@promptbook/remote-server 0.84.0-9 → 0.85.0-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 (59) hide show
  1. package/README.md +21 -5
  2. package/esm/index.es.js +4543 -4264
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/src/_packages/cli.index.d.ts +4 -0
  5. package/esm/typings/src/_packages/core.index.d.ts +12 -4
  6. package/esm/typings/src/_packages/deepseek.index.d.ts +8 -0
  7. package/esm/typings/src/_packages/types.index.d.ts +16 -2
  8. package/esm/typings/src/_packages/utils.index.d.ts +2 -2
  9. package/esm/typings/src/_packages/wizzard.index.d.ts +4 -0
  10. package/esm/typings/src/cli/cli-commands/_boilerplate.d.ts +13 -0
  11. package/esm/typings/src/cli/cli-commands/about.d.ts +4 -1
  12. package/esm/typings/src/cli/cli-commands/hello.d.ts +3 -1
  13. package/esm/typings/src/cli/cli-commands/list-models.d.ts +3 -1
  14. package/esm/typings/src/cli/cli-commands/list-scrapers.d.ts +13 -0
  15. package/esm/typings/src/cli/cli-commands/make.d.ts +3 -1
  16. package/esm/typings/src/cli/cli-commands/prettify.d.ts +3 -1
  17. package/esm/typings/src/cli/cli-commands/run.d.ts +3 -1
  18. package/esm/typings/src/cli/cli-commands/runInteractiveChatbot.d.ts +1 -1
  19. package/esm/typings/src/cli/cli-commands/start-server.d.ts +13 -0
  20. package/esm/typings/src/cli/cli-commands/test-command.d.ts +3 -1
  21. package/esm/typings/src/config.d.ts +27 -1
  22. package/esm/typings/src/conversion/compilePipelineOnRemoteServer.d.ts +1 -1
  23. package/esm/typings/src/execution/AbstractTaskResult.d.ts +25 -0
  24. package/esm/typings/src/execution/ExecutionTask.d.ts +71 -0
  25. package/esm/typings/src/execution/FilesystemTools.d.ts +1 -1
  26. package/esm/typings/src/execution/PipelineExecutor.d.ts +2 -5
  27. package/esm/typings/src/execution/PipelineExecutorResult.d.ts +2 -15
  28. package/esm/typings/src/execution/PromptbookFetch.d.ts +8 -1
  29. package/esm/typings/src/execution/{assertsExecutionSuccessful.d.ts → assertsTaskSuccessful.d.ts} +4 -3
  30. package/esm/typings/src/execution/createPipelineExecutor/00-createPipelineExecutor.d.ts +0 -3
  31. package/esm/typings/src/execution/createPipelineExecutor/10-executePipeline.d.ts +2 -6
  32. package/esm/typings/src/execution/createPipelineExecutor/20-executeTask.d.ts +3 -6
  33. package/esm/typings/src/llm-providers/_common/register/$registeredLlmToolsMessage.d.ts +9 -0
  34. package/esm/typings/src/llm-providers/deepseek/DeepseekExecutionToolsOptions.d.ts +9 -0
  35. package/esm/typings/src/llm-providers/deepseek/createDeepseekExecutionTools.d.ts +14 -0
  36. package/esm/typings/src/llm-providers/deepseek/register-configuration.d.ts +14 -0
  37. package/esm/typings/src/llm-providers/deepseek/register-constructor.d.ts +15 -0
  38. package/esm/typings/src/pipeline/book-notation.d.ts +3 -2
  39. package/esm/typings/src/pipeline/prompt-notation.d.ts +18 -5
  40. package/esm/typings/src/prepare/preparePipelineOnRemoteServer.d.ts +1 -1
  41. package/esm/typings/src/remote-server/socket-types/_subtypes/PromptbookServer_Identification.d.ts +5 -2
  42. package/esm/typings/src/remote-server/startRemoteServer.d.ts +1 -0
  43. package/esm/typings/src/types/typeAliases.d.ts +2 -0
  44. package/esm/typings/src/utils/editable/edit-pipeline-string/deflatePipeline.test.d.ts +1 -0
  45. package/esm/typings/src/utils/editable/utils/isFlatPipeline.test.d.ts +1 -0
  46. package/esm/typings/src/utils/environment/$isRunningInBrowser.d.ts +3 -0
  47. package/esm/typings/src/utils/environment/$isRunningInJest.d.ts +3 -0
  48. package/esm/typings/src/utils/environment/$isRunningInNode.d.ts +3 -0
  49. package/esm/typings/src/utils/environment/$isRunningInWebWorker.d.ts +3 -0
  50. package/esm/typings/src/utils/files/mimeTypeToExtension.d.ts +10 -0
  51. package/esm/typings/src/utils/files/mimeTypeToExtension.test.d.ts +1 -0
  52. package/esm/typings/src/utils/random/$randomSeed.d.ts +2 -1
  53. package/esm/typings/src/utils/random/$randomToken.d.ts +13 -0
  54. package/esm/typings/src/wizzard/wizzard.d.ts +8 -3
  55. package/package.json +12 -16
  56. package/umd/index.umd.js +3889 -3612
  57. package/umd/index.umd.js.map +1 -1
  58. package/esm/typings/src/remote-server/socket-types/_common/PromptbookServer_Progress.d.ts +0 -10
  59. package/esm/typings/src/types/TaskProgress.d.ts +0 -43
