@promptbook/remote-server 0.72.0-9 → 0.73.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/README.md +36 -252
  2. package/esm/index.es.js +76 -69
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/src/_packages/core.index.d.ts +24 -18
  5. package/esm/typings/src/_packages/node.index.d.ts +2 -0
  6. package/esm/typings/src/_packages/types.index.d.ts +18 -12
  7. package/esm/typings/src/_packages/utils.index.d.ts +2 -2
  8. package/esm/typings/src/collection/PipelineCollection.d.ts +1 -1
  9. package/esm/typings/src/collection/SimplePipelineCollection.d.ts +2 -2
  10. package/esm/typings/src/collection/collectionToJson.d.ts +1 -1
  11. package/esm/typings/src/collection/constructors/createCollectionFromJson.d.ts +1 -1
  12. package/esm/typings/src/collection/constructors/createCollectionFromPromise.d.ts +1 -1
  13. package/esm/typings/src/commands/TEMPLATE/TemplateTypes.d.ts +1 -1
  14. package/esm/typings/src/commands/_common/types/CommandParser.d.ts +5 -5
  15. package/esm/typings/src/config.d.ts +22 -15
  16. package/esm/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +3 -3
  17. package/esm/typings/src/conversion/utils/stringifyPipelineJson.d.ts +1 -1
  18. package/esm/typings/src/conversion/validation/_importPipeline.d.ts +1 -1
  19. package/esm/typings/src/conversion/validation/validatePipeline.d.ts +2 -2
  20. package/esm/typings/src/executables/$provideExecutablesForNode.d.ts +12 -0
  21. package/esm/typings/src/executables/apps/locateLibreoffice.d.ts +11 -0
  22. package/esm/typings/src/executables/apps/locatePandoc.d.ts +11 -0
  23. package/esm/typings/src/executables/locateApp.d.ts +33 -0
  24. package/esm/typings/src/executables/locateApp.test.d.ts +1 -0
  25. package/esm/typings/src/executables/platforms/locateAppOnLinux.d.ts +12 -0
  26. package/esm/typings/src/executables/platforms/locateAppOnMacOs.d.ts +12 -0
  27. package/esm/typings/src/executables/platforms/locateAppOnWindows.d.ts +12 -0
  28. package/esm/typings/src/execution/EmbeddingVector.d.ts +1 -1
  29. package/esm/typings/src/execution/Executables.d.ts +18 -0
  30. package/esm/typings/src/execution/ExecutionTools.d.ts +9 -3
  31. package/esm/typings/src/execution/FilesystemTools.d.ts +1 -1
  32. package/esm/typings/src/execution/LlmExecutionTools.d.ts +2 -2
  33. package/esm/typings/src/execution/PipelineExecutorResult.d.ts +2 -2
  34. package/esm/typings/src/execution/assertsExecutionSuccessful.d.ts +3 -2
  35. package/esm/typings/src/execution/createPipelineExecutor/00-CreatePipelineExecutorOptions.d.ts +29 -6
  36. package/esm/typings/src/execution/createPipelineExecutor/10-executePipeline.d.ts +2 -11
  37. package/esm/typings/src/execution/createPipelineExecutor/20-executeTemplate.d.ts +4 -13
  38. package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +9 -14
  39. package/esm/typings/src/execution/createPipelineExecutor/{getSamplesForTemplate.d.ts → getExamplesForTemplate.d.ts} +1 -1
  40. package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/LindatAutomaticTranslator.d.ts +11 -3
  41. package/esm/typings/src/execution/utils/addUsage.d.ts +1 -1
  42. package/esm/typings/src/execution/utils/forEachAsync.d.ts +1 -1
  43. package/esm/typings/src/formats/_common/FormatDefinition.d.ts +4 -4
  44. package/esm/typings/src/formats/_common/FormatSubvalueDefinition.d.ts +3 -3
  45. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForCli.d.ts +2 -2
  46. package/esm/typings/src/llm-providers/_common/register/LlmToolsConfiguration.d.ts +1 -1
  47. package/esm/typings/src/llm-providers/_common/register/createLlmToolsFromConfiguration.d.ts +7 -0
  48. package/esm/typings/src/llm-providers/_common/utils/cache/CacheLlmToolsOptions.d.ts +4 -1
  49. package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +1 -1
  50. package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +2 -2
  51. package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
  52. package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +1 -1
  53. package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +2 -1
  54. package/esm/typings/src/llm-providers/langtail/LangtailExecutionTools.d.ts +1 -1
  55. package/esm/typings/src/llm-providers/mocked/$fakeTextToExpectations.d.ts +1 -1
  56. package/esm/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +1 -1
  57. package/esm/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +1 -1
  58. package/esm/typings/src/llm-providers/multiple/MultipleLlmExecutionTools.d.ts +4 -5
  59. package/esm/typings/src/llm-providers/multiple/joinLlmExecutionTools.d.ts +1 -1
  60. package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +0 -1
  61. package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +2 -2
  62. package/esm/typings/src/llm-providers/openai/OpenAiExecutionToolsOptions.d.ts +2 -2
  63. package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -1
  64. package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +4 -4
  65. package/esm/typings/src/llm-providers/remote/interfaces/PromptbookServer_ListModels_Request.d.ts +15 -6
  66. package/esm/typings/src/llm-providers/remote/interfaces/PromptbookServer_ListModels_Response.d.ts +4 -4
  67. package/esm/typings/src/llm-providers/remote/interfaces/PromptbookServer_Prompt_Request.d.ts +6 -12
  68. package/esm/typings/src/llm-providers/remote/interfaces/PromptbookServer_Prompt_Response.d.ts +3 -3
  69. package/esm/typings/src/llm-providers/remote/interfaces/RemoteLlmExecutionToolsOptions.d.ts +9 -14
  70. package/esm/typings/src/llm-providers/remote/interfaces/RemoteServerOptions.d.ts +23 -8
  71. package/esm/typings/src/llm-providers/remote/startRemoteServer.d.ts +1 -1
  72. package/esm/typings/src/personas/preparePersona.d.ts +1 -1
  73. package/esm/typings/src/prepare/PrepareAndScrapeOptions.d.ts +4 -23
  74. package/esm/typings/src/prepare/isPipelinePrepared.d.ts +2 -2
  75. package/esm/typings/src/prepare/prepareTemplates.d.ts +2 -2
  76. package/esm/typings/src/scrapers/_common/Scraper.d.ts +2 -9
  77. package/esm/typings/src/scrapers/_common/prepareKnowledgePieces.d.ts +1 -1
  78. package/esm/typings/src/scrapers/_common/register/$provideScrapersForBrowser.d.ts +2 -2
  79. package/esm/typings/src/scrapers/_common/register/$provideScrapersForNode.d.ts +2 -2
  80. package/esm/typings/src/scrapers/_common/register/ScraperAndConverterMetadata.d.ts +2 -2
  81. package/esm/typings/src/scrapers/_common/utils/getScraperIntermediateSource.d.ts +2 -2
  82. package/esm/typings/src/scrapers/_common/utils/makeKnowledgeSourceHandler.d.ts +1 -1
  83. package/esm/typings/src/scrapers/document/DocumentScraper.d.ts +2 -2
  84. package/esm/typings/src/scrapers/document/DocumentScraper.test.d.ts +1 -1
  85. package/esm/typings/src/scrapers/document/createDocumentScraper.d.ts +1 -1
  86. package/esm/typings/src/scrapers/document/register-metadata.d.ts +1 -1
  87. package/esm/typings/src/scrapers/document-legacy/LegacyDocumentScraper.d.ts +3 -3
  88. package/esm/typings/src/scrapers/document-legacy/LegacyDocumentScraper.test.d.ts +1 -1
  89. package/esm/typings/src/scrapers/document-legacy/createLegacyDocumentScraper.d.ts +1 -1
  90. package/esm/typings/src/scrapers/document-legacy/register-metadata.d.ts +1 -1
  91. package/esm/typings/src/scrapers/markdown/MarkdownScraper.d.ts +1 -1
  92. package/esm/typings/src/scrapers/markdown/MarkdownScraper.test.d.ts +1 -1
  93. package/esm/typings/src/scrapers/markdown/createMarkdownScraper.d.ts +1 -1
  94. package/esm/typings/src/scrapers/markdown/register-metadata.d.ts +1 -1
  95. package/esm/typings/src/scrapers/pdf/PdfScraper.d.ts +2 -2
  96. package/esm/typings/src/scrapers/pdf/createPdfScraper.d.ts +1 -1
  97. package/esm/typings/src/scrapers/pdf/register-metadata.d.ts +1 -1
  98. package/esm/typings/src/scrapers/website/WebsiteScraper.d.ts +6 -3
  99. package/esm/typings/src/scrapers/website/createWebsiteScraper.d.ts +1 -1
  100. package/esm/typings/src/scrapers/website/register-metadata.d.ts +1 -1
  101. package/esm/typings/src/scrapers/website/utils/createShowdownConverter.d.ts +7 -0
  102. package/esm/typings/src/scrapers/website/utils/createShowdownConverter.test.d.ts +1 -0
  103. package/esm/typings/src/scripting/javascript/utils/preserve.d.ts +1 -1
  104. package/esm/typings/src/storage/file-cache-storage/utils/nameToSubfolderPath.d.ts +1 -1
  105. package/esm/typings/src/types/Arrayable.d.ts +1 -1
  106. package/esm/typings/src/types/IntermediateFilesStrategy.d.ts +7 -0
  107. package/esm/typings/src/types/PipelineJson/KnowledgePieceJson.d.ts +4 -4
  108. package/esm/typings/src/types/PipelineJson/KnowledgeSourceJson.d.ts +1 -1
  109. package/esm/typings/src/types/PipelineJson/ParameterJson.d.ts +2 -2
  110. package/esm/typings/src/types/PipelineJson/PersonaJson.d.ts +1 -1
  111. package/esm/typings/src/types/PipelineJson/PreparationJson.d.ts +1 -1
  112. package/esm/typings/src/types/PipelineJson/TemplateJsonCommon.d.ts +2 -2
  113. package/esm/typings/src/types/Prompt.d.ts +2 -1
  114. package/esm/typings/src/types/execution-report/ExecutionReportJson.d.ts +1 -1
  115. package/esm/typings/src/types/typeAliases.d.ts +11 -8
  116. package/esm/typings/src/utils/$Register.d.ts +1 -1
  117. package/esm/typings/src/utils/FromtoItems.d.ts +1 -1
  118. package/esm/typings/src/utils/arrayableToArray.d.ts +1 -1
  119. package/esm/typings/src/utils/emojis.d.ts +1 -1
  120. package/esm/typings/src/utils/execCommand/$execCommand.d.ts +4 -2
  121. package/esm/typings/src/utils/execCommand/$execCommandNormalizeOptions.d.ts +12 -0
  122. package/esm/typings/src/utils/execCommand/$execCommands.d.ts +1 -0
  123. package/esm/typings/src/utils/execCommand/ExecCommandOptions.d.ts +45 -0
  124. package/esm/typings/src/utils/expectation-counters/countSentences.d.ts +1 -1
  125. package/esm/typings/src/utils/files/isExecutable.d.ts +11 -0
  126. package/esm/typings/src/utils/markdown/extractAllBlocksFromMarkdown.d.ts +1 -1
  127. package/esm/typings/src/utils/markdown/splitMarkdownIntoSections.d.ts +1 -1
  128. package/esm/typings/src/utils/normalization/IKeywords.d.ts +2 -2
  129. package/esm/typings/src/utils/normalization/parseKeywords.d.ts +2 -2
  130. package/esm/typings/src/utils/normalization/parseKeywordsFromString.d.ts +2 -2
  131. package/esm/typings/src/utils/normalization/searchKeywords.d.ts +2 -2
  132. package/esm/typings/src/utils/organization/TODO_USE.d.ts +1 -1
  133. package/esm/typings/src/utils/organization/keepUnused.d.ts +1 -1
  134. package/esm/typings/src/utils/random/$randomSeed.d.ts +1 -1
  135. package/esm/typings/src/utils/sets/intersection.d.ts +1 -1
  136. package/esm/typings/src/utils/sets/union.d.ts +1 -1
  137. package/esm/typings/src/utils/unwrapResult.d.ts +4 -4
  138. package/package.json +6 -4
  139. package/umd/index.umd.js +76 -69
  140. package/umd/index.umd.js.map +1 -1
  141. package/esm/typings/src/execution/createPipelineExecutor/00-CreatePipelineExecutorSettings.d.ts +0 -29
  142. package/esm/typings/src/scrapers/website/utils/markdownConverter.d.ts +0 -12
  143. package/esm/typings/src/utils/execCommand/IExecCommandOptions.d.ts +0 -23
  144. package/esm/typings/src/utils/execCommand/execCommandNormalizeOptions.d.ts +0 -10
  145. /package/esm/typings/src/{scrapers/website/WebsiteScraper.test.d.ts → executables/apps/locateLibreoffice.test.d.ts} +0 -0
  146. /package/esm/typings/src/{scrapers/website/utils/markdownConverter.test.d.ts → executables/apps/locatePandoc.test.d.ts} +0 -0
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # ![Promptbook logo - cube with letters P and B](./other/design/logo-h1.png) Promptbook
4
4
 
