@blocknote/xl-ai 0.44.2 → 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.
Files changed (251) hide show
  1. package/dist/blocknote-xl-ai.cjs +1 -1
  2. package/dist/blocknote-xl-ai.cjs.map +1 -1
  3. package/dist/blocknote-xl-ai.js +147 -149
  4. package/dist/blocknote-xl-ai.js.map +1 -1
  5. package/dist/client-BPNTLm1-.cjs +36 -0
  6. package/dist/client-BPNTLm1-.cjs.map +1 -0
  7. package/dist/{client-ChPl2nQr.js → client-De9NkxJ-.js} +288 -387
  8. package/dist/client-De9NkxJ-.js.map +1 -0
  9. package/dist/server.cjs +1 -1
  10. package/dist/server.js +12 -14
  11. package/dist/webpack-stats.json +1 -1
  12. package/package.json +17 -17
  13. package/src/AIExtension.ts +9 -3
  14. package/src/api/aiRequest/builder.ts +1 -1
  15. package/src/api/aiRequest/sendMessageWithAIRequest.ts +1 -1
  16. package/src/api/formats/base-tools/createUpdateBlockTool.ts +5 -3
  17. package/src/api/formats/base-tools/delete.ts +5 -1
  18. 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
  19. 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
  20. 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
  21. 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
  22. 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
  23. 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
  24. 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
  25. 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
  26. 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
  27. 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
  28. 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
  29. 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
  30. 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
  31. 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
  32. 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
  33. 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
  34. 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 +15 -0
  35. 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
  36. 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 +15 -0
  37. 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
  38. 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
  39. 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
  40. 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
  41. 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
  42. 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
  43. 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
  44. 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
  45. 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 +15 -0
  46. 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
  47. 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
  48. 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
  49. 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
  50. 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
  51. 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
  52. 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
  53. 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
  54. 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
  55. 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
  56. 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
  57. 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 +15 -0
  58. 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
  59. 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
  60. 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
  61. 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
  62. 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
  63. 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
  64. 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
  65. 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
  66. 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 +15 -0
  67. 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
  68. 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
  69. 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
  70. 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
  71. 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
  72. 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
  73. 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
  74. 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
  75. 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
  76. 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
  77. 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
  78. 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 +15 -0
  79. 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
  80. 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
  81. 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
  82. 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
  83. 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
  84. 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
  85. 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
  86. 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
  87. 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
  88. 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
  89. 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
  90. 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
  91. 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
  92. 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
  93. 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
  94. 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
  95. 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
  96. 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
  97. 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
  98. 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
  99. 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
  100. 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
  101. 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
  102. 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
  103. 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
  104. 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
  105. package/src/api/formats/html-blocks/htmlBlocks.test.ts +1 -8
  106. package/src/api/formats/html-blocks/htmlBlocks.ts +1 -1
  107. package/src/api/formats/html-blocks/tools/rebaseTool.ts +6 -2
  108. package/src/api/formats/json/errorHandling.test.ts +54 -57
  109. package/src/api/formats/json/json.test.ts +1 -1
  110. package/src/api/formats/json/json.ts +1 -1
  111. package/src/api/formats/json/tools/jsontools.test.ts +12 -2
  112. package/src/api/formats/markdown-blocks/markdownBlocks.test.ts +1 -1
  113. package/src/api/formats/markdown-blocks/markdownBlocks.ts +1 -1
  114. package/src/api/formats/tests/validateTestEnvironment.test.ts +1 -0
  115. package/src/components/AIMenu/PromptSuggestionMenu.tsx +20 -18
  116. package/src/prosemirror/__snapshots__/agent.test.ts.snap +7 -0
  117. package/src/prosemirror/__snapshots__/changeset.test.ts.snap +28 -0
  118. package/src/prosemirror/agent.test.ts +14 -2
  119. package/src/prosemirror/changeset.test.ts +8 -2
  120. package/src/streamTool/index.ts +0 -1
  121. package/src/streamTool/vercelAiSdk/clientside/ClientSideTransport.ts +7 -92
  122. package/src/streamTool/vercelAiSdk/util/toolDefinitions.ts +9 -5
  123. package/src/testUtil/cases/combinedOperationsTestCases.ts +1 -1
  124. package/src/testUtil/cases/editors/simpleEditor.ts +15 -0
  125. package/src/testUtil/cases/index.ts +6 -1
  126. package/src/testUtil/cases/updateOperationTestCases.ts +30 -1
  127. package/types/src/streamTool/index.d.ts +0 -1
  128. package/types/src/streamTool/vercelAiSdk/clientside/ClientSideTransport.d.ts +9 -33
  129. package/types/src/streamTool/vercelAiSdk/util/toolDefinitions.d.ts +1 -1
  130. package/types/src/testUtil/cases/editors/simpleEditor.d.ts +268 -0
  131. package/dist/client-ChPl2nQr.js.map +0 -1
  132. package/dist/client-wMB2zJXh.cjs +0 -36
  133. package/dist/client-wMB2zJXh.cjs.map +0 -1
  134. 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
  135. 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
  136. 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
  137. 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
  138. 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
  139. 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
  140. 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
  141. 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
  142. 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
  143. 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
  144. 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_039451748eb07d71d3d7f96c97950d62.json +0 -15
  145. 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_a7597ddda3f5117e1572545c53c19414.json +0 -15
  146. 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
  147. 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_bb81e06e77589983badfe53e3839ab83.json +0 -15
  148. 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
  149. 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_8b11b2a66564f9985f33774d3862cd8c.json +0 -15
  150. 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
  151. 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
  152. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/anthropic.messages/claude-3-7-sonnet-latest (streaming)/translate selection_1_885e9088214dbb6d50dcda19d0056f3c.json +0 -15
  153. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/groq.chat/llama-3.3-70b-versatile (streaming)/translate selection_1_1e9c30fa14f61508e6d90cbfa4d9b891.json +0 -15
  154. 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
  155. 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
  156. 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
  157. 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
  158. 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
  159. 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
  160. 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
  161. 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
  162. 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
  163. 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
  164. 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
  165. 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
  166. 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
  167. 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
  168. 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_f82bcc59263074bf367562f7380b9cef.json +0 -15
  169. 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
  170. 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
  171. 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
  172. 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
  173. 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
  174. 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
  175. 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
  176. 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
  177. 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
  178. 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
  179. 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
  180. 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
  181. 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
  182. 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
  183. 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
  184. 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
  185. 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
  186. 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
  187. 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
  188. package/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Update/__msw_snapshots__/openai.responses/gpt-4o-2024-08-06 (streaming)/translate selection_1_94c4e51be42ba73c81d7edc503e92b40.json +0 -15
  189. 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
  190. 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
  191. 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
  192. 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
  193. 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
  194. 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
  195. 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
  196. 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
  197. 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
  198. 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
  199. 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
  200. 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
  201. 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
  202. 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
  203. 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
  204. 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
  205. 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
  206. 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
  207. 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
  208. 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
  209. 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
  210. 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
  211. 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
  212. 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
  213. 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
  214. 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
  215. 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
  216. 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
  217. 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
  218. 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
  219. 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
  220. 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
  221. 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
  222. 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
  223. 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
  224. 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
  225. 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
  226. 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
  227. 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
  228. 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
  229. 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
  230. 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
  231. 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
  232. 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
  233. 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
  234. 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
  235. 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
  236. 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
  237. 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
  238. 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
  239. 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
  240. 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
  241. 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
  242. 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
  243. 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
  244. 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
  245. 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
  246. 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
  247. 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
  248. 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
  249. 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
  250. package/src/streamTool/vercelAiSdk/util/partialObjectStreamUtil.ts +0 -120
  251. package/types/src/streamTool/vercelAiSdk/util/partialObjectStreamUtil.d.ts +0 -30