@@ -4,6 +4,8 @@ import { _AnthropicClaudeMetadataRegistration } from '../llm-providers/anthropic
4
4
  import { _AnthropicClaudeRegistration } from '../llm-providers/anthropic-claude/register-constructor';
5
5
  import { _AzureOpenAiMetadataRegistration } from '../llm-providers/azure-openai/register-configuration';
6
6
  import { _AzureOpenAiRegistration } from '../llm-providers/azure-openai/register-constructor';
7
+ import { _DeepseekMetadataRegistration } from '../llm-providers/deepseek/register-configuration';
8
+ import { _DeepseekRegistration } from '../llm-providers/deepseek/register-constructor';
7
9
  import { _GoogleMetadataRegistration } from '../llm-providers/google/register-configuration';
8
10
  import { _GoogleRegistration } from '../llm-providers/google/register-constructor';
9
11
  import { _OpenAiMetadataRegistration } from '../llm-providers/openai/register-configuration';
@@ -30,6 +32,8 @@ export { _AnthropicClaudeMetadataRegistration };
30
32
  export { _AnthropicClaudeRegistration };
31
33
  export { _AzureOpenAiMetadataRegistration };
32
34
  export { _AzureOpenAiRegistration };
35
+ export { _DeepseekMetadataRegistration };
36
+ export { _DeepseekRegistration };
33
37
  export { _GoogleMetadataRegistration };
34
38
  export { _GoogleRegistration };
35
39
  export { _OpenAiMetadataRegistration };
@@ -12,6 +12,9 @@ import { LOGO_LIGHT_SRC } from '../config';
12
12
  import { LOGO_DARK_SRC } from '../config';
13
13
  import { DEFAULT_BOOK_TITLE } from '../config';
14
14
  import { DEFAULT_TASK_TITLE } from '../config';
15
+ import { DEFAULT_PROMPT_TASK_TITLE } from '../config';
16
+ import { DEFAULT_BOOK_OUTPUT_PARAMETER_NAME } from '../config';
17
+ import { DEFAULT_MAX_FILE_SIZE } from '../config';
15
18
  import { MAX_FILENAME_LENGTH } from '../config';
16
19
  import { DEFAULT_INTERMEDIATE_FILES_STRATEGY } from '../config';
17
20
  import { DEFAULT_MAX_PARALLEL_COUNT } from '../config';
@@ -19,7 +22,8 @@ import { DEFAULT_MAX_EXECUTION_ATTEMPTS } from '../config';
19
22
  import { DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH } from '../config';
20
23
  import { DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL } from '../config';
21
24
  import { DEFAULT_BOOKS_DIRNAME } from '../config';
22
- import { DEFAULT_EXECUTIONS_CACHE_DIRNAME } from '../config';
25
+ import { DEFAULT_DOWNLOAD_CACHE_DIRNAME } from '../config';
26
+ import { DEFAULT_EXECUTION_CACHE_DIRNAME } from '../config';
23
27
  import { DEFAULT_SCRAPE_CACHE_DIRNAME } from '../config';
24
28
  import { DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME } from '../config';
25
29
  import { DEFAULT_REMOTE_URL } from '../config';
@@ -55,7 +59,6 @@ import { PipelineExecutionError } from '../errors/PipelineExecutionError';
55
59
  import { PipelineLogicError } from '../errors/PipelineLogicError';
56
60
  import { PipelineUrlError } from '../errors/PipelineUrlError';
57
61
  import { UnexpectedError } from '../errors/UnexpectedError';
58
- import { assertsExecutionSuccessful } from '../execution/assertsExecutionSuccessful';
59
62
  import { createPipelineExecutor } from '../execution/createPipelineExecutor/00-createPipelineExecutor';
60
63
  import { embeddingVectorToString } from '../execution/embeddingVectorToString';
61
64
  import { executionReportJsonToString } from '../execution/execution-report/executionReportJsonToString';
@@ -88,6 +91,7 @@ import { countTotalUsage } from '../llm-providers/_common/utils/count-total-usag
88
91
  import { limitTotalUsage } from '../llm-providers/_common/utils/count-total-usage/limitTotalUsage';
89
92
  import { _AnthropicClaudeMetadataRegistration } from '../llm-providers/anthropic-claude/register-configuration';
90
93
  import { _AzureOpenAiMetadataRegistration } from '../llm-providers/azure-openai/register-configuration';
94
+ import { _DeepseekMetadataRegistration } from '../llm-providers/deepseek/register-configuration';
91
95
  import { _GoogleMetadataRegistration } from '../llm-providers/google/register-configuration';
92
96
  import { joinLlmExecutionTools } from '../llm-providers/multiple/joinLlmExecutionTools';
93
97
  import { MultipleLlmExecutionTools } from '../llm-providers/multiple/MultipleLlmExecutionTools';
@@ -138,6 +142,9 @@ export { LOGO_LIGHT_SRC };
138
142
  export { LOGO_DARK_SRC };
139
143
  export { DEFAULT_BOOK_TITLE };