5
- Supercharge your use of large language models
5
+ Build responsible, controlled and transparent applications on top of LLM models!
6
6
 
7
7
 
8
8
 
@@ -18,12 +18,10 @@ Supercharge your use of large language models
18
18
 
19
19
  ## ✨ New Features
20
20
 
21
+ - 💙 Working on [the **Book** language v1](https://github.com/webgptorg/book)
22
+ - 📚 Support of `.docx`, `.doc` and `.pdf` documents
21
23
  - ✨ **Support of [OpenAI o1 model](https://openai.com/o1/)**
22
24
 
23
- <blockquote style="color: #ff8811">
24
- <b>⚠ Warning:</b> This is a pre-release version of the library. It is not yet ready for production use. Please look at <a href="https://www.npmjs.com/package/@promptbook/core?activeTab=versions">latest stable release</a>.
25
- </blockquote>
26
-
27
25
 
28
26
 
29
27
  ## 📦 Package `@promptbook/remote-server`
@@ -50,260 +48,48 @@ Rest of the documentation is common for **entire promptbook ecosystem**:
50
48
 
51
49
  ## 🤍 The Promptbook Whitepaper
52
50
 
51
+ If you have a simple, single prompt for ChatGPT, GPT-4, Anthropic Claude, Google Gemini, Llama 3, or whatever, it doesn't matter how you integrate it. Whether it's calling a REST API directly, using the SDK, hardcoding the prompt into the source code, or importing a text file, the process remains the same.
53
52
 
54
-
55
- If you have a simple, single prompt for ChatGPT, GPT-4, Anthropic Claude, Google Gemini, Llama 2, or whatever, it doesn't matter how you integrate it. Whether it's calling a REST API directly, using the SDK, hardcoding the prompt into the source code, or importing a text file, the process remains the same.
56
-
57
- But often you will struggle with the limitations of LLMs, such as hallucinations, off-topic responses, poor quality output, language drift, word repetition repetition repetition repetition or misuse, lack of context, or just plain w𝒆𝐢rd responses. When this happens, you generally have three options:
53
+ But often you will struggle with the **limitations of LLMs**, such as **hallucinations, off-topic responses, poor quality output, language and prompt drift, word repetition repetition repetition repetition or misuse, lack of context, or just plain w𝒆𝐢rd resp0nses**. When this happens, you generally have three options:
58
54
 
59
55
  1. **Fine-tune** the model to your specifications or even train your own.
60
56
  2. **Prompt-engineer** the prompt to the best shape you can achieve.
61
57
  3. Orchestrate **multiple prompts** in a [pipeline](https://github.com/webgptorg/promptbook/discussions/64) to get the best result.
62
58
 
63
- In all of these situations, but especially in 3., the Promptbook library can make your life easier.
59
+ In all of these situations, but especially in 3., the **✨ Promptbook can make your life waaaaaaaaaay easier**.
64
60
 
65
- - [**Separates concerns**](https://github.com/webgptorg/promptbook/discussions/32) between prompt-engineer and programmer, between code files and prompt files, and between prompts and their execution logic.
66
- - Establishes a [**common format `.ptbk.md`**](https://github.com/webgptorg/promptbook/discussions/85) that can be used to describe your prompt business logic without having to write code or deal with the technicalities of LLMs.
67
- - **Forget** about **low-level details** like choosing the right model, tokens, context size, temperature, top-k, top-p, or kernel sampling. **Just write your intent** and [**persona**](https://github.com/webgptorg/promptbook/discussions/22) who should be responsible for the task and let the library do the rest.
68
- - Has built-in **orchestration** of [pipeline](https://github.com/webgptorg/promptbook/discussions/64) execution and many tools to make the process easier, more reliable, and more efficient, such as caching, [compilation+preparation](https://github.com/webgptorg/promptbook/discussions/78), [just-in-time fine-tuning](https://github.com/webgptorg/promptbook/discussions/33), [expectation-aware generation](https://github.com/webgptorg/promptbook/discussions/37), [agent adversary expectations](https://github.com/webgptorg/promptbook/discussions/39), and more.
61
+ - [**Separates concerns**](https://github.com/webgptorg/promptbook/discussions/32) between prompt-engineer and programmer, between code files and prompt files, and between prompts and their execution logic. For this purpose, it introduces a new language called [the **💙 Book**](https://github.com/webgptorg/book).
62
+ - Book allows you to **focus on the business** logic without having to write code or deal with the technicalities of LLMs.
63
+ - **Forget** about **low-level details** like choosing the right model, tokens, context size, `temperature`, `top-k`, `top-p`, or kernel sampling. **Just write your intent** and [**persona**](https://github.com/webgptorg/promptbook/discussions/22) who should be responsible for the task and let the library do the rest.
64
+ - We have built-in **orchestration** of [pipeline](https://github.com/webgptorg/promptbook/discussions/64) execution and many tools to make the process easier, more reliable, and more efficient, such as caching, [compilation+preparation](https://github.com/webgptorg/promptbook/discussions/78), [just-in-time fine-tuning](https://github.com/webgptorg/promptbook/discussions/33), [expectation-aware generation](https://github.com/webgptorg/promptbook/discussions/37), [agent adversary expectations](https://github.com/webgptorg/promptbook/discussions/39), and more.
69
65
  - Sometimes even the best prompts with the best framework like Promptbook `:)` can't avoid the problems. In this case, the library has built-in **[anomaly detection](https://github.com/webgptorg/promptbook/discussions/40) and logging** to help you find and fix the problems.
70
- - Promptbook has built in versioning. You can test multiple **A/B versions** of pipelines and see which one works best.
71
- - Promptbook is designed to do [**RAG** (Retrieval-Augmented Generation)](https://github.com/webgptorg/promptbook/discussions/41) and other advanced techniques. You can use **knowledge** to improve the quality of the output.
72
-
73
-
74
-
75
- ## 🧔 Pipeline _(for prompt-engeneers)_
76
-
77
- **P**romp**t** **b**oo**k** markdown file (or `.ptbk.md` file) is document that describes a **pipeline** - a series of prompts that are chained together to form somewhat reciepe for transforming natural language input.
78
-
79
- - Multiple pipelines forms a **collection** which will handle core **know-how of your LLM application**.
80
- - Theese pipelines are designed such as they **can be written by non-programmers**.
81
-
82
-
83
-
84
- ### Sample:
85
-
86
- File `write-website-content.ptbk.md`:
87
-
88
-
89
-
90
-
91
-
92
- > # 🌍 Create website content
93
- >
94
- > Instructions for creating web page content.
95
- >
96
- > - PIPELINE URL https://promptbook.studio/webgpt/write-website-content.ptbk.md
97
- > - INPUT  PARAM `{rawTitle}` Automatically suggested a site name or empty text
98
- > - INPUT  PARAM `{rawAssigment}` Automatically generated site entry from image recognition
99
- > - OUTPUT PARAM `{websiteContent}` Web content
100
- > - OUTPUT PARAM `{keywords}` Keywords
101
- >
102
- > ## 👤 Specifying the assigment
103
- >
104
- > What is your web about?
105
- >
106
- > - DIALOG TEMPLATE
107
- >
108
- > ```
109
- > {rawAssigment}
110
- > ```
111
- >
112
- > `-> {assigment}` Website assignment and specification
113
- >
114
- > ## ✨ Improving the title
115
- >
116
- > - PERSONA Jane, Copywriter and Marketing Specialist.
117
- >
118
- > ```
119
- > As an experienced marketing specialist, you have been entrusted with improving the name of your client's business.
120
- >
121
- > A suggested name from a client:
122
- > "{rawTitle}"
123
- >
124
- > Assignment from customer:
125
- >
126
- > > {assigment}
127
- >
128
- > ## Instructions:
129
- >
130
- > - Write only one name suggestion
131
- > - The name will be used on the website, business cards, visuals, etc.
132
- > ```
133
- >
134
- > `-> {enhancedTitle}` Enhanced title
135
- >
136
- > ## 👤 Website title approval
137
- >
138
- > Is the title for your website okay?
139
- >
140
- > - DIALOG TEMPLATE
141
- >
142
- > ```
143
- > {enhancedTitle}
144
- > ```
145
- >
146
- > `-> {title}` Title for the website
147
- >
148
- > ## 🐰 Cunning subtitle
149
- >
150
- > - PERSONA Josh, a copywriter, tasked with creating a claim for the website.
151
- >
152
- > ```
153
- > As an experienced copywriter, you have been entrusted with creating a claim for the "{title}" web page.
154
- >
155
- > A website assignment from a customer:
156
- >
157
- > > {assigment}
158
- >
159
- > ## Instructions:
160
- >
161
- > - Write only one name suggestion
162
- > - Claim will be used on website, business cards, visuals, etc.
163
- > - Claim should be punchy, funny, original
164
- > ```
165
- >
166
- > `-> {claim}` Claim for the web
167
- >
168
- > ## 🚦 Keyword analysis
169
- >
170
- > - PERSONA Paul, extremely creative SEO specialist.
171
- >
172
- > ```
173
- > As an experienced SEO specialist, you have been entrusted with creating keywords for the website "{title}".
174
- >
175
- > Website assignment from the customer:
176
- >
177
- > > {assigment}
178
- >
179
- > ## Instructions:
180
- >
181
- > - Write a list of keywords
182
- > - Keywords are in basic form
183
- >
184
- > ## Example:
185
- >
186
- > - Ice cream
187
- > - Olomouc
188
- > - Quality
189
- > - Family
190
- > - Tradition
191
- > - Italy
192
- > - Craft
193
- >
194
- > ```
195
- >
196
- > `-> {keywords}` Keywords
197
- >
198
- > ## 🔗 Combine the beginning
199
- >
200
- > - SIMPLE TEMPLATE
201
- >
202
- > ```
203
- >
204
- > # {title}
205
- >
206
- > > {claim}
207
- >
208
- > ```
209
- >
210
- > `-> {contentBeginning}` Beginning of web content
211
- >
212
- > ## 🖋 Write the content
213
- >
214
- > - PERSONA Jane
215
- >
216
- > ```
217
- > As an experienced copywriter and web designer, you have been entrusted with creating text for a new website {title}.
218
- >
219
- > A website assignment from a customer:
220
- >
221
- > > {assigment}
222
- >
223
- > ## Instructions:
224
- >
225
- > - Text formatting is in Markdown
226
- > - Be concise and to the point
227
- > - Use keywords, but they should be naturally in the text
228
- > - This is the complete content of the page, so don't forget all the important information and elements the page should contain
229
- > - Use headings, bullets, text formatting
230
- >
231
- > ## Keywords:
232
- >
233
- > {keywords}
234
- >
235
- > ## Web Content:
236
- >
237
- > {contentBeginning}
238
- > ```
239
- >
240
- > `-> {contentBody}` Middle of the web content
241
- >
242
- > ## 🔗 Combine the content
243
- >
244
- > - SIMPLE TEMPLATE
245
- >
246
- > ```markdown
247
- > {contentBeginning}
248
- >
249
- > {contentBody}
250
- > ```
251
- >
252
- > `-> {websiteContent}`
253
-
254
-
255
-
256
- Following is the scheme how the promptbook above is executed:
257
-
258
- ```mermaid
259
- %% 🔮 Tip: Open this on GitHub or in the VSCode website to see the Mermaid graph visually
260
-
261
- flowchart LR
262
- subgraph "🌍 Create website content"
263
-
264
- direction TB
265
-
266
- input((Input)):::input
267
- templateSpecifyingTheAssigment(👤 Specifying the assigment)
268
- input--"{rawAssigment}"-->templateSpecifyingTheAssigment
269
- templateImprovingTheTitle(✨ Improving the title)
270
- input--"{rawTitle}"-->templateImprovingTheTitle
271
- templateSpecifyingTheAssigment--"{assigment}"-->templateImprovingTheTitle
272
- templateWebsiteTitleApproval(👤 Website title approval)
273
- templateImprovingTheTitle--"{enhancedTitle}"-->templateWebsiteTitleApproval
274
- templateCunningSubtitle(🐰 Cunning subtitle)
275
- templateWebsiteTitleApproval--"{title}"-->templateCunningSubtitle
276
- templateSpecifyingTheAssigment--"{assigment}"-->templateCunningSubtitle
277
- templateKeywordAnalysis(🚦 Keyword analysis)
278
- templateWebsiteTitleApproval--"{title}"-->templateKeywordAnalysis
279
- templateSpecifyingTheAssigment--"{assigment}"-->templateKeywordAnalysis
280
- templateCombineTheBeginning(🔗 Combine the beginning)
281
- templateWebsiteTitleApproval--"{title}"-->templateCombineTheBeginning
282
- templateCunningSubtitle--"{claim}"-->templateCombineTheBeginning
283
- templateWriteTheContent(🖋 Write the content)
284
- templateWebsiteTitleApproval--"{title}"-->templateWriteTheContent
285
- templateSpecifyingTheAssigment--"{assigment}"-->templateWriteTheContent
286
- templateKeywordAnalysis--"{keywords}"-->templateWriteTheContent
287
- templateCombineTheBeginning--"{contentBeginning}"-->templateWriteTheContent
288
- templateCombineTheContent(🔗 Combine the content)
289
- templateCombineTheBeginning--"{contentBeginning}"-->templateCombineTheContent
290
- templateWriteTheContent--"{contentBody}"-->templateCombineTheContent
291
-
292
- templateCombineTheContent--"{websiteContent}"-->output
293
- output((Output)):::output
294
-
295
- classDef input color: grey;
296
- classDef output color: grey;
297
-
298
- end;
299
- ```
66
+ - Versioning is build in. You can test multiple **A/B versions** of pipelines and see which one works best.
67
+ - Promptbook is designed to use [**RAG** (Retrieval-Augmented Generation)](https://github.com/webgptorg/promptbook/discussions/41) and other advanced techniques to bring the context of your business to generic LLM. You can use **knowledge** to improve the quality of the output.
68
+
69
+
70
+
71
+ ## 💙 Book language _(for prompt-engineer)_
72
+
73
+ Promptbook [pipelines](https://github.com/webgptorg/promptbook/discussions/64) are written in markdown-like language called [Book](https://github.com/webgptorg/book). It is designed to be understandable by non-programmers and non-technical people.
300
74
 
301
- - [More template samples](./samples/pipelines/)
302
- - [Read more about `.ptbk.md` file format here](https://github.com/webgptorg/promptbook/discussions/categories/concepts?discussions_q=is%3Aopen+label%3A.ptbk.md+category%3AConcepts)
303
75
 
304
- _Note: We are using [postprocessing functions](#postprocessing-functions) like `unwrapResult` that can be used to postprocess the result._
305
76
 
306
- ## 📦 Packages
77
+ ```markdown
78
+ # 🌟 My first Book
79
+
80
+ - PERSONA Jane, marketing specialist with prior experience in writing articles about technology and artificial intelligence
81
+ - KNOWLEDGE https://ptbk.io
82
+ - KNOWLEDGE ./promptbook.pdf
83
+ - EXPECT MIN 1 Sentence
84
+ - EXPECT MAX 1 Paragraph
85
+
86
+ > Write an article about the future of artificial intelligence in the next 10 years and how metalanguages will change the way AI is used in the world.
87
+ > Look specifically at the impact of Promptbook on the AI industry.
88
+
89
+ -> {article}
90
+ ```
91
+
92
+ ## 📦 Packages _(for developers)_
307
93
 
308
94
  This library is divided into several packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
309
95
  You can install all of them at once:
@@ -345,8 +131,6 @@ Or you can install them separately:
345
131
 
346
132
  The following glossary is used to clarify certain concepts:
347
133
 
348
-
349
-
350
134
  ### Core concepts
351
135
 
352
136
  - [📚 Collection of pipelines](https://github.com/webgptorg/promptbook/discussions/65)
@@ -377,8 +161,8 @@ The following glossary is used to clarify certain concepts:
377
161
 
378
162
  ## 🔌 Usage in Typescript / Javascript
379
163
 
380
- - [Simple usage](./samples/usage/simple-script)
381
- - [Usage with client and remote server](./samples/usage/remote)
164
+ - [Simple usage](./examples/usage/simple-script)
165
+ - [Usage with client and remote server](./examples/usage/remote)
382
166
 
383
167
  ## ➕➖ When to use Promptbook?
384
168
 
package/esm/index.es.js CHANGED
@@ -7,7 +7,7 @@ import spaceTrim$1, { spaceTrim } from 'spacetrim';
7
7
  /**
8
8
  * The version of the Promptbook library
9
9
  */
10
- var PROMPTBOOK_VERSION = '0.72.0-8';
10
+ var PROMPTBOOK_VERSION = '0.72.0';
11
11
  // TODO: [main] !!!! List here all the versions and annotate + put into script
12
12
 
13
13
  /*! *****************************************************************************
@@ -351,10 +351,10 @@ $asDeeplyFrozenSerializableJson('RESERVED_PARAMETER_NAMES', [
351
351
  'content',
352
352
  'context',
353
353
  'knowledge',
354
- 'samples',
354
+ 'examples',
355
355
  'modelName',
356
356
  'currentDate',
357
- // <- TODO: !!!!! list here all command names
357
+ // <- TODO: list here all command names
358
358
  // <- TODO: Add more like 'date', 'modelName',...
359
359
  // <- TODO: Add [emoji] + instructions ACRY when adding new reserved parameter
360
360
  ]);
@@ -375,7 +375,7 @@ Object.freeze({
375
375
  *
376
376
  * @public exported from `@promptbook/core`
377
377
  */
378
- var IS_VERBOSE = false;
378
+ var DEFAULT_IS_VERBOSE = false;
379
379
  /**
380
380
  * TODO: [🧠][🧜‍♂️] Maybe join remoteUrl and path into single value
381
381
  */
@@ -587,8 +587,7 @@ function serializeError(error) {
587
587
  * Multiple LLM Execution Tools is a proxy server that uses multiple execution tools internally and exposes the executor interface externally.
588
588
  *
589
589
  * Note: Internal utility of `joinLlmExecutionTools` but exposed type
590
- * @public exported from `@promptbook/types`
591
- * TODO: !!!!!! Export as runtime class not just type
590
+ * @public exported from `@promptbook/core`
592
591
  */
593
592
  var MultipleLlmExecutionTools = /** @class */ (function () {
594
593
  /**
@@ -987,7 +986,7 @@ var $Register = /** @class */ (function () {
987
986
  this.storage = globalScope[storageName];
988
987
  }
989
988
  $Register.prototype.list = function () {
990
- // <- TODO: ReadonlyDeep<Array<TRegistered>>
989
+ // <- TODO: ReadonlyDeep<ReadonlyArray<TRegistered>>
991
990
  return this.storage;
992
991
  };
993
992
  $Register.prototype.register = function (registered) {
@@ -1150,7 +1149,7 @@ function $registeredLlmToolsMessage() {
1150
1149
  */
1151
1150
  function createLlmToolsFromConfiguration(configuration, options) {
1152
1151
  if (options === void 0) { options = {}; }
1153
- var _a = options.isVerbose, isVerbose = _a === void 0 ? IS_VERBOSE : _a;
1152
+ var _a = options.isVerbose, isVerbose = _a === void 0 ? DEFAULT_IS_VERBOSE : _a, userId = options.userId;
1154
1153
  var llmTools = configuration.map(function (llmConfiguration) {
1155
1154
  var registeredItem = $llmToolsRegister
1156
1155
  .list()
@@ -1161,7 +1160,7 @@ function createLlmToolsFromConfiguration(configuration, options) {
1161
1160
  if (registeredItem === undefined) {
1162
1161
  throw new Error(spaceTrim$1(function (block) { return "\n There is no constructor for LLM provider `".concat(llmConfiguration.className, "` from `").concat(llmConfiguration.packageName, "`\n\n You have probably forgotten install and import the provider package.\n To fix this issue, you can:\n\n Install:\n\n > npm install ").concat(llmConfiguration.packageName, "\n\n And import:\n\n > import '").concat(llmConfiguration.packageName, "';\n\n\n ").concat(block($registeredLlmToolsMessage()), "\n "); }));
1163
1162
  }
1164
- return registeredItem(__assign({ isVerbose: isVerbose }, llmConfiguration.options));
1163
+ return registeredItem(__assign({ isVerbose: isVerbose, userId: userId }, llmConfiguration.options));
1165
1164
  });
1166
1165
  return joinLlmExecutionTools.apply(void 0, __spreadArray([], __read(llmTools), false));
1167
1166
  }
@@ -1186,9 +1185,7 @@ function createLlmToolsFromConfiguration(configuration, options) {
1186
1185
  */
1187
1186
  function startRemoteServer(options) {
1188
1187
  var _this = this;
1189
- var _a = __assign({ isAnonymousModeAllowed: false, isCollectionModeAllowed: false, collection: null, createLlmExecutionTools: null }, options), port = _a.port, path = _a.path, collection = _a.collection, createLlmExecutionTools = _a.createLlmExecutionTools,
1190
- // <- TODO: [🧠][🤺] Remove `createLlmExecutionTools`, pass just `llmExecutionTools`
1191
- isAnonymousModeAllowed = _a.isAnonymousModeAllowed, isCollectionModeAllowed = _a.isCollectionModeAllowed, _b = _a.isVerbose, isVerbose = _b === void 0 ? IS_VERBOSE : _b;
1188
+ var _a = __assign({ isAnonymousModeAllowed: false, isApplicationModeAllowed: false, collection: null, createLlmExecutionTools: null }, options), port = _a.port, path = _a.path, collection = _a.collection, createLlmExecutionTools = _a.createLlmExecutionTools, isAnonymousModeAllowed = _a.isAnonymousModeAllowed, isApplicationModeAllowed = _a.isApplicationModeAllowed, _b = _a.isVerbose, isVerbose = _b === void 0 ? DEFAULT_IS_VERBOSE : _b;
1192
1189
  // <- TODO: [🦪] Some helper type to be able to use discriminant union types with destructuring
1193
1190
  var httpServer = http.createServer({}, function (request, response) { return __awaiter(_this, void 0, void 0, function () {
1194
1191
  var _a, _b;
@@ -1206,9 +1203,9 @@ function startRemoteServer(options) {
1206
1203
  return __generator(this, function (_f) {
1207
1204
  switch (_f.label) {
1208
1205
  case 0:
1209
- _b = (_a = "\n Server for processing promptbook remote requests is running.\n\n Version: ".concat(PROMPTBOOK_VERSION, "\n Socket.io path: ").concat(path, "/socket.io\n Anonymouse mode: ").concat(isAnonymousModeAllowed ? 'enabled' : 'disabled', "\n Collection mode: ").concat(isCollectionModeAllowed ? 'enabled' : 'disabled', "\n ")).concat;
1206
+ _b = (_a = "\n Server for processing promptbook remote requests is running.\n\n Version: ".concat(PROMPTBOOK_VERSION, "\n Socket.io path: ").concat(path, "/socket.io\n Anonymouse mode: ").concat(isAnonymousModeAllowed ? 'enabled' : 'disabled', "\n Application mode: ").concat(isApplicationModeAllowed ? 'enabled' : 'disabled', "\n ")).concat;
1210
1207
  _c = block;
1211
- if (!!isCollectionModeAllowed) return [3 /*break*/, 1];
1208
+ if (!!isApplicationModeAllowed) return [3 /*break*/, 1];
1212
1209
  _d = '';
1213
1210
  return [3 /*break*/, 3];
1214
1211
  case 1:
@@ -1244,145 +1241,155 @@ function startRemoteServer(options) {
1244
1241
  console.info(colors.gray("Client connected"), socket.id);
1245
1242
  }
1246
1243
  socket.on('prompt-request', function (request) { return __awaiter(_this, void 0, void 0, function () {
1247
- var _a, isAnonymous, prompt, userId, llmToolsConfiguration, llmExecutionTools, promptResult, _b, error_1;
1244
+ var _a, isAnonymous, prompt, appId, userId, customOptions, llmToolsConfiguration, llmExecutionTools, promptResult, _b, error_1;
1248
1245
  return __generator(this, function (_c) {
1249
1246
  switch (_c.label) {
1250
1247
  case 0:
1251
- _a = __assign({ userId: null, llmToolsConfiguration: null }, request), isAnonymous = _a.isAnonymous, prompt = _a.prompt, userId = _a.userId, llmToolsConfiguration = _a.llmToolsConfiguration;
1248
+ _a = __assign({ appId: null, customOptions: undefined, llmToolsConfiguration: null }, request), isAnonymous = _a.isAnonymous, prompt = _a.prompt, appId = _a.appId, userId = _a.userId, customOptions = _a.customOptions, llmToolsConfiguration = _a.llmToolsConfiguration;
1252
1249
  // <- TODO: [🦪] Some helper type to be able to use discriminant union types with destructuring
1253
1250
  if (isVerbose) {
1254
1251
  console.info(colors.bgWhite("Prompt:"), colors.gray(JSON.stringify(request, null, 4)));
1255
1252
  }
1256
1253
  _c.label = 1;
1257
1254
  case 1:
1258
- _c.trys.push([1, 14, 15, 16]);
1255
+ _c.trys.push([1, 15, 16, 17]);
1259
1256
  if (isAnonymous === true && !isAnonymousModeAllowed) {
1260
1257
  throw new PipelineExecutionError("Anonymous mode is not allowed"); // <- TODO: [main] !!! Test
1261
1258
  }
1262
- if (isAnonymous === false && !isCollectionModeAllowed) {
1263
- throw new PipelineExecutionError("Collection mode is not allowed"); // <- TODO: [main] !!! Test
1259
+ if (isAnonymous === false && !isApplicationModeAllowed) {
1260
+ throw new PipelineExecutionError("Application mode is not allowed"); // <- TODO: [main] !!! Test
1264
1261
  }
1265
1262
  llmExecutionTools = void 0;
1266
1263
  if (!(isAnonymous === true && llmToolsConfiguration !== null)) return [3 /*break*/, 2];
1267
1264
  // Note: Anonymouse mode
1268
1265
  // TODO: Maybe check that configuration is not empty
1269
1266
  llmExecutionTools = createLlmToolsFromConfiguration(llmToolsConfiguration, { isVerbose: isVerbose });
1270
- return [3 /*break*/, 5];
1267
+ return [3 /*break*/, 6];
1271
1268
  case 2:
1272
- if (!(isAnonymous === false && createLlmExecutionTools !== null)) return [3 /*break*/, 4];
1273
- // Note: Collection mode
1274
- llmExecutionTools = createLlmExecutionTools(userId);
1275
- return [4 /*yield*/, collection.isResponsibleForPrompt(prompt)];
1269
+ if (!(isAnonymous === false && createLlmExecutionTools !== null)) return [3 /*break*/, 5];
1270
+ return [4 /*yield*/, createLlmExecutionTools({
1271
+ appId: appId,
1272
+ userId: userId,
1273
+ customOptions: customOptions,
1274
+ })];
1276
1275
  case 3:
1276
+ // Note: Application mode
1277
+ llmExecutionTools = _c.sent();
1278
+ return [4 /*yield*/, collection.isResponsibleForPrompt(prompt)];
1279
+ case 4:
1277
1280
  if (!(_c.sent())) {
1278
1281
  throw new PipelineExecutionError("Pipeline is not in the collection of this server");
1279
1282
  }
1280
- return [3 /*break*/, 5];
1281
- case 4: throw new PipelineExecutionError("You must provide either llmToolsConfiguration or non-anonymous mode must be propperly configured");
1282
- case 5:
1283
+ return [3 /*break*/, 6];
1284
+ case 5: throw new PipelineExecutionError("You must provide either llmToolsConfiguration or non-anonymous mode must be propperly configured");
1285
+ case 6:
1283
1286
  promptResult = void 0;
1284
1287
  _b = prompt.modelRequirements.modelVariant;
1285
1288
  switch (_b) {
1286
- case 'CHAT': return [3 /*break*/, 6];
1287
- case 'COMPLETION': return [3 /*break*/, 8];
1288
- case 'EMBEDDING': return [3 /*break*/, 10];
1289
+ case 'CHAT': return [3 /*break*/, 7];
1290
+ case 'COMPLETION': return [3 /*break*/, 9];
1291
+ case 'EMBEDDING': return [3 /*break*/, 11];
1289
1292
  }
1290
- return [3 /*break*/, 12];
1291
- case 6:
1293
+ return [3 /*break*/, 13];
1294
+ case 7:
1292
1295
  if (llmExecutionTools.callChatModel === undefined) {
1293
1296
  // Note: [0] This check should not be a thing
1294
1297
  throw new PipelineExecutionError("Chat model is not available");
1295
1298
  }
1296
1299
  return [4 /*yield*/, llmExecutionTools.callChatModel(prompt)];
1297
- case 7:
1298
- promptResult = _c.sent();
1299
- return [3 /*break*/, 13];
1300
1300
  case 8:
1301
+ promptResult = _c.sent();
1302
+ return [3 /*break*/, 14];
1303
+ case 9:
1301
1304
  if (llmExecutionTools.callCompletionModel === undefined) {
1302
1305
  // Note: [0] This check should not be a thing
1303
1306
  throw new PipelineExecutionError("Completion model is not available");
1304
1307
  }
1305
1308
  return [4 /*yield*/, llmExecutionTools.callCompletionModel(prompt)];
1306
- case 9:
1307
- promptResult = _c.sent();
1308
- return [3 /*break*/, 13];
1309
1309
  case 10:
1310
+ promptResult = _c.sent();
1311
+ return [3 /*break*/, 14];
1312
+ case 11:
1310
1313
  if (llmExecutionTools.callEmbeddingModel === undefined) {
1311
1314
  // Note: [0] This check should not be a thing
1312
1315
  throw new PipelineExecutionError("Embedding model is not available");
1313
1316
  }
1314
1317
  return [4 /*yield*/, llmExecutionTools.callEmbeddingModel(prompt)];
1315
- case 11:
1318
+ case 12:
1316
1319
  promptResult = _c.sent();
1317
- return [3 /*break*/, 13];
1318
- case 12: throw new PipelineExecutionError("Unknown model variant \"".concat(prompt.modelRequirements.modelVariant, "\""));
1319
- case 13:
1320
+ return [3 /*break*/, 14];
1321
+ case 13: throw new PipelineExecutionError("Unknown model variant \"".concat(prompt.modelRequirements.modelVariant, "\""));
1322
+ case 14:
1320
1323
  if (isVerbose) {
1321
1324
  console.info(colors.bgGreen("PromptResult:"), colors.green(JSON.stringify(promptResult, null, 4)));
1322
1325
  }
1323
1326
  socket.emit('prompt-response', { promptResult: promptResult } /* <- TODO: [🤛] */);
1324
- return [3 /*break*/, 16];
1325
- case 14:
1327
+ return [3 /*break*/, 17];
1328
+ case 15:
1326
1329
  error_1 = _c.sent();
1327
1330
  if (!(error_1 instanceof Error)) {
1328
1331
  throw error_1;
1329
1332
  }
1330
1333
  socket.emit('error', serializeError(error_1) /* <- TODO: [🤛] */);
1331
- return [3 /*break*/, 16];
1332
- case 15:
1334
+ return [3 /*break*/, 17];
1335
+ case 16:
1333
1336
  socket.disconnect();
1334
1337
  return [7 /*endfinally*/];
1335
- case 16: return [2 /*return*/];
1338
+ case 17: return [2 /*return*/];
1336
1339
  }
1337
1340
  });
1338
1341
  }); });
1339
1342
  // TODO: [👒] Listing models (and checking configuration) probbably should go through REST API not Socket.io
1340
1343
  socket.on('listModels-request', function (request) { return __awaiter(_this, void 0, void 0, function () {
1341
- var _a, isAnonymous, llmToolsConfiguration, llmExecutionTools, models, error_2;
1344
+ var _a, isAnonymous, appId, userId, customOptions, llmToolsConfiguration, llmExecutionTools, models, error_2;
1342
1345
  return __generator(this, function (_b) {
1343
1346
  switch (_b.label) {
1344
1347
  case 0:
1345
- _a = __assign({ llmToolsConfiguration: null }, request), isAnonymous = _a.isAnonymous, llmToolsConfiguration = _a.llmToolsConfiguration;
1348
+ _a = __assign({ appId: null, customOptions: undefined, llmToolsConfiguration: null }, request), isAnonymous = _a.isAnonymous, appId = _a.appId, userId = _a.userId, customOptions = _a.customOptions, llmToolsConfiguration = _a.llmToolsConfiguration;
1346
1349
  // <- TODO: [🦪] Some helper type to be able to use discriminant union types with destructuring
1347
1350
  if (isVerbose) {
1348
1351
  console.info(colors.bgWhite("Listing models"));
1349
1352
  }
1350
1353
  _b.label = 1;
1351
1354
  case 1:
1352
- _b.trys.push([1, 3, 4, 5]);
1355
+ _b.trys.push([1, 6, 7, 8]);
1353
1356
  if (isAnonymous === true && !isAnonymousModeAllowed) {
1354
1357
  throw new PipelineExecutionError("Anonymous mode is not allowed"); // <- TODO: [main] !!! Test
1355
1358
  }
1356
- if (isAnonymous === false && !isCollectionModeAllowed) {
1357
- throw new PipelineExecutionError("Collection mode is not allowed"); // <- TODO: [main] !!! Test
1359
+ if (isAnonymous === false && !isApplicationModeAllowed) {
1360
+ throw new PipelineExecutionError("Application mode is not allowed"); // <- TODO: [main] !!! Test
1358
1361
  }
1359
1362
  llmExecutionTools = void 0;
1360
- if (isAnonymous === true) {
1361
- // Note: Anonymouse mode
1362
- // TODO: Maybe check that configuration is not empty
1363
- llmExecutionTools = createLlmToolsFromConfiguration(llmToolsConfiguration, { isVerbose: isVerbose });
1364
- }
1365
- else {
1366
- // Note: Collection mode
1367
- llmExecutionTools = createLlmExecutionTools(
1368
- /* userId: */ undefined);
1369
- }
1370
- return [4 /*yield*/, llmExecutionTools.listModels()];
1371
- case 2:
1363
+ if (!(isAnonymous === true)) return [3 /*break*/, 2];
1364
+ // Note: Anonymouse mode
1365
+ // TODO: Maybe check that configuration is not empty
1366
+ llmExecutionTools = createLlmToolsFromConfiguration(llmToolsConfiguration, { isVerbose: isVerbose });
1367
+ return [3 /*break*/, 4];
1368
+ case 2: return [4 /*yield*/, createLlmExecutionTools({
1369
+ appId: appId,
1370
+ userId: userId,
1371
+ customOptions: customOptions,
1372
+ })];
1373
+ case 3:
1374
+ // Note: Application mode
1375
+ llmExecutionTools = _b.sent();
1376
+ _b.label = 4;
1377
+ case 4: return [4 /*yield*/, llmExecutionTools.listModels()];
1378
+ case 5:
1372
1379
  models = _b.sent();
1373
1380
  socket.emit('listModels-response', { models: models } /* <- TODO: [🤛] */);
1374
- return [3 /*break*/, 5];
1375
- case 3:
1381
+ return [3 /*break*/, 8];
1382
+ case 6:
1376
1383
  error_2 = _b.sent();
1377
1384
  if (!(error_2 instanceof Error)) {
1378
1385
  throw error_2;
1379
1386
  }
1380
1387
  socket.emit('error', serializeError(error_2));
1381
- return [3 /*break*/, 5];
1382
- case 4:
1388
+ return [3 /*break*/, 8];
1389
+ case 7:
1383
1390
  socket.disconnect();
1384
1391
  return [7 /*endfinally*/];
1385
- case 5: return [2 /*return*/];
1392
+ case 8: return [2 /*return*/];
1386
1393
  }
1387
1394
  });
1388
1395
  }); });