test
"], +// referenceId: "1", +// position: "after", +// }); + +// executor.executeOne({ +// // @ts-expect-error +// type: "update", +// blocks: ["test
"], +// referenceId: "1", +// position: "after", +// }); + +// executor.executeOne({ +// type: "add", +// // @ts-expect-error +// blocks: [{ type: "paragraph", content: "test" }], +// referenceId: "1", +// position: "after", +// }); +// }); +// }); diff --git a/packages/xl-ai/src/api/formats/html-document/htmlDocument.ts b/packages/xl-ai/src/api/formats/html-document/htmlDocument.ts new file mode 100644 index 0000000000..5de6e1b347 --- /dev/null +++ b/packages/xl-ai/src/api/formats/html-document/htmlDocument.ts @@ -0,0 +1,52 @@ +import { BlockNoteEditor } from "@blocknote/core"; +import { AIRequest } from "../../aiRequest/types.js"; +import { StreamToolsConfig, StreamToolsProvider } from "../formats.js"; +import { replaceTool } from "./tools/index.js"; + +const systemPrompt = `You are manipulating a text document using TSX components. +Each block is represented as a TSX component with props. +`; + +type BlockRange = { + start: number; + end: number; +}; + +export async function exportHtmlDocument(editor: BlockNoteEditor) { + const separator = "\n"; + const blockRanges: Mapconsole.log('hello world')\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\";\\\\\\\"}]\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"\\\"}\"} }\n\nevent: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0 }\n\nevent: message_delta\ndata: {\"type\":\"message_delta\",\"delta\":{\"stop_reason\":\"tool_use\",\"stop_sequence\":null},\"usage\":{\"input_tokens\":885,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":181} }\n\nevent: message_stop\ndata: {\"type\":\"message_stop\" }\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/anthropic.messages/claude-haiku-4-5 (streaming)/add a list (end)_1_7186aca370a3afe374b48437113f0f78.json b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/anthropic.messages/claude-haiku-4-5 (streaming)/add a list (end)_1_7186aca370a3afe374b48437113f0f78.json
new file mode 100644
index 0000000000..d4cbb27de5
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/anthropic.messages/claude-haiku-4-5 (streaming)/add a list (end)_1_7186aca370a3afe374b48437113f0f78.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://api.anthropic.com/v1/messages",
+ "body": "{\"model\":\"claude-haiku-4-5\",\"max_tokens\":64000,\"system\":[{\"type\":\"text\",\"text\":\"You are manipulating a text document using TSX components.\\nEach block is represented as a TSX component with props.\\n\"}],\"messages\":[{\"role\":\"assistant\",\"content\":[{\"type\":\"text\",\"text\":\"There is no active selection. This is the latest state of the document (ignore previous documents, you MUST issue operations against this latest version of the document). \\nThe cursor is BETWEEN two blocks as indicated by cursor: true.\\nPrefer updating existing blocks over removing and adding (but this also depends on the user's question).\"},{\"type\":\"text\",\"text\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"Hello, world! \\\"},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"How are you? \\\"}]\"}]},{\"role\":\"user\",\"content\":[{\"type\":\"text\",\"text\":\"add a list with the items 'Apples' and 'Bananas' after the last sentence\"}]}],\"tools\":[{\"name\":\"file_replace\",\"input_schema\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"]}}],\"tool_choice\":{\"type\":\"any\"},\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"model\":\"claude-haiku-4-5-20251001\",\"id\":\"msg_011e2khqh8KN1w3fWG6H3svm\",\"type\":\"message\",\"role\":\"assistant\",\"content\":[],\"stop_reason\":null,\"stop_sequence\":null,\"usage\":{\"input_tokens\":871,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"cache_creation\":{\"ephemeral_5m_input_tokens\":0,\"ephemeral_1h_input_tokens\":0},\"output_tokens\":8,\"service_tier\":\"standard\",\"inference_geo\":\"not_available\"}} }\n\nevent: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"tool_use\",\"id\":\"toolu_01WYgx3eCAy62R322AiJpqmM\",\"name\":\"file_replace\",\"input\":{}} }\n\nevent: ping\ndata: {\"type\": \"ping\"}\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"{\\\"target\\\": \\\"{\\\\\\\"\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"cursor\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"\\\\\\\":\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"true},\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"{\\\\\\\"id\\\\\\\":\\\\\\\"ref2$\\\\\\\",\\\\\\\"block\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"\\\\\\\":\\\\\\\"How\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\" are you? \\\\\\\"\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"}\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"\\\", \\\"replacement\\\": \\\"{\\\\\\\"id\\\\\\\":\\\\\\\"ref2$\\\\\\\",\\\\\\\"block\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"\\\\\\\":\\\\\\\"How\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\" are you? \"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"\\\\\\\"},\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"{\\\\\\\"cursor\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"\\\\\\\":true},{\\\\\\\"id\\\\\\\":\\\\\\\"ref3\"}}\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"$\\\\\\\",\\\\\\\"block\\\\\\\":\\\\\\\"\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"Apples
Bananas\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\" \\\\\\\"}\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"\\\"}\"} }\n\nevent: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0 }\n\nevent: message_delta\ndata: {\"type\":\"message_delta\",\"delta\":{\"stop_reason\":\"tool_use\",\"stop_sequence\":null},\"usage\":{\"input_tokens\":871,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":160}}\n\nevent: message_stop\ndata: {\"type\":\"message_stop\" }\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/anthropic.messages/claude-haiku-4-5 (streaming)/add a new paragraph (empty doc)_1_6e45e8b483018781d3a347f0e2ecd1e9.json b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/anthropic.messages/claude-haiku-4-5 (streaming)/add a new paragraph (empty doc)_1_6e45e8b483018781d3a347f0e2ecd1e9.json
new file mode 100644
index 0000000000..d4c3cd555f
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/anthropic.messages/claude-haiku-4-5 (streaming)/add a new paragraph (empty doc)_1_6e45e8b483018781d3a347f0e2ecd1e9.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://api.anthropic.com/v1/messages",
+ "body": "{\"model\":\"claude-haiku-4-5\",\"max_tokens\":64000,\"system\":[{\"type\":\"text\",\"text\":\"You are manipulating a text document using TSX components.\\nEach block is represented as a TSX component with props.\\n\"}],\"messages\":[{\"role\":\"assistant\",\"content\":[{\"type\":\"text\",\"text\":\"There is no active selection. This is the latest state of the document (ignore previous documents, you MUST issue operations against this latest version of the document). \\nThe cursor is BETWEEN two blocks as indicated by cursor: true.\\nBecause the document is empty, YOU MUST first update the empty block before adding new blocks.\"},{\"type\":\"text\",\"text\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\" \\\"},{\\\"cursor\\\":true}]\"}]},{\"role\":\"user\",\"content\":[{\"type\":\"text\",\"text\":\"write a new paragraph with the text 'You look great today!'\"}]}],\"tools\":[{\"name\":\"file_replace\",\"input_schema\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"]}}],\"tool_choice\":{\"type\":\"any\"},\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"model\":\"claude-haiku-4-5-20251001\",\"id\":\"msg_01EVFNNz3p4hLmXVwKxMcC4W\",\"type\":\"message\",\"role\":\"assistant\",\"content\":[],\"stop_reason\":null,\"stop_sequence\":null,\"usage\":{\"input_tokens\":821,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"cache_creation\":{\"ephemeral_5m_input_tokens\":0,\"ephemeral_1h_input_tokens\":0},\"output_tokens\":8,\"service_tier\":\"standard\",\"inference_geo\":\"not_available\"}} }\n\nevent: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"tool_use\",\"id\":\"toolu_0151JMd9GCEJiJDqxLABWKkt\",\"name\":\"file_replace\",\"input\":{}} }\n\nevent: ping\ndata: {\"type\": \"ping\"}\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"{\\\"target\\\": \\\" \"}}\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"\\\", \\\"replacement\\\": \\\"\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"You look great today! \"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"\\\"}\"} }\n\nevent: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0 }\n\nevent: message_delta\ndata: {\"type\":\"message_delta\",\"delta\":{\"stop_reason\":\"tool_use\",\"stop_sequence\":null},\"usage\":{\"input_tokens\":821,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":84} }\n\nevent: message_stop\ndata: {\"type\":\"message_stop\" }\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/anthropic.messages/claude-haiku-4-5 (streaming)/add a new paragraph (end)_1_a41c115e1597d0b4c3ba7be11ad1970f.json b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/anthropic.messages/claude-haiku-4-5 (streaming)/add a new paragraph (end)_1_a41c115e1597d0b4c3ba7be11ad1970f.json
new file mode 100644
index 0000000000..d012451b17
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/anthropic.messages/claude-haiku-4-5 (streaming)/add a new paragraph (end)_1_a41c115e1597d0b4c3ba7be11ad1970f.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://api.anthropic.com/v1/messages",
+ "body": "{\"model\":\"claude-haiku-4-5\",\"max_tokens\":64000,\"system\":[{\"type\":\"text\",\"text\":\"You are manipulating a text document using TSX components.\\nEach block is represented as a TSX component with props.\\n\"}],\"messages\":[{\"role\":\"assistant\",\"content\":[{\"type\":\"text\",\"text\":\"There is no active selection. This is the latest state of the document (ignore previous documents, you MUST issue operations against this latest version of the document). \\nThe cursor is BETWEEN two blocks as indicated by cursor: true.\\nPrefer updating existing blocks over removing and adding (but this also depends on the user's question).\"},{\"type\":\"text\",\"text\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"Hello, world! \\\"},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"How are you? \\\"}]\"}]},{\"role\":\"user\",\"content\":[{\"type\":\"text\",\"text\":\"add a new paragraph with the text 'You look great today!' after the last sentence\"}]}],\"tools\":[{\"name\":\"file_replace\",\"input_schema\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"]}}],\"tool_choice\":{\"type\":\"any\"},\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"model\":\"claude-haiku-4-5-20251001\",\"id\":\"msg_018BtL8NgPYCvYzb9J8izG1d\",\"type\":\"message\",\"role\":\"assistant\",\"content\":[],\"stop_reason\":null,\"stop_sequence\":null,\"usage\":{\"input_tokens\":866,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"cache_creation\":{\"ephemeral_5m_input_tokens\":0,\"ephemeral_1h_input_tokens\":0},\"output_tokens\":8,\"service_tier\":\"standard\",\"inference_geo\":\"not_available\"}} }\n\nevent: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"tool_use\",\"id\":\"toolu_018k5nLvPT9TqfCqvuuvLGH8\",\"name\":\"file_replace\",\"input\":{}} }\n\nevent: ping\ndata: {\"type\": \"ping\"}\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"{\\\"target\\\": \\\"{\\\\\\\"\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"id\\\\\\\":\\\\\\\"ref2$\\\\\\\",\\\\\\\"block\\\\\\\":\\\\\\\"\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"How are\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\" you? \"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"\\\\\\\"}]\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"\\\", \\\"replacement\\\": \\\"{\\\\\\\"\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"i\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"d\\\\\\\":\\\\\\\"ref2$\\\\\\\",\\\\\\\"block\\\\\\\":\\\\\\\"\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"How\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\" are you? \\\\\\\"},\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"{\\\\\\\"\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"i\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"d\\\\\\\":\\\\\\\"ref3\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"$\\\\\\\",\\\\\\\"block\\\\\\\":\\\\\\\"You look great today!\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\" \\\\\\\"}]\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"\\\"}\"} }\n\nevent: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0 }\n\nevent: message_delta\ndata: {\"type\":\"message_delta\",\"delta\":{\"stop_reason\":\"tool_use\",\"stop_sequence\":null},\"usage\":{\"input_tokens\":866,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":151} }\n\nevent: message_stop\ndata: {\"type\":\"message_stop\" }\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/anthropic.messages/claude-haiku-4-5 (streaming)/add a new paragraph (start)_1_f9cbba2f713396cd771b29b3b25361f7.json b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/anthropic.messages/claude-haiku-4-5 (streaming)/add a new paragraph (start)_1_f9cbba2f713396cd771b29b3b25361f7.json
new file mode 100644
index 0000000000..fbc00d0986
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/anthropic.messages/claude-haiku-4-5 (streaming)/add a new paragraph (start)_1_f9cbba2f713396cd771b29b3b25361f7.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://api.anthropic.com/v1/messages",
+ "body": "{\"model\":\"claude-haiku-4-5\",\"max_tokens\":64000,\"system\":[{\"type\":\"text\",\"text\":\"You are manipulating a text document using TSX components.\\nEach block is represented as a TSX component with props.\\n\"}],\"messages\":[{\"role\":\"assistant\",\"content\":[{\"type\":\"text\",\"text\":\"There is no active selection. This is the latest state of the document (ignore previous documents, you MUST issue operations against this latest version of the document). \\nThe cursor is BETWEEN two blocks as indicated by cursor: true.\\nPrefer updating existing blocks over removing and adding (but this also depends on the user's question).\"},{\"type\":\"text\",\"text\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"Hello, world! \\\"},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"How are you? \\\"}]\"}]},{\"role\":\"user\",\"content\":[{\"type\":\"text\",\"text\":\"add a new paragraph with the text 'You look great today!' before the first sentence\"}]}],\"tools\":[{\"name\":\"file_replace\",\"input_schema\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"]}}],\"tool_choice\":{\"type\":\"any\"},\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"model\":\"claude-haiku-4-5-20251001\",\"id\":\"msg_01GvHG7azydUesGYkaTipCwW\",\"type\":\"message\",\"role\":\"assistant\",\"content\":[],\"stop_reason\":null,\"stop_sequence\":null,\"usage\":{\"input_tokens\":866,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"cache_creation\":{\"ephemeral_5m_input_tokens\":0,\"ephemeral_1h_input_tokens\":0},\"output_tokens\":8,\"service_tier\":\"standard\",\"inference_geo\":\"not_available\"}} }\n\nevent: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"tool_use\",\"id\":\"toolu_01FoQQu5Ti4nZCgi2XZtaFqj\",\"name\":\"file_replace\",\"input\":{}} }\n\nevent: ping\ndata: {\"type\": \"ping\"}\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"\"}}\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"{\\\"target\\\": \\\"{\\\\\\\"\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"id\\\\\\\":\\\\\\\"ref1$\\\\\\\",\\\\\\\"block\\\\\\\":\\\\\\\"\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"Hello\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\", world! \"}}\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"\\\\\\\"},\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"{\\\\\\\"cursor\\\\\\\":true},{\\\\\\\"id\\\\\\\":\\\\\\\"\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"ref2$\\\\\\\",\\\\\\\"block\\\\\\\":\\\\\\\"\"}}\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"How are you?\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\" \\\\\\\"}]\"}}\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"\\\", \\\"replacement\\\": \\\"{\\\\\\\"\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"i\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"d\\\\\\\":\\\\\\\"ref0\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"$\\\\\\\",\\\\\\\"block\\\\\\\":\\\\\\\"You look great today!\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\" \\\\\\\"},\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"{\\\\\\\"i\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"d\\\\\\\":\\\\\\\"ref1$\\\\\\\",\\\\\\\"block\\\\\\\":\\\\\\\"\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"Hello, worl\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"d! \\\\\\\"},\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"{\\\\\\\"cursor\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"\\\\\\\":true},{\\\\\\\"id\\\\\\\":\\\\\\\"ref2\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"$\\\\\\\",\\\\\\\"block\\\\\\\":\\\\\\\"How are you?\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\" \\\\\\\"}]\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"\\\"}\"} }\n\nevent: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0 }\n\nevent: message_delta\ndata: {\"type\":\"message_delta\",\"delta\":{\"stop_reason\":\"tool_use\",\"stop_sequence\":null},\"usage\":{\"input_tokens\":866,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":223} }\n\nevent: message_stop\ndata: {\"type\":\"message_stop\" }\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/Add heading (h1) and code block_1_b65a8b07cf1a374240984e655186c51b.json b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/Add heading (h1) and code block_1_b65a8b07cf1a374240984e655186c51b.json
new file mode 100644
index 0000000000..8c4bac59c6
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/Add heading (h1) and code block_1_b65a8b07cf1a374240984e655186c51b.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://api.groq.com/openai/v1/chat/completions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"messages\":[{\"role\":\"system\",\"content\":\"You are manipulating a text document using TSX components.\\nEach block is represented as a TSX component with props.\\n\"},{\"role\":\"assistant\",\"content\":\"There is no active selection. This is the latest state of the document (ignore previous documents, you MUST issue operations against this latest version of the document). \\nThe cursor is BETWEEN two blocks as indicated by cursor: true.\\nPrefer updating existing blocks over removing and adding (but this also depends on the user's question).[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"Hello, world! \\\"},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"How are you? \\\"}]\"},{\"role\":\"user\",\"content\":\"at the end of doc, add a h1 heading `Code` and a javascript code block (block, not inline style) with `console.log('hello world');`\"}],\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"]}}}],\"tool_choice\":\"required\",\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-f32d16e6-7a45-470a-80be-10c721257efb\",\"object\":\"chat.completion.chunk\",\"created\":1770919629,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_f8b414701e\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null},\"logprobs\":null,\"finish_reason\":null}],\"x_groq\":{\"id\":\"req_01kh9gj4wke728vksgsjx8kayx\",\"seed\":1545225693}}\n\ndata: {\"id\":\"chatcmpl-f32d16e6-7a45-470a-80be-10c721257efb\",\"object\":\"chat.completion.chunk\",\"created\":1770919629,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_f8b414701e\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"id\":\"a6x4mdefz\",\"type\":\"function\",\"function\":{\"name\":\"file_replace\",\"arguments\":\"{\\\"replacement\\\":\\\"\\\\u003cHeading1 id=\\\\\\\"ref3\\\\\\\"\\\\u003eCode\\\\u003c/Heading1\\\\u003e\\\\u003cCodeBlock id=\\\\\\\"ref4\\\\\\\"\\\\u003econsole.log('hello world');\\\\n\\\\u003c/CodeBlock\\\\u003e\\\",\\\"target\\\":\\\"\\\"}\"},\"index\":0}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-f32d16e6-7a45-470a-80be-10c721257efb\",\"object\":\"chat.completion.chunk\",\"created\":1770919629,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_f8b414701e\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"x_groq\":{\"id\":\"req_01kh9gj4wke728vksgsjx8kayx\",\"usage\":{\"queue_time\":0.04742317,\"prompt_tokens\":425,\"prompt_time\":0.028595065,\"completion_tokens\":45,\"completion_time\":0.20616259,\"total_tokens\":470,\"total_time\":0.234757655}},\"usage\":{\"queue_time\":0.04742317,\"prompt_tokens\":425,\"prompt_time\":0.028595065,\"completion_tokens\":45,\"completion_time\":0.20616259,\"total_tokens\":470,\"total_time\":0.234757655}}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/add a list (end)_1_4a3ac5fc2174f5d75a80e1df795607a7.json b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/add a list (end)_1_4a3ac5fc2174f5d75a80e1df795607a7.json
new file mode 100644
index 0000000000..b3c9bf24eb
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/add a list (end)_1_4a3ac5fc2174f5d75a80e1df795607a7.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://api.groq.com/openai/v1/chat/completions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"messages\":[{\"role\":\"system\",\"content\":\"You are manipulating a text document using TSX components.\\nEach block is represented as a TSX component with props.\\n\"},{\"role\":\"assistant\",\"content\":\"There is no active selection. This is the latest state of the document (ignore previous documents, you MUST issue operations against this latest version of the document). \\nThe cursor is BETWEEN two blocks as indicated by cursor: true.\\nPrefer updating existing blocks over removing and adding (but this also depends on the user's question).[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"Hello, world! \\\"},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"How are you? \\\"}]\"},{\"role\":\"user\",\"content\":\"add a list with the items 'Apples' and 'Bananas' after the last sentence\"}],\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"]}}}],\"tool_choice\":\"required\",\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-2c1ff5ae-1fda-4bce-b19a-1d18018e6e3a\",\"object\":\"chat.completion.chunk\",\"created\":1770919629,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_68f543a7cc\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null},\"logprobs\":null,\"finish_reason\":null}],\"x_groq\":{\"id\":\"req_01kh9gj4kse72ad3sama4900ny\",\"seed\":977938030}}\n\ndata: {\"id\":\"chatcmpl-2c1ff5ae-1fda-4bce-b19a-1d18018e6e3a\",\"object\":\"chat.completion.chunk\",\"created\":1770919629,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_68f543a7cc\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"id\":\"y02yzcxma\",\"type\":\"function\",\"function\":{\"name\":\"file_replace\",\"arguments\":\"{\\\"replacement\\\":\\\"\\\\u003c/Paragraph\\\\u003e\\\\u003cList id='ref3'\\\\u003e\\\\u003cListItem\\\\u003eApples\\\\u003c/ListItem\\\\u003e\\\\u003cListItem\\\\u003eBananas\\\\u003c/ListItem\\\\u003e\\\\u003c/List\\\\u003e\\\",\\\"target\\\":\\\"\\\\u003c/Paragraph\\\\u003e\\\"}\"},\"index\":0}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-2c1ff5ae-1fda-4bce-b19a-1d18018e6e3a\",\"object\":\"chat.completion.chunk\",\"created\":1770919629,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_68f543a7cc\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"x_groq\":{\"id\":\"req_01kh9gj4kse72ad3sama4900ny\",\"usage\":{\"queue_time\":0.090337779,\"prompt_tokens\":409,\"prompt_time\":0.023149621,\"completion_tokens\":40,\"completion_time\":0.132428746,\"total_tokens\":449,\"total_time\":0.155578367}},\"usage\":{\"queue_time\":0.090337779,\"prompt_tokens\":409,\"prompt_time\":0.023149621,\"completion_tokens\":40,\"completion_time\":0.132428746,\"total_tokens\":449,\"total_time\":0.155578367}}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/add a new paragraph (end)_1_0cda7a8a40522e986020c58441a47c8f.json b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/add a new paragraph (end)_1_0cda7a8a40522e986020c58441a47c8f.json
new file mode 100644
index 0000000000..15afc18dcf
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/add a new paragraph (end)_1_0cda7a8a40522e986020c58441a47c8f.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://api.groq.com/openai/v1/chat/completions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"messages\":[{\"role\":\"system\",\"content\":\"You are manipulating a text document using TSX components.\\nEach block is represented as a TSX component with props.\\n\"},{\"role\":\"assistant\",\"content\":\"There is no active selection. This is the latest state of the document (ignore previous documents, you MUST issue operations against this latest version of the document). \\nThe cursor is BETWEEN two blocks as indicated by cursor: true.\\nPrefer updating existing blocks over removing and adding (but this also depends on the user's question).[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"Hello, world! \\\"},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"How are you? \\\"}]\"},{\"role\":\"user\",\"content\":\"add a new paragraph with the text 'You look great today!' after the last sentence\"}],\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"]}}}],\"tool_choice\":\"required\",\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "event: error\ndata: {\"error\":{\"message\":\"Failed to call a function. Please adjust your prompt. See 'failed_generation' for more details.\",\"type\":\"invalid_request_error\",\"code\":\"tool_use_failed\",\"failed_generation\":\"\\u003cfunction=file_replace\\u003e{\\\"target\\\":\\\"{\\\"id\\\\\\\":\\\\\\\"ref2$\\\\\\\",\\\\\\\"block\\\\\\\":\\\\\\\"\\u003cParagraph textAlignment=\\\\\\\"left\\\\\\\" id=\\\\\\\"ref2\\\\\\\"\\u003eHow are you?\\u003c/Paragraph\\u003e\\\\\\\"}\\\",\\\"replacement\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"ref2$\\\\\\\",\\\\\\\"block\\\\\\\":\\\\\\\"\\u003cParagraph textAlignment=\\\\\\\"left\\\\\\\" id=\\\\\\\"ref2\\\\\\\"\\u003eHow are you?\\u003c/Paragraph\\u003e\\\\\\\"},{\\\\\\\"id\\\\\\\":\\\\\\\"ref3$\\\\\\\",\\\\\\\"block\\\\\\\":\\\\\\\"\\u003cParagraph textAlignment=\\\\\\\"left\\\\\\\" id=\\\\\\\"ref3\\\\\\\"\\u003eYou look great today!\\u003c/Paragraph\\u003e\\\\\\\"}\\\"}\\u003c/function\\u003e\",\"status_code\":400}}\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/add a new paragraph (start)_1_97b771b47141baec64b6b31c7bd0870b.json b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/add a new paragraph (start)_1_97b771b47141baec64b6b31c7bd0870b.json
new file mode 100644
index 0000000000..0cbb8d76a6
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/add a new paragraph (start)_1_97b771b47141baec64b6b31c7bd0870b.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://api.groq.com/openai/v1/chat/completions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"messages\":[{\"role\":\"system\",\"content\":\"You are manipulating a text document using TSX components.\\nEach block is represented as a TSX component with props.\\n\"},{\"role\":\"assistant\",\"content\":\"There is no active selection. This is the latest state of the document (ignore previous documents, you MUST issue operations against this latest version of the document). \\nThe cursor is BETWEEN two blocks as indicated by cursor: true.\\nPrefer updating existing blocks over removing and adding (but this also depends on the user's question).[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"Hello, world! \\\"},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"How are you? \\\"}]\"},{\"role\":\"user\",\"content\":\"add a new paragraph with the text 'You look great today!' before the first sentence\"}],\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"]}}}],\"tool_choice\":\"required\",\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-7d0d5608-026e-4d06-bcff-0067b276fb13\",\"object\":\"chat.completion.chunk\",\"created\":1770919629,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_68f543a7cc\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null},\"logprobs\":null,\"finish_reason\":null}],\"x_groq\":{\"id\":\"req_01kh9gj3tyej2sg8krrqkmx86f\",\"seed\":1564233627}}\n\ndata: {\"id\":\"chatcmpl-7d0d5608-026e-4d06-bcff-0067b276fb13\",\"object\":\"chat.completion.chunk\",\"created\":1770919629,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_68f543a7cc\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"id\":\"d108gk1dg\",\"type\":\"function\",\"function\":{\"name\":\"file_replace\",\"arguments\":\"{\\\"replacement\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"ref3$\\\\\\\",\\\\\\\"block\\\\\\\":\\\\\\\"\\\\u003cParagraph textAlignment=\\\\\\\\\\\\\\\"left\\\\\\\\\\\\\\\" id=\\\\\\\\\\\\\\\"ref3\\\\\\\\\\\\\\\"\\\\u003eYou look great today!\\\\u003c/Paragraph\\\\u003e\\\\\\\",\\\\\\\"cursor\\\\\\\":true},{\\\\\\\"id\\\\\\\":\\\\\\\"ref1$\\\\\\\",\\\\\\\"block\\\\\\\":\\\\\\\"\\\\u003cParagraph textAlignment=\\\\\\\\\\\\\\\"left\\\\\\\\\\\\\\\" id=\\\\\\\\\\\\\\\"ref1\\\\\\\\\\\\\\\"\\\\u003eHello, world!\\\\u003c/Paragraph\\\\u003e\\\\\\\"}\\\",\\\"target\\\":\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"ref1$\\\\\\\",\\\\\\\"block\\\\\\\":\\\\\\\"\\\\u003cParagraph textAlignment=\\\\\\\"left\\\\\\\" id=\\\\\\\"ref1\\\\\\\"\\\\u003eHello, world!\\\\u003c/Paragraph\\\\u003e\\\\\\\"}\\\"}\"},\"index\":0}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-7d0d5608-026e-4d06-bcff-0067b276fb13\",\"object\":\"chat.completion.chunk\",\"created\":1770919629,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_68f543a7cc\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"x_groq\":{\"id\":\"req_01kh9gj3tyej2sg8krrqkmx86f\",\"usage\":{\"queue_time\":0.089463724,\"prompt_tokens\":407,\"prompt_time\":0.02109889,\"completion_tokens\":116,\"completion_time\":0.267260918,\"total_tokens\":523,\"total_time\":0.288359808}},\"usage\":{\"queue_time\":0.089463724,\"prompt_tokens\":407,\"prompt_time\":0.02109889,\"completion_tokens\":116,\"completion_time\":0.267260918,\"total_tokens\":523,\"total_time\":0.288359808}}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/Add heading (h1) and code block_1_8df4b339961b2bacbf3b6d5462971369.json b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/Add heading (h1) and code block_1_8df4b339961b2bacbf3b6d5462971369.json
new file mode 100644
index 0000000000..b1962c2045
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/Add heading (h1) and code block_1_8df4b339961b2bacbf3b6d5462971369.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://api.openai.com/v1/responses",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"input\":[{\"role\":\"system\",\"content\":\"You are manipulating a text document using TSX components.\\nEach block is represented as a TSX component with props.\\n\"},{\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"There is no active selection. This is the latest state of the document (ignore previous documents, you MUST issue operations against this latest version of the document). \\nThe cursor is BETWEEN two blocks as indicated by cursor: true.\\nPrefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}]},{\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"Hello, world! \\\"},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"How are you? \\\"}]\"}]},{\"role\":\"user\",\"content\":[{\"type\":\"input_text\",\"text\":\"at the end of doc, add a h1 heading `Code` and a javascript code block (block, not inline style) with `console.log('hello world');`\"}]}],\"tools\":[{\"type\":\"function\",\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"]}}],\"tool_choice\":\"required\",\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "event: response.created\ndata: {\"type\":\"response.created\",\"response\":{\"id\":\"resp_0cee5a0926145aa800698e16c3fcc48196a11e78bc96dd4def\",\"object\":\"response\",\"created_at\":1770919620,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"],\"additionalProperties\":false},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":0}\n\nevent: response.in_progress\ndata: {\"type\":\"response.in_progress\",\"response\":{\"id\":\"resp_0cee5a0926145aa800698e16c3fcc48196a11e78bc96dd4def\",\"object\":\"response\",\"created_at\":1770919620,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"],\"additionalProperties\":false},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":1}\n\nevent: response.output_item.added\ndata: {\"type\":\"response.output_item.added\",\"item\":{\"id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"type\":\"function_call\",\"status\":\"in_progress\",\"arguments\":\"\",\"call_id\":\"call_gMJZ6dVgSlmt8CigBLaUbkqX\",\"name\":\"file_replace\"},\"output_index\":0,\"sequence_number\":2}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"{\\\"\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"sjqXVVDwKVRf8J\",\"output_index\":0,\"sequence_number\":3}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"target\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"od2944zQwy\",\"output_index\":0,\"sequence_number\":4}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\\\"\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"6mhYpDM1zB6XN\",\"output_index\":0,\"sequence_number\":5}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"pVSox7lopAhSlT\",\"output_index\":0,\"sequence_number\":6}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"zzKsgeU\",\"output_index\":0,\"sequence_number\":7}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\">]\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"qJ2Q3aQgz4wbi1\",\"output_index\":0,\"sequence_number\":8}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\",\\\"\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"Y9gby912DbmMY\",\"output_index\":0,\"sequence_number\":9}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"replacement\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"5qtSh\",\"output_index\":0,\"sequence_number\":10}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\\\"\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"oKbIB28ARONnQ\",\"output_index\":0,\"sequence_number\":11}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"7I3V4gj3yeVYFi\",\"output_index\":0,\"sequence_number\":12}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"kRmJkOR\",\"output_index\":0,\"sequence_number\":13}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\">,\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"KAEOP4oi4W2u9g\",\"output_index\":0,\"sequence_number\":14}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" {\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"bbhc3YCsEgt4aA\",\"output_index\":0,\"sequence_number\":15}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\"\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"pITv3IVWaUxaDF\",\"output_index\":0,\"sequence_number\":16}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"id\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"e53Jpxk2R6jDdb\",\"output_index\":0,\"sequence_number\":17}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\":\\\\\\\"\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"9tDyLvS1WKF\",\"output_index\":0,\"sequence_number\":18}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"ref\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"2rosmamkIJGyl\",\"output_index\":0,\"sequence_number\":19}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"3\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"kBD8CRCNs8CQ8g4\",\"output_index\":0,\"sequence_number\":20}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"$\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"sRLPI5LODfrnSr1\",\"output_index\":0,\"sequence_number\":21}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\",\\\\\\\"\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"i3K2aasWre0\",\"output_index\":0,\"sequence_number\":22}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"block\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"nuqFYlV4BBJ\",\"output_index\":0,\"sequence_number\":23}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\":\\\\\\\"\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"IjR9gXCdL48\",\"output_index\":0,\"sequence_number\":24}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"<\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"ja5gqwJe0LtX6E5\",\"output_index\":0,\"sequence_number\":25}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Heading\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"CbGfgpYjo\",\"output_index\":0,\"sequence_number\":26}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" level\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"jnOuIUJJfG\",\"output_index\":0,\"sequence_number\":27}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"PN5IsqE1YPimqWR\",\"output_index\":0,\"sequence_number\":28}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\\\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"g28nxK5cRRG27C\",\"output_index\":0,\"sequence_number\":29}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\"\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"7oGmKgGGKoFhS5\",\"output_index\":0,\"sequence_number\":30}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"1\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"96zTMIXzxyzE2Pw\",\"output_index\":0,\"sequence_number\":31}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\\\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"2vRlKQtYdMeyMu\",\"output_index\":0,\"sequence_number\":32}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\"\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"5Vuw8c7ZBeSYu0\",\"output_index\":0,\"sequence_number\":33}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" id\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"yBXoqFwn7yXao\",\"output_index\":0,\"sequence_number\":34}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"9xI68kkg6U7ODV5\",\"output_index\":0,\"sequence_number\":35}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\\\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"v1acLo3nxx6Qxr\",\"output_index\":0,\"sequence_number\":36}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\"\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"SLWitY3sTFkF5Y\",\"output_index\":0,\"sequence_number\":37}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"ref\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"TeR4sPzYiTyDh\",\"output_index\":0,\"sequence_number\":38}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"3\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"MX0g7TikEYVDUKD\",\"output_index\":0,\"sequence_number\":39}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\\\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"XHgUFMl0DtQNgi\",\"output_index\":0,\"sequence_number\":40}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\">\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"c9cgVd4N72tD1\",\"output_index\":0,\"sequence_number\":41}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Code\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"gT66D9BxoE9K\",\"output_index\":0,\"sequence_number\":42}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"pZDZVBRFoHZKgm\",\"output_index\":0,\"sequence_number\":43}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Heading\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"sW6aTPW5a\",\"output_index\":0,\"sequence_number\":44}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\">\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"mgvgWP2Uu83s5NJ\",\"output_index\":0,\"sequence_number\":45}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\"\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"5mjKf87lBU4cTe\",\"output_index\":0,\"sequence_number\":46}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"},\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"CAWJlB0r8WlA1v\",\"output_index\":0,\"sequence_number\":47}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" {\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"axWDO85liaeCKR\",\"output_index\":0,\"sequence_number\":48}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\"\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"kRlSts1KdsEGAc\",\"output_index\":0,\"sequence_number\":49}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"id\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"j18u46cX0a3lcG\",\"output_index\":0,\"sequence_number\":50}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\":\\\\\\\"\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"zyE0AWRAekJ\",\"output_index\":0,\"sequence_number\":51}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"ref\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"EPgcyV2vbnx1z\",\"output_index\":0,\"sequence_number\":52}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"4\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"rdx4Ax7jZfgjq7P\",\"output_index\":0,\"sequence_number\":53}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"$\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"5h0T8AXeAhIxJEm\",\"output_index\":0,\"sequence_number\":54}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\",\\\\\\\"\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"8x96gLL7yjY\",\"output_index\":0,\"sequence_number\":55}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"block\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"eS7HUmJB7XJ\",\"output_index\":0,\"sequence_number\":56}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\":\\\\\\\"\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"CqxnqSAOcoN\",\"output_index\":0,\"sequence_number\":57}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"<\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"W1j747Qdfx7sGOn\",\"output_index\":0,\"sequence_number\":58}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Code\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"3YiTMhCTB9fG\",\"output_index\":0,\"sequence_number\":59}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Block\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"E1WFlbPMyPN\",\"output_index\":0,\"sequence_number\":60}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" id\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"K1MQZpHu03REH\",\"output_index\":0,\"sequence_number\":61}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"pHsxgoWMivtOj00\",\"output_index\":0,\"sequence_number\":62}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\\\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"K6XrXXS8Zqw6d8\",\"output_index\":0,\"sequence_number\":63}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\"\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"c6NBYTn24LRWrW\",\"output_index\":0,\"sequence_number\":64}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"ref\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"lEWJYA69J79L8\",\"output_index\":0,\"sequence_number\":65}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"4\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"gvWywdtuI4VT3B9\",\"output_index\":0,\"sequence_number\":66}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\\\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"7B0KuxhCcI1GdT\",\"output_index\":0,\"sequence_number\":67}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\">\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"OIvmBlR6VHqoG\",\"output_index\":0,\"sequence_number\":68}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"console\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"6Wf38Ln1Q\",\"output_index\":0,\"sequence_number\":69}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\".log\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"gLD3LQMumMPP\",\"output_index\":0,\"sequence_number\":70}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"('\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"CX3fCFf12bP7Kg\",\"output_index\":0,\"sequence_number\":71}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"hello\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"Fy0ENJTbFxp\",\"output_index\":0,\"sequence_number\":72}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" world\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"gpj6OGxkim\",\"output_index\":0,\"sequence_number\":73}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"');\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"BxS7EMRc0AVIi\",\"output_index\":0,\"sequence_number\":74}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"3Aue2HnErGLOSD\",\"output_index\":0,\"sequence_number\":75}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Code\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"LsV6c06t3SPN\",\"output_index\":0,\"sequence_number\":76}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Block\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"m6e0GLBrqB4\",\"output_index\":0,\"sequence_number\":77}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\">\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"hgc5MKtbNllEERe\",\"output_index\":0,\"sequence_number\":78}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\"\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"8jHAjJtDeWikZY\",\"output_index\":0,\"sequence_number\":79}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"}]\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"djB9aR7KAMLqm7\",\"output_index\":0,\"sequence_number\":80}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\"}\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"obfuscation\":\"Z7QjfSLzXTzfOe\",\"output_index\":0,\"sequence_number\":81}\n\nevent: response.function_call_arguments.done\ndata: {\"type\":\"response.function_call_arguments.done\",\"arguments\":\"{\\\"target\\\":\\\"]\\\",\\\"replacement\\\":\\\", {\\\\\\\"id\\\\\\\":\\\\\\\"ref3$\\\\\\\",\\\\\\\"block\\\\\\\":\\\\\\\"Code \\\\\\\"}, {\\\\\\\"id\\\\\\\":\\\\\\\"ref4$\\\\\\\",\\\\\\\"block\\\\\\\":\\\\\\\"console.log('hello world'); \\\\\\\"}]\\\"}\",\"item_id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"output_index\":0,\"sequence_number\":82}\n\nevent: response.output_item.done\ndata: {\"type\":\"response.output_item.done\",\"item\":{\"id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"type\":\"function_call\",\"status\":\"completed\",\"arguments\":\"{\\\"target\\\":\\\"]\\\",\\\"replacement\\\":\\\", {\\\\\\\"id\\\\\\\":\\\\\\\"ref3$\\\\\\\",\\\\\\\"block\\\\\\\":\\\\\\\"Code \\\\\\\"}, {\\\\\\\"id\\\\\\\":\\\\\\\"ref4$\\\\\\\",\\\\\\\"block\\\\\\\":\\\\\\\"console.log('hello world'); \\\\\\\"}]\\\"}\",\"call_id\":\"call_gMJZ6dVgSlmt8CigBLaUbkqX\",\"name\":\"file_replace\"},\"output_index\":0,\"sequence_number\":83}\n\nevent: response.completed\ndata: {\"type\":\"response.completed\",\"response\":{\"id\":\"resp_0cee5a0926145aa800698e16c3fcc48196a11e78bc96dd4def\",\"object\":\"response\",\"created_at\":1770919620,\"status\":\"completed\",\"background\":false,\"completed_at\":1770919622,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[{\"id\":\"fc_0cee5a0926145aa800698e16c48cd08196876ce5e336ad1780\",\"type\":\"function_call\",\"status\":\"completed\",\"arguments\":\"{\\\"target\\\":\\\"]\\\",\\\"replacement\\\":\\\", {\\\\\\\"id\\\\\\\":\\\\\\\"ref3$\\\\\\\",\\\\\\\"block\\\\\\\":\\\\\\\"Code \\\\\\\"}, {\\\\\\\"id\\\\\\\":\\\\\\\"ref4$\\\\\\\",\\\\\\\"block\\\\\\\":\\\\\\\"console.log('hello world'); \\\\\\\"}]\\\"}\",\"call_id\":\"call_gMJZ6dVgSlmt8CigBLaUbkqX\",\"name\":\"file_replace\"}],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"default\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"],\"additionalProperties\":false},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":{\"input_tokens\":248,\"input_tokens_details\":{\"cached_tokens\":0},\"output_tokens\":80,\"output_tokens_details\":{\"reasoning_tokens\":0},\"total_tokens\":328},\"user\":null,\"metadata\":{}},\"sequence_number\":84}\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/Add heading (h1) and code block_1_d7f3d589b85dc014d5f536b3f941f3b6.json b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/Add heading (h1) and code block_1_d7f3d589b85dc014d5f536b3f941f3b6.json
new file mode 100644
index 0000000000..bb01a006f5
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/Add heading (h1) and code block_1_d7f3d589b85dc014d5f536b3f941f3b6.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://api.openai.com/v1/responses",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"input\":[{\"role\":\"system\",\"content\":\"You are manipulating a text document using TSX components.\\nEach block is represented as a TSX component with props.\\n\"},{\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"There is no active selection. This is the latest state of the document (ignore previous documents, you MUST issue operations against this latest version of the document). \\nThe cursor is BETWEEN two blocks as indicated by cursor: true.\\nPrefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}]},{\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"{\\\"selection\\\":false,\\\"blocks\\\":[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"Hello, world! \\\"},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"How are you? \\\"}],\\\"isEmptyDocument\\\":false}\"}]},{\"role\":\"user\",\"content\":[{\"type\":\"input_text\",\"text\":\"at the end of doc, add a h1 heading `Code` and a javascript code block (block, not inline style) with `console.log('hello world');`\"}]}],\"tools\":[{\"type\":\"function\",\"name\":\"applyDocumentOperations\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Replace a part of the document file\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"file_replace\"]},\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"type\",\"target\",\"replacement\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"]}}],\"tool_choice\":\"required\",\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "event: response.created\ndata: {\"type\":\"response.created\",\"response\":{\"id\":\"resp_00c006ebd61e2f7c00698cd82516d081978ff6a25712665e2a\",\"object\":\"response\",\"created_at\":1770838053,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"applyDocumentOperations\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Replace a part of the document file\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"file_replace\"]},\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"type\",\"target\",\"replacement\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"]},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":0}\n\nevent: response.in_progress\ndata: {\"type\":\"response.in_progress\",\"response\":{\"id\":\"resp_00c006ebd61e2f7c00698cd82516d081978ff6a25712665e2a\",\"object\":\"response\",\"created_at\":1770838053,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"applyDocumentOperations\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Replace a part of the document file\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"file_replace\"]},\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"type\",\"target\",\"replacement\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"]},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":1}\n\nevent: response.output_item.added\ndata: {\"type\":\"response.output_item.added\",\"item\":{\"id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"type\":\"function_call\",\"status\":\"in_progress\",\"arguments\":\"\",\"call_id\":\"call_i6Od4VgwdP4pBxLLE1xkEAtf\",\"name\":\"applyDocumentOperations\"},\"output_index\":0,\"sequence_number\":2}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"{\\\"\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"6pqdVyFtBCIMwK\",\"output_index\":0,\"sequence_number\":3}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"operations\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"zpJt8G\",\"output_index\":0,\"sequence_number\":4}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":[\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"qOHGpeTSJVebY\",\"output_index\":0,\"sequence_number\":5}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"{\\\"\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"B6ZHvqzd9j8fDj\",\"output_index\":0,\"sequence_number\":6}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"type\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"VC7nctnZdmW1\",\"output_index\":0,\"sequence_number\":7}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\\\"\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"1hhbKEnHvHwgc\",\"output_index\":0,\"sequence_number\":8}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"file\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"f9TTU7ANegzo\",\"output_index\":0,\"sequence_number\":9}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"_replace\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"1oCuZJXJ\",\"output_index\":0,\"sequence_number\":10}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\",\\\"\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"4TIcqsFZkkNCT\",\"output_index\":0,\"sequence_number\":11}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"target\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"4KlRl8PVjT\",\"output_index\":0,\"sequence_number\":12}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\\\"\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"TJV4DJmQbTiGQ\",\"output_index\":0,\"sequence_number\":13}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"<\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"mpUNDGyRs8LIZeS\",\"output_index\":0,\"sequence_number\":14}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"GEELDXW\",\"output_index\":0,\"sequence_number\":15}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" text\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"C4bsANySWcn\",\"output_index\":0,\"sequence_number\":16}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Alignment\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"Opwr5y4\",\"output_index\":0,\"sequence_number\":17}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"w2ceOHrycgQiM\",\"output_index\":0,\"sequence_number\":18}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"left\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"x3a04ko5ZCeO\",\"output_index\":0,\"sequence_number\":19}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\"\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"FhNAJxGr61FryW\",\"output_index\":0,\"sequence_number\":20}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" id\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"QqsMOgA2HbXxM\",\"output_index\":0,\"sequence_number\":21}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"NOLB7EqYTDR3D\",\"output_index\":0,\"sequence_number\":22}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"ref\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"rSi7Urq67cwew\",\"output_index\":0,\"sequence_number\":23}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"2\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"8zxGHJqnA3ciBeN\",\"output_index\":0,\"sequence_number\":24}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\">\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"bOhJdUaSb7V5Y\",\"output_index\":0,\"sequence_number\":25}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"How\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"yDqmPSnrjiTmz\",\"output_index\":0,\"sequence_number\":26}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" are\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"TOP3wCSondHD\",\"output_index\":0,\"sequence_number\":27}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" you\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"Lx4RST3jAfq9\",\"output_index\":0,\"sequence_number\":28}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"?\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"KkDCptbZvQ8jz\",\"output_index\":0,\"sequence_number\":29}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"99ik7Bu\",\"output_index\":0,\"sequence_number\":30}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\">\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"1w8JM9BtXU6IZNt\",\"output_index\":0,\"sequence_number\":31}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\",\\\"\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"imBTLOHAGqvmG\",\"output_index\":0,\"sequence_number\":32}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"replacement\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"yP4WR\",\"output_index\":0,\"sequence_number\":33}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\\\"\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"0gMJmiOZ8zlDV\",\"output_index\":0,\"sequence_number\":34}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"<\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"dK3J8SU2eV1o0fa\",\"output_index\":0,\"sequence_number\":35}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"P2rQHwS\",\"output_index\":0,\"sequence_number\":36}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" text\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"WFpCfggSut9\",\"output_index\":0,\"sequence_number\":37}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Alignment\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"fvafVza\",\"output_index\":0,\"sequence_number\":38}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"762Srfob0tGPd\",\"output_index\":0,\"sequence_number\":39}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"left\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"9v8iikIsQmKX\",\"output_index\":0,\"sequence_number\":40}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\"\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"uXLGpICUAiSU5g\",\"output_index\":0,\"sequence_number\":41}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" id\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"Gcprvnsr8b3c8\",\"output_index\":0,\"sequence_number\":42}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"pXSW9a0s016Cm\",\"output_index\":0,\"sequence_number\":43}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"ref\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"j1qKYJepNbpdi\",\"output_index\":0,\"sequence_number\":44}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"2\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"jI0oKt0waGZPY45\",\"output_index\":0,\"sequence_number\":45}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\">\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"t7o6bP4ejCgFF\",\"output_index\":0,\"sequence_number\":46}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"How\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"KHmIvTc1ls6ZG\",\"output_index\":0,\"sequence_number\":47}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" are\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"BmmfcOu6Zy6e\",\"output_index\":0,\"sequence_number\":48}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" you\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"kRHCamnOJuvw\",\"output_index\":0,\"sequence_number\":49}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"?\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"lDCGv6LZVrFXl\",\"output_index\":0,\"sequence_number\":50}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"2KWxcMc\",\"output_index\":0,\"sequence_number\":51}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"><\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"bbYIwtbQMp4zRk\",\"output_index\":0,\"sequence_number\":52}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Heading\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"TUfKugUCj\",\"output_index\":0,\"sequence_number\":53}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" level\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"vpzgGAZ4MF\",\"output_index\":0,\"sequence_number\":54}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"djtWtkC3Z5DEG\",\"output_index\":0,\"sequence_number\":55}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"1\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"Hxbu1RxuM6Fu6AA\",\"output_index\":0,\"sequence_number\":56}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\">\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"H176l6iRyfEU7\",\"output_index\":0,\"sequence_number\":57}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Code\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"KMRkR9BoVEw3\",\"output_index\":0,\"sequence_number\":58}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"RwUjGBn5I2acbH\",\"output_index\":0,\"sequence_number\":59}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Heading\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"Q2ZRQdIJd\",\"output_index\":0,\"sequence_number\":60}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"><\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"TDo2GSHJnLsU0y\",\"output_index\":0,\"sequence_number\":61}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Code\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"HW6k5O4l8GQ2\",\"output_index\":0,\"sequence_number\":62}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Block\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"GwBgQjdUuEo\",\"output_index\":0,\"sequence_number\":63}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" language\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"1fWrMYA\",\"output_index\":0,\"sequence_number\":64}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"RWdTgC1BXyICB\",\"output_index\":0,\"sequence_number\":65}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"javascript\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"Kj2k7w\",\"output_index\":0,\"sequence_number\":66}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\">\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"a8oFZrUdNaBR0\",\"output_index\":0,\"sequence_number\":67}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"console\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"1ThhM2WPJ\",\"output_index\":0,\"sequence_number\":68}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\".log\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"TtWLz0YlVktd\",\"output_index\":0,\"sequence_number\":69}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"('\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"UlsEV3I333k0MX\",\"output_index\":0,\"sequence_number\":70}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"hello\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"AGHDNciWwds\",\"output_index\":0,\"sequence_number\":71}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" world\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"OSYD0ejVJo\",\"output_index\":0,\"sequence_number\":72}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"');\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"0lRLBH7BrFJcO\",\"output_index\":0,\"sequence_number\":73}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"R7ync5sIgnsla2\",\"output_index\":0,\"sequence_number\":74}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Code\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"ULxJ40Baad8u\",\"output_index\":0,\"sequence_number\":75}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Block\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"BZYqveCkjBB\",\"output_index\":0,\"sequence_number\":76}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\">\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"JGhsDZQkCdsbXIn\",\"output_index\":0,\"sequence_number\":77}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\"}\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"wxJJNyILjCKUin\",\"output_index\":0,\"sequence_number\":78}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"]}\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"obfuscation\":\"jwXE1GaCpm0fgN\",\"output_index\":0,\"sequence_number\":79}\n\nevent: response.function_call_arguments.done\ndata: {\"type\":\"response.function_call_arguments.done\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"file_replace\\\",\\\"target\\\":\\\"How are you? \\\",\\\"replacement\\\":\\\"How are you? Code console.log('hello world'); \\\"}]}\",\"item_id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"output_index\":0,\"sequence_number\":80}\n\nevent: response.output_item.done\ndata: {\"type\":\"response.output_item.done\",\"item\":{\"id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"type\":\"function_call\",\"status\":\"completed\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"file_replace\\\",\\\"target\\\":\\\"How are you? \\\",\\\"replacement\\\":\\\"How are you? Code console.log('hello world'); \\\"}]}\",\"call_id\":\"call_i6Od4VgwdP4pBxLLE1xkEAtf\",\"name\":\"applyDocumentOperations\"},\"output_index\":0,\"sequence_number\":81}\n\nevent: response.completed\ndata: {\"type\":\"response.completed\",\"response\":{\"id\":\"resp_00c006ebd61e2f7c00698cd82516d081978ff6a25712665e2a\",\"object\":\"response\",\"created_at\":1770838053,\"status\":\"completed\",\"background\":false,\"completed_at\":1770838054,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[{\"id\":\"fc_00c006ebd61e2f7c00698cd8257d208197806a293ee66f7e26\",\"type\":\"function_call\",\"status\":\"completed\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"file_replace\\\",\\\"target\\\":\\\"How are you? \\\",\\\"replacement\\\":\\\"How are you? Code console.log('hello world'); \\\"}]}\",\"call_id\":\"call_i6Od4VgwdP4pBxLLE1xkEAtf\",\"name\":\"applyDocumentOperations\"}],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"default\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"applyDocumentOperations\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Replace a part of the document file\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"file_replace\"]},\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"type\",\"target\",\"replacement\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"]},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":{\"input_tokens\":285,\"input_tokens_details\":{\"cached_tokens\":0},\"output_tokens\":78,\"output_tokens_details\":{\"reasoning_tokens\":0},\"total_tokens\":363},\"user\":null,\"metadata\":{}},\"sequence_number\":82}\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/add a list (end)_1_3c8d705ee030e9d6422e9a28d896c78f.json b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/add a list (end)_1_3c8d705ee030e9d6422e9a28d896c78f.json
new file mode 100644
index 0000000000..36697a073c
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/add a list (end)_1_3c8d705ee030e9d6422e9a28d896c78f.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://api.openai.com/v1/responses",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"input\":[{\"role\":\"system\",\"content\":\"You are manipulating a text document using TSX components.\\nEach block is represented as a TSX component with props.\\n\"},{\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"There is no active selection. This is the latest state of the document (ignore previous documents, you MUST issue operations against this latest version of the document). \\nThe cursor is BETWEEN two blocks as indicated by cursor: true.\\nPrefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}]},{\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"{\\\"selection\\\":false,\\\"blocks\\\":[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"Hello, world! \\\"},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"How are you? \\\"}],\\\"isEmptyDocument\\\":false}\"}]},{\"role\":\"user\",\"content\":[{\"type\":\"input_text\",\"text\":\"add a list with the items 'Apples' and 'Bananas' after the last sentence\"}]}],\"tools\":[{\"type\":\"function\",\"name\":\"applyDocumentOperations\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Replace a part of the document file\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"file_replace\"]},\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"type\",\"target\",\"replacement\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"]}}],\"tool_choice\":\"required\",\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "event: response.created\ndata: {\"type\":\"response.created\",\"response\":{\"id\":\"resp_02deb0267e42db8300698cd82394b881948ee46bf2cb217e4f\",\"object\":\"response\",\"created_at\":1770838051,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"applyDocumentOperations\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Replace a part of the document file\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"file_replace\"]},\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"type\",\"target\",\"replacement\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"]},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":0}\n\nevent: response.in_progress\ndata: {\"type\":\"response.in_progress\",\"response\":{\"id\":\"resp_02deb0267e42db8300698cd82394b881948ee46bf2cb217e4f\",\"object\":\"response\",\"created_at\":1770838051,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"applyDocumentOperations\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Replace a part of the document file\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"file_replace\"]},\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"type\",\"target\",\"replacement\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"]},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":1}\n\nevent: response.output_item.added\ndata: {\"type\":\"response.output_item.added\",\"item\":{\"id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"type\":\"function_call\",\"status\":\"in_progress\",\"arguments\":\"\",\"call_id\":\"call_wVCjcQlJA8dgoGr9Jt3GS4Uw\",\"name\":\"applyDocumentOperations\"},\"output_index\":0,\"sequence_number\":2}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"{\\\"\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"jAzSHG6KcjyJRU\",\"output_index\":0,\"sequence_number\":3}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"operations\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"Yl7KcZ\",\"output_index\":0,\"sequence_number\":4}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":[\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"z2wnnGfpo0X3S\",\"output_index\":0,\"sequence_number\":5}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"{\\\"\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"LI5ZkGfoqpfyyA\",\"output_index\":0,\"sequence_number\":6}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"type\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"2x4fWuHLuyqQ\",\"output_index\":0,\"sequence_number\":7}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\\\"\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"wVOu5FqdRlxYB\",\"output_index\":0,\"sequence_number\":8}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"file\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"FUWdaoZ6Tel8\",\"output_index\":0,\"sequence_number\":9}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"_replace\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"2nFliWUI\",\"output_index\":0,\"sequence_number\":10}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\",\\\"\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"XcXOQr76b74kq\",\"output_index\":0,\"sequence_number\":11}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"target\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"836xEA46Tz\",\"output_index\":0,\"sequence_number\":12}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\\\"\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"upHkBeaZFikUI\",\"output_index\":0,\"sequence_number\":13}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"<\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"Y6IPIJ7uK6ZD0GV\",\"output_index\":0,\"sequence_number\":14}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"WSd7edZ\",\"output_index\":0,\"sequence_number\":15}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" text\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"3K07i7ol8Gn\",\"output_index\":0,\"sequence_number\":16}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Alignment\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"dTDq8hr\",\"output_index\":0,\"sequence_number\":17}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"WXOsrJcGweMEE\",\"output_index\":0,\"sequence_number\":18}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"left\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"bVdECRg6a4qh\",\"output_index\":0,\"sequence_number\":19}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\"\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"Eh21hihJNqccET\",\"output_index\":0,\"sequence_number\":20}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" id\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"esnOmBNDDwcE6\",\"output_index\":0,\"sequence_number\":21}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"l3FJ06jcOxazw\",\"output_index\":0,\"sequence_number\":22}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"ref\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"tPpEQgC336iPs\",\"output_index\":0,\"sequence_number\":23}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"2\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"7iOu78OwKLEXDlZ\",\"output_index\":0,\"sequence_number\":24}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\">\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"Z4ypuwqEnjwpP\",\"output_index\":0,\"sequence_number\":25}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"How\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"dX28hIR8yfoDu\",\"output_index\":0,\"sequence_number\":26}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" are\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"tJ6gsGX6fwtI\",\"output_index\":0,\"sequence_number\":27}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" you\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"XaZie0rnfNg6\",\"output_index\":0,\"sequence_number\":28}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"?\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"C7ngwbjdfTRVl\",\"output_index\":0,\"sequence_number\":29}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"yFD8WE5\",\"output_index\":0,\"sequence_number\":30}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\">\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"bnPqcpvh7ZiINKp\",\"output_index\":0,\"sequence_number\":31}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\",\\\"\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"jtMNFPAagvzZW\",\"output_index\":0,\"sequence_number\":32}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"replacement\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"EbmnH\",\"output_index\":0,\"sequence_number\":33}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\\\"\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"OYyKxzdR4f12Y\",\"output_index\":0,\"sequence_number\":34}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"<\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"am4j4M6MMmia8hP\",\"output_index\":0,\"sequence_number\":35}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"0pyecUC\",\"output_index\":0,\"sequence_number\":36}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" text\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"1CzyZ0qtGd3\",\"output_index\":0,\"sequence_number\":37}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Alignment\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"OXgVE2H\",\"output_index\":0,\"sequence_number\":38}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"DBbcg029l8geT\",\"output_index\":0,\"sequence_number\":39}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"left\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"JKJyYEyRBDFh\",\"output_index\":0,\"sequence_number\":40}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\"\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"QY5YQfE5Fg8Gnv\",\"output_index\":0,\"sequence_number\":41}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" id\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"XtlaEck1HfIFg\",\"output_index\":0,\"sequence_number\":42}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"0w6UtYwu0V3m9\",\"output_index\":0,\"sequence_number\":43}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"ref\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"WjcXM87DHxckg\",\"output_index\":0,\"sequence_number\":44}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"2\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"Vxh2A88iJKDT1rv\",\"output_index\":0,\"sequence_number\":45}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\">\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"17plX5XWNx7gF\",\"output_index\":0,\"sequence_number\":46}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"How\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"Mp3sqZzLw6cQt\",\"output_index\":0,\"sequence_number\":47}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" are\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"ZfUXUUwqZ9EN\",\"output_index\":0,\"sequence_number\":48}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" you\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"9nTYUn38RpM6\",\"output_index\":0,\"sequence_number\":49}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"?\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"aWUUExDLpxP4F\",\"output_index\":0,\"sequence_number\":50}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"OSOWeL1\",\"output_index\":0,\"sequence_number\":51}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"><\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"HTwE3fZewvAx2v\",\"output_index\":0,\"sequence_number\":52}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"List\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"ieSTbJQ3H04Y\",\"output_index\":0,\"sequence_number\":53}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" id\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"URoKYdvqA2W2a\",\"output_index\":0,\"sequence_number\":54}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"l0etM4JhDvnnw\",\"output_index\":0,\"sequence_number\":55}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"ref\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"nutVj6uWkwptH\",\"output_index\":0,\"sequence_number\":56}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"3\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"Li1jy48m7pZuTxB\",\"output_index\":0,\"sequence_number\":57}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\"><\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"7P8NTV5pnOaz\",\"output_index\":0,\"sequence_number\":58}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Item\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"gbXZrW5Z9T2N\",\"output_index\":0,\"sequence_number\":59}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\">\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"3HMVxTXIjcN5m6v\",\"output_index\":0,\"sequence_number\":60}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Ap\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"hryWS2qtxQESMY\",\"output_index\":0,\"sequence_number\":61}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"ples\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"VvFzuWaSjIRU\",\"output_index\":0,\"sequence_number\":62}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"sttLrphbOiUYP9\",\"output_index\":0,\"sequence_number\":63}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Item\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"xCpievvksDOA\",\"output_index\":0,\"sequence_number\":64}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"><\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"dSEzFNtU2EB88R\",\"output_index\":0,\"sequence_number\":65}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Item\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"szEZbqfTHLPI\",\"output_index\":0,\"sequence_number\":66}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\">\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"Z6g2OYWOip4OjFL\",\"output_index\":0,\"sequence_number\":67}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Ban\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"9BNz5UQnSCwNP\",\"output_index\":0,\"sequence_number\":68}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"anas\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"9FaFEnCuh0dm\",\"output_index\":0,\"sequence_number\":69}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"2GV2OVI6NDucbt\",\"output_index\":0,\"sequence_number\":70}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Item\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"Q9WU9WzkvMqD\",\"output_index\":0,\"sequence_number\":71}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\">\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"mFzdqqtAIiAIw\",\"output_index\":0,\"sequence_number\":72}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"List\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"8mkl4aFpwjO0\",\"output_index\":0,\"sequence_number\":73}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\">\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"IXepPTsPprO1rHs\",\"output_index\":0,\"sequence_number\":74}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\"}\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"c6CfKkGGP6BmAO\",\"output_index\":0,\"sequence_number\":75}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"]}\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"obfuscation\":\"eW0wDVjsAAiLM9\",\"output_index\":0,\"sequence_number\":76}\n\nevent: response.function_call_arguments.done\ndata: {\"type\":\"response.function_call_arguments.done\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"file_replace\\\",\\\"target\\\":\\\"How are you? \\\",\\\"replacement\\\":\\\"How are you? - Apples
- Bananas
\\\"}]}\",\"item_id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"output_index\":0,\"sequence_number\":77}\n\nevent: response.output_item.done\ndata: {\"type\":\"response.output_item.done\",\"item\":{\"id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"type\":\"function_call\",\"status\":\"completed\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"file_replace\\\",\\\"target\\\":\\\"How are you? \\\",\\\"replacement\\\":\\\"How are you? - Apples
- Bananas
\\\"}]}\",\"call_id\":\"call_wVCjcQlJA8dgoGr9Jt3GS4Uw\",\"name\":\"applyDocumentOperations\"},\"output_index\":0,\"sequence_number\":78}\n\nevent: response.completed\ndata: {\"type\":\"response.completed\",\"response\":{\"id\":\"resp_02deb0267e42db8300698cd82394b881948ee46bf2cb217e4f\",\"object\":\"response\",\"created_at\":1770838051,\"status\":\"completed\",\"background\":false,\"completed_at\":1770838052,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[{\"id\":\"fc_02deb0267e42db8300698cd82400dc81948749405bf68eca78\",\"type\":\"function_call\",\"status\":\"completed\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"file_replace\\\",\\\"target\\\":\\\"How are you? \\\",\\\"replacement\\\":\\\"How are you? - Apples
- Bananas
\\\"}]}\",\"call_id\":\"call_wVCjcQlJA8dgoGr9Jt3GS4Uw\",\"name\":\"applyDocumentOperations\"}],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"default\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"applyDocumentOperations\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Replace a part of the document file\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"file_replace\"]},\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"type\",\"target\",\"replacement\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"]},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":{\"input_tokens\":269,\"input_tokens_details\":{\"cached_tokens\":0},\"output_tokens\":75,\"output_tokens_details\":{\"reasoning_tokens\":0},\"total_tokens\":344},\"user\":null,\"metadata\":{}},\"sequence_number\":79}\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/add a list (end)_1_d7ece95dd7b470ac2c8445b56de14c4d.json b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/add a list (end)_1_d7ece95dd7b470ac2c8445b56de14c4d.json
new file mode 100644
index 0000000000..2f21aeec6a
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/add a list (end)_1_d7ece95dd7b470ac2c8445b56de14c4d.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://api.openai.com/v1/responses",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"input\":[{\"role\":\"system\",\"content\":\"You are manipulating a text document using TSX components.\\nEach block is represented as a TSX component with props.\\n\"},{\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"There is no active selection. This is the latest state of the document (ignore previous documents, you MUST issue operations against this latest version of the document). \\nThe cursor is BETWEEN two blocks as indicated by cursor: true.\\nPrefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}]},{\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"Hello, world! \\\"},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"How are you? \\\"}]\"}]},{\"role\":\"user\",\"content\":[{\"type\":\"input_text\",\"text\":\"add a list with the items 'Apples' and 'Bananas' after the last sentence\"}]}],\"tools\":[{\"type\":\"function\",\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"]}}],\"tool_choice\":\"required\",\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "event: response.created\ndata: {\"type\":\"response.created\",\"response\":{\"id\":\"resp_0bf801264141576700698e16c293888197940b54afa6620222\",\"object\":\"response\",\"created_at\":1770919618,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"],\"additionalProperties\":false},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":0}\n\nevent: response.in_progress\ndata: {\"type\":\"response.in_progress\",\"response\":{\"id\":\"resp_0bf801264141576700698e16c293888197940b54afa6620222\",\"object\":\"response\",\"created_at\":1770919618,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"],\"additionalProperties\":false},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":1}\n\nevent: response.output_item.added\ndata: {\"type\":\"response.output_item.added\",\"item\":{\"id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"type\":\"function_call\",\"status\":\"in_progress\",\"arguments\":\"\",\"call_id\":\"call_ulKHZ83j9qCVbHw0IGoyZiGV\",\"name\":\"file_replace\"},\"output_index\":0,\"sequence_number\":2}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"{\\\"\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"XIUsXkUvc5ry93\",\"output_index\":0,\"sequence_number\":3}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"target\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"TLXpszzUHC\",\"output_index\":0,\"sequence_number\":4}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\\\"\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"3M35Lon9XVAHE\",\"output_index\":0,\"sequence_number\":5}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"<\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"pqLBYC3ZDkgriDw\",\"output_index\":0,\"sequence_number\":6}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"wAzsotH\",\"output_index\":0,\"sequence_number\":7}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" text\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"oHUtpf5YATq\",\"output_index\":0,\"sequence_number\":8}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Alignment\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"OSf8fiw\",\"output_index\":0,\"sequence_number\":9}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"ng6gsNv2NmLkJ\",\"output_index\":0,\"sequence_number\":10}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"left\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"fBXkA62YByr1\",\"output_index\":0,\"sequence_number\":11}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\"\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"Syosid4eFFUZZa\",\"output_index\":0,\"sequence_number\":12}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" id\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"vXvQfsbOCLu7i\",\"output_index\":0,\"sequence_number\":13}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"6ZvPYNeABoL67\",\"output_index\":0,\"sequence_number\":14}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"ref\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"yZfihm33Oy8k7\",\"output_index\":0,\"sequence_number\":15}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"2\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"IyjHEfWXskAaROd\",\"output_index\":0,\"sequence_number\":16}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\">\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"5LOwTA1nQwBUT\",\"output_index\":0,\"sequence_number\":17}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"How\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"XdPQD4WqhyV8r\",\"output_index\":0,\"sequence_number\":18}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" are\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"kMH15b0HAwbw\",\"output_index\":0,\"sequence_number\":19}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" you\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"eZ9m9zh1tQmf\",\"output_index\":0,\"sequence_number\":20}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"?\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"SUew0K0cy8Q5V\",\"output_index\":0,\"sequence_number\":21}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"kNrCbkN\",\"output_index\":0,\"sequence_number\":22}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\">\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"sMUwgywVLiGBQ2N\",\"output_index\":0,\"sequence_number\":23}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\",\\\"\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"bTXdfwYZQvdq7\",\"output_index\":0,\"sequence_number\":24}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"replacement\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"LPNzs\",\"output_index\":0,\"sequence_number\":25}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\\\"\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"K4tbgiA9pXuV2\",\"output_index\":0,\"sequence_number\":26}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"<\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"pVEIH2WIgxnfVcS\",\"output_index\":0,\"sequence_number\":27}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"YX78OQc\",\"output_index\":0,\"sequence_number\":28}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" text\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"yixFQO1liyl\",\"output_index\":0,\"sequence_number\":29}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Alignment\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"GAoSHPs\",\"output_index\":0,\"sequence_number\":30}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"JOR8CaKqdlptm\",\"output_index\":0,\"sequence_number\":31}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"left\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"LyCGyJWLqH4O\",\"output_index\":0,\"sequence_number\":32}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\"\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"baqVDLePXOcyFX\",\"output_index\":0,\"sequence_number\":33}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" id\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"VUIEwPVfWqDNe\",\"output_index\":0,\"sequence_number\":34}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"Wt3jHyFp7NSav\",\"output_index\":0,\"sequence_number\":35}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"ref\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"lWFm4LQJUE1i5\",\"output_index\":0,\"sequence_number\":36}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"2\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"0t7ESjGmor8W3nx\",\"output_index\":0,\"sequence_number\":37}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\">\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"uAvcnL0SMeNvs\",\"output_index\":0,\"sequence_number\":38}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"How\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"Dv0ZJO5cdXvm3\",\"output_index\":0,\"sequence_number\":39}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" are\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"d7IjG3OLW5oV\",\"output_index\":0,\"sequence_number\":40}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" you\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"LR3hSVW2PsM6\",\"output_index\":0,\"sequence_number\":41}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"?\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"8PfxGCFfW9W51\",\"output_index\":0,\"sequence_number\":42}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"LsAf1TU\",\"output_index\":0,\"sequence_number\":43}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"><\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"wxSp6KVkusHoUV\",\"output_index\":0,\"sequence_number\":44}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"List\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"7G1TXNq9Voh3\",\"output_index\":0,\"sequence_number\":45}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" id\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"T82IfzQOfVXzl\",\"output_index\":0,\"sequence_number\":46}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"W1D0pemwNDF7t\",\"output_index\":0,\"sequence_number\":47}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"list\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"nx4Z8gVoQDEK\",\"output_index\":0,\"sequence_number\":48}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"1\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"mYG6NaC9HNuxOYb\",\"output_index\":0,\"sequence_number\":49}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\"><\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"tBlDf3VJ3b1u\",\"output_index\":0,\"sequence_number\":50}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"List\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"s0ZvhROvfS15\",\"output_index\":0,\"sequence_number\":51}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Item\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"E4uQlRmDuNQd\",\"output_index\":0,\"sequence_number\":52}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\">\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"XkwSWOiqX4KBJAG\",\"output_index\":0,\"sequence_number\":53}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Ap\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"6hNsv64l3EG4YV\",\"output_index\":0,\"sequence_number\":54}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"ples\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"7OrAI4R8eQDi\",\"output_index\":0,\"sequence_number\":55}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"XL6YNpR6Gw5n0o\",\"output_index\":0,\"sequence_number\":56}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"List\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"cO0oXzHffQKp\",\"output_index\":0,\"sequence_number\":57}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Item\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"TXg4G2Mxyl15\",\"output_index\":0,\"sequence_number\":58}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"><\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"iZxiUHrxEPPh3Q\",\"output_index\":0,\"sequence_number\":59}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"List\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"bwhQ6uwGlSah\",\"output_index\":0,\"sequence_number\":60}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Item\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"3KdsdcMPG8Is\",\"output_index\":0,\"sequence_number\":61}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\">\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"3iL0QPhft969Xwz\",\"output_index\":0,\"sequence_number\":62}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Ban\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"8Jh3w7ubbOLkG\",\"output_index\":0,\"sequence_number\":63}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"anas\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"PsfCoBfRhzfP\",\"output_index\":0,\"sequence_number\":64}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"SvcHwFQJIYxvTw\",\"output_index\":0,\"sequence_number\":65}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"List\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"lhnivwHZwXez\",\"output_index\":0,\"sequence_number\":66}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Item\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"J4pSdiGQjNBT\",\"output_index\":0,\"sequence_number\":67}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\">\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"QzFzRHXCWsdwp\",\"output_index\":0,\"sequence_number\":68}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"List\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"G0Hugeyb4Hzq\",\"output_index\":0,\"sequence_number\":69}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\">\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"b2pf0wRgpWZwrId\",\"output_index\":0,\"sequence_number\":70}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\"}\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"obfuscation\":\"suj2irQdRCVFSw\",\"output_index\":0,\"sequence_number\":71}\n\nevent: response.function_call_arguments.done\ndata: {\"type\":\"response.function_call_arguments.done\",\"arguments\":\"{\\\"target\\\":\\\"How are you? \\\",\\\"replacement\\\":\\\"How are you? Apples Bananas
\\\"}\",\"item_id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"output_index\":0,\"sequence_number\":72}\n\nevent: response.output_item.done\ndata: {\"type\":\"response.output_item.done\",\"item\":{\"id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"type\":\"function_call\",\"status\":\"completed\",\"arguments\":\"{\\\"target\\\":\\\"How are you? \\\",\\\"replacement\\\":\\\"How are you? Apples Bananas
\\\"}\",\"call_id\":\"call_ulKHZ83j9qCVbHw0IGoyZiGV\",\"name\":\"file_replace\"},\"output_index\":0,\"sequence_number\":73}\n\nevent: response.completed\ndata: {\"type\":\"response.completed\",\"response\":{\"id\":\"resp_0bf801264141576700698e16c293888197940b54afa6620222\",\"object\":\"response\",\"created_at\":1770919618,\"status\":\"completed\",\"background\":false,\"completed_at\":1770919619,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[{\"id\":\"fc_0bf801264141576700698e16c2ef7081978feb411057d4af24\",\"type\":\"function_call\",\"status\":\"completed\",\"arguments\":\"{\\\"target\\\":\\\"How are you? \\\",\\\"replacement\\\":\\\"How are you? Apples Bananas
\\\"}\",\"call_id\":\"call_ulKHZ83j9qCVbHw0IGoyZiGV\",\"name\":\"file_replace\"}],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"default\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"],\"additionalProperties\":false},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":{\"input_tokens\":232,\"input_tokens_details\":{\"cached_tokens\":0},\"output_tokens\":70,\"output_tokens_details\":{\"reasoning_tokens\":0},\"total_tokens\":302},\"user\":null,\"metadata\":{}},\"sequence_number\":74}\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/add a new paragraph (empty doc)_1_4ddd26cb3bd20f62e0060899a3c57056.json b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/add a new paragraph (empty doc)_1_4ddd26cb3bd20f62e0060899a3c57056.json
new file mode 100644
index 0000000000..c4fdb8580b
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/add a new paragraph (empty doc)_1_4ddd26cb3bd20f62e0060899a3c57056.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://api.openai.com/v1/responses",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"input\":[{\"role\":\"system\",\"content\":\"You are manipulating a text document using TSX components.\\nEach block is represented as a TSX component with props.\\n\"},{\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"There is no active selection. This is the latest state of the document (ignore previous documents, you MUST issue operations against this latest version of the document). \\nThe cursor is BETWEEN two blocks as indicated by cursor: true.\\nBecause the document is empty, YOU MUST first update the empty block before adding new blocks.\"}]},{\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"{\\\"selection\\\":false,\\\"blocks\\\":[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\" \\\"},{\\\"cursor\\\":true}],\\\"isEmptyDocument\\\":true}\"}]},{\"role\":\"user\",\"content\":[{\"type\":\"input_text\",\"text\":\"write a new paragraph with the text 'You look great today!'\"}]}],\"tools\":[{\"type\":\"function\",\"name\":\"applyDocumentOperations\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Replace a part of the document file\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"file_replace\"]},\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"type\",\"target\",\"replacement\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"]}}],\"tool_choice\":\"required\",\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "event: response.created\ndata: {\"type\":\"response.created\",\"response\":{\"id\":\"resp_0230f5dca948ab2b00698cd82650748197ba37aa967dfc8fbb\",\"object\":\"response\",\"created_at\":1770838054,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"applyDocumentOperations\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Replace a part of the document file\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"file_replace\"]},\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"type\",\"target\",\"replacement\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"]},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":0}\n\nevent: response.in_progress\ndata: {\"type\":\"response.in_progress\",\"response\":{\"id\":\"resp_0230f5dca948ab2b00698cd82650748197ba37aa967dfc8fbb\",\"object\":\"response\",\"created_at\":1770838054,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"applyDocumentOperations\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Replace a part of the document file\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"file_replace\"]},\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"type\",\"target\",\"replacement\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"]},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":1}\n\nevent: response.output_item.added\ndata: {\"type\":\"response.output_item.added\",\"item\":{\"id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"type\":\"function_call\",\"status\":\"in_progress\",\"arguments\":\"\",\"call_id\":\"call_3ZcKkLqGZj278rRPZKTZR1Gx\",\"name\":\"applyDocumentOperations\"},\"output_index\":0,\"sequence_number\":2}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"{\\\"\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"TNdqQ5YsPUcegU\",\"output_index\":0,\"sequence_number\":3}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"operations\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"M1BZfh\",\"output_index\":0,\"sequence_number\":4}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":[\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"V0pyg39MaX6x7\",\"output_index\":0,\"sequence_number\":5}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"{\\\"\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"ylR2DQlKEhB26l\",\"output_index\":0,\"sequence_number\":6}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"type\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"pLPd7hA2YBh6\",\"output_index\":0,\"sequence_number\":7}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\\\"\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"GA5Iy9XRYzNMl\",\"output_index\":0,\"sequence_number\":8}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"file\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"F0JQPC8nKZEy\",\"output_index\":0,\"sequence_number\":9}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"_replace\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"zEN5jA0G\",\"output_index\":0,\"sequence_number\":10}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\",\\\"\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"KUwf2Qug1BhHg\",\"output_index\":0,\"sequence_number\":11}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"target\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"1XUdB2rkuK\",\"output_index\":0,\"sequence_number\":12}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\\\"\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"Sm0Mcbjk6pQKW\",\"output_index\":0,\"sequence_number\":13}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"<\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"o2szFEV7Wvho46k\",\"output_index\":0,\"sequence_number\":14}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"5lq1MRl\",\"output_index\":0,\"sequence_number\":15}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" text\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"kI4GKpS710e\",\"output_index\":0,\"sequence_number\":16}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Alignment\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"AQEl9Lq\",\"output_index\":0,\"sequence_number\":17}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"KuRxBFeJYklmP\",\"output_index\":0,\"sequence_number\":18}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"left\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"0kVmwTKoy6C5\",\"output_index\":0,\"sequence_number\":19}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\"\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"NSfrk3u7qqsPCz\",\"output_index\":0,\"sequence_number\":20}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" id\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"wPrvvb8ssMWNH\",\"output_index\":0,\"sequence_number\":21}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"mTuSbHf5xb7fL\",\"output_index\":0,\"sequence_number\":22}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"ref\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"0Sd1q1y72sfjb\",\"output_index\":0,\"sequence_number\":23}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"1\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"FSdcHLflVdvvrGx\",\"output_index\":0,\"sequence_number\":24}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\"\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"VCE1XxfFBA9PlZ\",\"output_index\":0,\"sequence_number\":25}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" />\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"gltudhTTAdo7n\",\"output_index\":0,\"sequence_number\":26}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\",\\\"\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"A8bWcg4A2WeWH\",\"output_index\":0,\"sequence_number\":27}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"replacement\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"IgacU\",\"output_index\":0,\"sequence_number\":28}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\\\"\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"9Mjswz6V3mzw9\",\"output_index\":0,\"sequence_number\":29}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"<\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"jKoiqWhyT2xIej4\",\"output_index\":0,\"sequence_number\":30}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"02DegnZ\",\"output_index\":0,\"sequence_number\":31}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" text\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"M3uV5JEZzgW\",\"output_index\":0,\"sequence_number\":32}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Alignment\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"BDIX3GS\",\"output_index\":0,\"sequence_number\":33}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"rFyoVsQpPtIH8\",\"output_index\":0,\"sequence_number\":34}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"left\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"ChewPXW0Q5Sg\",\"output_index\":0,\"sequence_number\":35}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\"\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"QIQOohtcMfSag3\",\"output_index\":0,\"sequence_number\":36}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" id\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"1y29KkcBq1S4k\",\"output_index\":0,\"sequence_number\":37}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"dQNsVrZ6cT93T\",\"output_index\":0,\"sequence_number\":38}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"ref\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"wt9JY4foMOJcA\",\"output_index\":0,\"sequence_number\":39}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"1\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"9IBfWtQ5fEp0h0y\",\"output_index\":0,\"sequence_number\":40}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\">\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"crfSUvHPhbZBo\",\"output_index\":0,\"sequence_number\":41}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"You\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"GVWgHcWhY5K4L\",\"output_index\":0,\"sequence_number\":42}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" look\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"EERCNAl3YAJ\",\"output_index\":0,\"sequence_number\":43}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" great\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"WWJvMqZOA8\",\"output_index\":0,\"sequence_number\":44}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" today\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"zPpgt0rnGp\",\"output_index\":0,\"sequence_number\":45}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"!\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"pqe7OkbhX99r2\",\"output_index\":0,\"sequence_number\":46}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"H6Xpklq\",\"output_index\":0,\"sequence_number\":47}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\">\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"TKwVq2r33vElfrf\",\"output_index\":0,\"sequence_number\":48}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\"}\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"FIIESRBdcDhzHp\",\"output_index\":0,\"sequence_number\":49}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"]}\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"obfuscation\":\"xh2M3ZB8sB0aWe\",\"output_index\":0,\"sequence_number\":50}\n\nevent: response.function_call_arguments.done\ndata: {\"type\":\"response.function_call_arguments.done\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"file_replace\\\",\\\"target\\\":\\\" \\\",\\\"replacement\\\":\\\"You look great today! \\\"}]}\",\"item_id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"output_index\":0,\"sequence_number\":51}\n\nevent: response.output_item.done\ndata: {\"type\":\"response.output_item.done\",\"item\":{\"id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"type\":\"function_call\",\"status\":\"completed\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"file_replace\\\",\\\"target\\\":\\\" \\\",\\\"replacement\\\":\\\"You look great today! \\\"}]}\",\"call_id\":\"call_3ZcKkLqGZj278rRPZKTZR1Gx\",\"name\":\"applyDocumentOperations\"},\"output_index\":0,\"sequence_number\":52}\n\nevent: response.completed\ndata: {\"type\":\"response.completed\",\"response\":{\"id\":\"resp_0230f5dca948ab2b00698cd82650748197ba37aa967dfc8fbb\",\"object\":\"response\",\"created_at\":1770838054,\"status\":\"completed\",\"background\":false,\"completed_at\":1770838055,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[{\"id\":\"fc_0230f5dca948ab2b00698cd8269fac8197979dd89d73397556\",\"type\":\"function_call\",\"status\":\"completed\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"file_replace\\\",\\\"target\\\":\\\" \\\",\\\"replacement\\\":\\\"You look great today! \\\"}]}\",\"call_id\":\"call_3ZcKkLqGZj278rRPZKTZR1Gx\",\"name\":\"applyDocumentOperations\"}],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"default\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"applyDocumentOperations\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Replace a part of the document file\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"file_replace\"]},\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"type\",\"target\",\"replacement\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"]},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":{\"input_tokens\":231,\"input_tokens_details\":{\"cached_tokens\":0},\"output_tokens\":49,\"output_tokens_details\":{\"reasoning_tokens\":0},\"total_tokens\":280},\"user\":null,\"metadata\":{}},\"sequence_number\":53}\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/add a new paragraph (empty doc)_1_ee3dd6efeb79bd98344df49480eddb29.json b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/add a new paragraph (empty doc)_1_ee3dd6efeb79bd98344df49480eddb29.json
new file mode 100644
index 0000000000..42bfaca3e7
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/add a new paragraph (empty doc)_1_ee3dd6efeb79bd98344df49480eddb29.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://api.openai.com/v1/responses",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"input\":[{\"role\":\"system\",\"content\":\"You are manipulating a text document using TSX components.\\nEach block is represented as a TSX component with props.\\n\"},{\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"There is no active selection. This is the latest state of the document (ignore previous documents, you MUST issue operations against this latest version of the document). \\nThe cursor is BETWEEN two blocks as indicated by cursor: true.\\nBecause the document is empty, YOU MUST first update the empty block before adding new blocks.\"}]},{\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\" \\\"},{\\\"cursor\\\":true}]\"}]},{\"role\":\"user\",\"content\":[{\"type\":\"input_text\",\"text\":\"write a new paragraph with the text 'You look great today!'\"}]}],\"tools\":[{\"type\":\"function\",\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"]}}],\"tool_choice\":\"required\",\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "event: response.created\ndata: {\"type\":\"response.created\",\"response\":{\"id\":\"resp_0addaa26e93aa41d00698e16c699648190bc6b7b918668354b\",\"object\":\"response\",\"created_at\":1770919622,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"],\"additionalProperties\":false},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":0}\n\nevent: response.in_progress\ndata: {\"type\":\"response.in_progress\",\"response\":{\"id\":\"resp_0addaa26e93aa41d00698e16c699648190bc6b7b918668354b\",\"object\":\"response\",\"created_at\":1770919622,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"],\"additionalProperties\":false},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":1}\n\nevent: response.output_item.added\ndata: {\"type\":\"response.output_item.added\",\"item\":{\"id\":\"fc_0addaa26e93aa41d00698e16c6fde08190ab42d35b5d8526fc\",\"type\":\"function_call\",\"status\":\"in_progress\",\"arguments\":\"\",\"call_id\":\"call_0uzRTCfLwNALnBXdGnRTHjr4\",\"name\":\"file_replace\"},\"output_index\":0,\"sequence_number\":2}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"{\\\"\",\"item_id\":\"fc_0addaa26e93aa41d00698e16c6fde08190ab42d35b5d8526fc\",\"obfuscation\":\"kPNm3h0K8YFYJ8\",\"output_index\":0,\"sequence_number\":3}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"target\",\"item_id\":\"fc_0addaa26e93aa41d00698e16c6fde08190ab42d35b5d8526fc\",\"obfuscation\":\"M9TOAKkAgu\",\"output_index\":0,\"sequence_number\":4}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\\\"\",\"item_id\":\"fc_0addaa26e93aa41d00698e16c6fde08190ab42d35b5d8526fc\",\"obfuscation\":\"QcPfe0bmhU1zF\",\"output_index\":0,\"sequence_number\":5}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"<\",\"item_id\":\"fc_0addaa26e93aa41d00698e16c6fde08190ab42d35b5d8526fc\",\"obfuscation\":\"um86EeroIVBP7Kx\",\"output_index\":0,\"sequence_number\":6}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_0addaa26e93aa41d00698e16c6fde08190ab42d35b5d8526fc\",\"obfuscation\":\"sm4TKHC\",\"output_index\":0,\"sequence_number\":7}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" text\",\"item_id\":\"fc_0addaa26e93aa41d00698e16c6fde08190ab42d35b5d8526fc\",\"obfuscation\":\"coDb95hYYr6\",\"output_index\":0,\"sequence_number\":8}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Alignment\",\"item_id\":\"fc_0addaa26e93aa41d00698e16c6fde08190ab42d35b5d8526fc\",\"obfuscation\":\"NPcCbVr\",\"output_index\":0,\"sequence_number\":9}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_0addaa26e93aa41d00698e16c6fde08190ab42d35b5d8526fc\",\"obfuscation\":\"6riQVF4VjJbuf\",\"output_index\":0,\"sequence_number\":10}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"left\",\"item_id\":\"fc_0addaa26e93aa41d00698e16c6fde08190ab42d35b5d8526fc\",\"obfuscation\":\"r10RCoMJJw0C\",\"output_index\":0,\"sequence_number\":11}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\"\",\"item_id\":\"fc_0addaa26e93aa41d00698e16c6fde08190ab42d35b5d8526fc\",\"obfuscation\":\"3QPxGHdRY442ao\",\"output_index\":0,\"sequence_number\":12}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" id\",\"item_id\":\"fc_0addaa26e93aa41d00698e16c6fde08190ab42d35b5d8526fc\",\"obfuscation\":\"Wu50IngwRXm9N\",\"output_index\":0,\"sequence_number\":13}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_0addaa26e93aa41d00698e16c6fde08190ab42d35b5d8526fc\",\"obfuscation\":\"wSYLVDZmgUCQQ\",\"output_index\":0,\"sequence_number\":14}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"ref\",\"item_id\":\"fc_0addaa26e93aa41d00698e16c6fde08190ab42d35b5d8526fc\",\"obfuscation\":\"tkaAoxPvXYDIm\",\"output_index\":0,\"sequence_number\":15}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"1\",\"item_id\":\"fc_0addaa26e93aa41d00698e16c6fde08190ab42d35b5d8526fc\",\"obfuscation\":\"qfwk2mTzIEJRmCR\",\"output_index\":0,\"sequence_number\":16}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\"\",\"item_id\":\"fc_0addaa26e93aa41d00698e16c6fde08190ab42d35b5d8526fc\",\"obfuscation\":\"TawQ8o84RVpeqD\",\"output_index\":0,\"sequence_number\":17}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" />\",\"item_id\":\"fc_0addaa26e93aa41d00698e16c6fde08190ab42d35b5d8526fc\",\"obfuscation\":\"qU5DxegNdjt9L\",\"output_index\":0,\"sequence_number\":18}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\",\\\"\",\"item_id\":\"fc_0addaa26e93aa41d00698e16c6fde08190ab42d35b5d8526fc\",\"obfuscation\":\"jHNt1oN5MsM2l\",\"output_index\":0,\"sequence_number\":19}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"replacement\",\"item_id\":\"fc_0addaa26e93aa41d00698e16c6fde08190ab42d35b5d8526fc\",\"obfuscation\":\"jahZG\",\"output_index\":0,\"sequence_number\":20}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\\\"\",\"item_id\":\"fc_0addaa26e93aa41d00698e16c6fde08190ab42d35b5d8526fc\",\"obfuscation\":\"rfplo4EOZnkaK\",\"output_index\":0,\"sequence_number\":21}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"<\",\"item_id\":\"fc_0addaa26e93aa41d00698e16c6fde08190ab42d35b5d8526fc\",\"obfuscation\":\"f3et0BJ3eG1zmLS\",\"output_index\":0,\"sequence_number\":22}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_0addaa26e93aa41d00698e16c6fde08190ab42d35b5d8526fc\",\"obfuscation\":\"3enDQij\",\"output_index\":0,\"sequence_number\":23}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" text\",\"item_id\":\"fc_0addaa26e93aa41d00698e16c6fde08190ab42d35b5d8526fc\",\"obfuscation\":\"OOFwLnKw50p\",\"output_index\":0,\"sequence_number\":24}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Alignment\",\"item_id\":\"fc_0addaa26e93aa41d00698e16c6fde08190ab42d35b5d8526fc\",\"obfuscation\":\"rvEQrvG\",\"output_index\":0,\"sequence_number\":25}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_0addaa26e93aa41d00698e16c6fde08190ab42d35b5d8526fc\",\"obfuscation\":\"mIKKaHdJoZDzn\",\"output_index\":0,\"sequence_number\":26}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"left\",\"item_id\":\"fc_0addaa26e93aa41d00698e16c6fde08190ab42d35b5d8526fc\",\"obfuscation\":\"35pDeM34Z2in\",\"output_index\":0,\"sequence_number\":27}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\"\",\"item_id\":\"fc_0addaa26e93aa41d00698e16c6fde08190ab42d35b5d8526fc\",\"obfuscation\":\"hLVchrmjX6iC0R\",\"output_index\":0,\"sequence_number\":28}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" id\",\"item_id\":\"fc_0addaa26e93aa41d00698e16c6fde08190ab42d35b5d8526fc\",\"obfuscation\":\"ltu5VwTlSLepO\",\"output_index\":0,\"sequence_number\":29}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_0addaa26e93aa41d00698e16c6fde08190ab42d35b5d8526fc\",\"obfuscation\":\"iuAq15S7rerMx\",\"output_index\":0,\"sequence_number\":30}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"ref\",\"item_id\":\"fc_0addaa26e93aa41d00698e16c6fde08190ab42d35b5d8526fc\",\"obfuscation\":\"kic3sC8ZkMQce\",\"output_index\":0,\"sequence_number\":31}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"1\",\"item_id\":\"fc_0addaa26e93aa41d00698e16c6fde08190ab42d35b5d8526fc\",\"obfuscation\":\"fopsMfMoCOlQqEh\",\"output_index\":0,\"sequence_number\":32}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\">\",\"item_id\":\"fc_0addaa26e93aa41d00698e16c6fde08190ab42d35b5d8526fc\",\"obfuscation\":\"EoAr71RokDuyZ\",\"output_index\":0,\"sequence_number\":33}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"You\",\"item_id\":\"fc_0addaa26e93aa41d00698e16c6fde08190ab42d35b5d8526fc\",\"obfuscation\":\"JRBm3td5aoUs5\",\"output_index\":0,\"sequence_number\":34}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" look\",\"item_id\":\"fc_0addaa26e93aa41d00698e16c6fde08190ab42d35b5d8526fc\",\"obfuscation\":\"Hlty8Sku0zJ\",\"output_index\":0,\"sequence_number\":35}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" great\",\"item_id\":\"fc_0addaa26e93aa41d00698e16c6fde08190ab42d35b5d8526fc\",\"obfuscation\":\"bofyIFQoJh\",\"output_index\":0,\"sequence_number\":36}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" today\",\"item_id\":\"fc_0addaa26e93aa41d00698e16c6fde08190ab42d35b5d8526fc\",\"obfuscation\":\"WbBNSfWx0z\",\"output_index\":0,\"sequence_number\":37}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"!\",\"item_id\":\"fc_0addaa26e93aa41d00698e16c6fde08190ab42d35b5d8526fc\",\"obfuscation\":\"EKZRr6GEFxj0J\",\"output_index\":0,\"sequence_number\":38}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_0addaa26e93aa41d00698e16c6fde08190ab42d35b5d8526fc\",\"obfuscation\":\"cgNLU93\",\"output_index\":0,\"sequence_number\":39}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\">\",\"item_id\":\"fc_0addaa26e93aa41d00698e16c6fde08190ab42d35b5d8526fc\",\"obfuscation\":\"9hAercEs85gyIVt\",\"output_index\":0,\"sequence_number\":40}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\"}\",\"item_id\":\"fc_0addaa26e93aa41d00698e16c6fde08190ab42d35b5d8526fc\",\"obfuscation\":\"G6K1gfLBQlUpTV\",\"output_index\":0,\"sequence_number\":41}\n\nevent: response.function_call_arguments.done\ndata: {\"type\":\"response.function_call_arguments.done\",\"arguments\":\"{\\\"target\\\":\\\" \\\",\\\"replacement\\\":\\\"You look great today! \\\"}\",\"item_id\":\"fc_0addaa26e93aa41d00698e16c6fde08190ab42d35b5d8526fc\",\"output_index\":0,\"sequence_number\":42}\n\nevent: response.output_item.done\ndata: {\"type\":\"response.output_item.done\",\"item\":{\"id\":\"fc_0addaa26e93aa41d00698e16c6fde08190ab42d35b5d8526fc\",\"type\":\"function_call\",\"status\":\"completed\",\"arguments\":\"{\\\"target\\\":\\\" \\\",\\\"replacement\\\":\\\"You look great today! \\\"}\",\"call_id\":\"call_0uzRTCfLwNALnBXdGnRTHjr4\",\"name\":\"file_replace\"},\"output_index\":0,\"sequence_number\":43}\n\nevent: response.completed\ndata: {\"type\":\"response.completed\",\"response\":{\"id\":\"resp_0addaa26e93aa41d00698e16c699648190bc6b7b918668354b\",\"object\":\"response\",\"created_at\":1770919622,\"status\":\"completed\",\"background\":false,\"completed_at\":1770919623,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[{\"id\":\"fc_0addaa26e93aa41d00698e16c6fde08190ab42d35b5d8526fc\",\"type\":\"function_call\",\"status\":\"completed\",\"arguments\":\"{\\\"target\\\":\\\" \\\",\\\"replacement\\\":\\\"You look great today! \\\"}\",\"call_id\":\"call_0uzRTCfLwNALnBXdGnRTHjr4\",\"name\":\"file_replace\"}],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"default\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"],\"additionalProperties\":false},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":{\"input_tokens\":193,\"input_tokens_details\":{\"cached_tokens\":0},\"output_tokens\":40,\"output_tokens_details\":{\"reasoning_tokens\":0},\"total_tokens\":233},\"user\":null,\"metadata\":{}},\"sequence_number\":44}\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/add a new paragraph (end)_1_358291b6f87d2d1bcbc7b488318dc0d5.json b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/add a new paragraph (end)_1_358291b6f87d2d1bcbc7b488318dc0d5.json
new file mode 100644
index 0000000000..2ae8cb18de
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/add a new paragraph (end)_1_358291b6f87d2d1bcbc7b488318dc0d5.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://api.openai.com/v1/responses",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"input\":[{\"role\":\"system\",\"content\":\"You are manipulating a text document using TSX components.\\nEach block is represented as a TSX component with props.\\n\"},{\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"There is no active selection. This is the latest state of the document (ignore previous documents, you MUST issue operations against this latest version of the document). \\nThe cursor is BETWEEN two blocks as indicated by cursor: true.\\nPrefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}]},{\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"Hello, world! \\\"},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"How are you? \\\"}]\"}]},{\"role\":\"user\",\"content\":[{\"type\":\"input_text\",\"text\":\"add a new paragraph with the text 'You look great today!' after the last sentence\"}]}],\"tools\":[{\"type\":\"function\",\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"]}}],\"tool_choice\":\"required\",\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "event: response.created\ndata: {\"type\":\"response.created\",\"response\":{\"id\":\"resp_0b7295bf83b07ff300698e16c110d48194820b53d75ef0401e\",\"object\":\"response\",\"created_at\":1770919617,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"],\"additionalProperties\":false},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":0}\n\nevent: response.in_progress\ndata: {\"type\":\"response.in_progress\",\"response\":{\"id\":\"resp_0b7295bf83b07ff300698e16c110d48194820b53d75ef0401e\",\"object\":\"response\",\"created_at\":1770919617,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"],\"additionalProperties\":false},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":1}\n\nevent: response.output_item.added\ndata: {\"type\":\"response.output_item.added\",\"item\":{\"id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"type\":\"function_call\",\"status\":\"in_progress\",\"arguments\":\"\",\"call_id\":\"call_lkvijxr4p1r3NAjmFLTpKG3A\",\"name\":\"file_replace\"},\"output_index\":0,\"sequence_number\":2}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"{\\\"\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"NEfgrEE35Fd89L\",\"output_index\":0,\"sequence_number\":3}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"target\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"lIuKvaCUJG\",\"output_index\":0,\"sequence_number\":4}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\\\"\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"N1awDXbg0xBz9\",\"output_index\":0,\"sequence_number\":5}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"<\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"ZKi9SkVXEVZToIs\",\"output_index\":0,\"sequence_number\":6}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"fjEQsTq\",\"output_index\":0,\"sequence_number\":7}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" text\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"zw0zYmA0tHA\",\"output_index\":0,\"sequence_number\":8}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Alignment\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"3UPP93h\",\"output_index\":0,\"sequence_number\":9}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"0WzkQTqP4c6Bx\",\"output_index\":0,\"sequence_number\":10}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"left\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"iQAeqPTKofYZ\",\"output_index\":0,\"sequence_number\":11}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\"\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"4qSnWJK1DAvgii\",\"output_index\":0,\"sequence_number\":12}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" id\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"yUsodDtHx0oB6\",\"output_index\":0,\"sequence_number\":13}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"Vk5PiQD6y4tjp\",\"output_index\":0,\"sequence_number\":14}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"ref\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"VXgUwb7PnM4Gn\",\"output_index\":0,\"sequence_number\":15}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"2\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"6Ihkg65ShPzX9y1\",\"output_index\":0,\"sequence_number\":16}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\">\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"Z6fOYxCshAGva\",\"output_index\":0,\"sequence_number\":17}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"How\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"84gDrnLIIUtWc\",\"output_index\":0,\"sequence_number\":18}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" are\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"b4wxg0NkSLNz\",\"output_index\":0,\"sequence_number\":19}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" you\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"3Iyxw7f5LTiN\",\"output_index\":0,\"sequence_number\":20}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"?\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"9NcxaYxPczdoI\",\"output_index\":0,\"sequence_number\":21}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"3rIJfZf\",\"output_index\":0,\"sequence_number\":22}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\">\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"UAn40G3Ovb2vDvO\",\"output_index\":0,\"sequence_number\":23}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\",\\\"\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"g63oSiiE6nc0W\",\"output_index\":0,\"sequence_number\":24}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"replacement\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"H1IAp\",\"output_index\":0,\"sequence_number\":25}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\\\"\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"uNpkCqmPkl4w0\",\"output_index\":0,\"sequence_number\":26}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"<\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"8fri6CRq5GkD4KR\",\"output_index\":0,\"sequence_number\":27}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"ZdCCFKe\",\"output_index\":0,\"sequence_number\":28}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" text\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"WOpudmZJ5DR\",\"output_index\":0,\"sequence_number\":29}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Alignment\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"V2ftZPK\",\"output_index\":0,\"sequence_number\":30}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"TUhy0it6FhYXl\",\"output_index\":0,\"sequence_number\":31}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"left\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"pNhI1jajfjlA\",\"output_index\":0,\"sequence_number\":32}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\"\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"6bxDaLUq7Tc6eF\",\"output_index\":0,\"sequence_number\":33}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" id\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"56fIPO65PRTCr\",\"output_index\":0,\"sequence_number\":34}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"wIOcUDCTrsUyc\",\"output_index\":0,\"sequence_number\":35}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"ref\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"phMUDfKa23wAY\",\"output_index\":0,\"sequence_number\":36}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"2\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"ruabDZPchXuwGYN\",\"output_index\":0,\"sequence_number\":37}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\">\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"q3Ty7rw56Mp11\",\"output_index\":0,\"sequence_number\":38}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"How\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"mWjIRQcaD0nN7\",\"output_index\":0,\"sequence_number\":39}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" are\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"2WbyXWI93GvA\",\"output_index\":0,\"sequence_number\":40}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" you\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"RXzbfD5RReSV\",\"output_index\":0,\"sequence_number\":41}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"?\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"D73zImyXRpFTK\",\"output_index\":0,\"sequence_number\":42}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"plDTX5T\",\"output_index\":0,\"sequence_number\":43}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\">\\\\\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"yfb9PCjxqMkgis\",\"output_index\":0,\"sequence_number\":44}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"n\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"oSXn9HwSVLOor4c\",\"output_index\":0,\"sequence_number\":45}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"<\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"iAu1exmY5Pp1Q01\",\"output_index\":0,\"sequence_number\":46}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"kofuWrn\",\"output_index\":0,\"sequence_number\":47}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" text\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"7IeQn5M84ug\",\"output_index\":0,\"sequence_number\":48}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Alignment\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"UOdnrb6\",\"output_index\":0,\"sequence_number\":49}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"1JBJgAgd50IEZ\",\"output_index\":0,\"sequence_number\":50}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"left\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"tWjipGpRF3nt\",\"output_index\":0,\"sequence_number\":51}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\"\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"eLvAkI4IjrN9ly\",\"output_index\":0,\"sequence_number\":52}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" id\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"npCqKJZ2eXpWD\",\"output_index\":0,\"sequence_number\":53}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"kPQALSEXnqlqQ\",\"output_index\":0,\"sequence_number\":54}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"ref\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"FVvDa24ifn6TC\",\"output_index\":0,\"sequence_number\":55}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"3\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"FRv6cPKN3zncAMT\",\"output_index\":0,\"sequence_number\":56}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\">\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"5xO8lMxradFKD\",\"output_index\":0,\"sequence_number\":57}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"You\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"Aj0iabAKQr1Mn\",\"output_index\":0,\"sequence_number\":58}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" look\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"FBv9k41XTrP\",\"output_index\":0,\"sequence_number\":59}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" great\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"Ocb9DvCTQv\",\"output_index\":0,\"sequence_number\":60}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" today\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"BpsWcDgCdt\",\"output_index\":0,\"sequence_number\":61}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"!\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"fe4TLvfHa3EL6\",\"output_index\":0,\"sequence_number\":62}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"6iOlTW4\",\"output_index\":0,\"sequence_number\":63}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\">\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"ctJj4cKcHmytEjD\",\"output_index\":0,\"sequence_number\":64}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\"}\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"obfuscation\":\"7kFxdKwMeA6Nps\",\"output_index\":0,\"sequence_number\":65}\n\nevent: response.function_call_arguments.done\ndata: {\"type\":\"response.function_call_arguments.done\",\"arguments\":\"{\\\"target\\\":\\\"How are you? \\\",\\\"replacement\\\":\\\"How are you? \\\\nYou look great today! \\\"}\",\"item_id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"output_index\":0,\"sequence_number\":66}\n\nevent: response.output_item.done\ndata: {\"type\":\"response.output_item.done\",\"item\":{\"id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"type\":\"function_call\",\"status\":\"completed\",\"arguments\":\"{\\\"target\\\":\\\"How are you? \\\",\\\"replacement\\\":\\\"How are you? \\\\nYou look great today! \\\"}\",\"call_id\":\"call_lkvijxr4p1r3NAjmFLTpKG3A\",\"name\":\"file_replace\"},\"output_index\":0,\"sequence_number\":67}\n\nevent: response.completed\ndata: {\"type\":\"response.completed\",\"response\":{\"id\":\"resp_0b7295bf83b07ff300698e16c110d48194820b53d75ef0401e\",\"object\":\"response\",\"created_at\":1770919617,\"status\":\"completed\",\"background\":false,\"completed_at\":1770919618,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[{\"id\":\"fc_0b7295bf83b07ff300698e16c17a108194899c429135447658\",\"type\":\"function_call\",\"status\":\"completed\",\"arguments\":\"{\\\"target\\\":\\\"How are you? \\\",\\\"replacement\\\":\\\"How are you? \\\\nYou look great today! \\\"}\",\"call_id\":\"call_lkvijxr4p1r3NAjmFLTpKG3A\",\"name\":\"file_replace\"}],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"default\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"],\"additionalProperties\":false},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":{\"input_tokens\":230,\"input_tokens_details\":{\"cached_tokens\":0},\"output_tokens\":64,\"output_tokens_details\":{\"reasoning_tokens\":0},\"total_tokens\":294},\"user\":null,\"metadata\":{}},\"sequence_number\":68}\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/add a new paragraph (end)_1_528aa99624a5ea1ecf2419b1c5ec471a.json b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/add a new paragraph (end)_1_528aa99624a5ea1ecf2419b1c5ec471a.json
new file mode 100644
index 0000000000..f1d1b3e810
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/add a new paragraph (end)_1_528aa99624a5ea1ecf2419b1c5ec471a.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://api.openai.com/v1/responses",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"input\":[{\"role\":\"system\",\"content\":\"You are manipulating a text document using TSX components.\\nEach block is represented as a TSX component with props.\\n\"},{\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"There is no active selection. This is the latest state of the document (ignore previous documents, you MUST issue operations against this latest version of the document). \\nThe cursor is BETWEEN two blocks as indicated by cursor: true.\\nPrefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}]},{\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"{\\\"selection\\\":false,\\\"blocks\\\":[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"Hello, world! \\\"},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"How are you? \\\"}],\\\"isEmptyDocument\\\":false}\"}]},{\"role\":\"user\",\"content\":[{\"type\":\"input_text\",\"text\":\"add a new paragraph with the text 'You look great today!' after the last sentence\"}]}],\"tools\":[{\"type\":\"function\",\"name\":\"applyDocumentOperations\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Replace a part of the document file\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"file_replace\"]},\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"type\",\"target\",\"replacement\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"]}}],\"tool_choice\":\"required\",\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "event: response.created\ndata: {\"type\":\"response.created\",\"response\":{\"id\":\"resp_0cd60577277a029300698cd82212d08197a104dd16c5720ad6\",\"object\":\"response\",\"created_at\":1770838050,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"applyDocumentOperations\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Replace a part of the document file\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"file_replace\"]},\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"type\",\"target\",\"replacement\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"]},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":0}\n\nevent: response.in_progress\ndata: {\"type\":\"response.in_progress\",\"response\":{\"id\":\"resp_0cd60577277a029300698cd82212d08197a104dd16c5720ad6\",\"object\":\"response\",\"created_at\":1770838050,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"applyDocumentOperations\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Replace a part of the document file\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"file_replace\"]},\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"type\",\"target\",\"replacement\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"]},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":1}\n\nevent: response.output_item.added\ndata: {\"type\":\"response.output_item.added\",\"item\":{\"id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"type\":\"function_call\",\"status\":\"in_progress\",\"arguments\":\"\",\"call_id\":\"call_KY9MAUqMC8fr5Ed22QRmgVrl\",\"name\":\"applyDocumentOperations\"},\"output_index\":0,\"sequence_number\":2}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"{\\\"\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"ndH29ZXftuXwtd\",\"output_index\":0,\"sequence_number\":3}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"operations\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"jWMW8u\",\"output_index\":0,\"sequence_number\":4}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":[\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"kTmXFHVwEtR1d\",\"output_index\":0,\"sequence_number\":5}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"{\\\"\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"ZPYyxxsQWBk4vY\",\"output_index\":0,\"sequence_number\":6}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"type\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"rr8OPU2nCfRh\",\"output_index\":0,\"sequence_number\":7}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\\\"\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"JipxMTfGCs2Xp\",\"output_index\":0,\"sequence_number\":8}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"file\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"jKZVd01NJyp4\",\"output_index\":0,\"sequence_number\":9}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"_replace\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"1dKnLX8U\",\"output_index\":0,\"sequence_number\":10}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\",\\\"\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"7o26lIFGho9l5\",\"output_index\":0,\"sequence_number\":11}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"target\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"tun1wluAjL\",\"output_index\":0,\"sequence_number\":12}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\\\"\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"sRhaYBMO6qW1o\",\"output_index\":0,\"sequence_number\":13}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"<\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"wUm5Psvx91Ic0nE\",\"output_index\":0,\"sequence_number\":14}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"V5Os18b\",\"output_index\":0,\"sequence_number\":15}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" text\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"gQlp2JhwTbZ\",\"output_index\":0,\"sequence_number\":16}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Alignment\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"Sh61QJu\",\"output_index\":0,\"sequence_number\":17}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"0xGa0sPtGAePm\",\"output_index\":0,\"sequence_number\":18}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"left\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"oxEnH5ELs6a7\",\"output_index\":0,\"sequence_number\":19}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\"\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"HUozrzLML6wc6y\",\"output_index\":0,\"sequence_number\":20}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" id\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"cqtCEPJJXsOMO\",\"output_index\":0,\"sequence_number\":21}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"N2xG9qpxbgRzo\",\"output_index\":0,\"sequence_number\":22}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"ref\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"P0mPJKrdobf5E\",\"output_index\":0,\"sequence_number\":23}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"2\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"Q1gI1YFm3d8AgLH\",\"output_index\":0,\"sequence_number\":24}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\">\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"rQI8LmFtTCZOS\",\"output_index\":0,\"sequence_number\":25}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"How\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"dEAbeDpkMiswR\",\"output_index\":0,\"sequence_number\":26}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" are\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"HvdivnbOQmoA\",\"output_index\":0,\"sequence_number\":27}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" you\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"ry8Vg35jPDgr\",\"output_index\":0,\"sequence_number\":28}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"?\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"TQcekRgYvDrMm\",\"output_index\":0,\"sequence_number\":29}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"amKUWcK\",\"output_index\":0,\"sequence_number\":30}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\">\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"sY9KFNGSjJozlNL\",\"output_index\":0,\"sequence_number\":31}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\",\\\"\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"zPKMFL0DkgeQh\",\"output_index\":0,\"sequence_number\":32}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"replacement\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"92HnW\",\"output_index\":0,\"sequence_number\":33}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\\\"\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"CznYITU5Hx9ck\",\"output_index\":0,\"sequence_number\":34}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"<\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"3AH2ner9BIeQXHs\",\"output_index\":0,\"sequence_number\":35}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"qzvRg5m\",\"output_index\":0,\"sequence_number\":36}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" text\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"zvbabqP33RW\",\"output_index\":0,\"sequence_number\":37}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Alignment\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"6rnht7r\",\"output_index\":0,\"sequence_number\":38}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"EFPA9dgqie9TU\",\"output_index\":0,\"sequence_number\":39}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"left\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"ihJZ9tHeTNk5\",\"output_index\":0,\"sequence_number\":40}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\"\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"XXoR0rX5yLqOMO\",\"output_index\":0,\"sequence_number\":41}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" id\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"qwGKqtZRmnI1r\",\"output_index\":0,\"sequence_number\":42}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"fPLkyjtOV9bMW\",\"output_index\":0,\"sequence_number\":43}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"ref\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"L658gyQwVFCxx\",\"output_index\":0,\"sequence_number\":44}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"2\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"ZcUrSKJ46nyWq2R\",\"output_index\":0,\"sequence_number\":45}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\">\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"wZa0oO98jadfd\",\"output_index\":0,\"sequence_number\":46}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"How\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"u8wieJKLrXrJn\",\"output_index\":0,\"sequence_number\":47}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" are\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"7GhK3hxGXtzF\",\"output_index\":0,\"sequence_number\":48}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" you\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"p3Nx68mG8g0q\",\"output_index\":0,\"sequence_number\":49}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"?\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"MypmvbECLQaaQ\",\"output_index\":0,\"sequence_number\":50}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"oVi7K0n\",\"output_index\":0,\"sequence_number\":51}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"><\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"u0ZDsTR5q1Qjsm\",\"output_index\":0,\"sequence_number\":52}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"7sxJBBu\",\"output_index\":0,\"sequence_number\":53}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" text\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"LgGAyOxYAJy\",\"output_index\":0,\"sequence_number\":54}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Alignment\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"80jXx11\",\"output_index\":0,\"sequence_number\":55}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"TQNXxMZPaJ7wS\",\"output_index\":0,\"sequence_number\":56}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"left\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"CTdeIj3lyo8P\",\"output_index\":0,\"sequence_number\":57}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\"\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"heq2L8I6w0hnEb\",\"output_index\":0,\"sequence_number\":58}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" id\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"m3mmN7ITIWb6x\",\"output_index\":0,\"sequence_number\":59}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"5CJlitVE0ONEk\",\"output_index\":0,\"sequence_number\":60}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"new\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"FdAw7Ooe4TaPi\",\"output_index\":0,\"sequence_number\":61}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"1\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"eIgp22MlblkgDSa\",\"output_index\":0,\"sequence_number\":62}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\">\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"8OGTfToi0m8Wa\",\"output_index\":0,\"sequence_number\":63}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"You\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"3On8P2qwRXycn\",\"output_index\":0,\"sequence_number\":64}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" look\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"tof2mjYO3OO\",\"output_index\":0,\"sequence_number\":65}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" great\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"pO5xk2Zjz6\",\"output_index\":0,\"sequence_number\":66}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" today\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"VA7GrLjJk5\",\"output_index\":0,\"sequence_number\":67}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"!\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"GutDdRiHk5XC3\",\"output_index\":0,\"sequence_number\":68}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"w7aAJ9m\",\"output_index\":0,\"sequence_number\":69}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\">\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"53PcNdzKDJKY1Tl\",\"output_index\":0,\"sequence_number\":70}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\"}\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"100orD7lC4ycR1\",\"output_index\":0,\"sequence_number\":71}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"]}\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"obfuscation\":\"PHP3MlqsM4upJN\",\"output_index\":0,\"sequence_number\":72}\n\nevent: response.function_call_arguments.done\ndata: {\"type\":\"response.function_call_arguments.done\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"file_replace\\\",\\\"target\\\":\\\"How are you? \\\",\\\"replacement\\\":\\\"How are you? You look great today! \\\"}]}\",\"item_id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"output_index\":0,\"sequence_number\":73}\n\nevent: response.output_item.done\ndata: {\"type\":\"response.output_item.done\",\"item\":{\"id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"type\":\"function_call\",\"status\":\"completed\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"file_replace\\\",\\\"target\\\":\\\"How are you? \\\",\\\"replacement\\\":\\\"How are you? You look great today! \\\"}]}\",\"call_id\":\"call_KY9MAUqMC8fr5Ed22QRmgVrl\",\"name\":\"applyDocumentOperations\"},\"output_index\":0,\"sequence_number\":74}\n\nevent: response.completed\ndata: {\"type\":\"response.completed\",\"response\":{\"id\":\"resp_0cd60577277a029300698cd82212d08197a104dd16c5720ad6\",\"object\":\"response\",\"created_at\":1770838050,\"status\":\"completed\",\"background\":false,\"completed_at\":1770838051,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[{\"id\":\"fc_0cd60577277a029300698cd8226f9c8197bddceeecb2133191\",\"type\":\"function_call\",\"status\":\"completed\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"file_replace\\\",\\\"target\\\":\\\"How are you? \\\",\\\"replacement\\\":\\\"How are you? You look great today! \\\"}]}\",\"call_id\":\"call_KY9MAUqMC8fr5Ed22QRmgVrl\",\"name\":\"applyDocumentOperations\"}],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"default\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"applyDocumentOperations\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Replace a part of the document file\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"file_replace\"]},\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"type\",\"target\",\"replacement\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"]},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":{\"input_tokens\":267,\"input_tokens_details\":{\"cached_tokens\":0},\"output_tokens\":71,\"output_tokens_details\":{\"reasoning_tokens\":0},\"total_tokens\":338},\"user\":null,\"metadata\":{}},\"sequence_number\":75}\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/add a new paragraph (start)_1_4b63d3fb3ebbd1723d659e661c8300c6.json b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/add a new paragraph (start)_1_4b63d3fb3ebbd1723d659e661c8300c6.json
new file mode 100644
index 0000000000..85ce8d4a06
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/add a new paragraph (start)_1_4b63d3fb3ebbd1723d659e661c8300c6.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://api.openai.com/v1/responses",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"input\":[{\"role\":\"system\",\"content\":\"You are manipulating a text document using TSX components.\\nEach block is represented as a TSX component with props.\\n\"},{\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"There is no active selection. This is the latest state of the document (ignore previous documents, you MUST issue operations against this latest version of the document). \\nThe cursor is BETWEEN two blocks as indicated by cursor: true.\\nPrefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}]},{\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"{\\\"selection\\\":false,\\\"blocks\\\":[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"Hello, world! \\\"},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"How are you? \\\"}],\\\"isEmptyDocument\\\":false}\"}]},{\"role\":\"user\",\"content\":[{\"type\":\"input_text\",\"text\":\"add a new paragraph with the text 'You look great today!' before the first sentence\"}]}],\"tools\":[{\"type\":\"function\",\"name\":\"applyDocumentOperations\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Replace a part of the document file\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"file_replace\"]},\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"type\",\"target\",\"replacement\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"]}}],\"tool_choice\":\"required\",\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "event: response.created\ndata: {\"type\":\"response.created\",\"response\":{\"id\":\"resp_09c1bf95a588a3a500698cd820f7ac81969c9645f7e2b70c04\",\"object\":\"response\",\"created_at\":1770838048,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"applyDocumentOperations\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Replace a part of the document file\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"file_replace\"]},\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"type\",\"target\",\"replacement\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"]},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":0}\n\nevent: response.in_progress\ndata: {\"type\":\"response.in_progress\",\"response\":{\"id\":\"resp_09c1bf95a588a3a500698cd820f7ac81969c9645f7e2b70c04\",\"object\":\"response\",\"created_at\":1770838048,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"applyDocumentOperations\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Replace a part of the document file\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"file_replace\"]},\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"type\",\"target\",\"replacement\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"]},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":1}\n\nevent: response.output_item.added\ndata: {\"type\":\"response.output_item.added\",\"item\":{\"id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"type\":\"function_call\",\"status\":\"in_progress\",\"arguments\":\"\",\"call_id\":\"call_Tnds3lipGiMdJXAnCSG4F7hQ\",\"name\":\"applyDocumentOperations\"},\"output_index\":0,\"sequence_number\":2}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"{\\\"\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"Ijtuo2PH7VyR6l\",\"output_index\":0,\"sequence_number\":3}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"operations\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"0VaY1a\",\"output_index\":0,\"sequence_number\":4}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":[\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"FWPdtUo91MPK5\",\"output_index\":0,\"sequence_number\":5}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"{\\\"\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"QgzVPPrughvlgW\",\"output_index\":0,\"sequence_number\":6}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"type\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"BGthyoFVFjh9\",\"output_index\":0,\"sequence_number\":7}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\\\"\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"rV06tF6MztzvV\",\"output_index\":0,\"sequence_number\":8}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"file\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"oFSgAQ1HfD4v\",\"output_index\":0,\"sequence_number\":9}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"_replace\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"cSf6sXzK\",\"output_index\":0,\"sequence_number\":10}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\",\\\"\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"cB8JpecUMFv0Z\",\"output_index\":0,\"sequence_number\":11}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"target\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"RPRYEyYVGj\",\"output_index\":0,\"sequence_number\":12}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\\\"\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"mlROUcU07vafi\",\"output_index\":0,\"sequence_number\":13}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"<\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"MNO4UI2EL8DM1WB\",\"output_index\":0,\"sequence_number\":14}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"BLauEhW\",\"output_index\":0,\"sequence_number\":15}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" text\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"2ii26rQBbWi\",\"output_index\":0,\"sequence_number\":16}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Alignment\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"mGBylnN\",\"output_index\":0,\"sequence_number\":17}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"PvSgbBbrDKXyJ\",\"output_index\":0,\"sequence_number\":18}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"left\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"EWcFpw40939R\",\"output_index\":0,\"sequence_number\":19}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\"\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"4TEXRGHq80zR9U\",\"output_index\":0,\"sequence_number\":20}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" id\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"JXfXr3SCZExHM\",\"output_index\":0,\"sequence_number\":21}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"VsRHWgSK6kyJ7\",\"output_index\":0,\"sequence_number\":22}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"ref\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"IhuKyRAUJ6zQR\",\"output_index\":0,\"sequence_number\":23}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"1\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"EDLRn22OzTdgFEL\",\"output_index\":0,\"sequence_number\":24}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\">\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"u1Ilfx8rOHI2h\",\"output_index\":0,\"sequence_number\":25}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\",\\\"\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"gSHZfTMb9zXvG\",\"output_index\":0,\"sequence_number\":26}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"replacement\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"T0uGf\",\"output_index\":0,\"sequence_number\":27}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\\\"\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"jy0FMDcsbnLIN\",\"output_index\":0,\"sequence_number\":28}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"<\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"ynE0w6lX2f4PjEO\",\"output_index\":0,\"sequence_number\":29}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"KG76epy\",\"output_index\":0,\"sequence_number\":30}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" text\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"9nPm3IZ2PcI\",\"output_index\":0,\"sequence_number\":31}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Alignment\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"MBOxcuh\",\"output_index\":0,\"sequence_number\":32}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"jyzkZsp80lasZ\",\"output_index\":0,\"sequence_number\":33}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"left\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"7ADrHkZOra2x\",\"output_index\":0,\"sequence_number\":34}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\"\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"JFJH1VAeLzd4aL\",\"output_index\":0,\"sequence_number\":35}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" id\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"wiwBYww1lsBqQ\",\"output_index\":0,\"sequence_number\":36}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"5dPWwQWvRGQ49\",\"output_index\":0,\"sequence_number\":37}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"new\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"fyr3AwtoiyTzQ\",\"output_index\":0,\"sequence_number\":38}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"1\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"3X2uUpSDyxqS7mg\",\"output_index\":0,\"sequence_number\":39}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\">\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"54O9pcPMucUTU\",\"output_index\":0,\"sequence_number\":40}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"You\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"01EuWznZDe3j0\",\"output_index\":0,\"sequence_number\":41}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" look\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"wIO2oFTNHpH\",\"output_index\":0,\"sequence_number\":42}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" great\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"ydVTRQuX6C\",\"output_index\":0,\"sequence_number\":43}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" today\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"ksX7DK2TbT\",\"output_index\":0,\"sequence_number\":44}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"!\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"o30HzD2J58HGD\",\"output_index\":0,\"sequence_number\":45}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"M1IcRIL\",\"output_index\":0,\"sequence_number\":46}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"><\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"iaLleCyTCOTdmH\",\"output_index\":0,\"sequence_number\":47}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"fCiR02F\",\"output_index\":0,\"sequence_number\":48}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" text\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"wAlzcA2dM7b\",\"output_index\":0,\"sequence_number\":49}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Alignment\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"gJPzai7\",\"output_index\":0,\"sequence_number\":50}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"DTKnXc4hEf3A6\",\"output_index\":0,\"sequence_number\":51}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"left\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"NHbCND7aCy8X\",\"output_index\":0,\"sequence_number\":52}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\"\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"azEv2M0fVYVRYt\",\"output_index\":0,\"sequence_number\":53}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" id\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"vQDN6FoLMTu3S\",\"output_index\":0,\"sequence_number\":54}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"7DKZ9xCnUXVVW\",\"output_index\":0,\"sequence_number\":55}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"ref\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"pv0aAFVemb3Ct\",\"output_index\":0,\"sequence_number\":56}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"1\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"cs1WSTpYX75EkRb\",\"output_index\":0,\"sequence_number\":57}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\">\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"L58GagOKM3fxz\",\"output_index\":0,\"sequence_number\":58}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\"}\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"m4WZ903AidL4lC\",\"output_index\":0,\"sequence_number\":59}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"]}\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"obfuscation\":\"ioRtgKjrTwq1S8\",\"output_index\":0,\"sequence_number\":60}\n\nevent: response.function_call_arguments.done\ndata: {\"type\":\"response.function_call_arguments.done\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"file_replace\\\",\\\"target\\\":\\\"\\\",\\\"replacement\\\":\\\"You look great today! \\\"}]}\",\"item_id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"output_index\":0,\"sequence_number\":61}\n\nevent: response.output_item.done\ndata: {\"type\":\"response.output_item.done\",\"item\":{\"id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"type\":\"function_call\",\"status\":\"completed\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"file_replace\\\",\\\"target\\\":\\\"\\\",\\\"replacement\\\":\\\"You look great today! \\\"}]}\",\"call_id\":\"call_Tnds3lipGiMdJXAnCSG4F7hQ\",\"name\":\"applyDocumentOperations\"},\"output_index\":0,\"sequence_number\":62}\n\nevent: response.completed\ndata: {\"type\":\"response.completed\",\"response\":{\"id\":\"resp_09c1bf95a588a3a500698cd820f7ac81969c9645f7e2b70c04\",\"object\":\"response\",\"created_at\":1770838048,\"status\":\"completed\",\"background\":false,\"completed_at\":1770838049,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[{\"id\":\"fc_09c1bf95a588a3a500698cd82146dc819682dfc6501a653bf4\",\"type\":\"function_call\",\"status\":\"completed\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"file_replace\\\",\\\"target\\\":\\\"\\\",\\\"replacement\\\":\\\"You look great today! \\\"}]}\",\"call_id\":\"call_Tnds3lipGiMdJXAnCSG4F7hQ\",\"name\":\"applyDocumentOperations\"}],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"default\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"applyDocumentOperations\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Replace a part of the document file\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"file_replace\"]},\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"type\",\"target\",\"replacement\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"]},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":{\"input_tokens\":267,\"input_tokens_details\":{\"cached_tokens\":0},\"output_tokens\":59,\"output_tokens_details\":{\"reasoning_tokens\":0},\"total_tokens\":326},\"user\":null,\"metadata\":{}},\"sequence_number\":63}\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/add a new paragraph (start)_1_54c1b65e18228a05a990e64a476a12e2.json b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/add a new paragraph (start)_1_54c1b65e18228a05a990e64a476a12e2.json
new file mode 100644
index 0000000000..25c478de79
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Add/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/add a new paragraph (start)_1_54c1b65e18228a05a990e64a476a12e2.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://api.openai.com/v1/responses",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"input\":[{\"role\":\"system\",\"content\":\"You are manipulating a text document using TSX components.\\nEach block is represented as a TSX component with props.\\n\"},{\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"There is no active selection. This is the latest state of the document (ignore previous documents, you MUST issue operations against this latest version of the document). \\nThe cursor is BETWEEN two blocks as indicated by cursor: true.\\nPrefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}]},{\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"Hello, world! \\\"},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"How are you? \\\"}]\"}]},{\"role\":\"user\",\"content\":[{\"type\":\"input_text\",\"text\":\"add a new paragraph with the text 'You look great today!' before the first sentence\"}]}],\"tools\":[{\"type\":\"function\",\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"]}}],\"tool_choice\":\"required\",\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "event: response.created\ndata: {\"type\":\"response.created\",\"response\":{\"id\":\"resp_090df34a8460908100698e16bf06dc8190a724e07f4eaec09a\",\"object\":\"response\",\"created_at\":1770919615,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"],\"additionalProperties\":false},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":0}\n\nevent: response.in_progress\ndata: {\"type\":\"response.in_progress\",\"response\":{\"id\":\"resp_090df34a8460908100698e16bf06dc8190a724e07f4eaec09a\",\"object\":\"response\",\"created_at\":1770919615,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"],\"additionalProperties\":false},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":1}\n\nevent: response.output_item.added\ndata: {\"type\":\"response.output_item.added\",\"item\":{\"id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"type\":\"function_call\",\"status\":\"in_progress\",\"arguments\":\"\",\"call_id\":\"call_wANbTKU085qbIrsID4vsBUVq\",\"name\":\"file_replace\"},\"output_index\":0,\"sequence_number\":2}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"{\\\"\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"Yv4KMr7nDl7CwE\",\"output_index\":0,\"sequence_number\":3}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"target\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"WovBOmplWd\",\"output_index\":0,\"sequence_number\":4}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\\\"\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"frpWxmpZibveF\",\"output_index\":0,\"sequence_number\":5}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"<\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"fH4pwps9H3VKjmq\",\"output_index\":0,\"sequence_number\":6}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"RC2P0jw\",\"output_index\":0,\"sequence_number\":7}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" text\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"d4qw3Qa3W3p\",\"output_index\":0,\"sequence_number\":8}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Alignment\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"hLqad2S\",\"output_index\":0,\"sequence_number\":9}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"FT5XNVkSlMsM6\",\"output_index\":0,\"sequence_number\":10}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"left\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"vohNXFzqVi5p\",\"output_index\":0,\"sequence_number\":11}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\"\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"HAgldoiliAWKvX\",\"output_index\":0,\"sequence_number\":12}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" id\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"0diyi059ea0cS\",\"output_index\":0,\"sequence_number\":13}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"yZVZEm2cFjTTl\",\"output_index\":0,\"sequence_number\":14}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"ref\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"PZQoXHjhSTIYv\",\"output_index\":0,\"sequence_number\":15}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"1\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"lQkZeVfrI257PTf\",\"output_index\":0,\"sequence_number\":16}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\">\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"yU2oi75ndOlIk\",\"output_index\":0,\"sequence_number\":17}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Hello\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"CjSBHWNbrtQ\",\"output_index\":0,\"sequence_number\":18}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\",\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"2cHUy61bXGyZD98\",\"output_index\":0,\"sequence_number\":19}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" world\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"oj1FHxCQmd\",\"output_index\":0,\"sequence_number\":20}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"!\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"KV1xVBFnNkWt7\",\"output_index\":0,\"sequence_number\":21}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"j5RMdHr\",\"output_index\":0,\"sequence_number\":22}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\">\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"iCoyh6LPPxP2FwC\",\"output_index\":0,\"sequence_number\":23}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\",\\\"\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"YPDl0yFYzHaVG\",\"output_index\":0,\"sequence_number\":24}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"replacement\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"tr0QB\",\"output_index\":0,\"sequence_number\":25}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\\\"\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"BXQhAJjSlbMze\",\"output_index\":0,\"sequence_number\":26}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"<\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"OfDpJ2JDVM33Lsp\",\"output_index\":0,\"sequence_number\":27}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"s00FwP9\",\"output_index\":0,\"sequence_number\":28}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" text\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"IIEoPRa27Sx\",\"output_index\":0,\"sequence_number\":29}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Alignment\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"00mqAmI\",\"output_index\":0,\"sequence_number\":30}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"IzbmU42fAkExG\",\"output_index\":0,\"sequence_number\":31}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"left\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"6IWbBHNwizup\",\"output_index\":0,\"sequence_number\":32}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\"\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"o6z8v0FTipZQnW\",\"output_index\":0,\"sequence_number\":33}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" id\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"F2nBB2xS4NxqG\",\"output_index\":0,\"sequence_number\":34}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"twoOsIaUn1xPd\",\"output_index\":0,\"sequence_number\":35}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"new\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"oTp4TSWflwpKL\",\"output_index\":0,\"sequence_number\":36}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"1\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"AEbdI6s2pNHP4uj\",\"output_index\":0,\"sequence_number\":37}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\">\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"DksgO0vSY8Kng\",\"output_index\":0,\"sequence_number\":38}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"You\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"hvUtKAfz6gkPC\",\"output_index\":0,\"sequence_number\":39}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" look\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"73gckcXiUyb\",\"output_index\":0,\"sequence_number\":40}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" great\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"GfESNrzEIT\",\"output_index\":0,\"sequence_number\":41}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" today\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"9VjSUM3rDj\",\"output_index\":0,\"sequence_number\":42}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"!\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"LL0P5WhcR06FQ\",\"output_index\":0,\"sequence_number\":43}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"LU1aSB6\",\"output_index\":0,\"sequence_number\":44}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\">\\\\\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"ihf85rAZDhB1Bo\",\"output_index\":0,\"sequence_number\":45}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"n\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"uRZPFsRCCN4CjNn\",\"output_index\":0,\"sequence_number\":46}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"<\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"AjzhwALvvEZlWoy\",\"output_index\":0,\"sequence_number\":47}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"hmlSPqj\",\"output_index\":0,\"sequence_number\":48}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" text\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"hkYWIFqlbwA\",\"output_index\":0,\"sequence_number\":49}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Alignment\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"j0JuO2q\",\"output_index\":0,\"sequence_number\":50}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"JJjGt0c0MQW9T\",\"output_index\":0,\"sequence_number\":51}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"left\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"MBHExIDY2m0M\",\"output_index\":0,\"sequence_number\":52}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\"\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"WBiALihtXYgapu\",\"output_index\":0,\"sequence_number\":53}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" id\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"ypsLQp8ZRFMjw\",\"output_index\":0,\"sequence_number\":54}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"IKruxiOVdGwf4\",\"output_index\":0,\"sequence_number\":55}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"ref\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"vwOWkXCPqrEY2\",\"output_index\":0,\"sequence_number\":56}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"1\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"mbLgwgB4JBhMQYD\",\"output_index\":0,\"sequence_number\":57}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\">\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"CPpimljsq3RvQ\",\"output_index\":0,\"sequence_number\":58}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Hello\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"t2E05imhY5I\",\"output_index\":0,\"sequence_number\":59}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\",\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"WGakmFzbHLxEfST\",\"output_index\":0,\"sequence_number\":60}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" world\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"XJc1wKghDS\",\"output_index\":0,\"sequence_number\":61}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"!\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"ZLMbmG2ZKvBRk\",\"output_index\":0,\"sequence_number\":62}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"FzEPPiE\",\"output_index\":0,\"sequence_number\":63}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\">\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"2Kun2HKpNYBluDV\",\"output_index\":0,\"sequence_number\":64}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\"}\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"obfuscation\":\"vypnMQtWtwtRri\",\"output_index\":0,\"sequence_number\":65}\n\nevent: response.function_call_arguments.done\ndata: {\"type\":\"response.function_call_arguments.done\",\"arguments\":\"{\\\"target\\\":\\\"Hello, world! \\\",\\\"replacement\\\":\\\"You look great today! \\\\nHello, world! \\\"}\",\"item_id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"output_index\":0,\"sequence_number\":66}\n\nevent: response.output_item.done\ndata: {\"type\":\"response.output_item.done\",\"item\":{\"id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"type\":\"function_call\",\"status\":\"completed\",\"arguments\":\"{\\\"target\\\":\\\"Hello, world! \\\",\\\"replacement\\\":\\\"You look great today! \\\\nHello, world! \\\"}\",\"call_id\":\"call_wANbTKU085qbIrsID4vsBUVq\",\"name\":\"file_replace\"},\"output_index\":0,\"sequence_number\":67}\n\nevent: response.completed\ndata: {\"type\":\"response.completed\",\"response\":{\"id\":\"resp_090df34a8460908100698e16bf06dc8190a724e07f4eaec09a\",\"object\":\"response\",\"created_at\":1770919615,\"status\":\"completed\",\"background\":false,\"completed_at\":1770919616,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[{\"id\":\"fc_090df34a8460908100698e16bfc3a88190ade0229f57b498b4\",\"type\":\"function_call\",\"status\":\"completed\",\"arguments\":\"{\\\"target\\\":\\\"Hello, world! \\\",\\\"replacement\\\":\\\"You look great today! \\\\nHello, world! \\\"}\",\"call_id\":\"call_wANbTKU085qbIrsID4vsBUVq\",\"name\":\"file_replace\"}],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"default\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"],\"additionalProperties\":false},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":{\"input_tokens\":230,\"input_tokens_details\":{\"cached_tokens\":0},\"output_tokens\":64,\"output_tokens_details\":{\"reasoning_tokens\":0},\"total_tokens\":294},\"user\":null,\"metadata\":{}},\"sequence_number\":68}\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-haiku-4-5 (streaming)/clear block formatting_1_1c369cd8c5a498da0f47051946893914.json b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-haiku-4-5 (streaming)/clear block formatting_1_1c369cd8c5a498da0f47051946893914.json
new file mode 100644
index 0000000000..e16458bf35
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-haiku-4-5 (streaming)/clear block formatting_1_1c369cd8c5a498da0f47051946893914.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://api.anthropic.com/v1/messages",
+ "body": "{\"model\":\"claude-haiku-4-5\",\"max_tokens\":64000,\"system\":[{\"type\":\"text\",\"text\":\"You are manipulating a text document using TSX components.\\nEach block is represented as a TSX component with props.\\n\"}],\"messages\":[{\"role\":\"assistant\",\"content\":[{\"type\":\"text\",\"text\":\"There is no active selection. This is the latest state of the document (ignore previous documents, you MUST issue operations against this latest version of the document). \\nThe cursor is BETWEEN two blocks as indicated by cursor: true.\\nPrefer updating existing blocks over removing and adding (but this also depends on the user's question).\"},{\"type\":\"text\",\"text\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"Colored text \\\"},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"Aligned text \\\"}]\"}]},{\"role\":\"user\",\"content\":[{\"type\":\"text\",\"text\":\"clear the formatting (colors and alignment)\"}]}],\"tools\":[{\"name\":\"file_replace\",\"input_schema\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"]}}],\"tool_choice\":{\"type\":\"any\"},\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"model\":\"claude-haiku-4-5-20251001\",\"id\":\"msg_01QkzXc6kM1d5srqgdP9Jnq6\",\"type\":\"message\",\"role\":\"assistant\",\"content\":[],\"stop_reason\":null,\"stop_sequence\":null,\"usage\":{\"input_tokens\":859,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"cache_creation\":{\"ephemeral_5m_input_tokens\":0,\"ephemeral_1h_input_tokens\":0},\"output_tokens\":8,\"service_tier\":\"standard\",\"inference_geo\":\"not_available\"}} }\n\nevent: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"tool_use\",\"id\":\"toolu_013MzWceVNEiYfZ2CMN6WwCt\",\"name\":\"file_replace\",\"input\":{}} }\n\nevent: ping\ndata: {\"type\": \"ping\"}\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"{\\\"target\\\": \\\"\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"Colored text \"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"\\\", \\\"replacement\\\": \\\"\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"Colored text \"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"\\\"}\"} }\n\nevent: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0 }\n\nevent: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":1,\"content_block\":{\"type\":\"tool_use\",\"id\":\"toolu_018B5Rxq8Qs4gA1qpgi3FiYB\",\"name\":\"file_replace\",\"input\":{}} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":1,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":1,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"{\\\"target\\\": \\\"Aligned text\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":1,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\" \"}}\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":1,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"\\\", \\\"replacement\\\": \\\"Aligned text \"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":1,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"\\\"}\"} }\n\nevent: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":1 }\n\nevent: message_delta\ndata: {\"type\":\"message_delta\",\"delta\":{\"stop_reason\":\"tool_use\",\"stop_sequence\":null},\"usage\":{\"input_tokens\":859,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":170} }\n\nevent: message_stop\ndata: {\"type\":\"message_stop\" }\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-haiku-4-5 (streaming)/fix spelling mid-word selection_1_f958ac638e675d62743bd99fcc891740.json b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-haiku-4-5 (streaming)/fix spelling mid-word selection_1_f958ac638e675d62743bd99fcc891740.json
new file mode 100644
index 0000000000..f232545fc9
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-haiku-4-5 (streaming)/fix spelling mid-word selection_1_f958ac638e675d62743bd99fcc891740.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://api.anthropic.com/v1/messages",
+ "body": "{\"model\":\"claude-haiku-4-5\",\"max_tokens\":64000,\"system\":[{\"type\":\"text\",\"text\":\"You are manipulating a text document using TSX components.\\nEach block is represented as a TSX component with props.\\n\"}],\"messages\":[{\"role\":\"assistant\",\"content\":[{\"type\":\"text\",\"text\":\"This is the latest state of the selection (ignore previous selections, you MUST issue operations against this latest version of the selection):\"},{\"type\":\"text\",\"text\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"Hello, world! Dow are you? \\\"}]\"},{\"type\":\"text\",\"text\":\"This is the latest state of the entire document (INCLUDING the selected text), \\nyou can use this to find the selected text to understand the context (but you MUST NOT issue operations against this document, you MUST issue operations against the selection):\"},{\"type\":\"text\",\"text\":\"[{\\\"block\\\":\\\"Hello, world! Dow are you? \\\"}]\"}]},{\"role\":\"user\",\"content\":[{\"type\":\"text\",\"text\":\"fix spelling\"}]}],\"tools\":[{\"name\":\"file_replace\",\"input_schema\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"]}}],\"tool_choice\":{\"type\":\"any\"},\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"model\":\"claude-haiku-4-5-20251001\",\"id\":\"msg_01Eegao48DWXsst6gTedQtB9\",\"type\":\"message\",\"role\":\"assistant\",\"content\":[],\"stop_reason\":null,\"stop_sequence\":null,\"usage\":{\"input_tokens\":860,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"cache_creation\":{\"ephemeral_5m_input_tokens\":0,\"ephemeral_1h_input_tokens\":0},\"output_tokens\":8,\"service_tier\":\"standard\",\"inference_geo\":\"not_available\"}}}\n\nevent: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"tool_use\",\"id\":\"toolu_013KoRjcvywDLfjQP2fhUhVM\",\"name\":\"file_replace\",\"input\":{}} }\n\nevent: ping\ndata: {\"type\": \"ping\"}\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"{\\\"target\\\": \\\"Dow are\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\" you?\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"\\\", \\\"replacement\\\": \\\"How\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\" are you?\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"\\\"}\"} }\n\nevent: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0 }\n\nevent: message_delta\ndata: {\"type\":\"message_delta\",\"delta\":{\"stop_reason\":\"tool_use\",\"stop_sequence\":null},\"usage\":{\"input_tokens\":860,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":62} }\n\nevent: message_stop\ndata: {\"type\":\"message_stop\" }\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-haiku-4-5 (streaming)/modify nested content_1_c765e50907caf6893b85a5e8053f3a29.json b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-haiku-4-5 (streaming)/modify nested content_1_c765e50907caf6893b85a5e8053f3a29.json
new file mode 100644
index 0000000000..73d5526cb8
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-haiku-4-5 (streaming)/modify nested content_1_c765e50907caf6893b85a5e8053f3a29.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://api.anthropic.com/v1/messages",
+ "body": "{\"model\":\"claude-haiku-4-5\",\"max_tokens\":64000,\"system\":[{\"type\":\"text\",\"text\":\"You are manipulating a text document using TSX components.\\nEach block is represented as a TSX component with props.\\n\"}],\"messages\":[{\"role\":\"assistant\",\"content\":[{\"type\":\"text\",\"text\":\"There is no active selection. This is the latest state of the document (ignore previous documents, you MUST issue operations against this latest version of the document). \\nThe cursor is BETWEEN two blocks as indicated by cursor: true.\\nPrefer updating existing blocks over removing and adding (but this also depends on the user's question).\"},{\"type\":\"text\",\"text\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"I need to buy: \\\"},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"Apples \\\"}]\"}]},{\"role\":\"user\",\"content\":[{\"type\":\"text\",\"text\":\"make apples uppercase\"}]}],\"tools\":[{\"name\":\"file_replace\",\"input_schema\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"]}}],\"tool_choice\":{\"type\":\"any\"},\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"model\":\"claude-haiku-4-5-20251001\",\"id\":\"msg_01CDm5G4HcQJb18JM4jZHGtu\",\"type\":\"message\",\"role\":\"assistant\",\"content\":[],\"stop_reason\":null,\"stop_sequence\":null,\"usage\":{\"input_tokens\":852,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"cache_creation\":{\"ephemeral_5m_input_tokens\":0,\"ephemeral_1h_input_tokens\":0},\"output_tokens\":8,\"service_tier\":\"standard\",\"inference_geo\":\"not_available\"}} }\n\nevent: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"tool_use\",\"id\":\"toolu_011punvZFF8oK4w9JVRL4h6z\",\"name\":\"file_replace\",\"input\":{}}}\n\nevent: ping\ndata: {\"type\": \"ping\"}\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"{\\\"target\\\": \\\"Apples\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"\\\", \\\"replacement\\\": \\\"APPLES\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"\\\"}\"} }\n\nevent: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0 }\n\nevent: message_delta\ndata: {\"type\":\"message_delta\",\"delta\":{\"stop_reason\":\"tool_use\",\"stop_sequence\":null},\"usage\":{\"input_tokens\":852,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":59} }\n\nevent: message_stop\ndata: {\"type\":\"message_stop\" }\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-haiku-4-5 (streaming)/modify parent content_1_531389fceb12c1b2708740d07e8a7ab8.json b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-haiku-4-5 (streaming)/modify parent content_1_531389fceb12c1b2708740d07e8a7ab8.json
new file mode 100644
index 0000000000..28df1dfc76
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-haiku-4-5 (streaming)/modify parent content_1_531389fceb12c1b2708740d07e8a7ab8.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://api.anthropic.com/v1/messages",
+ "body": "{\"model\":\"claude-haiku-4-5\",\"max_tokens\":64000,\"system\":[{\"type\":\"text\",\"text\":\"You are manipulating a text document using TSX components.\\nEach block is represented as a TSX component with props.\\n\"}],\"messages\":[{\"role\":\"assistant\",\"content\":[{\"type\":\"text\",\"text\":\"There is no active selection. This is the latest state of the document (ignore previous documents, you MUST issue operations against this latest version of the document). \\nThe cursor is BETWEEN two blocks as indicated by cursor: true.\\nPrefer updating existing blocks over removing and adding (but this also depends on the user's question).\"},{\"type\":\"text\",\"text\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"I need to buy: \\\"},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"Apples \\\"}]\"}]},{\"role\":\"user\",\"content\":[{\"type\":\"text\",\"text\":\"make the first paragraph uppercase\"}]}],\"tools\":[{\"name\":\"file_replace\",\"input_schema\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"]}}],\"tool_choice\":{\"type\":\"any\"},\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"model\":\"claude-haiku-4-5-20251001\",\"id\":\"msg_01A1GM5tK7BpSy7mo7e5u6Rv\",\"type\":\"message\",\"role\":\"assistant\",\"content\":[],\"stop_reason\":null,\"stop_sequence\":null,\"usage\":{\"input_tokens\":853,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"cache_creation\":{\"ephemeral_5m_input_tokens\":0,\"ephemeral_1h_input_tokens\":0},\"output_tokens\":8,\"service_tier\":\"standard\",\"inference_geo\":\"not_available\"}} }\n\nevent: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"tool_use\",\"id\":\"toolu_01J8JoCaHWaTgejiFokmpMo9\",\"name\":\"file_replace\",\"input\":{}} }\n\nevent: ping\ndata: {\"type\": \"ping\"}\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"{\\\"target\\\": \\\"I need to buy\"}}\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\": \"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"\\\", \\\"replacement\\\": \\\"I\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\" NEED TO BUY:\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\" \"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"\\\"}\"} }\n\nevent: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0 }\n\nevent: message_delta\ndata: {\"type\":\"message_delta\",\"delta\":{\"stop_reason\":\"tool_use\",\"stop_sequence\":null},\"usage\":{\"input_tokens\":853,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":94} }\n\nevent: message_stop\ndata: {\"type\":\"message_stop\" }\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-haiku-4-5 (streaming)/turn paragraphs into list_1_c0aa3f1f854ce2abe443e22b12b5a02d.json b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-haiku-4-5 (streaming)/turn paragraphs into list_1_c0aa3f1f854ce2abe443e22b12b5a02d.json
new file mode 100644
index 0000000000..388c80a352
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-haiku-4-5 (streaming)/turn paragraphs into list_1_c0aa3f1f854ce2abe443e22b12b5a02d.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://api.anthropic.com/v1/messages",
+ "body": "{\"model\":\"claude-haiku-4-5\",\"max_tokens\":64000,\"system\":[{\"type\":\"text\",\"text\":\"You are manipulating a text document using TSX components.\\nEach block is represented as a TSX component with props.\\n\"}],\"messages\":[{\"role\":\"assistant\",\"content\":[{\"type\":\"text\",\"text\":\"This is the latest state of the selection (ignore previous selections, you MUST issue operations against this latest version of the selection):\"},{\"type\":\"text\",\"text\":\"[{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"Apples \\\"},{\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":\\\"Bananas \\\"}]\"},{\"type\":\"text\",\"text\":\"This is the latest state of the entire document (INCLUDING the selected text), \\nyou can use this to find the selected text to understand the context (but you MUST NOT issue operations against this document, you MUST issue operations against the selection):\"},{\"type\":\"text\",\"text\":\"[{\\\"block\\\":\\\"I need to buy: \\\"},{\\\"block\\\":\\\"Apples \\\"},{\\\"block\\\":\\\"Bananas \\\"}]\"}]},{\"role\":\"user\",\"content\":[{\"type\":\"text\",\"text\":\"turn into list (update existing blocks)\"}]}],\"tools\":[{\"name\":\"file_replace\",\"input_schema\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"]}}],\"tool_choice\":{\"type\":\"any\"},\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"model\":\"claude-haiku-4-5-20251001\",\"id\":\"msg_017n7yrhgyiBLG6kisHG393N\",\"type\":\"message\",\"role\":\"assistant\",\"content\":[],\"stop_reason\":null,\"stop_sequence\":null,\"usage\":{\"input_tokens\":936,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"cache_creation\":{\"ephemeral_5m_input_tokens\":0,\"ephemeral_1h_input_tokens\":0},\"output_tokens\":8,\"service_tier\":\"standard\",\"inference_geo\":\"not_available\"}} }\n\nevent: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"tool_use\",\"id\":\"toolu_01LYUpbtWUGATbAK5RLgBwDL\",\"name\":\"file_replace\",\"input\":{}} }\n\nevent: ping\ndata: {\"type\": \"ping\"}\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"{\\\"target\\\": \\\"Apples\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\" \"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"\\\", \\\"replacement\\\": \\\"Ap\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"ples\"}}\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"\\\"}\"} }\n\nevent: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0 }\n\nevent: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":1,\"content_block\":{\"type\":\"tool_use\",\"id\":\"toolu_01M1DN9qPobbbSMXuhDKVhwS\",\"name\":\"file_replace\",\"input\":{}} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":1,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":1,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"{\\\"target\\\": \\\"\"}}\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":1,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"Bananas \"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":1,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"\\\", \\\"replacement\\\": \\\"Bananas\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":1,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\" \"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":1,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"\\\"}\"} }\n\nevent: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":1 }\n\nevent: message_delta\ndata: {\"type\":\"message_delta\",\"delta\":{\"stop_reason\":\"tool_use\",\"stop_sequence\":null},\"usage\":{\"input_tokens\":936,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":166} }\n\nevent: message_stop\ndata: {\"type\":\"message_stop\" }\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/fix spelling mid-word selection_1_ad8bf632345fe3f3db077847b06ed139.json b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/fix spelling mid-word selection_1_ad8bf632345fe3f3db077847b06ed139.json
new file mode 100644
index 0000000000..a9aefd5d20
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/fix spelling mid-word selection_1_ad8bf632345fe3f3db077847b06ed139.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://api.groq.com/openai/v1/chat/completions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"messages\":[{\"role\":\"system\",\"content\":\"You are manipulating a text document using TSX components.\\nEach block is represented as a TSX component with props.\\n\"},{\"role\":\"assistant\",\"content\":\"This is the latest state of the selection (ignore previous selections, you MUST issue operations against this latest version of the selection):[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"Hello, world! Dow are you? \\\"}]This is the latest state of the entire document (INCLUDING the selected text), \\nyou can use this to find the selected text to understand the context (but you MUST NOT issue operations against this document, you MUST issue operations against the selection):[{\\\"block\\\":\\\"Hello, world! Dow are you? \\\"}]\"},{\"role\":\"user\",\"content\":\"fix spelling\"}],\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"]}}}],\"tool_choice\":\"required\",\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-2e96671e-54e8-41c9-b645-4dd49ae29675\",\"object\":\"chat.completion.chunk\",\"created\":1770919630,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_dae98b5ecb\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null},\"logprobs\":null,\"finish_reason\":null}],\"x_groq\":{\"id\":\"req_01kh9gj5hqej6bx5rgk1wde59r\",\"seed\":1942262262}}\n\ndata: {\"id\":\"chatcmpl-2e96671e-54e8-41c9-b645-4dd49ae29675\",\"object\":\"chat.completion.chunk\",\"created\":1770919630,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_dae98b5ecb\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"id\":\"p6mk7x7cv\",\"type\":\"function\",\"function\":{\"name\":\"file_replace\",\"arguments\":\"{\\\"replacement\\\":\\\"How\\\",\\\"target\\\":\\\"Dow\\\"}\"},\"index\":0}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-2e96671e-54e8-41c9-b645-4dd49ae29675\",\"object\":\"chat.completion.chunk\",\"created\":1770919630,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_dae98b5ecb\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"x_groq\":{\"id\":\"req_01kh9gj5hqej6bx5rgk1wde59r\",\"usage\":{\"queue_time\":0.090633618,\"prompt_tokens\":402,\"prompt_time\":0.02088625,\"completion_tokens\":19,\"completion_time\":0.079126386,\"total_tokens\":421,\"total_time\":0.100012636}},\"usage\":{\"queue_time\":0.090633618,\"prompt_tokens\":402,\"prompt_time\":0.02088625,\"completion_tokens\":19,\"completion_time\":0.079126386,\"total_tokens\":421,\"total_time\":0.100012636}}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/modify nested content_1_2b4d4dfb9bb12629f81ef931c9879893.json b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/modify nested content_1_2b4d4dfb9bb12629f81ef931c9879893.json
new file mode 100644
index 0000000000..12a460f200
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/modify nested content_1_2b4d4dfb9bb12629f81ef931c9879893.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://api.groq.com/openai/v1/chat/completions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"messages\":[{\"role\":\"system\",\"content\":\"You are manipulating a text document using TSX components.\\nEach block is represented as a TSX component with props.\\n\"},{\"role\":\"assistant\",\"content\":\"There is no active selection. This is the latest state of the document (ignore previous documents, you MUST issue operations against this latest version of the document). \\nThe cursor is BETWEEN two blocks as indicated by cursor: true.\\nPrefer updating existing blocks over removing and adding (but this also depends on the user's question).[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"I need to buy: \\\"},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"Apples \\\"}]\"},{\"role\":\"user\",\"content\":\"make apples uppercase\"}],\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"]}}}],\"tool_choice\":\"required\",\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-49c5a6b1-4082-4afe-ab14-873de6c3447b\",\"object\":\"chat.completion.chunk\",\"created\":1770919631,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_c06d5113ec\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null},\"logprobs\":null,\"finish_reason\":null}],\"x_groq\":{\"id\":\"req_01kh9gj63vej78cwx3t4hy6phx\",\"seed\":429975615}}\n\ndata: {\"id\":\"chatcmpl-49c5a6b1-4082-4afe-ab14-873de6c3447b\",\"object\":\"chat.completion.chunk\",\"created\":1770919631,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_c06d5113ec\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"id\":\"2t4psjpcz\",\"type\":\"function\",\"function\":{\"name\":\"file_replace\",\"arguments\":\"{\\\"replacement\\\":\\\"APPLES\\\",\\\"target\\\":\\\"Apples\\\"}\"},\"index\":0}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-49c5a6b1-4082-4afe-ab14-873de6c3447b\",\"object\":\"chat.completion.chunk\",\"created\":1770919631,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_c06d5113ec\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"x_groq\":{\"id\":\"req_01kh9gj63vej78cwx3t4hy6phx\",\"usage\":{\"queue_time\":0.093093514,\"prompt_tokens\":393,\"prompt_time\":0.054738222,\"completion_tokens\":20,\"completion_time\":0.061451164,\"total_tokens\":413,\"total_time\":0.116189386}},\"usage\":{\"queue_time\":0.093093514,\"prompt_tokens\":393,\"prompt_time\":0.054738222,\"completion_tokens\":20,\"completion_time\":0.061451164,\"total_tokens\":413,\"total_time\":0.116189386}}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/modify parent content_1_65d70c1bac37c7c4b09eb571e5d385b5.json b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/modify parent content_1_65d70c1bac37c7c4b09eb571e5d385b5.json
new file mode 100644
index 0000000000..140fba0173
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/modify parent content_1_65d70c1bac37c7c4b09eb571e5d385b5.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://api.groq.com/openai/v1/chat/completions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"messages\":[{\"role\":\"system\",\"content\":\"You are manipulating a text document using TSX components.\\nEach block is represented as a TSX component with props.\\n\"},{\"role\":\"assistant\",\"content\":\"There is no active selection. This is the latest state of the document (ignore previous documents, you MUST issue operations against this latest version of the document). \\nThe cursor is BETWEEN two blocks as indicated by cursor: true.\\nPrefer updating existing blocks over removing and adding (but this also depends on the user's question).[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"I need to buy: \\\"},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"Apples \\\"}]\"},{\"role\":\"user\",\"content\":\"make the first paragraph uppercase\"}],\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"]}}}],\"tool_choice\":\"required\",\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "data: {\"id\":\"chatcmpl-8a4d4f9e-ef22-4995-946c-375a4905a00f\",\"object\":\"chat.completion.chunk\",\"created\":1770919631,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_f8b414701e\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null},\"logprobs\":null,\"finish_reason\":null}],\"x_groq\":{\"id\":\"req_01kh9gj6bde77v9549tbjz7hjw\",\"seed\":392699640}}\n\ndata: {\"id\":\"chatcmpl-8a4d4f9e-ef22-4995-946c-375a4905a00f\",\"object\":\"chat.completion.chunk\",\"created\":1770919631,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_f8b414701e\",\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"id\":\"wq81nn056\",\"type\":\"function\",\"function\":{\"name\":\"file_replace\",\"arguments\":\"{\\\"replacement\\\":\\\"I NEED TO BUY:\\\",\\\"target\\\":\\\"I need to buy:\\\"}\"},\"index\":0}]},\"logprobs\":null,\"finish_reason\":null}]}\n\ndata: {\"id\":\"chatcmpl-8a4d4f9e-ef22-4995-946c-375a4905a00f\",\"object\":\"chat.completion.chunk\",\"created\":1770919631,\"model\":\"llama-3.3-70b-versatile\",\"system_fingerprint\":\"fp_f8b414701e\",\"choices\":[{\"index\":0,\"delta\":{},\"logprobs\":null,\"finish_reason\":\"tool_calls\"}],\"x_groq\":{\"id\":\"req_01kh9gj6bde77v9549tbjz7hjw\",\"usage\":{\"queue_time\":0.048406573,\"prompt_tokens\":395,\"prompt_time\":0.020830893,\"completion_tokens\":22,\"completion_time\":0.074240778,\"total_tokens\":417,\"total_time\":0.095071671}},\"usage\":{\"queue_time\":0.048406573,\"prompt_tokens\":395,\"prompt_time\":0.020830893,\"completion_tokens\":22,\"completion_time\":0.074240778,\"total_tokens\":417,\"total_time\":0.095071671}}\n\ndata: [DONE]\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/turn paragraphs into list_1_8695bf27c1be0bd1787de54cbe6028cf.json b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/turn paragraphs into list_1_8695bf27c1be0bd1787de54cbe6028cf.json
new file mode 100644
index 0000000000..8a80267d8f
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/turn paragraphs into list_1_8695bf27c1be0bd1787de54cbe6028cf.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://api.groq.com/openai/v1/chat/completions",
+ "body": "{\"model\":\"llama-3.3-70b-versatile\",\"messages\":[{\"role\":\"system\",\"content\":\"You are manipulating a text document using TSX components.\\nEach block is represented as a TSX component with props.\\n\"},{\"role\":\"assistant\",\"content\":\"This is the latest state of the selection (ignore previous selections, you MUST issue operations against this latest version of the selection):[{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"Apples \\\"},{\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":\\\"Bananas \\\"}]This is the latest state of the entire document (INCLUDING the selected text), \\nyou can use this to find the selected text to understand the context (but you MUST NOT issue operations against this document, you MUST issue operations against the selection):[{\\\"block\\\":\\\"I need to buy: \\\"},{\\\"block\\\":\\\"Apples \\\"},{\\\"block\\\":\\\"Bananas \\\"}]\"},{\"role\":\"user\",\"content\":\"turn into list (update existing blocks)\"}],\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"]}}}],\"tool_choice\":\"required\",\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "event: error\ndata: {\"error\":{\"message\":\"Failed to call a function. Please adjust your prompt. See 'failed_generation' for more details.\",\"type\":\"invalid_request_error\",\"code\":\"tool_use_failed\",\"failed_generation\":\"\\u003cfunction=update_blocks\\u003e{\\\"blocks\\\":[{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"\\u003cUnorderedList textAlignment=\\\\\\\"left\\\\\\\" id=\\\\\\\"ref2\\\\\\\"\\u003e\\u003cListItem\\u003eApples\\u003c/ListItem\\u003e\\u003c/UnorderedList\\u003e\\\"},{\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":\\\"\\u003cUnorderedList textAlignment=\\\\\\\"left\\\\\\\" id=\\\\\\\"ref3\\\\\\\"\\u003e\\u003cListItem\\u003eBananas\\u003c/ListItem\\u003e\\u003c/UnorderedList\\u003e\\\"}]\\u003c/function\\u003e\",\"status_code\":400}}\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/clear block formatting_1_e4d8c00fcff2bb70298a909030687157.json b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/clear block formatting_1_e4d8c00fcff2bb70298a909030687157.json
new file mode 100644
index 0000000000..a9bcec0519
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/clear block formatting_1_e4d8c00fcff2bb70298a909030687157.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://api.openai.com/v1/responses",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"input\":[{\"role\":\"system\",\"content\":\"You are manipulating a text document using TSX components.\\nEach block is represented as a TSX component with props.\\n\"},{\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"There is no active selection. This is the latest state of the document (ignore previous documents, you MUST issue operations against this latest version of the document). \\nThe cursor is BETWEEN two blocks as indicated by cursor: true.\\nPrefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}]},{\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"Colored text \\\"},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"Aligned text \\\"}]\"}]},{\"role\":\"user\",\"content\":[{\"type\":\"input_text\",\"text\":\"clear the formatting (colors and alignment)\"}]}],\"tools\":[{\"type\":\"function\",\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"]}}],\"tool_choice\":\"required\",\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "event: response.created\ndata: {\"type\":\"response.created\",\"response\":{\"id\":\"resp_025bcd77e93c43de00698e16cbb26081958d52e35dfc7cb577\",\"object\":\"response\",\"created_at\":1770919627,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"],\"additionalProperties\":false},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":0}\n\nevent: response.in_progress\ndata: {\"type\":\"response.in_progress\",\"response\":{\"id\":\"resp_025bcd77e93c43de00698e16cbb26081958d52e35dfc7cb577\",\"object\":\"response\",\"created_at\":1770919627,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"],\"additionalProperties\":false},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":1}\n\nevent: response.output_item.added\ndata: {\"type\":\"response.output_item.added\",\"item\":{\"id\":\"fc_025bcd77e93c43de00698e16cc1f708195927920a3ad85726e\",\"type\":\"function_call\",\"status\":\"in_progress\",\"arguments\":\"\",\"call_id\":\"call_mEV4aurYWkf3jSYeenZ4x00h\",\"name\":\"file_replace\"},\"output_index\":0,\"sequence_number\":2}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"{\\\"\",\"item_id\":\"fc_025bcd77e93c43de00698e16cc1f708195927920a3ad85726e\",\"obfuscation\":\"rbNq2D6Mu6n55a\",\"output_index\":0,\"sequence_number\":3}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"target\",\"item_id\":\"fc_025bcd77e93c43de00698e16cc1f708195927920a3ad85726e\",\"obfuscation\":\"GarHCMywfa\",\"output_index\":0,\"sequence_number\":4}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\\\"\",\"item_id\":\"fc_025bcd77e93c43de00698e16cc1f708195927920a3ad85726e\",\"obfuscation\":\"jEXDSAbTm7UOH\",\"output_index\":0,\"sequence_number\":5}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" background\",\"item_id\":\"fc_025bcd77e93c43de00698e16cc1f708195927920a3ad85726e\",\"obfuscation\":\"wsWG2\",\"output_index\":0,\"sequence_number\":6}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Color\",\"item_id\":\"fc_025bcd77e93c43de00698e16cc1f708195927920a3ad85726e\",\"obfuscation\":\"vn9Bj2noiYS\",\"output_index\":0,\"sequence_number\":7}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_025bcd77e93c43de00698e16cc1f708195927920a3ad85726e\",\"obfuscation\":\"Zak3JqIuRjGNg\",\"output_index\":0,\"sequence_number\":8}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"red\",\"item_id\":\"fc_025bcd77e93c43de00698e16cc1f708195927920a3ad85726e\",\"obfuscation\":\"DizdhxgUE90kU\",\"output_index\":0,\"sequence_number\":9}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\"\",\"item_id\":\"fc_025bcd77e93c43de00698e16cc1f708195927920a3ad85726e\",\"obfuscation\":\"lBYmQ8VwxmHmZ5\",\"output_index\":0,\"sequence_number\":10}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\",\\\"\",\"item_id\":\"fc_025bcd77e93c43de00698e16cc1f708195927920a3ad85726e\",\"obfuscation\":\"kFFv3iBnzplL6\",\"output_index\":0,\"sequence_number\":11}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"replacement\",\"item_id\":\"fc_025bcd77e93c43de00698e16cc1f708195927920a3ad85726e\",\"obfuscation\":\"7rFJ4\",\"output_index\":0,\"sequence_number\":12}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\",\"item_id\":\"fc_025bcd77e93c43de00698e16cc1f708195927920a3ad85726e\",\"obfuscation\":\"TH8i04OjXoxUBJ\",\"output_index\":0,\"sequence_number\":13}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\"\\\"\",\"item_id\":\"fc_025bcd77e93c43de00698e16cc1f708195927920a3ad85726e\",\"obfuscation\":\"iWK62YrojMklE2\",\"output_index\":0,\"sequence_number\":14}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"}\",\"item_id\":\"fc_025bcd77e93c43de00698e16cc1f708195927920a3ad85726e\",\"obfuscation\":\"osaLI9EkI3pjm9G\",\"output_index\":0,\"sequence_number\":15}\n\nevent: response.function_call_arguments.done\ndata: {\"type\":\"response.function_call_arguments.done\",\"arguments\":\"{\\\"target\\\":\\\" backgroundColor=\\\\\\\"red\\\\\\\"\\\",\\\"replacement\\\":\\\"\\\"}\",\"item_id\":\"fc_025bcd77e93c43de00698e16cc1f708195927920a3ad85726e\",\"output_index\":0,\"sequence_number\":16}\n\nevent: response.output_item.done\ndata: {\"type\":\"response.output_item.done\",\"item\":{\"id\":\"fc_025bcd77e93c43de00698e16cc1f708195927920a3ad85726e\",\"type\":\"function_call\",\"status\":\"completed\",\"arguments\":\"{\\\"target\\\":\\\" backgroundColor=\\\\\\\"red\\\\\\\"\\\",\\\"replacement\\\":\\\"\\\"}\",\"call_id\":\"call_mEV4aurYWkf3jSYeenZ4x00h\",\"name\":\"file_replace\"},\"output_index\":0,\"sequence_number\":17}\n\nevent: response.completed\ndata: {\"type\":\"response.completed\",\"response\":{\"id\":\"resp_025bcd77e93c43de00698e16cbb26081958d52e35dfc7cb577\",\"object\":\"response\",\"created_at\":1770919627,\"status\":\"completed\",\"background\":false,\"completed_at\":1770919628,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[{\"id\":\"fc_025bcd77e93c43de00698e16cc1f708195927920a3ad85726e\",\"type\":\"function_call\",\"status\":\"completed\",\"arguments\":\"{\\\"target\\\":\\\" backgroundColor=\\\\\\\"red\\\\\\\"\\\",\\\"replacement\\\":\\\"\\\"}\",\"call_id\":\"call_mEV4aurYWkf3jSYeenZ4x00h\",\"name\":\"file_replace\"}],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"default\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"],\"additionalProperties\":false},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":{\"input_tokens\":224,\"input_tokens_details\":{\"cached_tokens\":0},\"output_tokens\":14,\"output_tokens_details\":{\"reasoning_tokens\":0},\"total_tokens\":238},\"user\":null,\"metadata\":{}},\"sequence_number\":18}\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/fix spelling mid-word selection_1_08065d705823242620eadeffe098a0fb.json b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/fix spelling mid-word selection_1_08065d705823242620eadeffe098a0fb.json
new file mode 100644
index 0000000000..3705b49e42
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/fix spelling mid-word selection_1_08065d705823242620eadeffe098a0fb.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://api.openai.com/v1/responses",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"input\":[{\"role\":\"system\",\"content\":\"You are manipulating a text document using TSX components.\\nEach block is represented as a TSX component with props.\\n\"},{\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"This is the latest state of the selection (ignore previous selections, you MUST issue operations against this latest version of the selection):\"}]},{\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"Hello, world! Dow are you? \\\"}]\"}]},{\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"This is the latest state of the entire document (INCLUDING the selected text), \\nyou can use this to find the selected text to understand the context (but you MUST NOT issue operations against this document, you MUST issue operations against the selection):\"}]},{\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"[{\\\"block\\\":\\\"Hello, world! Dow are you? \\\"}]\"}]},{\"role\":\"user\",\"content\":[{\"type\":\"input_text\",\"text\":\"fix spelling\"}]}],\"tools\":[{\"type\":\"function\",\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"]}}],\"tool_choice\":\"required\",\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "event: response.created\ndata: {\"type\":\"response.created\",\"response\":{\"id\":\"resp_029b7db2fc0aee2900698e16c7c0d4819090222bc34004eb6d\",\"object\":\"response\",\"created_at\":1770919623,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"],\"additionalProperties\":false},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":0}\n\nevent: response.in_progress\ndata: {\"type\":\"response.in_progress\",\"response\":{\"id\":\"resp_029b7db2fc0aee2900698e16c7c0d4819090222bc34004eb6d\",\"object\":\"response\",\"created_at\":1770919623,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"],\"additionalProperties\":false},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":1}\n\nevent: response.output_item.added\ndata: {\"type\":\"response.output_item.added\",\"item\":{\"id\":\"fc_029b7db2fc0aee2900698e16c831088190b0d32ec514a87c6e\",\"type\":\"function_call\",\"status\":\"in_progress\",\"arguments\":\"\",\"call_id\":\"call_ar9tG9QP3jnsq5CUOqxrXrSk\",\"name\":\"file_replace\"},\"output_index\":0,\"sequence_number\":2}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"{\\\"\",\"item_id\":\"fc_029b7db2fc0aee2900698e16c831088190b0d32ec514a87c6e\",\"obfuscation\":\"c8PqCNiIwLD7Mj\",\"output_index\":0,\"sequence_number\":3}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"target\",\"item_id\":\"fc_029b7db2fc0aee2900698e16c831088190b0d32ec514a87c6e\",\"obfuscation\":\"jXaOeUH8OR\",\"output_index\":0,\"sequence_number\":4}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\\\"\",\"item_id\":\"fc_029b7db2fc0aee2900698e16c831088190b0d32ec514a87c6e\",\"obfuscation\":\"5soUbKrdRoe0a\",\"output_index\":0,\"sequence_number\":5}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Dow\",\"item_id\":\"fc_029b7db2fc0aee2900698e16c831088190b0d32ec514a87c6e\",\"obfuscation\":\"zqqVK5xaP5TUR\",\"output_index\":0,\"sequence_number\":6}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\",\\\"\",\"item_id\":\"fc_029b7db2fc0aee2900698e16c831088190b0d32ec514a87c6e\",\"obfuscation\":\"2WVGdKgPtpZ0N\",\"output_index\":0,\"sequence_number\":7}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"replacement\",\"item_id\":\"fc_029b7db2fc0aee2900698e16c831088190b0d32ec514a87c6e\",\"obfuscation\":\"AlyLh\",\"output_index\":0,\"sequence_number\":8}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\\\"\",\"item_id\":\"fc_029b7db2fc0aee2900698e16c831088190b0d32ec514a87c6e\",\"obfuscation\":\"4DTSi7K5Vs6ZC\",\"output_index\":0,\"sequence_number\":9}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"How\",\"item_id\":\"fc_029b7db2fc0aee2900698e16c831088190b0d32ec514a87c6e\",\"obfuscation\":\"OBKwkRZglHrXN\",\"output_index\":0,\"sequence_number\":10}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\"}\",\"item_id\":\"fc_029b7db2fc0aee2900698e16c831088190b0d32ec514a87c6e\",\"obfuscation\":\"VXRKsbrqZbX8wT\",\"output_index\":0,\"sequence_number\":11}\n\nevent: response.function_call_arguments.done\ndata: {\"type\":\"response.function_call_arguments.done\",\"arguments\":\"{\\\"target\\\":\\\"Dow\\\",\\\"replacement\\\":\\\"How\\\"}\",\"item_id\":\"fc_029b7db2fc0aee2900698e16c831088190b0d32ec514a87c6e\",\"output_index\":0,\"sequence_number\":12}\n\nevent: response.output_item.done\ndata: {\"type\":\"response.output_item.done\",\"item\":{\"id\":\"fc_029b7db2fc0aee2900698e16c831088190b0d32ec514a87c6e\",\"type\":\"function_call\",\"status\":\"completed\",\"arguments\":\"{\\\"target\\\":\\\"Dow\\\",\\\"replacement\\\":\\\"How\\\"}\",\"call_id\":\"call_ar9tG9QP3jnsq5CUOqxrXrSk\",\"name\":\"file_replace\"},\"output_index\":0,\"sequence_number\":13}\n\nevent: response.completed\ndata: {\"type\":\"response.completed\",\"response\":{\"id\":\"resp_029b7db2fc0aee2900698e16c7c0d4819090222bc34004eb6d\",\"object\":\"response\",\"created_at\":1770919623,\"status\":\"completed\",\"background\":false,\"completed_at\":1770919624,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[{\"id\":\"fc_029b7db2fc0aee2900698e16c831088190b0d32ec514a87c6e\",\"type\":\"function_call\",\"status\":\"completed\",\"arguments\":\"{\\\"target\\\":\\\"Dow\\\",\\\"replacement\\\":\\\"How\\\"}\",\"call_id\":\"call_ar9tG9QP3jnsq5CUOqxrXrSk\",\"name\":\"file_replace\"}],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"default\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"],\"additionalProperties\":false},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":{\"input_tokens\":234,\"input_tokens_details\":{\"cached_tokens\":0},\"output_tokens\":10,\"output_tokens_details\":{\"reasoning_tokens\":0},\"total_tokens\":244},\"user\":null,\"metadata\":{}},\"sequence_number\":14}\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/fix spelling mid-word selection_1_8a82739cf497d1566327d1fe0e748f58.json b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/fix spelling mid-word selection_1_8a82739cf497d1566327d1fe0e748f58.json
new file mode 100644
index 0000000000..d83dfb0c58
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/fix spelling mid-word selection_1_8a82739cf497d1566327d1fe0e748f58.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://api.openai.com/v1/responses",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"input\":[{\"role\":\"system\",\"content\":\"You are manipulating a text document using TSX components.\\nEach block is represented as a TSX component with props.\\n\"},{\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"This is the latest state of the selection (ignore previous selections, you MUST issue operations against this latest version of the selection):\"}]},{\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"Hello, world! Dow are you? \\\"}]\"}]},{\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"This is the latest state of the entire document (INCLUDING the selected text), \\nyou can use this to find the selected text to understand the context (but you MUST NOT issue operations against this document, you MUST issue operations against the selection):\"}]},{\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"[{\\\"block\\\":\\\"Hello, world! Dow are you? \\\"}]\"}]},{\"role\":\"user\",\"content\":[{\"type\":\"input_text\",\"text\":\"fix spelling\"}]}],\"tools\":[{\"type\":\"function\",\"name\":\"applyDocumentOperations\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Replace a part of the document file\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"file_replace\"]},\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"type\",\"target\",\"replacement\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"]}}],\"tool_choice\":\"required\",\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "event: response.created\ndata: {\"type\":\"response.created\",\"response\":{\"id\":\"resp_0b1243216d3bfa9b00698cd827a8b481938ceba9715088b5c6\",\"object\":\"response\",\"created_at\":1770838055,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"applyDocumentOperations\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Replace a part of the document file\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"file_replace\"]},\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"type\",\"target\",\"replacement\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"]},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":0}\n\nevent: response.in_progress\ndata: {\"type\":\"response.in_progress\",\"response\":{\"id\":\"resp_0b1243216d3bfa9b00698cd827a8b481938ceba9715088b5c6\",\"object\":\"response\",\"created_at\":1770838055,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"applyDocumentOperations\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Replace a part of the document file\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"file_replace\"]},\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"type\",\"target\",\"replacement\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"]},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":1}\n\nevent: response.output_item.added\ndata: {\"type\":\"response.output_item.added\",\"item\":{\"id\":\"fc_0b1243216d3bfa9b00698cd8282f40819385afe52249fdd3ac\",\"type\":\"function_call\",\"status\":\"in_progress\",\"arguments\":\"\",\"call_id\":\"call_23B7P32ICyfRavtFyslF9wj6\",\"name\":\"applyDocumentOperations\"},\"output_index\":0,\"sequence_number\":2}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"{\\\"\",\"item_id\":\"fc_0b1243216d3bfa9b00698cd8282f40819385afe52249fdd3ac\",\"obfuscation\":\"8LHfmj4Q4MOPdQ\",\"output_index\":0,\"sequence_number\":3}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"operations\",\"item_id\":\"fc_0b1243216d3bfa9b00698cd8282f40819385afe52249fdd3ac\",\"obfuscation\":\"6sLLYx\",\"output_index\":0,\"sequence_number\":4}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":[\",\"item_id\":\"fc_0b1243216d3bfa9b00698cd8282f40819385afe52249fdd3ac\",\"obfuscation\":\"jlSD6iscrccjt\",\"output_index\":0,\"sequence_number\":5}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"{\\\"\",\"item_id\":\"fc_0b1243216d3bfa9b00698cd8282f40819385afe52249fdd3ac\",\"obfuscation\":\"EzQjB0deVIvs0P\",\"output_index\":0,\"sequence_number\":6}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"type\",\"item_id\":\"fc_0b1243216d3bfa9b00698cd8282f40819385afe52249fdd3ac\",\"obfuscation\":\"AtrN4LsQuokT\",\"output_index\":0,\"sequence_number\":7}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\\\"\",\"item_id\":\"fc_0b1243216d3bfa9b00698cd8282f40819385afe52249fdd3ac\",\"obfuscation\":\"wWKKwTaFJnfNv\",\"output_index\":0,\"sequence_number\":8}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"file\",\"item_id\":\"fc_0b1243216d3bfa9b00698cd8282f40819385afe52249fdd3ac\",\"obfuscation\":\"jdpv35M3BjI0\",\"output_index\":0,\"sequence_number\":9}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"_replace\",\"item_id\":\"fc_0b1243216d3bfa9b00698cd8282f40819385afe52249fdd3ac\",\"obfuscation\":\"mBRtr5at\",\"output_index\":0,\"sequence_number\":10}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\",\\\"\",\"item_id\":\"fc_0b1243216d3bfa9b00698cd8282f40819385afe52249fdd3ac\",\"obfuscation\":\"q5blEQf8vX758\",\"output_index\":0,\"sequence_number\":11}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"target\",\"item_id\":\"fc_0b1243216d3bfa9b00698cd8282f40819385afe52249fdd3ac\",\"obfuscation\":\"A3sHMCVY9I\",\"output_index\":0,\"sequence_number\":12}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\\\"\",\"item_id\":\"fc_0b1243216d3bfa9b00698cd8282f40819385afe52249fdd3ac\",\"obfuscation\":\"yVhIybHV0Ic9H\",\"output_index\":0,\"sequence_number\":13}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Dow\",\"item_id\":\"fc_0b1243216d3bfa9b00698cd8282f40819385afe52249fdd3ac\",\"obfuscation\":\"UbHbuUNsNnLrE\",\"output_index\":0,\"sequence_number\":14}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" are\",\"item_id\":\"fc_0b1243216d3bfa9b00698cd8282f40819385afe52249fdd3ac\",\"obfuscation\":\"31kHU7XN453f\",\"output_index\":0,\"sequence_number\":15}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" you\",\"item_id\":\"fc_0b1243216d3bfa9b00698cd8282f40819385afe52249fdd3ac\",\"obfuscation\":\"q2LCqUxNidmz\",\"output_index\":0,\"sequence_number\":16}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\",\\\"\",\"item_id\":\"fc_0b1243216d3bfa9b00698cd8282f40819385afe52249fdd3ac\",\"obfuscation\":\"yFz5BUKulMuaU\",\"output_index\":0,\"sequence_number\":17}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"replacement\",\"item_id\":\"fc_0b1243216d3bfa9b00698cd8282f40819385afe52249fdd3ac\",\"obfuscation\":\"Jysd8\",\"output_index\":0,\"sequence_number\":18}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\\\"\",\"item_id\":\"fc_0b1243216d3bfa9b00698cd8282f40819385afe52249fdd3ac\",\"obfuscation\":\"F4oFEMLVU7byN\",\"output_index\":0,\"sequence_number\":19}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"How\",\"item_id\":\"fc_0b1243216d3bfa9b00698cd8282f40819385afe52249fdd3ac\",\"obfuscation\":\"9BYyIlF89ujib\",\"output_index\":0,\"sequence_number\":20}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" are\",\"item_id\":\"fc_0b1243216d3bfa9b00698cd8282f40819385afe52249fdd3ac\",\"obfuscation\":\"w2oXz9kbmKel\",\"output_index\":0,\"sequence_number\":21}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" you\",\"item_id\":\"fc_0b1243216d3bfa9b00698cd8282f40819385afe52249fdd3ac\",\"obfuscation\":\"8FkiXrufBqZQ\",\"output_index\":0,\"sequence_number\":22}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\"}\",\"item_id\":\"fc_0b1243216d3bfa9b00698cd8282f40819385afe52249fdd3ac\",\"obfuscation\":\"BB0aQXO3oloKAl\",\"output_index\":0,\"sequence_number\":23}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"]}\",\"item_id\":\"fc_0b1243216d3bfa9b00698cd8282f40819385afe52249fdd3ac\",\"obfuscation\":\"JPxUqMAzJY2ykX\",\"output_index\":0,\"sequence_number\":24}\n\nevent: response.function_call_arguments.done\ndata: {\"type\":\"response.function_call_arguments.done\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"file_replace\\\",\\\"target\\\":\\\"Dow are you\\\",\\\"replacement\\\":\\\"How are you\\\"}]}\",\"item_id\":\"fc_0b1243216d3bfa9b00698cd8282f40819385afe52249fdd3ac\",\"output_index\":0,\"sequence_number\":25}\n\nevent: response.output_item.done\ndata: {\"type\":\"response.output_item.done\",\"item\":{\"id\":\"fc_0b1243216d3bfa9b00698cd8282f40819385afe52249fdd3ac\",\"type\":\"function_call\",\"status\":\"completed\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"file_replace\\\",\\\"target\\\":\\\"Dow are you\\\",\\\"replacement\\\":\\\"How are you\\\"}]}\",\"call_id\":\"call_23B7P32ICyfRavtFyslF9wj6\",\"name\":\"applyDocumentOperations\"},\"output_index\":0,\"sequence_number\":26}\n\nevent: response.completed\ndata: {\"type\":\"response.completed\",\"response\":{\"id\":\"resp_0b1243216d3bfa9b00698cd827a8b481938ceba9715088b5c6\",\"object\":\"response\",\"created_at\":1770838055,\"status\":\"completed\",\"background\":false,\"completed_at\":1770838056,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[{\"id\":\"fc_0b1243216d3bfa9b00698cd8282f40819385afe52249fdd3ac\",\"type\":\"function_call\",\"status\":\"completed\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"file_replace\\\",\\\"target\\\":\\\"Dow are you\\\",\\\"replacement\\\":\\\"How are you\\\"}]}\",\"call_id\":\"call_23B7P32ICyfRavtFyslF9wj6\",\"name\":\"applyDocumentOperations\"}],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"default\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"applyDocumentOperations\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Replace a part of the document file\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"file_replace\"]},\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"type\",\"target\",\"replacement\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"]},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":{\"input_tokens\":259,\"input_tokens_details\":{\"cached_tokens\":0},\"output_tokens\":23,\"output_tokens_details\":{\"reasoning_tokens\":0},\"total_tokens\":282},\"user\":null,\"metadata\":{}},\"sequence_number\":27}\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/modify nested content_1_ce33bc467950fe7a62a714bf8918f342.json b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/modify nested content_1_ce33bc467950fe7a62a714bf8918f342.json
new file mode 100644
index 0000000000..29604d8652
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/modify nested content_1_ce33bc467950fe7a62a714bf8918f342.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://api.openai.com/v1/responses",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"input\":[{\"role\":\"system\",\"content\":\"You are manipulating a text document using TSX components.\\nEach block is represented as a TSX component with props.\\n\"},{\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"There is no active selection. This is the latest state of the document (ignore previous documents, you MUST issue operations against this latest version of the document). \\nThe cursor is BETWEEN two blocks as indicated by cursor: true.\\nPrefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}]},{\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"{\\\"selection\\\":false,\\\"blocks\\\":[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"I need to buy: \\\"},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"Apples \\\"}],\\\"isEmptyDocument\\\":false}\"}]},{\"role\":\"user\",\"content\":[{\"type\":\"input_text\",\"text\":\"make apples uppercase\"}]}],\"tools\":[{\"type\":\"function\",\"name\":\"applyDocumentOperations\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Replace a part of the document file\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"file_replace\"]},\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"type\",\"target\",\"replacement\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"]}}],\"tool_choice\":\"required\",\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "event: response.created\ndata: {\"type\":\"response.created\",\"response\":{\"id\":\"resp_087067d7cb35199800698cd82a6810819495e6aee592fca834\",\"object\":\"response\",\"created_at\":1770838058,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"applyDocumentOperations\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Replace a part of the document file\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"file_replace\"]},\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"type\",\"target\",\"replacement\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"]},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":0}\n\nevent: response.in_progress\ndata: {\"type\":\"response.in_progress\",\"response\":{\"id\":\"resp_087067d7cb35199800698cd82a6810819495e6aee592fca834\",\"object\":\"response\",\"created_at\":1770838058,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"applyDocumentOperations\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Replace a part of the document file\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"file_replace\"]},\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"type\",\"target\",\"replacement\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"]},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":1}\n\nevent: response.output_item.added\ndata: {\"type\":\"response.output_item.added\",\"item\":{\"id\":\"fc_087067d7cb35199800698cd82acdf88194b13e6fc3a69fa730\",\"type\":\"function_call\",\"status\":\"in_progress\",\"arguments\":\"\",\"call_id\":\"call_cDpnXxLBSHF47qrEU5sEgkFa\",\"name\":\"applyDocumentOperations\"},\"output_index\":0,\"sequence_number\":2}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"{\\\"\",\"item_id\":\"fc_087067d7cb35199800698cd82acdf88194b13e6fc3a69fa730\",\"obfuscation\":\"qDojbQNBypAmMK\",\"output_index\":0,\"sequence_number\":3}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"operations\",\"item_id\":\"fc_087067d7cb35199800698cd82acdf88194b13e6fc3a69fa730\",\"obfuscation\":\"f1IkdJ\",\"output_index\":0,\"sequence_number\":4}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":[\",\"item_id\":\"fc_087067d7cb35199800698cd82acdf88194b13e6fc3a69fa730\",\"obfuscation\":\"I0gepvZEdxdIN\",\"output_index\":0,\"sequence_number\":5}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"{\\\"\",\"item_id\":\"fc_087067d7cb35199800698cd82acdf88194b13e6fc3a69fa730\",\"obfuscation\":\"z0Yjndsy7ij73a\",\"output_index\":0,\"sequence_number\":6}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"type\",\"item_id\":\"fc_087067d7cb35199800698cd82acdf88194b13e6fc3a69fa730\",\"obfuscation\":\"0cF29NErSwRs\",\"output_index\":0,\"sequence_number\":7}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\\\"\",\"item_id\":\"fc_087067d7cb35199800698cd82acdf88194b13e6fc3a69fa730\",\"obfuscation\":\"OjBFSfwg0YREb\",\"output_index\":0,\"sequence_number\":8}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"file\",\"item_id\":\"fc_087067d7cb35199800698cd82acdf88194b13e6fc3a69fa730\",\"obfuscation\":\"1mJclpGZB9p0\",\"output_index\":0,\"sequence_number\":9}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"_replace\",\"item_id\":\"fc_087067d7cb35199800698cd82acdf88194b13e6fc3a69fa730\",\"obfuscation\":\"yj8pv183\",\"output_index\":0,\"sequence_number\":10}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\",\\\"\",\"item_id\":\"fc_087067d7cb35199800698cd82acdf88194b13e6fc3a69fa730\",\"obfuscation\":\"j75AUFufDdCMv\",\"output_index\":0,\"sequence_number\":11}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"target\",\"item_id\":\"fc_087067d7cb35199800698cd82acdf88194b13e6fc3a69fa730\",\"obfuscation\":\"OCEgEWjcxT\",\"output_index\":0,\"sequence_number\":12}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\\\"\",\"item_id\":\"fc_087067d7cb35199800698cd82acdf88194b13e6fc3a69fa730\",\"obfuscation\":\"47hvqKi6rBP8K\",\"output_index\":0,\"sequence_number\":13}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Ap\",\"item_id\":\"fc_087067d7cb35199800698cd82acdf88194b13e6fc3a69fa730\",\"obfuscation\":\"hG4kRGT7t9UiYL\",\"output_index\":0,\"sequence_number\":14}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"ples\",\"item_id\":\"fc_087067d7cb35199800698cd82acdf88194b13e6fc3a69fa730\",\"obfuscation\":\"XCLG1CWbDu9I\",\"output_index\":0,\"sequence_number\":15}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\",\\\"\",\"item_id\":\"fc_087067d7cb35199800698cd82acdf88194b13e6fc3a69fa730\",\"obfuscation\":\"8ZDj0wccpe81i\",\"output_index\":0,\"sequence_number\":16}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"replacement\",\"item_id\":\"fc_087067d7cb35199800698cd82acdf88194b13e6fc3a69fa730\",\"obfuscation\":\"KXjZW\",\"output_index\":0,\"sequence_number\":17}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\\\"\",\"item_id\":\"fc_087067d7cb35199800698cd82acdf88194b13e6fc3a69fa730\",\"obfuscation\":\"E9Os99EGGmK7O\",\"output_index\":0,\"sequence_number\":18}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"APP\",\"item_id\":\"fc_087067d7cb35199800698cd82acdf88194b13e6fc3a69fa730\",\"obfuscation\":\"MYSXpXcS7nZ7d\",\"output_index\":0,\"sequence_number\":19}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"LES\",\"item_id\":\"fc_087067d7cb35199800698cd82acdf88194b13e6fc3a69fa730\",\"obfuscation\":\"q01DAkaaDEupW\",\"output_index\":0,\"sequence_number\":20}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\"}\",\"item_id\":\"fc_087067d7cb35199800698cd82acdf88194b13e6fc3a69fa730\",\"obfuscation\":\"CUq2IhbSZigOCc\",\"output_index\":0,\"sequence_number\":21}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"]}\",\"item_id\":\"fc_087067d7cb35199800698cd82acdf88194b13e6fc3a69fa730\",\"obfuscation\":\"cp004TUTas0Rhi\",\"output_index\":0,\"sequence_number\":22}\n\nevent: response.function_call_arguments.done\ndata: {\"type\":\"response.function_call_arguments.done\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"file_replace\\\",\\\"target\\\":\\\"Apples\\\",\\\"replacement\\\":\\\"APPLES\\\"}]}\",\"item_id\":\"fc_087067d7cb35199800698cd82acdf88194b13e6fc3a69fa730\",\"output_index\":0,\"sequence_number\":23}\n\nevent: response.output_item.done\ndata: {\"type\":\"response.output_item.done\",\"item\":{\"id\":\"fc_087067d7cb35199800698cd82acdf88194b13e6fc3a69fa730\",\"type\":\"function_call\",\"status\":\"completed\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"file_replace\\\",\\\"target\\\":\\\"Apples\\\",\\\"replacement\\\":\\\"APPLES\\\"}]}\",\"call_id\":\"call_cDpnXxLBSHF47qrEU5sEgkFa\",\"name\":\"applyDocumentOperations\"},\"output_index\":0,\"sequence_number\":24}\n\nevent: response.completed\ndata: {\"type\":\"response.completed\",\"response\":{\"id\":\"resp_087067d7cb35199800698cd82a6810819495e6aee592fca834\",\"object\":\"response\",\"created_at\":1770838058,\"status\":\"completed\",\"background\":false,\"completed_at\":1770838059,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[{\"id\":\"fc_087067d7cb35199800698cd82acdf88194b13e6fc3a69fa730\",\"type\":\"function_call\",\"status\":\"completed\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"file_replace\\\",\\\"target\\\":\\\"Apples\\\",\\\"replacement\\\":\\\"APPLES\\\"}]}\",\"call_id\":\"call_cDpnXxLBSHF47qrEU5sEgkFa\",\"name\":\"applyDocumentOperations\"}],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"default\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"applyDocumentOperations\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Replace a part of the document file\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"file_replace\"]},\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"type\",\"target\",\"replacement\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"]},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":{\"input_tokens\":253,\"input_tokens_details\":{\"cached_tokens\":0},\"output_tokens\":21,\"output_tokens_details\":{\"reasoning_tokens\":0},\"total_tokens\":274},\"user\":null,\"metadata\":{}},\"sequence_number\":25}\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/modify nested content_1_e66930d796500abae0df4d4a8a25ae48.json b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/modify nested content_1_e66930d796500abae0df4d4a8a25ae48.json
new file mode 100644
index 0000000000..567344b4af
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/modify nested content_1_e66930d796500abae0df4d4a8a25ae48.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://api.openai.com/v1/responses",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"input\":[{\"role\":\"system\",\"content\":\"You are manipulating a text document using TSX components.\\nEach block is represented as a TSX component with props.\\n\"},{\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"There is no active selection. This is the latest state of the document (ignore previous documents, you MUST issue operations against this latest version of the document). \\nThe cursor is BETWEEN two blocks as indicated by cursor: true.\\nPrefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}]},{\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"I need to buy: \\\"},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"Apples \\\"}]\"}]},{\"role\":\"user\",\"content\":[{\"type\":\"input_text\",\"text\":\"make apples uppercase\"}]}],\"tools\":[{\"type\":\"function\",\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"]}}],\"tool_choice\":\"required\",\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "event: response.created\ndata: {\"type\":\"response.created\",\"response\":{\"id\":\"resp_0ac07f5cf4bfc84800698e16c9d29c8190abb8aa66ae880233\",\"object\":\"response\",\"created_at\":1770919625,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"],\"additionalProperties\":false},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":0}\n\nevent: response.in_progress\ndata: {\"type\":\"response.in_progress\",\"response\":{\"id\":\"resp_0ac07f5cf4bfc84800698e16c9d29c8190abb8aa66ae880233\",\"object\":\"response\",\"created_at\":1770919625,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"],\"additionalProperties\":false},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":1}\n\nevent: response.output_item.added\ndata: {\"type\":\"response.output_item.added\",\"item\":{\"id\":\"fc_0ac07f5cf4bfc84800698e16ca301c81909fedc209ed88d7ce\",\"type\":\"function_call\",\"status\":\"in_progress\",\"arguments\":\"\",\"call_id\":\"call_IR9UDmyb5ngmD9Rhj7nnLxWi\",\"name\":\"file_replace\"},\"output_index\":0,\"sequence_number\":2}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"{\\\"\",\"item_id\":\"fc_0ac07f5cf4bfc84800698e16ca301c81909fedc209ed88d7ce\",\"obfuscation\":\"UdPxEq1haAipMM\",\"output_index\":0,\"sequence_number\":3}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"target\",\"item_id\":\"fc_0ac07f5cf4bfc84800698e16ca301c81909fedc209ed88d7ce\",\"obfuscation\":\"dWoQFdVB1J\",\"output_index\":0,\"sequence_number\":4}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\\\"\",\"item_id\":\"fc_0ac07f5cf4bfc84800698e16ca301c81909fedc209ed88d7ce\",\"obfuscation\":\"I5pjPj3Rmsg4P\",\"output_index\":0,\"sequence_number\":5}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Ap\",\"item_id\":\"fc_0ac07f5cf4bfc84800698e16ca301c81909fedc209ed88d7ce\",\"obfuscation\":\"2sFUjWBsf0HDvX\",\"output_index\":0,\"sequence_number\":6}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"ples\",\"item_id\":\"fc_0ac07f5cf4bfc84800698e16ca301c81909fedc209ed88d7ce\",\"obfuscation\":\"OGEC2bafMvzF\",\"output_index\":0,\"sequence_number\":7}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\",\\\"\",\"item_id\":\"fc_0ac07f5cf4bfc84800698e16ca301c81909fedc209ed88d7ce\",\"obfuscation\":\"BQZVKlJ6mOdc1\",\"output_index\":0,\"sequence_number\":8}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"replacement\",\"item_id\":\"fc_0ac07f5cf4bfc84800698e16ca301c81909fedc209ed88d7ce\",\"obfuscation\":\"NQktS\",\"output_index\":0,\"sequence_number\":9}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\\\"\",\"item_id\":\"fc_0ac07f5cf4bfc84800698e16ca301c81909fedc209ed88d7ce\",\"obfuscation\":\"O6Bd3Qrc4eunZ\",\"output_index\":0,\"sequence_number\":10}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"APP\",\"item_id\":\"fc_0ac07f5cf4bfc84800698e16ca301c81909fedc209ed88d7ce\",\"obfuscation\":\"3tKjEuqevSVay\",\"output_index\":0,\"sequence_number\":11}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"LES\",\"item_id\":\"fc_0ac07f5cf4bfc84800698e16ca301c81909fedc209ed88d7ce\",\"obfuscation\":\"DTSf6FMJThRas\",\"output_index\":0,\"sequence_number\":12}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\"}\",\"item_id\":\"fc_0ac07f5cf4bfc84800698e16ca301c81909fedc209ed88d7ce\",\"obfuscation\":\"Qz7UjCge61RGDM\",\"output_index\":0,\"sequence_number\":13}\n\nevent: response.function_call_arguments.done\ndata: {\"type\":\"response.function_call_arguments.done\",\"arguments\":\"{\\\"target\\\":\\\"Apples\\\",\\\"replacement\\\":\\\"APPLES\\\"}\",\"item_id\":\"fc_0ac07f5cf4bfc84800698e16ca301c81909fedc209ed88d7ce\",\"output_index\":0,\"sequence_number\":14}\n\nevent: response.output_item.done\ndata: {\"type\":\"response.output_item.done\",\"item\":{\"id\":\"fc_0ac07f5cf4bfc84800698e16ca301c81909fedc209ed88d7ce\",\"type\":\"function_call\",\"status\":\"completed\",\"arguments\":\"{\\\"target\\\":\\\"Apples\\\",\\\"replacement\\\":\\\"APPLES\\\"}\",\"call_id\":\"call_IR9UDmyb5ngmD9Rhj7nnLxWi\",\"name\":\"file_replace\"},\"output_index\":0,\"sequence_number\":15}\n\nevent: response.completed\ndata: {\"type\":\"response.completed\",\"response\":{\"id\":\"resp_0ac07f5cf4bfc84800698e16c9d29c8190abb8aa66ae880233\",\"object\":\"response\",\"created_at\":1770919625,\"status\":\"completed\",\"background\":false,\"completed_at\":1770919626,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[{\"id\":\"fc_0ac07f5cf4bfc84800698e16ca301c81909fedc209ed88d7ce\",\"type\":\"function_call\",\"status\":\"completed\",\"arguments\":\"{\\\"target\\\":\\\"Apples\\\",\\\"replacement\\\":\\\"APPLES\\\"}\",\"call_id\":\"call_IR9UDmyb5ngmD9Rhj7nnLxWi\",\"name\":\"file_replace\"}],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"default\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"],\"additionalProperties\":false},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":{\"input_tokens\":216,\"input_tokens_details\":{\"cached_tokens\":0},\"output_tokens\":12,\"output_tokens_details\":{\"reasoning_tokens\":0},\"total_tokens\":228},\"user\":null,\"metadata\":{}},\"sequence_number\":16}\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/modify parent content_1_1a7f1d7079a72f7ffd5c2634b6a9f6a5.json b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/modify parent content_1_1a7f1d7079a72f7ffd5c2634b6a9f6a5.json
new file mode 100644
index 0000000000..24e83a975d
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/modify parent content_1_1a7f1d7079a72f7ffd5c2634b6a9f6a5.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://api.openai.com/v1/responses",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"input\":[{\"role\":\"system\",\"content\":\"You are manipulating a text document using TSX components.\\nEach block is represented as a TSX component with props.\\n\"},{\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"There is no active selection. This is the latest state of the document (ignore previous documents, you MUST issue operations against this latest version of the document). \\nThe cursor is BETWEEN two blocks as indicated by cursor: true.\\nPrefer updating existing blocks over removing and adding (but this also depends on the user's question).\"}]},{\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"[{\\\"id\\\":\\\"ref1$\\\",\\\"block\\\":\\\"I need to buy: \\\"},{\\\"cursor\\\":true},{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"Apples \\\"}]\"}]},{\"role\":\"user\",\"content\":[{\"type\":\"input_text\",\"text\":\"make the first paragraph uppercase\"}]}],\"tools\":[{\"type\":\"function\",\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"]}}],\"tool_choice\":\"required\",\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "event: response.created\ndata: {\"type\":\"response.created\",\"response\":{\"id\":\"resp_0276c56691d02c0c00698e16ca9fd0819792dbed34251ad17d\",\"object\":\"response\",\"created_at\":1770919626,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"],\"additionalProperties\":false},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":0}\n\nevent: response.in_progress\ndata: {\"type\":\"response.in_progress\",\"response\":{\"id\":\"resp_0276c56691d02c0c00698e16ca9fd0819792dbed34251ad17d\",\"object\":\"response\",\"created_at\":1770919626,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"],\"additionalProperties\":false},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":1}\n\nevent: response.output_item.added\ndata: {\"type\":\"response.output_item.added\",\"item\":{\"id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"type\":\"function_call\",\"status\":\"in_progress\",\"arguments\":\"\",\"call_id\":\"call_qHwkA86vmtLnvoju8Epk2jci\",\"name\":\"file_replace\"},\"output_index\":0,\"sequence_number\":2}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"{\\\"\",\"item_id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"obfuscation\":\"c7ajREfW4yLVAp\",\"output_index\":0,\"sequence_number\":3}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"target\",\"item_id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"obfuscation\":\"MIaHzcmUXv\",\"output_index\":0,\"sequence_number\":4}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\\\"\",\"item_id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"obfuscation\":\"nCxmwnxY8L3xk\",\"output_index\":0,\"sequence_number\":5}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"<\",\"item_id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"obfuscation\":\"mxKxiyUPN8DY9mO\",\"output_index\":0,\"sequence_number\":6}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"obfuscation\":\"saDIQsE\",\"output_index\":0,\"sequence_number\":7}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" text\",\"item_id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"obfuscation\":\"YCVOK9BK8aN\",\"output_index\":0,\"sequence_number\":8}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Alignment\",\"item_id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"obfuscation\":\"KKPTWjK\",\"output_index\":0,\"sequence_number\":9}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"obfuscation\":\"tQvUMY9AiaBPU\",\"output_index\":0,\"sequence_number\":10}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"left\",\"item_id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"obfuscation\":\"H6dqPzCyLEvD\",\"output_index\":0,\"sequence_number\":11}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\"\",\"item_id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"obfuscation\":\"YIQJHcSsQ16Wp8\",\"output_index\":0,\"sequence_number\":12}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" id\",\"item_id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"obfuscation\":\"c70tw7Wu9Au35\",\"output_index\":0,\"sequence_number\":13}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"obfuscation\":\"1IvyOrqjdcGZ0\",\"output_index\":0,\"sequence_number\":14}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"ref\",\"item_id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"obfuscation\":\"j2wAmmOZgMGuf\",\"output_index\":0,\"sequence_number\":15}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"1\",\"item_id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"obfuscation\":\"2LB7fwzKfp4EXxL\",\"output_index\":0,\"sequence_number\":16}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\">\",\"item_id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"obfuscation\":\"tS0zdTCoPkGqk\",\"output_index\":0,\"sequence_number\":17}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"I\",\"item_id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"obfuscation\":\"z4rqZG1HE4tjphn\",\"output_index\":0,\"sequence_number\":18}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" need\",\"item_id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"obfuscation\":\"gBb1ItcvvNA\",\"output_index\":0,\"sequence_number\":19}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" to\",\"item_id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"obfuscation\":\"i4RwW1FZFZJ4z\",\"output_index\":0,\"sequence_number\":20}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" buy\",\"item_id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"obfuscation\":\"WuZ1izAwpmhm\",\"output_index\":0,\"sequence_number\":21}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\":\",\"item_id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"obfuscation\":\"I7si0W0ce1dM4\",\"output_index\":0,\"sequence_number\":22}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"obfuscation\":\"tpWbup2\",\"output_index\":0,\"sequence_number\":23}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\">\",\"item_id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"obfuscation\":\"HTMCSkXuhcKP3s5\",\"output_index\":0,\"sequence_number\":24}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\",\\\"\",\"item_id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"obfuscation\":\"0lS2Ua535reyt\",\"output_index\":0,\"sequence_number\":25}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"replacement\",\"item_id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"obfuscation\":\"VeDEu\",\"output_index\":0,\"sequence_number\":26}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\\\"\",\"item_id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"obfuscation\":\"8mnQJblmIlDxk\",\"output_index\":0,\"sequence_number\":27}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"<\",\"item_id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"obfuscation\":\"8gZdJxTMOQurA1M\",\"output_index\":0,\"sequence_number\":28}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"obfuscation\":\"ZQljrvD\",\"output_index\":0,\"sequence_number\":29}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" text\",\"item_id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"obfuscation\":\"FypWobKcNyC\",\"output_index\":0,\"sequence_number\":30}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Alignment\",\"item_id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"obfuscation\":\"DkCcSXY\",\"output_index\":0,\"sequence_number\":31}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"obfuscation\":\"GmTsfLfgpJzeY\",\"output_index\":0,\"sequence_number\":32}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"left\",\"item_id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"obfuscation\":\"yZzXXHjJGckM\",\"output_index\":0,\"sequence_number\":33}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\"\",\"item_id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"obfuscation\":\"eo6kYCD6le7ts0\",\"output_index\":0,\"sequence_number\":34}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" id\",\"item_id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"obfuscation\":\"c1WwVyMcmsWA0\",\"output_index\":0,\"sequence_number\":35}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"obfuscation\":\"8aqjl1bXnIoud\",\"output_index\":0,\"sequence_number\":36}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"ref\",\"item_id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"obfuscation\":\"33mhBaC9ide8I\",\"output_index\":0,\"sequence_number\":37}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"1\",\"item_id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"obfuscation\":\"eVO5UkikUT8GGlM\",\"output_index\":0,\"sequence_number\":38}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\">\",\"item_id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"obfuscation\":\"zndJawVFQHBZT\",\"output_index\":0,\"sequence_number\":39}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"I\",\"item_id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"obfuscation\":\"OgXbJTL3XQbuRrN\",\"output_index\":0,\"sequence_number\":40}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" NEED\",\"item_id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"obfuscation\":\"7cgqPJ8rIki\",\"output_index\":0,\"sequence_number\":41}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" TO\",\"item_id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"obfuscation\":\"CcjtpfvlftBuC\",\"output_index\":0,\"sequence_number\":42}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" BUY\",\"item_id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"obfuscation\":\"SGfIL97DwVGk\",\"output_index\":0,\"sequence_number\":43}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\":\",\"item_id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"obfuscation\":\"ran09YGxSL8Vn\",\"output_index\":0,\"sequence_number\":44}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"obfuscation\":\"lSPzcDE\",\"output_index\":0,\"sequence_number\":45}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\">\",\"item_id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"obfuscation\":\"A0QbATLaKuzp4I7\",\"output_index\":0,\"sequence_number\":46}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\"}\",\"item_id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"obfuscation\":\"aVak9BfVgY7cCP\",\"output_index\":0,\"sequence_number\":47}\n\nevent: response.function_call_arguments.done\ndata: {\"type\":\"response.function_call_arguments.done\",\"arguments\":\"{\\\"target\\\":\\\"I need to buy: \\\",\\\"replacement\\\":\\\"I NEED TO BUY: \\\"}\",\"item_id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"output_index\":0,\"sequence_number\":48}\n\nevent: response.output_item.done\ndata: {\"type\":\"response.output_item.done\",\"item\":{\"id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"type\":\"function_call\",\"status\":\"completed\",\"arguments\":\"{\\\"target\\\":\\\"I need to buy: \\\",\\\"replacement\\\":\\\"I NEED TO BUY: \\\"}\",\"call_id\":\"call_qHwkA86vmtLnvoju8Epk2jci\",\"name\":\"file_replace\"},\"output_index\":0,\"sequence_number\":49}\n\nevent: response.completed\ndata: {\"type\":\"response.completed\",\"response\":{\"id\":\"resp_0276c56691d02c0c00698e16ca9fd0819792dbed34251ad17d\",\"object\":\"response\",\"created_at\":1770919626,\"status\":\"completed\",\"background\":false,\"completed_at\":1770919627,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[{\"id\":\"fc_0276c56691d02c0c00698e16cb0920819799603e3088d9662a\",\"type\":\"function_call\",\"status\":\"completed\",\"arguments\":\"{\\\"target\\\":\\\"I need to buy: \\\",\\\"replacement\\\":\\\"I NEED TO BUY: \\\"}\",\"call_id\":\"call_qHwkA86vmtLnvoju8Epk2jci\",\"name\":\"file_replace\"}],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"default\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"],\"additionalProperties\":false},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":{\"input_tokens\":218,\"input_tokens_details\":{\"cached_tokens\":0},\"output_tokens\":46,\"output_tokens_details\":{\"reasoning_tokens\":0},\"total_tokens\":264},\"user\":null,\"metadata\":{}},\"sequence_number\":50}\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/turn paragraphs into list_1_a9f159e42c5da61727c8d77764c66693.json b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/turn paragraphs into list_1_a9f159e42c5da61727c8d77764c66693.json
new file mode 100644
index 0000000000..d6f2c5c92d
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/turn paragraphs into list_1_a9f159e42c5da61727c8d77764c66693.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://api.openai.com/v1/responses",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"input\":[{\"role\":\"system\",\"content\":\"You are manipulating a text document using TSX components.\\nEach block is represented as a TSX component with props.\\n\"},{\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"This is the latest state of the selection (ignore previous selections, you MUST issue operations against this latest version of the selection):\"}]},{\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"[{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"Apples \\\"},{\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":\\\"Bananas \\\"}]\"}]},{\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"This is the latest state of the entire document (INCLUDING the selected text), \\nyou can use this to find the selected text to understand the context (but you MUST NOT issue operations against this document, you MUST issue operations against the selection):\"}]},{\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"[{\\\"block\\\":\\\"I need to buy: \\\"},{\\\"block\\\":\\\"Apples \\\"},{\\\"block\\\":\\\"Bananas \\\"}]\"}]},{\"role\":\"user\",\"content\":[{\"type\":\"input_text\",\"text\":\"turn into list (update existing blocks)\"}]}],\"tools\":[{\"type\":\"function\",\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"]}}],\"tool_choice\":\"required\",\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "event: response.created\ndata: {\"type\":\"response.created\",\"response\":{\"id\":\"resp_0ac275bc8dbb279000698e16c8a1108190a88f06fffd7154e8\",\"object\":\"response\",\"created_at\":1770919624,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"],\"additionalProperties\":false},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":0}\n\nevent: response.in_progress\ndata: {\"type\":\"response.in_progress\",\"response\":{\"id\":\"resp_0ac275bc8dbb279000698e16c8a1108190a88f06fffd7154e8\",\"object\":\"response\",\"created_at\":1770919624,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"],\"additionalProperties\":false},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":1}\n\nevent: response.output_item.added\ndata: {\"type\":\"response.output_item.added\",\"item\":{\"id\":\"fc_0ac275bc8dbb279000698e16c8f35081908b74505d2d5d710a\",\"type\":\"function_call\",\"status\":\"in_progress\",\"arguments\":\"\",\"call_id\":\"call_py39NpurrFm09mTtAEOOIFb0\",\"name\":\"file_replace\"},\"output_index\":0,\"sequence_number\":2}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"{\\\"\",\"item_id\":\"fc_0ac275bc8dbb279000698e16c8f35081908b74505d2d5d710a\",\"obfuscation\":\"PPidfntJXy8VrT\",\"output_index\":0,\"sequence_number\":3}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"target\",\"item_id\":\"fc_0ac275bc8dbb279000698e16c8f35081908b74505d2d5d710a\",\"obfuscation\":\"SmYSoR4Gzo\",\"output_index\":0,\"sequence_number\":4}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\\\"\",\"item_id\":\"fc_0ac275bc8dbb279000698e16c8f35081908b74505d2d5d710a\",\"obfuscation\":\"6A4pP4zMN2FIN\",\"output_index\":0,\"sequence_number\":5}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"<\",\"item_id\":\"fc_0ac275bc8dbb279000698e16c8f35081908b74505d2d5d710a\",\"obfuscation\":\"GeNBSRPkyGCoPJ5\",\"output_index\":0,\"sequence_number\":6}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_0ac275bc8dbb279000698e16c8f35081908b74505d2d5d710a\",\"obfuscation\":\"Vqhhwpp\",\"output_index\":0,\"sequence_number\":7}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" text\",\"item_id\":\"fc_0ac275bc8dbb279000698e16c8f35081908b74505d2d5d710a\",\"obfuscation\":\"MvTIPcsgl76\",\"output_index\":0,\"sequence_number\":8}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Alignment\",\"item_id\":\"fc_0ac275bc8dbb279000698e16c8f35081908b74505d2d5d710a\",\"obfuscation\":\"rqqGHPe\",\"output_index\":0,\"sequence_number\":9}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_0ac275bc8dbb279000698e16c8f35081908b74505d2d5d710a\",\"obfuscation\":\"DEssm7RNDAItd\",\"output_index\":0,\"sequence_number\":10}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"left\",\"item_id\":\"fc_0ac275bc8dbb279000698e16c8f35081908b74505d2d5d710a\",\"obfuscation\":\"2KZyie4JBWUh\",\"output_index\":0,\"sequence_number\":11}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\"\",\"item_id\":\"fc_0ac275bc8dbb279000698e16c8f35081908b74505d2d5d710a\",\"obfuscation\":\"x8u0teYCgqe1Ix\",\"output_index\":0,\"sequence_number\":12}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" id\",\"item_id\":\"fc_0ac275bc8dbb279000698e16c8f35081908b74505d2d5d710a\",\"obfuscation\":\"sBgAblenxE9x4\",\"output_index\":0,\"sequence_number\":13}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_0ac275bc8dbb279000698e16c8f35081908b74505d2d5d710a\",\"obfuscation\":\"2KIcXBAmrMigG\",\"output_index\":0,\"sequence_number\":14}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"ref\",\"item_id\":\"fc_0ac275bc8dbb279000698e16c8f35081908b74505d2d5d710a\",\"obfuscation\":\"iRsPPqzHoJ1bB\",\"output_index\":0,\"sequence_number\":15}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"2\",\"item_id\":\"fc_0ac275bc8dbb279000698e16c8f35081908b74505d2d5d710a\",\"obfuscation\":\"Nf8zErhIMKLO3Tu\",\"output_index\":0,\"sequence_number\":16}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\">\",\"item_id\":\"fc_0ac275bc8dbb279000698e16c8f35081908b74505d2d5d710a\",\"obfuscation\":\"EMti6pftEVolv\",\"output_index\":0,\"sequence_number\":17}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Ap\",\"item_id\":\"fc_0ac275bc8dbb279000698e16c8f35081908b74505d2d5d710a\",\"obfuscation\":\"xMONTVSkJZIF5k\",\"output_index\":0,\"sequence_number\":18}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"ples\",\"item_id\":\"fc_0ac275bc8dbb279000698e16c8f35081908b74505d2d5d710a\",\"obfuscation\":\"yNfPscq81YdW\",\"output_index\":0,\"sequence_number\":19}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\",\"item_id\":\"fc_0ac275bc8dbb279000698e16c8f35081908b74505d2d5d710a\",\"obfuscation\":\"Jfg0YcVGnXrioX\",\"output_index\":0,\"sequence_number\":20}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_0ac275bc8dbb279000698e16c8f35081908b74505d2d5d710a\",\"obfuscation\":\"mjyO4mR\",\"output_index\":0,\"sequence_number\":21}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\">\",\"item_id\":\"fc_0ac275bc8dbb279000698e16c8f35081908b74505d2d5d710a\",\"obfuscation\":\"dcmvXi4ZieJBMRt\",\"output_index\":0,\"sequence_number\":22}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\",\\\"\",\"item_id\":\"fc_0ac275bc8dbb279000698e16c8f35081908b74505d2d5d710a\",\"obfuscation\":\"CkQ6Fv64wMUis\",\"output_index\":0,\"sequence_number\":23}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"replacement\",\"item_id\":\"fc_0ac275bc8dbb279000698e16c8f35081908b74505d2d5d710a\",\"obfuscation\":\"z7rXC\",\"output_index\":0,\"sequence_number\":24}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\\\"\",\"item_id\":\"fc_0ac275bc8dbb279000698e16c8f35081908b74505d2d5d710a\",\"obfuscation\":\"3zswC02yI4JkT\",\"output_index\":0,\"sequence_number\":25}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"<\",\"item_id\":\"fc_0ac275bc8dbb279000698e16c8f35081908b74505d2d5d710a\",\"obfuscation\":\"QH4AQMmMHcZHllt\",\"output_index\":0,\"sequence_number\":26}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"List\",\"item_id\":\"fc_0ac275bc8dbb279000698e16c8f35081908b74505d2d5d710a\",\"obfuscation\":\"KOvrtznzRrez\",\"output_index\":0,\"sequence_number\":27}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Item\",\"item_id\":\"fc_0ac275bc8dbb279000698e16c8f35081908b74505d2d5d710a\",\"obfuscation\":\"9lBSNoO16pEN\",\"output_index\":0,\"sequence_number\":28}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" id\",\"item_id\":\"fc_0ac275bc8dbb279000698e16c8f35081908b74505d2d5d710a\",\"obfuscation\":\"Ol3QBwI281hZk\",\"output_index\":0,\"sequence_number\":29}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_0ac275bc8dbb279000698e16c8f35081908b74505d2d5d710a\",\"obfuscation\":\"OVLtA9ufHVR3H\",\"output_index\":0,\"sequence_number\":30}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"ref\",\"item_id\":\"fc_0ac275bc8dbb279000698e16c8f35081908b74505d2d5d710a\",\"obfuscation\":\"NqdDvKfjKuKhp\",\"output_index\":0,\"sequence_number\":31}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"2\",\"item_id\":\"fc_0ac275bc8dbb279000698e16c8f35081908b74505d2d5d710a\",\"obfuscation\":\"DSAor1dGeHHwioZ\",\"output_index\":0,\"sequence_number\":32}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\">\",\"item_id\":\"fc_0ac275bc8dbb279000698e16c8f35081908b74505d2d5d710a\",\"obfuscation\":\"i8QQbJTNe9BBe\",\"output_index\":0,\"sequence_number\":33}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Ap\",\"item_id\":\"fc_0ac275bc8dbb279000698e16c8f35081908b74505d2d5d710a\",\"obfuscation\":\"UKpMIlxpaY4lhd\",\"output_index\":0,\"sequence_number\":34}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"ples\",\"item_id\":\"fc_0ac275bc8dbb279000698e16c8f35081908b74505d2d5d710a\",\"obfuscation\":\"h0kbxe2xFrMA\",\"output_index\":0,\"sequence_number\":35}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\",\"item_id\":\"fc_0ac275bc8dbb279000698e16c8f35081908b74505d2d5d710a\",\"obfuscation\":\"GV4dmE3FapLRW8\",\"output_index\":0,\"sequence_number\":36}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"List\",\"item_id\":\"fc_0ac275bc8dbb279000698e16c8f35081908b74505d2d5d710a\",\"obfuscation\":\"jXIUTkXhDjkz\",\"output_index\":0,\"sequence_number\":37}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Item\",\"item_id\":\"fc_0ac275bc8dbb279000698e16c8f35081908b74505d2d5d710a\",\"obfuscation\":\"cVTYgSuASLjO\",\"output_index\":0,\"sequence_number\":38}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\">\",\"item_id\":\"fc_0ac275bc8dbb279000698e16c8f35081908b74505d2d5d710a\",\"obfuscation\":\"76ZVTVFHEpEjgv3\",\"output_index\":0,\"sequence_number\":39}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\"}\",\"item_id\":\"fc_0ac275bc8dbb279000698e16c8f35081908b74505d2d5d710a\",\"obfuscation\":\"w67Jojtdyv2sL0\",\"output_index\":0,\"sequence_number\":40}\n\nevent: response.function_call_arguments.done\ndata: {\"type\":\"response.function_call_arguments.done\",\"arguments\":\"{\\\"target\\\":\\\"Apples \\\",\\\"replacement\\\":\\\"Apples \\\"}\",\"item_id\":\"fc_0ac275bc8dbb279000698e16c8f35081908b74505d2d5d710a\",\"output_index\":0,\"sequence_number\":41}\n\nevent: response.output_item.done\ndata: {\"type\":\"response.output_item.done\",\"item\":{\"id\":\"fc_0ac275bc8dbb279000698e16c8f35081908b74505d2d5d710a\",\"type\":\"function_call\",\"status\":\"completed\",\"arguments\":\"{\\\"target\\\":\\\"Apples \\\",\\\"replacement\\\":\\\"Apples \\\"}\",\"call_id\":\"call_py39NpurrFm09mTtAEOOIFb0\",\"name\":\"file_replace\"},\"output_index\":0,\"sequence_number\":42}\n\nevent: response.completed\ndata: {\"type\":\"response.completed\",\"response\":{\"id\":\"resp_0ac275bc8dbb279000698e16c8a1108190a88f06fffd7154e8\",\"object\":\"response\",\"created_at\":1770919624,\"status\":\"completed\",\"background\":false,\"completed_at\":1770919625,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[{\"id\":\"fc_0ac275bc8dbb279000698e16c8f35081908b74505d2d5d710a\",\"type\":\"function_call\",\"status\":\"completed\",\"arguments\":\"{\\\"target\\\":\\\"Apples \\\",\\\"replacement\\\":\\\"Apples \\\"}\",\"call_id\":\"call_py39NpurrFm09mTtAEOOIFb0\",\"name\":\"file_replace\"}],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"default\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"file_replace\",\"parameters\":{\"type\":\"object\",\"properties\":{\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"target\",\"replacement\"],\"additionalProperties\":false},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":{\"input_tokens\":298,\"input_tokens_details\":{\"cached_tokens\":0},\"output_tokens\":39,\"output_tokens_details\":{\"reasoning_tokens\":0},\"total_tokens\":337},\"user\":null,\"metadata\":{}},\"sequence_number\":43}\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/turn paragraphs into list_1_b91bf228911b0e8569268b5b3cc57017.json b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/turn paragraphs into list_1_b91bf228911b0e8569268b5b3cc57017.json
new file mode 100644
index 0000000000..86b1cb3b24
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/tsx-document/__snapshots__/tsxDocument.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/turn paragraphs into list_1_b91bf228911b0e8569268b5b3cc57017.json
@@ -0,0 +1,15 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "https://api.openai.com/v1/responses",
+ "body": "{\"model\":\"gpt-4o-2024-08-06\",\"input\":[{\"role\":\"system\",\"content\":\"You are manipulating a text document using TSX components.\\nEach block is represented as a TSX component with props.\\n\"},{\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"This is the latest state of the selection (ignore previous selections, you MUST issue operations against this latest version of the selection):\"}]},{\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"[{\\\"id\\\":\\\"ref2$\\\",\\\"block\\\":\\\"Apples \\\"},{\\\"id\\\":\\\"ref3$\\\",\\\"block\\\":\\\"Bananas \\\"}]\"}]},{\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"This is the latest state of the entire document (INCLUDING the selected text), \\nyou can use this to find the selected text to understand the context (but you MUST NOT issue operations against this document, you MUST issue operations against the selection):\"}]},{\"role\":\"assistant\",\"content\":[{\"type\":\"output_text\",\"text\":\"[{\\\"block\\\":\\\"I need to buy: \\\"},{\\\"block\\\":\\\"Apples \\\"},{\\\"block\\\":\\\"Bananas \\\"}]\"}]},{\"role\":\"user\",\"content\":[{\"type\":\"input_text\",\"text\":\"turn into list (update existing blocks)\"}]}],\"tools\":[{\"type\":\"function\",\"name\":\"applyDocumentOperations\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Replace a part of the document file\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"file_replace\"]},\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"type\",\"target\",\"replacement\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"]}}],\"tool_choice\":\"required\",\"stream\":true}",
+ "headers": [],
+ "cookies": []
+ },
+ "response": {
+ "status": 200,
+ "statusText": "",
+ "body": "event: response.created\ndata: {\"type\":\"response.created\",\"response\":{\"id\":\"resp_08f182bfb8e8e6ac00698cd82913b88190ad679f753bbe75d6\",\"object\":\"response\",\"created_at\":1770838057,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"applyDocumentOperations\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Replace a part of the document file\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"file_replace\"]},\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"type\",\"target\",\"replacement\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"]},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":0}\n\nevent: response.in_progress\ndata: {\"type\":\"response.in_progress\",\"response\":{\"id\":\"resp_08f182bfb8e8e6ac00698cd82913b88190ad679f753bbe75d6\",\"object\":\"response\",\"created_at\":1770838057,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"applyDocumentOperations\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Replace a part of the document file\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"file_replace\"]},\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"type\",\"target\",\"replacement\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"]},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":1}\n\nevent: response.output_item.added\ndata: {\"type\":\"response.output_item.added\",\"item\":{\"id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"type\":\"function_call\",\"status\":\"in_progress\",\"arguments\":\"\",\"call_id\":\"call_AkpFZEegz5ket0lnQSDeXzDG\",\"name\":\"applyDocumentOperations\"},\"output_index\":0,\"sequence_number\":2}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"{\\\"\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"EcN5MOCPK9eKuE\",\"output_index\":0,\"sequence_number\":3}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"operations\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"m7KZFq\",\"output_index\":0,\"sequence_number\":4}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":[\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"VovJn9RR0kbQC\",\"output_index\":0,\"sequence_number\":5}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"{\\\"\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"VrNeiCjxzJLOGp\",\"output_index\":0,\"sequence_number\":6}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"type\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"ZDhmj0OQhRRu\",\"output_index\":0,\"sequence_number\":7}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\\\"\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"cPL6iWW6RKmRQ\",\"output_index\":0,\"sequence_number\":8}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"file\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"hN20htg348LM\",\"output_index\":0,\"sequence_number\":9}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"_replace\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"ydsiVBnc\",\"output_index\":0,\"sequence_number\":10}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\",\\\"\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"CJ32wPELYY0EE\",\"output_index\":0,\"sequence_number\":11}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"target\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"kDOeH55LCm\",\"output_index\":0,\"sequence_number\":12}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\\\"\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"IcuuTXiXXYDmj\",\"output_index\":0,\"sequence_number\":13}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"<\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"QrZjEli3gN934bq\",\"output_index\":0,\"sequence_number\":14}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"GgO77UE\",\"output_index\":0,\"sequence_number\":15}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" text\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"rxHkxG8xGOn\",\"output_index\":0,\"sequence_number\":16}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Alignment\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"amSzH9w\",\"output_index\":0,\"sequence_number\":17}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"mxE0qO8CZlRbY\",\"output_index\":0,\"sequence_number\":18}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"left\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"gSjpwB6WgAOS\",\"output_index\":0,\"sequence_number\":19}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\"\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"ELNnBRKvqaVApy\",\"output_index\":0,\"sequence_number\":20}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" id\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"nAop1RM5szBAc\",\"output_index\":0,\"sequence_number\":21}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"nSpEtZkj6XhaV\",\"output_index\":0,\"sequence_number\":22}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"ref\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"lyEgSS11NZqcA\",\"output_index\":0,\"sequence_number\":23}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"2\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"oWDY8qdpClTBJ5k\",\"output_index\":0,\"sequence_number\":24}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\">\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"SAYvyPw9CtlPN\",\"output_index\":0,\"sequence_number\":25}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Ap\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"hx9t3Nz59Zm8DR\",\"output_index\":0,\"sequence_number\":26}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"ples\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"0QY30QCerZij\",\"output_index\":0,\"sequence_number\":27}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"hvAyVMSuBqyj1I\",\"output_index\":0,\"sequence_number\":28}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"ZYc0yiG\",\"output_index\":0,\"sequence_number\":29}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\">\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"MS54aL6chc98IFC\",\"output_index\":0,\"sequence_number\":30}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\",\\\"\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"EZdVGsEpnGOfQ\",\"output_index\":0,\"sequence_number\":31}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"replacement\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"IsZuU\",\"output_index\":0,\"sequence_number\":32}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\\\"\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"mSjW9Tf5Ke5dc\",\"output_index\":0,\"sequence_number\":33}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"<\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"zA1pNeh2icVRy4f\",\"output_index\":0,\"sequence_number\":34}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"List\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"xLGjCk1ENuSn\",\"output_index\":0,\"sequence_number\":35}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Item\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"1iy7prP4i2Qx\",\"output_index\":0,\"sequence_number\":36}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" id\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"immgscLlVh7ea\",\"output_index\":0,\"sequence_number\":37}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"nZwcVeYY3BaUg\",\"output_index\":0,\"sequence_number\":38}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"ref\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"zvaXGSVWPqYhJ\",\"output_index\":0,\"sequence_number\":39}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"2\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"uRNYCpWwYL9ApDX\",\"output_index\":0,\"sequence_number\":40}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\">\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"3FSteTuJW1iCU\",\"output_index\":0,\"sequence_number\":41}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Ap\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"MLAKupsKz7VUn4\",\"output_index\":0,\"sequence_number\":42}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"ples\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"Yi9VORDerTki\",\"output_index\":0,\"sequence_number\":43}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"BWtNyUwPSLJ8BZ\",\"output_index\":0,\"sequence_number\":44}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"List\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"8uDYMcMayfkY\",\"output_index\":0,\"sequence_number\":45}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Item\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"LyPM301kDoPD\",\"output_index\":0,\"sequence_number\":46}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\">\\\"\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"1YKh70GlM83nQy\",\"output_index\":0,\"sequence_number\":47}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"},{\\\"\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"HYV2PJUyC2Fz\",\"output_index\":0,\"sequence_number\":48}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"type\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"snGI1yQ19Idq\",\"output_index\":0,\"sequence_number\":49}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\\\"\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"EpHyzpGGDhiQ9\",\"output_index\":0,\"sequence_number\":50}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"file\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"lYgiLdAoZXGa\",\"output_index\":0,\"sequence_number\":51}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"_replace\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"4bpQWVYM\",\"output_index\":0,\"sequence_number\":52}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\",\\\"\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"f08cyOnl82s3U\",\"output_index\":0,\"sequence_number\":53}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"target\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"OxjvqwewuO\",\"output_index\":0,\"sequence_number\":54}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\\\"\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"j1ZFFQ8HN1Qrl\",\"output_index\":0,\"sequence_number\":55}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"<\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"Ix15Gnfz8u1Wuqw\",\"output_index\":0,\"sequence_number\":56}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"t7BtWwK\",\"output_index\":0,\"sequence_number\":57}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" text\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"bzoWN3Bep90\",\"output_index\":0,\"sequence_number\":58}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Alignment\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"UTX5y11\",\"output_index\":0,\"sequence_number\":59}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"INOdTkSHRSz0f\",\"output_index\":0,\"sequence_number\":60}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"left\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"Lh5RHZFVpf6G\",\"output_index\":0,\"sequence_number\":61}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\"\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"LK6Zg4uR6ZjaNn\",\"output_index\":0,\"sequence_number\":62}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" id\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"vwDeKR0SK7YL0\",\"output_index\":0,\"sequence_number\":63}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"Kd7Wfx8W9IRXk\",\"output_index\":0,\"sequence_number\":64}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"ref\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"CrTCzbSTOuMD1\",\"output_index\":0,\"sequence_number\":65}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"3\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"u8y33CUrpGSOTcG\",\"output_index\":0,\"sequence_number\":66}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\">\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"AMZoA3h548ZE5\",\"output_index\":0,\"sequence_number\":67}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Ban\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"j9EkKbgBv1c3G\",\"output_index\":0,\"sequence_number\":68}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"anas\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"xre6AsZQLO5L\",\"output_index\":0,\"sequence_number\":69}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"XQ95seclhxntWh\",\"output_index\":0,\"sequence_number\":70}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Paragraph\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"LTdWGUY\",\"output_index\":0,\"sequence_number\":71}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\">\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"e3zsXO09Fu8Ba4m\",\"output_index\":0,\"sequence_number\":72}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\",\\\"\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"rrgHUijr7fOEN\",\"output_index\":0,\"sequence_number\":73}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"replacement\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"ZBPG0\",\"output_index\":0,\"sequence_number\":74}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\":\\\"\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"I3N5HNLFYECM9\",\"output_index\":0,\"sequence_number\":75}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"<\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"6nBDBAA8N5rZcXE\",\"output_index\":0,\"sequence_number\":76}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"List\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"dtwyr3VfnZQZ\",\"output_index\":0,\"sequence_number\":77}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Item\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"Mti6Bfht2I06\",\"output_index\":0,\"sequence_number\":78}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\" id\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"waZRRnOfmNnia\",\"output_index\":0,\"sequence_number\":79}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"=\\\\\\\"\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"D9GsrJveU1wU5\",\"output_index\":0,\"sequence_number\":80}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"ref\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"B3HhkBmgiePJ3\",\"output_index\":0,\"sequence_number\":81}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"3\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"uhsd5ZQVMMoZr0y\",\"output_index\":0,\"sequence_number\":82}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\\\\\">\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"wj9hEYd9AJs2m\",\"output_index\":0,\"sequence_number\":83}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Ban\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"eZkp4QQFeF5hW\",\"output_index\":0,\"sequence_number\":84}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"anas\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"DyLAMc76RrRN\",\"output_index\":0,\"sequence_number\":85}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"0tajQSB3YuLPiR\",\"output_index\":0,\"sequence_number\":86}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"List\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"IZFDayia3oD2\",\"output_index\":0,\"sequence_number\":87}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"Item\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"Z1EIx0gDewTS\",\"output_index\":0,\"sequence_number\":88}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\">\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"MM6t9k0V58TYLwL\",\"output_index\":0,\"sequence_number\":89}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"\\\"}\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"M19oVGekjFp98b\",\"output_index\":0,\"sequence_number\":90}\n\nevent: response.function_call_arguments.delta\ndata: {\"type\":\"response.function_call_arguments.delta\",\"delta\":\"]}\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"obfuscation\":\"RFkNhOuG3CYVL2\",\"output_index\":0,\"sequence_number\":91}\n\nevent: response.function_call_arguments.done\ndata: {\"type\":\"response.function_call_arguments.done\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"file_replace\\\",\\\"target\\\":\\\"Apples \\\",\\\"replacement\\\":\\\"Apples \\\"},{\\\"type\\\":\\\"file_replace\\\",\\\"target\\\":\\\"Bananas \\\",\\\"replacement\\\":\\\"Bananas \\\"}]}\",\"item_id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"output_index\":0,\"sequence_number\":92}\n\nevent: response.output_item.done\ndata: {\"type\":\"response.output_item.done\",\"item\":{\"id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"type\":\"function_call\",\"status\":\"completed\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"file_replace\\\",\\\"target\\\":\\\"Apples \\\",\\\"replacement\\\":\\\"Apples \\\"},{\\\"type\\\":\\\"file_replace\\\",\\\"target\\\":\\\"Bananas \\\",\\\"replacement\\\":\\\"Bananas \\\"}]}\",\"call_id\":\"call_AkpFZEegz5ket0lnQSDeXzDG\",\"name\":\"applyDocumentOperations\"},\"output_index\":0,\"sequence_number\":93}\n\nevent: response.completed\ndata: {\"type\":\"response.completed\",\"response\":{\"id\":\"resp_08f182bfb8e8e6ac00698cd82913b88190ad679f753bbe75d6\",\"object\":\"response\",\"created_at\":1770838057,\"status\":\"completed\",\"background\":false,\"completed_at\":1770838058,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-4o-2024-08-06\",\"output\":[{\"id\":\"fc_08f182bfb8e8e6ac00698cd8296f908190953c0edeaadd5f50\",\"type\":\"function_call\",\"status\":\"completed\",\"arguments\":\"{\\\"operations\\\":[{\\\"type\\\":\\\"file_replace\\\",\\\"target\\\":\\\"Apples \\\",\\\"replacement\\\":\\\"Apples \\\"},{\\\"type\\\":\\\"file_replace\\\",\\\"target\\\":\\\"Bananas \\\",\\\"replacement\\\":\\\"Bananas \\\"}]}\",\"call_id\":\"call_AkpFZEegz5ket0lnQSDeXzDG\",\"name\":\"applyDocumentOperations\"}],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"default\",\"store\":true,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"required\",\"tools\":[{\"type\":\"function\",\"description\":null,\"name\":\"applyDocumentOperations\",\"parameters\":{\"type\":\"object\",\"properties\":{\"operations\":{\"type\":\"array\",\"items\":{\"anyOf\":[{\"type\":\"object\",\"description\":\"Replace a part of the document file\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"file_replace\"]},\"target\":{\"type\":\"string\",\"description\":\"The string to replace\"},\"replacement\":{\"type\":\"string\",\"description\":\"The replacement string\"}},\"required\":[\"type\",\"target\",\"replacement\"],\"additionalProperties\":false}]}}},\"additionalProperties\":false,\"required\":[\"operations\"]},\"strict\":true}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":{\"input_tokens\":323,\"input_tokens_details\":{\"cached_tokens\":0},\"output_tokens\":90,\"output_tokens_details\":{\"reasoning_tokens\":0},\"total_tokens\":413},\"user\":null,\"metadata\":{}},\"sequence_number\":94}\n\n",
+ "headers": []
+ }
+}
\ No newline at end of file
diff --git a/packages/xl-ai/src/api/formats/tsx-document/tools/convertFileReplaceToolCall.test.ts b/packages/xl-ai/src/api/formats/tsx-document/tools/convertFileReplaceToolCall.test.ts
new file mode 100644
index 0000000000..4c352392ab
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/tsx-document/tools/convertFileReplaceToolCall.test.ts
@@ -0,0 +1,681 @@
+import { describe, expect, it } from "vitest";
+import type { AddBlocksToolCall } from "../../base-tools/createAddBlocksTool.js";
+import type { UpdateBlockToolCall } from "../../base-tools/createUpdateBlockTool.js";
+import type { DeleteBlockToolCall } from "../../base-tools/delete.js";
+import {
+ BlockRange,
+ convertFileReplaceToolCall,
+ TsxToolCall,
+} from "./convertFileReplaceToolCall.js";
+
+// Fixtures ────────────────────────────────────────────────────────────────────
+
+const simpleDoc = `Hello World
+Second paragraph
+Third paragraph `;
+
+function simpleRanges(): Map {
+ const m = new Map();
+ m.set("p1", { start: 0, end: 42 });
+ m.set("p2", { start: 43, end: 90 });
+ m.set("p3", { start: 91, end: 137 });
+ return m;
+}
+
+/** Document with textAlignment attributes and mixed block types. */
+const richDoc = `Welcome
+Hello World
+This is a test paragraph.
+Item 1
+Item 2 `;
+
+function richRanges(): Map {
+ const m = new Map();
+ m.set("h1", { start: 0, end: 65 });
+ m.set("p1", { start: 66, end: 142 });
+ m.set("p2", { start: 143, end: 220 });
+ m.set("list1", { start: 221, end: 292 });
+ m.set("list2", { start: 293, end: 364 });
+ return m;
+}
+
+const attrDoc = `Hello
+World `;
+
+function attrRanges(): Map {
+ const m = new Map();
+ m.set("p1", { start: 0, end: 57 });
+ m.set("p2", { start: 58, end: 113 });
+ return m;
+}
+
+// Typed assertion helpers ─────────────────────────────────────────────────────
+
+function updates(r: TsxToolCall[]): UpdateBlockToolCall[] {
+ return r.filter((c): c is UpdateBlockToolCall => c.type === "update");
+}
+function adds(r: TsxToolCall[]): AddBlocksToolCall[] {
+ return r.filter((c): c is AddBlocksToolCall => c.type === "add");
+}
+function deletes(r: TsxToolCall[]): DeleteBlockToolCall[] {
+ return r.filter((c): c is DeleteBlockToolCall => c.type === "delete");
+}
+
+/** Shorthand to call the function with simpleDoc. */
+function run(
+ target: string,
+ replacement: string,
+ partial = false,
+): TsxToolCall[] {
+ return convertFileReplaceToolCall({
+ document: simpleDoc,
+ blockRanges: simpleRanges(),
+ target,
+ replacement,
+ isPossiblyPartial: partial,
+ });
+}
+
+// Tests ───────────────────────────────────────────────────────────────────────
+
+describe("convertFileReplaceToolCall", () => {
+ describe("updates & deletes", () => {
+ it("returns empty array when target not found", () => {
+ expect(run("NOT IN DOCUMENT", "anything")).toHaveLength(0);
+ });
+
+ it("detects UPDATE when replacement has matching ID", () => {
+ const r = run(
+ `Hello World `,
+ `Hello Universe `,
+ );
+ expect(updates(r)).toHaveLength(1);
+ expect(updates(r)[0].id).toBe("p1");
+ expect(updates(r)[0].block).toContain("Hello Universe");
+ });
+
+ it("skips UPDATE when content is unchanged", () => {
+ const r = run(
+ `Hello World `,
+ `Hello World `,
+ );
+ expect(updates(r)).toHaveLength(0);
+ });
+
+ it("detects DELETE when replacement is empty", () => {
+ const r = run(`Second paragraph `, ``);
+ expect(deletes(r)).toHaveLength(1);
+ expect(deletes(r)[0].id).toBe("p2");
+ });
+
+ it("detects ADD + DELETE when replacement has no ID", () => {
+ const r = run(
+ `Hello World `,
+ `New Content `,
+ );
+ expect(adds(r)).toHaveLength(1);
+ expect(adds(r)[0].blocks[0]).toContain("New Content");
+ expect(deletes(r)).toHaveLength(1);
+ expect(deletes(r)[0].id).toBe("p1");
+ });
+
+ it("does NOT delete block when replacement restores its ID", () => {
+ const r = run(
+ `Hello World `,
+ `New Block \nHello World `,
+ );
+ expect(adds(r)).toHaveLength(1);
+ expect(deletes(r)).toHaveLength(0);
+ });
+
+ it("handles update one + delete one", () => {
+ const r = run(
+ `Hello World \nSecond paragraph `,
+ `Updated p1 `,
+ );
+ expect(updates(r)).toHaveLength(1);
+ expect(updates(r)[0].id).toBe("p1");
+ expect(deletes(r)).toHaveLength(1);
+ expect(deletes(r)[0].id).toBe("p2");
+ });
+
+ it("handles update + add + delete (complex scenario)", () => {
+ const doc = `First
+Second
+Third `;
+ const ranges = new Map();
+ ranges.set("p1", { start: 0, end: 57 });
+ ranges.set("p2", { start: 58, end: 116 });
+ ranges.set("p3", { start: 117, end: 174 });
+
+ const r = convertFileReplaceToolCall({
+ document: doc,
+ blockRanges: ranges,
+ target: doc,
+ replacement: `First - Modified \nNew paragraph `,
+ isPossiblyPartial: false,
+ });
+
+ expect(updates(r)).toHaveLength(1);
+ expect(updates(r)[0].id).toBe("p1");
+ expect(adds(r)).toHaveLength(1);
+ expect(deletes(r)).toHaveLength(2);
+ expect(deletes(r).map((d) => d.id)).toContain("p2");
+ expect(deletes(r).map((d) => d.id)).toContain("p3");
+ });
+
+ it("splices text-only replacement correctly", () => {
+ const r = run("World", "Planet");
+ expect(updates(r)).toHaveLength(1);
+ expect(updates(r)[0].id).toBe("p1");
+ expect(updates(r)[0].block).toBe(
+ `Hello Planet `,
+ );
+ expect(adds(r)).toHaveLength(0);
+ expect(deletes(r)).toHaveLength(0);
+ });
+
+ it("updates when target is at START of block", () => {
+ const r = run(`Hello`, `Goodbye`);
+ expect(updates(r)[0].block).toBe(
+ `Goodbye World `,
+ );
+ });
+
+ it("updates when target is in MIDDLE of block", () => {
+ const r = run("Hello", "Goodbye");
+ expect(updates(r)[0].block).toBe(
+ `Goodbye World `,
+ );
+ });
+
+ it("updates when target is at END of block", () => {
+ const r = run("World ", "Universe ");
+ expect(updates(r)[0].block).toBe(
+ `Hello Universe `,
+ );
+ });
+
+ it("handles cross-block target: updates first, deletes rest", () => {
+ const r = run(
+ `World
\nSecond`,
+ `World Second`,
+ );
+ // First block absorbs replacement + tail of last block
+ expect(updates(r)).toHaveLength(1);
+ expect(updates(r)[0].id).toBe("p1");
+ expect(updates(r)[0].block).toContain("World Second");
+ expect(updates(r)[0].block).toContain("paragraph ");
+ // p2 is deleted — no trace of it in the replaced document
+ expect(deletes(r)).toHaveLength(1);
+ expect(deletes(r)[0].id).toBe("p2");
+ });
+
+ it("handles self-closing elements", () => {
+ const doc = `Hello World \n \nAfter image `;
+ const ranges = new Map();
+ ranges.set("p1", { start: 0, end: 42 });
+ ranges.set("img1", { start: 43, end: 77 });
+ ranges.set("p3", { start: 78, end: 118 });
+
+ const r = convertFileReplaceToolCall({
+ document: doc,
+ blockRanges: ranges,
+ target: ` `,
+ replacement: ` `,
+ isPossiblyPartial: false,
+ });
+ expect(updates(r)).toHaveLength(1);
+ expect(updates(r)[0].id).toBe("img1");
+ expect(updates(r)[0].block).toContain("new.png");
+ });
+
+ it("handles target inside an attribute value", () => {
+ const doc = `Content here `;
+ const ranges = new Map();
+ ranges.set("p1", { start: 0, end: 65 });
+
+ const r = convertFileReplaceToolCall({
+ document: doc,
+ blockRanges: ranges,
+ target: "left",
+ replacement: "center",
+ isPossiblyPartial: false,
+ });
+ expect(updates(r)[0].block).toContain('textAlignment="center"');
+ });
+
+ it("does not confuse inline markup with blocks", () => {
+ const r = run(
+ `Hello World `,
+ `Hello World `,
+ );
+ expect(updates(r)).toHaveLength(1);
+ expect(adds(r)).toHaveLength(0);
+ });
+
+ // Rich document (mixed block types)
+ it("updates a heading in rich document", () => {
+ const r = convertFileReplaceToolCall({
+ document: richDoc,
+ blockRanges: richRanges(),
+ target: `Welcome `,
+ replacement: `Welcome Back `,
+ isPossiblyPartial: false,
+ });
+ expect(updates(r)).toHaveLength(1);
+ expect(updates(r)[0].id).toBe("h1");
+ });
+
+ it("updates a paragraph with inline Bold in rich document", () => {
+ const r = convertFileReplaceToolCall({
+ document: richDoc,
+ blockRanges: richRanges(),
+ target: `Hello World `,
+ replacement: `Hello Universe `,
+ isPossiblyPartial: false,
+ });
+ expect(updates(r)).toHaveLength(1);
+ expect(updates(r)[0].id).toBe("p1");
+ expect(deletes(r)).toHaveLength(0);
+ });
+
+ it("handles target spanning closing tag in rich document", () => {
+ const r = convertFileReplaceToolCall({
+ document: richDoc,
+ blockRanges: richRanges(),
+ target: `World `,
+ replacement: `Universe `,
+ isPossiblyPartial: false,
+ });
+ expect(updates(r)).toHaveLength(1);
+ expect(updates(r)[0].id).toBe("p1");
+ });
+
+ it("handles partial opening tag target in rich document", () => {
+ const r = convertFileReplaceToolCall({
+ document: richDoc,
+ blockRanges: richRanges(),
+ target: `id="p1">Hello`,
+ replacement: `id="p1">Goodbye`,
+ isPossiblyPartial: false,
+ });
+ expect(updates(r)).toHaveLength(1);
+ });
+
+ describe("reordering", () => {
+ it("handles simple two-block swap via delete+add", () => {
+ const r = run(
+ `Hello World \nSecond paragraph `,
+ `Second paragraph \nHello World `,
+ );
+ // Two-pointer: sees p2 first → skips p1 (delete), updates p2.
+ // Then sees p1 → already consumed → re-add after p2.
+ expect(deletes(r)).toHaveLength(1);
+ expect(deletes(r)[0].id).toBe("p1");
+ expect(adds(r)).toHaveLength(1);
+ expect(adds(r)[0].position).toBe("after");
+ expect(adds(r)[0].referenceId).toBe("p2");
+ expect(adds(r)[0].blocks[0]).toContain("Hello World");
+ });
+
+ it("handles three-block reorder with content change", () => {
+ const r = run(
+ `Hello World \nSecond paragraph \nThird paragraph `,
+ `Third paragraph \nSecond paragraph \nModified Hello `,
+ );
+ // p1 is skipped (deleted). p2 matches? NO, p3 matches first!
+ // p3 matches (idx 2). Skip p1(0), p2(1).
+ // Then p2 (already consumed) -> re-add.
+ // Then p1 (already consumed) -> re-add.
+ expect(deletes(r)).toHaveLength(2);
+ expect(deletes(r).map((d) => d.id)).toContain("p1");
+ expect(deletes(r).map((d) => d.id)).toContain("p2");
+
+ expect(updates(r)).toHaveLength(0); // p3 content unchanged
+
+ expect(adds(r)).toHaveLength(1);
+ expect(adds(r)[0].blocks).toHaveLength(2);
+ expect(adds(r)[0].blocks[0]).toContain("Second paragraph");
+ expect(adds(r)[0].blocks[1]).toContain("Modified Hello");
+ });
+
+ it("handles reorder during streaming: skipped deletes + re-adds", () => {
+ const r = run(
+ `Hello World \nSecond paragraph `,
+ `Second paragraph \nHello World `,
+ true, // streaming
+ );
+ // Two-pointer: p2 matched first → p1 skipped (deleted even during streaming,
+ // because it was definitively passed over). p1 is already-consumed → re-add.
+ expect(deletes(r)).toHaveLength(1);
+ expect(deletes(r)[0].id).toBe("p1");
+ expect(adds(r)).toHaveLength(1);
+ expect(adds(r)[0].blocks[0]).toContain("Hello World");
+ });
+ });
+
+ describe("adds", () => {
+ it("detects ADD + UPDATE when block modified and new block added", () => {
+ const r = run(
+ `Hello World `,
+ `Hello Modified New Block `,
+ );
+ expect(updates(r)).toHaveLength(1);
+ expect(updates(r)[0].block).toContain("Hello Modified");
+ expect(adds(r)).toHaveLength(1);
+ expect(adds(r)[0].blocks[0]).toContain("New Block");
+ expect(deletes(r)).toHaveLength(0);
+ });
+
+ it("detects ADD when replacement has more blocks (content unchanged)", () => {
+ const r = run(
+ `Hello World `,
+ `New Before \nHello World `,
+ );
+ expect(updates(r)).toHaveLength(0);
+ expect(adds(r)).toHaveLength(1);
+ expect(adds(r)[0].blocks[0]).toContain("New Before");
+ expect(adds(r)[0].position).toBe("before");
+ });
+
+ it("treats elements with unknown IDs as ADDs", () => {
+ const r = run(
+ `World `,
+ `World New Block `,
+ );
+ expect(adds(r)).toHaveLength(1);
+ expect(adds(r)[0].blocks[0]).toContain("New Block");
+ expect(adds(r)[0].referenceId).toBe("p1");
+ });
+
+ it("emits batched ADDs in correct order", () => {
+ const r = run(
+ `Hello World `,
+ `New1 New2 Hello World New3 New4 `,
+ );
+ // New1, New2 added before p1. New3, New4 added after p1.
+ expect(adds(r)).toHaveLength(2);
+
+ // First batch: New1, New2 before p1
+ expect(adds(r)[0].position).toBe("before");
+ expect(adds(r)[0].blocks).toHaveLength(2);
+ expect(adds(r)[0].blocks[0]).toContain("New1");
+ expect(adds(r)[0].blocks[1]).toContain("New2");
+
+ // Second batch: New3, New4 after p1
+ expect(adds(r)[1].position).toBe("after");
+ expect(adds(r)[1].blocks).toHaveLength(2);
+ expect(adds(r)[1].blocks[0]).toContain("New3");
+ expect(adds(r)[1].blocks[1]).toContain("New4");
+ });
+
+ it("uses earliest affected block as referenceId regardless of Map order", () => {
+ const confusedRanges = new Map();
+ confusedRanges.set("p3", { start: 91, end: 137 });
+ confusedRanges.set("p2", { start: 43, end: 90 });
+
+ const r = convertFileReplaceToolCall({
+ document: simpleDoc,
+ blockRanges: confusedRanges,
+ target: `Second paragraph \nThird paragraph `,
+ replacement: `New Item `,
+ isPossiblyPartial: false,
+ });
+ expect(adds(r)[0].referenceId).toBe("p2");
+ });
+
+ it("handles Add + Keep scenario from attrDoc", () => {
+ const r = convertFileReplaceToolCall({
+ document: attrDoc,
+ blockRanges: attrRanges(),
+ target: `Hello `,
+ replacement: `New block \nHello `,
+ isPossiblyPartial: true,
+ });
+ expect(deletes(r)).toHaveLength(0);
+ expect(updates(r)).toHaveLength(0);
+ expect(adds(r)).toHaveLength(1);
+ });
+ });
+
+ describe("streaming & edge cases", () => {
+ it("does NOT emit deletes when isPossiblyPartial is true", () => {
+ const r = run(`Hello World `, ``, true);
+ expect(deletes(r)).toHaveLength(0);
+ });
+
+ it("emits deletes when isPossiblyPartial is false", () => {
+ const r = run(`Hello World `, ``);
+ expect(deletes(r)).toHaveLength(1);
+ });
+
+ it("does NOT emit deletes during streaming (attrDoc)", () => {
+ const r = convertFileReplaceToolCall({
+ document: attrDoc,
+ blockRanges: attrRanges(),
+ target: attrDoc,
+ replacement: `Hello `,
+ isPossiblyPartial: true,
+ });
+ expect(deletes(r)).toHaveLength(0);
+ });
+
+ it("emits deletes when complete (attrDoc)", () => {
+ const r = convertFileReplaceToolCall({
+ document: attrDoc,
+ blockRanges: attrRanges(),
+ target: attrDoc,
+ replacement: `Hello `,
+ isPossiblyPartial: false,
+ });
+ expect(updates(r)).toHaveLength(0);
+ expect(deletes(r)).toHaveLength(1);
+ expect(deletes(r)[0].id).toBe("p2");
+ });
+
+ it("handles incomplete tag during streaming", () => {
+ const r = run(
+ `Hello World `,
+ `Partial content<`,
+ true,
+ );
+ expect(r).toBeDefined();
+ });
+
+ it("returns empty when replacement is too incomplete", () => {
+ const r = run(
+ `Hello World `,
+ ` {
+ const target = `Hello World `;
+
+ // Call 1: Prefix of original — suppressed (streaming artifact)
+ const r1 = run(target, `Hel`, true);
+ expect(updates(r1)).toHaveLength(0);
+
+ // Call 2: Diverges from original ("Beautiful" ≠ "World") → update emitted
+ const r2 = run(target, `Hello Beautiful`, true);
+ expect(updates(r2)).toHaveLength(1);
+ expect(updates(r2)[0].block).toContain("Hello Beautiful");
+ expect(deletes(r2)).toHaveLength(0);
+
+ // Call 3: Complete
+ const full = `Hello Beautiful World `;
+ const r3 = run(target, full);
+ expect(updates(r3)).toHaveLength(1);
+ expect(updates(r3)[0].block).toBe(full);
+ });
+
+ it("returns empty for empty document", () => {
+ const r = convertFileReplaceToolCall({
+ document: "",
+ blockRanges: new Map(),
+ target: "anything",
+ replacement: "anything",
+ isPossiblyPartial: false,
+ });
+ expect(r).toHaveLength(0);
+ });
+
+ it("handles unknown ID element as ADD (not ignored)", () => {
+ const r = run(
+ `Hello World `,
+ `Mystery block `,
+ );
+ expect(deletes(r)).toHaveLength(1);
+ expect(deletes(r)[0].id).toBe("p1");
+ });
+
+ it("handles cross-block target in rich document", () => {
+ const r = convertFileReplaceToolCall({
+ document: richDoc,
+ blockRanges: richRanges(),
+ target: ` \nThis`,
+ replacement: ` \nThat`,
+ isPossiblyPartial: false,
+ });
+ // p2 is in allAffected but effectively deleted (skipped by no-elements logic which collapses into p1)
+ // TODO: this should just be an update to p2? and p1 unaffected?
+ expect(updates(r)).toHaveLength(1);
+ expect(updates(r)[0].id).toBe("p1");
+ expect(deletes(r)).toHaveLength(1);
+ expect(deletes(r)[0].id).toBe("p2");
+ });
+
+ it("handles streaming with incomplete tag in rich document", () => {
+ const r = convertFileReplaceToolCall({
+ document: richDoc,
+ blockRanges: richRanges(),
+ target: `Hello World `,
+ replacement: `Hello Unive`,
+ isPossiblyPartial: true,
+ });
+ expect(updates(r)).toHaveLength(1);
+ expect(updates(r)[0].id).toBe("p1");
+ expect(deletes(r)).toHaveLength(0);
+ });
+
+ it("returns empty for too-incomplete replacement in rich document", () => {
+ const r = convertFileReplaceToolCall({
+ document: richDoc,
+ blockRanges: richRanges(),
+ target: `Hello `,
+ replacement: ` {
+ /**
+ * Validates streaming consistency:
+ * 1. Every op in partial result has a matching op (same type + id) in final
+ * 2. Matching ops appear in the same relative order as in the final result
+ */
+ function assertStreamingConsistency(
+ target: string,
+ fullReplacement: string,
+ doc: string,
+ ranges: Map,
+ ) {
+ const finalResult = convertFileReplaceToolCall({
+ document: doc,
+ blockRanges: ranges,
+ target,
+ replacement: fullReplacement,
+ isPossiblyPartial: false,
+ });
+
+ /** Find the index of an op in finalResult by type + id */
+ function finalIndex(op: TsxToolCall): number {
+ return finalResult.findIndex((f) => {
+ if (f.type !== op.type) return false;
+ if (f.type === "update" && op.type === "update")
+ return f.id === op.id;
+ if (f.type === "delete" && op.type === "delete")
+ return f.id === op.id;
+ if (f.type === "add" && op.type === "add") {
+ return (
+ f.referenceId === op.referenceId && f.position === op.position
+ );
+ }
+ return false;
+ });
+ }
+
+ for (let i = 1; i <= fullReplacement.length; i++) {
+ const partial = fullReplacement.slice(0, i);
+ const partialResult = convertFileReplaceToolCall({
+ document: doc,
+ blockRanges: ranges,
+ target,
+ replacement: partial,
+ isPossiblyPartial: true,
+ });
+
+ // (1) Every partial op must have a match in final result
+ for (const partialOp of partialResult) {
+ const idx = finalIndex(partialOp);
+ expect(
+ idx,
+ `Prefix length ${i}: ${partialOp.type} op should have a match in final result (${JSON.stringify(partialOp)})`,
+ ).toBeGreaterThanOrEqual(0);
+ }
+
+ // (2) Ops must appear in the same relative order as in final
+ const indices = partialResult.map((op) => finalIndex(op));
+ for (let j = 1; j < indices.length; j++) {
+ expect(
+ indices[j],
+ `Prefix length ${i}: ops should be in same order as final (index ${indices[j]} should be > ${indices[j - 1]})`,
+ ).toBeGreaterThan(indices[j - 1]);
+ }
+ }
+ }
+
+ it("prefix-subset: simple update", () => {
+ assertStreamingConsistency(
+ `Hello World `,
+ `Hello Beautiful World `,
+ simpleDoc,
+ simpleRanges(),
+ );
+ });
+
+ it("prefix-subset: update + add + delete", () => {
+ assertStreamingConsistency(
+ `Hello World \nSecond paragraph `,
+ `Modified \nNew Block `,
+ simpleDoc,
+ simpleRanges(),
+ );
+ });
+
+ it("prefix-subset: rich document update", () => {
+ assertStreamingConsistency(
+ `Hello World `,
+ `Hello Beautiful Universe `,
+ richDoc,
+ richRanges(),
+ );
+ });
+
+ it("prefix-subset: reorder with skipped-block deletes", () => {
+ assertStreamingConsistency(
+ `Hello World \nSecond paragraph `,
+ `Second paragraph \nHello World `,
+ simpleDoc,
+ simpleRanges(),
+ );
+ });
+ });
+ });
+});
diff --git a/packages/xl-ai/src/api/formats/tsx-document/tools/convertFileReplaceToolCall.ts b/packages/xl-ai/src/api/formats/tsx-document/tools/convertFileReplaceToolCall.ts
new file mode 100644
index 0000000000..88e31f7a87
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/tsx-document/tools/convertFileReplaceToolCall.ts
@@ -0,0 +1,357 @@
+/**
+ * Converts an LLM's file_replace tool call into BlockNote operations:
+ * - UPDATE: replacement element has ID matching existing block
+ * - ADD: replacement element has no ID (or unknown ID)
+ * - DELETE: block in target, but ID not in replacement
+ *
+ * Uses a two-pointer walk: iterates replacement elements in order while
+ * maintaining a cursor into the original affected blocks. This naturally
+ * handles streaming, reordering, and deletions.
+ *
+ * Streaming consistency: calling with replacement.slice(0, N) returns
+ * a prefix-subset of calling with the full replacement. Deletes are
+ * only emitted when isPossiblyPartial = false.
+ */
+
+import type { AddBlocksToolCall } from "../../base-tools/createAddBlocksTool.js";
+import type { UpdateBlockToolCall } from "../../base-tools/createUpdateBlockTool.js";
+import type { DeleteBlockToolCall } from "../../base-tools/delete.js";
+
+export type TsxToolCall =
+ | AddBlocksToolCall
+ | UpdateBlockToolCall
+ | DeleteBlockToolCall;
+
+/**
+ * Character range of a block in the document string.
+ * `start` is inclusive, `end` is exclusive (matches `String.substring` semantics).
+ */
+export type BlockRange = {
+ start: number;
+ end: number;
+};
+
+export type ConvertOptions = {
+ document: string;
+ blockRanges: Map;
+ target: string;
+ replacement: string;
+ isPossiblyPartial: boolean;
+};
+
+type ParsedElement = { content: string; id: string | null };
+
+/** Parse TSX string into top-level elements with their IDs. */
+function parseElements(tsx: string): ParsedElement[] {
+ const elements: ParsedElement[] = [];
+ const pattern = /<([A-Z][a-zA-Z0-9]*)\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/\1>)/g;
+ let match;
+ while ((match = pattern.exec(tsx)) !== null) {
+ const idMatch = match[2].match(/id=(["'])(.*?)\1/);
+ elements.push({ content: match[0], id: idMatch ? idMatch[2] : null });
+ }
+ return elements;
+}
+
+/**
+ * Extract complete elements from potentially incomplete TSX (streaming).
+ * Strips incomplete trailing tags and closes any unclosed tags.
+ */
+function getPartialTsx(tsx: string): string {
+ const lastOpen = tsx.lastIndexOf("<");
+ const lastClose = tsx.lastIndexOf(">");
+ let processed = lastOpen > lastClose ? tsx.substring(0, lastOpen) : tsx;
+
+ const openTags: string[] = [];
+ const tagPattern = /<\/?([A-Z][a-zA-Z0-9]*)/g;
+ let m;
+ while ((m = tagPattern.exec(processed)) !== null) {
+ if (m[0].startsWith("")) {
+ if (openTags.length > 0 && openTags[openTags.length - 1] === m[1]) {
+ openTags.pop();
+ }
+ } else {
+ const tagEnd = processed.indexOf(">", m.index);
+ if (tagEnd !== -1 && processed[tagEnd - 1] !== "/") {
+ openTags.push(m[1]);
+ }
+ }
+ }
+ for (let i = openTags.length - 1; i >= 0; i--) {
+ processed += `${openTags[i]}>`;
+ }
+ return processed.trim();
+}
+
+/** Check if a block is fully contained within the target range. */
+function isFullyContained(
+ range: BlockRange,
+ targetStart: number,
+ targetEnd: number,
+): boolean {
+ return range.start >= targetStart && range.end <= targetEnd;
+}
+
+/**
+ * Check if `candidate` is a prefix of `full` (ignoring trailing closing tags).
+ * Used during streaming to detect that auto-closed content is just a truncated
+ * version of the original — not a real change.
+ */
+function isPrefixOf(candidate: string, full: string): boolean {
+ const strip = (s: string) => s.replace(/(<\/[A-Z][a-zA-Z0-9]*>\s*)+$/g, "");
+ const strippedCandidate = strip(candidate);
+ const strippedFull = strip(full);
+ return (
+ strippedCandidate !== strippedFull &&
+ strippedFull.startsWith(strippedCandidate)
+ );
+}
+
+/**
+ * For a partially-overlapping block, splice the replacement into the
+ * overlapping portion and return the updated block content.
+ */
+function spliceBlock(
+ document: string,
+ range: BlockRange,
+ targetStart: number,
+ targetEnd: number,
+ replacementText: string,
+): string {
+ const original = document.substring(range.start, range.end);
+ const relStart = Math.max(0, targetStart - range.start);
+ const relEnd = Math.min(original.length, targetEnd - range.start);
+ return (
+ original.substring(0, relStart) +
+ replacementText +
+ original.substring(relEnd)
+ );
+}
+
+/**
+ * For a partially-overlapping block that was "skipped" (not matched),
+ * trim the consumed portion without inserting replacement text.
+ */
+function trimBlock(
+ document: string,
+ range: BlockRange,
+ targetStart: number,
+ targetEnd: number,
+): string {
+ return spliceBlock(document, range, targetStart, targetEnd, "");
+}
+
+export function convertFileReplaceToolCall(
+ options: ConvertOptions,
+): TsxToolCall[] {
+ const { document, blockRanges, target, replacement, isPossiblyPartial } =
+ options;
+ const result: TsxToolCall[] = [];
+
+ // Step 1: Locate target in document
+ const targetStart = document.indexOf(target);
+ if (targetStart === -1) return result;
+ const targetEnd = targetStart + target.length;
+
+ // Step 2: Prepare replacement (handle streaming)
+ const processedReplacement = isPossiblyPartial
+ ? getPartialTsx(replacement)
+ : replacement;
+ if (!processedReplacement && replacement) return result;
+
+ // Step 3: Find affected blocks, sorted by document position
+ const allAffected: string[] = [];
+ for (const [id, range] of blockRanges) {
+ if (range.start < targetEnd && range.end > targetStart) {
+ allAffected.push(id);
+ }
+ }
+ allAffected.sort(
+ (a, b) => blockRanges.get(a)!.start - blockRanges.get(b)!.start,
+ );
+
+ if (allAffected.length === 0) return result;
+
+ // Step 4: Parse replacement elements
+ const elements = parseElements(processedReplacement);
+
+ // Build a set to quickly check if an ID is in the affected window
+ const affectedSet = new Set(allAffected);
+
+ // If no parseable elements: find-and-replace on the document level.
+ // The first block absorbs the replacement text + the tail of the last block.
+ // All other affected blocks are deleted.
+ if (elements.length === 0) {
+ const firstId = allAffected[0];
+ const firstRange = blockRanges.get(firstId)!;
+ const lastId = allAffected[allAffected.length - 1];
+ const lastRange = blockRanges.get(lastId)!;
+
+ // Build the new first block: content before target + replacement + content after target
+ const beforeTarget = document.substring(firstRange.start, targetStart);
+ const afterTarget = document.substring(targetEnd, lastRange.end);
+ const newFirstBlock = beforeTarget + processedReplacement + afterTarget;
+ const originalFirst = document.substring(firstRange.start, firstRange.end);
+
+ if (newFirstBlock !== originalFirst) {
+ if (!newFirstBlock.trim() && !isPossiblyPartial) {
+ // If content is empty/whitespace only after replacement, treat as DELETE
+ result.push({ type: "delete", id: firstId });
+ } else {
+ result.push({ type: "update", id: firstId, block: newFirstBlock });
+ }
+ }
+
+ // All other affected blocks → DELETE
+ for (let i = 1; i < allAffected.length; i++) {
+ if (!isPossiblyPartial) {
+ result.push({ type: "delete", id: allAffected[i] });
+ }
+ }
+ return result;
+ }
+
+ // Step 5: Two-pointer walk
+ let cursor = 0; // index into allAffected
+ let lastRefId = allAffected[0];
+ let seenExisting = false; // have we seen any existing block in the walk?
+ const consumed = new Set(); // IDs we've already passed
+ let pendingAdds: string[] = []; // buffer for batching consecutive ADDs
+
+ /** Flush buffered ADDs as a single batched operation. */
+ function flushAdds() {
+ if (pendingAdds.length === 0) return;
+ result.push({
+ type: "add",
+ referenceId: lastRefId,
+ position: seenExisting ? "after" : "before",
+ blocks: [...pendingAdds],
+ });
+ pendingAdds = [];
+ }
+
+ for (const element of elements) {
+ if (
+ element.id &&
+ affectedSet.has(element.id) &&
+ !consumed.has(element.id)
+ ) {
+ // CASE A: element matches an original block ahead of cursor
+ flushAdds(); // flush pending adds before processing this block
+
+ const matchIdx = allAffected.indexOf(element.id, cursor);
+
+ if (matchIdx === -1) {
+ // Shouldn't happen if !consumed and in affectedSet, but guard
+ continue;
+ }
+
+ // Skip (delete/trim) blocks between cursor and matchIdx
+ for (let i = cursor; i < matchIdx; i++) {
+ const skipId = allAffected[i];
+ const skipRange = blockRanges.get(skipId)!;
+ consumed.add(skipId);
+
+ if (isFullyContained(skipRange, targetStart, targetEnd)) {
+ // Safe to delete even during streaming: this block was definitively
+ // skipped because a later block appeared first in the replacement.
+ result.push({ type: "delete", id: skipId });
+ } else {
+ // Edge block: trim consumed portion
+ const trimmed = trimBlock(
+ document,
+ skipRange,
+ targetStart,
+ targetEnd,
+ );
+ const original = document.substring(skipRange.start, skipRange.end);
+ if (trimmed !== original) {
+ result.push({ type: "update", id: skipId, block: trimmed });
+ }
+ }
+ }
+
+ // Process the matched block
+ const matchRange = blockRanges.get(element.id)!;
+ consumed.add(element.id);
+
+ if (isFullyContained(matchRange, targetStart, targetEnd)) {
+ // Fully contained: UPDATE if content changed
+ const original = document.substring(matchRange.start, matchRange.end);
+ if (element.content !== original) {
+ // During streaming, suppress if content is just a truncated original
+ if (isPossiblyPartial && isPrefixOf(element.content, original)) {
+ // streaming artifact — don't update yet
+ } else {
+ result.push({
+ type: "update",
+ id: element.id,
+ block: element.content,
+ });
+ }
+ }
+ } else {
+ // Edge block: merge — replace the overlapping portion with element content
+ const merged = spliceBlock(
+ document,
+ matchRange,
+ targetStart,
+ targetEnd,
+ element.content,
+ );
+ const original = document.substring(matchRange.start, matchRange.end);
+ if (merged !== original) {
+ // During streaming, suppress if merged content is just a truncated original
+ if (isPossiblyPartial && isPrefixOf(merged, original)) {
+ // streaming artifact — don't update yet
+ } else {
+ result.push({ type: "update", id: element.id, block: merged });
+ }
+ }
+ }
+
+ cursor = matchIdx + 1;
+ lastRefId = element.id;
+ seenExisting = true;
+ } else if (element.id && consumed.has(element.id)) {
+ // CASE B: already-passed block (reorder) → buffer for add
+ pendingAdds.push(element.content);
+ } else if (
+ element.id &&
+ blockRanges.has(element.id) &&
+ !affectedSet.has(element.id)
+ ) {
+ // CASE C: references a block outside the target range
+ // Skip — adding it would duplicate an existing block
+ continue;
+ } else {
+ // CASE D: new block (no ID or unknown ID) → buffer for add
+ pendingAdds.push(element.content);
+ }
+ }
+
+ // Flush any remaining buffered ADDs
+ flushAdds();
+
+ // Remaining blocks after cursor → delete/trim
+ for (let i = cursor; i < allAffected.length; i++) {
+ const id = allAffected[i];
+ if (consumed.has(id)) continue;
+ const range = blockRanges.get(id)!;
+
+ if (isFullyContained(range, targetStart, targetEnd)) {
+ if (!isPossiblyPartial) {
+ result.push({ type: "delete", id });
+ }
+ } else {
+ // Edge block: trim consumed portion
+ const trimmed = trimBlock(document, range, targetStart, targetEnd);
+ const original = document.substring(range.start, range.end);
+ if (trimmed !== original) {
+ result.push({ type: "update", id, block: trimmed });
+ }
+ }
+ }
+
+ return result;
+}
diff --git a/packages/xl-ai/src/api/formats/tsx-document/tools/index.ts b/packages/xl-ai/src/api/formats/tsx-document/tools/index.ts
new file mode 100644
index 0000000000..2f2f0bef3a
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/tsx-document/tools/index.ts
@@ -0,0 +1,53 @@
+import { streamTool } from "../../../../streamTool/streamTool.js";
+
+type FileReplaceToolCall = {
+ type: "file_replace";
+ target: string;
+ replacement: string;
+};
+
+// Placeholder for now
+export const tools = {
+ // We use streamTool directly as requested
+ replace: streamTool({
+ name: "file_replace",
+ description: "Replace a part of the document file",
+ inputSchema: {
+ type: "object",
+ properties: {
+ target: {
+ type: "string",
+ description: "The string to replace",
+ },
+ replacement: {
+ type: "string",
+ description: "The replacement string",
+ },
+ },
+ required: ["target", "replacement"],
+ },
+ validate: (operation: any) => {
+ if (!operation.target || !operation.replacement) {
+ return { ok: false, error: "Missing target or replacement" };
+ }
+ return { ok: true, value: operation as FileReplaceToolCall };
+ },
+ executor: () => {
+ return {
+ execute: async (chunk) => {
+ if (chunk.operation.type !== "file_replace") {
+ return false;
+ }
+
+ const operation = chunk.operation as FileReplaceToolCall;
+
+ // Placeholder: logic to map to block updates will be added later
+ return true;
+ },
+ };
+ },
+ }),
+};
+
+// TODO: correct approach at all? prosemirror vs html / tsx docs
+//
diff --git a/packages/xl-ai/src/api/formats/tsx-document/tsxDocument.test.ts b/packages/xl-ai/src/api/formats/tsx-document/tsxDocument.test.ts
new file mode 100644
index 0000000000..8d7cb5be0d
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/tsx-document/tsxDocument.test.ts
@@ -0,0 +1,185 @@
+import { getCurrentTest } from "@vitest/runner";
+import { getSortedEntries, snapshot, toHashString } from "msw-snapshot";
+import { setupServer } from "msw/node";
+import path from "path";
+import { afterAll, afterEach, beforeAll, describe, it } from "vitest";
+import { testAIModels } from "../../../testUtil/testAIModels.js";
+
+import { BlockNoteEditor } from "@blocknote/core";
+import { StreamToolExecutor } from "../../../streamTool/StreamToolExecutor.js";
+import { ClientSideTransport } from "../../../streamTool/vercelAiSdk/clientside/ClientSideTransport.js";
+import { generateSharedTestCases } from "../tests/sharedTestCases.js";
+import { tsxDocumentLLMFormat } from "./tsxDocument.js";
+
+const BASE_FILE_PATH = path.resolve(
+ __dirname,
+ "__snapshots__",
+ path.basename(__filename),
+);
+
+const fetchCountMap: Record = {};
+
+async function createRequestHash(req: Request) {
+ const url = new URL(req.url);
+ return [
+ // url.host,
+ // url.pathname,
+ toHashString([
+ req.method,
+ url.origin,
+ url.pathname,
+ getSortedEntries(url.searchParams),
+ getSortedEntries(req.headers),
+ // getSortedEntries(req.cookies),
+ new TextDecoder("utf-8").decode(await req.arrayBuffer()),
+ ]),
+ ].join("/");
+}
+
+// Main test suite with snapshot middleware
+describe("Models", () => {
+ // Define server with snapshot middleware for the main tests
+ const server = setupServer(
+ snapshot({
+ updateSnapshots: "missing",
+ // onSnapshotUpdated: "all",
+ // ignoreSnapshots: true,
+ async createSnapshotPath(info) {
+ // use a unique path for each model
+ const t = getCurrentTest()!;
+ const mswPath = path.join(
+ t.suite!.name, // same directory as the test snapshot
+ "__msw_snapshots__",
+ t.suite!.suite!.name, // model / streaming params
+ t.name,
+ );
+ // in case there are multiple requests in a test, we need to use a separate snapshot for each request
+ fetchCountMap[mswPath] = (fetchCountMap[mswPath] || 0) + 1;
+ const hash = await createRequestHash(info.request);
+ return mswPath + `_${fetchCountMap[mswPath]}_${hash}.json`;
+ },
+ basePath: BASE_FILE_PATH,
+ // onFetchFromSnapshot(info, snapshot) {
+ // console.log("onFetchFromSnapshot", info, snapshot);
+ // },
+ // onFetchFromServer(info, snapshot) {
+ // console.log("onFetchFromServer", info, snapshot);
+ // },
+ }),
+ );
+
+ beforeAll(() => {
+ server.listen();
+ });
+
+ afterAll(() => {
+ server.close();
+ });
+
+ afterEach(() => {
+ delete (window as Window & { __TEST_OPTIONS?: any }).__TEST_OPTIONS;
+ });
+
+ const testMatrix = [
+ {
+ model: testAIModels.openai,
+ stream: true,
+ },
+ // {
+ // model: testAIModels.openai,
+ // stream: false,
+ // },
+ // TODO: https://github.com/vercel/ai/issues/8533
+ {
+ model: testAIModels.groq,
+ stream: true,
+ },
+ // {
+ // model: testAIModels.groq,
+ // stream: false,
+ // },
+ // anthropic streaming needs further investigation for some test cases
+ // {
+ // model: testAIModels.anthropic,
+ // stream: true,
+ // },
+ {
+ model: testAIModels.anthropic,
+ stream: true,
+ },
+ // currently doesn't support streaming
+ // https://github.com/vercel/ai/issues/5350
+ // {
+ // model: testAIModels.albert,
+ // stream: true,
+ // },
+ // This works for most prompts, but not all (would probably need a llama upgrade?)
+ // {
+ // model: testAIModels.albert,
+ // stream: false,
+ // },
+ ];
+
+ for (const params of testMatrix) {
+ describe(`${params.model.provider}/${params.model.modelId} (${
+ params.stream ? "streaming" : "non-streaming"
+ })`, () => {
+ generateSharedTestCases({
+ streamToolsProvider: tsxDocumentLLMFormat.getStreamToolsProvider({
+ withDelays: false,
+ }),
+ documentStateBuilder: tsxDocumentLLMFormat.defaultDocumentStateBuilder,
+ transport: new ClientSideTransport({
+ systemPrompt: tsxDocumentLLMFormat.systemPrompt,
+ model: params.model,
+ stream: params.stream,
+ _additionalOptions: {
+ maxRetries: 0,
+ },
+ }),
+ });
+ });
+ }
+});
+
+describe("streamToolsProvider", () => {
+ it("should return the correct stream tools", () => {
+ // test skipped, this is only to validate type inference
+ return;
+
+ // eslint-disable-next-line no-unreachable
+ const editor = BlockNoteEditor.create();
+ const streamTools = htmlBlockLLMFormat
+ .getStreamToolsProvider({
+ defaultStreamTools: {
+ add: true,
+ },
+ })
+ .getStreamTools(editor, true);
+
+ const executor = new StreamToolExecutor(streamTools);
+
+ executor.executeOne({
+ type: "add",
+ blocks: ["test
"],
+ referenceId: "1",
+ position: "after",
+ });
+
+ executor.executeOne({
+ // @ts-expect-error
+ type: "update",
+ blocks: ["test
"],
+ referenceId: "1",
+ position: "after",
+ });
+
+ executor.executeOne({
+ type: "add",
+ // @ts-expect-error
+ blocks: [{ type: "paragraph", content: "test" }],
+ referenceId: "1",
+ position: "after",
+ });
+ });
+});
diff --git a/packages/xl-ai/src/api/formats/tsx-document/tsxDocument.ts b/packages/xl-ai/src/api/formats/tsx-document/tsxDocument.ts
new file mode 100644
index 0000000000..48c93d8bdb
--- /dev/null
+++ b/packages/xl-ai/src/api/formats/tsx-document/tsxDocument.ts
@@ -0,0 +1,48 @@
+import {
+ BlockNoteSchema,
+ defaultBlockSpecs,
+ defaultInlineContentSpecs,
+ defaultStyleSpecs,
+} from "@blocknote/core";
+import { TsxExporter } from "../../exporters/tsx/TsxExporter.js";
+import { makeDocumentStateBuilder } from "../DocumentStateBuilder.js";
+import { StreamToolsConfig, StreamToolsProvider } from "../formats.js";
+import { tools } from "./tools/index.js";
+
+const systemPrompt = `You are manipulating a text document using TSX components.
+Each block is represented as a TSX component with props.
+`;
+
+// Reuse the same schema creation logic or import if available centrally.
+// Ideally, the exporter should accept any schema, but for default builder we need one.
+// We'll create a default one similar to tests.
+const defaultSchema = BlockNoteSchema.create({
+ blockSpecs: defaultBlockSpecs,
+ inlineContentSpecs: defaultInlineContentSpecs,
+ styleSpecs: defaultStyleSpecs,
+});
+
+const exporter = new TsxExporter(defaultSchema);
+
+export const tsxDocumentLLMFormat = {
+ getStreamToolsProvider: (
+ _opts: { withDelays?: boolean; defaultStreamTools?: T } = {},
+ ): StreamToolsProvider => ({
+ getStreamTools: (_editor, _selectionInfo, _onBlockUpdate) => {
+ // Return the placeholder replacement tool
+ return [tools.replace];
+ },
+ }),
+ systemPrompt,
+ tools,
+ defaultDocumentStateBuilder: makeDocumentStateBuilder(
+ async (_editor, block) => {
+ // We wrap the single block in an array because toTsx expects an array
+ // But verify what block structure is passed.
+ // makeDocumentStateBuilder passes a Block object.
+ // toTsx expects BlockFromConfig.
+ // We can cast or minimal wrapper.
+ return exporter.toTsx([block] as any);
+ },
+ ),
+};
diff --git a/packages/xl-ai/src/index.ts b/packages/xl-ai/src/index.ts
index 2f7dd58c09..b3dd41727d 100644
--- a/packages/xl-ai/src/index.ts
+++ b/packages/xl-ai/src/index.ts
@@ -1,6 +1,7 @@
import "./style.css";
export * from "./AIExtension.js";
+export * from "./api/exporters/tsx/index.js";
export * from "./components/AIMenu/AIMenu.js";
export * from "./components/AIMenu/AIMenuController.js";
export * from "./components/AIMenu/getDefaultAIMenuItems.js";
diff --git a/packages/xl-ai/src/prosemirror/changeset.ts b/packages/xl-ai/src/prosemirror/changeset.ts
index 26e3099a89..c91d6c1836 100644
--- a/packages/xl-ai/src/prosemirror/changeset.ts
+++ b/packages/xl-ai/src/prosemirror/changeset.ts
@@ -207,7 +207,15 @@ export function updateToReplaceSteps(
updateToPos,
);
- let updatedDoc = updatedTr.doc;
+ return trToReplaceSteps(updatedTr, doc, dontReplaceContentAtEnd);
+}
+
+export function trToReplaceSteps(
+ tr: Transform,
+ doc: Node,
+ dontReplaceContentAtEnd = false,
+) {
+ let updatedDoc = tr.doc;
let changeset = ChangeSet.create(
doc,
@@ -215,7 +223,7 @@ export function updateToReplaceSteps(
createEncoder(doc, updatedDoc),
);
- changeset = changeset.addSteps(updatedDoc, updatedTr.mapping.maps, 0);
+ changeset = changeset.addSteps(updatedDoc, tr.mapping.maps, 0);
// When we're streaming (we sent `dontReplaceContentAtEnd = true`),
// we need to add back the content that was removed at the end of the block.
@@ -238,16 +246,16 @@ export function updateToReplaceSteps(
lastChange.fromA + lengthB,
lastChange.toA,
);
- updatedTr.step(
+ tr.step(
new ReplaceStep(lastChange.toB, lastChange.toB, endOfBlockToReAdd),
);
- updatedDoc = updatedTr.doc;
+ updatedDoc = tr.doc;
changeset = ChangeSet.create(
changeset.startDoc,
undefined,
createEncoder(changeset.startDoc, updatedDoc),
);
- changeset = changeset.addSteps(updatedDoc, updatedTr.mapping.maps, 0);
+ changeset = changeset.addSteps(updatedDoc, tr.mapping.maps, 0);
}
}
@@ -295,7 +303,7 @@ export function updateToReplaceSteps(
}
}
- addMissingChanges(changes, doc, updatedDoc);
+ // addMissingChanges(changes, doc, updatedDoc);
for (let i = 0; i < changes.length; i++) {
const step = changes[i];
diff --git a/packages/xl-ai/src/streamTool/StreamToolExecutor.ts b/packages/xl-ai/src/streamTool/StreamToolExecutor.ts
index cb6f0b927e..fb11263d47 100644
--- a/packages/xl-ai/src/streamTool/StreamToolExecutor.ts
+++ b/packages/xl-ai/src/streamTool/StreamToolExecutor.ts
@@ -39,15 +39,17 @@ type Operation[] | StreamTool> = {
* @example see the `manual-execution` example
*/
export class StreamToolExecutor[]> {
- private readonly stream: TransformStream<
- string | Operation,
- {
- status: "ok";
- chunk: Operation;
- }
- > & {
- finishPromise: Promise;
- };
+ private stream:
+ | undefined
+ | (TransformStream<
+ string | Operation,
+ {
+ status: "ok";
+ chunk: Operation;
+ }
+ > & {
+ finishPromise: Promise;
+ });
/**
* @param streamTools - The StreamTools to use to apply the StreamToolCalls
@@ -57,10 +59,14 @@ export class StreamToolExecutor[]> {
private streamTools: T,
private abortSignal?: AbortSignal,
) {
- this.stream = this.createStream();
+ // this.stream = this.createStream();
}
- private createStream() {
+ async init() {
+ this.stream = await this.createStream();
+ }
+
+ private async createStream() {
let lastParsedResult: Operation | undefined;
const stream = new TransformStream, Operation>({
transform: async (chunk, controller) => {
@@ -93,7 +99,9 @@ export class StreamToolExecutor[]> {
// - Works regardless of the number of internal transforms.
// - The readable can still be exposed if the consumer wants it, but they don’t have to consume it for close() to guarantee processing is done.
- const secondTransform = stream.readable.pipeThrough(this.createExecutor());
+ const secondTransform = stream.readable.pipeThrough(
+ await this.createExecutor(),
+ );
const [internalReadable, externalReadable] = secondTransform.tee();
@@ -108,8 +116,10 @@ export class StreamToolExecutor[]> {
};
}
- private createExecutor() {
- const executors = this.streamTools.map((tool) => tool.executor());
+ private async createExecutor() {
+ const executors = await Promise.all(
+ this.streamTools.map((tool) => tool.executor()),
+ );
return new TransformStream<
Operation,
@@ -161,6 +171,9 @@ export class StreamToolExecutor[]> {
* Make sure to call `close` on the StreamToolExecutor instead of on the writable returned here!
*/
public get writable() {
+ if (!this.stream) {
+ throw new Error("StreamToolExecutor not initialized");
+ }
return this.stream.writable;
}
@@ -168,10 +181,16 @@ export class StreamToolExecutor[]> {
* Returns a ReadableStream that can be used to read the results of the executor.
*/
public get readable() {
+ if (!this.stream) {
+ throw new Error("StreamToolExecutor not initialized");
+ }
return this.stream.readable;
}
public async finish() {
+ if (!this.stream) {
+ throw new Error("StreamToolExecutor not initialized");
+ }
await this.stream.finishPromise;
}
diff --git a/packages/xl-ai/src/streamTool/jsonSchema.ts b/packages/xl-ai/src/streamTool/jsonSchema.ts
index 0637a8c976..17ba8d0abd 100644
--- a/packages/xl-ai/src/streamTool/jsonSchema.ts
+++ b/packages/xl-ai/src/streamTool/jsonSchema.ts
@@ -81,10 +81,19 @@ export function createStreamToolsArraySchema(
}
export function streamToolsToToolSet(streamTools: StreamTool[]): ToolSet {
- return {
- applyDocumentOperations: {
- inputSchema: jsonSchema(createStreamToolsArraySchema(streamTools)),
- outputSchema: jsonSchema({ type: "object" }),
- },
- };
+ return Object.fromEntries(
+ streamTools.map((tool) => [
+ tool.name,
+ {
+ inputSchema: jsonSchema(tool.inputSchema),
+ outputSchema: jsonSchema({ type: "object" }),
+ },
+ ]),
+ );
+ // return {
+ // applyDocumentOperations: {
+ // inputSchema: jsonSchema(createStreamToolsArraySchema(streamTools)),
+ // outputSchema: jsonSchema({ type: "object" }),
+ // },
+ // };
}
diff --git a/packages/xl-ai/src/streamTool/filterNewOrUpdatedOperations.test.ts b/packages/xl-ai/src/streamTool/operations/filterNewOrUpdatedOperations.test.ts
similarity index 100%
rename from packages/xl-ai/src/streamTool/filterNewOrUpdatedOperations.test.ts
rename to packages/xl-ai/src/streamTool/operations/filterNewOrUpdatedOperations.test.ts
diff --git a/packages/xl-ai/src/streamTool/filterNewOrUpdatedOperations.ts b/packages/xl-ai/src/streamTool/operations/filterNewOrUpdatedOperations.ts
similarity index 69%
rename from packages/xl-ai/src/streamTool/filterNewOrUpdatedOperations.ts
rename to packages/xl-ai/src/streamTool/operations/filterNewOrUpdatedOperations.ts
index ee4ee6cc60..f5f296678c 100644
--- a/packages/xl-ai/src/streamTool/filterNewOrUpdatedOperations.ts
+++ b/packages/xl-ai/src/streamTool/operations/filterNewOrUpdatedOperations.ts
@@ -67,3 +67,42 @@ export async function* filterNewOrUpdatedOperations(
metadata,
};
}
+
+// TODO: rename?
+export async function* filterNewOrUpdatedCalls(
+ partialObjectStream: AsyncIterable,
+ metadata: any,
+): AsyncGenerator<{
+ partialOperation: any;
+ isUpdateToPreviousOperation: boolean;
+ isPossiblyPartial: boolean;
+ metadata: any;
+}> {
+ let first = true;
+
+ let lastOp: any;
+
+ for await (const chunk of partialObjectStream) {
+ lastOp = chunk;
+ yield {
+ partialOperation: chunk,
+ isUpdateToPreviousOperation: !first,
+ isPossiblyPartial: !first,
+ metadata,
+ };
+ first = false;
+ }
+
+ if (!lastOp) {
+ // TODO: this should be handled somewhere else
+ throw new Error("No operations seen");
+ }
+
+ // mark final operation as final (by emitting with isPossiblyPartial: false)
+ yield {
+ partialOperation: lastOp,
+ isUpdateToPreviousOperation: true,
+ isPossiblyPartial: false,
+ metadata,
+ };
+}
diff --git a/packages/xl-ai/src/streamTool/streamTool.ts b/packages/xl-ai/src/streamTool/streamTool.ts
index 0f3ccdfe10..79fd8817ef 100644
--- a/packages/xl-ai/src/streamTool/streamTool.ts
+++ b/packages/xl-ai/src/streamTool/streamTool.ts
@@ -45,7 +45,7 @@ export type StreamTool = {
*
* @returns the stream of operations that have not been processed (and should be passed on to execute handlers of other StreamTools)
*/
- executor: () => {
+ executor: () => Promise<{
execute: (
chunk: {
operation: StreamToolCall[]>;
@@ -55,7 +55,7 @@ export type StreamTool = {
},
abortSignal?: AbortSignal,
) => Promise;
- };
+ }>;
};
export type StreamToolCallSingle> =
diff --git a/packages/xl-ai/src/streamTool/vercelAiSdk/clientside/ClientSideTransport.ts b/packages/xl-ai/src/streamTool/vercelAiSdk/clientside/ClientSideTransport.ts
index 0a16b55e60..4d2bb3e33a 100644
--- a/packages/xl-ai/src/streamTool/vercelAiSdk/clientside/ClientSideTransport.ts
+++ b/packages/xl-ai/src/streamTool/vercelAiSdk/clientside/ClientSideTransport.ts
@@ -89,12 +89,31 @@ export class ClientSideTransport
injectDocumentStateMessages(messages),
),
tools,
+ // tools: {
+ // str_replace_based_edit_tool: anthropic.tools.textEditor_20250728({
+ // execute: async ({}) => {
+ // return {};
+ // },
+ // needsApproval: true,
+ // }),
+ // },
+
toolChoice: "required",
// extra options for streamObject
...((_additionalOptions ?? {}) as any),
// activeTools: ["applyDocumentOperations"],
+ onFinish: ({ usage }) => {
+ // your own logic, e.g. for saving the chat history or recording usage
+ console.log("usage:", JSON.stringify(usage, null, 2));
+ },
});
-
+ // console.log(
+ // JSON.stringify(
+ // await convertToModelMessages(injectDocumentStateMessages(messages)),
+ // null,
+ // 2,
+ // ),
+ // );
return ret.toUIMessageStream();
}
diff --git a/packages/xl-ai/src/streamTool/vercelAiSdk/util/UIMessageStreamToOperationsResult.ts b/packages/xl-ai/src/streamTool/vercelAiSdk/util/UIMessageStreamToOperationsResult.ts
index 5995265190..d4d6467bec 100644
--- a/packages/xl-ai/src/streamTool/vercelAiSdk/util/UIMessageStreamToOperationsResult.ts
+++ b/packages/xl-ai/src/streamTool/vercelAiSdk/util/UIMessageStreamToOperationsResult.ts
@@ -3,7 +3,10 @@ import {
createAsyncIterableStream,
createAsyncIterableStreamFromAsyncIterable,
} from "../../../util/stream.js";
-import { filterNewOrUpdatedOperations } from "../../filterNewOrUpdatedOperations.js";
+import {
+ filterNewOrUpdatedCalls,
+ filterNewOrUpdatedOperations,
+} from "../../operations/filterNewOrUpdatedOperations.js";
import { preprocessOperationsStreaming } from "../../preprocess.js";
import { StreamTool, StreamToolCall } from "../../streamTool.js";
@@ -33,7 +36,9 @@ type OperationsResult[]> = AsyncIterableStream<{
metadata: any;
}>;
-export function objectStreamToOperationsResult[]>(
+export function operationsObjectStreamToOperationsResult<
+ T extends StreamTool[],
+>(
stream: ReadableStream[] }>>,
streamTools: T,
chunkMetadata: any,
@@ -49,3 +54,17 @@ export function objectStreamToOperationsResult[]>(
),
);
}
+
+export function objectStreamToOperationsResult[]>(
+ stream: ReadableStream>,
+ streamTools: T,
+ chunkMetadata: any,
+): OperationsResult {
+ // Note: we can probably clean this up by switching to streams instead of async iterables
+ return createAsyncIterableStreamFromAsyncIterable(
+ preprocessOperationsStreaming(
+ filterNewOrUpdatedCalls(createAsyncIterableStream(stream), chunkMetadata),
+ streamTools,
+ ),
+ );
+}
diff --git a/packages/xl-ai/src/streamTool/vercelAiSdk/util/chatHandlers.ts b/packages/xl-ai/src/streamTool/vercelAiSdk/util/chatHandlers.ts
index 2014b2d8a8..4ad1e4928e 100644
--- a/packages/xl-ai/src/streamTool/vercelAiSdk/util/chatHandlers.ts
+++ b/packages/xl-ai/src/streamTool/vercelAiSdk/util/chatHandlers.ts
@@ -1,11 +1,20 @@
import { getErrorMessage } from "@ai-sdk/provider-utils";
import type { Chat } from "@ai-sdk/react";
-import { DeepPartial, isToolUIPart, UIMessage } from "ai";
+import {
+ DeepPartial,
+ isToolUIPart,
+ UIMessage,
+ UITool,
+ UIToolInvocation,
+} from "ai";
import { ChunkExecutionError } from "../../ChunkExecutionError.js";
import { Result, StreamTool, StreamToolCall } from "../../streamTool.js";
import { StreamToolExecutor } from "../../StreamToolExecutor.js";
import { createAppendableStream } from "./appendableStream.js";
-import { objectStreamToOperationsResult } from "./UIMessageStreamToOperationsResult.js";
+import {
+ objectStreamToOperationsResult,
+ operationsObjectStreamToOperationsResult,
+} from "./UIMessageStreamToOperationsResult.js";
/**
* Listens to messages received in the `chat` object and processes tool calls
@@ -39,6 +48,7 @@ export async function setupToolCallStreaming(
and this state is shared across parallel tool calls).
*/
const executor = new StreamToolExecutor(streamTools, abortSignal);
+ await executor.init();
const appendableStream = createAppendableStream();
@@ -54,22 +64,29 @@ export async function setupToolCallStreaming(
// streaming steps in case downstream consumer (like the StreamToolExecutor)
// are slower than the producer
const unsub = chat["~registerMessagesCallback"](() => {
- processToolCallParts(chat, (data) => {
- if (!toolCallStreams.has(data.toolCallId)) {
+ const calls = getToolCalls(chat);
+ for (const call of calls) {
+ if (!toolCallStreams.has(call.part.toolCallId)) {
const toolCallStreamData = createToolCallStream(
streamTools,
- data.toolName,
- data.toolCallId,
+ call.toolName,
+ call.part.toolCallId,
);
+ if (!toolCallStreamData) {
+ continue;
+ }
appendableStream.append(toolCallStreamData.operationsStream);
- toolCallStreams.set(data.toolCallId, toolCallStreamData);
+ toolCallStreams.set(call.part.toolCallId, toolCallStreamData);
if (first) {
first = false;
onStart?.();
}
}
- return toolCallStreams.get(data.toolCallId)!;
- });
+ const data = toolCallStreams.get(call.part.toolCallId);
+ if (data) {
+ processToolCallPart(call.part, data);
+ }
+ }
});
const statusHandler = new Promise((resolve) => {
@@ -202,13 +219,11 @@ type ToolCallStreamData = {
/**
* Process tool call parts and manage individual streams per toolCallId
*/
-function processToolCallParts(
- chat: Chat,
- getToolCallStreamData: (data: {
+function getToolCalls(chat: Chat) {
+ const toolCalls: {
toolName: string;
- toolCallId: string;
- }) => ToolCallStreamData,
-) {
+ part: UIToolInvocation;
+ }[] = [];
// TODO: better to check if tool has output instead of hardcoding lastMessage
for (const part of chat.lastMessage?.parts ?? []) {
if (!isToolUIPart(part)) {
@@ -217,21 +232,10 @@ function processToolCallParts(
const toolName = part.type.replace("tool-", "");
- if (toolName !== "applyDocumentOperations") {
- // we only process the combined operations tool call
- // in a future improvement we can add more generic support for different tool streaming
- continue;
- }
-
- const toolCallId = part.toolCallId;
-
- const toolCallData = getToolCallStreamData({
- toolName: part.type.replace("tool-", ""),
- toolCallId,
- });
-
- processToolCallPart(part, toolCallData);
+ toolCalls.push({ toolName, part });
}
+
+ return toolCalls;
}
/**
@@ -241,15 +245,26 @@ function createToolCallStream(
streamTools: StreamTool[],
toolName: string,
toolCallId: string,
-): ToolCallStreamData {
+): ToolCallStreamData | undefined {
const stream = new TransformStream<
DeepPartial<{ operations: StreamToolCall[] }>
>();
- const operationsStream = objectStreamToOperationsResult(
- stream.readable,
- streamTools,
- { toolCallId },
- );
+ let operationsStream: ReturnType;
+ if (toolName === "applyDocumentOperations") {
+ operationsStream = operationsObjectStreamToOperationsResult(
+ stream.readable,
+ streamTools,
+ { toolCallId },
+ );
+ } else if (streamTools.find((tool) => tool.name === toolName)) {
+ operationsStream = objectStreamToOperationsResult(
+ stream.readable,
+ streamTools,
+ { toolCallId },
+ );
+ } else {
+ return undefined;
+ }
const writer = stream.writable.getWriter();
@@ -268,6 +283,7 @@ function createToolCallStream(
* Process a single tool call part (streaming or available)
*/
function processToolCallPart(part: any, toolCallData: ToolCallStreamData) {
+ // TODO: what if data is the same?
if (part.state === "input-streaming") {
const input = part.input;
if (input !== undefined) {
diff --git a/packages/xl-ai/src/streamTool/vercelAiSdk/util/injectDocumentStateMessages.ts b/packages/xl-ai/src/streamTool/vercelAiSdk/util/injectDocumentStateMessages.ts
index 90de5d8973..54628cc6d3 100644
--- a/packages/xl-ai/src/streamTool/vercelAiSdk/util/injectDocumentStateMessages.ts
+++ b/packages/xl-ai/src/streamTool/vercelAiSdk/util/injectDocumentStateMessages.ts
@@ -47,7 +47,11 @@ The cursor is BETWEEN two blocks as indicated by cursor: true.
},
{
type: "text" as const,
- text: JSON.stringify(documentState.blocks),
+ text: JSON.stringify(
+ typeof documentState === "string"
+ ? documentState
+ : documentState.blocks,
+ ),
},
]),
// Alternatively, we could explore using dynamic tools to fake document state retrieval:
diff --git a/packages/xl-ai/src/testUtil/testAIModels.ts b/packages/xl-ai/src/testUtil/testAIModels.ts
index c6ed3a2b8a..931b1e1044 100644
--- a/packages/xl-ai/src/testUtil/testAIModels.ts
+++ b/packages/xl-ai/src/testUtil/testAIModels.ts
@@ -14,7 +14,7 @@ const openai = createOpenAI({
const anthropic = createAnthropic({
apiKey: process.env.ANTHROPIC_API_KEY || "not-available-in-ci",
-})("claude-3-7-sonnet-latest");
+})("claude-haiku-4-5");
const albert = createOpenAICompatible({
name: "albert-etalab",
diff --git a/test-diff.txt b/test-diff.txt
new file mode 100644
index 0000000000..5df6bc5cb4
--- /dev/null
+++ b/test-diff.txt
@@ -0,0 +1,3 @@
+Line 123
+Line 3 - added externally
+This line was added from the terminal at Thu Feb 12 19:54:43 CET 2026