@promptbook/components 0.100.0-24

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 (780) hide show
  1. package/README.md +570 -0
  2. package/esm/index.es.js +1953 -0
  3. package/esm/index.es.js.map +1 -0
  4. package/esm/typings/books/index.d.ts +131 -0
  5. package/esm/typings/servers.d.ts +40 -0
  6. package/esm/typings/src/_packages/anthropic-claude.index.d.ts +16 -0
  7. package/esm/typings/src/_packages/azure-openai.index.d.ts +10 -0
  8. package/esm/typings/src/_packages/browser.index.d.ts +12 -0
  9. package/esm/typings/src/_packages/cli.index.d.ts +64 -0
  10. package/esm/typings/src/_packages/components.index.d.ts +4 -0
  11. package/esm/typings/src/_packages/core.index.d.ts +322 -0
  12. package/esm/typings/src/_packages/deepseek.index.d.ts +10 -0
  13. package/esm/typings/src/_packages/documents.index.d.ts +8 -0
  14. package/esm/typings/src/_packages/editable.index.d.ts +90 -0
  15. package/esm/typings/src/_packages/fake-llm.index.d.ts +6 -0
  16. package/esm/typings/src/_packages/google.index.d.ts +12 -0
  17. package/esm/typings/src/_packages/javascript.index.d.ts +10 -0
  18. package/esm/typings/src/_packages/legacy-documents.index.d.ts +8 -0
  19. package/esm/typings/src/_packages/markdown-utils.index.d.ts +48 -0
  20. package/esm/typings/src/_packages/markitdown.index.d.ts +8 -0
  21. package/esm/typings/src/_packages/node.index.d.ts +24 -0
  22. package/esm/typings/src/_packages/ollama.index.d.ts +14 -0
  23. package/esm/typings/src/_packages/openai.index.d.ts +32 -0
  24. package/esm/typings/src/_packages/pdf.index.d.ts +14 -0
  25. package/esm/typings/src/_packages/remote-client.index.d.ts +16 -0
  26. package/esm/typings/src/_packages/remote-server.index.d.ts +12 -0
  27. package/esm/typings/src/_packages/templates.index.d.ts +4 -0
  28. package/esm/typings/src/_packages/types.index.d.ts +638 -0
  29. package/esm/typings/src/_packages/utils.index.d.ts +170 -0
  30. package/esm/typings/src/_packages/vercel.index.d.ts +6 -0
  31. package/esm/typings/src/_packages/website-crawler.index.d.ts +8 -0
  32. package/esm/typings/src/_packages/wizard.index.d.ts +64 -0
  33. package/esm/typings/src/book-2.0/agent-source/parseAgentSource.d.ts +30 -0
  34. package/esm/typings/src/book-2.0/agent-source/parseAgentSource.test.d.ts +1 -0
  35. package/esm/typings/src/book-2.0/agent-source/string_book.d.ts +26 -0
  36. package/esm/typings/src/book-2.0/commitments/ACTION/ACTION.d.ts +38 -0
  37. package/esm/typings/src/book-2.0/commitments/FORMAT/FORMAT.d.ts +39 -0
  38. package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/FrontendRAGService.d.ts +48 -0
  39. package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/KNOWLEDGE.d.ts +51 -0
  40. package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/RAGService.d.ts +54 -0
  41. package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/processors/BaseKnowledgeProcessor.d.ts +45 -0
  42. package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/processors/PdfProcessor.d.ts +31 -0
  43. package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/processors/ProcessorFactory.d.ts +23 -0
  44. package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/processors/TextProcessor.d.ts +18 -0
  45. package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/types.d.ts +56 -0
  46. package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/utils/ragHelper.d.ts +34 -0
  47. package/esm/typings/src/book-2.0/commitments/META_IMAGE/META_IMAGE.d.ts +44 -0
  48. package/esm/typings/src/book-2.0/commitments/META_LINK/META_LINK.d.ts +56 -0
  49. package/esm/typings/src/book-2.0/commitments/MODEL/MODEL.d.ts +39 -0
  50. package/esm/typings/src/book-2.0/commitments/NOTE/NOTE.d.ts +49 -0
  51. package/esm/typings/src/book-2.0/commitments/PERSONA/PERSONA.d.ts +46 -0
  52. package/esm/typings/src/book-2.0/commitments/RULE/RULE.d.ts +44 -0
  53. package/esm/typings/src/book-2.0/commitments/SAMPLE/SAMPLE.d.ts +44 -0
  54. package/esm/typings/src/book-2.0/commitments/STYLE/STYLE.d.ts +38 -0
  55. package/esm/typings/src/book-2.0/commitments/_base/BaseCommitmentDefinition.d.ts +52 -0
  56. package/esm/typings/src/book-2.0/commitments/_base/BookCommitment.d.ts +5 -0
  57. package/esm/typings/src/book-2.0/commitments/_base/CommitmentDefinition.d.ts +48 -0
  58. package/esm/typings/src/book-2.0/commitments/_base/NotYetImplementedCommitmentDefinition.d.ts +22 -0
  59. package/esm/typings/src/book-2.0/commitments/_base/createEmptyAgentModelRequirements.d.ts +19 -0
  60. package/esm/typings/src/book-2.0/commitments/_misc/AgentModelRequirements.d.ts +37 -0
  61. package/esm/typings/src/book-2.0/commitments/_misc/AgentSourceParseResult.d.ts +18 -0
  62. package/esm/typings/src/book-2.0/commitments/_misc/ParsedCommitment.d.ts +22 -0
  63. package/esm/typings/src/book-2.0/commitments/_misc/createAgentModelRequirements.d.ts +61 -0
  64. package/esm/typings/src/book-2.0/commitments/_misc/createAgentModelRequirementsWithCommitments.d.ts +35 -0
  65. package/esm/typings/src/book-2.0/commitments/_misc/createCommitmentRegex.d.ts +20 -0
  66. package/esm/typings/src/book-2.0/commitments/_misc/parseAgentSourceWithCommitments.d.ts +24 -0
  67. package/esm/typings/src/book-2.0/commitments/_misc/removeCommentsFromSystemMessage.d.ts +11 -0
  68. package/esm/typings/src/book-2.0/commitments/index.d.ts +56 -0
  69. package/esm/typings/src/book-2.0/utils/profileImageUtils.d.ts +39 -0
  70. package/esm/typings/src/book-components/BookEditor/BookEditor.d.ts +26 -0
  71. package/esm/typings/src/cli/cli-commands/_boilerplate.d.ts +13 -0
  72. package/esm/typings/src/cli/cli-commands/about.d.ts +14 -0
  73. package/esm/typings/src/cli/cli-commands/common/handleActionErrors.d.ts +11 -0
  74. package/esm/typings/src/cli/cli-commands/hello.d.ts +14 -0
  75. package/esm/typings/src/cli/cli-commands/list-models.d.ts +13 -0
  76. package/esm/typings/src/cli/cli-commands/list-scrapers.d.ts +13 -0
  77. package/esm/typings/src/cli/cli-commands/login.d.ts +14 -0
  78. package/esm/typings/src/cli/cli-commands/make.d.ts +16 -0
  79. package/esm/typings/src/cli/cli-commands/prettify.d.ts +15 -0
  80. package/esm/typings/src/cli/cli-commands/run.d.ts +17 -0
  81. package/esm/typings/src/cli/cli-commands/runInteractiveChatbot.d.ts +32 -0
  82. package/esm/typings/src/cli/cli-commands/start-server.d.ts +13 -0
  83. package/esm/typings/src/cli/cli-commands/test-command.d.ts +16 -0
  84. package/esm/typings/src/cli/common/$addGlobalOptionsToCommand.d.ts +7 -0
  85. package/esm/typings/src/cli/common/$provideLlmToolsForCli.d.ts +28 -0
  86. package/esm/typings/src/cli/main.d.ts +16 -0
  87. package/esm/typings/src/cli/promptbookCli.d.ts +13 -0
  88. package/esm/typings/src/cli/test/ptbk.d.ts +5 -0
  89. package/esm/typings/src/cli/test/ptbk.test.d.ts +1 -0
  90. package/esm/typings/src/collection/PipelineCollection.d.ts +25 -0
  91. package/esm/typings/src/collection/SimplePipelineCollection.d.ts +37 -0
  92. package/esm/typings/src/collection/collectionToJson.d.ts +13 -0
  93. package/esm/typings/src/collection/collectionToJson.test.d.ts +7 -0
  94. package/esm/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +65 -0
  95. package/esm/typings/src/collection/constructors/createCollectionFromDirectory.test.d.ts +1 -0
  96. package/esm/typings/src/collection/constructors/createCollectionFromJson.d.ts +13 -0
  97. package/esm/typings/src/collection/constructors/createCollectionFromJson.test.d.ts +1 -0
  98. package/esm/typings/src/collection/constructors/createCollectionFromPromise.d.ts +23 -0
  99. package/esm/typings/src/collection/constructors/createCollectionFromPromise.test.d.ts +1 -0
  100. package/esm/typings/src/collection/constructors/createCollectionFromUrl.d.ts +29 -0
  101. package/esm/typings/src/collection/constructors/createSubcollection.d.ts +13 -0
  102. package/esm/typings/src/commands/BOOK_VERSION/BookVersionCommand.d.ts +11 -0
  103. package/esm/typings/src/commands/BOOK_VERSION/bookVersionCommand.test.d.ts +1 -0
  104. package/esm/typings/src/commands/BOOK_VERSION/bookVersionCommandParser.d.ts +9 -0
  105. package/esm/typings/src/commands/EXPECT/ExpectCommand.d.ts +17 -0
  106. package/esm/typings/src/commands/EXPECT/expectCommand.test.d.ts +1 -0
  107. package/esm/typings/src/commands/EXPECT/expectCommandParser.d.ts +11 -0
  108. package/esm/typings/src/commands/FOREACH/ForeachCommand.d.ts +10 -0
  109. package/esm/typings/src/commands/FOREACH/ForeachJson.d.ts +27 -0
  110. package/esm/typings/src/commands/FOREACH/foreachCommand.test.d.ts +1 -0
  111. package/esm/typings/src/commands/FOREACH/foreachCommandParser.d.ts +12 -0
  112. package/esm/typings/src/commands/FORMAT/FormatCommand.d.ts +9 -0
  113. package/esm/typings/src/commands/FORMAT/formatCommand.test.d.ts +1 -0
  114. package/esm/typings/src/commands/FORMAT/formatCommandParser.d.ts +9 -0
  115. package/esm/typings/src/commands/FORMFACTOR/FormfactorCommand.d.ts +11 -0
  116. package/esm/typings/src/commands/FORMFACTOR/formfactorCommand.test.d.ts +1 -0
  117. package/esm/typings/src/commands/FORMFACTOR/formfactorCommandParser.d.ts +11 -0
  118. package/esm/typings/src/commands/JOKER/JokerCommand.d.ts +11 -0
  119. package/esm/typings/src/commands/JOKER/jokerCommand.test.d.ts +1 -0
  120. package/esm/typings/src/commands/JOKER/jokerCommandParser.d.ts +9 -0
  121. package/esm/typings/src/commands/KNOWLEDGE/KnowledgeCommand.d.ts +11 -0
  122. package/esm/typings/src/commands/KNOWLEDGE/knowledgeCommand.test.d.ts +1 -0
  123. package/esm/typings/src/commands/KNOWLEDGE/knowledgeCommandParser.d.ts +12 -0
  124. package/esm/typings/src/commands/KNOWLEDGE/utils/knowledgeSourceContentToName.d.ts +11 -0
  125. package/esm/typings/src/commands/KNOWLEDGE/utils/knowledgeSourceContentToName.test.d.ts +4 -0
  126. package/esm/typings/src/commands/MODEL/ModelCommand.d.ts +14 -0
  127. package/esm/typings/src/commands/MODEL/modelCommand.test.d.ts +1 -0
  128. package/esm/typings/src/commands/MODEL/modelCommandParser.d.ts +10 -0
  129. package/esm/typings/src/commands/PARAMETER/ParameterCommand.d.ts +15 -0
  130. package/esm/typings/src/commands/PARAMETER/parameterCommand.test.d.ts +1 -0
  131. package/esm/typings/src/commands/PARAMETER/parameterCommandParser.d.ts +9 -0
  132. package/esm/typings/src/commands/PERSONA/PersonaCommand.d.ts +13 -0
  133. package/esm/typings/src/commands/PERSONA/personaCommand.test.d.ts +1 -0
  134. package/esm/typings/src/commands/PERSONA/personaCommandParser.d.ts +9 -0
  135. package/esm/typings/src/commands/POSTPROCESS/PostprocessCommand.d.ts +11 -0
  136. package/esm/typings/src/commands/POSTPROCESS/postprocessCommand.test.d.ts +1 -0
  137. package/esm/typings/src/commands/POSTPROCESS/postprocessCommandParser.d.ts +9 -0
  138. package/esm/typings/src/commands/SECTION/SectionCommand.d.ts +11 -0
  139. package/esm/typings/src/commands/SECTION/sectionCommand.test.d.ts +1 -0
  140. package/esm/typings/src/commands/SECTION/sectionCommandParser.d.ts +20 -0
  141. package/esm/typings/src/commands/URL/UrlCommand.d.ts +10 -0
  142. package/esm/typings/src/commands/URL/urlCommand.test.d.ts +1 -0
  143. package/esm/typings/src/commands/URL/urlCommandParser.d.ts +9 -0
  144. package/esm/typings/src/commands/X_ACTION/ActionCommand.d.ts +9 -0
  145. package/esm/typings/src/commands/X_ACTION/actionCommand.test.d.ts +1 -0
  146. package/esm/typings/src/commands/X_ACTION/actionCommandParser.d.ts +12 -0
  147. package/esm/typings/src/commands/X_INSTRUMENT/InstrumentCommand.d.ts +9 -0
  148. package/esm/typings/src/commands/X_INSTRUMENT/instrumentCommand.test.d.ts +1 -0
  149. package/esm/typings/src/commands/X_INSTRUMENT/instrumentCommandParser.d.ts +12 -0
  150. package/esm/typings/src/commands/_BOILERPLATE/BoilerplateCommand.d.ts +10 -0
  151. package/esm/typings/src/commands/_BOILERPLATE/boilerplateCommand.test.d.ts +1 -0
  152. package/esm/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +11 -0
  153. package/esm/typings/src/commands/_common/getParserForCommand.d.ts +11 -0
  154. package/esm/typings/src/commands/_common/getParserForCommand.test.d.ts +1 -0
  155. package/esm/typings/src/commands/_common/parseCommand.d.ts +12 -0
  156. package/esm/typings/src/commands/_common/parseCommand.test.d.ts +1 -0
  157. package/esm/typings/src/commands/_common/stringifyCommand.d.ts +12 -0
  158. package/esm/typings/src/commands/_common/stringifyCommand.test.d.ts +1 -0
  159. package/esm/typings/src/commands/_common/types/Command.d.ts +6 -0
  160. package/esm/typings/src/commands/_common/types/CommandParser.d.ts +205 -0
  161. package/esm/typings/src/commands/_common/types/CommandType.d.ts +17 -0
  162. package/esm/typings/src/commands/_common/types/CommandUsagePlaces.d.ts +13 -0
  163. package/esm/typings/src/commands/index.d.ts +9 -0
  164. package/esm/typings/src/config.d.ts +313 -0
  165. package/esm/typings/src/config.test.d.ts +4 -0
  166. package/esm/typings/src/constants.d.ts +76 -0
  167. package/esm/typings/src/conversion/archive/loadArchive.d.ts +16 -0
  168. package/esm/typings/src/conversion/archive/saveArchive.d.ts +18 -0
  169. package/esm/typings/src/conversion/compilePipeline.d.ts +25 -0
  170. package/esm/typings/src/conversion/compilePipeline.test.d.ts +1 -0
  171. package/esm/typings/src/conversion/compilePipelineOnRemoteServer.d.ts +21 -0
  172. package/esm/typings/src/conversion/parsePipeline.d.ts +30 -0
  173. package/esm/typings/src/conversion/parsePipeline.test.d.ts +1 -0
  174. package/esm/typings/src/conversion/pipelineJsonToString.d.ts +18 -0
  175. package/esm/typings/src/conversion/prettify/PrettifyOptions.d.ts +13 -0
  176. package/esm/typings/src/conversion/prettify/prettifyPipelineString.d.ts +12 -0
  177. package/esm/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +30 -0
  178. package/esm/typings/src/conversion/utils/extractParameterNamesFromTask.d.ts +15 -0
  179. package/esm/typings/src/conversion/utils/extractParameterNamesFromTask.test.d.ts +1 -0
  180. package/esm/typings/src/conversion/validation/_importPipeline.d.ts +23 -0
  181. package/esm/typings/src/conversion/validation/pipelineStringToJson-parseErrors.test.d.ts +4 -0
  182. package/esm/typings/src/conversion/validation/validatePipeline-logicErrors.test.d.ts +4 -0
  183. package/esm/typings/src/conversion/validation/validatePipeline.d.ts +42 -0
  184. package/esm/typings/src/conversion/validation/validatePipeline.test.d.ts +4 -0
  185. package/esm/typings/src/dialogs/callback/CallbackInterfaceTools.d.ts +17 -0
  186. package/esm/typings/src/dialogs/callback/CallbackInterfaceToolsOptions.d.ts +14 -0
  187. package/esm/typings/src/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +22 -0
  188. package/esm/typings/src/dialogs/user-interface-execution-tools.test.d.ts +1 -0
  189. package/esm/typings/src/errors/0-BoilerplateError.d.ts +12 -0
  190. package/esm/typings/src/errors/0-index.d.ts +94 -0
  191. package/esm/typings/src/errors/AbstractFormatError.d.ts +11 -0
  192. package/esm/typings/src/errors/AuthenticationError.d.ts +9 -0
  193. package/esm/typings/src/errors/CollectionError.d.ts +9 -0
  194. package/esm/typings/src/errors/EnvironmentMismatchError.d.ts +9 -0
  195. package/esm/typings/src/errors/ExpectError.d.ts +12 -0
  196. package/esm/typings/src/errors/KnowledgeScrapeError.d.ts +9 -0
  197. package/esm/typings/src/errors/LimitReachedError.d.ts +9 -0
  198. package/esm/typings/src/errors/MissingToolsError.d.ts +9 -0
  199. package/esm/typings/src/errors/NotFoundError.d.ts +9 -0
  200. package/esm/typings/src/errors/NotYetImplementedError.d.ts +9 -0
  201. package/esm/typings/src/errors/ParseError.d.ts +12 -0
  202. package/esm/typings/src/errors/PipelineExecutionError.d.ts +14 -0
  203. package/esm/typings/src/errors/PipelineLogicError.d.ts +9 -0
  204. package/esm/typings/src/errors/PipelineUrlError.d.ts +9 -0
  205. package/esm/typings/src/errors/PromptbookFetchError.d.ts +9 -0
  206. package/esm/typings/src/errors/UnexpectedError.d.ts +9 -0
  207. package/esm/typings/src/errors/WrappedError.d.ts +10 -0
  208. package/esm/typings/src/errors/assertsError.d.ts +11 -0
  209. package/esm/typings/src/errors/utils/ErrorJson.d.ts +25 -0
  210. package/esm/typings/src/errors/utils/deserializeError.d.ts +7 -0
  211. package/esm/typings/src/errors/utils/deserializeError.test.d.ts +1 -0
  212. package/esm/typings/src/errors/utils/getErrorReportUrl.d.ts +6 -0
  213. package/esm/typings/src/errors/utils/serializeError.d.ts +7 -0
  214. package/esm/typings/src/errors/utils/serializeError.test.d.ts +1 -0
  215. package/esm/typings/src/executables/$provideExecutablesForNode.d.ts +12 -0
  216. package/esm/typings/src/executables/apps/locateLibreoffice.d.ts +12 -0
  217. package/esm/typings/src/executables/apps/locateLibreoffice.test.d.ts +1 -0
  218. package/esm/typings/src/executables/apps/locatePandoc.d.ts +12 -0
  219. package/esm/typings/src/executables/apps/locatePandoc.test.d.ts +1 -0
  220. package/esm/typings/src/executables/locateApp.d.ts +33 -0
  221. package/esm/typings/src/executables/locateApp.test.d.ts +1 -0
  222. package/esm/typings/src/executables/platforms/locateAppOnLinux.d.ts +13 -0
  223. package/esm/typings/src/executables/platforms/locateAppOnMacOs.d.ts +13 -0
  224. package/esm/typings/src/executables/platforms/locateAppOnWindows.d.ts +13 -0
  225. package/esm/typings/src/execution/AbstractTaskResult.d.ts +25 -0
  226. package/esm/typings/src/execution/AvailableModel.d.ts +46 -0
  227. package/esm/typings/src/execution/CommonToolsOptions.d.ts +28 -0
  228. package/esm/typings/src/execution/EmbeddingVector.d.ts +8 -0
  229. package/esm/typings/src/execution/Executables.d.ts +18 -0
  230. package/esm/typings/src/execution/ExecutionTask.d.ts +119 -0
  231. package/esm/typings/src/execution/ExecutionTools.d.ts +69 -0
  232. package/esm/typings/src/execution/FilesystemTools.d.ts +9 -0
  233. package/esm/typings/src/execution/LlmExecutionTools.d.ts +61 -0
  234. package/esm/typings/src/execution/LlmExecutionToolsConstructor.d.ts +11 -0
  235. package/esm/typings/src/execution/PipelineExecutor.d.ts +16 -0
  236. package/esm/typings/src/execution/PipelineExecutorResult.d.ts +39 -0
  237. package/esm/typings/src/execution/PromptResult.d.ts +101 -0
  238. package/esm/typings/src/execution/PromptbookFetch.d.ts +12 -0
  239. package/esm/typings/src/execution/PromptbookFetch.test-type.d.ts +5 -0
  240. package/esm/typings/src/execution/ScriptExecutionTools.d.ts +39 -0
  241. package/esm/typings/src/execution/UncertainNumber.d.ts +19 -0
  242. package/esm/typings/src/execution/Usage.d.ts +33 -0
  243. package/esm/typings/src/execution/UserInterfaceTools.d.ts +46 -0
  244. package/esm/typings/src/execution/assertsTaskSuccessful.d.ts +14 -0
  245. package/esm/typings/src/execution/createPipelineExecutor/$OngoingTaskResult.d.ts +56 -0
  246. package/esm/typings/src/execution/createPipelineExecutor/00-CreatePipelineExecutorOptions.d.ts +46 -0
  247. package/esm/typings/src/execution/createPipelineExecutor/00-createPipelineExecutor.d.ts +10 -0
  248. package/esm/typings/src/execution/createPipelineExecutor/10-executePipeline.d.ts +48 -0
  249. package/esm/typings/src/execution/createPipelineExecutor/20-executeTask.d.ts +51 -0
  250. package/esm/typings/src/execution/createPipelineExecutor/30-executeFormatSubvalues.d.ts +27 -0
  251. package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +70 -0
  252. package/esm/typings/src/execution/createPipelineExecutor/computeCosineSimilarity.d.ts +13 -0
  253. package/esm/typings/src/execution/createPipelineExecutor/filterJustOutputParameters.d.ts +35 -0
  254. package/esm/typings/src/execution/createPipelineExecutor/getContextForTask.d.ts +14 -0
  255. package/esm/typings/src/execution/createPipelineExecutor/getExamplesForTask.d.ts +10 -0
  256. package/esm/typings/src/execution/createPipelineExecutor/getKnowledgeForTask.d.ts +42 -0
  257. package/esm/typings/src/execution/createPipelineExecutor/getReservedParametersForTask.d.ts +48 -0
  258. package/esm/typings/src/execution/createPipelineExecutor/knowledgePiecesToString.d.ts +9 -0
  259. package/esm/typings/src/execution/embeddingVectorToString.d.ts +7 -0
  260. package/esm/typings/src/execution/execution-report/ExecutionPromptReportJson.d.ts +24 -0
  261. package/esm/typings/src/execution/execution-report/ExecutionReportJson.d.ts +41 -0
  262. package/esm/typings/src/execution/execution-report/ExecutionReportString.d.ts +16 -0
  263. package/esm/typings/src/execution/execution-report/ExecutionReportStringOptions.d.ts +25 -0
  264. package/esm/typings/src/execution/execution-report/countWorkingDuration.d.ts +7 -0
  265. package/esm/typings/src/execution/execution-report/countWorkingDuration.test.d.ts +1 -0
  266. package/esm/typings/src/execution/execution-report/executionReportJsonToString.d.ts +15 -0
  267. package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/AutomaticTranslator.d.ts +7 -0
  268. package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/DebugAutomaticTranslator.d.ts +11 -0
  269. package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/FakeAutomaticTranslator.d.ts +8 -0
  270. package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/LindatAutomaticTranslator.d.ts +22 -0
  271. package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/TranslatorOptions.d.ts +7 -0
  272. package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.d.ts +8 -0
  273. package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.test.d.ts +1 -0
  274. package/esm/typings/src/execution/translation/automatic-translate/translateMessages.d.ts +12 -0
  275. package/esm/typings/src/execution/utils/$provideExecutionToolsForNode.d.ts +13 -0
  276. package/esm/typings/src/execution/utils/addUsage.d.ts +9 -0
  277. package/esm/typings/src/execution/utils/addUsage.test.d.ts +1 -0
  278. package/esm/typings/src/execution/utils/checkExpectations.d.ts +29 -0
  279. package/esm/typings/src/execution/utils/checkExpectations.test.d.ts +1 -0
  280. package/esm/typings/src/execution/utils/computeUsageCounts.d.ts +10 -0
  281. package/esm/typings/src/execution/utils/forEachAsync.d.ts +20 -0
  282. package/esm/typings/src/execution/utils/uncertainNumber.d.ts +10 -0
  283. package/esm/typings/src/execution/utils/usage-constants.d.ts +147 -0
  284. package/esm/typings/src/execution/utils/usageToHuman.d.ts +26 -0
  285. package/esm/typings/src/execution/utils/usageToWorktime.d.ts +20 -0
  286. package/esm/typings/src/execution/utils/usageToWorktime.test.d.ts +1 -0
  287. package/esm/typings/src/execution/utils/validatePromptResult.d.ts +53 -0
  288. package/esm/typings/src/expectations/drafts/isDomainNameFree.d.ts +10 -0
  289. package/esm/typings/src/expectations/drafts/isGithubNameFree.d.ts +10 -0
  290. package/esm/typings/src/formats/_common/FormatParser.d.ts +72 -0
  291. package/esm/typings/src/formats/_common/FormatSubvalueParser.d.ts +66 -0
  292. package/esm/typings/src/formats/csv/CsvFormatError.d.ts +10 -0
  293. package/esm/typings/src/formats/csv/CsvFormatParser.d.ts +17 -0
  294. package/esm/typings/src/formats/csv/CsvSettings.d.ts +13 -0
  295. package/esm/typings/src/formats/csv/utils/csvParse.d.ts +12 -0
  296. package/esm/typings/src/formats/csv/utils/isValidCsvString.d.ts +9 -0
  297. package/esm/typings/src/formats/csv/utils/isValidCsvString.test.d.ts +1 -0
  298. package/esm/typings/src/formats/index.d.ts +9 -0
  299. package/esm/typings/src/formats/json/JsonFormatParser.d.ts +19 -0
  300. package/esm/typings/src/formats/json/utils/isValidJsonString.d.ts +9 -0
  301. package/esm/typings/src/formats/json/utils/isValidJsonString.test.d.ts +1 -0
  302. package/esm/typings/src/formats/json/utils/jsonParse.d.ts +8 -0
  303. package/esm/typings/src/formats/text/TextFormatParser.d.ts +19 -0
  304. package/esm/typings/src/formats/xml/XmlFormatParser.d.ts +19 -0
  305. package/esm/typings/src/formats/xml/utils/isValidXmlString.d.ts +9 -0
  306. package/esm/typings/src/formats/xml/utils/isValidXmlString.test.d.ts +1 -0
  307. package/esm/typings/src/formfactors/_boilerplate/BoilerplateFormfactorDefinition.d.ts +15 -0
  308. package/esm/typings/src/formfactors/_common/AbstractFormfactorDefinition.d.ts +49 -0
  309. package/esm/typings/src/formfactors/_common/FormfactorDefinition.d.ts +10 -0
  310. package/esm/typings/src/formfactors/_common/string_formfactor_name.d.ts +6 -0
  311. package/esm/typings/src/formfactors/chatbot/ChatbotFormfactorDefinition.d.ts +45 -0
  312. package/esm/typings/src/formfactors/completion/CompletionFormfactorDefinition.d.ts +29 -0
  313. package/esm/typings/src/formfactors/generator/GeneratorFormfactorDefinition.d.ts +25 -0
  314. package/esm/typings/src/formfactors/generic/GenericFormfactorDefinition.d.ts +14 -0
  315. package/esm/typings/src/formfactors/image-generator/ImageGeneratorFormfactorDefinition.d.ts +24 -0
  316. package/esm/typings/src/formfactors/index.d.ts +170 -0
  317. package/esm/typings/src/formfactors/matcher/MatcherFormfactorDefinition.d.ts +21 -0
  318. package/esm/typings/src/formfactors/sheets/SheetsFormfactorDefinition.d.ts +26 -0
  319. package/esm/typings/src/formfactors/translator/TranslatorFormfactorDefinition.d.ts +25 -0
  320. package/esm/typings/src/high-level-abstractions/_common/HighLevelAbstraction.d.ts +20 -0
  321. package/esm/typings/src/high-level-abstractions/implicit-formfactor/ImplicitFormfactorHla.d.ts +10 -0
  322. package/esm/typings/src/high-level-abstractions/index.d.ts +54 -0
  323. package/esm/typings/src/high-level-abstractions/quick-chatbot/QuickChatbotHla.d.ts +13 -0
  324. package/esm/typings/src/llm-providers/_common/filterModels.d.ts +15 -0
  325. package/esm/typings/src/llm-providers/_common/register/$llmToolsMetadataRegister.d.ts +13 -0
  326. package/esm/typings/src/llm-providers/_common/register/$llmToolsRegister.d.ts +13 -0
  327. package/esm/typings/src/llm-providers/_common/register/$provideEnvFilename.d.ts +12 -0
  328. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts +19 -0
  329. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts +27 -0
  330. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForWizardOrCli.d.ts +59 -0
  331. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsFromEnv.d.ts +41 -0
  332. package/esm/typings/src/llm-providers/_common/register/$registeredLlmToolsMessage.d.ts +22 -0
  333. package/esm/typings/src/llm-providers/_common/register/LlmToolsConfiguration.d.ts +30 -0
  334. package/esm/typings/src/llm-providers/_common/register/LlmToolsMetadata.d.ts +58 -0
  335. package/esm/typings/src/llm-providers/_common/register/LlmToolsOptions.d.ts +17 -0
  336. package/esm/typings/src/llm-providers/_common/register/createLlmToolsFromConfiguration.d.ts +49 -0
  337. package/esm/typings/src/llm-providers/_common/register/createLlmToolsFromConfiguration.test.d.ts +1 -0
  338. package/esm/typings/src/llm-providers/_common/utils/cache/CacheItem.d.ts +33 -0
  339. package/esm/typings/src/llm-providers/_common/utils/cache/CacheLlmToolsOptions.d.ts +27 -0
  340. package/esm/typings/src/llm-providers/_common/utils/cache/cacheLlmTools.d.ts +19 -0
  341. package/esm/typings/src/llm-providers/_common/utils/count-total-usage/LlmExecutionToolsWithTotalUsage.d.ts +22 -0
  342. package/esm/typings/src/llm-providers/_common/utils/count-total-usage/countUsage.d.ts +17 -0
  343. package/esm/typings/src/llm-providers/_common/utils/count-total-usage/limitTotalUsage.d.ts +36 -0
  344. package/esm/typings/src/llm-providers/_common/utils/pricing.d.ts +16 -0
  345. package/esm/typings/src/llm-providers/_common/utils/pricing.test.d.ts +1 -0
  346. package/esm/typings/src/llm-providers/_multiple/MultipleLlmExecutionTools.d.ts +63 -0
  347. package/esm/typings/src/llm-providers/_multiple/joinLlmExecutionTools.d.ts +21 -0
  348. package/esm/typings/src/llm-providers/_multiple/playground/playground.d.ts +5 -0
  349. package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +66 -0
  350. package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +31 -0
  351. package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +24 -0
  352. package/esm/typings/src/llm-providers/anthropic-claude/computeAnthropicClaudeUsage.d.ts +18 -0
  353. package/esm/typings/src/llm-providers/anthropic-claude/computeAnthropicClaudeUsage.test.d.ts +4 -0
  354. package/esm/typings/src/llm-providers/anthropic-claude/createAnthropicClaudeExecutionTools.d.ts +19 -0
  355. package/esm/typings/src/llm-providers/anthropic-claude/playground/playground.d.ts +7 -0
  356. package/esm/typings/src/llm-providers/anthropic-claude/register-configuration.d.ts +14 -0
  357. package/esm/typings/src/llm-providers/anthropic-claude/register-constructor.d.ts +16 -0
  358. package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +67 -0
  359. package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +37 -0
  360. package/esm/typings/src/llm-providers/azure-openai/createAzureOpenAiExecutionTools.d.ts +15 -0
  361. package/esm/typings/src/llm-providers/azure-openai/playground/playground.d.ts +6 -0
  362. package/esm/typings/src/llm-providers/azure-openai/register-configuration.d.ts +14 -0
  363. package/esm/typings/src/llm-providers/azure-openai/register-constructor.d.ts +15 -0
  364. package/esm/typings/src/llm-providers/deepseek/DeepseekExecutionToolsOptions.d.ts +9 -0
  365. package/esm/typings/src/llm-providers/deepseek/createDeepseekExecutionTools.d.ts +14 -0
  366. package/esm/typings/src/llm-providers/deepseek/deepseek-models.d.ts +23 -0
  367. package/esm/typings/src/llm-providers/deepseek/register-configuration.d.ts +14 -0
  368. package/esm/typings/src/llm-providers/deepseek/register-constructor.d.ts +15 -0
  369. package/esm/typings/src/llm-providers/google/GoogleExecutionToolsOptions.d.ts +9 -0
  370. package/esm/typings/src/llm-providers/google/createGoogleExecutionTools.d.ts +14 -0
  371. package/esm/typings/src/llm-providers/google/google-models.d.ts +23 -0
  372. package/esm/typings/src/llm-providers/google/register-configuration.d.ts +14 -0
  373. package/esm/typings/src/llm-providers/google/register-constructor.d.ts +15 -0
  374. package/esm/typings/src/llm-providers/mocked/$fakeTextToExpectations.d.ts +15 -0
  375. package/esm/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +40 -0
  376. package/esm/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +44 -0
  377. package/esm/typings/src/llm-providers/mocked/test/fakeTextToExpectations.test.d.ts +1 -0
  378. package/esm/typings/src/llm-providers/mocked/test/faked-completion.test.d.ts +1 -0
  379. package/esm/typings/src/llm-providers/mocked/test/joker.test.d.ts +4 -0
  380. package/esm/typings/src/llm-providers/mocked/test/mocked-chat.test.d.ts +5 -0
  381. package/esm/typings/src/llm-providers/mocked/test/mocked-completion.test.d.ts +4 -0
  382. package/esm/typings/src/llm-providers/ollama/OllamaExecutionTools.d.ts +44 -0
  383. package/esm/typings/src/llm-providers/ollama/OllamaExecutionToolsOptions.d.ts +23 -0
  384. package/esm/typings/src/llm-providers/ollama/createOllamaExecutionTools.d.ts +11 -0
  385. package/esm/typings/src/llm-providers/ollama/ollama-models.d.ts +14 -0
  386. package/esm/typings/src/llm-providers/ollama/playground/playground.d.ts +6 -0
  387. package/esm/typings/src/llm-providers/ollama/register-configuration.d.ts +14 -0
  388. package/esm/typings/src/llm-providers/ollama/register-constructor.d.ts +15 -0
  389. package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +36 -0
  390. package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionToolsOptions.d.ts +14 -0
  391. package/esm/typings/src/llm-providers/openai/OpenAiCompatibleExecutionTools.d.ts +91 -0
  392. package/esm/typings/src/llm-providers/openai/OpenAiCompatibleExecutionToolsOptions.d.ts +52 -0
  393. package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +38 -0
  394. package/esm/typings/src/llm-providers/openai/OpenAiExecutionToolsOptions.d.ts +9 -0
  395. package/esm/typings/src/llm-providers/openai/computeOpenAiUsage.d.ts +18 -0
  396. package/esm/typings/src/llm-providers/openai/computeOpenAiUsage.test.d.ts +4 -0
  397. package/esm/typings/src/llm-providers/openai/createOpenAiAssistantExecutionTools.d.ts +15 -0
  398. package/esm/typings/src/llm-providers/openai/createOpenAiCompatibleExecutionTools.d.ts +74 -0
  399. package/esm/typings/src/llm-providers/openai/createOpenAiExecutionTools.d.ts +17 -0
  400. package/esm/typings/src/llm-providers/openai/openai-models.d.ts +25 -0
  401. package/esm/typings/src/llm-providers/openai/playground/playground.d.ts +6 -0
  402. package/esm/typings/src/llm-providers/openai/register-configuration.d.ts +35 -0
  403. package/esm/typings/src/llm-providers/openai/register-constructor.d.ts +39 -0
  404. package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +59 -0
  405. package/esm/typings/src/llm-providers/remote/playground/playground.d.ts +5 -0
  406. package/esm/typings/src/llm-providers/vercel/VercelExecutionToolsOptions.d.ts +23 -0
  407. package/esm/typings/src/llm-providers/vercel/VercelProvider.d.ts +13 -0
  408. package/esm/typings/src/llm-providers/vercel/createExecutionToolsFromVercelProvider.d.ts +8 -0
  409. package/esm/typings/src/llm-providers/vercel/playground/playground.d.ts +6 -0
  410. package/esm/typings/src/migrations/migratePipeline.d.ts +9 -0
  411. package/esm/typings/src/other/templates/getBookTemplates.d.ts +24 -0
  412. package/esm/typings/src/other/templates/getTemplatesPipelineCollection.d.ts +10 -0
  413. package/esm/typings/src/personas/preparePersona.d.ts +17 -0
  414. package/esm/typings/src/pipeline/PipelineInterface/PipelineInterface.d.ts +22 -0
  415. package/esm/typings/src/pipeline/PipelineInterface/constants.d.ts +14 -0
  416. package/esm/typings/src/pipeline/PipelineInterface/getPipelineInterface.d.ts +11 -0
  417. package/esm/typings/src/pipeline/PipelineInterface/isPipelineImplementingInterface.d.ts +27 -0
  418. package/esm/typings/src/pipeline/PipelineInterface/isPipelineInterfacesEqual.d.ts +10 -0
  419. package/esm/typings/src/pipeline/PipelineJson/CommonTaskJson.d.ts +103 -0
  420. package/esm/typings/src/pipeline/PipelineJson/DialogTaskJson.d.ts +13 -0
  421. package/esm/typings/src/pipeline/PipelineJson/Expectations.d.ts +40 -0
  422. package/esm/typings/src/pipeline/PipelineJson/KnowledgePieceJson.d.ts +73 -0
  423. package/esm/typings/src/pipeline/PipelineJson/KnowledgeSourceJson.d.ts +44 -0
  424. package/esm/typings/src/pipeline/PipelineJson/ParameterJson.d.ts +98 -0
  425. package/esm/typings/src/pipeline/PipelineJson/PersonaJson.d.ts +47 -0
  426. package/esm/typings/src/pipeline/PipelineJson/PipelineJson.d.ts +113 -0
  427. package/esm/typings/src/pipeline/PipelineJson/PreparationJson.d.ts +22 -0
  428. package/esm/typings/src/pipeline/PipelineJson/PromptTaskJson.d.ts +26 -0
  429. package/esm/typings/src/pipeline/PipelineJson/ScriptTaskJson.d.ts +20 -0
  430. package/esm/typings/src/pipeline/PipelineJson/SimpleTaskJson.d.ts +13 -0
  431. package/esm/typings/src/pipeline/PipelineJson/TaskJson.d.ts +11 -0
  432. package/esm/typings/src/pipeline/PipelineString.d.ts +11 -0
  433. package/esm/typings/src/pipeline/book-notation.d.ts +20 -0
  434. package/esm/typings/src/pipeline/isValidPipelineString.d.ts +13 -0
  435. package/esm/typings/src/pipeline/isValidPipelineString.test.d.ts +4 -0
  436. package/esm/typings/src/pipeline/prompt-notation.d.ts +31 -0
  437. package/esm/typings/src/pipeline/prompt-notation.test.d.ts +4 -0
  438. package/esm/typings/src/pipeline/validatePipelineString.d.ts +14 -0
  439. package/esm/typings/src/playground/playground.d.ts +5 -0
  440. package/esm/typings/src/postprocessing/utils/extractBlock.d.ts +16 -0
  441. package/esm/typings/src/postprocessing/utils/extractJsonBlock.d.ts +25 -0
  442. package/esm/typings/src/postprocessing/utils/extractJsonBlock.test.d.ts +1 -0
  443. package/esm/typings/src/prepare/PrepareAndScrapeOptions.d.ts +51 -0
  444. package/esm/typings/src/prepare/isPipelinePrepared.d.ts +18 -0
  445. package/esm/typings/src/prepare/isPipelinePrepared.test.d.ts +1 -0
  446. package/esm/typings/src/prepare/preparePipeline.d.ts +22 -0
  447. package/esm/typings/src/prepare/preparePipelineOnRemoteServer.d.ts +17 -0
  448. package/esm/typings/src/prepare/prepareTasks.d.ts +36 -0
  449. package/esm/typings/src/prepare/unpreparePipeline.d.ts +13 -0
  450. package/esm/typings/src/remote-server/RemoteServer.d.ts +23 -0
  451. package/esm/typings/src/remote-server/createRemoteClient.d.ts +10 -0
  452. package/esm/typings/src/remote-server/openapi-types.d.ts +626 -0
  453. package/esm/typings/src/remote-server/openapi.d.ts +581 -0
  454. package/esm/typings/src/remote-server/socket-types/_common/PromptbookServer_Error.d.ts +7 -0
  455. package/esm/typings/src/remote-server/socket-types/_subtypes/Identification.d.ts +59 -0
  456. package/esm/typings/src/remote-server/socket-types/_subtypes/identificationToPromptbookToken.d.ts +11 -0
  457. package/esm/typings/src/remote-server/socket-types/_subtypes/promptbookTokenToIdentification.d.ts +10 -0
  458. package/esm/typings/src/remote-server/socket-types/listModels/PromptbookServer_ListModels_Request.d.ts +17 -0
  459. package/esm/typings/src/remote-server/socket-types/listModels/PromptbookServer_ListModels_Response.d.ts +17 -0
  460. package/esm/typings/src/remote-server/socket-types/prepare/PromptbookServer_PreparePipeline_Request.d.ts +17 -0
  461. package/esm/typings/src/remote-server/socket-types/prepare/PromptbookServer_PreparePipeline_Response.d.ts +12 -0
  462. package/esm/typings/src/remote-server/socket-types/prompt/PromptbookServer_Prompt_Request.d.ts +17 -0
  463. package/esm/typings/src/remote-server/socket-types/prompt/PromptbookServer_Prompt_Response.d.ts +12 -0
  464. package/esm/typings/src/remote-server/startRemoteServer.d.ts +25 -0
  465. package/esm/typings/src/remote-server/types/RemoteClientOptions.d.ts +24 -0
  466. package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +164 -0
  467. package/esm/typings/src/scrapers/_boilerplate/BoilerplateScraper.d.ts +43 -0
  468. package/esm/typings/src/scrapers/_boilerplate/createBoilerplateScraper.d.ts +20 -0
  469. package/esm/typings/src/scrapers/_boilerplate/playground/boilerplate-scraper-playground.d.ts +5 -0
  470. package/esm/typings/src/scrapers/_boilerplate/register-constructor.d.ts +15 -0
  471. package/esm/typings/src/scrapers/_boilerplate/register-metadata.d.ts +28 -0
  472. package/esm/typings/src/scrapers/_common/Converter.d.ts +25 -0
  473. package/esm/typings/src/scrapers/_common/Scraper.d.ts +60 -0
  474. package/esm/typings/src/scrapers/_common/ScraperIntermediateSource.d.ts +16 -0
  475. package/esm/typings/src/scrapers/_common/prepareKnowledgePieces.d.ts +19 -0
  476. package/esm/typings/src/scrapers/_common/prepareKnowledgePieces.test.d.ts +1 -0
  477. package/esm/typings/src/scrapers/_common/register/$provideFilesystemForNode.d.ts +12 -0
  478. package/esm/typings/src/scrapers/_common/register/$provideScrapersForBrowser.d.ts +15 -0
  479. package/esm/typings/src/scrapers/_common/register/$provideScrapersForNode.d.ts +13 -0
  480. package/esm/typings/src/scrapers/_common/register/$provideScriptingForNode.d.ts +11 -0
  481. package/esm/typings/src/scrapers/_common/register/$registeredScrapersMessage.d.ts +13 -0
  482. package/esm/typings/src/scrapers/_common/register/$scrapersMetadataRegister.d.ts +13 -0
  483. package/esm/typings/src/scrapers/_common/register/$scrapersRegister.d.ts +14 -0
  484. package/esm/typings/src/scrapers/_common/register/ScraperAndConverterMetadata.d.ts +46 -0
  485. package/esm/typings/src/scrapers/_common/register/ScraperConstructor.d.ts +13 -0
  486. package/esm/typings/src/scrapers/_common/utils/getScraperIntermediateSource.d.ts +35 -0
  487. package/esm/typings/src/scrapers/_common/utils/getScraperIntermediateSource.test.d.ts +4 -0
  488. package/esm/typings/src/scrapers/_common/utils/makeKnowledgeSourceHandler.d.ts +13 -0
  489. package/esm/typings/src/scrapers/_common/utils/promptbookFetch.d.ts +10 -0
  490. package/esm/typings/src/scrapers/document/DocumentScraper.d.ts +43 -0
  491. package/esm/typings/src/scrapers/document/DocumentScraper.test.d.ts +4 -0
  492. package/esm/typings/src/scrapers/document/createDocumentScraper.d.ts +20 -0
  493. package/esm/typings/src/scrapers/document/playground/document-scraper-playground.d.ts +5 -0
  494. package/esm/typings/src/scrapers/document/register-constructor.d.ts +15 -0
  495. package/esm/typings/src/scrapers/document/register-metadata.d.ts +28 -0
  496. package/esm/typings/src/scrapers/document-legacy/LegacyDocumentScraper.d.ts +43 -0
  497. package/esm/typings/src/scrapers/document-legacy/LegacyDocumentScraper.test.d.ts +4 -0
  498. package/esm/typings/src/scrapers/document-legacy/createLegacyDocumentScraper.d.ts +21 -0
  499. package/esm/typings/src/scrapers/document-legacy/playground/legacy-document-scraper-playground.d.ts +5 -0
  500. package/esm/typings/src/scrapers/document-legacy/register-constructor.d.ts +15 -0
  501. package/esm/typings/src/scrapers/document-legacy/register-metadata.d.ts +28 -0
  502. package/esm/typings/src/scrapers/markdown/MarkdownScraper.d.ts +29 -0
  503. package/esm/typings/src/scrapers/markdown/MarkdownScraper.test.d.ts +4 -0
  504. package/esm/typings/src/scrapers/markdown/createMarkdownScraper.d.ts +20 -0
  505. package/esm/typings/src/scrapers/markdown/playground/markdown-scraper-playground.d.ts +5 -0
  506. package/esm/typings/src/scrapers/markdown/register-constructor.d.ts +15 -0
  507. package/esm/typings/src/scrapers/markdown/register-metadata.d.ts +28 -0
  508. package/esm/typings/src/scrapers/markitdown/MarkitdownScraper.d.ts +50 -0
  509. package/esm/typings/src/scrapers/markitdown/createMarkitdownScraper.d.ts +22 -0
  510. package/esm/typings/src/scrapers/markitdown/playground/markitdown-scraper-playground.d.ts +5 -0
  511. package/esm/typings/src/scrapers/markitdown/register-constructor.d.ts +17 -0
  512. package/esm/typings/src/scrapers/markitdown/register-metadata.d.ts +28 -0
  513. package/esm/typings/src/scrapers/pdf/PdfScraper.d.ts +41 -0
  514. package/esm/typings/src/scrapers/pdf/createPdfScraper.d.ts +21 -0
  515. package/esm/typings/src/scrapers/pdf/playground/pdf-scraper-playground.d.ts +5 -0
  516. package/esm/typings/src/scrapers/pdf/register-constructor.d.ts +15 -0
  517. package/esm/typings/src/scrapers/pdf/register-metadata.d.ts +28 -0
  518. package/esm/typings/src/scrapers/website/WebsiteScraper.d.ts +50 -0
  519. package/esm/typings/src/scrapers/website/createWebsiteScraper.d.ts +21 -0
  520. package/esm/typings/src/scrapers/website/playground/website-scraper-playground.d.ts +5 -0
  521. package/esm/typings/src/scrapers/website/register-constructor.d.ts +15 -0
  522. package/esm/typings/src/scrapers/website/register-metadata.d.ts +28 -0
  523. package/esm/typings/src/scrapers/website/utils/createShowdownConverter.d.ts +7 -0
  524. package/esm/typings/src/scrapers/website/utils/createShowdownConverter.test.d.ts +1 -0
  525. package/esm/typings/src/scripting/_test/custom-function-async.test.ts.test.d.ts +1 -0
  526. package/esm/typings/src/scripting/_test/custom-function-missing.test.d.ts +1 -0
  527. package/esm/typings/src/scripting/_test/custom-function-with-dependencies.test.d.ts +1 -0
  528. package/esm/typings/src/scripting/_test/custom-function.test.d.ts +1 -0
  529. package/esm/typings/src/scripting/_test/postprocessing.test.d.ts +1 -0
  530. package/esm/typings/src/scripting/_test/script-execution-errors.test.d.ts +1 -0
  531. package/esm/typings/src/scripting/_test/script-execution-tools.test.d.ts +1 -0
  532. package/esm/typings/src/scripting/javascript/JavascriptEvalExecutionTools.d.ts +22 -0
  533. package/esm/typings/src/scripting/javascript/JavascriptEvalExecutionTools.test.d.ts +4 -0
  534. package/esm/typings/src/scripting/javascript/JavascriptExecutionTools.d.ts +8 -0
  535. package/esm/typings/src/scripting/javascript/JavascriptExecutionToolsOptions.d.ts +26 -0
  536. package/esm/typings/src/scripting/javascript/postprocessing-functions.d.ts +56 -0
  537. package/esm/typings/src/scripting/javascript/utils/extractVariablesFromJavascript.d.ts +14 -0
  538. package/esm/typings/src/scripting/javascript/utils/extractVariablesFromJavascript.test.d.ts +1 -0
  539. package/esm/typings/src/scripting/javascript/utils/extractVariablesFromScript.test.d.ts +1 -0
  540. package/esm/typings/src/scripting/javascript/utils/preserve.d.ts +14 -0
  541. package/esm/typings/src/scripting/python/PythonExecutionTools.d.ts +18 -0
  542. package/esm/typings/src/scripting/typescript/TypescriptExecutionTools.d.ts +18 -0
  543. package/esm/typings/src/storage/_common/PromptbookStorage.d.ts +24 -0
  544. package/esm/typings/src/storage/_common/PromptbookStorage.test-type.d.ts +5 -0
  545. package/esm/typings/src/storage/blackhole/BlackholeStorage.d.ts +33 -0
  546. package/esm/typings/src/storage/env-storage/$EnvStorage.d.ts +40 -0
  547. package/esm/typings/src/storage/file-cache-storage/FileCacheStorage.d.ts +40 -0
  548. package/esm/typings/src/storage/file-cache-storage/FileCacheStorageOptions.d.ts +12 -0
  549. package/esm/typings/src/storage/file-cache-storage/utils/nameToSubfolderPath.d.ts +8 -0
  550. package/esm/typings/src/storage/file-cache-storage/utils/nameToSubfolderPath.test.d.ts +1 -0
  551. package/esm/typings/src/storage/local-storage/getIndexedDbStorage.d.ts +11 -0
  552. package/esm/typings/src/storage/local-storage/getLocalStorage.d.ts +10 -0
  553. package/esm/typings/src/storage/local-storage/getSessionStorage.d.ts +10 -0
  554. package/esm/typings/src/storage/local-storage/utils/IndexedDbStorageOptions.d.ts +14 -0
  555. package/esm/typings/src/storage/local-storage/utils/makePromptbookStorageFromIndexedDb.d.ts +8 -0
  556. package/esm/typings/src/storage/local-storage/utils/makePromptbookStorageFromWebStorage.d.ts +12 -0
  557. package/esm/typings/src/storage/memory/MemoryStorage.d.ts +33 -0
  558. package/esm/typings/src/storage/utils/PrefixStorage.d.ts +25 -0
  559. package/esm/typings/src/types/Arrayable.d.ts +11 -0
  560. package/esm/typings/src/types/IntermediateFilesStrategy.d.ts +8 -0
  561. package/esm/typings/src/types/ModelRequirements.d.ts +104 -0
  562. package/esm/typings/src/types/ModelVariant.d.ts +15 -0
  563. package/esm/typings/src/types/NonEmptyArray.d.ts +8 -0
  564. package/esm/typings/src/types/Prompt.d.ts +111 -0
  565. package/esm/typings/src/types/ScriptLanguage.d.ts +13 -0
  566. package/esm/typings/src/types/SectionType.d.ts +21 -0
  567. package/esm/typings/src/types/TaskType.d.ts +15 -0
  568. package/esm/typings/src/types/typeAliasEmoji.d.ts +12 -0
  569. package/esm/typings/src/types/typeAliases.d.ts +685 -0
  570. package/esm/typings/src/utils/$Register.d.ts +40 -0
  571. package/esm/typings/src/utils/$getCurrentDate.d.ts +10 -0
  572. package/esm/typings/src/utils/FromtoItems.d.ts +19 -0
  573. package/esm/typings/src/utils/arrayableToArray.d.ts +11 -0
  574. package/esm/typings/src/utils/arrayableToArray.test.d.ts +1 -0
  575. package/esm/typings/src/utils/editable/edit-pipeline-string/addPipelineCommand.d.ts +17 -0
  576. package/esm/typings/src/utils/editable/edit-pipeline-string/addPipelineCommand.test.d.ts +1 -0
  577. package/esm/typings/src/utils/editable/edit-pipeline-string/deflatePipeline.d.ts +13 -0
  578. package/esm/typings/src/utils/editable/edit-pipeline-string/deflatePipeline.test.d.ts +1 -0
  579. package/esm/typings/src/utils/editable/edit-pipeline-string/removePipelineCommand.d.ts +22 -0
  580. package/esm/typings/src/utils/editable/edit-pipeline-string/removePipelineCommand.test.d.ts +1 -0
  581. package/esm/typings/src/utils/editable/types/PipelineEditableSerialized.d.ts +27 -0
  582. package/esm/typings/src/utils/editable/utils/isFlatPipeline.d.ts +8 -0
  583. package/esm/typings/src/utils/editable/utils/isFlatPipeline.test.d.ts +1 -0
  584. package/esm/typings/src/utils/editable/utils/renamePipelineParameter.d.ts +29 -0
  585. package/esm/typings/src/utils/editable/utils/renamePipelineParameter.test.d.ts +1 -0
  586. package/esm/typings/src/utils/editable/utils/stringifyPipelineJson.d.ts +16 -0
  587. package/esm/typings/src/utils/emojis.d.ts +24 -0
  588. package/esm/typings/src/utils/environment/$getGlobalScope.d.ts +10 -0
  589. package/esm/typings/src/utils/environment/$isRunningInBrowser.d.ts +11 -0
  590. package/esm/typings/src/utils/environment/$isRunningInJest.d.ts +11 -0
  591. package/esm/typings/src/utils/environment/$isRunningInNode.d.ts +11 -0
  592. package/esm/typings/src/utils/environment/$isRunningInWebWorker.d.ts +11 -0
  593. package/esm/typings/src/utils/execCommand/$execCommand.d.ts +16 -0
  594. package/esm/typings/src/utils/execCommand/$execCommandNormalizeOptions.d.ts +12 -0
  595. package/esm/typings/src/utils/execCommand/$execCommands.d.ts +18 -0
  596. package/esm/typings/src/utils/execCommand/ExecCommandOptions.d.ts +45 -0
  597. package/esm/typings/src/utils/execCommand/execCommand.test.d.ts +1 -0
  598. package/esm/typings/src/utils/execCommand/execCommandNormalizeOptions.test.d.ts +1 -0
  599. package/esm/typings/src/utils/expectation-counters/constants.d.ts +16 -0
  600. package/esm/typings/src/utils/expectation-counters/countCharacters.d.ts +10 -0
  601. package/esm/typings/src/utils/expectation-counters/countCharacters.test.d.ts +1 -0
  602. package/esm/typings/src/utils/expectation-counters/countLines.d.ts +12 -0
  603. package/esm/typings/src/utils/expectation-counters/countLines.test.d.ts +1 -0
  604. package/esm/typings/src/utils/expectation-counters/countPages.d.ts +12 -0
  605. package/esm/typings/src/utils/expectation-counters/countPages.test.d.ts +1 -0
  606. package/esm/typings/src/utils/expectation-counters/countParagraphs.d.ts +10 -0
  607. package/esm/typings/src/utils/expectation-counters/countParagraphs.test.d.ts +1 -0
  608. package/esm/typings/src/utils/expectation-counters/countSentences.d.ts +16 -0
  609. package/esm/typings/src/utils/expectation-counters/countSentences.test.d.ts +1 -0
  610. package/esm/typings/src/utils/expectation-counters/countWords.d.ts +10 -0
  611. package/esm/typings/src/utils/expectation-counters/countWords.test.d.ts +1 -0
  612. package/esm/typings/src/utils/expectation-counters/index.d.ts +12 -0
  613. package/esm/typings/src/utils/files/extensionToMimeType.d.ts +8 -0
  614. package/esm/typings/src/utils/files/extensionToMimeType.test.d.ts +1 -0
  615. package/esm/typings/src/utils/files/getFileExtension.d.ts +8 -0
  616. package/esm/typings/src/utils/files/getFileExtension.test.d.ts +1 -0
  617. package/esm/typings/src/utils/files/isDirectoryExisting.d.ts +14 -0
  618. package/esm/typings/src/utils/files/isDirectoryExisting.test.d.ts +1 -0
  619. package/esm/typings/src/utils/files/isExecutable.d.ts +11 -0
  620. package/esm/typings/src/utils/files/isFileExisting.d.ts +13 -0
  621. package/esm/typings/src/utils/files/isFileExisting.test.d.ts +1 -0
  622. package/esm/typings/src/utils/files/listAllFiles.d.ts +17 -0
  623. package/esm/typings/src/utils/files/listAllFiles.test.d.ts +1 -0
  624. package/esm/typings/src/utils/files/mimeTypeToExtension.d.ts +10 -0
  625. package/esm/typings/src/utils/files/mimeTypeToExtension.test.d.ts +1 -0
  626. package/esm/typings/src/utils/markdown/addAutoGeneratedSection.d.ts +14 -0
  627. package/esm/typings/src/utils/markdown/addAutoGeneratedSection.test.d.ts +1 -0
  628. package/esm/typings/src/utils/markdown/createMarkdownChart.d.ts +38 -0
  629. package/esm/typings/src/utils/markdown/createMarkdownChart.test.d.ts +1 -0
  630. package/esm/typings/src/utils/markdown/createMarkdownTable.d.ts +11 -0
  631. package/esm/typings/src/utils/markdown/createMarkdownTable.test.d.ts +1 -0
  632. package/esm/typings/src/utils/markdown/escapeMarkdownBlock.d.ts +11 -0
  633. package/esm/typings/src/utils/markdown/escapeMarkdownBlock.test.d.ts +1 -0
  634. package/esm/typings/src/utils/markdown/extractAllBlocksFromMarkdown-real.test.d.ts +1 -0
  635. package/esm/typings/src/utils/markdown/extractAllBlocksFromMarkdown.d.ts +36 -0
  636. package/esm/typings/src/utils/markdown/extractAllBlocksFromMarkdown.test.d.ts +1 -0
  637. package/esm/typings/src/utils/markdown/extractAllListItemsFromMarkdown.d.ts +15 -0
  638. package/esm/typings/src/utils/markdown/extractAllListItemsFromMarkdown.test.d.ts +1 -0
  639. package/esm/typings/src/utils/markdown/extractOneBlockFromMarkdown.d.ts +22 -0
  640. package/esm/typings/src/utils/markdown/extractOneBlockFromMarkdown.test.d.ts +1 -0
  641. package/esm/typings/src/utils/markdown/flattenMarkdown.d.ts +17 -0
  642. package/esm/typings/src/utils/markdown/flattenMarkdown.test.d.ts +1 -0
  643. package/esm/typings/src/utils/markdown/parseMarkdownSection.d.ts +34 -0
  644. package/esm/typings/src/utils/markdown/parseMarkdownSection.test.d.ts +1 -0
  645. package/esm/typings/src/utils/markdown/prettifyMarkdown.d.ts +9 -0
  646. package/esm/typings/src/utils/markdown/prettifyMarkdown.test.d.ts +1 -0
  647. package/esm/typings/src/utils/markdown/removeMarkdownComments.d.ts +10 -0
  648. package/esm/typings/src/utils/markdown/removeMarkdownComments.test.d.ts +1 -0
  649. package/esm/typings/src/utils/markdown/removeMarkdownFormatting.d.ts +9 -0
  650. package/esm/typings/src/utils/markdown/removeMarkdownFormatting.test.d.ts +1 -0
  651. package/esm/typings/src/utils/markdown/splitMarkdownIntoSections.d.ts +15 -0
  652. package/esm/typings/src/utils/markdown/splitMarkdownIntoSections.test.d.ts +1 -0
  653. package/esm/typings/src/utils/normalization/DIACRITIC_VARIANTS_LETTERS.d.ts +12 -0
  654. package/esm/typings/src/utils/normalization/IKeywords.d.ts +21 -0
  655. package/esm/typings/src/utils/normalization/capitalize.d.ts +6 -0
  656. package/esm/typings/src/utils/normalization/capitalize.test.d.ts +1 -0
  657. package/esm/typings/src/utils/normalization/decapitalize.d.ts +6 -0
  658. package/esm/typings/src/utils/normalization/decapitalize.test.d.ts +1 -0
  659. package/esm/typings/src/utils/normalization/isValidKeyword.d.ts +10 -0
  660. package/esm/typings/src/utils/normalization/isValidKeyword.test.d.ts +1 -0
  661. package/esm/typings/src/utils/normalization/nameToUriPart.d.ts +9 -0
  662. package/esm/typings/src/utils/normalization/nameToUriPart.test.d.ts +1 -0
  663. package/esm/typings/src/utils/normalization/nameToUriParts.d.ts +9 -0
  664. package/esm/typings/src/utils/normalization/nameToUriParts.test.d.ts +1 -0
  665. package/esm/typings/src/utils/normalization/normalize-to-kebab-case.d.ts +21 -0
  666. package/esm/typings/src/utils/normalization/normalize-to-kebab-case.test.d.ts +1 -0
  667. package/esm/typings/src/utils/normalization/normalizeTo_PascalCase.d.ts +17 -0
  668. package/esm/typings/src/utils/normalization/normalizeTo_PascalCase.test.d.ts +1 -0
  669. package/esm/typings/src/utils/normalization/normalizeTo_SCREAMING_CASE.d.ts +26 -0
  670. package/esm/typings/src/utils/normalization/normalizeTo_SCREAMING_CASE.test.d.ts +1 -0
  671. package/esm/typings/src/utils/normalization/normalizeTo_camelCase.d.ts +22 -0
  672. package/esm/typings/src/utils/normalization/normalizeTo_camelCase.test.d.ts +1 -0
  673. package/esm/typings/src/utils/normalization/normalizeTo_snake_case.d.ts +17 -0
  674. package/esm/typings/src/utils/normalization/normalizeTo_snake_case.test.d.ts +1 -0
  675. package/esm/typings/src/utils/normalization/normalizeWhitespaces.d.ts +6 -0
  676. package/esm/typings/src/utils/normalization/normalizeWhitespaces.test.d.ts +1 -0
  677. package/esm/typings/src/utils/normalization/orderJson.d.ts +21 -0
  678. package/esm/typings/src/utils/normalization/orderJson.test.d.ts +4 -0
  679. package/esm/typings/src/utils/normalization/parseKeywords.d.ts +16 -0
  680. package/esm/typings/src/utils/normalization/parseKeywords.test.d.ts +1 -0
  681. package/esm/typings/src/utils/normalization/parseKeywordsFromString.d.ts +9 -0
  682. package/esm/typings/src/utils/normalization/parseKeywordsFromString.test.d.ts +1 -0
  683. package/esm/typings/src/utils/normalization/removeDiacritics.d.ts +11 -0
  684. package/esm/typings/src/utils/normalization/removeDiacritics.test.d.ts +1 -0
  685. package/esm/typings/src/utils/normalization/searchKeywords.d.ts +13 -0
  686. package/esm/typings/src/utils/normalization/searchKeywords.test.d.ts +1 -0
  687. package/esm/typings/src/utils/normalization/suffixUrl.d.ts +7 -0
  688. package/esm/typings/src/utils/normalization/suffixUrl.test.d.ts +1 -0
  689. package/esm/typings/src/utils/normalization/titleToName.d.ts +9 -0
  690. package/esm/typings/src/utils/normalization/titleToName.test.d.ts +1 -0
  691. package/esm/typings/src/utils/organization/$sideEffect.d.ts +9 -0
  692. package/esm/typings/src/utils/organization/TODO_USE.d.ts +12 -0
  693. package/esm/typings/src/utils/organization/TODO_any.d.ts +6 -0
  694. package/esm/typings/src/utils/organization/TODO_narrow.d.ts +6 -0
  695. package/esm/typings/src/utils/organization/TODO_object.d.ts +6 -0
  696. package/esm/typings/src/utils/organization/TODO_remove_as.d.ts +6 -0
  697. package/esm/typings/src/utils/organization/TODO_string.d.ts +6 -0
  698. package/esm/typings/src/utils/organization/TODO_unknown.d.ts +6 -0
  699. package/esm/typings/src/utils/organization/___and___.d.ts +7 -0
  700. package/esm/typings/src/utils/organization/___or___.d.ts +6 -0
  701. package/esm/typings/src/utils/organization/empty_object.d.ts +10 -0
  702. package/esm/typings/src/utils/organization/just.d.ts +14 -0
  703. package/esm/typings/src/utils/organization/just_empty_object.d.ts +12 -0
  704. package/esm/typings/src/utils/organization/keepTypeImported.d.ts +9 -0
  705. package/esm/typings/src/utils/organization/keepUnused.d.ts +16 -0
  706. package/esm/typings/src/utils/organization/really_any.d.ts +6 -0
  707. package/esm/typings/src/utils/organization/really_unknown.d.ts +6 -0
  708. package/esm/typings/src/utils/organization/spaceTrim.d.ts +11 -0
  709. package/esm/typings/src/utils/parameters/extractParameterNames.d.ts +10 -0
  710. package/esm/typings/src/utils/parameters/extractParameterNames.test.d.ts +1 -0
  711. package/esm/typings/src/utils/parameters/mapAvailableToExpectedParameters.d.ts +27 -0
  712. package/esm/typings/src/utils/parameters/mapAvailableToExpectedParameters.test.d.ts +1 -0
  713. package/esm/typings/src/utils/parameters/numberToString.d.ts +7 -0
  714. package/esm/typings/src/utils/parameters/numberToString.test.d.ts +1 -0
  715. package/esm/typings/src/utils/parameters/templateParameters.d.ts +16 -0
  716. package/esm/typings/src/utils/parameters/templateParameters.test.d.ts +1 -0
  717. package/esm/typings/src/utils/parameters/valueToString.d.ts +17 -0
  718. package/esm/typings/src/utils/parameters/valueToString.test.d.ts +1 -0
  719. package/esm/typings/src/utils/parseNumber.d.ts +16 -0
  720. package/esm/typings/src/utils/parseNumber.test.d.ts +1 -0
  721. package/esm/typings/src/utils/random/$randomSeed.d.ts +10 -0
  722. package/esm/typings/src/utils/random/$randomToken.d.ts +13 -0
  723. package/esm/typings/src/utils/removeEmojis.d.ts +8 -0
  724. package/esm/typings/src/utils/removeEmojis.test.d.ts +1 -0
  725. package/esm/typings/src/utils/removeQuotes.d.ts +14 -0
  726. package/esm/typings/src/utils/removeQuotes.test.d.ts +1 -0
  727. package/esm/typings/src/utils/serialization/$deepFreeze.d.ts +14 -0
  728. package/esm/typings/src/utils/serialization/asSerializable.d.ts +15 -0
  729. package/esm/typings/src/utils/serialization/asSerializable.test.d.ts +1 -0
  730. package/esm/typings/src/utils/serialization/checkSerializableAsJson.d.ts +45 -0
  731. package/esm/typings/src/utils/serialization/clonePipeline.d.ts +14 -0
  732. package/esm/typings/src/utils/serialization/deepClone.d.ts +14 -0
  733. package/esm/typings/src/utils/serialization/deepClone.test.d.ts +1 -0
  734. package/esm/typings/src/utils/serialization/exportJson.d.ts +29 -0
  735. package/esm/typings/src/utils/serialization/isSerializableAsJson.d.ts +25 -0
  736. package/esm/typings/src/utils/serialization/isSerializableAsJson.test.d.ts +1 -0
  737. package/esm/typings/src/utils/serialization/jsonStringsToJsons.d.ts +9 -0
  738. package/esm/typings/src/utils/serialization/jsonStringsToJsons.test.d.ts +1 -0
  739. package/esm/typings/src/utils/sets/difference.d.ts +10 -0
  740. package/esm/typings/src/utils/sets/difference.test.d.ts +1 -0
  741. package/esm/typings/src/utils/sets/intersection.d.ts +7 -0
  742. package/esm/typings/src/utils/sets/intersection.test.d.ts +1 -0
  743. package/esm/typings/src/utils/sets/union.d.ts +7 -0
  744. package/esm/typings/src/utils/sets/union.test.d.ts +1 -0
  745. package/esm/typings/src/utils/trimCodeBlock.d.ts +9 -0
  746. package/esm/typings/src/utils/trimCodeBlock.test.d.ts +1 -0
  747. package/esm/typings/src/utils/trimEndOfCodeBlock.d.ts +9 -0
  748. package/esm/typings/src/utils/trimEndOfCodeBlock.test.d.ts +1 -0
  749. package/esm/typings/src/utils/unwrapResult.d.ts +37 -0
  750. package/esm/typings/src/utils/unwrapResult.test.d.ts +1 -0
  751. package/esm/typings/src/utils/validators/email/isValidEmail.d.ts +8 -0
  752. package/esm/typings/src/utils/validators/email/isValidEmail.test.d.ts +1 -0
  753. package/esm/typings/src/utils/validators/filePath/isRootPath.d.ts +12 -0
  754. package/esm/typings/src/utils/validators/filePath/isRootPath.test.d.ts +4 -0
  755. package/esm/typings/src/utils/validators/filePath/isValidFilePath.d.ts +12 -0
  756. package/esm/typings/src/utils/validators/filePath/isValidFilePath.test.d.ts +1 -0
  757. package/esm/typings/src/utils/validators/javascriptName/isValidJavascriptName.d.ts +10 -0
  758. package/esm/typings/src/utils/validators/javascriptName/isValidJavascriptName.test.d.ts +1 -0
  759. package/esm/typings/src/utils/validators/parameterName/validateParameterName.d.ts +11 -0
  760. package/esm/typings/src/utils/validators/parameterName/validateParameterName.test.d.ts +1 -0
  761. package/esm/typings/src/utils/validators/semanticVersion/isValidPromptbookVersion.d.ts +15 -0
  762. package/esm/typings/src/utils/validators/semanticVersion/isValidPromptbookVersion.test.d.ts +1 -0
  763. package/esm/typings/src/utils/validators/semanticVersion/isValidSemanticVersion.d.ts +12 -0
  764. package/esm/typings/src/utils/validators/semanticVersion/isValidSemanticVersion.test.d.ts +1 -0
  765. package/esm/typings/src/utils/validators/url/isHostnameOnPrivateNetwork.d.ts +11 -0
  766. package/esm/typings/src/utils/validators/url/isHostnameOnPrivateNetwork.test.d.ts +1 -0
  767. package/esm/typings/src/utils/validators/url/isUrlOnPrivateNetwork.d.ts +13 -0
  768. package/esm/typings/src/utils/validators/url/isUrlOnPrivateNetwork.test.d.ts +1 -0
  769. package/esm/typings/src/utils/validators/url/isValidPipelineUrl.d.ts +15 -0
  770. package/esm/typings/src/utils/validators/url/isValidPipelineUrl.test.d.ts +1 -0
  771. package/esm/typings/src/utils/validators/url/isValidUrl.d.ts +13 -0
  772. package/esm/typings/src/utils/validators/url/isValidUrl.test.d.ts +1 -0
  773. package/esm/typings/src/utils/validators/uuid/isValidUuid.d.ts +8 -0
  774. package/esm/typings/src/utils/validators/uuid/isValidUuid.test.d.ts +1 -0
  775. package/esm/typings/src/version.d.ts +26 -0
  776. package/esm/typings/src/wizard/$getCompiledBook.d.ts +16 -0
  777. package/esm/typings/src/wizard/wizard.d.ts +78 -0
  778. package/package.json +100 -0
  779. package/umd/index.umd.js +1965 -0
  780. package/umd/index.umd.js.map +1 -0