140
144
  export { DEFAULT_TASK_TITLE };
145
+ export { DEFAULT_PROMPT_TASK_TITLE };
146
+ export { DEFAULT_BOOK_OUTPUT_PARAMETER_NAME };
147
+ export { DEFAULT_MAX_FILE_SIZE };
141
148
  export { MAX_FILENAME_LENGTH };
142
149
  export { DEFAULT_INTERMEDIATE_FILES_STRATEGY };
143
150
  export { DEFAULT_MAX_PARALLEL_COUNT };
@@ -145,7 +152,8 @@ export { DEFAULT_MAX_EXECUTION_ATTEMPTS };
145
152
  export { DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH };
146
153
  export { DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL };
147
154
  export { DEFAULT_BOOKS_DIRNAME };
148
- export { DEFAULT_EXECUTIONS_CACHE_DIRNAME };
155
+ export { DEFAULT_DOWNLOAD_CACHE_DIRNAME };
156
+ export { DEFAULT_EXECUTION_CACHE_DIRNAME };
149
157
  export { DEFAULT_SCRAPE_CACHE_DIRNAME };
150
158
  export { DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME };
151
159
  export { DEFAULT_REMOTE_URL };
@@ -181,7 +189,6 @@ export { PipelineExecutionError };
181
189
  export { PipelineLogicError };
182
190
  export { PipelineUrlError };
183
191
  export { UnexpectedError };
184
- export { assertsExecutionSuccessful };
185
192
  export { createPipelineExecutor };
186
193
  export { embeddingVectorToString };
187
194
  export { executionReportJsonToString };
@@ -214,6 +221,7 @@ export { countTotalUsage };
214
221
  export { limitTotalUsage };
215
222
  export { _AnthropicClaudeMetadataRegistration };
216
223
  export { _AzureOpenAiMetadataRegistration };
224
+ export { _DeepseekMetadataRegistration };
217
225
  export { _GoogleMetadataRegistration };
218
226
  export { joinLlmExecutionTools };
219
227
  export { MultipleLlmExecutionTools };
@@ -0,0 +1,8 @@
1
+ import { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION } from '../version';
2
+ import { createDeepseekExecutionTools } from '../llm-providers/deepseek/createDeepseekExecutionTools';
3
+ import type { DeepseekExecutionToolsOptions } from '../llm-providers/deepseek/DeepseekExecutionToolsOptions';
4
+ import { _DeepseekRegistration } from '../llm-providers/deepseek/register-constructor';
5
+ export { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION };
6
+ export { createDeepseekExecutionTools };
7
+ export type { DeepseekExecutionToolsOptions };
8
+ export { _DeepseekRegistration };
@@ -28,6 +28,7 @@ import type { renderPipelineMermaidOptions } from '../conversion/prettify/render
28
28
  import type { CallbackInterfaceToolsOptions } from '../dialogs/callback/CallbackInterfaceToolsOptions';
29
29
  import type { ErrorJson } from '../errors/utils/ErrorJson';
30
30
  import type { LocateAppOptions } from '../executables/locateApp';
31
+ import type { AbstractTaskResult } from '../execution/AbstractTaskResult';
31
32
  import type { AvailableModel } from '../execution/AvailableModel';
32
33
  import type { CommonToolsOptions } from '../execution/CommonToolsOptions';
33
34
  import type { CreatePipelineExecutorOptions } from '../execution/createPipelineExecutor/00-CreatePipelineExecutorOptions';
@@ -37,6 +38,10 @@ import type { ExecutionPromptReportJson } from '../execution/execution-report/Ex
37
38
  import type { ExecutionReportJson } from '../execution/execution-report/ExecutionReportJson';
38
39
  import type { ExecutionReportString } from '../execution/execution-report/ExecutionReportString';
39
40
  import type { ExecutionReportStringOptions } from '../execution/execution-report/ExecutionReportStringOptions';
41
+ import type { ExecutionTask } from '../execution/ExecutionTask';
42
+ import type { PreparationTask } from '../execution/ExecutionTask';
43
+ import type { AbstractTask } from '../execution/ExecutionTask';
44
+ import type { Task } from '../execution/ExecutionTask';
40
45
  import type { ExecutionTools } from '../execution/ExecutionTools';
41
46
  import type { FilesystemTools } from '../execution/FilesystemTools';
42
47
  import type { LlmExecutionTools } from '../execution/LlmExecutionTools';
@@ -70,6 +75,7 @@ import type { AnthropicClaudeExecutionToolsOptions } from '../llm-providers/anth
70
75
  import type { AnthropicClaudeExecutionToolsDirectOptions } from '../llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions';
71
76
  import type { AnthropicClaudeExecutionToolsProxiedOptions } from '../llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions';
72
77
  import type { AzureOpenAiExecutionToolsOptions } from '../llm-providers/azure-openai/AzureOpenAiExecutionToolsOptions';
78
+ import type { DeepseekExecutionToolsOptions } from '../llm-providers/deepseek/DeepseekExecutionToolsOptions';
73
79
  import type { GoogleExecutionToolsOptions } from '../llm-providers/google/GoogleExecutionToolsOptions';
