@blocknote/xl-ai 0.45.0 → 0.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blocknote-xl-ai.cjs +1 -1
- package/dist/blocknote-xl-ai.cjs.map +1 -1
- package/dist/blocknote-xl-ai.js +147 -149
- package/dist/blocknote-xl-ai.js.map +1 -1
- package/dist/client-BPNTLm1-.cjs +36 -0
- package/dist/client-BPNTLm1-.cjs.map +1 -0
- package/dist/{client-B0lU3j7B.js → client-De9NkxJ-.js} +268 -380
- package/dist/client-De9NkxJ-.js.map +1 -0
- package/dist/server.cjs +1 -1
- package/dist/server.js +12 -14
- package/dist/webpack-stats.json +1 -1
- package/package.json +13 -13
- package/src/AIExtension.ts +9 -3
- package/src/api/aiRequest/sendMessageWithAIRequest.ts +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (streaming)/Add heading (h1) and code block_1_21c6ffe4ff4bd18e2a782b926b61618c.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (streaming)/add a list (end)_1_d0219ee443d8f6d3563dcffcba160730.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (streaming)/add a new paragraph (empty doc)_1_0737d0ae03c2d0adf101da14bdef2414.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (streaming)/add a new paragraph (end)_1_25717cdb5e0dabfd9e85a28126fc6b5b.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (streaming)/add a new paragraph (start)_1_8fc8e14082d21bf98623cd9ef57bafff.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/Add heading (h1) and code block_1_72b3fb10d4b64ad2c57b7e759fb45ea2.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/add a list (end)_1_6330fcc2bc48733981e5337c6f38fe08.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/add a new paragraph (empty doc)_1_1df3fb78a5790897b37bfba0ae96be1e.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/add a new paragraph (end)_1_13ac6e523b724ec3d4e4113c1f973f7d.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/add a new paragraph (start)_1_c7a2f3226a4ee862c75a049c92cea98f.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/Add heading (h1) and code block_1_a10f3f8e8e6d938c54950352eae2f50f.json +15 -0
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/add a list (end)_1_b0a300b9716085d9bfa169d8085d10b7.json +15 -0
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/add a new paragraph (empty doc)_1_9d4f54665e392006af18af614d32e632.json +15 -0
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/add a new paragraph (end)_1_d862f2761b7f6594f4b571c7f8291820.json +15 -0
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/add a new paragraph (start)_1_94759353bbdb9e30152eb0164488ba89.json +15 -0
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (streaming)/add and update paragraph_1_2dbe9e9945d6cabc0b02e812a6ba1b93.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (streaming)/add paragraph and update selection_1_ed2eea810db5ab73a8478e981735f2a6.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/add and update paragraph_1_7a6f24c686aeb896da8088bd8ea14089.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/add paragraph and update selection_1_9d907341d7a5b18529ccaf20cacbbe6f.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/add and update paragraph_1_a562a7fd96440f9bfac43e04c1bf144a.json +15 -0
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/add paragraph and update selection_1_6bb242aace6ad9ae71bcb369ce8208d4.json +15 -0
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Delete/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (streaming)/delete first block_1_71dfbd70fa9bcd8c2378c0b255360279.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Delete/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/delete first block_1_72e05e8a661b9149b89f8ca9a80a2129.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Delete/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/delete first block_1_f51e5c59768fde7bccc5635d90890452.json +15 -0
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (streaming)/clear block formatting_1_f3ecead131eac14f117b601ad92bae90.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (streaming)/drop mark and link and change text within mark_1_6b686110fa540e40d81fd68ee23cde86.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (streaming)/drop mark and link_1_fee0a33a7c0951dacc8fd9ba02adef0a.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (streaming)/fix spelling mid-word selection_1_ce6692c22eda2a757e123681118a333d.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (streaming)/modify nested content_1_1d18b29fde3a6494f2d1df98d0689bcf.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (streaming)/modify parent content_1_7d96675c4edc13f69084f42983de6d73.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (streaming)/plain source block, add mention_1_785d7f53424b53e8b64f4732aa578c61.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (streaming)/standard update_1_c01c22b2bf79f30908ce9ffb0798a79f.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (streaming)/styles + ic in source block, remove mark_1_66f540dda8b5f8e8713b9c6f0bdd4d3f.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (streaming)/styles + ic in source block, remove mention_1_9111f9b26383721d9186c99d035f44e8.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (streaming)/styles + ic in source block, replace content_1_6a2c68962725ab2dc43dc12b5e9e5d8f.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (streaming)/styles + ic in source block, update mention prop_1_60f48a7bd81fb6a72b96b284d61c6e53.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (streaming)/styles + ic in source block, update text_1_284f982ebe3b60bc15c674d63795a879.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (streaming)/styles + ic in target block, add mark (paragraph)_1_6c8e4ac91518d57e4827481f00ddc38e.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (streaming)/styles + ic in target block, add mark (word)_1_06f3ae0ab5b505f03cf8e0c6bd654b1e.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (streaming)/translate selection_1_1ad7d1a857e525e2d0f5a8c85b645a0e.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (streaming)/turn paragraphs into list_1_0e8f14f06679e951d88ec74919c24b90.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (streaming)/update block prop and content_1_f6c1cfee51cd75204495d3db1d80350e.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (streaming)/update block prop_1_759983067f25f0daafb42bc9fefcdb64.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (streaming)/update block type and content_1_e9d9d699bbe4a3b6e754c530ffe56e2c.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (streaming)/update block type_1_ac405ec31a0cb874515b0c5b6aa2eb2d.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/clear block formatting_1_1b60a2dae45a21cc2916e15e97bfd289.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/drop mark and link and change text within mark_1_a7e99401a3cc86c79b30fdf47b0dc28e.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/drop mark and link_1_75e458d048de9ef0fb1eef34109ec81b.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/fix spelling mid-word selection_1_8c47595610a6a2d15e1c5c751528e97a.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/modify nested content_1_f81acd3a9fb46c387163c91724ec4c55.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/modify parent content_1_49c9371e221a7966cac554b99ba56b02.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/plain source block, add mention_1_b2be33e4a07122a85e49b521c20f26db.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/standard update_1_08d79a078de070c800627c412f9a0d9f.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/styles + ic in source block, remove mark_1_0d87ce48c7e9e690bde7fc3668fe735b.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/styles + ic in source block, remove mention_1_a96e84a734674ca195c2b40bab34c2fa.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/styles + ic in source block, replace content_1_f5be35337d2ac3c65ec6363d4f347364.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/styles + ic in source block, update mention prop_1_a09c043f6d105b1496a7c79ce34e28d3.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/styles + ic in source block, update text_1_dfc536ede5303a75993dea08764b318e.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/styles + ic in target block, add mark (paragraph)_1_ebbeca51137a25dc54cdb7bafab53bed.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/styles + ic in target block, add mark (word)_1_d6f14d8cecee690c72107e57eee0efbf.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/translate selection_1_59b3c2f2328276dc62dad98af951d63c.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/turn paragraphs into list_1_50b1aa228a2b2557dea5026daaef2fad.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/update block prop and content_1_4a65e945b3b6fac5d4a0cf8d623486d3.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/update block prop_1_83a73dcfd05a6cf6754e1eb24114c1f1.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/update block type and content_1_7500fd44498888e45aedc9dfa669737c.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/update block type_1_92eb84e55a7b9efe5daf52bef299b4a6.json +1 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/clear block formatting_1_21bbf793e092bd207656f933b2274b21.json +15 -0
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/drop mark and link and change text within mark_1_70261ec295eec99f6b835af3371749ef.json +15 -0
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/drop mark and link_1_45e52fc97822fb0e7573a6603137ab4e.json +15 -0
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/fix spelling mid-word selection_1_74934d888aa5deba8c74b66c12d81443.json +15 -0
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/modify nested content_1_bfd4f73138b34375f33d28b5ee48d971.json +15 -0
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/modify parent content_1_df8380600ae416c0eb70034e41b59701.json +15 -0
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/plain source block, add mention_1_4579057dabcbe2f9f73c9a329a99393d.json +15 -0
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/standard update_1_ede2a6f5b9da689056b55d71d91434fe.json +15 -0
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, remove mark_1_a6d8c670d163bd0cf79a424c6a6054a0.json +15 -0
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, remove mention_1_ea57e8c6df3c134fa91348e7b71e7a57.json +15 -0
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, replace content_1_24429e5416bc371492edd73611cf3946.json +15 -0
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, update mention prop_1_079714c774da28b17075269c1cdd1696.json +15 -0
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, update text_1_e0d8184c9829e07f8df2860248818bc8.json +15 -0
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/styles + ic in target block, add mark (paragraph)_1_6b7d5cf6029aa5db5a9aaad9264795f8.json +15 -0
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/styles + ic in target block, add mark (word)_1_ffc7b82f1fb9de2ffacf16dda33c09eb.json +15 -0
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/translate selection_1_b8200b55589e761efded3c08e8709a53.json +15 -0
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/turn paragraphs into list_1_30410f1a45a0de453f68c27fa57dded9.json +15 -0
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/update block prop and content_1_2184f0d7adf54cebd8f2068b93783d8b.json +15 -0
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/update block prop_1_56a595216306ecbe9557436eabd778b1.json +15 -0
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/update block type and content_1_894e0e3aa3fe005922264627bab288ea.json +15 -0
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/update block type_1_0bf2510ac3023bb1a62d991c85655cba.json +15 -0
- package/src/api/formats/html-blocks/htmlBlocks.test.ts +1 -8
- package/src/api/formats/json/errorHandling.test.ts +54 -57
- package/src/api/formats/json/json.test.ts +1 -1
- package/src/api/formats/markdown-blocks/markdownBlocks.test.ts +1 -1
- package/src/components/AIMenu/PromptSuggestionMenu.tsx +20 -18
- package/src/streamTool/index.ts +0 -1
- package/src/streamTool/vercelAiSdk/clientside/ClientSideTransport.ts +7 -92
- package/src/streamTool/vercelAiSdk/util/toolDefinitions.ts +9 -5
- package/types/src/streamTool/index.d.ts +0 -1
- package/types/src/streamTool/vercelAiSdk/clientside/ClientSideTransport.d.ts +9 -33
- package/types/src/streamTool/vercelAiSdk/util/toolDefinitions.d.ts +1 -1
- package/dist/client-B0lU3j7B.js.map +0 -1
- package/dist/client-CUJscXD0.cjs +0 -36
- package/dist/client-CUJscXD0.cjs.map +0 -1
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming + generateObject)/Add heading (h1) and code block_1_1d3b032c0f42ea308a1e7a13160bec4b.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming + generateObject)/add a list (end)_1_e341e2801f875f5ac4e8a4508c274b08.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming + generateObject)/add a new paragraph (empty doc)_1_42ec272374b0f12670f81c091e9ceaca.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming + generateObject)/add a new paragraph (end)_1_86ff29befb09692b6ca78454082eb4a9.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming + generateObject)/add a new paragraph (start)_1_3fd9b56671a58b30eff463b30963b76b.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/Add heading (h1) and code block_1_a7541d4dff5630b127b0284a513d8cb6.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/add a list (end)_1_5fa40270f0d516da79eb1a7f58c7f43f.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/add a new paragraph (empty doc)_1_42ba165a69a6e53683cb40d6018445bf.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/add a new paragraph (end)_1_b5d7570beb28712970433d8b53528829.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/add a new paragraph (start)_1_94232233e44ede5453eea20dd949c070.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming + generateObject)/add and update paragraph_1_1f86584753177f1b06f2cab6a822316b.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming + generateObject)/add paragraph and update selection_1_a7100ba9aeac25c6dbfc977b2325ae74.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/add and update paragraph_1_d6725684f23346e66f8289d5ba72d7c1.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Combined/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/add paragraph and update selection_1_b6c3311e72a434273d25e4a6dc74731a.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Delete/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming + generateObject)/delete first block_1_00d51791f8357a4bc061a2cf8ce067f1.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Delete/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/delete first block_1_83607282733aee32b5769107be6b9428.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming + generateObject)/clear block formatting_1_c3fe0bb003a4e1d613472af309c46ab0.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming + generateObject)/drop mark and link and change text within mark_1_9724ffa3960f9e2f0853ca65fa305d5a.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming + generateObject)/drop mark and link_1_ab436caf1e1c8338ab798b9e41f27035.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming + generateObject)/fix spelling mid-word selection_1_a6c5e74c3098077445378d6645e2672e.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming + generateObject)/modify nested content_1_030d3ad5a7f2e03a8f141379accd970d.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming + generateObject)/modify parent content_1_8123bc6c0c42f952c5081494aae87db3.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming + generateObject)/plain source block, add mention_1_7740e1127e576e342300ad8ca046c116.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming + generateObject)/standard update_1_b940b7342e81fb99f50941824dca6dc9.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming + generateObject)/styles + ic in source block, remove mark_1_69370edf5666084e6ab44e3c9a41fa12.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming + generateObject)/styles + ic in source block, remove mention_1_73ae7ea818d0050772e68d743b8c8f07.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming + generateObject)/styles + ic in source block, replace content_1_493b1cae062778312080cf9e73436d03.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming + generateObject)/styles + ic in source block, update mention prop_1_812164c840f1ad02eb52b9b82e8adad1.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming + generateObject)/styles + ic in source block, update text_1_28d3f4434e75617be2e5aaffcb5c1ca7.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming + generateObject)/styles + ic in target block, add mark (paragraph)_1_2fcc358ab0331d440742d0b28cdbffcd.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming + generateObject)/styles + ic in target block, add mark (word)_1_d51e7544c0fcb93030a9d4c14970a487.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming + generateObject)/translate selection_1_d51b8ed2dc61e8f8e333a3221be46316.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming + generateObject)/turn paragraphs into list_1_34265b84999198d0abed53174f1081a1.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming + generateObject)/update block prop and content_1_8a8bb024ac97dfc5a47387ceb86a483f.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming + generateObject)/update block prop_1_4a0be63bfbef46eea3c480cd5c20d78b.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming + generateObject)/update block type and content_1_2e78a51589c195d5f4a1668482db03c4.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming + generateObject)/update block type_1_77c40f25fadd092d83b41c87d2b21055.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/clear block formatting_1_09ce4ed21f35db11e7e8abc53d8e897c.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/drop mark and link and change text within mark_1_1072f99168883f64e55663c24b1b0a0d.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/drop mark and link_1_d0d892fae6bedce4f397e9e70a26c548.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/fix spelling mid-word selection_1_d4b4abc5fa45932eec4efcc43bb337bd.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/modify nested content_1_dd6cb439703f9c3f9bad5e2cc1a911c2.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/modify parent content_1_3a1e3c71094e24988b7f754e1d329f94.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/plain source block, add mention_1_19d556214c5ef684a2c65e3a08f14ba1.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/standard update_1_e0e15748dddab0b96d9367062c1ee445.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, remove mark_1_c69996aacaf807f2f988d23570f1829e.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, remove mention_1_86a5a7047cd626ede49fa5336b0cfedf.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, replace content_1_c29ec07799c4f9099789d65b819038e8.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, update mention prop_1_0355ff1065aab025d93ccddb0d5a1005.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, update text_1_d2b04758b99475efcd78a137aa91cfe4.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/styles + ic in target block, add mark (paragraph)_1_071517f9f358c0806dd80b49096a405d.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/styles + ic in target block, add mark (word)_1_4bdc947c29ac3c96b95afac6843a6894.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/translate selection_1_e4b712a415f8af6f2b49382cac85ae77.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/turn paragraphs into list_1_63ec354cac388bce6c2b6d324473b48f.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/update block prop and content_1_9290d6b9a47efc6589359e2820ef6702.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/update block prop_1_220afe040247e0efb76c73bf82ed4d4e.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/update block type and content_1_8494a477cce9b50c531800a11a8fd6ef.json +0 -15
- package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/update block type_1_c25f2e6f9ffe088112413cc2ca87e75a.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/Add heading (h1) and code block_1_da23f47c1267f17138027b6bd115b251.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/add a list (end)_1_215b02f86ce29cdb7f8834b39d073041.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/add a new paragraph (empty doc)_1_56cad0142b200cfff68d9ff03f02e930.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/add a new paragraph (end)_1_87a85aa54d0e545e325753089c3843b2.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/add a new paragraph (start)_1_572761dc235c6278ed438821af019645.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/Add heading (h1) and code block_1_a5e8aef512955120d014d7b2fc72d306.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add a list (end)_1_97ac96ad778b2e833c0e43c1a2221a4f.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add a new paragraph (empty doc)_1_25dfbd403ed079997ccc162bd02defa7.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add a new paragraph (end)_1_240d8ee34ce9447499e1ea1058a6d6e3.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add a new paragraph (start)_1_ccaaaa4df61f9ed8a174034e7eb066af.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Combined/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/add and update paragraph_1_923d9eef4b0b2e7367fd68983678a41a.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Combined/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/add paragraph and update selection_1_ca185676c21707be2b3524b104786716.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Combined/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add and update paragraph_1_6a4c9cc869ec961e3662b788540af827.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Combined/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/add paragraph and update selection_1_8092e1583e60700c3cff810383dbf5ad.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Delete/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/delete first block_1_f36354147821c0e68c7e4d2ff18e8a95.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Delete/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/delete first block_1_4ac561ca5a33ecb3cbb77482471e2477.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/clear block formatting_1_4479e5ad2d77e8d9f6b49330a706a3af.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/drop mark and link and change text within mark_1_d8be2007761d56dcf271fa44d6e8a232.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/drop mark and link_1_ce3a8d756277935c395939e94ffbdfb1.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/modify nested content_1_65bac275d973af0c7b46b2b8d5d324fe.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/modify parent content_1_e23642dde85b3d958c556c5e4f86ac38.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/plain source block, add mention_1_b2b46f2ea1174691cf498ebb089d464a.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/standard update_1_94dcefb2b5844b8a3f64f32f87115a14.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in source block, remove mark_1_276903909ec4f878e8adc9c6bd53d0cf.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in source block, remove mention_1_e494072895d2e9d6bd0465582b9034f6.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in source block, replace content_1_0781fecd32901229a780bd5675e62163.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in source block, update mention prop_1_2d779ce68436ee4e33b6781e66c95d4d.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in source block, update text_1_03a2f68b3d126b81618ffeebec9f2c7f.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in target block, add mark (paragraph)_1_7875145fec05f9cae7e28537ac95bc84.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/styles + ic in target block, add mark (word)_1_0fe47d4cbf760327d6622e9e27c734c4.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/translate selection_1_a1c443203ee18f4ec6d71349d0c57311.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/turn paragraphs into list_1_641282d2e6c4ebf728bf3d68a286275b.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/update block prop and content_1_535c3a219eb5cf340184d102273a2cf4.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/update block prop_1_c7c286b44674e4f6141b1e95819b7f60.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/update block type and content_1_901d3a54e64251f1be4ee227b9fb4522.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (non-streaming)/update block type_1_90c759912d4965fb8ce694e2a63e26fb.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/clear block formatting_1_49a8b14dc6c4c5cc452e22c79dae5b62.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/drop mark and link and change text within mark_1_2c278aa8dd1cb7a5f35e306e9a02c487.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/drop mark and link_1_8349974ecc8b2268c1b5b42aa93563b7.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/modify nested content_1_3773830b2cf364532410c9c5498a1355.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/modify parent content_1_c0dd9920ce66da75022907181066f5c8.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/plain source block, add mention_1_255c7e8a0fd687acb58e373b4b4e7bee.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/standard update_1_462e7956999f00b4e3ff89faa46d3d4d.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, remove mark_1_c7c6246b702c9417679fec382dfa34d1.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, remove mention_1_5eb79311fbbec3ee0ed02e0178b3bee6.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, replace content_1_5d52b9a4787e7d80ebeabb4ebd975206.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, update mention prop_1_18ed7c60005c23092d68b0d1f73af517.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in source block, update text_1_b2017bfc7ff6e6440d2459f1042a8a49.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in target block, add mark (paragraph)_1_b68a744287cba99975e82279562eb768.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/styles + ic in target block, add mark (word)_1_a435c74c2ca086ce0225445d217e9a2e.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/translate selection_1_ac70d79d18996d3e08a6559885013c70.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/turn paragraphs into list_1_92a38569e8e9c873af8553e1607a7ba7.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/update block prop and content_1_470bec988f3c558f26928b2f29b50637.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/update block prop_1_7e88e61010d66486f9882befa48894db.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/update block type and content_1_1c088e30cb25a7508d30c2079426a225.json +0 -15
- package/src/api/formats/json/__snapshots__/json.test.ts/Update/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/update block type_1_9fed5f51d881546a9031bc6308ff465c.json +0 -15
- package/src/streamTool/vercelAiSdk/util/partialObjectStreamUtil.ts +0 -120
- package/types/src/streamTool/vercelAiSdk/util/partialObjectStreamUtil.d.ts +0 -30
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { jsonSchema as N, parsePartialJson as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { getPmSchema as
|
|
9
|
-
import { Slice as
|
|
10
|
-
import { TextSelection as
|
|
11
|
-
import { Transform as E, Mapping as
|
|
12
|
-
import { ChangeSet as
|
|
13
|
-
import { applySuggestions as
|
|
14
|
-
function
|
|
1
|
+
var ye = Object.defineProperty;
|
|
2
|
+
var be = (t, e, o) => e in t ? ye(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o;
|
|
3
|
+
var D = (t, e, o) => be(t, typeof e != "symbol" ? e + "" : e, o);
|
|
4
|
+
import { jsonSchema as N, parsePartialJson as ie, asSchema as Y, tool as Se, streamText as ke, convertToModelMessages as we, isToolUIPart as ge } from "ai";
|
|
5
|
+
import X from "lodash.merge";
|
|
6
|
+
import { getErrorMessage as L } from "@ai-sdk/provider-utils";
|
|
7
|
+
import Te from "lodash.isequal";
|
|
8
|
+
import { getPmSchema as Pe, UnreachableCaseError as ve, getNodeById as Oe, updateBlockTr as Ee, insertBlocks as xe, trackPosition as Z, removeAndInsertBlocks as Be, getBlock as ce, defaultProps as le, isStyledTextInlineContent as Ce, isLinkInlineContent as Ie } from "@blocknote/core";
|
|
9
|
+
import { Slice as Ne } from "prosemirror-model";
|
|
10
|
+
import { TextSelection as Me } from "prosemirror-state";
|
|
11
|
+
import { Transform as E, Mapping as ue, ReplaceStep as P, ReplaceAroundStep as Ae } from "prosemirror-transform";
|
|
12
|
+
import { ChangeSet as G, simplifyChanges as _e } from "prosemirror-changeset";
|
|
13
|
+
import { applySuggestions as $e } from "@handlewithcare/prosemirror-suggest-changes";
|
|
14
|
+
function U(t) {
|
|
15
15
|
return (t.type === "paragraph" || !t.type) && !t.content || Array.isArray(t.content) && t.content.length === 0;
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function je(t, e, o = !0, r = !0) {
|
|
18
18
|
let n = 0, a = t.length;
|
|
19
19
|
if (o)
|
|
20
20
|
for (; n < a && e(t[n]); )
|
|
@@ -24,15 +24,15 @@ function Ue(t, e, o = !0, r = !0) {
|
|
|
24
24
|
a--;
|
|
25
25
|
return t.slice(n, a);
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
return
|
|
27
|
+
function v(t, e) {
|
|
28
|
+
return je(
|
|
29
29
|
t,
|
|
30
|
-
(r) =>
|
|
30
|
+
(r) => U(r) && (e == null ? void 0 : e.cursorBlockId) !== r.id,
|
|
31
31
|
(e == null ? void 0 : e.trimStart) ?? !1,
|
|
32
32
|
(e == null ? void 0 : e.trimEnd) ?? !0
|
|
33
33
|
);
|
|
34
34
|
}
|
|
35
|
-
async function
|
|
35
|
+
async function $t(t) {
|
|
36
36
|
const {
|
|
37
37
|
useSelection: e,
|
|
38
38
|
deleteEmptyCursorBlock: o,
|
|
@@ -42,11 +42,11 @@ async function Ut(t) {
|
|
|
42
42
|
} = {
|
|
43
43
|
useSelection: t.useSelection ?? !1,
|
|
44
44
|
deleteEmptyCursorBlock: t.deleteEmptyCursorBlock ?? !0,
|
|
45
|
-
streamToolsProvider: t.streamToolsProvider ??
|
|
46
|
-
documentStateBuilder: t.documentStateBuilder ??
|
|
45
|
+
streamToolsProvider: t.streamToolsProvider ?? ae.html.getStreamToolsProvider(),
|
|
46
|
+
documentStateBuilder: t.documentStateBuilder ?? ae.html.defaultDocumentStateBuilder,
|
|
47
47
|
onStart: t.onStart ?? (() => {
|
|
48
48
|
})
|
|
49
|
-
}, i = e ? void 0 : t.editor.getTextCursorPosition().block, s = i && o &&
|
|
49
|
+
}, i = e ? void 0 : t.editor.getTextCursorPosition().block, s = i && o && U(i) && v(t.editor.document).length > 0 ? i.id : void 0, c = e ? t.editor.getSelectionCutBlocks(!0) : void 0, d = r.getStreamTools(
|
|
50
50
|
t.editor,
|
|
51
51
|
c ? {
|
|
52
52
|
from: c._meta.startPos,
|
|
@@ -65,7 +65,7 @@ async function Ut(t) {
|
|
|
65
65
|
documentState: await n(u)
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function De(t) {
|
|
69
69
|
const { properties: e, required: o, $defs: r, ...n } = t.inputSchema;
|
|
70
70
|
return {
|
|
71
71
|
schema: {
|
|
@@ -85,11 +85,11 @@ function Je(t) {
|
|
|
85
85
|
$defs: r
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
|
-
function
|
|
89
|
-
const e = t.map((r) =>
|
|
88
|
+
function Le(t) {
|
|
89
|
+
const e = t.map((r) => De(r)), o = {};
|
|
90
90
|
for (const r of e)
|
|
91
91
|
for (const n in r.$defs) {
|
|
92
|
-
if (o[n] && !
|
|
92
|
+
if (o[n] && !Te(o[n], r.$defs[n]))
|
|
93
93
|
throw new Error(`Duplicate, but different definition for ${n}`);
|
|
94
94
|
o[n] = r.$defs[n];
|
|
95
95
|
}
|
|
@@ -110,35 +110,35 @@ function Re(t) {
|
|
|
110
110
|
$defs: Object.keys(o).length > 0 ? o : void 0
|
|
111
111
|
};
|
|
112
112
|
}
|
|
113
|
-
function
|
|
113
|
+
function Ue(t) {
|
|
114
114
|
return {
|
|
115
115
|
applyDocumentOperations: {
|
|
116
|
-
inputSchema: N(
|
|
116
|
+
inputSchema: N(Le(t)),
|
|
117
117
|
outputSchema: N({ type: "object" })
|
|
118
118
|
}
|
|
119
119
|
};
|
|
120
120
|
}
|
|
121
|
-
class
|
|
121
|
+
class J extends Error {
|
|
122
122
|
constructor(o, r, n) {
|
|
123
123
|
super(o, n);
|
|
124
|
-
|
|
124
|
+
D(this, "aborted");
|
|
125
125
|
this.chunk = r, this.name = "ChunkExecutionError", this.aborted = (n == null ? void 0 : n.aborted) ?? !1;
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
|
-
class
|
|
128
|
+
class Je {
|
|
129
129
|
/**
|
|
130
130
|
* @param streamTools - The StreamTools to use to apply the StreamToolCalls
|
|
131
131
|
* @param abortSignal - Optional AbortSignal to cancel ongoing operations
|
|
132
132
|
*/
|
|
133
133
|
constructor(e, o) {
|
|
134
|
-
|
|
134
|
+
D(this, "stream");
|
|
135
135
|
this.streamTools = e, this.abortSignal = o, this.stream = this.createStream();
|
|
136
136
|
}
|
|
137
137
|
createStream() {
|
|
138
138
|
let e;
|
|
139
139
|
const o = new TransformStream({
|
|
140
140
|
transform: async (s, c) => {
|
|
141
|
-
const d = typeof s == "string" ? await
|
|
141
|
+
const d = typeof s == "string" ? await qe(
|
|
142
142
|
s,
|
|
143
143
|
(e == null ? void 0 : e.isPossiblyPartial) ?? !1,
|
|
144
144
|
this.streamTools
|
|
@@ -170,8 +170,8 @@ class He {
|
|
|
170
170
|
}
|
|
171
171
|
} catch (c) {
|
|
172
172
|
r.error(
|
|
173
|
-
new
|
|
174
|
-
`Tool execution failed: ${
|
|
173
|
+
new J(
|
|
174
|
+
`Tool execution failed: ${L(c)}`,
|
|
175
175
|
o,
|
|
176
176
|
{
|
|
177
177
|
cause: c,
|
|
@@ -215,7 +215,7 @@ class He {
|
|
|
215
215
|
async executeOperationsArray(e) {
|
|
216
216
|
const o = this.writable.getWriter();
|
|
217
217
|
for await (const r of e) {
|
|
218
|
-
const n = await
|
|
218
|
+
const n = await ie(r);
|
|
219
219
|
if (n.state === "undefined-input" || n.state === "failed-parse" || !n)
|
|
220
220
|
return;
|
|
221
221
|
await o.write(r);
|
|
@@ -251,8 +251,8 @@ class He {
|
|
|
251
251
|
);
|
|
252
252
|
}
|
|
253
253
|
}
|
|
254
|
-
async function
|
|
255
|
-
const r = await
|
|
254
|
+
async function qe(t, e, o) {
|
|
255
|
+
const r = await ie(t);
|
|
256
256
|
if (r.state === "undefined-input" || r.state === "failed-parse" || !r)
|
|
257
257
|
return;
|
|
258
258
|
const n = o.find((i) => {
|
|
@@ -267,7 +267,7 @@ async function Fe(t, e, o) {
|
|
|
267
267
|
metadata: void 0
|
|
268
268
|
};
|
|
269
269
|
}
|
|
270
|
-
function
|
|
270
|
+
function Re(t) {
|
|
271
271
|
return t.flatMap((e) => {
|
|
272
272
|
var o;
|
|
273
273
|
if (e.role === "user" && ((o = e.metadata) != null && o.documentState)) {
|
|
@@ -334,89 +334,24 @@ The cursor is BETWEEN two blocks as indicated by cursor: true.
|
|
|
334
334
|
return [e];
|
|
335
335
|
});
|
|
336
336
|
}
|
|
337
|
-
function
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
start(r) {
|
|
342
|
-
r.enqueue({ type: "start" }), r.enqueue({ type: "start-step" }), r.enqueue({
|
|
343
|
-
type: "tool-input-start",
|
|
344
|
-
toolCallId: "call_object_1",
|
|
345
|
-
toolName: e
|
|
346
|
-
});
|
|
347
|
-
},
|
|
348
|
-
transform(r, n) {
|
|
349
|
-
switch (r.type) {
|
|
350
|
-
case "text-delta":
|
|
351
|
-
o += r.textDelta, n.enqueue({
|
|
352
|
-
type: "tool-input-delta",
|
|
353
|
-
toolCallId: "call_object_1",
|
|
354
|
-
inputTextDelta: r.textDelta
|
|
355
|
-
});
|
|
356
|
-
break;
|
|
357
|
-
case "object":
|
|
358
|
-
case "finish":
|
|
359
|
-
break;
|
|
360
|
-
case "error":
|
|
361
|
-
n.enqueue({
|
|
362
|
-
type: "error",
|
|
363
|
-
errorText: $(r.error)
|
|
364
|
-
});
|
|
365
|
-
break;
|
|
366
|
-
default: {
|
|
367
|
-
const a = r;
|
|
368
|
-
throw new Error(`Unsupported chunk type: ${a}`);
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
},
|
|
372
|
-
async flush(r) {
|
|
373
|
-
r.enqueue({
|
|
374
|
-
type: "tool-input-available",
|
|
375
|
-
toolCallId: "call_object_1",
|
|
376
|
-
toolName: e,
|
|
377
|
-
input: JSON.parse(o)
|
|
378
|
-
}), r.enqueue({ type: "finish-step" }), r.enqueue({ type: "finish" });
|
|
379
|
-
}
|
|
380
|
-
})
|
|
381
|
-
);
|
|
382
|
-
}
|
|
383
|
-
function Ve(t, e) {
|
|
384
|
-
return new ReadableStream({
|
|
385
|
-
start(r) {
|
|
386
|
-
r.enqueue({ type: "start" }), r.enqueue({ type: "start-step" }), r.enqueue({
|
|
387
|
-
type: "tool-input-start",
|
|
388
|
-
toolCallId: "call_object_1",
|
|
389
|
-
toolName: e
|
|
390
|
-
}), r.enqueue({
|
|
391
|
-
type: "tool-input-delta",
|
|
392
|
-
toolCallId: "call_object_1",
|
|
393
|
-
inputTextDelta: JSON.stringify(t)
|
|
394
|
-
}), r.enqueue({
|
|
395
|
-
type: "tool-input-available",
|
|
396
|
-
toolCallId: "call_object_1",
|
|
397
|
-
toolName: e,
|
|
398
|
-
input: t
|
|
399
|
-
}), r.enqueue({ type: "finish-step" }), r.enqueue({ type: "finish" }), r.close();
|
|
400
|
-
}
|
|
401
|
-
});
|
|
402
|
-
}
|
|
403
|
-
function Ye(t) {
|
|
404
|
-
return Object.fromEntries(
|
|
405
|
-
Object.entries(t).map(([e, o]) => [
|
|
406
|
-
e,
|
|
337
|
+
async function ze(t) {
|
|
338
|
+
const e = await Promise.all(
|
|
339
|
+
Object.entries(t).map(async ([o, r]) => [
|
|
340
|
+
o,
|
|
407
341
|
{
|
|
408
|
-
description:
|
|
409
|
-
inputSchema:
|
|
410
|
-
outputSchema:
|
|
342
|
+
description: r.description,
|
|
343
|
+
inputSchema: await Y(r.inputSchema).jsonSchema,
|
|
344
|
+
outputSchema: await Y(r.outputSchema).jsonSchema
|
|
411
345
|
}
|
|
412
346
|
])
|
|
413
347
|
);
|
|
348
|
+
return Object.fromEntries(e);
|
|
414
349
|
}
|
|
415
|
-
function
|
|
350
|
+
function He(t) {
|
|
416
351
|
return Object.fromEntries(
|
|
417
352
|
Object.entries(t).map(([e, o]) => [
|
|
418
353
|
e,
|
|
419
|
-
|
|
354
|
+
Se({
|
|
420
355
|
...o,
|
|
421
356
|
inputSchema: N(o.inputSchema),
|
|
422
357
|
outputSchema: N(o.outputSchema)
|
|
@@ -424,7 +359,7 @@ function Xe(t) {
|
|
|
424
359
|
])
|
|
425
360
|
);
|
|
426
361
|
}
|
|
427
|
-
const
|
|
362
|
+
const Fe = {
|
|
428
363
|
"mistral.chat": {
|
|
429
364
|
mode: "auto"
|
|
430
365
|
},
|
|
@@ -439,58 +374,13 @@ const Ze = {
|
|
|
439
374
|
}
|
|
440
375
|
}
|
|
441
376
|
};
|
|
442
|
-
function
|
|
443
|
-
return
|
|
377
|
+
function jt(t) {
|
|
378
|
+
return Fe[t.provider] || {};
|
|
444
379
|
}
|
|
445
|
-
class
|
|
380
|
+
class Dt {
|
|
446
381
|
constructor(e) {
|
|
447
382
|
this.opts = e;
|
|
448
383
|
}
|
|
449
|
-
/**
|
|
450
|
-
* Calls an LLM with StreamTools, using the `generateObject` of the AI SDK.
|
|
451
|
-
*
|
|
452
|
-
* This is the non-streaming version.
|
|
453
|
-
*/
|
|
454
|
-
async generateObject(e, o) {
|
|
455
|
-
const { model: r, _additionalOptions: n } = this.opts;
|
|
456
|
-
if (typeof r == "string")
|
|
457
|
-
throw new Error("model must be a LanguageModelV2");
|
|
458
|
-
const a = Object.keys(o)[0], i = o[a].inputSchema, s = await Te({
|
|
459
|
-
output: "object",
|
|
460
|
-
schema: i,
|
|
461
|
-
model: r,
|
|
462
|
-
mode: "tool",
|
|
463
|
-
system: this.opts.systemPrompt,
|
|
464
|
-
messages: q(U(e)),
|
|
465
|
-
...ee(r),
|
|
466
|
-
...n ?? {}
|
|
467
|
-
});
|
|
468
|
-
return Ve(s.object, a);
|
|
469
|
-
}
|
|
470
|
-
/**
|
|
471
|
-
* Calls an LLM with StreamTools, using the `streamObject` of the AI SDK.
|
|
472
|
-
*
|
|
473
|
-
* This is the streaming version.
|
|
474
|
-
*/
|
|
475
|
-
async streamObject(e, o) {
|
|
476
|
-
const { model: r, _additionalOptions: n } = this.opts;
|
|
477
|
-
if (typeof r == "string")
|
|
478
|
-
throw new Error("model must be a LanguageModelV2");
|
|
479
|
-
const a = Object.keys(o)[0], i = o[a].inputSchema, s = ve({
|
|
480
|
-
output: "object",
|
|
481
|
-
schema: i,
|
|
482
|
-
model: r,
|
|
483
|
-
mode: "tool",
|
|
484
|
-
system: this.opts.systemPrompt,
|
|
485
|
-
messages: q(U(e)),
|
|
486
|
-
...ee(r),
|
|
487
|
-
...n ?? {}
|
|
488
|
-
});
|
|
489
|
-
return We(
|
|
490
|
-
s.fullStream,
|
|
491
|
-
a
|
|
492
|
-
);
|
|
493
|
-
}
|
|
494
384
|
/**
|
|
495
385
|
* Calls an LLM with StreamTools, using the `streamText` of the AI SDK.
|
|
496
386
|
*
|
|
@@ -498,10 +388,12 @@ class Jt {
|
|
|
498
388
|
*/
|
|
499
389
|
async streamText(e, o) {
|
|
500
390
|
const { model: r, _additionalOptions: n } = this.opts;
|
|
501
|
-
return
|
|
391
|
+
return ke({
|
|
502
392
|
model: r,
|
|
503
393
|
system: this.opts.systemPrompt,
|
|
504
|
-
messages:
|
|
394
|
+
messages: await we(
|
|
395
|
+
Re(e)
|
|
396
|
+
),
|
|
505
397
|
tools: o,
|
|
506
398
|
toolChoice: "required",
|
|
507
399
|
// extra options for streamObject
|
|
@@ -514,9 +406,7 @@ class Jt {
|
|
|
514
406
|
body: o
|
|
515
407
|
// metadata,
|
|
516
408
|
}) {
|
|
517
|
-
const r = this.opts.stream ?? !0, n = o.toolDefinitions, a =
|
|
518
|
-
if (this.opts.objectGeneration)
|
|
519
|
-
return r ? this.streamObject(e, a) : this.generateObject(e, a);
|
|
409
|
+
const r = this.opts.stream ?? !0, n = o.toolDefinitions, a = await He(n);
|
|
520
410
|
if (r)
|
|
521
411
|
return await this.streamText(e, a);
|
|
522
412
|
throw new Error("Not implemented (generateText)");
|
|
@@ -525,7 +415,7 @@ class Jt {
|
|
|
525
415
|
throw new Error("Not implemented");
|
|
526
416
|
}
|
|
527
417
|
}
|
|
528
|
-
function
|
|
418
|
+
function We() {
|
|
529
419
|
let t, e = Promise.resolve(), o = !1, r;
|
|
530
420
|
const n = new Promise((c, d) => {
|
|
531
421
|
r = d;
|
|
@@ -565,7 +455,7 @@ function Ge() {
|
|
|
565
455
|
}
|
|
566
456
|
return { output: a, append: i, finalize: s };
|
|
567
457
|
}
|
|
568
|
-
function
|
|
458
|
+
function Ve(t) {
|
|
569
459
|
return new ReadableStream({
|
|
570
460
|
async start(e) {
|
|
571
461
|
try {
|
|
@@ -578,7 +468,7 @@ function Ke(t) {
|
|
|
578
468
|
}
|
|
579
469
|
});
|
|
580
470
|
}
|
|
581
|
-
function
|
|
471
|
+
function de(t) {
|
|
582
472
|
if (t.locked)
|
|
583
473
|
throw new Error(
|
|
584
474
|
"Stream (source) is already locked and cannot be iterated."
|
|
@@ -596,10 +486,10 @@ function me(t) {
|
|
|
596
486
|
};
|
|
597
487
|
}, e;
|
|
598
488
|
}
|
|
599
|
-
function
|
|
600
|
-
return
|
|
489
|
+
function Ye(t) {
|
|
490
|
+
return de(Ve(t));
|
|
601
491
|
}
|
|
602
|
-
async function*
|
|
492
|
+
async function* Xe(t, e) {
|
|
603
493
|
var a;
|
|
604
494
|
let o = 0, r = !0, n;
|
|
605
495
|
for await (const i of t)
|
|
@@ -624,7 +514,7 @@ async function* et(t, e) {
|
|
|
624
514
|
metadata: e
|
|
625
515
|
};
|
|
626
516
|
}
|
|
627
|
-
async function*
|
|
517
|
+
async function* Ze(t, e) {
|
|
628
518
|
let o = !1;
|
|
629
519
|
for await (const r of t) {
|
|
630
520
|
const n = r.operation;
|
|
@@ -639,7 +529,7 @@ async function* tt(t, e) {
|
|
|
639
529
|
}));
|
|
640
530
|
}
|
|
641
531
|
}
|
|
642
|
-
async function*
|
|
532
|
+
async function* Ge(t, e) {
|
|
643
533
|
for await (const o of t) {
|
|
644
534
|
if (!o.partialOperation.type) {
|
|
645
535
|
yield {
|
|
@@ -676,17 +566,17 @@ async function* ot(t, e) {
|
|
|
676
566
|
};
|
|
677
567
|
}
|
|
678
568
|
}
|
|
679
|
-
async function*
|
|
680
|
-
const o =
|
|
569
|
+
async function* Ke(t, e) {
|
|
570
|
+
const o = Ge(
|
|
681
571
|
t,
|
|
682
572
|
e
|
|
683
573
|
);
|
|
684
|
-
yield*
|
|
574
|
+
yield* Ze(
|
|
685
575
|
o,
|
|
686
576
|
(n) => {
|
|
687
577
|
if (!n.isPossiblyPartial)
|
|
688
|
-
throw new
|
|
689
|
-
`Invalid operation. ${
|
|
578
|
+
throw new J(
|
|
579
|
+
`Invalid operation. ${L(n.operation.error)}`,
|
|
690
580
|
n,
|
|
691
581
|
{
|
|
692
582
|
cause: n.operation.error
|
|
@@ -695,24 +585,24 @@ async function* rt(t, e) {
|
|
|
695
585
|
}
|
|
696
586
|
);
|
|
697
587
|
}
|
|
698
|
-
function
|
|
699
|
-
return
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
588
|
+
function Qe(t, e, o) {
|
|
589
|
+
return Ye(
|
|
590
|
+
Ke(
|
|
591
|
+
Xe(
|
|
592
|
+
de(t),
|
|
703
593
|
o
|
|
704
594
|
),
|
|
705
595
|
e
|
|
706
596
|
)
|
|
707
597
|
);
|
|
708
598
|
}
|
|
709
|
-
async function
|
|
710
|
-
const n = new
|
|
599
|
+
async function et(t, e, o, r) {
|
|
600
|
+
const n = new Je(t, r), a = We(), i = a.output.pipeTo(n.writable), s = /* @__PURE__ */ new Map();
|
|
711
601
|
let c = !0;
|
|
712
602
|
const d = e["~registerMessagesCallback"](() => {
|
|
713
|
-
|
|
603
|
+
tt(e, (S) => {
|
|
714
604
|
if (!s.has(S.toolCallId)) {
|
|
715
|
-
const y =
|
|
605
|
+
const y = ot(
|
|
716
606
|
t,
|
|
717
607
|
S.toolName,
|
|
718
608
|
S.toolCallId
|
|
@@ -740,7 +630,7 @@ async function st(t, e, o, r) {
|
|
|
740
630
|
);
|
|
741
631
|
let p;
|
|
742
632
|
if (f.status === "rejected") {
|
|
743
|
-
if (f.reason instanceof
|
|
633
|
+
if (f.reason instanceof J)
|
|
744
634
|
p = f.reason;
|
|
745
635
|
else if (!e.error)
|
|
746
636
|
throw new Error(
|
|
@@ -758,7 +648,7 @@ async function st(t, e, o, r) {
|
|
|
758
648
|
toolCallId: m[y].toolCallId,
|
|
759
649
|
state: "output-error",
|
|
760
650
|
errorText: JSON.stringify(
|
|
761
|
-
h ? { status: "error", error:
|
|
651
|
+
h ? { status: "error", error: L(p) } : { status: "not-executed-previous-tool-errored" }
|
|
762
652
|
)
|
|
763
653
|
}) : e.addToolOutput({
|
|
764
654
|
state: "output-available",
|
|
@@ -771,20 +661,20 @@ async function st(t, e, o, r) {
|
|
|
771
661
|
error: p
|
|
772
662
|
} : { ok: !0, value: void 0 };
|
|
773
663
|
}
|
|
774
|
-
function
|
|
664
|
+
function tt(t, e) {
|
|
775
665
|
var o;
|
|
776
666
|
for (const r of ((o = t.lastMessage) == null ? void 0 : o.parts) ?? []) {
|
|
777
|
-
if (!
|
|
667
|
+
if (!ge(r) || r.type.replace("tool-", "") !== "applyDocumentOperations")
|
|
778
668
|
continue;
|
|
779
669
|
const a = r.toolCallId, i = e({
|
|
780
670
|
toolName: r.type.replace("tool-", ""),
|
|
781
671
|
toolCallId: a
|
|
782
672
|
});
|
|
783
|
-
|
|
673
|
+
rt(r, i);
|
|
784
674
|
}
|
|
785
675
|
}
|
|
786
|
-
function
|
|
787
|
-
const r = new TransformStream(), n =
|
|
676
|
+
function ot(t, e, o) {
|
|
677
|
+
const r = new TransformStream(), n = Qe(
|
|
788
678
|
r.readable,
|
|
789
679
|
t,
|
|
790
680
|
{ toolCallId: o }
|
|
@@ -799,7 +689,7 @@ function it(t, e, o) {
|
|
|
799
689
|
toolCallId: o
|
|
800
690
|
};
|
|
801
691
|
}
|
|
802
|
-
function
|
|
692
|
+
function rt(t, e) {
|
|
803
693
|
if (t.state === "input-streaming") {
|
|
804
694
|
const o = t.input;
|
|
805
695
|
o !== void 0 && e.writer.write(o);
|
|
@@ -810,31 +700,31 @@ function ct(t, e) {
|
|
|
810
700
|
e.complete || (e.complete = !0, e.writer.write(o), e.writer.close());
|
|
811
701
|
}
|
|
812
702
|
}
|
|
813
|
-
async function
|
|
703
|
+
async function Lt(t, e, o, r, n) {
|
|
814
704
|
const a = o ?? t.lastMessage;
|
|
815
705
|
if (!a)
|
|
816
706
|
throw new Error("No message to send");
|
|
817
|
-
a.metadata =
|
|
707
|
+
a.metadata = X(a.metadata, {
|
|
818
708
|
documentState: e.documentState
|
|
819
709
|
});
|
|
820
|
-
const i =
|
|
710
|
+
const i = et(
|
|
821
711
|
e.streamTools,
|
|
822
712
|
t,
|
|
823
713
|
e.onStart,
|
|
824
714
|
n
|
|
825
715
|
);
|
|
826
|
-
return r =
|
|
716
|
+
return r = X(r, {
|
|
827
717
|
metadata: {
|
|
828
718
|
source: "blocknote-ai"
|
|
829
719
|
},
|
|
830
720
|
body: {
|
|
831
|
-
toolDefinitions:
|
|
832
|
-
|
|
721
|
+
toolDefinitions: await ze(
|
|
722
|
+
Ue(e.streamTools)
|
|
833
723
|
)
|
|
834
724
|
}
|
|
835
725
|
}), await t.sendMessage(o, r), await i;
|
|
836
726
|
}
|
|
837
|
-
function
|
|
727
|
+
function pe(t, e) {
|
|
838
728
|
const o = t.getTextCursorPosition(), r = [];
|
|
839
729
|
for (const n of e) {
|
|
840
730
|
const a = n.id === o.block.id;
|
|
@@ -862,20 +752,20 @@ function O(t) {
|
|
|
862
752
|
...O(e.children)
|
|
863
753
|
]);
|
|
864
754
|
}
|
|
865
|
-
function
|
|
755
|
+
function q(t) {
|
|
866
756
|
return t.map((e) => typeof e == "object" && e && "id" in e ? {
|
|
867
757
|
...e,
|
|
868
758
|
id: `${e.id}$`
|
|
869
759
|
} : e);
|
|
870
760
|
}
|
|
871
|
-
function
|
|
872
|
-
return async (e) => e.selectedBlocks ? await
|
|
761
|
+
function R(t) {
|
|
762
|
+
return async (e) => e.selectedBlocks ? await st(
|
|
873
763
|
e.editor,
|
|
874
764
|
t,
|
|
875
765
|
{
|
|
876
766
|
selectedBlocks: e.selectedBlocks
|
|
877
767
|
}
|
|
878
|
-
) : await
|
|
768
|
+
) : await nt(
|
|
879
769
|
e.editor,
|
|
880
770
|
t,
|
|
881
771
|
{
|
|
@@ -883,26 +773,26 @@ function H(t) {
|
|
|
883
773
|
}
|
|
884
774
|
);
|
|
885
775
|
}
|
|
886
|
-
async function
|
|
887
|
-
const r =
|
|
776
|
+
async function nt(t, e, o) {
|
|
777
|
+
const r = v(t.document).length === 0, n = t.getTextCursorPosition().block.id, a = v(t.document, {
|
|
888
778
|
cursorBlockId: n
|
|
889
779
|
}), i = await M(
|
|
890
780
|
O(a),
|
|
891
781
|
async (u) => e(t, u)
|
|
892
|
-
), c =
|
|
782
|
+
), c = pe(t, i).filter(
|
|
893
783
|
(u) => "cursor" in u || !(o.excludeBlockIds || []).includes(u.id)
|
|
894
784
|
);
|
|
895
785
|
return {
|
|
896
786
|
selection: !1,
|
|
897
|
-
blocks:
|
|
787
|
+
blocks: q(c),
|
|
898
788
|
isEmptyDocument: r
|
|
899
789
|
};
|
|
900
790
|
}
|
|
901
|
-
async function
|
|
902
|
-
const r =
|
|
791
|
+
async function st(t, e, o) {
|
|
792
|
+
const r = v(t.document).length === 0, n = await M(
|
|
903
793
|
O(o.selectedBlocks),
|
|
904
794
|
async (i) => e(t, i)
|
|
905
|
-
), a =
|
|
795
|
+
), a = q(n);
|
|
906
796
|
return {
|
|
907
797
|
isEmptyDocument: r,
|
|
908
798
|
selection: !0,
|
|
@@ -911,22 +801,22 @@ async function ut(t, e, o) {
|
|
|
911
801
|
// strip ids so LLM can't accidentally issue updates to ids not in selection
|
|
912
802
|
};
|
|
913
803
|
}
|
|
914
|
-
function
|
|
804
|
+
function at(t) {
|
|
915
805
|
let e, o = !1;
|
|
916
806
|
return t.descendants((r, n) => o ? !1 : (r.isText && (o = !0, e = n), !0)), e;
|
|
917
807
|
}
|
|
918
|
-
function
|
|
808
|
+
function A(t) {
|
|
919
809
|
var a;
|
|
920
|
-
const e =
|
|
810
|
+
const e = Pe(t), { modification: o } = e.marks, r = [], n = new E(t.before);
|
|
921
811
|
for (let i = 0; i < t.steps.length; i++) {
|
|
922
|
-
const s = t.steps[i], c = new
|
|
812
|
+
const s = t.steps[i], c = new ue(t.mapping.maps.slice(0, i)).invert();
|
|
923
813
|
if (s.structure) {
|
|
924
|
-
if (s instanceof
|
|
814
|
+
if (s instanceof P) {
|
|
925
815
|
if (s.to !== s.from + 1 || s.slice.openStart !== 0 || s.slice.openEnd !== 1 || s.slice.content.size !== 2)
|
|
926
816
|
throw new Error(
|
|
927
817
|
"Structure change is not in expected format (ReplaceStep)"
|
|
928
818
|
);
|
|
929
|
-
} else if (s instanceof
|
|
819
|
+
} else if (s instanceof Ae) {
|
|
930
820
|
if (s.insert !== 1 || s.slice.size !== 2 || s.gapTo !== s.to - 1 || s.gapFrom !== s.from + 1)
|
|
931
821
|
throw new Error(
|
|
932
822
|
"Structure change is not in expected format (ReplaceAroundStep)"
|
|
@@ -964,7 +854,7 @@ function _(t) {
|
|
|
964
854
|
});
|
|
965
855
|
continue;
|
|
966
856
|
}
|
|
967
|
-
if (!(s instanceof
|
|
857
|
+
if (!(s instanceof P))
|
|
968
858
|
throw new Error("Step is not a ReplaceStep");
|
|
969
859
|
const d = c.map(s.from), u = c.map(s.to);
|
|
970
860
|
if (s.slice.openStart > 0 || s.slice.openEnd > 0)
|
|
@@ -986,7 +876,7 @@ function _(t) {
|
|
|
986
876
|
else if (l.length === 0)
|
|
987
877
|
p = s.slice.content.size;
|
|
988
878
|
else {
|
|
989
|
-
const y =
|
|
879
|
+
const y = at(s.slice.content);
|
|
990
880
|
if (y === void 0)
|
|
991
881
|
throw new Error("unexpected: no first character found");
|
|
992
882
|
p = y + 1;
|
|
@@ -1000,7 +890,7 @@ function _(t) {
|
|
|
1000
890
|
const T = n.doc.resolve(n.mapping.map(d));
|
|
1001
891
|
(a = T.nodeAfter) != null && a.isBlock && n.addNodeMark(T.pos, e.mark("deletion", {})), n.addMark(T.pos, b, e.mark("deletion", {})), b = n.mapping.map(u);
|
|
1002
892
|
}
|
|
1003
|
-
const w = new
|
|
893
|
+
const w = new Ne(s.slice.content.cut(0, y), 0, 0);
|
|
1004
894
|
n.replace(m, b, w).addMark(
|
|
1005
895
|
m,
|
|
1006
896
|
m + w.content.size,
|
|
@@ -1010,7 +900,7 @@ function _(t) {
|
|
|
1010
900
|
m + w.content.size,
|
|
1011
901
|
(T, g) => g < m || g > m + w.content.size ? !0 : (T.isBlock && n.addNodeMark(g, e.mark("insertion", {})), !1)
|
|
1012
902
|
), b = n.mapping.slice(k).map(b);
|
|
1013
|
-
const x =
|
|
903
|
+
const x = Me.near(
|
|
1014
904
|
n.doc.resolve(m + w.content.size),
|
|
1015
905
|
-1
|
|
1016
906
|
);
|
|
@@ -1027,7 +917,7 @@ function _(t) {
|
|
|
1027
917
|
}
|
|
1028
918
|
return r;
|
|
1029
919
|
}
|
|
1030
|
-
async function
|
|
920
|
+
async function z(t) {
|
|
1031
921
|
const e = Math.random() * 0.3 + 0.85;
|
|
1032
922
|
if (t.type === "select")
|
|
1033
923
|
await new Promise((o) => setTimeout(o, 100 * e));
|
|
@@ -1036,9 +926,9 @@ async function F(t) {
|
|
|
1036
926
|
else if (t.type === "replace")
|
|
1037
927
|
await new Promise((o) => setTimeout(o, 200 * e));
|
|
1038
928
|
else
|
|
1039
|
-
throw new
|
|
929
|
+
throw new ve(t.type);
|
|
1040
930
|
}
|
|
1041
|
-
function
|
|
931
|
+
function H(t, e) {
|
|
1042
932
|
t.setMeta("addToHistory", !1), e.selection && t.setMeta("aiAgent", {
|
|
1043
933
|
selection: {
|
|
1044
934
|
anchor: e.selection.anchor,
|
|
@@ -1050,10 +940,10 @@ function W(t, e) {
|
|
|
1050
940
|
throw new Error("failed to apply step");
|
|
1051
941
|
return t;
|
|
1052
942
|
}
|
|
1053
|
-
function
|
|
943
|
+
function it(t, e, o) {
|
|
1054
944
|
const r = new E(e);
|
|
1055
945
|
for (const i of t) {
|
|
1056
|
-
const s = new
|
|
946
|
+
const s = new P(
|
|
1057
947
|
r.mapping.map(i.fromA),
|
|
1058
948
|
r.mapping.map(i.toA),
|
|
1059
949
|
o.slice(i.fromB, i.toB)
|
|
@@ -1082,7 +972,7 @@ function pt(t, e, o) {
|
|
|
1082
972
|
inserted: [],
|
|
1083
973
|
type: c ? "node-type-or-attr-update" : "mark-update"
|
|
1084
974
|
}), r.step(
|
|
1085
|
-
new
|
|
975
|
+
new P(
|
|
1086
976
|
a,
|
|
1087
977
|
u,
|
|
1088
978
|
o.slice(a, u),
|
|
@@ -1096,7 +986,7 @@ function pt(t, e, o) {
|
|
|
1096
986
|
}
|
|
1097
987
|
return t;
|
|
1098
988
|
}
|
|
1099
|
-
const
|
|
989
|
+
const K = (t, e) => {
|
|
1100
990
|
const o = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
1101
991
|
t.descendants((i) => {
|
|
1102
992
|
i.type.name === "tableCell" && o.add(JSON.stringify(i.toJSON()));
|
|
@@ -1125,19 +1015,19 @@ const te = (t, e) => {
|
|
|
1125
1015
|
compareTokens: (i, s) => i === s
|
|
1126
1016
|
};
|
|
1127
1017
|
};
|
|
1128
|
-
function
|
|
1129
|
-
const a =
|
|
1130
|
-
|
|
1018
|
+
function j(t, e, o = !1, r, n) {
|
|
1019
|
+
const a = Oe(t.id, e), i = new E(e);
|
|
1020
|
+
Ee(
|
|
1131
1021
|
i,
|
|
1132
1022
|
a.posBeforeNode,
|
|
1133
1023
|
t.block,
|
|
1134
1024
|
r,
|
|
1135
1025
|
n
|
|
1136
1026
|
);
|
|
1137
|
-
let s = i.doc, c =
|
|
1027
|
+
let s = i.doc, c = G.create(
|
|
1138
1028
|
e,
|
|
1139
1029
|
void 0,
|
|
1140
|
-
|
|
1030
|
+
K(e, s)
|
|
1141
1031
|
);
|
|
1142
1032
|
if (c = c.addSteps(s, i.mapping.maps, 0), o && c.changes.length > 0) {
|
|
1143
1033
|
const l = c.changes[c.changes.length - 1], f = l.toA - l.fromA, p = l.toB - l.fromB;
|
|
@@ -1147,15 +1037,15 @@ function D(t, e, o = !1, r, n) {
|
|
|
1147
1037
|
l.toA
|
|
1148
1038
|
);
|
|
1149
1039
|
i.step(
|
|
1150
|
-
new
|
|
1151
|
-
), s = i.doc, c =
|
|
1040
|
+
new P(l.toB, l.toB, b)
|
|
1041
|
+
), s = i.doc, c = G.create(
|
|
1152
1042
|
c.startDoc,
|
|
1153
1043
|
void 0,
|
|
1154
|
-
|
|
1044
|
+
K(c.startDoc, s)
|
|
1155
1045
|
), c = c.addSteps(s, i.mapping.maps, 0);
|
|
1156
1046
|
}
|
|
1157
1047
|
}
|
|
1158
|
-
const d = [], u =
|
|
1048
|
+
const d = [], u = _e(
|
|
1159
1049
|
c.changes,
|
|
1160
1050
|
s
|
|
1161
1051
|
);
|
|
@@ -1181,7 +1071,7 @@ function D(t, e, o = !1, r, n) {
|
|
|
1181
1071
|
u.splice(l, 1, b, m), l++;
|
|
1182
1072
|
}
|
|
1183
1073
|
}
|
|
1184
|
-
|
|
1074
|
+
it(u, e, s);
|
|
1185
1075
|
for (let l = 0; l < u.length; l++) {
|
|
1186
1076
|
const f = u[l], p = s.slice(f.fromB, f.toB);
|
|
1187
1077
|
if (p.openEnd > 0 && p.size > 1)
|
|
@@ -1189,7 +1079,7 @@ function D(t, e, o = !1, r, n) {
|
|
|
1189
1079
|
"unexpected, openEnd > 0 and size > 1, this should have been split into two steps"
|
|
1190
1080
|
);
|
|
1191
1081
|
l === u.length - 1 && o && f.type === "mark-update" || d.push(
|
|
1192
|
-
new
|
|
1082
|
+
new P(
|
|
1193
1083
|
f.fromA,
|
|
1194
1084
|
f.toA,
|
|
1195
1085
|
p,
|
|
@@ -1199,12 +1089,12 @@ function D(t, e, o = !1, r, n) {
|
|
|
1199
1089
|
}
|
|
1200
1090
|
return d;
|
|
1201
1091
|
}
|
|
1202
|
-
class
|
|
1092
|
+
class fe extends Error {
|
|
1203
1093
|
constructor(e, o) {
|
|
1204
1094
|
super(e, o), this.name = "AbortError";
|
|
1205
1095
|
}
|
|
1206
1096
|
}
|
|
1207
|
-
function
|
|
1097
|
+
function ct(t, e) {
|
|
1208
1098
|
if (!t || !Array.isArray(t) || t.length === 0)
|
|
1209
1099
|
return {
|
|
1210
1100
|
ok: !1,
|
|
@@ -1225,7 +1115,7 @@ function ft(t, e) {
|
|
|
1225
1115
|
value: o
|
|
1226
1116
|
};
|
|
1227
1117
|
}
|
|
1228
|
-
function
|
|
1118
|
+
function F(t) {
|
|
1229
1119
|
return (e, o) => {
|
|
1230
1120
|
const r = typeof t.schema == "function" ? t.schema(e) : t.schema;
|
|
1231
1121
|
return {
|
|
@@ -1281,7 +1171,7 @@ function V(t) {
|
|
|
1281
1171
|
ok: !1,
|
|
1282
1172
|
error: "referenceId not found"
|
|
1283
1173
|
};
|
|
1284
|
-
const s =
|
|
1174
|
+
const s = ct(
|
|
1285
1175
|
n.blocks,
|
|
1286
1176
|
(c) => t.validateBlock(c, e)
|
|
1287
1177
|
);
|
|
@@ -1309,7 +1199,7 @@ function V(t) {
|
|
|
1309
1199
|
...i,
|
|
1310
1200
|
operation: c
|
|
1311
1201
|
});
|
|
1312
|
-
if (!d || i.isPossiblyPartial &&
|
|
1202
|
+
if (!d || i.isPossiblyPartial && U(
|
|
1313
1203
|
d.blocks[d.blocks.length - 1]
|
|
1314
1204
|
))
|
|
1315
1205
|
return !0;
|
|
@@ -1317,7 +1207,7 @@ function V(t) {
|
|
|
1317
1207
|
const f = d.blocks[l], p = e.prosemirrorState.tr;
|
|
1318
1208
|
let b = [];
|
|
1319
1209
|
if (l < n.length) {
|
|
1320
|
-
const m = await t.rebaseTool(n[l], e), y =
|
|
1210
|
+
const m = await t.rebaseTool(n[l], e), y = j(
|
|
1321
1211
|
{
|
|
1322
1212
|
id: n[l],
|
|
1323
1213
|
block: f
|
|
@@ -1327,23 +1217,23 @@ function V(t) {
|
|
|
1327
1217
|
).map((h) => h.map(m.invertMap));
|
|
1328
1218
|
for (const h of y)
|
|
1329
1219
|
p.step(h.map(p.mapping));
|
|
1330
|
-
b =
|
|
1220
|
+
b = A(p), b = b.filter(
|
|
1331
1221
|
(h) => h.type !== "select"
|
|
1332
1222
|
);
|
|
1333
1223
|
} else {
|
|
1334
|
-
const m = c.position === "after" ? a[c.referenceId] : void 0, S =
|
|
1224
|
+
const m = c.position === "after" ? a[c.referenceId] : void 0, S = xe(
|
|
1335
1225
|
p,
|
|
1336
1226
|
[f],
|
|
1337
1227
|
l > 0 ? n[l - 1] : m || c.referenceId,
|
|
1338
1228
|
l > 0 ? "after" : c.position
|
|
1339
1229
|
);
|
|
1340
|
-
n.push(...S.map((y) => y.id)), b =
|
|
1230
|
+
n.push(...S.map((y) => y.id)), b = A(p);
|
|
1341
1231
|
}
|
|
1342
1232
|
for (const m of b) {
|
|
1343
1233
|
if (s != null && s.aborted)
|
|
1344
|
-
throw new
|
|
1345
|
-
o.withDelays && await
|
|
1346
|
-
|
|
1234
|
+
throw new fe("Operation was aborted");
|
|
1235
|
+
o.withDelays && await z(m), e.transact((S) => {
|
|
1236
|
+
H(S, m);
|
|
1347
1237
|
}), (u = o.onBlockUpdate) == null || u.call(o, n[l]);
|
|
1348
1238
|
}
|
|
1349
1239
|
}
|
|
@@ -1354,7 +1244,7 @@ function V(t) {
|
|
|
1354
1244
|
};
|
|
1355
1245
|
};
|
|
1356
1246
|
}
|
|
1357
|
-
function
|
|
1247
|
+
function W(t) {
|
|
1358
1248
|
return (e, o) => {
|
|
1359
1249
|
const r = typeof t.schema == "function" ? t.schema(e) : t.schema;
|
|
1360
1250
|
return {
|
|
@@ -1422,8 +1312,8 @@ function Y(t) {
|
|
|
1422
1312
|
executor: () => {
|
|
1423
1313
|
let a = 50;
|
|
1424
1314
|
const i = o.updateSelection ? {
|
|
1425
|
-
from:
|
|
1426
|
-
to:
|
|
1315
|
+
from: Z(e, o.updateSelection.from),
|
|
1316
|
+
to: Z(e, o.updateSelection.to)
|
|
1427
1317
|
} : void 0;
|
|
1428
1318
|
return {
|
|
1429
1319
|
execute: async (s, c) => {
|
|
@@ -1444,7 +1334,7 @@ function Y(t) {
|
|
|
1444
1334
|
});
|
|
1445
1335
|
if (!p)
|
|
1446
1336
|
return !0;
|
|
1447
|
-
const b =
|
|
1337
|
+
const b = j(
|
|
1448
1338
|
p,
|
|
1449
1339
|
u.doc,
|
|
1450
1340
|
s.isPossiblyPartial,
|
|
@@ -1456,12 +1346,12 @@ function Y(t) {
|
|
|
1456
1346
|
const m = b.map((k) => k.map(u.invertMap)), S = new E(e.prosemirrorState.doc);
|
|
1457
1347
|
for (const k of m)
|
|
1458
1348
|
S.step(k.map(S.mapping));
|
|
1459
|
-
const y =
|
|
1349
|
+
const y = A(S);
|
|
1460
1350
|
for (const k of y) {
|
|
1461
1351
|
if (c != null && c.aborted)
|
|
1462
|
-
throw new
|
|
1463
|
-
o.withDelays && await
|
|
1464
|
-
|
|
1352
|
+
throw new fe("Operation was aborted");
|
|
1353
|
+
o.withDelays && await z(k), e.transact((w) => {
|
|
1354
|
+
H(w, k);
|
|
1465
1355
|
}), (h = o.onBlockUpdate) == null || h.call(o, d.id);
|
|
1466
1356
|
}
|
|
1467
1357
|
return !0;
|
|
@@ -1471,7 +1361,7 @@ function Y(t) {
|
|
|
1471
1361
|
};
|
|
1472
1362
|
};
|
|
1473
1363
|
}
|
|
1474
|
-
const
|
|
1364
|
+
const V = (t, e) => ({
|
|
1475
1365
|
name: "delete",
|
|
1476
1366
|
description: "Delete a block",
|
|
1477
1367
|
inputSchema: {
|
|
@@ -1527,17 +1417,17 @@ const X = (t, e) => ({
|
|
|
1527
1417
|
if (o.operation.type !== "delete")
|
|
1528
1418
|
return !1;
|
|
1529
1419
|
const r = o.operation, n = t.prosemirrorState.tr;
|
|
1530
|
-
|
|
1531
|
-
const a =
|
|
1420
|
+
Be(n, [r.id], []);
|
|
1421
|
+
const a = A(n);
|
|
1532
1422
|
for (const s of a)
|
|
1533
|
-
e.withDelays && await
|
|
1534
|
-
|
|
1423
|
+
e.withDelays && await z(s), t.transact((c) => {
|
|
1424
|
+
H(c, s);
|
|
1535
1425
|
}), (i = e.onBlockUpdate) == null || i.call(e, r.id);
|
|
1536
1426
|
return !0;
|
|
1537
1427
|
}
|
|
1538
1428
|
})
|
|
1539
1429
|
});
|
|
1540
|
-
function
|
|
1430
|
+
function Q(t) {
|
|
1541
1431
|
const e = t.lastIndexOf("<"), o = t.lastIndexOf(">");
|
|
1542
1432
|
let r = t;
|
|
1543
1433
|
if (e > o && (r = t.substring(0, e), !r.trim()))
|
|
@@ -1553,15 +1443,15 @@ function oe(t) {
|
|
|
1553
1443
|
).body.firstChild;
|
|
1554
1444
|
return s ? s.innerHTML : "";
|
|
1555
1445
|
}
|
|
1556
|
-
function
|
|
1446
|
+
function _(t) {
|
|
1557
1447
|
let e;
|
|
1558
|
-
if (
|
|
1448
|
+
if ($e(t.prosemirrorState, (o) => {
|
|
1559
1449
|
e = o;
|
|
1560
1450
|
}), !e)
|
|
1561
1451
|
throw new Error("applySuggestionsTr is not set");
|
|
1562
1452
|
return e;
|
|
1563
1453
|
}
|
|
1564
|
-
function
|
|
1454
|
+
function $(t, e) {
|
|
1565
1455
|
const o = e.mapping.invert();
|
|
1566
1456
|
return {
|
|
1567
1457
|
doc: e.doc,
|
|
@@ -1593,9 +1483,9 @@ function j(t, e) {
|
|
|
1593
1483
|
}
|
|
1594
1484
|
};
|
|
1595
1485
|
}
|
|
1596
|
-
async function
|
|
1486
|
+
async function ee(t, e) {
|
|
1597
1487
|
var d;
|
|
1598
|
-
const o =
|
|
1488
|
+
const o = _(e), r = ce(o.doc, t);
|
|
1599
1489
|
if (!r)
|
|
1600
1490
|
throw new Error("block not found");
|
|
1601
1491
|
const n = await e.blocksToHTMLLossy([
|
|
@@ -1607,7 +1497,7 @@ async function re(t, e) {
|
|
|
1607
1497
|
if (window.__TEST_OPTIONS && (window.__TEST_OPTIONS.mockID = a), i.length !== 1)
|
|
1608
1498
|
throw new Error("html diff invalid block count");
|
|
1609
1499
|
const s = i[0];
|
|
1610
|
-
if (s.id = t,
|
|
1500
|
+
if (s.id = t, j(
|
|
1611
1501
|
{
|
|
1612
1502
|
id: t,
|
|
1613
1503
|
block: s
|
|
@@ -1620,9 +1510,9 @@ async function re(t, e) {
|
|
|
1620
1510
|
htmlBlock: s
|
|
1621
1511
|
}
|
|
1622
1512
|
});
|
|
1623
|
-
return
|
|
1513
|
+
return $(e, o);
|
|
1624
1514
|
}
|
|
1625
|
-
function
|
|
1515
|
+
function te(t) {
|
|
1626
1516
|
return typeof t != "string" ? {
|
|
1627
1517
|
ok: !1,
|
|
1628
1518
|
error: "block must be a string"
|
|
@@ -1632,7 +1522,7 @@ function ne(t) {
|
|
|
1632
1522
|
};
|
|
1633
1523
|
}
|
|
1634
1524
|
const B = {
|
|
1635
|
-
add:
|
|
1525
|
+
add: F({
|
|
1636
1526
|
description: "Insert new blocks",
|
|
1637
1527
|
schema: {
|
|
1638
1528
|
block: {
|
|
@@ -1640,13 +1530,13 @@ const B = {
|
|
|
1640
1530
|
description: "html of block (MUST be a single, VALID HTML element)"
|
|
1641
1531
|
}
|
|
1642
1532
|
},
|
|
1643
|
-
validateBlock:
|
|
1644
|
-
rebaseTool:
|
|
1533
|
+
validateBlock: te,
|
|
1534
|
+
rebaseTool: ee,
|
|
1645
1535
|
toJSONToolCall: async (t, e) => {
|
|
1646
1536
|
var n;
|
|
1647
1537
|
const o = (n = window.__TEST_OPTIONS) == null ? void 0 : n.mockID, r = (await Promise.all(
|
|
1648
1538
|
e.operation.blocks.map(async (a) => {
|
|
1649
|
-
const i = e.isPossiblyPartial ?
|
|
1539
|
+
const i = e.isPossiblyPartial ? Q(a) : a;
|
|
1650
1540
|
return i ? (await t.tryParseHTMLToBlocks(i)).map(
|
|
1651
1541
|
(s) => (delete s.id, s)
|
|
1652
1542
|
) : [];
|
|
@@ -1659,7 +1549,7 @@ const B = {
|
|
|
1659
1549
|
};
|
|
1660
1550
|
}
|
|
1661
1551
|
}),
|
|
1662
|
-
update:
|
|
1552
|
+
update: W({
|
|
1663
1553
|
description: "Update a block",
|
|
1664
1554
|
schema: {
|
|
1665
1555
|
block: {
|
|
@@ -1667,10 +1557,10 @@ const B = {
|
|
|
1667
1557
|
description: "html of block (MUST be a single HTML element)"
|
|
1668
1558
|
}
|
|
1669
1559
|
},
|
|
1670
|
-
validateBlock:
|
|
1671
|
-
rebaseTool:
|
|
1560
|
+
validateBlock: te,
|
|
1561
|
+
rebaseTool: ee,
|
|
1672
1562
|
toJSONToolCall: async (t, e) => {
|
|
1673
|
-
const o = e.isPossiblyPartial ?
|
|
1563
|
+
const o = e.isPossiblyPartial ? Q(e.operation.block) : e.operation.block;
|
|
1674
1564
|
if (!o)
|
|
1675
1565
|
return;
|
|
1676
1566
|
const r = (await t.tryParseHTMLToBlocks(o))[0];
|
|
@@ -1680,9 +1570,9 @@ const B = {
|
|
|
1680
1570
|
};
|
|
1681
1571
|
}
|
|
1682
1572
|
}),
|
|
1683
|
-
delete:
|
|
1573
|
+
delete: V
|
|
1684
1574
|
};
|
|
1685
|
-
function
|
|
1575
|
+
function lt(t, e, o, r, n) {
|
|
1686
1576
|
if (typeof r == "boolean") {
|
|
1687
1577
|
const s = r ? t.getSelectionCutBlocks(!0) : void 0;
|
|
1688
1578
|
r = s ? {
|
|
@@ -1708,7 +1598,7 @@ function mt(t, e, o, r, n) {
|
|
|
1708
1598
|
...a.delete ? [B.delete(t, { idsSuffixed: !0, withDelays: e, onBlockUpdate: n })] : []
|
|
1709
1599
|
];
|
|
1710
1600
|
}
|
|
1711
|
-
const
|
|
1601
|
+
const ut = `You're manipulating a text document using HTML blocks.
|
|
1712
1602
|
Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $).
|
|
1713
1603
|
List items are 1 block with 1 list item each, so block content \`<ul><li>item1</li></ul>\` is valid, but \`<ul><li>item1</li><li>item2</li></ul>\` is invalid. We'll merge them automatically.
|
|
1714
1604
|
For code blocks, you can use the \`data-language\` attribute on a <code> block (wrapped with <pre>) to specify the language.
|
|
@@ -1719,12 +1609,12 @@ IF there is no selection active in the latest state, first, determine what part
|
|
|
1719
1609
|
EXAMPLE: if user says "below" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor.
|
|
1720
1610
|
EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need \`referenceId\` to point to the block before the cursor with position \`after\` (or block below and \`before\`
|
|
1721
1611
|
---
|
|
1722
|
-
`,
|
|
1612
|
+
`, dt = {
|
|
1723
1613
|
/**
|
|
1724
1614
|
* Function to get the stream tools that can apply HTML block updates to the editor
|
|
1725
1615
|
*/
|
|
1726
1616
|
getStreamToolsProvider: (t = {}) => ({
|
|
1727
|
-
getStreamTools: (e, o, r) =>
|
|
1617
|
+
getStreamTools: (e, o, r) => lt(
|
|
1728
1618
|
e,
|
|
1729
1619
|
t.withDelays ?? !0,
|
|
1730
1620
|
t.defaultStreamTools,
|
|
@@ -1732,16 +1622,16 @@ IF there is no selection active in the latest state, first, determine what part
|
|
|
1732
1622
|
r
|
|
1733
1623
|
)
|
|
1734
1624
|
}),
|
|
1735
|
-
systemPrompt:
|
|
1625
|
+
systemPrompt: ut,
|
|
1736
1626
|
tools: B,
|
|
1737
1627
|
/**
|
|
1738
1628
|
* The default DocumentStateBuilder that can take an editor and convert it to a document state that can be passed to the backend
|
|
1739
1629
|
*/
|
|
1740
|
-
defaultDocumentStateBuilder:
|
|
1630
|
+
defaultDocumentStateBuilder: R(
|
|
1741
1631
|
async (t, e) => t.blocksToHTMLLossy([e])
|
|
1742
1632
|
)
|
|
1743
1633
|
};
|
|
1744
|
-
function
|
|
1634
|
+
function pt(t) {
|
|
1745
1635
|
const e = {}, o = {};
|
|
1746
1636
|
return t.forEach((n) => {
|
|
1747
1637
|
const { type: a, ...i } = n.properties, s = JSON.stringify(i);
|
|
@@ -1762,7 +1652,7 @@ function bt(t) {
|
|
|
1762
1652
|
};
|
|
1763
1653
|
});
|
|
1764
1654
|
}
|
|
1765
|
-
function
|
|
1655
|
+
function ft(t) {
|
|
1766
1656
|
return {
|
|
1767
1657
|
type: "object",
|
|
1768
1658
|
properties: Object.fromEntries(
|
|
@@ -1776,7 +1666,7 @@ function St(t) {
|
|
|
1776
1666
|
additionalProperties: !1
|
|
1777
1667
|
};
|
|
1778
1668
|
}
|
|
1779
|
-
function
|
|
1669
|
+
function mt() {
|
|
1780
1670
|
return {
|
|
1781
1671
|
type: "object",
|
|
1782
1672
|
properties: {
|
|
@@ -1795,7 +1685,7 @@ function kt() {
|
|
|
1795
1685
|
required: ["type", "text"]
|
|
1796
1686
|
};
|
|
1797
1687
|
}
|
|
1798
|
-
function
|
|
1688
|
+
function me(t) {
|
|
1799
1689
|
return {
|
|
1800
1690
|
type: "object",
|
|
1801
1691
|
properties: Object.fromEntries(
|
|
@@ -1810,7 +1700,7 @@ function be(t) {
|
|
|
1810
1700
|
additionalProperties: !1
|
|
1811
1701
|
};
|
|
1812
1702
|
}
|
|
1813
|
-
function
|
|
1703
|
+
function ht(t) {
|
|
1814
1704
|
return {
|
|
1815
1705
|
type: "array",
|
|
1816
1706
|
items: {
|
|
@@ -1848,7 +1738,7 @@ function wt(t) {
|
|
|
1848
1738
|
$ref: "#/$defs/styledtext"
|
|
1849
1739
|
}
|
|
1850
1740
|
} : void 0,
|
|
1851
|
-
props:
|
|
1741
|
+
props: me(o.propSchema)
|
|
1852
1742
|
},
|
|
1853
1743
|
additionalProperties: !1,
|
|
1854
1744
|
required: ["type", ...o.content === "styled" ? ["content"] : []]
|
|
@@ -1856,9 +1746,9 @@ function wt(t) {
|
|
|
1856
1746
|
}
|
|
1857
1747
|
};
|
|
1858
1748
|
}
|
|
1859
|
-
function
|
|
1749
|
+
function yt(t) {
|
|
1860
1750
|
return {
|
|
1861
|
-
anyOf:
|
|
1751
|
+
anyOf: pt(
|
|
1862
1752
|
Object.entries(t).map(([e, o]) => ({
|
|
1863
1753
|
type: "object",
|
|
1864
1754
|
properties: {
|
|
@@ -1868,7 +1758,7 @@ function gt(t) {
|
|
|
1868
1758
|
},
|
|
1869
1759
|
content: o.content === "inline" ? { $ref: "#/$defs/inlinecontent" } : o.content === "table" ? { type: "object", properties: {} } : void 0,
|
|
1870
1760
|
// filter out default props (TODO: make option)
|
|
1871
|
-
props:
|
|
1761
|
+
props: me(o.propSchema)
|
|
1872
1762
|
// Object.fromEntries(
|
|
1873
1763
|
// Object.entries(val.propSchema).filter(
|
|
1874
1764
|
// (key) => typeof (defaultProps as any)[key[0]] === "undefined"
|
|
@@ -1883,7 +1773,7 @@ function gt(t) {
|
|
|
1883
1773
|
)
|
|
1884
1774
|
};
|
|
1885
1775
|
}
|
|
1886
|
-
function
|
|
1776
|
+
function bt(t) {
|
|
1887
1777
|
const e = JSON.parse(
|
|
1888
1778
|
JSON.stringify({
|
|
1889
1779
|
blockSchema: t.blockSchema,
|
|
@@ -1911,7 +1801,7 @@ function Tt(t) {
|
|
|
1911
1801
|
...r,
|
|
1912
1802
|
propSchema: Object.fromEntries(
|
|
1913
1803
|
Object.entries(r.propSchema).filter(
|
|
1914
|
-
(n) => typeof
|
|
1804
|
+
(n) => typeof le[n[0]] > "u"
|
|
1915
1805
|
)
|
|
1916
1806
|
)
|
|
1917
1807
|
}
|
|
@@ -1923,22 +1813,22 @@ function Tt(t) {
|
|
|
1923
1813
|
}
|
|
1924
1814
|
};
|
|
1925
1815
|
}
|
|
1926
|
-
function
|
|
1927
|
-
return t =
|
|
1816
|
+
function oe(t) {
|
|
1817
|
+
return t = bt(t).removeFileBlocks().removeDefaultProps().get(), {
|
|
1928
1818
|
$defs: {
|
|
1929
|
-
styles:
|
|
1930
|
-
styledtext:
|
|
1931
|
-
inlinecontent:
|
|
1819
|
+
styles: ft(t.styleSchema),
|
|
1820
|
+
styledtext: mt(),
|
|
1821
|
+
inlinecontent: ht(
|
|
1932
1822
|
t.inlineContentSchema
|
|
1933
1823
|
),
|
|
1934
|
-
block:
|
|
1824
|
+
block: yt(t.blockSchema)
|
|
1935
1825
|
}
|
|
1936
1826
|
};
|
|
1937
1827
|
}
|
|
1938
|
-
function
|
|
1939
|
-
return !e.schema.inlineContentSchema[t.type] ||
|
|
1828
|
+
function he(t, e) {
|
|
1829
|
+
return !e.schema.inlineContentSchema[t.type] || Ce(t) && !("text" in t) ? !1 : Ie(t) ? !("content" in t) || !("href" in t) ? !1 : he(t.content, e) : !0;
|
|
1940
1830
|
}
|
|
1941
|
-
function
|
|
1831
|
+
function re(t, e, o) {
|
|
1942
1832
|
const r = t.type || o, n = e.schema.blockSchema[r];
|
|
1943
1833
|
if (!n)
|
|
1944
1834
|
return {
|
|
@@ -1967,7 +1857,7 @@ function ae(t, e, o) {
|
|
|
1967
1857
|
ok: !0,
|
|
1968
1858
|
value: t
|
|
1969
1859
|
};
|
|
1970
|
-
if (!t.content.every((a) =>
|
|
1860
|
+
if (!t.content.every((a) => he(a, e)))
|
|
1971
1861
|
return {
|
|
1972
1862
|
ok: !1,
|
|
1973
1863
|
error: "block content must be an array of inline content"
|
|
@@ -1979,31 +1869,31 @@ function ae(t, e, o) {
|
|
|
1979
1869
|
};
|
|
1980
1870
|
}
|
|
1981
1871
|
const C = {
|
|
1982
|
-
add:
|
|
1872
|
+
add: F({
|
|
1983
1873
|
description: "Insert new blocks",
|
|
1984
1874
|
schema: (t) => ({
|
|
1985
1875
|
block: {
|
|
1986
1876
|
$ref: "#/$defs/block"
|
|
1987
1877
|
},
|
|
1988
|
-
...
|
|
1878
|
+
...oe(t.schema)
|
|
1989
1879
|
}),
|
|
1990
|
-
validateBlock:
|
|
1991
|
-
rebaseTool: async (t, e) =>
|
|
1880
|
+
validateBlock: re,
|
|
1881
|
+
rebaseTool: async (t, e) => $(e, _(e)),
|
|
1992
1882
|
toJSONToolCall: async (t, e) => e.operation
|
|
1993
1883
|
}),
|
|
1994
|
-
update:
|
|
1884
|
+
update: W({
|
|
1995
1885
|
description: "Update a block, the new block will replace the existing block.",
|
|
1996
1886
|
schema: (t) => ({
|
|
1997
1887
|
block: {
|
|
1998
1888
|
$ref: "#/$defs/block"
|
|
1999
1889
|
},
|
|
2000
|
-
...
|
|
1890
|
+
...oe(t.schema)
|
|
2001
1891
|
}),
|
|
2002
|
-
validateBlock:
|
|
2003
|
-
rebaseTool: async (t, e) =>
|
|
1892
|
+
validateBlock: re,
|
|
1893
|
+
rebaseTool: async (t, e) => $(e, _(e)),
|
|
2004
1894
|
toJSONToolCall: async (t, e) => {
|
|
2005
1895
|
const o = Object.fromEntries(
|
|
2006
|
-
Object.entries(
|
|
1896
|
+
Object.entries(le).map(([r, n]) => [r, n.default])
|
|
2007
1897
|
);
|
|
2008
1898
|
return {
|
|
2009
1899
|
...e.operation,
|
|
@@ -2017,9 +1907,9 @@ const C = {
|
|
|
2017
1907
|
};
|
|
2018
1908
|
}
|
|
2019
1909
|
}),
|
|
2020
|
-
delete:
|
|
1910
|
+
delete: V
|
|
2021
1911
|
};
|
|
2022
|
-
function
|
|
1912
|
+
function St(t, e, o, r, n) {
|
|
2023
1913
|
if (typeof r == "boolean") {
|
|
2024
1914
|
const s = r ? t.getSelectionCutBlocks(!0) : void 0;
|
|
2025
1915
|
r = s ? {
|
|
@@ -2045,7 +1935,7 @@ function vt(t, e, o, r, n) {
|
|
|
2045
1935
|
...a.delete ? [C.delete(t, { idsSuffixed: !0, withDelays: e, onBlockUpdate: n })] : []
|
|
2046
1936
|
];
|
|
2047
1937
|
}
|
|
2048
|
-
const
|
|
1938
|
+
const kt = `You're manipulating a text document using JSON blocks.
|
|
2049
1939
|
Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $).
|
|
2050
1940
|
|
|
2051
1941
|
If the user requests updates to the document, use the "applyDocumentOperations" tool to update the document.
|
|
@@ -2054,12 +1944,12 @@ IF there is no selection active in the latest state, first, determine what part
|
|
|
2054
1944
|
EXAMPLE: if user says "below" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor.
|
|
2055
1945
|
EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need \`referenceId\` to point to the block before the cursor with position \`after\` (or block below and \`before\`
|
|
2056
1946
|
---
|
|
2057
|
-
`,
|
|
1947
|
+
`, wt = {
|
|
2058
1948
|
/**
|
|
2059
1949
|
* Function to get the stream tools that can apply JSON block updates to the editor
|
|
2060
1950
|
*/
|
|
2061
1951
|
getStreamToolsProvider: (t = {}) => ({
|
|
2062
|
-
getStreamTools: (e, o, r) =>
|
|
1952
|
+
getStreamTools: (e, o, r) => St(
|
|
2063
1953
|
e,
|
|
2064
1954
|
t.withDelays ?? !0,
|
|
2065
1955
|
t.defaultStreamTools,
|
|
@@ -2068,8 +1958,8 @@ IF there is no selection active in the latest state, first, determine what part
|
|
|
2068
1958
|
)
|
|
2069
1959
|
}),
|
|
2070
1960
|
tools: C,
|
|
2071
|
-
systemPrompt:
|
|
2072
|
-
defaultDocumentStateBuilder:
|
|
1961
|
+
systemPrompt: kt,
|
|
1962
|
+
defaultDocumentStateBuilder: R(
|
|
2073
1963
|
async (t, e) => ({
|
|
2074
1964
|
...e,
|
|
2075
1965
|
id: void 0,
|
|
@@ -2078,23 +1968,23 @@ IF there is no selection active in the latest state, first, determine what part
|
|
|
2078
1968
|
})
|
|
2079
1969
|
)
|
|
2080
1970
|
};
|
|
2081
|
-
async function
|
|
2082
|
-
const o =
|
|
1971
|
+
async function ne(t, e) {
|
|
1972
|
+
const o = _(e), r = await e.blocksToMarkdownLossy([ce(o.doc, t)]), n = await e.tryParseMarkdownToBlocks(r), a = j(
|
|
2083
1973
|
{
|
|
2084
1974
|
id: t,
|
|
2085
1975
|
block: n[0]
|
|
2086
1976
|
},
|
|
2087
1977
|
o.doc
|
|
2088
|
-
), i = new
|
|
1978
|
+
), i = new ue();
|
|
2089
1979
|
for (const s of a) {
|
|
2090
1980
|
const c = s.map(i);
|
|
2091
1981
|
if (!c)
|
|
2092
1982
|
throw new Error("Failed to map step");
|
|
2093
1983
|
o.step(c), i.appendMap(c.getMap());
|
|
2094
1984
|
}
|
|
2095
|
-
return
|
|
1985
|
+
return $(e, o);
|
|
2096
1986
|
}
|
|
2097
|
-
function
|
|
1987
|
+
function se(t) {
|
|
2098
1988
|
return typeof t != "string" ? {
|
|
2099
1989
|
ok: !1,
|
|
2100
1990
|
error: "block must be a string"
|
|
@@ -2104,7 +1994,7 @@ function ce(t) {
|
|
|
2104
1994
|
};
|
|
2105
1995
|
}
|
|
2106
1996
|
const I = {
|
|
2107
|
-
add:
|
|
1997
|
+
add: F({
|
|
2108
1998
|
description: "Insert new blocks",
|
|
2109
1999
|
schema: {
|
|
2110
2000
|
block: {
|
|
@@ -2114,8 +2004,8 @@ const I = {
|
|
|
2114
2004
|
block: { type: "string", description: "markdown of block" }
|
|
2115
2005
|
}
|
|
2116
2006
|
},
|
|
2117
|
-
validateBlock:
|
|
2118
|
-
rebaseTool:
|
|
2007
|
+
validateBlock: se,
|
|
2008
|
+
rebaseTool: ne,
|
|
2119
2009
|
toJSONToolCall: async (t, e) => {
|
|
2120
2010
|
const o = await Promise.all(
|
|
2121
2011
|
e.operation.blocks.map(async (r) => {
|
|
@@ -2129,7 +2019,7 @@ const I = {
|
|
|
2129
2019
|
};
|
|
2130
2020
|
}
|
|
2131
2021
|
}),
|
|
2132
|
-
update:
|
|
2022
|
+
update: W({
|
|
2133
2023
|
description: "Update a block, the new block will replace the existing block.",
|
|
2134
2024
|
schema: {
|
|
2135
2025
|
block: {
|
|
@@ -2139,8 +2029,8 @@ const I = {
|
|
|
2139
2029
|
block: { type: "string", description: "markdown of block" }
|
|
2140
2030
|
}
|
|
2141
2031
|
},
|
|
2142
|
-
validateBlock:
|
|
2143
|
-
rebaseTool:
|
|
2032
|
+
validateBlock: se,
|
|
2033
|
+
rebaseTool: ne,
|
|
2144
2034
|
toJSONToolCall: async (t, e) => {
|
|
2145
2035
|
const o = (await t.tryParseMarkdownToBlocks(e.operation.block.trim()))[0];
|
|
2146
2036
|
return delete o.id, window.__TEST_OPTIONS && (window.__TEST_OPTIONS.mockID = void 0), {
|
|
@@ -2149,9 +2039,9 @@ const I = {
|
|
|
2149
2039
|
};
|
|
2150
2040
|
}
|
|
2151
2041
|
}),
|
|
2152
|
-
delete:
|
|
2042
|
+
delete: V
|
|
2153
2043
|
};
|
|
2154
|
-
function
|
|
2044
|
+
function gt(t, e, o, r, n) {
|
|
2155
2045
|
if (typeof r == "boolean") {
|
|
2156
2046
|
const s = r ? t.getSelectionCutBlocks(!0) : void 0;
|
|
2157
2047
|
r = s ? {
|
|
@@ -2177,7 +2067,7 @@ function Et(t, e, o, r, n) {
|
|
|
2177
2067
|
...a.delete ? [I.delete(t, { idsSuffixed: !0, withDelays: e, onBlockUpdate: n })] : []
|
|
2178
2068
|
];
|
|
2179
2069
|
}
|
|
2180
|
-
const
|
|
2070
|
+
const Tt = `You're manipulating a text document using Markdown blocks.
|
|
2181
2071
|
Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $).
|
|
2182
2072
|
List items are 1 block with 1 list item each, so block content \`- item1\` is valid, but \`- item1
|
|
2183
2073
|
- item2\` is invalid. We'll merge them automatically.
|
|
@@ -2188,12 +2078,12 @@ IF there is no selection active in the latest state, first, determine what part
|
|
|
2188
2078
|
EXAMPLE: if user says "below" (without pointing to a specific part of the document) he / she probably indicates the block(s) after the cursor.
|
|
2189
2079
|
EXAMPLE: If you want to insert content AT the cursor position (UNLESS indicated otherwise by the user), then you need \`referenceId\` to point to the block before the cursor with position \`after\` (or block below and \`before\`
|
|
2190
2080
|
---
|
|
2191
|
-
`,
|
|
2081
|
+
`, Pt = {
|
|
2192
2082
|
/**
|
|
2193
2083
|
* Function to get the stream tools that can apply Markdown block updates to the editor
|
|
2194
2084
|
*/
|
|
2195
2085
|
getStreamToolsProvider: (t = {}) => ({
|
|
2196
|
-
getStreamTools: (e, o, r) =>
|
|
2086
|
+
getStreamTools: (e, o, r) => gt(
|
|
2197
2087
|
e,
|
|
2198
2088
|
t.withDelays ?? !0,
|
|
2199
2089
|
t.defaultStreamTools,
|
|
@@ -2201,28 +2091,28 @@ IF there is no selection active in the latest state, first, determine what part
|
|
|
2201
2091
|
r
|
|
2202
2092
|
)
|
|
2203
2093
|
}),
|
|
2204
|
-
systemPrompt:
|
|
2094
|
+
systemPrompt: Tt,
|
|
2205
2095
|
tools: I,
|
|
2206
|
-
defaultDocumentStateBuilder:
|
|
2096
|
+
defaultDocumentStateBuilder: R(
|
|
2207
2097
|
async (t, e) => t.blocksToMarkdownLossy([e])
|
|
2208
2098
|
)
|
|
2209
|
-
},
|
|
2210
|
-
_experimental_json:
|
|
2211
|
-
_experimental_markdown:
|
|
2212
|
-
html:
|
|
2213
|
-
},
|
|
2214
|
-
addCursorPosition:
|
|
2099
|
+
}, ae = {
|
|
2100
|
+
_experimental_json: wt,
|
|
2101
|
+
_experimental_markdown: Pt,
|
|
2102
|
+
html: dt
|
|
2103
|
+
}, Ut = {
|
|
2104
|
+
addCursorPosition: pe,
|
|
2215
2105
|
flattenBlocks: O,
|
|
2216
|
-
suffixIDs:
|
|
2217
|
-
trimEmptyBlocks:
|
|
2106
|
+
suffixIDs: q,
|
|
2107
|
+
trimEmptyBlocks: v,
|
|
2218
2108
|
convertBlocks: M
|
|
2219
2109
|
};
|
|
2220
|
-
function
|
|
2110
|
+
function Jt(t) {
|
|
2221
2111
|
if (!t.dictionary.ai)
|
|
2222
2112
|
throw new Error("AI dictionary not found");
|
|
2223
2113
|
return t.dictionary.ai;
|
|
2224
2114
|
}
|
|
2225
|
-
const
|
|
2115
|
+
const qt = (t) => async (e, o) => {
|
|
2226
2116
|
const r = new Request(e, o), n = t(r.url), a = new Request(n, {
|
|
2227
2117
|
headers: r.headers,
|
|
2228
2118
|
// if we just pass request.body, it's a readablestream which is not visible in chrome inspector,
|
|
@@ -2234,26 +2124,24 @@ const Ft = (t) => async (e, o) => {
|
|
|
2234
2124
|
return await fetch(a);
|
|
2235
2125
|
};
|
|
2236
2126
|
export {
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
Rt as s,
|
|
2257
|
-
Ye as t
|
|
2127
|
+
Dt as C,
|
|
2128
|
+
Fe as P,
|
|
2129
|
+
Je as S,
|
|
2130
|
+
ae as a,
|
|
2131
|
+
$t as b,
|
|
2132
|
+
Jt as c,
|
|
2133
|
+
Le as d,
|
|
2134
|
+
Ue as e,
|
|
2135
|
+
qt as f,
|
|
2136
|
+
_ as g,
|
|
2137
|
+
jt as h,
|
|
2138
|
+
et as i,
|
|
2139
|
+
Re as j,
|
|
2140
|
+
He as k,
|
|
2141
|
+
R as m,
|
|
2142
|
+
Qe as o,
|
|
2143
|
+
Ut as p,
|
|
2144
|
+
Lt as s,
|
|
2145
|
+
ze as t
|
|
2258
2146
|
};
|
|
2259
|
-
//# sourceMappingURL=client-
|
|
2147
|
+
//# sourceMappingURL=client-De9NkxJ-.js.map
|