@@ -1,20 +1,20 @@
1
- var ke = Object.defineProperty;
2
- var we = (t, e, o) => e in t ? ke(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o;
3
- var L = (t, e, o) => we(t, typeof e != "symbol" ? e + "" : e, o);
4
- import { jsonSchema as N, parsePartialJson as ue, asSchema as Z, tool as ge, generateObject as Te, convertToModelMessages as U, streamObject as ve, streamText as Pe, isToolUIPart as Oe } from "ai";
5
- import { getErrorMessage as $ } from "@ai-sdk/provider-utils";
6
- import G from "lodash.merge";
7
- import Ee from "lodash.isequal";
8
- import { getPmSchema as xe, UnreachableCaseError as Be, getNodeById as Ce, updateBlockTr as Ie, insertBlocks as Ne, trackPosition as K, removeAndInsertBlocks as Me, getBlock as de, defaultProps as pe, isStyledTextInlineContent as _e, isLinkInlineContent as Ae } from "@blocknote/core";
9
- import { Slice as je } from "prosemirror-model";
10
- import { TextSelection as $e } from "prosemirror-state";
11
- import { Transform as E, Mapping as fe, ReplaceStep as v, ReplaceAroundStep as De } from "prosemirror-transform";
12
- import { ChangeSet as Q, simplifyChanges as Le } from "prosemirror-changeset";
13
- import { applySuggestions as Ue } from "@handlewithcare/prosemirror-suggest-changes";
14
- function J(t) {
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 qe(t, e, o = !0, r = !0) {
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 qe(t, e, o = !0, r = !0) {
24
24
  a--;
25
25
  return t.slice(n, a);
26
26
  }
27
- function P(t, e) {
28
- return qe(
27
+ function v(t, e) {
28
+ return je(
29
29
  t,
30
- (r) => J(r) && (e == null ? void 0 : e.cursorBlockId) !== r.id,
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 qt(t) {
35
+ async function $t(t) {
36
36
  const {
37
37
  useSelection: e,
38
38
  deleteEmptyCursorBlock: o,
@@ -42,11 +42,11 @@ async function qt(t) {
42
42
  } = {
43
43
  useSelection: t.useSelection ?? !1,
44
44
  deleteEmptyCursorBlock: t.deleteEmptyCursorBlock ?? !0,
45
- streamToolsProvider: t.streamToolsProvider ?? le.html.getStreamToolsProvider(),
46
- documentStateBuilder: t.documentStateBuilder ?? le.html.defaultDocumentStateBuilder,
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 && J(i) && P(t.editor.document).length > 0 ? i.id : void 0, c = e ? t.editor.getSelectionCutBlocks() : void 0, d = r.getStreamTools(
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 qt(t) {
65
65
  documentState: await n(u)
66
66
  };
67
67
  }
68
- function Je(t) {
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 Re(t) {
89
- const e = t.map((r) => Je(r)), o = {};
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] && !Ee(o[n], r.$defs[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 ze(t) {
113
+ function Ue(t) {
114
114
  return {
115
115
  applyDocumentOperations: {
116
- inputSchema: N(Re(t)),
116
+ inputSchema: N(Le(t)),
117
117
  outputSchema: N({ type: "object" })
118
118
  }
119
119
  };
120
120
  }
121
- class R extends Error {
121
+ class J extends Error {
122
122
  constructor(o, r, n) {
123
123
  super(o, n);
124
- L(this, "aborted");
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 He {
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
- L(this, "stream");
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 Fe(
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 R(
174
- `Tool execution failed: ${$(c)}`,
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 ue(r);
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 Fe(t, e, o) {
255
- const r = await ue(t);
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 q(t) {
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 We(t, e) {
338
- let o = "";
339
- return t.pipeThrough(
340
- new TransformStream({
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: o.description,
409
- inputSchema: Z(o.inputSchema).jsonSchema,
410
- outputSchema: Z(o.outputSchema).jsonSchema
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 Xe(t) {
350
+ function He(t) {
416
351
  return Object.fromEntries(
417
352
  Object.entries(t).map(([e, o]) => [
418
353
  e,
419
- ge({
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 Ze = {
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 ee(t) {
443
- return Ze[t.provider] || {};
377
+ function jt(t) {
378
+ return Fe[t.provider] || {};
444
379
  }
445
- class Jt {
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: U(q(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: U(q(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 Pe({
391
+ return ke({
502
392
  model: r,
503
393
  system: this.opts.systemPrompt,
504
- messages: U(q(e)),
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 = Xe(n);
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 Ge() {
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 Ke(t) {
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 me(t) {
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 Qe(t) {
600
- return me(Ke(t));
489
+ function Ye(t) {
490
+ return de(Ve(t));
601
491
  }
602
- async function* et(t, e) {
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* tt(t, e) {
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* ot(t, e) {
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* rt(t, e) {
680
- const o = ot(
569
+ async function* Ke(t, e) {
570
+ const o = Ge(
681
571
  t,
682
572
  e
683
573
  );
684
- yield* tt(
574
+ yield* Ze(
685
575
  o,
686
576
  (n) => {
687
577
  if (!n.isPossiblyPartial)
688
- throw new R(
689
- `Invalid operation. ${$(n.operation.error)}`,
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 nt(t, e, o) {
699
- return Qe(
700
- rt(
701
- et(
702
- me(t),
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 st(t, e, o, r) {
710
- const n = new He(t, r), a = Ge(), i = a.output.pipeTo(n.writable), s = /* @__PURE__ */ new Map();
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
- at(e, (S) => {
603
+ tt(e, (S) => {
714
604
  if (!s.has(S.toolCallId)) {
715
- const y = it(
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 R)
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: $(p) } : { status: "not-executed-previous-tool-errored" }
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 at(t, e) {
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 (!Oe(r) || r.type.replace("tool-", "") !== "applyDocumentOperations")
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
- ct(r, i);
673
+ rt(r, i);
784
674
  }
785
675
  }
786
- function it(t, e, o) {
787
- const r = new TransformStream(), n = nt(
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 ct(t, e) {
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 Rt(t, e, o, r, n) {
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 = G(a.metadata, {
707
+ a.metadata = X(a.metadata, {
818
708
  documentState: e.documentState
819
709
  });
820
- const i = st(
710
+ const i = et(
821
711
  e.streamTools,
822
712
  t,
823
713
  e.onStart,
824
714
  n
825
715
  );
826
- return r = G(r, {
716
+ return r = X(r, {
827
717
  metadata: {
828
718
  source: "blocknote-ai"
829
719
  },
830
720
  body: {
831
- toolDefinitions: Ye(
832
- ze(e.streamTools)
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 he(t, e) {
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 z(t) {
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 H(t) {
872
- return async (e) => e.selectedBlocks ? await ut(
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 lt(
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 lt(t, e, o) {
887
- const r = P(t.document).length === 0, n = t.getTextCursorPosition().block.id, a = P(t.document, {
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 = he(t, i).filter(
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: z(c),
787
+ blocks: q(c),
898
788
  isEmptyDocument: r
899
789
  };
900
790
  }
901
- async function ut(t, e, o) {
902
- const r = P(t.document).length === 0, n = await M(
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 = z(n);
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 dt(t) {
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 _(t) {
808
+ function A(t) {
919
809
  var a;
920
- const e = xe(t), { modification: o } = e.marks, r = [], n = new E(t.before);
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 fe(t.mapping.maps.slice(0, i)).invert();
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 v) {
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 De) {
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 v))
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 = dt(s.slice.content);
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 je(s.slice.content.cut(0, y), 0, 0);
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 = $e.near(
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 F(t) {
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 Be(t.type);
929
+ throw new ve(t.type);
1040
930
  }
1041
- function W(t, e) {
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 pt(t, e, o) {
943
+ function it(t, e, o) {
1054
944
  const r = new E(e);
1055
945
  for (const i of t) {
1056
- const s = new v(
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 v(
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 te = (t, e) => {
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 D(t, e, o = !1, r, n) {
1129
- const a = Ce(t.id, e), i = new E(e);
1130
- Ie(
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 = Q.create(
1027
+ let s = i.doc, c = G.create(
1138
1028
  e,
1139
1029
  void 0,
1140
- te(e, s)
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 v(l.toB, l.toB, b)
1151
- ), s = i.doc, c = Q.create(
1040
+ new P(l.toB, l.toB, b)
1041
+ ), s = i.doc, c = G.create(
1152
1042
  c.startDoc,
1153
1043
  void 0,
1154
- te(c.startDoc, s)
1044
+ K(c.startDoc, s)
1155
1045
  ), c = c.addSteps(s, i.mapping.maps, 0);
1156
1046
  }
1157
1047
  }
1158
- const d = [], u = Le(
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
- pt(u, e, s);
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 v(
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 ye extends Error {
1092
+ class fe extends Error {
1203
1093
  constructor(e, o) {
1204
1094
  super(e, o), this.name = "AbortError";
1205
1095
  }
1206
1096
  }
1207
- function ft(t, e) {
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 V(t) {
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 = ft(
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 && J(
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 = D(
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 = _(p), b = b.filter(
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 = Ne(
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 = _(p);
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 ye("Operation was aborted");
1345
- o.withDelays && await F(m), e.transact((S) => {
1346
- W(S, m);
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 Y(t) {
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 {
@@ -1399,9 +1289,13 @@ function Y(t) {
1399
1289
  };
1400
1290
  const i = e.getBlock(a);
1401
1291
  if (!i)
1402
- return console.error("BLOCK NOT FOUND", a), {
1292
+ return {
1403
1293
  ok: !1,
1404
- error: "block not found"
1294
+ error: new Error("Block not found (update)", {
1295
+ cause: {
1296
+ blockId: a
1297
+ }
1298
+ })
1405
1299
  };
1406
1300
  const s = t.validateBlock(n.block, e, i.type);
1407
1301
  return s.ok ? {
@@ -1418,8 +1312,8 @@ function Y(t) {
1418
1312
  executor: () => {
1419
1313
  let a = 50;
1420
1314
  const i = o.updateSelection ? {
1421
- from: K(e, o.updateSelection.from),
1422
- to: K(e, o.updateSelection.to)
1315
+ from: Z(e, o.updateSelection.from),
1316
+ to: Z(e, o.updateSelection.to)
1423
1317
  } : void 0;
1424
1318
  return {
1425
1319
  execute: async (s, c) => {
@@ -1440,7 +1334,7 @@ function Y(t) {
1440
1334
  });
1441
1335
  if (!p)
1442
1336
  return !0;
1443
- const b = D(
1337
+ const b = j(
1444
1338
  p,
1445
1339
  u.doc,
1446
1340
  s.isPossiblyPartial,
@@ -1452,12 +1346,12 @@ function Y(t) {
1452
1346
  const m = b.map((k) => k.map(u.invertMap)), S = new E(e.prosemirrorState.doc);
1453
1347
  for (const k of m)
1454
1348
  S.step(k.map(S.mapping));
1455
- const y = _(S);
1349
+ const y = A(S);
1456
1350
  for (const k of y) {
1457
1351
  if (c != null && c.aborted)
1458
- throw new ye("Operation was aborted");
1459
- o.withDelays && await F(k), e.transact((w) => {
1460
- W(w, k);
1352
+ throw new fe("Operation was aborted");
1353
+ o.withDelays && await z(k), e.transact((w) => {
1354
+ H(w, k);
1461
1355
  }), (h = o.onBlockUpdate) == null || h.call(o, d.id);
1462
1356
  }
1463
1357
  return !0;
@@ -1467,7 +1361,7 @@ function Y(t) {
1467
1361
  };
1468
1362
  };
1469
1363
  }
1470
- const X = (t, e) => ({
1364
+ const V = (t, e) => ({
1471
1365
  name: "delete",
1472
1366
  description: "Delete a block",
1473
1367
  inputSchema: {
@@ -1508,7 +1402,11 @@ const X = (t, e) => ({
1508
1402
  }
1509
1403
  } : {
1510
1404
  ok: !1,
1511
- error: "block not found"
1405
+ error: new Error("Block not found (delete)", {
1406
+ cause: {
1407
+ blockId: r
1408
+ }
1409
+ })
1512
1410
  };
1513
1411
  },
1514
1412
  // Note: functionality mostly tested in jsontools.test.ts
@@ -1519,17 +1417,17 @@ const X = (t, e) => ({
1519
1417
  if (o.operation.type !== "delete")
1520
1418
  return !1;
1521
1419
  const r = o.operation, n = t.prosemirrorState.tr;
1522
- Me(n, [r.id], []);
1523
- const a = _(n);
1420
+ Be(n, [r.id], []);
1421
+ const a = A(n);
1524
1422
  for (const s of a)
1525
- e.withDelays && await F(s), t.transact((c) => {
1526
- W(c, s);
1423
+ e.withDelays && await z(s), t.transact((c) => {
1424
+ H(c, s);
1527
1425
  }), (i = e.onBlockUpdate) == null || i.call(e, r.id);
1528
1426
  return !0;
1529
1427
  }
1530
1428
  })
1531
1429
  });
1532
- function oe(t) {
1430
+ function Q(t) {
1533
1431
  const e = t.lastIndexOf("<"), o = t.lastIndexOf(">");
1534
1432
  let r = t;
1535
1433
  if (e > o && (r = t.substring(0, e), !r.trim()))
@@ -1545,15 +1443,15 @@ function oe(t) {
1545
1443
  ).body.firstChild;
1546
1444
  return s ? s.innerHTML : "";
1547
1445
  }
1548
- function A(t) {
1446
+ function _(t) {
1549
1447
  let e;
1550
- if (Ue(t.prosemirrorState, (o) => {
1448
+ if ($e(t.prosemirrorState, (o) => {
1551
1449
  e = o;
1552
1450
  }), !e)
1553
1451
  throw new Error("applySuggestionsTr is not set");
1554
1452
  return e;
1555
1453
  }
1556
- function j(t, e) {
1454
+ function $(t, e) {
1557
1455
  const o = e.mapping.invert();
1558
1456
  return {
1559
1457
  doc: e.doc,
@@ -1585,9 +1483,9 @@ function j(t, e) {
1585
1483
  }
1586
1484
  };
1587
1485
  }
1588
- async function re(t, e) {
1486
+ async function ee(t, e) {
1589
1487
  var d;
1590
- const o = A(e), r = de(o.doc, t);
1488
+ const o = _(e), r = ce(o.doc, t);
1591
1489
  if (!r)
1592
1490
  throw new Error("block not found");
1593
1491
  const n = await e.blocksToHTMLLossy([
@@ -1599,17 +1497,22 @@ async function re(t, e) {
1599
1497
  if (window.__TEST_OPTIONS && (window.__TEST_OPTIONS.mockID = a), i.length !== 1)
1600
1498
  throw new Error("html diff invalid block count");
1601
1499
  const s = i[0];
1602
- if (s.id = t, D(
1500
+ if (s.id = t, j(
1603
1501
  {
1604
1502
  id: t,
1605
1503
  block: s
1606
1504
  },
1607
1505
  o.doc
1608
1506
  ).length)
1609
- throw new Error("html diff");
1610
- return j(e, o);
1507
+ throw new Error("html diff", {
1508
+ cause: {
1509
+ html: n,
1510
+ htmlBlock: s
1511
+ }
1512
+ });
1513
+ return $(e, o);
1611
1514
  }
1612
- function ne(t) {
1515
+ function te(t) {
1613
1516
  return typeof t != "string" ? {
1614
1517
  ok: !1,
1615
1518
  error: "block must be a string"
@@ -1619,7 +1522,7 @@ function ne(t) {
1619
1522
  };
1620
1523
  }
1621
1524
  const B = {
1622
- add: V({
1525
+ add: F({
1623
1526
  description: "Insert new blocks",
1624
1527
  schema: {
1625
1528
  block: {
@@ -1627,13 +1530,13 @@ const B = {
1627
1530
  description: "html of block (MUST be a single, VALID HTML element)"
1628
1531
  }
1629
1532
  },
1630
- validateBlock: ne,
1631
- rebaseTool: re,
1533
+ validateBlock: te,
1534
+ rebaseTool: ee,
1632
1535
  toJSONToolCall: async (t, e) => {
1633
1536
  var n;
1634
1537
  const o = (n = window.__TEST_OPTIONS) == null ? void 0 : n.mockID, r = (await Promise.all(
1635
1538
  e.operation.blocks.map(async (a) => {
1636
- const i = e.isPossiblyPartial ? oe(a) : a;
1539
+ const i = e.isPossiblyPartial ? Q(a) : a;
1637
1540
  return i ? (await t.tryParseHTMLToBlocks(i)).map(
1638
1541
  (s) => (delete s.id, s)
1639
1542
  ) : [];
@@ -1646,7 +1549,7 @@ const B = {
1646
1549
  };
1647
1550
  }
1648
1551
  }),
1649
- update: Y({
1552
+ update: W({
1650
1553
  description: "Update a block",
1651
1554
  schema: {
1652
1555
  block: {
@@ -1654,10 +1557,10 @@ const B = {
1654
1557
  description: "html of block (MUST be a single HTML element)"
1655
1558
  }
1656
1559
  },
1657
- validateBlock: ne,
1658
- rebaseTool: re,
1560
+ validateBlock: te,
1561
+ rebaseTool: ee,
1659
1562
  toJSONToolCall: async (t, e) => {
1660
- const o = e.isPossiblyPartial ? oe(e.operation.block) : e.operation.block;
1563
+ const o = e.isPossiblyPartial ? Q(e.operation.block) : e.operation.block;
1661
1564
  if (!o)
1662
1565
  return;
1663
1566
  const r = (await t.tryParseHTMLToBlocks(o))[0];
@@ -1667,11 +1570,11 @@ const B = {
1667
1570
  };
1668
1571
  }
1669
1572
  }),
1670
- delete: X
1573
+ delete: V
1671
1574
  };
1672
- function mt(t, e, o, r, n) {
1575
+ function lt(t, e, o, r, n) {
1673
1576
  if (typeof r == "boolean") {
1674
- const s = r ? t.getSelectionCutBlocks() : void 0;
1577
+ const s = r ? t.getSelectionCutBlocks(!0) : void 0;
1675
1578
  r = s ? {
1676
1579
  from: s._meta.startPos,
1677
1580
  to: s._meta.endPos
@@ -1695,7 +1598,7 @@ function mt(t, e, o, r, n) {
1695
1598
  ...a.delete ? [B.delete(t, { idsSuffixed: !0, withDelays: e, onBlockUpdate: n })] : []
1696
1599
  ];
1697
1600
  }
1698
- const ht = `You're manipulating a text document using HTML blocks.
1601
+ const ut = `You're manipulating a text document using HTML blocks.
1699
1602
  Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $).
1700
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.
1701
1604
  For code blocks, you can use the \`data-language\` attribute on a <code> block (wrapped with <pre>) to specify the language.
@@ -1706,12 +1609,12 @@ IF there is no selection active in the latest state, first, determine what part
1706
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.
1707
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\`
1708
1611
  ---
1709
- `, yt = {
1612
+ `, dt = {
1710
1613
  /**
1711
1614
  * Function to get the stream tools that can apply HTML block updates to the editor
1712
1615
  */
1713
1616
  getStreamToolsProvider: (t = {}) => ({
1714
- getStreamTools: (e, o, r) => mt(
1617
+ getStreamTools: (e, o, r) => lt(
1715
1618
  e,
1716
1619
  t.withDelays ?? !0,
1717
1620
  t.defaultStreamTools,
@@ -1719,16 +1622,16 @@ IF there is no selection active in the latest state, first, determine what part
1719
1622
  r
1720
1623
  )
1721
1624
  }),
1722
- systemPrompt: ht,
1625
+ systemPrompt: ut,
1723
1626
  tools: B,
1724
1627
  /**
1725
1628
  * The default DocumentStateBuilder that can take an editor and convert it to a document state that can be passed to the backend
1726
1629
  */
1727
- defaultDocumentStateBuilder: H(
1630
+ defaultDocumentStateBuilder: R(
1728
1631
  async (t, e) => t.blocksToHTMLLossy([e])
1729
1632
  )
1730
1633
  };
1731
- function bt(t) {
1634
+ function pt(t) {
1732
1635
  const e = {}, o = {};
1733
1636
  return t.forEach((n) => {
1734
1637
  const { type: a, ...i } = n.properties, s = JSON.stringify(i);
@@ -1749,7 +1652,7 @@ function bt(t) {
1749
1652
  };
1750
1653
  });
1751
1654
  }
1752
- function St(t) {
1655
+ function ft(t) {
1753
1656
  return {
1754
1657
  type: "object",
1755
1658
  properties: Object.fromEntries(
@@ -1763,7 +1666,7 @@ function St(t) {
1763
1666
  additionalProperties: !1
1764
1667
  };
1765
1668
  }
1766
- function kt() {
1669
+ function mt() {
1767
1670
  return {
1768
1671
  type: "object",
1769
1672
  properties: {
@@ -1782,7 +1685,7 @@ function kt() {
1782
1685
  required: ["type", "text"]
1783
1686
  };
1784
1687
  }
1785
- function be(t) {
1688
+ function me(t) {
1786
1689
  return {
1787
1690
  type: "object",
1788
1691
  properties: Object.fromEntries(
@@ -1797,7 +1700,7 @@ function be(t) {
1797
1700
  additionalProperties: !1
1798
1701
  };
1799
1702
  }
1800
- function wt(t) {
1703
+ function ht(t) {
1801
1704
  return {
1802
1705
  type: "array",
1803
1706
  items: {
@@ -1835,7 +1738,7 @@ function wt(t) {
1835
1738
  $ref: "#/$defs/styledtext"
1836
1739
  }
1837
1740
  } : void 0,
1838
- props: be(o.propSchema)
1741
+ props: me(o.propSchema)
1839
1742
  },
1840
1743
  additionalProperties: !1,
1841
1744
  required: ["type", ...o.content === "styled" ? ["content"] : []]
@@ -1843,9 +1746,9 @@ function wt(t) {
1843
1746
  }
1844
1747
  };
1845
1748
  }
1846
- function gt(t) {
1749
+ function yt(t) {
1847
1750
  return {
1848
- anyOf: bt(
1751
+ anyOf: pt(
1849
1752
  Object.entries(t).map(([e, o]) => ({
1850
1753
  type: "object",
1851
1754
  properties: {
@@ -1855,7 +1758,7 @@ function gt(t) {
1855
1758
  },
1856
1759
  content: o.content === "inline" ? { $ref: "#/$defs/inlinecontent" } : o.content === "table" ? { type: "object", properties: {} } : void 0,
1857
1760
  // filter out default props (TODO: make option)
1858
- props: be(o.propSchema)
1761
+ props: me(o.propSchema)
1859
1762
  // Object.fromEntries(
1860
1763
  // Object.entries(val.propSchema).filter(
1861
1764
  // (key) => typeof (defaultProps as any)[key[0]] === "undefined"
@@ -1870,7 +1773,7 @@ function gt(t) {
1870
1773
  )
1871
1774
  };
1872
1775
  }
1873
- function Tt(t) {
1776
+ function bt(t) {
1874
1777
  const e = JSON.parse(
1875
1778
  JSON.stringify({
1876
1779
  blockSchema: t.blockSchema,
@@ -1898,7 +1801,7 @@ function Tt(t) {
1898
1801
  ...r,
1899
1802
  propSchema: Object.fromEntries(
1900
1803
  Object.entries(r.propSchema).filter(
1901
- (n) => typeof pe[n[0]] > "u"
1804
+ (n) => typeof le[n[0]] > "u"
1902
1805
  )
1903
1806
  )
1904
1807
  }
@@ -1910,22 +1813,22 @@ function Tt(t) {
1910
1813
  }
1911
1814
  };
1912
1815
  }
1913
- function se(t) {
1914
- return t = Tt(t).removeFileBlocks().removeDefaultProps().get(), {
1816
+ function oe(t) {
1817
+ return t = bt(t).removeFileBlocks().removeDefaultProps().get(), {
1915
1818
  $defs: {
1916
- styles: St(t.styleSchema),
1917
- styledtext: kt(),
1918
- inlinecontent: wt(
1819
+ styles: ft(t.styleSchema),
1820
+ styledtext: mt(),
1821
+ inlinecontent: ht(
1919
1822
  t.inlineContentSchema
1920
1823
  ),
1921
- block: gt(t.blockSchema)
1824
+ block: yt(t.blockSchema)
1922
1825
  }
1923
1826
  };
1924
1827
  }
1925
- function Se(t, e) {
1926
- return !e.schema.inlineContentSchema[t.type] || _e(t) && !("text" in t) ? !1 : Ae(t) ? !("content" in t) || !("href" in t) ? !1 : Se(t.content, e) : !0;
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;
1927
1830
  }
1928
- function ae(t, e, o) {
1831
+ function re(t, e, o) {
1929
1832
  const r = t.type || o, n = e.schema.blockSchema[r];
1930
1833
  if (!n)
1931
1834
  return {
@@ -1954,7 +1857,7 @@ function ae(t, e, o) {
1954
1857
  ok: !0,
1955
1858
  value: t
1956
1859
  };
1957
- if (!t.content.every((a) => Se(a, e)))
1860
+ if (!t.content.every((a) => he(a, e)))
1958
1861
  return {
1959
1862
  ok: !1,
1960
1863
  error: "block content must be an array of inline content"
@@ -1966,31 +1869,31 @@ function ae(t, e, o) {
1966
1869
  };
1967
1870
  }
1968
1871
  const C = {
1969
- add: V({
1872
+ add: F({
1970
1873
  description: "Insert new blocks",
1971
1874
  schema: (t) => ({
1972
1875
  block: {
1973
1876
  $ref: "#/$defs/block"
1974
1877
  },
1975
- ...se(t.schema)
1878
+ ...oe(t.schema)
1976
1879
  }),
1977
- validateBlock: ae,
1978
- rebaseTool: async (t, e) => j(e, A(e)),
1880
+ validateBlock: re,
1881
+ rebaseTool: async (t, e) => $(e, _(e)),
1979
1882
  toJSONToolCall: async (t, e) => e.operation
1980
1883
  }),
1981
- update: Y({
1884
+ update: W({
1982
1885
  description: "Update a block, the new block will replace the existing block.",
1983
1886
  schema: (t) => ({
1984
1887
  block: {
1985
1888
  $ref: "#/$defs/block"
1986
1889
  },
1987
- ...se(t.schema)
1890
+ ...oe(t.schema)
1988
1891
  }),
1989
- validateBlock: ae,
1990
- rebaseTool: async (t, e) => j(e, A(e)),
1892
+ validateBlock: re,
1893
+ rebaseTool: async (t, e) => $(e, _(e)),
1991
1894
  toJSONToolCall: async (t, e) => {
1992
1895
  const o = Object.fromEntries(
1993
- Object.entries(pe).map(([r, n]) => [r, n.default])
1896
+ Object.entries(le).map(([r, n]) => [r, n.default])
1994
1897
  );
1995
1898
  return {
1996
1899
  ...e.operation,
@@ -2004,11 +1907,11 @@ const C = {
2004
1907
  };
2005
1908
  }
2006
1909
  }),
2007
- delete: X
1910
+ delete: V
2008
1911
  };
2009
- function vt(t, e, o, r, n) {
1912
+ function St(t, e, o, r, n) {
2010
1913
  if (typeof r == "boolean") {
2011
- const s = r ? t.getSelectionCutBlocks() : void 0;
1914
+ const s = r ? t.getSelectionCutBlocks(!0) : void 0;
2012
1915
  r = s ? {
2013
1916
  from: s._meta.startPos,
2014
1917
  to: s._meta.endPos
@@ -2032,7 +1935,7 @@ function vt(t, e, o, r, n) {
2032
1935
  ...a.delete ? [C.delete(t, { idsSuffixed: !0, withDelays: e, onBlockUpdate: n })] : []
2033
1936
  ];
2034
1937
  }
2035
- const Pt = `You're manipulating a text document using JSON blocks.
1938
+ const kt = `You're manipulating a text document using JSON blocks.
2036
1939
  Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $).
2037
1940
 
2038
1941
  If the user requests updates to the document, use the "applyDocumentOperations" tool to update the document.
@@ -2041,12 +1944,12 @@ IF there is no selection active in the latest state, first, determine what part
2041
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.
2042
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\`
2043
1946
  ---
2044
- `, Ot = {
1947
+ `, wt = {
2045
1948
  /**
2046
1949
  * Function to get the stream tools that can apply JSON block updates to the editor
2047
1950
  */
2048
1951
  getStreamToolsProvider: (t = {}) => ({
2049
- getStreamTools: (e, o, r) => vt(
1952
+ getStreamTools: (e, o, r) => St(
2050
1953
  e,
2051
1954
  t.withDelays ?? !0,
2052
1955
  t.defaultStreamTools,
@@ -2055,8 +1958,8 @@ IF there is no selection active in the latest state, first, determine what part
2055
1958
  )
2056
1959
  }),
2057
1960
  tools: C,
2058
- systemPrompt: Pt,
2059
- defaultDocumentStateBuilder: H(
1961
+ systemPrompt: kt,
1962
+ defaultDocumentStateBuilder: R(
2060
1963
  async (t, e) => ({
2061
1964
  ...e,
2062
1965
  id: void 0,
@@ -2065,23 +1968,23 @@ IF there is no selection active in the latest state, first, determine what part
2065
1968
  })
2066
1969
  )
2067
1970
  };
2068
- async function ie(t, e) {
2069
- const o = A(e), r = await e.blocksToMarkdownLossy([de(o.doc, t)]), n = await e.tryParseMarkdownToBlocks(r), a = D(
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(
2070
1973
  {
2071
1974
  id: t,
2072
1975
  block: n[0]
2073
1976
  },
2074
1977
  o.doc
2075
- ), i = new fe();
1978
+ ), i = new ue();
2076
1979
  for (const s of a) {
2077
1980
  const c = s.map(i);
2078
1981
  if (!c)
2079
1982
  throw new Error("Failed to map step");
2080
1983
  o.step(c), i.appendMap(c.getMap());
2081
1984
  }
2082
- return j(e, o);
1985
+ return $(e, o);
2083
1986
  }
2084
- function ce(t) {
1987
+ function se(t) {
2085
1988
  return typeof t != "string" ? {
2086
1989
  ok: !1,
2087
1990
  error: "block must be a string"
@@ -2091,7 +1994,7 @@ function ce(t) {
2091
1994
  };
2092
1995
  }
2093
1996
  const I = {
2094
- add: V({
1997
+ add: F({
2095
1998
  description: "Insert new blocks",
2096
1999
  schema: {
2097
2000
  block: {
@@ -2101,8 +2004,8 @@ const I = {
2101
2004
  block: { type: "string", description: "markdown of block" }
2102
2005
  }
2103
2006
  },
2104
- validateBlock: ce,
2105
- rebaseTool: ie,
2007
+ validateBlock: se,
2008
+ rebaseTool: ne,
2106
2009
  toJSONToolCall: async (t, e) => {
2107
2010
  const o = await Promise.all(
2108
2011
  e.operation.blocks.map(async (r) => {
@@ -2116,7 +2019,7 @@ const I = {
2116
2019
  };
2117
2020
  }
2118
2021
  }),
2119
- update: Y({
2022
+ update: W({
2120
2023
  description: "Update a block, the new block will replace the existing block.",
2121
2024
  schema: {
2122
2025
  block: {
@@ -2126,8 +2029,8 @@ const I = {
2126
2029
  block: { type: "string", description: "markdown of block" }
2127
2030
  }
2128
2031
  },
2129
- validateBlock: ce,
2130
- rebaseTool: ie,
2032
+ validateBlock: se,
2033
+ rebaseTool: ne,
2131
2034
  toJSONToolCall: async (t, e) => {
2132
2035
  const o = (await t.tryParseMarkdownToBlocks(e.operation.block.trim()))[0];
2133
2036
  return delete o.id, window.__TEST_OPTIONS && (window.__TEST_OPTIONS.mockID = void 0), {
@@ -2136,11 +2039,11 @@ const I = {
2136
2039
  };
2137
2040
  }
2138
2041
  }),
2139
- delete: X
2042
+ delete: V
2140
2043
  };
2141
- function Et(t, e, o, r, n) {
2044
+ function gt(t, e, o, r, n) {
2142
2045
  if (typeof r == "boolean") {
2143
- const s = r ? t.getSelectionCutBlocks() : void 0;
2046
+ const s = r ? t.getSelectionCutBlocks(!0) : void 0;
2144
2047
  r = s ? {
2145
2048
  from: s._meta.startPos,
2146
2049
  to: s._meta.endPos
@@ -2164,7 +2067,7 @@ function Et(t, e, o, r, n) {
2164
2067
  ...a.delete ? [I.delete(t, { idsSuffixed: !0, withDelays: e, onBlockUpdate: n })] : []
2165
2068
  ];
2166
2069
  }
2167
- const xt = `You're manipulating a text document using Markdown blocks.
2070
+ const Tt = `You're manipulating a text document using Markdown blocks.
2168
2071
  Make sure to follow the json schema provided. When referencing ids they MUST be EXACTLY the same (including the trailing $).
2169
2072
  List items are 1 block with 1 list item each, so block content \`- item1\` is valid, but \`- item1
2170
2073
  - item2\` is invalid. We'll merge them automatically.
@@ -2175,12 +2078,12 @@ IF there is no selection active in the latest state, first, determine what part
2175
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.
2176
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\`
2177
2080
  ---
2178
- `, Bt = {
2081
+ `, Pt = {
2179
2082
  /**
2180
2083
  * Function to get the stream tools that can apply Markdown block updates to the editor
2181
2084
  */
2182
2085
  getStreamToolsProvider: (t = {}) => ({
2183
- getStreamTools: (e, o, r) => Et(
2086
+ getStreamTools: (e, o, r) => gt(
2184
2087
  e,
2185
2088
  t.withDelays ?? !0,
2186
2089
  t.defaultStreamTools,
@@ -2188,28 +2091,28 @@ IF there is no selection active in the latest state, first, determine what part
2188
2091
  r
2189
2092
  )
2190
2093
  }),
2191
- systemPrompt: xt,
2094
+ systemPrompt: Tt,
2192
2095
  tools: I,
2193
- defaultDocumentStateBuilder: H(
2096
+ defaultDocumentStateBuilder: R(
2194
2097
  async (t, e) => t.blocksToMarkdownLossy([e])
2195
2098
  )
2196
- }, le = {
2197
- _experimental_json: Ot,
2198
- _experimental_markdown: Bt,
2199
- html: yt
2200
- }, zt = {
2201
- addCursorPosition: he,
2099
+ }, ae = {
2100
+ _experimental_json: wt,
2101
+ _experimental_markdown: Pt,
2102
+ html: dt
2103
+ }, Ut = {
2104
+ addCursorPosition: pe,
2202
2105
  flattenBlocks: O,
2203
- suffixIDs: z,
2204
- trimEmptyBlocks: P,
2106
+ suffixIDs: q,
2107
+ trimEmptyBlocks: v,
2205
2108
  convertBlocks: M
2206
2109
  };
2207
- function Ht(t) {
2110
+ function Jt(t) {
2208
2111
  if (!t.dictionary.ai)
2209
2112
  throw new Error("AI dictionary not found");
2210
2113
  return t.dictionary.ai;
2211
2114
  }
2212
- const Ft = (t) => async (e, o) => {
2115
+ const qt = (t) => async (e, o) => {
2213
2116
  const r = new Request(e, o), n = t(r.url), a = new Request(n, {
2214
2117
  headers: r.headers,
2215
2118
  // if we just pass request.body, it's a readablestream which is not visible in chrome inspector,
@@ -2221,26 +2124,24 @@ const Ft = (t) => async (e, o) => {
2221
2124
  return await fetch(a);
2222
2125
  };
2223
2126
  export {
2224
- Jt as C,
2225
- Ze as P,
2226
- He as S,
2227
- le as a,
2228
- qt as b,
2229
- Ht as c,
2230
- Re as d,
2231
- ze as e,
2232
- Ft as f,
2233
- A as g,
2234
- ee as h,
2235
- st as i,
2236
- q as j,
2237
- We as k,
2238
- Xe as l,
2239
- H as m,
2240
- nt as n,
2241
- Ve as o,
2242
- zt as p,
2243
- Rt as s,
2244
- 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
2245
2146
  };
2246
- //# sourceMappingURL=client-ChPl2nQr.js.map
2147
+ //# sourceMappingURL=client-De9NkxJ-.js.map