74
80
  import type { OpenAiAssistantExecutionToolsOptions } from '../llm-providers/openai/OpenAiAssistantExecutionToolsOptions';
75
81
  import type { OpenAiExecutionToolsOptions } from '../llm-providers/openai/OpenAiExecutionToolsOptions';
@@ -132,7 +138,6 @@ import type { ChatPrompt } from '../types/Prompt';
132
138
  import type { EmbeddingPrompt } from '../types/Prompt';
133
139
  import type { ScriptLanguage } from '../types/ScriptLanguage';
134
140
  import type { SectionType } from '../types/SectionType';
135
- import type { TaskProgress } from '../types/TaskProgress';
136
141
  import type { TaskType } from '../types/TaskType';
137
142
  import type { string_char_emoji } from '../types/typeAliasEmoji';
138
143
  import type { string_business_category_name } from '../types/typeAliases';
@@ -220,6 +225,7 @@ import type { string_translate_language } from '../types/typeAliases';
220
225
  import type { string_javascript_name } from '../types/typeAliases';
221
226
  import type { string_postprocessing_function_name } from '../types/typeAliases';
222
227
  import type { id } from '../types/typeAliases';
228
+ import type { task_id } from '../types/typeAliases';
223
229
  import type { string_token } from '../types/typeAliases';
224
230
  import type { string_license_token } from '../types/typeAliases';
225
231
  import type { string_password } from '../types/typeAliases';
@@ -233,6 +239,7 @@ import type { number_tokens } from '../types/typeAliases';
233
239
  import type { number_positive } from '../types/typeAliases';
234
240
  import type { number_negative } from '../types/typeAliases';
235
241
  import type { number_integer } from '../types/typeAliases';
242
+ import type { number_port } from '../types/typeAliases';
236
243
  import type { number_percent } from '../types/typeAliases';
237
244
  import type { number_model_temperature } from '../types/typeAliases';
238
245
  import type { number_seed } from '../types/typeAliases';
@@ -302,6 +309,7 @@ export type { renderPipelineMermaidOptions };
302
309
  export type { CallbackInterfaceToolsOptions };
303
310
  export type { ErrorJson };
304
311
  export type { LocateAppOptions };
312
+ export type { AbstractTaskResult };
305
313
  export type { AvailableModel };
306
314
  export type { CommonToolsOptions };
307
315
  export type { CreatePipelineExecutorOptions };
@@ -311,6 +319,10 @@ export type { ExecutionPromptReportJson };
311
319
  export type { ExecutionReportJson };
312
320
  export type { ExecutionReportString };
313
321
  export type { ExecutionReportStringOptions };
322
+ export type { ExecutionTask };
323
+ export type { PreparationTask };
324
+ export type { AbstractTask };
325
+ export type { Task };
314
326
  export type { ExecutionTools };
315
327
  export type { FilesystemTools };
316
328
  export type { LlmExecutionTools };
@@ -344,6 +356,7 @@ export type { AnthropicClaudeExecutionToolsOptions };
344
356
  export type { AnthropicClaudeExecutionToolsDirectOptions };
345
357
  export type { AnthropicClaudeExecutionToolsProxiedOptions };
346
358
  export type { AzureOpenAiExecutionToolsOptions };
359
+ export type { DeepseekExecutionToolsOptions };
347
360
  export type { GoogleExecutionToolsOptions };
348
361
  export type { OpenAiAssistantExecutionToolsOptions };
349
362
  export type { OpenAiExecutionToolsOptions };
@@ -406,7 +419,6 @@ export type { ChatPrompt };
406
419
  export type { EmbeddingPrompt };
407
420
  export type { ScriptLanguage };
408
421
  export type { SectionType };
409
- export type { TaskProgress };
410
422
  export type { TaskType };
411
423
  export type { string_char_emoji };
412
424
  export type { string_business_category_name };
@@ -494,6 +506,7 @@ export type { string_translate_language };
494
506
  export type { string_javascript_name };
495
507
  export type { string_postprocessing_function_name };
496
508
  export type { id };
509
+ export type { task_id };
497
510
  export type { string_token };
498
511
  export type { string_license_token };
499
512
  export type { string_password };
@@ -507,6 +520,7 @@ export type { number_tokens };
507
520
  export type { number_positive };
508
521
  export type { number_negative };
509
522
  export type { number_integer };
523
+ export type { number_port };
510
524
  export type { number_percent };
511
525
  export type { number_model_temperature };
512
526
  export type { number_seed };
@@ -8,6 +8,7 @@ import { serializeError } from '../errors/utils/serializeError';
8
8
  import { forEachAsync } from '../execution/utils/forEachAsync';
9
9
  import { isValidJsonString } from '../formats/json/utils/isValidJsonString';
10
10
  import { prompt } from '../pipeline/prompt-notation';
11
+ import { promptTemplate } from '../pipeline/prompt-notation';
11
12
  import { $getCurrentDate } from '../utils/$getCurrentDate';
12
13
  import { $isRunningInBrowser } from '../utils/environment/$isRunningInBrowser';
13
14
  import { $isRunningInJest } from '../utils/environment/$isRunningInJest';
@@ -53,7 +54,6 @@ import { numberToString } from '../utils/parameters/numberToString';
53
54
  import { templateParameters } from '../utils/parameters/templateParameters';