@@ -0,0 +1,1953 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { useState, useRef, useCallback, useEffect, useMemo } from 'react';
3
+ import spaceTrim, { spaceTrim as spaceTrim$1 } from 'spacetrim';
4
+
5
+ // ⚠️ WARNING: This code has been generated so that any manual changes will be overwritten
6
+ /**
7
+ * The version of the Book language
8
+ *
9
+ * @generated
10
+ * @see https://github.com/webgptorg/book
11
+ */
12
+ const BOOK_LANGUAGE_VERSION = '1.0.0';
13
+ /**
14
+ * The version of the Promptbook engine
15
+ *
16
+ * @generated
17
+ * @see https://github.com/webgptorg/promptbook
18
+ */
19
+ const PROMPTBOOK_ENGINE_VERSION = '0.100.0-24';
20
+ /**
21
+ * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
22
+ * Note: [💞] Ignore a discrepancy between file name and entity name
23
+ */
24
+
25
+ /**
26
+ * Type guard to check if a string is a valid agent source
27
+ *
28
+ * @public exported from `@promptbook/core`
29
+ */
30
+ function isValidBook(value) {
31
+ // Basic validation - agent source should have at least a name (first line)
32
+ return typeof value === 'string' /* && value.trim().length > 0 */;
33
+ }
34
+ /**
35
+ * Validates and converts a string to agent source branded type
36
+ * This function should be used when you have a string that you know represents agent source
37
+ * but need to convert it to the branded type for type safety
38
+ *
39
+ * @public exported from `@promptbook/core`
40
+ */
41
+ function validateBook(source) {
42
+ if (!isValidBook(source)) {
43
+ throw new Error('Invalid agent source: must be a string');
44
+ }
45
+ return source;
46
+ }
47
+ /**
48
+ * Default book
49
+ *
50
+ * @public exported from `@promptbook/core`
51
+ */
52
+ const DEFAULT_BOOK = validateBook(spaceTrim(`
53
+ AI Avatar
54
+
55
+ PERSONA A friendly AI assistant that helps you with your tasks
56
+ `));
57
+
58
+ /**
59
+ * Freezes the given object and all its nested objects recursively
60
+ *
61
+ * Note: `$` is used to indicate that this function is not a pure function - it mutates given object
62
+ * Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
63
+ *
64
+ * @returns The same object as the input, but deeply frozen
65
+ * @public exported from `@promptbook/utils`
66
+ */
67
+ function $deepFreeze(objectValue) {
68
+ if (Array.isArray(objectValue)) {
69
+ return Object.freeze(objectValue.map((item) => $deepFreeze(item)));
70
+ }
71
+ const propertyNames = Object.getOwnPropertyNames(objectValue);
72
+ for (const propertyName of propertyNames) {
73
+ const value = objectValue[propertyName];
74
+ if (value && typeof value === 'object') {
75
+ $deepFreeze(value);
76
+ }
77
+ }
78
+ Object.freeze(objectValue);
79
+ return objectValue;
80
+ }
81
+ /**
82
+ * TODO: [🧠] Is there a way how to meaningfully test this utility
83
+ */
84
+
85
+ /**
86
+ * Generates a regex pattern to match a specific commitment
87
+ *
88
+ * Note: It always creates new Regex object
89
+ * Note: Uses word boundaries to ensure only full words are matched (e.g., "PERSONA" matches but "PERSONALITY" does not)
90
+ *
91
+ * @private
92
+ */
93
+ function createCommitmentRegex(commitment) {
94
+ const escapedCommitment = commitment.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
95
+ const keywordPattern = escapedCommitment.split(/\s+/).join('\\s+');
96
+ const regex = new RegExp(`^\\s*(?<type>${keywordPattern})\\b\\s+(?<contents>.+)$`, 'gim');
97
+ return regex;
98
+ }
99
+ /**
100
+ * Generates a regex pattern to match a specific commitment type
101
+ *
102
+ * Note: It just matches the type part of the commitment
103
+ * Note: It always creates new Regex object
104
+ * Note: Uses word boundaries to ensure only full words are matched (e.g., "PERSONA" matches but "PERSONALITY" does not)
105
+ *
106
+ * @private
107
+ */
108
+ function createCommitmentTypeRegex(commitment) {
109
+ const escapedCommitment = commitment.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
110
+ const keywordPattern = escapedCommitment.split(/\s+/).join('\\s+');
111
+ const regex = new RegExp(`^\\s*(?<type>${keywordPattern})\\b`, 'gim');
112
+ return regex;
113
+ }
114
+
115
+ /**
116
+ * Base implementation of CommitmentDefinition that provides common functionality
117
+ * Most commitments can extend this class and only override the applyToAgentModelRequirements method
118
+ *
119
+ * @private
120
+ */
121
+ class BaseCommitmentDefinition {
122
+ constructor(type) {
123
+ this.type = type;
124
+ }
125
+ /**
126
+ * Creates a regex pattern to match this commitment in agent source
127
+ * Uses the existing createCommitmentRegex function as internal helper
128
+ */
129
+ createRegex() {
130
+ return createCommitmentRegex(this.type);
131
+ }
132
+ /**
133
+ * Creates a regex pattern to match just the commitment type
134
+ * Uses the existing createCommitmentTypeRegex function as internal helper
135
+ */
136
+ createTypeRegex() {
137
+ return createCommitmentTypeRegex(this.type);
138
+ }
139
+ /**
140
+ * Helper method to create a new requirements object with updated system message
141
+ * This is commonly used by many commitments
142
+ */
143
+ updateSystemMessage(requirements, messageUpdate) {
144
+ const newMessage = typeof messageUpdate === 'string' ? messageUpdate : messageUpdate(requirements.systemMessage);
145
+ return {
146
+ ...requirements,
147
+ systemMessage: newMessage,
148
+ };
149
+ }
150
+ /**
151
+ * Helper method to append content to the system message
152
+ */
153
+ appendToSystemMessage(requirements, content, separator = '\n\n') {
154
+ return this.updateSystemMessage(requirements, (currentMessage) => {
155
+ if (!currentMessage.trim()) {
156
+ return content;
157
+ }
158
+ return currentMessage + separator + content;
159
+ });
160
+ }
161
+ /**
162
+ * Helper method to add a comment section to the system message
163
+ * Comments are lines starting with # that will be removed from the final system message
164
+ * but can be useful for organizing and structuring the message during processing
165
+ */
166
+ addCommentSection(requirements, commentTitle, content, position = 'end') {
167
+ const commentSection = `# ${commentTitle.toUpperCase()}\n${content}`;
168
+ if (position === 'beginning') {
169
+ return this.updateSystemMessage(requirements, (currentMessage) => {
170
+ if (!currentMessage.trim()) {
171
+ return commentSection;
172
+ }
173
+ return commentSection + '\n\n' + currentMessage;
174
+ });
175
+ }
176
+ else {
177
+ return this.appendToSystemMessage(requirements, commentSection);
178
+ }
179
+ }
180
+ }
181
+
182
+ /**
183
+ * ACTION commitment definition
184
+ *
185
+ * The ACTION commitment defines specific actions or capabilities that the agent can perform.
186
+ * This helps define what the agent is capable of doing and how it should approach tasks.
187
+ *
188
+ * Example usage in agent source:
189
+ *
190
+ * ```book
191
+ * ACTION Can generate code snippets and explain programming concepts
192
+ * ACTION Able to analyze data and provide insights
193
+ * ```
194
+ *
195
+ * @private [🪔] Maybe export the commitments through some package
196
+ */
197
+ class ActionCommitmentDefinition extends BaseCommitmentDefinition {
198
+ constructor() {
199
+ super('ACTION');
200
+ }
201
+ /**
202
+ * Short one-line description of ACTION.
203
+ */
204
+ get description() {
205
+ return 'Define agent capabilities and actions it can perform.';
206
+ }
207
+ /**
208
+ * Markdown documentation for ACTION commitment.
209
+ */
210
+ get documentation() {
211
+ return spaceTrim$1(`
212
+ # ACTION
213
+
214
+ Defines specific actions or capabilities that the agent can perform.
215
+
216
+ ## Key behaviors
217
+
218
+ - Multiple \`ACTION\` commitments are applied sequentially.
219
+ - Each action adds to the agent's capability list.
220
+ - Actions help users understand what the agent can do.
221
+
222
+ ## Examples
223
+
224
+ \`\`\`book
225
+ Code Assistant
226
+
227
+ PERSONA You are a programming assistant
228
+ ACTION Can generate code snippets and explain programming concepts
229
+ ACTION Able to debug existing code and suggest improvements
230
+ ACTION Can create unit tests for functions
231
+ \`\`\`
232
+
233
+ \`\`\`book
234
+ Data Scientist
235
+
236
+ PERSONA You are a data analysis expert
237
+ ACTION Able to analyze data and provide insights
238
+ ACTION Can create visualizations and charts
239
+ ACTION Capable of statistical analysis and modeling
240
+ KNOWLEDGE Data analysis best practices and statistical methods
241
+ \`\`\`
242
+ `);
243
+ }
244
+ applyToAgentModelRequirements(requirements, content) {
245
+ const trimmedContent = content.trim();
246
+ if (!trimmedContent) {
247
+ return requirements;
248
+ }
249
+ // Add action capability to the system message
250
+ const actionSection = `Capability: ${trimmedContent}`;
251
+ return this.appendToSystemMessage(requirements, actionSection, '\n\n');
252
+ }
253
+ }
254
+ /**
255
+ * Singleton instance of the ACTION commitment definition
256
+ *
257
+ * @private [🪔] Maybe export the commitments through some package
258
+ */
259
+ new ActionCommitmentDefinition();
260
+ /**
261
+ * Note: [💞] Ignore a discrepancy between file name and entity name
262
+ */
263
+
264
+ /**
265
+ * FORMAT commitment definition
266
+ *
267
+ * The FORMAT commitment defines the specific output structure and formatting
268
+ * that the agent should use in its responses. This includes data formats,
269
+ * response templates, and structural requirements.
270
+ *
271
+ * Example usage in agent source:
272
+ *
273
+ * ```book
274
+ * FORMAT Always respond in JSON format with 'status' and 'data' fields
275
+ * FORMAT Use markdown formatting for all code blocks
276
+ * ```
277
+ *
278
+ * @private [🪔] Maybe export the commitments through some package
279
+ */
280
+ class FormatCommitmentDefinition extends BaseCommitmentDefinition {
281
+ constructor() {
282
+ super('FORMAT');
283
+ }
284
+ /**
285
+ * Short one-line description of FORMAT.
286
+ */
287
+ get description() {
288
+ return 'Specify output structure or formatting requirements.';
289
+ }
290
+ /**
291
+ * Markdown documentation for FORMAT commitment.
292
+ */
293
+ get documentation() {
294
+ return spaceTrim$1(`
295
+ # FORMAT
296
+
297
+ Defines the specific output structure and formatting for responses (data formats, templates, structure).
298
+
299
+ ## Key behaviors
300
+
301
+ - Multiple \`FORMAT\` commitments are applied sequentially.
302
+ - If they are in conflict, the last one takes precedence.
303
+ - You can specify both data formats and presentation styles.
304
+
305
+ ## Examples
306
+
307
+ \`\`\`book
308
+ Customer Support Bot
309
+
310
+ PERSONA You are a helpful customer support agent
311
+ FORMAT Always respond in JSON format with 'status' and 'data' fields
312
+ FORMAT Use markdown formatting for all code blocks
313
+ \`\`\`
314
+
315
+ \`\`\`book
316
+ Data Analyst
317
+
318
+ PERSONA You are a data analysis expert
319
+ FORMAT Present results in structured tables
320
+ FORMAT Include confidence scores for all predictions
321
+ STYLE Be concise and precise in explanations
322
+ \`\`\`
323
+ `);
324
+ }
325
+ applyToAgentModelRequirements(requirements, content) {
326
+ const trimmedContent = content.trim();
327
+ if (!trimmedContent) {
328
+ return requirements;
329
+ }
330
+ // Add format instructions to the system message
331
+ const formatSection = `Output Format: ${trimmedContent}`;
332
+ return this.appendToSystemMessage(requirements, formatSection, '\n\n');
333
+ }
334
+ }
335
+ /**
336
+ * Singleton instance of the FORMAT commitment definition
337
+ *
338
+ * @private [🪔] Maybe export the commitments through some package
339
+ */
340
+ new FormatCommitmentDefinition();
341
+ /**
342
+ * Note: [💞] Ignore a discrepancy between file name and entity name
343
+ */
344
+
345
+ /**
346
+ * Error thrown when a fetch request fails
347
+ *
348
+ * @public exported from `@promptbook/core`
349
+ */
350
+ class PromptbookFetchError extends Error {
351
+ constructor(message) {
352
+ super(message);
353
+ this.name = 'PromptbookFetchError';
354
+ Object.setPrototypeOf(this, PromptbookFetchError.prototype);
355
+ }
356
+ }
357
+
358
+ /**
359
+ * Name for the Promptbook
360
+ *
361
+ * TODO: [🗽] Unite branding and make single place for it
362
+ *
363
+ * @public exported from `@promptbook/core`
364
+ */
365
+ const NAME = `Promptbook`;
366
+ /**
367
+ * Email of the responsible person
368
+ *
369
+ * @public exported from `@promptbook/core`
370
+ */
371
+ const ADMIN_EMAIL = 'pavol@ptbk.io';
372
+ /**
373
+ * Name of the responsible person for the Promptbook on GitHub
374
+ *
375
+ * @public exported from `@promptbook/core`
376
+ */
377
+ const ADMIN_GITHUB_NAME = 'hejny';
378
+ // <- TODO: [🧜‍♂️]
379
+ /**
380
+ * Default settings for parsing and generating CSV files in Promptbook.
381
+ *
382
+ * @public exported from `@promptbook/core`
383
+ */
384
+ Object.freeze({
385
+ delimiter: ',',
386
+ quoteChar: '"',
387
+ newline: '\n',
388
+ skipEmptyLines: true,
389
+ });
390
+ /**
391
+ * Note: [💞] Ignore a discrepancy between file name and entity name
392
+ * TODO: [🧠][🧜‍♂️] Maybe join remoteServerUrl and path into single value
393
+ */
394
+
395
+ /**
396
+ * Make error report URL for the given error
397
+ *
398
+ * @private private within the repository
399
+ */
400
+ function getErrorReportUrl(error) {
401
+ const report = {
402
+ title: `🐜 Error report from ${NAME}`,
403
+ body: spaceTrim((block) => `
404
+
405
+
406
+ \`${error.name || 'Error'}\` has occurred in the [${NAME}], please look into it @${ADMIN_GITHUB_NAME}.
407
+
408
+ \`\`\`
409
+ ${block(error.message || '(no error message)')}
410
+ \`\`\`
411
+
412
+
413
+ ## More info:
414
+
415
+ - **Promptbook engine version:** ${PROMPTBOOK_ENGINE_VERSION}
416
+ - **Book language version:** ${BOOK_LANGUAGE_VERSION}
417
+ - **Time:** ${new Date().toISOString()}
418
+
419
+ <details>
420
+ <summary>Stack trace:</summary>
421
+
422
+ ## Stack trace:
423
+
424
+ \`\`\`stacktrace
425
+ ${block(error.stack || '(empty)')}
426
+ \`\`\`
427
+ </details>
428
+
429
+ `),
430
+ };
431
+ const reportUrl = new URL(`https://github.com/webgptorg/promptbook/issues/new`);
432
+ reportUrl.searchParams.set('labels', 'bug');
433
+ reportUrl.searchParams.set('assignees', ADMIN_GITHUB_NAME);
434
+ reportUrl.searchParams.set('title', report.title);
435
+ reportUrl.searchParams.set('body', report.body);
436
+ return reportUrl;
437
+ }
438
+
439
+ /**
440
+ * This error type indicates that the error should not happen and its last check before crashing with some other error
441
+ *
442
+ * @public exported from `@promptbook/core`
443
+ */
444
+ class UnexpectedError extends Error {
445
+ constructor(message) {
446
+ super(spaceTrim$1((block) => `
447
+ ${block(message)}
448
+
449
+ Note: This error should not happen.
450
+ It's probably a bug in the pipeline collection
451
+
452
+ Please report issue:
453
+ ${block(getErrorReportUrl(new Error(message)).href)}
454
+
455
+ Or contact us on ${ADMIN_EMAIL}
456
+
457
+ `));
458
+ this.name = 'UnexpectedError';
459
+ Object.setPrototypeOf(this, UnexpectedError.prototype);
460
+ }
461
+ }
462
+
463
+ /**
464
+ * This error type indicates that somewhere in the code non-Error object was thrown and it was wrapped into the `WrappedError`
465
+ *
466
+ * @public exported from `@promptbook/core`
467
+ */
468
+ class WrappedError extends Error {
469
+ constructor(whatWasThrown) {
470
+ const tag = `[🤮]`;
471
+ console.error(tag, whatWasThrown);
472
+ super(spaceTrim$1(`
473
+ Non-Error object was thrown
474
+
475
+ Note: Look for ${tag} in the console for more details
476
+ Please report issue on ${ADMIN_EMAIL}
477
+ `));
478
+ this.name = 'WrappedError';
479
+ Object.setPrototypeOf(this, WrappedError.prototype);
480
+ }
481
+ }
482
+
483
+ /**
484
+ * Helper used in catch blocks to assert that the error is an instance of `Error`
485
+ *
486
+ * @param whatWasThrown Any object that was thrown
487
+ * @returns Nothing if the error is an instance of `Error`
488
+ * @throws `WrappedError` or `UnexpectedError` if the error is not standard
489
+ *
490
+ * @private within the repository
491
+ */
492
+ function assertsError(whatWasThrown) {
493
+ // Case 1: Handle error which was rethrown as `WrappedError`
494
+ if (whatWasThrown instanceof WrappedError) {
495
+ const wrappedError = whatWasThrown;
496
+ throw wrappedError;
497
+ }
498
+ // Case 2: Handle unexpected errors
499
+ if (whatWasThrown instanceof UnexpectedError) {
500
+ const unexpectedError = whatWasThrown;
501
+ throw unexpectedError;
502
+ }
503
+ // Case 3: Handle standard errors - keep them up to consumer
504
+ if (whatWasThrown instanceof Error) {
505
+ return;
506
+ }
507
+ // Case 4: Handle non-standard errors - wrap them into `WrappedError` and throw
508
+ throw new WrappedError(whatWasThrown);
509
+ }
510
+
511
+ /**
512
+ * The built-in `fetch' function with a lightweight error handling wrapper as default fetch function used in Promptbook scrapers
513
+ *
514
+ * @public exported from `@promptbook/core`
515
+ */
516
+ const promptbookFetch = async (urlOrRequest, init) => {
517
+ try {
518
+ return await fetch(urlOrRequest, init);
519
+ }
520
+ catch (error) {
521
+ assertsError(error);
522
+ let url;
523
+ if (typeof urlOrRequest === 'string') {
524
+ url = urlOrRequest;
525
+ }
526
+ else if (urlOrRequest instanceof Request) {
527
+ url = urlOrRequest.url;
528
+ }
529
+ throw new PromptbookFetchError(spaceTrim((block) => `
530
+ Can not fetch "${url}"
531
+
532
+ Fetch error:
533
+ ${block(error.message)}
534
+
535
+ `));
536
+ }
537
+ };
538
+ /**
539
+ * TODO: [🧠] Maybe rename because it is not used only for scrapers but also in `$getCompiledBook`
540
+ */
541
+
542
+ /**
543
+ * Frontend RAG Service that uses backend APIs for processing
544
+ * This avoids Node.js dependencies in the frontend
545
+ *
546
+ * @private - TODO: [🧠] Maybe should be public?
547
+ */
548
+ class FrontendRAGService {
549
+ constructor(config) {
550
+ this.chunks = [];
551
+ this.sources = [];
552
+ this.isInitialized = false;
553
+ this.config = {
554
+ maxChunkSize: 1000,
555
+ chunkOverlap: 200,
556
+ maxRetrievedChunks: 5,
557
+ minRelevanceScore: 0.1,
558
+ ...config,
559
+ };
560
+ }
561
+ /**
562
+ * Initialize knowledge sources by processing them on the backend
563
+ */
564
+ async initializeKnowledgeSources(sources) {
565
+ if (sources.length === 0) {
566
+ this.isInitialized = true;
567
+ return;
568
+ }
569
+ try {
570
+ const response = await promptbookFetch('/api/knowledge/process-sources', {
571
+ method: 'POST',
572
+ headers: {
573
+ 'Content-Type': 'application/json',
574
+ },
575
+ body: JSON.stringify({
576
+ sources,
577
+ config: {
578
+ maxChunkSize: this.config.maxChunkSize,
579
+ chunkOverlap: this.config.chunkOverlap,
580
+ },
581
+ }),
582
+ });
583
+ if (!response.ok) {
584
+ throw new Error(`Failed to process knowledge sources: ${response.status}`);
585
+ }
586
+ const result = (await response.json());
587
+ if (!result.success) {
588
+ throw new Error(result.message || 'Failed to process knowledge sources');
589
+ }
590
+ this.chunks = result.chunks;
591
+ this.sources = sources;
592
+ this.isInitialized = true;
593
+ console.log(`Initialized RAG service with ${this.chunks.length} chunks from ${sources.length} sources`);
594
+ }
595
+ catch (error) {
596
+ console.error('Failed to initialize knowledge sources:', error);
597
+ // Don't throw - allow the system to continue without RAG
598
+ this.isInitialized = true;
599
+ }
600
+ }
601
+ /**
602
+ * Get relevant context for a user query
603
+ */
604
+ async getContextForQuery(query) {
605
+ if (!this.isInitialized) {
606
+ console.warn('RAG service not initialized');
607
+ return '';
608
+ }
609
+ if (this.chunks.length === 0) {
610
+ return '';
611
+ }
612
+ try {
613
+ const response = await promptbookFetch('/api/knowledge/retrieve-context', {
614
+ method: 'POST',
615
+ headers: {
616
+ 'Content-Type': 'application/json',
617
+ },
618
+ body: JSON.stringify({
619
+ query,
620
+ chunks: this.chunks,
621
+ config: {
622
+ maxRetrievedChunks: this.config.maxRetrievedChunks,
623
+ minRelevanceScore: this.config.minRelevanceScore,
624
+ },
625
+ }),
626
+ });
627
+ if (!response.ok) {
628
+ console.error(`Failed to retrieve context: ${response.status}`);
629
+ return '';
630
+ }
631
+ const result = (await response.json());
632
+ if (!result.success) {
633
+ console.error('Context retrieval failed:', result.message);
634
+ return '';
635
+ }
636
+ return result.context;
637
+ }
638
+ catch (error) {
639
+ console.error('Error retrieving context:', error);
640
+ return '';
641
+ }
642
+ }
643
+ /**
644
+ * Get relevant chunks for a query (for debugging/inspection)
645
+ */
646
+ async getRelevantChunks(query) {
647
+ if (!this.isInitialized || this.chunks.length === 0) {
648
+ return [];
649
+ }
650
+ try {
651
+ const response = await promptbookFetch('/api/knowledge/retrieve-context', {
652
+ method: 'POST',
653
+ headers: {
654
+ 'Content-Type': 'application/json',
655
+ },
656
+ body: JSON.stringify({
657
+ query,
658
+ chunks: this.chunks,
659
+ config: {
660
+ maxRetrievedChunks: this.config.maxRetrievedChunks,
661
+ minRelevanceScore: this.config.minRelevanceScore,
662
+ },
663
+ }),
664
+ });
665
+ if (!response.ok) {
666
+ return [];
667
+ }
668
+ const result = (await response.json());
669
+ return result.success ? result.relevantChunks : [];
670
+ }
671
+ catch (error) {
672
+ console.error('Error retrieving relevant chunks:', error);
673
+ return [];
674
+ }
675
+ }
676
+ /**
677
+ * Get knowledge base statistics
678
+ */
679
+ getStats() {
680
+ return {
681
+ sources: this.sources.length,
682
+ chunks: this.chunks.length,
683
+ isInitialized: this.isInitialized,
684
+ };
685
+ }
686
+ /**
687
+ * Check if the service is ready to use
688
+ */
689
+ isReady() {
690
+ return this.isInitialized;
691
+ }
692
+ /**
693
+ * Clear all knowledge sources
694
+ */
695
+ clearKnowledgeBase() {
696
+ this.chunks = [];
697
+ this.sources = [];
698
+ this.isInitialized = false;
699
+ }
700
+ /**
701
+ * Add a single knowledge source (for incremental updates)
702
+ */
703
+ async addKnowledgeSource(url) {
704
+ if (this.sources.includes(url)) {
705
+ console.log(`Knowledge source already exists: ${url}`);
706
+ return;
707
+ }
708
+ try {
709
+ const response = await promptbookFetch('/api/knowledge/process-sources', {
710
+ method: 'POST',
711
+ headers: {
712
+ 'Content-Type': 'application/json',
713
+ },
714
+ body: JSON.stringify({
715
+ sources: [url],
716
+ config: {
717
+ maxChunkSize: this.config.maxChunkSize,
718
+ chunkOverlap: this.config.chunkOverlap,
719
+ },
720
+ }),
721
+ });
722
+ if (!response.ok) {
723
+ throw new Error(`Failed to process knowledge source: ${response.status}`);
724
+ }
725
+ const result = (await response.json());
726
+ if (!result.success) {
727
+ throw new Error(result.message || 'Failed to process knowledge source');
728
+ }
729
+ // Add new chunks to existing ones
730
+ this.chunks.push(...result.chunks);
731
+ this.sources.push(url);
732
+ console.log(`Added knowledge source: ${url} (${result.chunks.length} chunks)`);
733
+ }
734
+ catch (error) {
735
+ console.error(`Failed to add knowledge source ${url}:`, error);
736
+ throw error;
737
+ }
738
+ }
739
+ }
740
+
741
+ /**
742
+ * KNOWLEDGE commitment definition
743
+ *
744
+ * The KNOWLEDGE commitment adds specific knowledge, facts, or context to the agent
745
+ * using RAG (Retrieval-Augmented Generation) approach for external sources.
746
+ *
747
+ * Supports both direct text knowledge and external sources like PDFs.
748
+ *
749
+ * Example usage in agent source:
750
+ *
751
+ * ```book
752
+ * KNOWLEDGE The company was founded in 2020 and specializes in AI-powered solutions
753
+ * KNOWLEDGE https://example.com/company-handbook.pdf
754
+ * KNOWLEDGE https://example.com/product-documentation.pdf
755
+ * ```
756
+ *
757
+ * @private [🪔] Maybe export the commitments through some package
758
+ */
759
+ class KnowledgeCommitmentDefinition extends BaseCommitmentDefinition {
760
+ constructor() {
761
+ super('KNOWLEDGE');
762
+ this.ragService = new FrontendRAGService();
763
+ }
764
+ /**
765
+ * Short one-line description of KNOWLEDGE.
766
+ */
767
+ get description() {
768
+ return 'Add domain **knowledge** via direct text or external sources (RAG).';
769
+ }
770
+ /**
771
+ * Markdown documentation for KNOWLEDGE commitment.
772
+ */
773
+ get documentation() {
774
+ return spaceTrim$1(`
775
+ # KNOWLEDGE
776
+
777
+ Adds specific knowledge, facts, or context to the agent using a RAG (Retrieval-Augmented Generation) approach for external sources.
778
+
779
+ ## Key behaviors
780
+
781
+ - Multiple \`KNOWLEDGE\` commitments are applied sequentially.
782
+ - Supports both direct text knowledge and external URLs.
783
+ - External sources (PDFs, websites) are processed via RAG for context retrieval.
784
+
785
+ ## Supported formats
786
+
787
+ - Direct text: Immediate knowledge incorporated into agent
788
+ - URLs: External documents processed for contextual retrieval
789
+ - Supported file types: PDF, text, markdown, HTML
790
+
791
+ ## Examples
792
+
793
+ \`\`\`book
794
+ Customer Support Bot
795
+
796
+ PERSONA You are a helpful customer support agent for TechCorp
797
+ KNOWLEDGE TechCorp was founded in 2020 and specializes in AI-powered solutions
798
+ KNOWLEDGE https://example.com/company-handbook.pdf
799
+ KNOWLEDGE https://example.com/product-documentation.pdf
800
+ RULE Always be polite and professional
801
+ \`\`\`
802
+
803
+ \`\`\`book
804
+ Research Assistant
805
+
806
+ PERSONA You are a knowledgeable research assistant
807
+ KNOWLEDGE Academic research requires careful citation and verification
808
+ KNOWLEDGE https://example.com/research-guidelines.pdf
809
+ ACTION Can help with literature reviews and data analysis
810
+ STYLE Present information in clear, academic format
811
+ \`\`\`
812
+ `);
813
+ }
814
+ applyToAgentModelRequirements(requirements, content) {
815
+ var _a;
816
+ const trimmedContent = content.trim();
817
+ if (!trimmedContent) {
818
+ return requirements;
819
+ }
820
+ // Check if content is a URL (external knowledge source)
821
+ if (this.isUrl(trimmedContent)) {
822
+ // Store the URL for later async processing
823
+ const updatedRequirements = {
824
+ ...requirements,
825
+ metadata: {
826
+ ...requirements.metadata,
827
+ ragService: this.ragService,
828
+ knowledgeSources: [
829
+ ...(((_a = requirements.metadata) === null || _a === void 0 ? void 0 : _a.knowledgeSources) || []),
830
+ trimmedContent,
831
+ ],
832
+ },
833
+ };
834
+ // Add placeholder information about knowledge sources to system message
835
+ const knowledgeInfo = `Knowledge Source URL: ${trimmedContent} (will be processed for retrieval during chat)`;
836
+ return this.appendToSystemMessage(updatedRequirements, knowledgeInfo, '\n\n');
837
+ }
838
+ else {
839
+ // Direct text knowledge - add to system message
840
+ const knowledgeSection = `Knowledge: ${trimmedContent}`;
841
+ return this.appendToSystemMessage(requirements, knowledgeSection, '\n\n');
842
+ }
843
+ }
844
+ /**
845
+ * Check if content is a URL
846
+ */
847
+ isUrl(content) {
848
+ try {
849
+ new URL(content);
850
+ return true;
851
+ }
852
+ catch (_a) {
853
+ return false;
854
+ }
855
+ }
856
+ /**
857
+ * Get RAG service instance for retrieving context during chat
858
+ */
859
+ getRagService() {
860
+ return this.ragService;
861
+ }
862
+ }
863
+ /**
864
+ * Singleton instance of the KNOWLEDGE commitment definition
865
+ *
866
+ * @private [🪔] Maybe export the commitments through some package
867
+ */
868
+ new KnowledgeCommitmentDefinition();
869
+ /**
870
+ * Note: [💞] Ignore a discrepancy between file name and entity name
871
+ */
872
+
873
+ /**
874
+ * META IMAGE commitment definition
875
+ *
876
+ * The META IMAGE commitment sets the agent's avatar/profile image URL.
877
+ * This commitment is special because it doesn't affect the system message,
878
+ * but is handled separately in the parsing logic.
879
+ *
880
+ * Example usage in agent source:
881
+ *
882
+ * ```book
883
+ * META IMAGE https://example.com/avatar.jpg
884
+ * META IMAGE /assets/agent-avatar.png
885
+ * ```
886
+ *
887
+ * @private [🪔] Maybe export the commitments through some package
888
+ */
889
+ class MetaImageCommitmentDefinition extends BaseCommitmentDefinition {
890
+ constructor() {
891
+ super('META IMAGE');
892
+ }
893
+ /**
894
+ * Short one-line description of META IMAGE.
895
+ */
896
+ get description() {
897
+ return "Set the agent's profile image URL.";
898
+ }
899
+ /**
900
+ * Markdown documentation for META IMAGE commitment.
901
+ */
902
+ get documentation() {
903
+ return spaceTrim$1(`
904
+ # META IMAGE
905
+
906
+ Sets the agent's avatar/profile image URL.
907
+
908
+ ## Key behaviors
909
+
910
+ - Does not modify the agent's behavior or responses.
911
+ - Only one \`META IMAGE\` should be used per agent.
912
+ - If multiple are specified, the last one takes precedence.
913
+ - Used for visual representation in user interfaces.
914
+
915
+ ## Examples
916
+
917
+ \`\`\`book
918
+ Professional Assistant
919
+
920
+ META IMAGE https://example.com/professional-avatar.jpg
921
+ PERSONA You are a professional business assistant
922
+ STYLE Maintain a formal and courteous tone
923
+ \`\`\`
924
+
925
+ \`\`\`book
926
+ Creative Helper
927
+
928
+ META IMAGE /assets/creative-bot-avatar.png
929
+ PERSONA You are a creative and inspiring assistant
930
+ STYLE Be enthusiastic and encouraging
931
+ ACTION Can help with brainstorming and ideation
932
+ \`\`\`
933
+ `);
934
+ }
935
+ applyToAgentModelRequirements(requirements, content) {
936
+ // META IMAGE doesn't modify the system message or model requirements
937
+ // It's handled separately in the parsing logic for profile image extraction
938
+ // This method exists for consistency with the CommitmentDefinition interface
939
+ return requirements;
940
+ }
941
+ /**
942
+ * Extracts the profile image URL from the content
943
+ * This is used by the parsing logic
944
+ */
945
+ extractProfileImageUrl(content) {
946
+ const trimmedContent = content.trim();
947
+ return trimmedContent || null;
948
+ }
949
+ }
950
+ /**
951
+ * Singleton instance of the META IMAGE commitment definition
952
+ *
953
+ * @private [🪔] Maybe export the commitments through some package
954
+ */
955
+ new MetaImageCommitmentDefinition();
956
+ /**
957
+ * Note: [💞] Ignore a discrepancy between file name and entity name
958
+ */
959
+
960
+ /**
961
+ * META LINK commitment definition
962
+ *
963
+ * The `META LINK` commitment represents the link to the person from whom the agent is created.
964
+ * This commitment is special because it doesn't affect the system message,
965
+ * but is handled separately in the parsing logic for profile display.
966
+ *
967
+ * Example usage in agent source:
968
+ *
969
+ * ```
970
+ * META LINK https://twitter.com/username
971
+ * META LINK https://linkedin.com/in/profile
972
+ * META LINK https://github.com/username
973
+ * ```
974
+ *
975
+ * Multiple `META LINK` commitments can be used when there are multiple sources:
976
+ *
977
+ * ```book
978
+ * META LINK https://twitter.com/username
979
+ * META LINK https://linkedin.com/in/profile
980
+ * ```
981
+ *
982
+ * @private [🪔] Maybe export the commitments through some package
983
+ */
984
+ class MetaLinkCommitmentDefinition extends BaseCommitmentDefinition {
985
+ constructor() {
986
+ super('META LINK');
987
+ }
988
+ /**
989
+ * Short one-line description of META LINK.
990
+ */
991
+ get description() {
992
+ return 'Provide profile/source links for the person the agent models.';
993
+ }
994
+ /**
995
+ * Markdown documentation for META LINK commitment.
996
+ */
997
+ get documentation() {
998
+ return spaceTrim$1(`
999
+ # META LINK
1000
+
1001
+ Represents a profile or source link for the person the agent is modeled after.
1002
+
1003
+ ## Key behaviors
1004
+
1005
+ - Does not modify the agent's behavior or responses.
1006
+ - Multiple \`META LINK\` commitments can be used for different social profiles.
1007
+ - Used for attribution and crediting the original person.
1008
+ - Displayed in user interfaces for transparency.
1009
+
1010
+ ## Examples
1011
+
1012
+ \`\`\`book
1013
+ Expert Consultant
1014
+
1015
+ META LINK https://twitter.com/expertname
1016
+ META LINK https://linkedin.com/in/expertprofile
1017
+ PERSONA You are Dr. Smith, a renowned expert in artificial intelligence
1018
+ KNOWLEDGE Extensive background in machine learning and neural networks
1019
+ \`\`\`
1020
+
1021
+ \`\`\`book
1022
+ Open Source Developer
1023
+
1024
+ META LINK https://github.com/developer
1025
+ META LINK https://twitter.com/devhandle
1026
+ PERSONA You are an experienced open source developer
1027
+ ACTION Can help with code reviews and architecture decisions
1028
+ STYLE Be direct and technical in explanations
1029
+ \`\`\`
1030
+ `);
1031
+ }
1032
+ applyToAgentModelRequirements(requirements, content) {
1033
+ // META LINK doesn't modify the system message or model requirements
1034
+ // It's handled separately in the parsing logic for profile link extraction
1035
+ // This method exists for consistency with the CommitmentDefinition interface
1036
+ return requirements;
1037
+ }
1038
+ /**
1039
+ * Extracts the profile link URL from the content
1040
+ * This is used by the parsing logic
1041
+ */
1042
+ extractProfileLinkUrl(content) {
1043
+ const trimmedContent = content.trim();
1044
+ return trimmedContent || null;
1045
+ }
1046
+ /**
1047
+ * Validates if the provided content is a valid URL
1048
+ */
1049
+ isValidUrl(content) {
1050
+ try {
1051
+ new URL(content.trim());
1052
+ return true;
1053
+ }
1054
+ catch (_a) {
1055
+ return false;
1056
+ }
1057
+ }
1058
+ }
1059
+ /**
1060
+ * Singleton instance of the META LINK commitment definition
1061
+ *
1062
+ * @private [🪔] Maybe export the commitments through some package
1063
+ */
1064
+ new MetaLinkCommitmentDefinition();
1065
+ /**
1066
+ * Note: [💞] Ignore a discrepancy between file name and entity name
1067
+ */
1068
+
1069
+ /**
1070
+ * MODEL commitment definition
1071
+ *
1072
+ * The MODEL commitment specifies which AI model to use and can also set
1073
+ * model-specific parameters like temperature, topP, and topK.
1074
+ *
1075
+ * Example usage in agent source:
1076
+ *
1077
+ * ```book
1078
+ * MODEL gpt-4
1079
+ * MODEL claude-3-opus temperature=0.3
1080
+ * MODEL gpt-3.5-turbo temperature=0.8 topP=0.9
1081
+ * ```
1082
+ *
1083
+ * @private [🪔] Maybe export the commitments through some package
1084
+ */
1085
+ class ModelCommitmentDefinition extends BaseCommitmentDefinition {
1086
+ constructor() {
1087
+ super('MODEL');
1088
+ }
1089
+ /**
1090
+ * Short one-line description of MODEL.
1091
+ */
1092
+ get description() {
1093
+ return 'Select the AI model and optional decoding parameters.';
1094
+ }
1095
+ /**
1096
+ * Markdown documentation for MODEL commitment.
1097
+ */
1098
+ get documentation() {
1099
+ return spaceTrim$1(`
1100
+ # MODEL
1101
+
1102
+ Specifies which AI model to use and optional decoding parameters.
1103
+
1104
+ ## Key behaviors
1105
+
1106
+ - Only one \`MODEL\` commitment should be used per agent.
1107
+ - If multiple are specified, the last one takes precedence.
1108
+ - Parameters control the randomness and creativity of responses.
1109
+
1110
+ ## Supported parameters
1111
+
1112
+ - \`temperature\`: Controls randomness (0.0 = deterministic, 1.0+ = creative)
1113
+ - \`topP\` (aka \`top_p\`): Nucleus sampling parameter
1114
+ - \`topK\` (aka \`top_k\`): Top-k sampling parameter
1115
+
1116
+ ## Examples
1117
+
1118
+ \`\`\`book
1119
+ Precise Assistant
1120
+
1121
+ PERSONA You are a precise and accurate assistant
1122
+ MODEL gpt-4 temperature=0.1
1123
+ RULE Always provide factual information
1124
+ \`\`\`
1125
+
1126
+ \`\`\`book
1127
+ Creative Writer
1128
+
1129
+ PERSONA You are a creative writing assistant
1130
+ MODEL claude-3-opus temperature=0.8 topP=0.9
1131
+ STYLE Be imaginative and expressive
1132
+ ACTION Can help with storytelling and character development
1133
+ \`\`\`
1134
+ `);
1135
+ }
1136
+ applyToAgentModelRequirements(requirements, content) {
1137
+ const trimmedContent = content.trim();
1138
+ if (!trimmedContent) {
1139
+ return requirements;
1140
+ }
1141
+ // Parse the model specification
1142
+ const parts = trimmedContent.split(/\s+/);
1143
+ const modelName = parts[0];
1144
+ if (!modelName) {
1145
+ return requirements;
1146
+ }
1147
+ // Start with the model name
1148
+ const updatedRequirements = {
1149
+ ...requirements,
1150
+ modelName,
1151
+ };
1152
+ // Parse additional parameters
1153
+ const result = { ...updatedRequirements };
1154
+ for (let i = 1; i < parts.length; i++) {
1155
+ const param = parts[i];
1156
+ if (param && param.includes('=')) {
1157
+ const [key, value] = param.split('=');
1158
+ if (key && value) {
1159
+ const numValue = parseFloat(value);
1160
+ if (!isNaN(numValue)) {
1161
+ switch (key.toLowerCase()) {
1162
+ case 'temperature':
1163
+ result.temperature = numValue;
1164
+ break;
1165
+ case 'topp':
1166
+ case 'top_p':
1167
+ result.topP = numValue;
1168
+ break;
1169
+ case 'topk':
1170
+ case 'top_k':
1171
+ result.topK = Math.round(numValue);
1172
+ break;
1173
+ }
1174
+ }
1175
+ }
1176
+ }
1177
+ }
1178
+ return result;
1179
+ }
1180
+ }
1181
+ /**
1182
+ * Singleton instance of the MODEL commitment definition
1183
+ *
1184
+ * @private [🪔] Maybe export the commitments through some package
1185
+ */
1186
+ new ModelCommitmentDefinition();
1187
+ /**
1188
+ * Note: [💞] Ignore a discrepancy between file name and entity name
1189
+ */
1190
+
1191
+ /**
1192
+ * NOTE commitment definition
1193
+ *
1194
+ * The NOTE commitment is used to add comments to the agent source without making any changes
1195
+ * to the system message or agent model requirements. It serves as a documentation mechanism
1196
+ * for developers to add explanatory comments, reminders, or annotations directly in the agent source.
1197
+ *
1198
+ * Key features:
1199
+ * - Makes no changes to the system message
1200
+ * - Makes no changes to agent model requirements
1201
+ * - Content is preserved in metadata.NOTE for debugging and inspection
1202
+ * - Multiple NOTE commitments are aggregated together
1203
+ * - Comments (# NOTE) are removed from the final system message
1204
+ *
1205
+ * Example usage in agent source:
1206
+ *
1207
+ * ```book
1208
+ * NOTE This agent was designed for customer support scenarios
1209
+ * NOTE Remember to update the knowledge base monthly
1210
+ * NOTE Performance optimized for quick response times
1211
+ * ```
1212
+ *
1213
+ * The above notes will be stored in metadata but won't affect the agent's behavior.
1214
+ *
1215
+ * @private [🪔] Maybe export the commitments through some package
1216
+ */
1217
+ class NoteCommitmentDefinition extends BaseCommitmentDefinition {
1218
+ constructor() {
1219
+ super('NOTE');
1220
+ }
1221
+ /**
1222
+ * Short one-line description of NOTE.
1223
+ */
1224
+ get description() {
1225
+ return 'Add developer-facing notes without changing behavior or output.';
1226
+ }
1227
+ /**
1228
+ * Markdown documentation for NOTE commitment.
1229
+ */
1230
+ get documentation() {
1231
+ return spaceTrim$1(`
1232
+ # NOTE
1233
+
1234
+ Adds comments for documentation without changing agent behavior.
1235
+
1236
+ ## Key behaviors
1237
+
1238
+ - Does not modify the agent's behavior or responses.
1239
+ - Multiple \`NOTE\` commitments are aggregated for debugging.
1240
+ - Useful for documenting design decisions and reminders.
1241
+ - Content is preserved in metadata for inspection.
1242
+
1243
+ ## Examples
1244
+
1245
+ \`\`\`book
1246
+ Customer Support Bot
1247
+
1248
+ NOTE This agent was designed for customer support scenarios
1249
+ NOTE Remember to update the knowledge base monthly
1250
+ PERSONA You are a helpful customer support representative
1251
+ KNOWLEDGE Company policies and procedures
1252
+ RULE Always be polite and professional
1253
+ \`\`\`
1254
+
1255
+ \`\`\`book
1256
+ Research Assistant
1257
+
1258
+ NOTE Performance optimized for quick response times
1259
+ NOTE Uses RAG for accessing latest research papers
1260
+ PERSONA You are a knowledgeable research assistant
1261
+ ACTION Can help with literature reviews and citations
1262
+ STYLE Present information in academic format
1263
+ \`\`\`
1264
+ `);
1265
+ }
1266
+ applyToAgentModelRequirements(requirements, content) {
1267
+ var _a;
1268
+ // The NOTE commitment makes no changes to the system message or model requirements
1269
+ // It only stores the note content in metadata for documentation purposes
1270
+ const trimmedContent = content.trim();
1271
+ if (!trimmedContent) {
1272
+ return requirements;
1273
+ }
1274
+ // Get existing note content from metadata
1275
+ const existingNoteContent = ((_a = requirements.metadata) === null || _a === void 0 ? void 0 : _a.NOTE) || '';
1276
+ // Merge the new content with existing note content
1277
+ // When multiple NOTE commitments exist, they are aggregated together
1278
+ const mergedNoteContent = existingNoteContent ? `${existingNoteContent}\n${trimmedContent}` : trimmedContent;
1279
+ // Store the merged note content in metadata for debugging and inspection
1280
+ const updatedMetadata = {
1281
+ ...requirements.metadata,
1282
+ NOTE: mergedNoteContent,
1283
+ };
1284
+ // Return requirements with updated metadata but no changes to system message
1285
+ return {
1286
+ ...requirements,
1287
+ metadata: updatedMetadata,
1288
+ };
1289
+ }
1290
+ }
1291
+ /**
1292
+ * Singleton instance of the NOTE commitment definition
1293
+ *
1294
+ * @private [🪔] Maybe export the commitments through some package
1295
+ */
1296
+ new NoteCommitmentDefinition();
1297
+ /**
1298
+ * [💞] Ignore a discrepancy between file name and entity name
1299
+ */
1300
+
1301
+ /**
1302
+ * PERSONA commitment definition
1303
+ *
1304
+ * The PERSONA commitment modifies the agent's personality and character in the system message.
1305
+ * It defines who the agent is, their background, expertise, and personality traits.
1306
+ *
1307
+ * Key features:
1308
+ * - Multiple PERSONA commitments are automatically merged into one
1309
+ * - Content is placed at the beginning of the system message
1310
+ * - Original content with comments is preserved in metadata.PERSONA
1311
+ * - Comments (# PERSONA) are removed from the final system message
1312
+ *
1313
+ * Example usage in agent source:
1314
+ *
1315
+ * ```book
1316
+ * PERSONA You are a helpful programming assistant with expertise in TypeScript and React
1317
+ * PERSONA You have deep knowledge of modern web development practices
1318
+ * ```
1319
+ *
1320
+ * The above will be merged into a single persona section at the beginning of the system message.
1321
+ *
1322
+ * @private [🪔] Maybe export the commitments through some package
1323
+ */
1324
+ class PersonaCommitmentDefinition extends BaseCommitmentDefinition {
1325
+ constructor() {
1326
+ super('PERSONA');
1327
+ }
1328
+ /**
1329
+ * Short one-line description of PERSONA.
1330
+ */
1331
+ get description() {
1332
+ return 'Define who the agent is: background, expertise, and personality.';
1333
+ }
1334
+ /**
1335
+ * Markdown documentation for PERSONA commitment.
1336
+ */
1337
+ get documentation() {
1338
+ return spaceTrim$1(`
1339
+ # PERSONA
1340
+
1341
+ Defines who the agent is, their background, expertise, and personality traits.
1342
+
1343
+ ## Key behaviors
1344
+
1345
+ - Multiple \`PERSONA\` commitments are merged together.
1346
+ - If they are in conflict, the last one takes precedence.
1347
+ - You can write persona content in multiple lines.
1348
+
1349
+ ## Examples
1350
+
1351
+ \`\`\`book
1352
+ Programming Assistant
1353
+
1354
+ PERSONA You are a helpful programming assistant with expertise in TypeScript and React
1355
+ PERSONA You have deep knowledge of modern web development practices
1356
+ \`\`\`
1357
+ `);
1358
+ }
1359
+ applyToAgentModelRequirements(requirements, content) {
1360
+ var _a, _b;
1361
+ // The PERSONA commitment aggregates all persona content and places it at the beginning
1362
+ const trimmedContent = content.trim();
1363
+ if (!trimmedContent) {
1364
+ return requirements;
1365
+ }
1366
+ // Get existing persona content from metadata
1367
+ const existingPersonaContent = ((_a = requirements.metadata) === null || _a === void 0 ? void 0 : _a.PERSONA) || '';
1368
+ // Merge the new content with existing persona content
1369
+ // When multiple PERSONA commitments exist, they are merged into one
1370
+ const mergedPersonaContent = existingPersonaContent
1371
+ ? `${existingPersonaContent}\n${trimmedContent}`
1372
+ : trimmedContent;
1373
+ // Store the merged persona content in metadata for debugging and inspection
1374
+ const updatedMetadata = {
1375
+ ...requirements.metadata,
1376
+ PERSONA: mergedPersonaContent,
1377
+ };
1378
+ // Get the agent name from metadata (which should contain the first line of agent source)
1379
+ // If not available, extract from current system message as fallback
1380
+ let agentName = (_b = requirements.metadata) === null || _b === void 0 ? void 0 : _b.agentName;
1381
+ if (!agentName) {
1382
+ // Fallback: extract from current system message
1383
+ const currentMessage = requirements.systemMessage.trim();
1384
+ const basicFormatMatch = currentMessage.match(/^You are (.+)$/);
1385
+ if (basicFormatMatch && basicFormatMatch[1]) {
1386
+ agentName = basicFormatMatch[1];
1387
+ }
1388
+ else {
1389
+ agentName = 'AI Agent'; // Final fallback
1390
+ }
1391
+ }
1392
+ // Remove any existing persona content from the system message
1393
+ // (this handles the case where we're processing multiple PERSONA commitments)
1394
+ const currentMessage = requirements.systemMessage.trim();
1395
+ let cleanedMessage = currentMessage;
1396
+ // Check if current message starts with persona content or is just the basic format
1397
+ const basicFormatRegex = /^You are .+$/;
1398
+ const isBasicFormat = basicFormatRegex.test(currentMessage) && !currentMessage.includes('\n');
1399
+ if (isBasicFormat) {
1400
+ // Replace the basic format entirely
1401
+ cleanedMessage = '';
1402
+ }
1403
+ else if (currentMessage.startsWith('# PERSONA')) {
1404
+ // Remove existing persona section by finding where it ends
1405
+ const lines = currentMessage.split('\n');
1406
+ let personaEndIndex = lines.length;
1407
+ // Find the end of the PERSONA section (next comment or end of message)
1408
+ for (let i = 1; i < lines.length; i++) {
1409
+ const line = lines[i].trim();
1410
+ if (line.startsWith('#') && !line.startsWith('# PERSONA')) {
1411
+ personaEndIndex = i;
1412
+ break;
1413
+ }
1414
+ }
1415
+ // Keep everything after the PERSONA section
1416
+ cleanedMessage = lines.slice(personaEndIndex).join('\n').trim();
1417
+ }
1418
+ // Create new system message with persona at the beginning
1419
+ // Format: "You are {agentName}\n{personaContent}"
1420
+ // The # PERSONA comment will be removed later by removeCommentsFromSystemMessage
1421
+ const personaSection = `# PERSONA\nYou are ${agentName}\n${mergedPersonaContent}`; // <- TODO: Use spaceTrim
1422
+ const newSystemMessage = cleanedMessage ? `${personaSection}\n\n${cleanedMessage}` : personaSection;
1423
+ return {
1424
+ ...requirements,
1425
+ systemMessage: newSystemMessage,
1426
+ metadata: updatedMetadata,
1427
+ };
1428
+ }
1429
+ }
1430
+ /**
1431
+ * Singleton instance of the PERSONA commitment definition
1432
+ *
1433
+ * @private [🪔] Maybe export the commitments through some package
1434
+ */
1435
+ new PersonaCommitmentDefinition();
1436
+ /**
1437
+ * Note: [💞] Ignore a discrepancy between file name and entity name
1438
+ */
1439
+
1440
+ /**
1441
+ * RULE commitment definition
1442
+ *
1443
+ * The RULE/RULES commitment adds behavioral constraints and guidelines that the agent must follow.
1444
+ * These are specific instructions about what the agent should or shouldn't do.
1445
+ *
1446
+ * Example usage in agent source:
1447
+ *
1448
+ * ```book
1449
+ * RULE Always ask for clarification if the user's request is ambiguous
1450
+ * RULES Never provide medical advice, always refer to healthcare professionals
1451
+ * ```
1452
+ *
1453
+ * @private [🪔] Maybe export the commitments through some package
1454
+ */
1455
+ class RuleCommitmentDefinition extends BaseCommitmentDefinition {
1456
+ constructor(type = 'RULE') {
1457
+ super(type);
1458
+ }
1459
+ /**
1460
+ * Short one-line description of RULE/RULES.
1461
+ */
1462
+ get description() {
1463
+ return 'Add behavioral rules the agent must follow.';
1464
+ }
1465
+ /**
1466
+ * Markdown documentation for RULE/RULES commitment.
1467
+ */
1468
+ get documentation() {
1469
+ return spaceTrim$1(`
1470
+ # ${this.type}
1471
+
1472
+ Adds behavioral constraints and guidelines that the agent must follow.
1473
+
1474
+ ## Key behaviors
1475
+
1476
+ - Multiple \`RULE\` and \`RULES\` commitments are applied sequentially.
1477
+ - All rules are treated equally regardless of singular/plural form.
1478
+ - Rules define what the agent must or must not do.
1479
+
1480
+ ## Examples
1481
+
1482
+ \`\`\`book
1483
+ Customer Support Agent
1484
+
1485
+ PERSONA You are a helpful customer support representative
1486
+ RULE Always ask for clarification if the user's request is ambiguous
1487
+ RULE Be polite and professional in all interactions
1488
+ RULES Never provide medical or legal advice
1489
+ STYLE Maintain a friendly and helpful tone
1490
+ \`\`\`
1491
+
1492
+ \`\`\`book
1493
+ Educational Tutor
1494
+
1495
+ PERSONA You are a patient and knowledgeable tutor
1496
+ RULE Break down complex concepts into simple steps
1497
+ RULE Always encourage students and celebrate their progress
1498
+ RULE If you don't know something, admit it and suggest resources
1499
+ SAMPLE When explaining math: "Let's work through this step by step..."
1500
+ \`\`\`
1501
+ `);
1502
+ }
1503
+ applyToAgentModelRequirements(requirements, content) {
1504
+ const trimmedContent = content.trim();
1505
+ if (!trimmedContent) {
1506
+ return requirements;
1507
+ }
1508
+ // Add rule to the system message
1509
+ const ruleSection = `Rule: ${trimmedContent}`;
1510
+ return this.appendToSystemMessage(requirements, ruleSection, '\n\n');
1511
+ }
1512
+ }
1513
+ /**
1514
+ * Singleton instances of the RULE commitment definitions
1515
+ *
1516
+ * @private [🪔] Maybe export the commitments through some package
1517
+ */
1518
+ new RuleCommitmentDefinition('RULE');
1519
+ /**
1520
+ * Singleton instances of the RULE commitment definitions
1521
+ *
1522
+ * @private [🪔] Maybe export the commitments through some package
1523
+ */
1524
+ new RuleCommitmentDefinition('RULES');
1525
+ /**
1526
+ * Note: [💞] Ignore a discrepancy between file name and entity name
1527
+ */
1528
+
1529
+ /**
1530
+ * SAMPLE commitment definition
1531
+ *
1532
+ * The SAMPLE/EXAMPLE commitment provides examples of how the agent should respond
1533
+ * or behave in certain situations. These examples help guide the agent's responses.
1534
+ *
1535
+ * Example usage in agent source:
1536
+ *
1537
+ * ```book
1538
+ * SAMPLE When asked about pricing, respond: "Our basic plan starts at $10/month..."
1539
+ * EXAMPLE For code questions, always include working code snippets
1540
+ * ```
1541
+ *
1542
+ * @private [🪔] Maybe export the commitments through some package
1543
+ */
1544
+ class SampleCommitmentDefinition extends BaseCommitmentDefinition {
1545
+ constructor(type = 'SAMPLE') {
1546
+ super(type);
1547
+ }
1548
+ /**
1549
+ * Short one-line description of SAMPLE/EXAMPLE.
1550
+ */
1551
+ get description() {
1552
+ return 'Provide example responses to guide behavior.';
1553
+ }
1554
+ /**
1555
+ * Markdown documentation for SAMPLE/EXAMPLE commitment.
1556
+ */
1557
+ get documentation() {
1558
+ return spaceTrim$1(`
1559
+ # ${this.type}
1560
+
1561
+ Provides examples of how the agent should respond or behave in certain situations.
1562
+
1563
+ ## Key behaviors
1564
+
1565
+ - Multiple \`SAMPLE\` and \`EXAMPLE\` commitments are applied sequentially.
1566
+ - Both terms work identically and can be used interchangeably.
1567
+ - Examples help guide the agent's response patterns and style.
1568
+
1569
+ ## Examples
1570
+
1571
+ \`\`\`book
1572
+ Sales Assistant
1573
+
1574
+ PERSONA You are a knowledgeable sales representative
1575
+ SAMPLE When asked about pricing, respond: "Our basic plan starts at $10/month..."
1576
+ SAMPLE For feature comparisons, create a clear comparison table
1577
+ RULE Always be honest about limitations
1578
+ \`\`\`
1579
+
1580
+ \`\`\`book
1581
+ Code Reviewer
1582
+
1583
+ PERSONA You are an experienced software engineer
1584
+ EXAMPLE For code questions, always include working code snippets
1585
+ EXAMPLE When suggesting improvements: "Here's a more efficient approach..."
1586
+ RULE Explain the reasoning behind your suggestions
1587
+ STYLE Be constructive and encouraging in feedback
1588
+ \`\`\`
1589
+ `);
1590
+ }
1591
+ applyToAgentModelRequirements(requirements, content) {
1592
+ const trimmedContent = content.trim();
1593
+ if (!trimmedContent) {
1594
+ return requirements;
1595
+ }
1596
+ // Add example to the system message
1597
+ const exampleSection = `Example: ${trimmedContent}`;
1598
+ return this.appendToSystemMessage(requirements, exampleSection, '\n\n');
1599
+ }
1600
+ }
1601
+ /**
1602
+ * Singleton instances of the SAMPLE commitment definitions
1603
+ *
1604
+ * @private [🪔] Maybe export the commitments through some package
1605
+ */
1606
+ new SampleCommitmentDefinition('SAMPLE');
1607
+ /**
1608
+ * Singleton instances of the SAMPLE commitment definitions
1609
+ *
1610
+ * @private [🪔] Maybe export the commitments through some package
1611
+ */
1612
+ new SampleCommitmentDefinition('EXAMPLE');
1613
+ /**
1614
+ * Note: [💞] Ignore a discrepancy between file name and entity name
1615
+ */
1616
+
1617
+ /**
1618
+ * STYLE commitment definition
1619
+ *
1620
+ * The STYLE commitment defines how the agent should format and present its responses.
1621
+ * This includes tone, writing style, formatting preferences, and communication patterns.
1622
+ *
1623
+ * Example usage in agent source:
1624
+ *
1625
+ * ```book
1626
+ * STYLE Write in a professional but friendly tone, use bullet points for lists
1627
+ * STYLE Always provide code examples when explaining programming concepts
1628
+ * ```
1629
+ *
1630
+ * @private [🪔] Maybe export the commitments through some package
1631
+ */
1632
+ class StyleCommitmentDefinition extends BaseCommitmentDefinition {
1633
+ constructor() {
1634
+ super('STYLE');
1635
+ }
1636
+ /**
1637
+ * Short one-line description of STYLE.
1638
+ */
1639
+ get description() {
1640
+ return 'Control the tone and writing style of responses.';
1641
+ }
1642
+ /**
1643
+ * Markdown documentation for STYLE commitment.
1644
+ */
1645
+ get documentation() {
1646
+ return spaceTrim$1(`
1647
+ # STYLE
1648
+
1649
+ Defines how the agent should format and present its responses (tone, writing style, formatting).
1650
+
1651
+ ## Key behaviors
1652
+
1653
+ - Multiple \`STYLE\` commitments are applied sequentially.
1654
+ - Later style instructions can override earlier ones.
1655
+ - Style affects both tone and presentation format.
1656
+
1657
+ ## Examples
1658
+
1659
+ \`\`\`book
1660
+ Technical Writer
1661
+
1662
+ PERSONA You are a technical documentation expert
1663
+ STYLE Write in a professional but friendly tone, use bullet points for lists
1664
+ STYLE Always provide code examples when explaining programming concepts
1665
+ FORMAT Use markdown formatting with clear headings
1666
+ \`\`\`
1667
+
1668
+ \`\`\`book
1669
+ Creative Assistant
1670
+
1671
+ PERSONA You are a creative writing helper
1672
+ STYLE Be enthusiastic and encouraging in your responses
1673
+ STYLE Use vivid metaphors and analogies to explain concepts
1674
+ STYLE Keep responses conversational and engaging
1675
+ RULE Always maintain a positive and supportive tone
1676
+ \`\`\`
1677
+ `);
1678
+ }
1679
+ applyToAgentModelRequirements(requirements, content) {
1680
+ const trimmedContent = content.trim();
1681
+ if (!trimmedContent) {
1682
+ return requirements;
1683
+ }
1684
+ // Add style instructions to the system message
1685
+ const styleSection = `Style: ${trimmedContent}`;
1686
+ return this.appendToSystemMessage(requirements, styleSection, '\n\n');
1687
+ }
1688
+ }
1689
+ /**
1690
+ * Singleton instance of the STYLE commitment definition
1691
+ *
1692
+ * @private [🪔] Maybe export the commitments through some package
1693
+ */
1694
+ new StyleCommitmentDefinition();
1695
+ /**
1696
+ * [💞] Ignore a discrepancy between file name and entity name
1697
+ */
1698
+
1699
+ /**
1700
+ * Placeholder commitment definition for commitments that are not yet implemented
1701
+ *
1702
+ * This commitment simply adds its content 1:1 into the system message,
1703
+ * preserving the original behavior until proper implementation is added.
1704
+ *
1705
+ * @public exported from `@promptbook/core`
1706
+ */
1707
+ class NotYetImplementedCommitmentDefinition extends BaseCommitmentDefinition {
1708
+ constructor(type) {
1709
+ super(type);
1710
+ }
1711
+ /**
1712
+ * Short one-line description of a placeholder commitment.
1713
+ */
1714
+ get description() {
1715
+ return 'Placeholder commitment that appends content verbatim to the system message.';
1716
+ }
1717
+ /**
1718
+ * Markdown documentation available at runtime.
1719
+ */
1720
+ get documentation() {
1721
+ return spaceTrim$1(`
1722
+ # ${this.type}
1723
+
1724
+ This commitment is not yet fully implemented.
1725
+
1726
+ ## Key behaviors
1727
+
1728
+ - Content is appended directly to the system message.
1729
+ - No special processing or validation is performed.
1730
+ - Behavior preserved until proper implementation is added.
1731
+
1732
+ ## Status
1733
+
1734
+ - **Status:** Placeholder implementation
1735
+ - **Effect:** Appends content prefixed by commitment type
1736
+ - **Future:** Will be replaced with specialized logic
1737
+
1738
+ ## Examples
1739
+
1740
+ \`\`\`book
1741
+ Example Agent
1742
+
1743
+ PERSONA You are a helpful assistant
1744
+ ${this.type} Your content here
1745
+ RULE Always be helpful
1746
+ \`\`\`
1747
+ `);
1748
+ }
1749
+ applyToAgentModelRequirements(requirements, content) {
1750
+ const trimmedContent = content.trim();
1751
+ if (!trimmedContent) {
1752
+ return requirements;
1753
+ }
1754
+ // Add the commitment content 1:1 to the system message
1755
+ const commitmentLine = `${this.type} ${trimmedContent}`;
1756
+ return this.appendToSystemMessage(requirements, commitmentLine, '\n\n');
1757
+ }
1758
+ }
1759
+
1760
+ // Import all commitment definition classes
1761
+ /**
1762
+ * Registry of all available commitment definitions
1763
+ * This array contains instances of all commitment definitions
1764
+ * This is the single source of truth for all commitments in the system
1765
+ *
1766
+ * @private Use functions to access commitments instead of this array directly
1767
+ */
1768
+ const COMMITMENT_REGISTRY = [
1769
+ // Fully implemented commitments
1770
+ new PersonaCommitmentDefinition(),
1771
+ new KnowledgeCommitmentDefinition(),
1772
+ new StyleCommitmentDefinition(),
1773
+ new RuleCommitmentDefinition('RULE'),
1774
+ new RuleCommitmentDefinition('RULES'),
1775
+ new SampleCommitmentDefinition('SAMPLE'),
1776
+ new SampleCommitmentDefinition('EXAMPLE'),
1777
+ new FormatCommitmentDefinition(),
1778
+ new ModelCommitmentDefinition(),
1779
+ new ActionCommitmentDefinition(),
1780
+ new MetaImageCommitmentDefinition(),
1781
+ new MetaLinkCommitmentDefinition(),
1782
+ new NoteCommitmentDefinition(),
1783
+ // Not yet implemented commitments (using placeholder)
1784
+ new NotYetImplementedCommitmentDefinition('EXPECT'),
1785
+ new NotYetImplementedCommitmentDefinition('SCENARIO'),
1786
+ new NotYetImplementedCommitmentDefinition('SCENARIOS'),
1787
+ new NotYetImplementedCommitmentDefinition('BEHAVIOUR'),
1788
+ new NotYetImplementedCommitmentDefinition('BEHAVIOURS'),
1789
+ new NotYetImplementedCommitmentDefinition('AVOID'),
1790
+ new NotYetImplementedCommitmentDefinition('AVOIDANCE'),
1791
+ new NotYetImplementedCommitmentDefinition('GOAL'),
1792
+ new NotYetImplementedCommitmentDefinition('GOALS'),
1793
+ new NotYetImplementedCommitmentDefinition('CONTEXT'),
1794
+ ];
1795
+ /**
1796
+ * Gets all available commitment definitions
1797
+ * @returns Array of all commitment definitions
1798
+ *
1799
+ * @public exported from `@promptbook/core`
1800
+ */
1801
+ function getAllCommitmentDefinitions() {
1802
+ return $deepFreeze([...COMMITMENT_REGISTRY]);
1803
+ }
1804
+ /**
1805
+ * TODO: !!!! Maybe create through standardized $register
1806
+ * Note: [💞] Ignore a discrepancy between file name and entity name
1807
+ */
1808
+
1809
+ /**
1810
+ * Escape HTML to safely render user text inside a <pre> with dangerouslySetInnerHTML.
1811
+ *
1812
+ * @private within the BookEditor component
1813
+ */
1814
+ function escapeHtml(input) {
1815
+ return input.replaceAll(/&/g, '&amp;').replaceAll(/</g, '&lt;').replaceAll(/>/g, '&gt;');
1816
+ }
1817
+ /**
1818
+ * Escape text for safe use inside a RegExp pattern.
1819
+ *
1820
+ * @private within the BookEditor component
1821
+ */
1822
+ function escapeRegex(input) {
1823
+ return input.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
1824
+ }
1825
+ /**
1826
+ * Renders a book editor
1827
+ *
1828
+ * @public exported from `@promptbook/components`
1829
+ */
1830
+ function BookEditor(props) {
1831
+ const { className = '', value: controlledValue, onChange, fontClassName = '' } = props;
1832
+ const [internalValue, setInternalValue] = useState(DEFAULT_BOOK);
1833
+ const value = controlledValue !== undefined ? controlledValue : internalValue;
1834
+ const textareaRef = useRef(null);
1835
+ const highlightRef = useRef(null);
1836
+ const [lineHeight, setLineHeight] = useState(32);
1837
+ const handleChange = useCallback((event) => {
1838
+ const newValue = event.target.value;
1839
+ if (controlledValue !== undefined) {
1840
+ onChange === null || onChange === void 0 ? void 0 : onChange(validateBook(newValue));
1841
+ }
1842
+ else {
1843
+ setInternalValue(validateBook(newValue));
1844
+ }
1845
+ }, [controlledValue, onChange]);
1846
+ const handleScroll = useCallback((event) => {
1847
+ const t = event.currentTarget;
1848
+ if (highlightRef.current) {
1849
+ highlightRef.current.scrollTop = t.scrollTop;
1850
+ highlightRef.current.scrollLeft = t.scrollLeft;
1851
+ }
1852
+ }, []);
1853
+ useEffect(() => {
1854
+ var _a;
1855
+ const el = textareaRef.current;
1856
+ if (!el)
1857
+ return;
1858
+ const measure = () => {
1859
+ const cs = window.getComputedStyle(el);
1860
+ const lh = parseFloat(cs.lineHeight || '0');
1861
+ if (!Number.isNaN(lh) && lh > 0) {
1862
+ setLineHeight(lh);
1863
+ }
1864
+ };
1865
+ // Initial measure
1866
+ measure();
1867
+ // Re-measure after fonts load (metrics can change once font renders)
1868
+ const fontsReady = (_a = document.fonts) === null || _a === void 0 ? void 0 : _a.ready;
1869
+ if (fontsReady && typeof fontsReady.then === 'function') {
1870
+ fontsReady
1871
+ .then(() => {
1872
+ measure();
1873
+ })
1874
+ .catch(() => {
1875
+ /* ignore */
1876
+ });
1877
+ }
1878
+ // Re-measure on resize
1879
+ window.addEventListener('resize', measure);
1880
+ return () => {
1881
+ window.removeEventListener('resize', measure);
1882
+ };
1883
+ }, []);
1884
+ // Build the regex for commitment types
1885
+ const typeRegex = useMemo(() => {
1886
+ const allTypes = getAllCommitmentDefinitions().map(({ type }) => String(type));
1887
+ const pattern = `\\b(?:${allTypes.map((t) => escapeRegex(t)).join('|')})\\b`;
1888
+ return new RegExp(pattern, 'gmi');
1889
+ }, []);
1890
+ // Generate highlighted HTML version of the current text
1891
+ const highlightedHtml = useMemo(() => {
1892
+ const text = value !== null && value !== void 0 ? value : '';
1893
+ const r = typeRegex;
1894
+ let lastIndex = 0;
1895
+ let out = '';
1896
+ text.replace(r, (match, ...args) => {
1897
+ const index = args[args.length - 2]; // offset
1898
+ out += escapeHtml(text.slice(lastIndex, index));
1899
+ out += `<span class="text-indigo-700">${escapeHtml(match)}</span>`;
1900
+ lastIndex = index + match.length;
1901
+ return match;
1902
+ });
1903
+ out += escapeHtml(text.slice(lastIndex));
1904
+ return out;
1905
+ }, [value, typeRegex]);
1906
+ return (jsx("div", { className: `w-full ${className}`, children: jsxs("div", { className: [
1907
+ 'relative overflow-hidden rounded-2xl border border-gray-300/80 bg-white shadow-sm focus-within:ring-2 focus-within:ring-indigo-300/40',
1908
+ 'transition-shadow duration-200 hover:shadow-md',
1909
+ fontClassName,
1910
+ // [7] libreBaskerville.className,
1911
+ ].join(' '), children: [jsx("div", { "aria-hidden": true, className: "pointer-events-none absolute inset-0",
1912
+ // Two background layers:
1913
+ // 1) center fold line
1914
+ // 2) horizontal repeating lines (lined paper)
1915
+ style: {
1916
+ backgroundImage: 'none',
1917
+ } }), jsx("pre", { ref: highlightRef, "aria-hidden": true, className: [
1918
+ 'absolute inset-0 overflow-auto pointer-events-none',
1919
+ 'whitespace-pre-wrap',
1920
+ 'text-gray-900',
1921
+ 'text-lg md:text-xl',
1922
+ 'py-6 md:py-8',
1923
+ 'pl-[46px] pr-[46px]',
1924
+ // Ensure highlighted text sits below the textarea but remains visible
1925
+ 'z-10',
1926
+ fontClassName,
1927
+ ].join(' '), style: {
1928
+ lineHeight: `${lineHeight}px`,
1929
+ backgroundImage: `linear-gradient(90deg, transparent 30px, rgba(59,130,246,0.3) 30px, rgba(59,130,246,0.3) 31px, transparent 31px), repeating-linear-gradient(0deg, transparent, transparent calc(${lineHeight}px - 1px), rgba(0,0,0,0.06) ${lineHeight}px)`,
1930
+ backgroundAttachment: 'local',
1931
+ backgroundOrigin: 'padding-box, content-box',
1932
+ backgroundClip: 'padding-box, content-box',
1933
+ overflowWrap: 'break-word',
1934
+ scrollbarWidth: 'none',
1935
+ msOverflowStyle: 'none',
1936
+ }, dangerouslySetInnerHTML: { __html: highlightedHtml } }), jsx("textarea", { ref: textareaRef, value: value, onChange: handleChange, onScroll: handleScroll, className: [
1937
+ 'relative z-20 w-full',
1938
+ // Taller editor area
1939
+ 'h-[28rem] md:h-[36rem]',
1940
+ // Typography
1941
+ 'text-transparent caret-gray-900 selection:bg-indigo-200/60',
1942
+ 'text-lg md:text-xl',
1943
+ fontClassName,
1944
+ // [7] libreBaskerville.className,
1945
+ // Layout and visuals
1946
+ 'bg-transparent outline-none resize-none',
1947
+ 'py-6 md:py-8',
1948
+ 'pl-[46px] pr-[46px]',
1949
+ ].join(' '), style: { lineHeight: `${lineHeight}px` }, spellCheck: false })] }) }));
1950
+ }
1951
+
1952
+ export { BOOK_LANGUAGE_VERSION, BookEditor, PROMPTBOOK_ENGINE_VERSION };
1953
+ //# sourceMappingURL=index.es.js.map