@promptbook/editable 0.103.0-4 → 0.103.0-40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +57 -21
- package/esm/index.es.js +61 -4
- package/esm/index.es.js.map +1 -1
- package/esm/typings/books/index.d.ts +0 -81
- package/esm/typings/src/_packages/browser.index.d.ts +6 -0
- package/esm/typings/src/_packages/cli.index.d.ts +4 -0
- package/esm/typings/src/_packages/components.index.d.ts +12 -8
- package/esm/typings/src/_packages/core.index.d.ts +30 -10
- package/esm/typings/src/_packages/node.index.d.ts +4 -2
- package/esm/typings/src/_packages/types.index.d.ts +18 -2
- package/esm/typings/src/_packages/wizard.index.d.ts +4 -0
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +1 -0
- package/esm/typings/src/book-2.0/agent-source/padBook.d.ts +16 -0
- package/esm/typings/src/book-components/BookEditor/BookEditor.d.ts +76 -15
- package/esm/typings/src/book-components/BookEditor/BookEditorActionbar.d.ts +14 -0
- package/esm/typings/src/book-components/BookEditor/BookEditorMonaco.d.ts +5 -0
- package/esm/typings/src/book-components/Chat/MarkdownContent/MarkdownContent.d.ts +15 -0
- package/esm/typings/src/book-components/Chat/MockedChat/MockedChat.d.ts +5 -0
- package/esm/typings/src/book-components/Chat/save/html/htmlSaveFormatDefinition.d.ts +1 -0
- package/esm/typings/src/book-components/Chat/save/pdf/pdfSaveFormatDefinition.d.ts +4 -0
- package/esm/typings/src/book-components/Qr/BrandedQrCode.d.ts +18 -0
- package/esm/typings/src/book-components/Qr/GenericQrCode.d.ts +10 -0
- package/esm/typings/src/book-components/Qr/PromptbookQrCode.d.ts +18 -0
- package/esm/typings/src/book-components/Qr/useQrCode.d.ts +15 -0
- package/esm/typings/src/book-components/_common/Dropdown/Dropdown.d.ts +15 -0
- package/esm/typings/src/book-components/_common/Modal/Modal.d.ts +2 -2
- package/esm/typings/src/book-components/_common/Tooltip/Tooltip.d.ts +47 -0
- package/esm/typings/src/book-components/_common/react-utils/classNames.d.ts +1 -1
- package/esm/typings/src/book-components/icons/AboutIcon.d.ts +9 -0
- package/esm/typings/src/book-components/icons/CloseIcon.d.ts +4 -8
- package/esm/typings/src/book-components/icons/DownloadIcon.d.ts +9 -0
- package/esm/typings/src/book-components/icons/ExitFullscreenIcon.d.ts +7 -0
- package/esm/typings/src/book-components/icons/FullscreenIcon.d.ts +7 -0
- package/esm/typings/src/book-components/icons/MenuIcon.d.ts +12 -0
- package/esm/typings/src/cli/cli-commands/_boilerplate.d.ts +2 -1
- package/esm/typings/src/cli/cli-commands/about.d.ts +3 -1
- package/esm/typings/src/cli/cli-commands/hello.d.ts +2 -1
- package/esm/typings/src/cli/cli-commands/list-models.d.ts +2 -1
- package/esm/typings/src/cli/cli-commands/list-scrapers.d.ts +2 -1
- package/esm/typings/src/cli/cli-commands/login.d.ts +2 -1
- package/esm/typings/src/cli/cli-commands/make.d.ts +2 -1
- package/esm/typings/src/cli/cli-commands/prettify.d.ts +2 -1
- package/esm/typings/src/cli/cli-commands/run.d.ts +2 -1
- package/esm/typings/src/cli/cli-commands/{start-server.d.ts → start-agents-server.d.ts} +3 -2
- package/esm/typings/src/cli/cli-commands/start-pipelines-server.d.ts +15 -0
- package/esm/typings/src/cli/cli-commands/test-command.d.ts +2 -1
- package/esm/typings/src/cli/common/$addGlobalOptionsToCommand.d.ts +2 -1
- package/esm/typings/src/collection/agent-collection/AgentCollection.d.ts +36 -0
- package/esm/typings/src/collection/agent-collection/constructors/AgentCollectionInDirectory.d.ts +88 -0
- package/esm/typings/src/collection/{PipelineCollection.d.ts → pipeline-collection/PipelineCollection.d.ts} +7 -3
- package/esm/typings/src/collection/{SimplePipelineCollection.d.ts → pipeline-collection/SimplePipelineCollection.d.ts} +5 -5
- package/esm/typings/src/collection/{constructors/createCollectionFromDirectory.d.ts → pipeline-collection/constructors/createPipelineCollectionFromDirectory.d.ts} +8 -11
- package/esm/typings/src/collection/pipeline-collection/constructors/createPipelineCollectionFromJson.d.ts +13 -0
- package/esm/typings/src/collection/{constructors/createCollectionFromPromise.d.ts → pipeline-collection/constructors/createPipelineCollectionFromPromise.d.ts} +6 -5
- package/esm/typings/src/collection/{constructors/createCollectionFromUrl.d.ts → pipeline-collection/constructors/createPipelineCollectionFromUrl.d.ts} +3 -3
- package/esm/typings/src/collection/{constructors/createSubcollection.d.ts → pipeline-collection/constructors/createPipelineSubcollection.d.ts} +3 -3
- package/esm/typings/src/collection/pipeline-collection/pipelineCollectionToJson.d.ts +13 -0
- package/esm/typings/src/commands/_common/types/CommandParser.d.ts +4 -5
- package/esm/typings/src/config.d.ts +22 -2
- package/esm/typings/src/errors/0-index.d.ts +3 -0
- package/esm/typings/src/errors/NotAllowed.d.ts +9 -0
- package/esm/typings/src/execution/AvailableModel.d.ts +1 -0
- package/esm/typings/src/execution/Executables.d.ts +3 -0
- package/esm/typings/src/execution/ExecutionTask.d.ts +12 -3
- package/esm/typings/src/execution/ExecutionTools.d.ts +5 -0
- package/esm/typings/src/execution/FilesystemTools.d.ts +1 -1
- package/esm/typings/src/execution/LlmExecutionTools.d.ts +7 -1
- package/esm/typings/src/execution/createPipelineExecutor/10-executePipeline.d.ts +5 -0
- package/esm/typings/src/execution/createPipelineExecutor/20-executeTask.d.ts +5 -0
- package/esm/typings/src/execution/createPipelineExecutor/30-executeFormatSubvalues.d.ts +5 -0
- package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +5 -0
- package/esm/typings/src/execution/utils/logLlmCall.d.ts +8 -0
- package/esm/typings/src/execution/utils/usage-constants.d.ts +4 -124
- package/esm/typings/src/high-level-abstractions/_common/HighLevelAbstraction.d.ts +2 -1
- package/esm/typings/src/llm-providers/_common/register/$registeredLlmToolsMessage.d.ts +2 -1
- package/esm/typings/src/llm-providers/agent/Agent.d.ts +49 -0
- package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +9 -4
- package/esm/typings/src/llm-providers/agent/AgentOptions.d.ts +17 -0
- package/esm/typings/src/llm-providers/agent/CreateAgentLlmExecutionToolsOptions.d.ts +16 -0
- package/esm/typings/src/llm-providers/agent/createAgentLlmExecutionTools.d.ts +1 -19
- package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +28 -0
- package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionToolsOptions.d.ts +7 -1
- package/esm/typings/src/other/templates/getTemplatesPipelineCollection.d.ts +1 -1
- package/esm/typings/src/playground/permanent/_boilerplate.d.ts +5 -0
- package/esm/typings/src/playground/permanent/agent-with-browser-playground.d.ts +5 -0
- package/esm/typings/src/playground/playground.d.ts +0 -3
- package/esm/typings/src/playground/playground1.d.ts +2 -0
- package/esm/typings/src/remote-server/startRemoteServer.d.ts +4 -1
- package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +22 -8
- package/esm/typings/src/scrapers/_boilerplate/createBoilerplateScraper.d.ts +1 -12
- package/esm/typings/src/scrapers/_boilerplate/register-metadata.d.ts +1 -9
- package/esm/typings/src/scrapers/document/createDocumentScraper.d.ts +1 -12
- package/esm/typings/src/scrapers/document/register-metadata.d.ts +1 -9
- package/esm/typings/src/scrapers/document-legacy/createLegacyDocumentScraper.d.ts +1 -12
- package/esm/typings/src/scrapers/document-legacy/register-metadata.d.ts +1 -9
- package/esm/typings/src/scrapers/markdown/createMarkdownScraper.d.ts +1 -12
- package/esm/typings/src/scrapers/markdown/register-metadata.d.ts +1 -9
- package/esm/typings/src/scrapers/markitdown/createMarkitdownScraper.d.ts +1 -12
- package/esm/typings/src/scrapers/markitdown/register-metadata.d.ts +1 -9
- package/esm/typings/src/scrapers/pdf/createPdfScraper.d.ts +1 -12
- package/esm/typings/src/scrapers/pdf/register-metadata.d.ts +1 -9
- package/esm/typings/src/scrapers/website/createWebsiteScraper.d.ts +1 -12
- package/esm/typings/src/scrapers/website/register-metadata.d.ts +1 -9
- package/esm/typings/src/storage/env-storage/$EnvStorage.d.ts +2 -1
- package/esm/typings/src/transpilers/_common/BookTranspiler.d.ts +29 -0
- package/esm/typings/src/transpilers/_common/BookTranspilerOptions.d.ts +18 -0
- package/esm/typings/src/transpilers/_common/register/$bookTranspilersRegister.d.ts +15 -0
- package/esm/typings/src/transpilers/formatted-book-in-markdown/FormattedBookInMarkdownTranspiler.d.ts +13 -0
- package/esm/typings/src/transpilers/formatted-book-in-markdown/register.d.ts +15 -0
- package/esm/typings/src/transpilers/openai-sdk/OpenAiSdkTranspiler.d.ts +13 -0
- package/esm/typings/src/transpilers/openai-sdk/OpenAiSdkTranspiler.test.d.ts +1 -0
- package/esm/typings/src/transpilers/openai-sdk/playground/playground.d.ts +5 -0
- package/esm/typings/src/transpilers/openai-sdk/register.d.ts +15 -0
- package/esm/typings/src/types/LlmCall.d.ts +20 -0
- package/esm/typings/src/types/Updatable.d.ts +19 -0
- package/esm/typings/src/types/typeAliases.d.ts +1 -1
- package/esm/typings/src/utils/execCommand/$execCommand.d.ts +2 -1
- package/esm/typings/src/utils/execCommand/$execCommands.d.ts +2 -1
- package/esm/typings/src/utils/files/$induceBookDownload.d.ts +13 -0
- package/esm/typings/src/utils/files/$induceFileDownload.d.ts +13 -0
- package/esm/typings/src/utils/files/ObjectUrl.d.ts +46 -0
- package/esm/typings/src/utils/files/listAllFiles.d.ts +2 -3
- package/esm/typings/src/utils/misc/aboutPromptbookInformation.d.ts +21 -0
- package/esm/typings/src/utils/misc/injectCssModuleIntoShadowRoot.d.ts +1 -0
- package/esm/typings/src/utils/misc/xAboutPromptbookInformation.d.ts +13 -0
- package/esm/typings/src/utils/organization/$side_effect.d.ts +7 -0
- package/esm/typings/src/utils/serialization/$deepFreeze.d.ts +2 -1
- package/esm/typings/src/version.d.ts +1 -1
- package/esm/typings/src/wizard/$getCompiledBook.d.ts +1 -2
- package/package.json +3 -3
- package/umd/index.umd.js +61 -4
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/book-components/BookEditor/BookEditorInner.d.ts +0 -5
- package/esm/typings/src/book-components/BookEditor/BookEditorWrapper.d.ts +0 -9
- package/esm/typings/src/book-components/BookEditor/config.d.ts +0 -10
- package/esm/typings/src/book-components/Chat/utils/renderMarkdown.d.ts +0 -21
- package/esm/typings/src/collection/collectionToJson.d.ts +0 -13
- package/esm/typings/src/collection/constructors/createCollectionFromJson.d.ts +0 -13
- /package/esm/typings/src/{book-components/Chat/utils/renderMarkdown.test.d.ts → collection/agent-collection/constructors/AgentCollectionInDirectory.test.d.ts} +0 -0
- /package/esm/typings/src/collection/{constructors/createCollectionFromDirectory.test.d.ts → pipeline-collection/constructors/createPipelineCollectionFromDirectory.test.d.ts} +0 -0
- /package/esm/typings/src/collection/{constructors/createCollectionFromJson.test.d.ts → pipeline-collection/constructors/createPipelineCollectionFromJson.test.d.ts} +0 -0
- /package/esm/typings/src/collection/{constructors/createCollectionFromPromise.test.d.ts → pipeline-collection/constructors/createPipelineCollectionFromPromise.test.d.ts} +0 -0
- /package/esm/typings/src/collection/{collectionToJson.test.d.ts → pipeline-collection/pipelineCollectionToJson.test.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -70,11 +70,15 @@ The main challenge is to narrow it down, constrain it, set the proper **context,
|
|
|
70
70
|
|
|
71
71
|
Promptbook takes the best from both worlds. You are defining your AI behavior by simple **books**, which are very explicit. They are automatically enforced, but they are very easy to understand, very easy to write, and very reliable and portable.
|
|
72
72
|
|
|
73
|
+
<table style="border: 1px solid #777; border-radius: 10px;"><tr><td>
|
|
73
74
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
/>
|
|
75
|
+
**<ins>Paul Smith & Associés</ins>**<br/>
|
|
76
|
+
<br/>
|
|
77
|
+
**PERSONA** You are a company lawyer.<br/>
|
|
78
|
+
Your job is to provide legal advice and support to the company and its employees.<br/>
|
|
79
|
+
You are knowledgeable, professional, and detail-oriented.<br/>
|
|
80
|
+
|
|
81
|
+
</td></tr></table>
|
|
78
82
|
|
|
79
83
|
<div style="page-break-after: always;"></div>
|
|
80
84
|
|
|
@@ -88,11 +92,15 @@ You can look at it as prompting (or writing a system message), but decorated by
|
|
|
88
92
|
|
|
89
93
|
Personas define the character of your AI persona, its role, and how it should interact with users. It sets the tone and style of communication.
|
|
90
94
|
|
|
95
|
+
<table style="border: 1px solid #777; border-radius: 10px;"><tr><td>
|
|
96
|
+
|
|
97
|
+
**<ins>Paul Smith & Associés</ins>**<br/>
|
|
98
|
+
<br/>
|
|
99
|
+
**PERSONA** You are a company lawyer.<br/>
|
|
100
|
+
Your job is to provide legal advice and support to the company and its employees.<br/>
|
|
101
|
+
You are knowledgeable, professional, and detail-oriented.<br/>
|
|
91
102
|
|
|
92
|
-
|
|
93
|
-
alt="Paul Smith & Associés Book"
|
|
94
|
-
src="https://promptbook.studio/embed/book-preview.png?book=Paul%20Smith%20%26%20Associ%C3%A9s%0A%20%20%20%20%20%20%7C%20PERSONA%20You%20are%20a%20company%20lawyer.%0A%20%20%20%20%20%20%7C%20Your%20job%20is%20to%20provide%20legal%20advice%20and%20support%20to%20the%20company%20and%20its%20employees.%0A%20%20%20%20%20%20%7C%20You%20are%20knowledgeable%2C%20professional%2C%20and%20detail-oriented.&width=800&height=450&nonce=0"
|
|
95
|
-
/>
|
|
103
|
+
</td></tr></table>
|
|
96
104
|
|
|
97
105
|
#### `Knowledge` commitment
|
|
98
106
|
|
|
@@ -102,11 +110,18 @@ This can include domain-specific knowledge, company policies, or any other relev
|
|
|
102
110
|
|
|
103
111
|
Promptbook Engine will automatically enforce this knowledge during interactions. When the knowledge is short enough, it will be included in the prompt. When it is too long, it will be stored in vector databases and RAG retrieved when needed. But you don't need to care about it.
|
|
104
112
|
|
|
113
|
+
<table style="border: 1px solid #777; border-radius: 10px;"><tr><td>
|
|
114
|
+
|
|
115
|
+
**<ins>Paul Smith & Associés</ins>**<br/>
|
|
116
|
+
<br/>
|
|
117
|
+
**PERSONA** You are a company lawyer.<br/>
|
|
118
|
+
Your job is to provide legal advice and support to the company and its employees.<br/>
|
|
119
|
+
You are knowledgeable, professional, and detail-oriented.<br/>
|
|
120
|
+
<br/>
|
|
121
|
+
**KNOWLEDGE** https://company.com/company-policies.pdf<br/>
|
|
122
|
+
**KNOWLEDGE** https://company.com/internal-documents/employee-handbook.docx<br/>
|
|
105
123
|
|
|
106
|
-
|
|
107
|
-
alt="Paul Smith & Associés Book"
|
|
108
|
-
src="https://promptbook.studio/embed/book-preview.png?book=Paul%20Smith%20%26%20Associ%C3%A9s%0A%20%20%20%20%20%20%7C%20PERSONA%20You%20are%20a%20company%20lawyer.%0A%20%20%20%20%20%20%7C%20Your%20job%20is%20to%20provide%20legal%20advice%20and%20support%20to%20the%20company%20and%20its%20employees.%0A%20%20%20%20%20%20%7C%20You%20are%20knowledgeable%2C%20professional%2C%20and%20detail-oriented.%0A%20%20%20%20%20%20%7C%20KNOWLEDGE%20%20https%3A%2F%2Fcompany.com%2Fcompany-policies.pdf%0A%20%20%20%20%20%20%7C%20KNOWLEDGE%20https%3A%2F%2Fcompany.com%2Finternal-documents%2Femployee-handbook.docx&width=800&height=450&nonce=0"
|
|
109
|
-
/>
|
|
124
|
+
</td></tr></table>
|
|
110
125
|
|
|
111
126
|
#### `Rule` commitment
|
|
112
127
|
|
|
@@ -114,21 +129,42 @@ Rules will enforce specific behaviors or constraints on the AI's responses. This
|
|
|
114
129
|
|
|
115
130
|
Depending on rule strictness, Promptbook will either propagate it to the prompt or use other techniques, like adversary agent, to enforce it.
|
|
116
131
|
|
|
132
|
+
<table style="border: 1px solid #777; border-radius: 10px;"><tr><td>
|
|
117
133
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
/>
|
|
134
|
+
**<ins>Paul Smith & Associés</ins>**<br/>
|
|
135
|
+
<br/>
|
|
136
|
+
**PERSONA** You are a company lawyer.<br/>
|
|
137
|
+
Your job is to provide legal advice and support to the company and its employees.<br/>
|
|
138
|
+
You are knowledgeable, professional, and detail-oriented.<br/>
|
|
139
|
+
<br/>
|
|
140
|
+
**RULE** Always ensure compliance with laws and regulations.<br/>
|
|
141
|
+
**RULE** Never provide legal advice outside your area of expertise.<br/>
|
|
142
|
+
**RULE** Never provide legal advice about criminal law.<br/>
|
|
143
|
+
**KNOWLEDGE** https://company.com/company-policies.pdf<br/>
|
|
144
|
+
**KNOWLEDGE** https://company.com/internal-documents/employee-handbook.docx<br/>
|
|
145
|
+
|
|
146
|
+
</td></tr></table>
|
|
122
147
|
|
|
123
148
|
#### `Action` commitment
|
|
124
149
|
|
|
125
150
|
Action Commitment allows you to define specific actions that the AI can take during interactions. This can include things like posting on a social media platform, sending emails, creating calendar events, or interacting with your internal systems.
|
|
126
151
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
/>
|
|
152
|
+
<table style="border: 1px solid #777; border-radius: 10px;"><tr><td>
|
|
153
|
+
|
|
154
|
+
**<ins>Paul Smith & Associés</ins>**<br/>
|
|
155
|
+
<br/>
|
|
156
|
+
**PERSONA** You are a company lawyer.<br/>
|
|
157
|
+
Your job is to provide legal advice and support to the company and its employees.<br/>
|
|
158
|
+
You are knowledgeable, professional, and detail-oriented.<br/>
|
|
159
|
+
<br/>
|
|
160
|
+
**RULE** Always ensure compliance with laws and regulations.<br/>
|
|
161
|
+
**RULE** Never provide legal advice outside your area of expertise.<br/>
|
|
162
|
+
**RULE** Never provide legal advice about criminal law.<br/>
|
|
163
|
+
**KNOWLEDGE** https://company.com/company-policies.pdf<br/>
|
|
164
|
+
**KNOWLEDGE** https://company.com/internal-documents/employee-handbook.docx<br/>
|
|
165
|
+
**ACTION** When a user asks about an issue that could be treated as a crime, notify legal@company.com.<br/>
|
|
166
|
+
|
|
167
|
+
</td></tr></table>
|
|
132
168
|
|
|
133
169
|
[Read more about the language](./BLUEPRINT.md)
|
|
134
170
|
|
package/esm/index.es.js
CHANGED
|
@@ -17,7 +17,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
17
17
|
* @generated
|
|
18
18
|
* @see https://github.com/webgptorg/promptbook
|
|
19
19
|
*/
|
|
20
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-
|
|
20
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-40';
|
|
21
21
|
/**
|
|
22
22
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
23
23
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -961,15 +961,30 @@ const ADMIN_GITHUB_NAME = 'hejny';
|
|
|
961
961
|
* @public exported from `@promptbook/core`
|
|
962
962
|
*/
|
|
963
963
|
const PROMPTBOOK_COLOR = Color.fromHex('#79EAFD');
|
|
964
|
-
// <- TODO: [🧠] Using `Color` here increases the package size approx 3kb, maybe remove it
|
|
964
|
+
// <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
|
|
965
965
|
/**
|
|
966
|
-
*
|
|
966
|
+
* Colors for syntax highlighting in the `<BookEditor/>`
|
|
967
|
+
*
|
|
968
|
+
* TODO: [🗽] Unite branding and make single place for it
|
|
969
|
+
*
|
|
970
|
+
* @public exported from `@promptbook/core`
|
|
971
|
+
*/
|
|
972
|
+
({
|
|
973
|
+
TITLE: Color.fromHex('#244EA8'),
|
|
974
|
+
LINE: Color.fromHex('#eeeeee'),
|
|
975
|
+
COMMITMENT: Color.fromHex('#DA0F78'),
|
|
976
|
+
PARAMETER: Color.fromHex('#8e44ad'),
|
|
977
|
+
});
|
|
978
|
+
// <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
|
|
979
|
+
/**
|
|
980
|
+
* Chat color of the Promptbook (in chat)
|
|
967
981
|
*
|
|
968
982
|
* TODO: [🗽] Unite branding and make single place for it
|
|
969
983
|
*
|
|
970
984
|
* @public exported from `@promptbook/core`
|
|
971
985
|
*/
|
|
972
986
|
PROMPTBOOK_COLOR.then(lighten(0.1)).then(saturate(0.9)).then(grayscale(0.9));
|
|
987
|
+
// <- TODO: [🧠][🈵] Using `Color` and `lighten`, `saturate`,... here increases the package size approx 3kb, maybe remove it
|
|
973
988
|
/**
|
|
974
989
|
* Color of the user (in chat)
|
|
975
990
|
*
|
|
@@ -978,6 +993,7 @@ PROMPTBOOK_COLOR.then(lighten(0.1)).then(saturate(0.9)).then(grayscale(0.9));
|
|
|
978
993
|
* @public exported from `@promptbook/core`
|
|
979
994
|
*/
|
|
980
995
|
Color.fromHex('#1D4ED8');
|
|
996
|
+
// <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
|
|
981
997
|
/**
|
|
982
998
|
* When the title is not provided, the default title is used
|
|
983
999
|
*
|
|
@@ -4882,6 +4898,46 @@ function parseCommandVariant(input) {
|
|
|
4882
4898
|
return null;
|
|
4883
4899
|
}
|
|
4884
4900
|
|
|
4901
|
+
/**
|
|
4902
|
+
* Number of padding lines to add at the end of the book content
|
|
4903
|
+
*
|
|
4904
|
+
* @public exported from `@promptbook/core`
|
|
4905
|
+
*/
|
|
4906
|
+
const PADDING_LINES = 11;
|
|
4907
|
+
/**
|
|
4908
|
+
* A function that adds padding to the book content
|
|
4909
|
+
*
|
|
4910
|
+
* @public exported from `@promptbook/core`
|
|
4911
|
+
*/
|
|
4912
|
+
function padBook(content) {
|
|
4913
|
+
if (!content) {
|
|
4914
|
+
return '\n'.repeat(PADDING_LINES);
|
|
4915
|
+
}
|
|
4916
|
+
const lines = content.split('\n');
|
|
4917
|
+
let trailingEmptyLines = 0;
|
|
4918
|
+
for (let i = lines.length - 1; i >= 0; i--) {
|
|
4919
|
+
const line = lines[i];
|
|
4920
|
+
if (line === undefined) {
|
|
4921
|
+
// Note: This should not happen in reality, but it's here to satisfy TypeScript's noUncheckedIndexedAccess option
|
|
4922
|
+
continue;
|
|
4923
|
+
}
|
|
4924
|
+
if (line.trim() === '') {
|
|
4925
|
+
trailingEmptyLines++;
|
|
4926
|
+
}
|
|
4927
|
+
else {
|
|
4928
|
+
break;
|
|
4929
|
+
}
|
|
4930
|
+
}
|
|
4931
|
+
if (trailingEmptyLines >= PADDING_LINES) {
|
|
4932
|
+
return content;
|
|
4933
|
+
}
|
|
4934
|
+
const linesToAdd = PADDING_LINES - trailingEmptyLines;
|
|
4935
|
+
return (content + '\n'.repeat(linesToAdd));
|
|
4936
|
+
}
|
|
4937
|
+
/**
|
|
4938
|
+
* TODO: [🧠] Maybe export
|
|
4939
|
+
*/
|
|
4940
|
+
|
|
4885
4941
|
/**
|
|
4886
4942
|
* Checks if value is valid email
|
|
4887
4943
|
*
|
|
@@ -4971,6 +5027,7 @@ function deflatePipeline(pipelineString) {
|
|
|
4971
5027
|
if (!isFlatPipeline(pipelineString)) {
|
|
4972
5028
|
return pipelineString;
|
|
4973
5029
|
}
|
|
5030
|
+
pipelineString = spaceTrim(pipelineString);
|
|
4974
5031
|
const pipelineStringLines = pipelineString.split('\n');
|
|
4975
5032
|
const potentialReturnStatement = pipelineStringLines.pop();
|
|
4976
5033
|
let returnStatement;
|
|
@@ -5005,7 +5062,7 @@ function deflatePipeline(pipelineString) {
|
|
|
5005
5062
|
${returnStatement}
|
|
5006
5063
|
`));
|
|
5007
5064
|
// <- TODO: Maybe use book` notation
|
|
5008
|
-
return pipelineString;
|
|
5065
|
+
return padBook(pipelineString);
|
|
5009
5066
|
}
|
|
5010
5067
|
/**
|
|
5011
5068
|
* TODO: Unit test
|