54
55
  import { valueToString } from '../utils/parameters/valueToString';
55
56
  import { parseNumber } from '../utils/parseNumber';
56
- import { $randomSeed } from '../utils/random/$randomSeed';
57
57
  import { removeEmojis } from '../utils/removeEmojis';
58
58
  import { removeQuotes } from '../utils/removeQuotes';
59
59
  import { $deepFreeze } from '../utils/serialization/$deepFreeze';
@@ -89,6 +89,7 @@ export { serializeError };
89
89
  export { forEachAsync };
90
90
  export { isValidJsonString };
91
91
  export { prompt };
92
+ export { promptTemplate };
92
93
  export { $getCurrentDate };
93
94
  export { $isRunningInBrowser };
94
95
  export { $isRunningInJest };
@@ -134,7 +135,6 @@ export { numberToString };
134
135
  export { templateParameters };
135
136
  export { valueToString };
136
137
  export { parseNumber };
137
- export { $randomSeed };
138
138
  export { removeEmojis };
139
139
  export { removeQuotes };
140
140
  export { $deepFreeze };
@@ -3,6 +3,8 @@ import { _AnthropicClaudeMetadataRegistration } from '../llm-providers/anthropic
3
3
  import { _AnthropicClaudeRegistration } from '../llm-providers/anthropic-claude/register-constructor';
4
4
  import { _AzureOpenAiMetadataRegistration } from '../llm-providers/azure-openai/register-configuration';
5
5
  import { _AzureOpenAiRegistration } from '../llm-providers/azure-openai/register-constructor';
6
+ import { _DeepseekMetadataRegistration } from '../llm-providers/deepseek/register-configuration';
7
+ import { _DeepseekRegistration } from '../llm-providers/deepseek/register-constructor';
6
8
  import { _GoogleMetadataRegistration } from '../llm-providers/google/register-configuration';
7
9
  import { _GoogleRegistration } from '../llm-providers/google/register-constructor';
8
10
  import { _OpenAiMetadataRegistration } from '../llm-providers/openai/register-configuration';
@@ -29,6 +31,8 @@ export { _AnthropicClaudeMetadataRegistration };
29
31
  export { _AnthropicClaudeRegistration };
30
32
  export { _AzureOpenAiMetadataRegistration };
31
33
  export { _AzureOpenAiRegistration };
34
+ export { _DeepseekMetadataRegistration };
35
+ export { _DeepseekRegistration };
32
36
  export { _GoogleMetadataRegistration };
33
37
  export { _GoogleRegistration };
34
38
  export { _OpenAiMetadataRegistration };
@@ -0,0 +1,13 @@
1
+ import type { Command as Program } from 'commander';
2
+ /**
3
+ * Initializes `boilerplate` command for Promptbook CLI utilities
4
+ *
5
+ * Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI
6
+ *
7
+ * @private internal function of `promptbookCli`
8
+ */
9
+ export declare function $initializeBoilerplateCommand(program: Program): void;
10
+ /**
11
+ * Note: [💞] Ignore a discrepancy between file name and entity name
12
+ * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
13
+ */
@@ -2,10 +2,13 @@ import type { Command as Program } from 'commander';
2
2
  /**
3
3
  * Initializes `about` command for Promptbook CLI utilities
4
4
  *
5
+ * Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI
6
+ *
5
7
  * @private internal function of `promptbookCli`
6
8
  */
7
- export declare function initializeAboutCommand(program: Program): void;
9
+ export declare function $initializeAboutCommand(program: Program): void;
8
10
  /**
11
+ * TODO: !!! Test this in `deno`
9
12
  * TODO: [🗽] Unite branding and make single place for it
10
13
  * Note: [💞] Ignore a discrepancy between file name and entity name
11
14
  * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
@@ -2,9 +2,11 @@ import type { Command as Program } from 'commander';
2
2
  /**
3
3
  * Initializes testing `hello` command for Promptbook CLI utilities
4
4
  *
5
+ * Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI
6
+ *
5
7
  * @private internal function of `promptbookCli`
6
8
  */
7
- export declare function initializeHelloCommand(program: Program): void;
9
+ export declare function $initializeHelloCommand(program: Program): void;
8
10
  /**
9
11
  * TODO: [🧠][🐣] Make here some easter egg with generated hello greeting via LLM models
10
12
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -2,9 +2,11 @@ import type { Command as Program } from 'commander';
2
2
  /**
3
3
  * Initializes `list-models` command for Promptbook CLI utilities
4
4
  *
5
+ * Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI
6
+ *
5
7
  * @private internal function of `promptbookCli`
6
8
  */
7
- export declare function initializeListModelsCommand(program: Program): void;
9
+ export declare function $initializeListModelsCommand(program: Program): void;
8
10
  /**
9
11
  * Note: [💞] Ignore a discrepancy between file name and entity name
10
12
  * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
@@ -0,0 +1,13 @@
1
+ import type { Command as Program } from 'commander';
2
+ /**
3
+ * Initializes `list-scrapers` command for Promptbook CLI utilities
4
+ *
5
+ * Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI
6
+ *
7
+ * @private internal function of `promptbookCli`
8
+ */
9
+ export declare function $initializeListScrapersCommand(program: Program): void;
10
+ /**
11
+ * Note: [💞] Ignore a discrepancy between file name and entity name
12
+ * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
13
+ */
@@ -2,9 +2,11 @@ import type { Command as Program } from 'commander';
2
2
  /**
3
3
  * Initializes `make` command for Promptbook CLI utilities
4
4
  *
5
+ * Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI
6
+ *
5
7
  * @private internal function of `promptbookCli`
6
8
  */
7
- export declare function initializeMakeCommand(program: Program): void;
9
+ export declare function $initializeMakeCommand(program: Program): void;
8
10
  /**
9
11
  * TODO: [🥃][main] !!3 Allow `ptbk make` without configuring any llm tools
10
12
  * TODO: [0] DRY Javascript and typescript - Maybe make ONLY typescript and for javascript just remove types
@@ -2,9 +2,11 @@ import type { Command as Program } from 'commander';
2
2
  /**
3
3
  * Initializes `prettify` command for Promptbook CLI utilities
4
4
  *
5
+ * Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI
6
+ *
5
7
  * @private internal function of `promptbookCli`
6
8
  */
7
- export declare function initializePrettifyCommand(program: Program): void;
9
+ export declare function $initializePrettifyCommand(program: Program): void;
8
10
  /**
9
11
  * TODO: [😶] Unite floder listing
10
12
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -2,9 +2,11 @@ import type { Command as Program } from 'commander';
2
2
  /**
3
3
  * Initializes `run` command for Promptbook CLI utilities
4
4
  *
5
+ * Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI
6
+ *
5
7
  * @private internal function of `promptbookCli`
6
8
  */
7
- export declare function initializeRunCommand(program: Program): void;
9
+ export declare function $initializeRunCommand(program: Program): void;
8
10
  /**
9
11
  * TODO: !!5 Catch and wrap all errors from CLI
10
12
  * TODO: [🧠] Pass `maxExecutionAttempts`, `csvSettings`
@@ -1,5 +1,5 @@
1
- import type { PipelineJson } from '../../pipeline/PipelineJson/PipelineJson';
2
1
  import type { PipelineExecutor } from '../../execution/PipelineExecutor';
2
+ import type { PipelineJson } from '../../pipeline/PipelineJson/PipelineJson';
3
3
  /**
4
4
  * Options for running the interactive chatbot
5
5
  */
@@ -0,0 +1,13 @@
1
+ import type { Command as Program } from 'commander';
2
+ /**
3
+ * Initializes `start-server` command for Promptbook CLI utilities
4
+ *
5
+ * Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI
6
+ *
7
+ * @private internal function of `promptbookCli`
8
+ */
9
+ export declare function $initializeStartServerCommand(program: Program): void;
10
+ /**
11
+ * Note: [💞] Ignore a discrepancy between file name and entity name
12
+ * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
13
+ */
@@ -2,9 +2,11 @@ import type { Command as Program } from 'commander';
2
2
  /**
3
3
  * Initializes `test` command for Promptbook CLI utilities
4
4
  *
5
+ * Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI
6
+ *
5
7
  * @private internal function of `promptbookCli`
6
8
  */
7
- export declare function initializeTestCommand(program: Program): void;
9
+ export declare function $initializeTestCommand(program: Program): void;
8
10
  /**
9
11
  * TODO: [😶] Unite floder listing
10
12
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -65,6 +65,24 @@ export declare const DEFAULT_BOOK_TITLE = "\u2728 Untitled Book";
65
65
  * @public exported from `@promptbook/core`
66
66
  */
67
67
  export declare const DEFAULT_TASK_TITLE = "Task";
68
+ /**
69
+ * When the title of the prompt task is not provided, the default title is used
70
+ *
71
+ * @public exported from `@promptbook/core`
72
+ */
73
+ export declare const DEFAULT_PROMPT_TASK_TITLE = "Prompt";
74
+ /**
75
+ * When the pipeline is flat and no name of return parameter is provided, this name is used
76
+ *
77
+ * @public exported from `@promptbook/core`
78
+ */
79
+ export declare const DEFAULT_BOOK_OUTPUT_PARAMETER_NAME = "result";
80
+ /**
81
+ * Maximum file size limit
82
+ *
83
+ * @public exported from `@promptbook/core`
84
+ */
85
+ export declare const DEFAULT_MAX_FILE_SIZE: number;
68
86
  /**
69
87
  * Warning message for the generated sections and files files
70
88
  *
@@ -166,6 +184,14 @@ export declare const DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL = 200;
166
184
  * @public exported from `@promptbook/core`
167
185
  */
168
186
  export declare const DEFAULT_BOOKS_DIRNAME = "./books";
187
+ /**
188
+ * Where to store the temporary downloads
189
+ *
190
+ * Note: When the folder does not exist, it is created recursively
191
+ *
192
+ * @public exported from `@promptbook/core`
193
+ */
194
+ export declare const DEFAULT_DOWNLOAD_CACHE_DIRNAME = "./.promptbook/download-cache";
169
195
  /**
170
196
  * Where to store the cache of executions for promptbook CLI
171
197
  *
@@ -173,7 +199,7 @@ export declare const DEFAULT_BOOKS_DIRNAME = "./books";
173
199
  *
174
200
  * @public exported from `@promptbook/core`
175
201
  */
176
- export declare const DEFAULT_EXECUTIONS_CACHE_DIRNAME = "./.promptbook/executions-cache";
202
+ export declare const DEFAULT_EXECUTION_CACHE_DIRNAME = "./.promptbook/execution-cache";
177
203
  /**
178
204
  * Where to store the scrape cache
179
205
  *
@@ -17,5 +17,5 @@ import type { RemoteClientOptions } from '../remote-server/types/RemoteClientOpt
17
17
  */
18
18
  export declare function compilePipelineOnRemoteServer<TCustomOptions = undefined>(pipelineString: PipelineString, options: RemoteClientOptions<TCustomOptions>): Promise<PipelineJson>;
19
19
  /**
20
- * TODO: !!!! Do not return Promise<PipelineJson> But PreparePipelineTask
20
+ * TODO: [🐚] Do not return `Promise<PipelineJson>` But `PreparationTask`
21
21
  */
@@ -0,0 +1,25 @@
1
+ import { ReadonlyDeep } from 'type-fest';
2
+ import type { ErrorJson } from '../errors/utils/ErrorJson';
3
+ /**
4
+ * @@@
5
+ *
6
+ * Note: [🚉] This is fully serializable as JSON
7
+ */
8
+ export type AbstractTaskResult = {
9
+ /**
10
+ * Whether the execution was successful, details are aviable in `executionReport`
11
+ */
12
+ readonly isSuccessful: boolean;
13
+ /**
14
+ * Errors that occured during the execution, details are aviable in `executionReport`
15
+ */
16
+ readonly errors: ReadonlyDeep<ReadonlyArray<ErrorJson>>;
17
+ /**
18
+ * Warnings that occured during the execution, details are aviable in `executionReport`
19
+ */
20
+ readonly warnings: ReadonlyDeep<ReadonlyArray<ErrorJson>>;
21
+ };
22
+ /**
23
+ * TODO: [🧠] Should this file be in /execution or /types folder?
24
+ * TODO: [🧠] Maybe constrain `ErrorJson` -> `ErrorJson & { name: 'PipelineExecutionError' | 'Error' }`
25
+ */
@@ -0,0 +1,71 @@
1
+ import type { Observable } from 'rxjs';
2
+ import { PartialDeep } from 'type-fest';
3
+ import type { string_SCREAMING_CASE } from '../utils/normalization/normalizeTo_SCREAMING_CASE';
4
+ import type { task_id } from '../types/typeAliases';
5
+ import type { AbstractTaskResult } from './AbstractTaskResult';
6
+ import type { PipelineExecutorResult } from './PipelineExecutorResult';
7
+ /**
8
+ * Options for creating a new task
9
+ */
10
+ type CreateTaskOptions<TTaskResult extends AbstractTaskResult> = {
11
+ /**
12
+ * The type of task to create
13
+ */
14
+ readonly taskType: AbstractTask<TTaskResult>['taskType'];
15
+ /**
16
+ * Callback that processes the task and updates the ongoing result
17
+ * @param ongoingResult The partial result of the task processing
18
+ * @returns The final task result
19
+ */
20
+ taskProcessCallback(updateOngoingResult: (newOngoingResult: PartialDeep<TTaskResult>) => void): Promise<TTaskResult>;
21
+ };
22
+ /**
23
+ * Helper to create a new task
24
+ *
25
+ * @private internal helper function
26
+ */
27
+ export declare function createTask<TTaskResult extends AbstractTaskResult>(options: CreateTaskOptions<TTaskResult>): AbstractTask<TTaskResult>;
28
+ /**
29
+ * Represents a task that executes a pipeline
30
+ */
31
+ export type ExecutionTask = AbstractTask<PipelineExecutorResult> & {
32
+ readonly taskType: 'EXECUTION';
33
+ readonly taskId: `execution-${task_id}`;
34
+ };
35
+ /**
36
+ * Represents a task that prepares a pipeline
37
+ * @deprecated TODO: [🐚] Currently unused - use
38
+ */
39
+ export type PreparationTask = AbstractTask<PipelineExecutorResult> & {
40
+ readonly taskType: 'PREPARATION';
41
+ readonly taskId: `preparation-${task_id}`;
42
+ };
43
+ /**
44
+ * Base interface for all task types
45
+ */
46
+ export type AbstractTask<TTaskResult extends AbstractTaskResult> = {
47
+ /**
48
+ * Type of the task
49
+ */
50
+ readonly taskType: string_SCREAMING_CASE;
51
+ /**
52
+ * Unique identifier for the task
53
+ */
54
+ readonly taskId: task_id;
55
+ /**
56
+ * Gets a promise that resolves with the task result
57
+ */
58
+ asPromise(options?: {
59
+ readonly isCrashedOnError?: boolean;
60
+ }): Promise<TTaskResult>;
61
+ /**
62
+ * Gets an observable stream of partial task results
63
+ */
64
+ asObservable(): Observable<PartialDeep<TTaskResult>>;
65
+ };
66
+ export type Task = ExecutionTask | PreparationTask;
67
+ export {};
68
+ /**
69
+ * TODO: Maybe allow to terminate the task and add getter `isFinished` or `status`
70
+ * TODO: [🐚] Split into more files and make `PrepareTask` & `RemoteTask` + split the function
71
+ */
@@ -3,7 +3,7 @@ import type fs from 'fs/promises';
3
3
  /**
4
4
  * Container for all the tools needed to manipulate with filesystem
5
5
  */
6
- export type FilesystemTools = Pick<typeof fs, 'access' | 'constants' | 'readFile' | 'writeFile' | 'stat' | 'readdir'>;
6
+ export type FilesystemTools = Pick<typeof fs, 'access' | 'constants' | 'readFile' | 'writeFile' | 'stat' | 'readdir' | 'mkdir'>;
7
7
  /**
8
8
  * TODO: Implement destroyable pattern to free resources
9
9
  */
@@ -1,7 +1,5 @@
1
- import type { Promisable } from 'type-fest';
2
- import type { TaskProgress } from '../types/TaskProgress';
3
1
  import type { InputParameters } from '../types/typeAliases';
4
- import type { PipelineExecutorResult } from './PipelineExecutorResult';
2
+ import type { ExecutionTask } from './ExecutionTask';
5
3
  /**
6
4
  * Executor is a simple async function that takes INPUT PARAMETERs and returns result parameters _(along with all intermediate parameters and INPUT PARAMETERs = it extends input object)_.
7
5
  * Executor is made by combining execution tools and pipeline collection.
@@ -11,9 +9,8 @@ import type { PipelineExecutorResult } from './PipelineExecutorResult';
11
9
  * @see https://github.com/webgptorg/promptbook#executor
12
10
  */
13
11
  export type PipelineExecutor = {
14
- (inputParameters: InputParameters, onProgress?: (taskProgress: TaskProgress) => Promisable<void>): Promise<PipelineExecutorResult>;
12
+ (inputParameters: InputParameters): ExecutionTask;
15
13
  };
16
14
  /**
17
- * TODO: [🐚] Change onProgress to object that represents the running execution, can be subscribed via RxJS to and also awaited
18
15
  * TODO: [🧠] Should this file be in /execution or /types folder?
19
16
  */
@@ -1,7 +1,7 @@
1
1
  import { ReadonlyDeep } from 'type-fest';
2
- import type { ErrorJson } from '../errors/utils/ErrorJson';
3
2
  import type { PipelineJson } from '../pipeline/PipelineJson/PipelineJson';
4
3
  import type { Parameters } from '../types/typeAliases';
4
+ import type { AbstractTaskResult } from './AbstractTaskResult';
5
5
  import type { ExecutionReportJson } from './execution-report/ExecutionReportJson';
6
6
  import type { PromptResultUsage } from './PromptResultUsage';
7
7
  /**
@@ -9,29 +9,17 @@ import type { PromptResultUsage } from './PromptResultUsage';
9
9
  *
10
10
  * Note: [🚉] This is fully serializable as JSON
11
11
  */
12
- export type PipelineExecutorResult = {
12
+ export type PipelineExecutorResult = AbstractTaskResult & {
13
13
  /**
14
14
  * Result parameters of the execution
15
15
  *
16
16
  * Note: If the execution was not successful, there are only some of the result parameters
17
17
  */
18
18
  readonly outputParameters: Readonly<Parameters>;
19
- /**
20
- * Whether the execution was successful, details are aviable in `executionReport`
21
- */
22
- readonly isSuccessful: boolean;
23
19
  /**
24
20
  * Added usage of whole execution, detailed usage is aviable in `executionReport`
25
21
  */
26
22
  readonly usage: ReadonlyDeep<PromptResultUsage>;
27
- /**
28
- * Errors that occured during the execution, details are aviable in `executionReport`
29
- */
30
- readonly errors: ReadonlyDeep<ReadonlyArray<ErrorJson>>;
31
- /**
32
- * Warnings that occured during the execution, details are aviable in `executionReport`
33
- */
34
- readonly warnings: ReadonlyDeep<ReadonlyArray<ErrorJson>>;
35
23
  /**
36
24
  * The report of the execution with all details
37
25
  */
@@ -46,5 +34,4 @@ export type PipelineExecutorResult = {
46
34
  };
47
35
  /**
48
36
  * TODO: [🧠] Should this file be in /execution or /types folder?
49
- * TODO: [🧠] Maybe constrain `ErrorJson` -> `ErrorJson & { name: 'PipelineExecutionError' | 'Error' }`
50
37
  */
@@ -1,5 +1,12 @@
1
1
  import type { string_url } from '../types/typeAliases';
2
2
  /**
3
- * Fetch function for fetching data from the internet used in scraping
3
+ * Fetch function used in Promptbook engine
4
+ *
5
+ * In most cases it is just native `fetch` function with a lightweight error handling wrapper
6
+ * But it can be replaced with any other fetch function, polyfill, custom implementation, security layer, etc.
7
+ *
8
+ * It is used in theese places:
9
+ * - Fetching knowledge sources
10
+ * - Callbacks from remote server ([👩🏾‍🤝‍🧑🏾] Not yet implemented)
4
11
  */
5
12
  export type PromptbookFetch = (url: string_url, init?: RequestInit) => Promise<Response>;