@promptbook/markdown-utils 0.89.0-3 → 0.89.0-31

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 (50) hide show
  1. package/README.md +9 -7
  2. package/esm/index.es.js +615 -532
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/servers.d.ts +40 -0
  5. package/esm/typings/src/_packages/core.index.d.ts +20 -8
  6. package/esm/typings/src/_packages/remote-client.index.d.ts +6 -8
  7. package/esm/typings/src/_packages/remote-server.index.d.ts +6 -6
  8. package/esm/typings/src/_packages/types.index.d.ts +24 -12
  9. package/esm/typings/src/cli/cli-commands/login.d.ts +0 -1
  10. package/esm/typings/src/cli/common/$addGlobalOptionsToCommand.d.ts +7 -0
  11. package/esm/typings/src/cli/common/$provideLlmToolsForCli.d.ts +28 -0
  12. package/esm/typings/src/cli/test/ptbk.d.ts +1 -1
  13. package/esm/typings/src/commands/EXPECT/expectCommandParser.d.ts +2 -0
  14. package/esm/typings/src/config.d.ts +24 -26
  15. package/esm/typings/src/errors/0-index.d.ts +9 -0
  16. package/esm/typings/src/errors/AuthenticationError.d.ts +9 -0
  17. package/esm/typings/src/errors/PipelineExecutionError.d.ts +1 -1
  18. package/esm/typings/src/errors/PromptbookFetchError.d.ts +9 -0
  19. package/esm/typings/src/errors/WrappedError.d.ts +10 -0
  20. package/esm/typings/src/errors/assertsError.d.ts +11 -0
  21. package/esm/typings/src/execution/PromptbookFetch.d.ts +1 -1
  22. package/esm/typings/src/llm-providers/_common/register/$provideEnvFilename.d.ts +12 -0
  23. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts +2 -8
  24. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts +2 -0
  25. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForWizzardOrCli.d.ts +45 -1
  26. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsFromEnv.d.ts +1 -0
  27. package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +1 -1
  28. package/esm/typings/src/llm-providers/anthropic-claude/register-configuration.d.ts +1 -1
  29. package/esm/typings/src/remote-server/RemoteServer.d.ts +23 -0
  30. package/esm/typings/src/remote-server/openapi-types.d.ts +284 -0
  31. package/esm/typings/src/remote-server/openapi.d.ts +187 -0
  32. package/esm/typings/src/remote-server/socket-types/_subtypes/{PromptbookServer_Identification.d.ts → Identification.d.ts} +3 -3
  33. package/esm/typings/src/remote-server/socket-types/_subtypes/identificationToPromptbookToken.d.ts +11 -0
  34. package/esm/typings/src/remote-server/socket-types/_subtypes/promptbookTokenToIdentification.d.ts +10 -0
  35. package/esm/typings/src/remote-server/socket-types/listModels/PromptbookServer_ListModels_Request.d.ts +2 -2
  36. package/esm/typings/src/remote-server/socket-types/prepare/PromptbookServer_PreparePipeline_Request.d.ts +2 -2
  37. package/esm/typings/src/remote-server/socket-types/prompt/PromptbookServer_Prompt_Request.d.ts +2 -2
  38. package/esm/typings/src/remote-server/startRemoteServer.d.ts +3 -4
  39. package/esm/typings/src/remote-server/types/RemoteClientOptions.d.ts +4 -12
  40. package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +84 -9
  41. package/esm/typings/src/scrapers/_common/utils/{scraperFetch.d.ts → promptbookFetch.d.ts} +2 -2
  42. package/esm/typings/src/storage/env-storage/$EnvStorage.d.ts +40 -0
  43. package/esm/typings/src/types/typeAliases.d.ts +19 -0
  44. package/esm/typings/src/utils/organization/TODO_narrow.d.ts +6 -0
  45. package/package.json +7 -3
  46. package/umd/index.umd.js +615 -532
  47. package/umd/index.umd.js.map +1 -1
  48. package/esm/typings/src/cli/test/ptbk2.d.ts +0 -5
  49. package/esm/typings/src/playground/BrjappConnector.d.ts +0 -67
  50. package/esm/typings/src/playground/brjapp-api-schema.d.ts +0 -12879
@@ -0,0 +1,40 @@
1
+ import type { string_legal_entity } from './src/types/typeAliases';
2
+ import type { string_promptbook_server_url } from './src/types/typeAliases';
3
+ import type { string_title } from './src/types/typeAliases';
4
+ /**
5
+ * Open Promptbook server usable for public
6
+ */
7
+ type ServerConfiguration = {
8
+ /**
9
+ * Basic name of the server
10
+ */
11
+ title: string_title;
12
+ /**
13
+ * Who is the owner of the server
14
+ */
15
+ owner: string_legal_entity;
16
+ /**
17
+ * Is the server open for public and anonymous usage
18
+ */
19
+ isAnonymousModeAllowed: boolean;
20
+ /**
21
+ * Description of the server, link to registration, user agreement, privacy policy, etc.
22
+ */
23
+ description: string;
24
+ /**
25
+ * URL of the server
26
+ *
27
+ Note: lising more for loadbalancing
28
+ */
29
+ urls: Array<string_promptbook_server_url>;
30
+ };
31
+ /**
32
+ * Available remote servers for the Promptbook
33
+ *
34
+ * @public exported from `@promptbook/core`
35
+ */
36
+ export declare const REMOTE_SERVER_URLS: Array<ServerConfiguration>;
37
+ export {};
38
+ /**
39
+ * Note: [💞] Ignore a discrepancy between file name and entity name
40
+ */
@@ -8,8 +8,6 @@ import { NAME } from '../config';
8
8
  import { ADMIN_EMAIL } from '../config';
9
9
  import { ADMIN_GITHUB_NAME } from '../config';
10
10
  import { CLAIM } from '../config';
11
- import { LOGO_LIGHT_SRC } from '../config';
12
- import { LOGO_DARK_SRC } from '../config';
13
11
  import { DEFAULT_BOOK_TITLE } from '../config';
14
12
  import { DEFAULT_TASK_TITLE } from '../config';
15
13
  import { DEFAULT_PROMPT_TASK_TITLE } from '../config';
@@ -25,9 +23,10 @@ import { DEFAULT_BOOKS_DIRNAME } from '../config';
25
23
  import { DEFAULT_DOWNLOAD_CACHE_DIRNAME } from '../config';
26
24
  import { DEFAULT_EXECUTION_CACHE_DIRNAME } from '../config';
27
25
  import { DEFAULT_SCRAPE_CACHE_DIRNAME } from '../config';
26
+ import { CLI_APP_ID } from '../config';
27
+ import { PLAYGROUND_APP_ID } from '../config';
28
28
  import { DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME } from '../config';
29
- import { DEFAULT_REMOTE_URL } from '../config';
30
- import { DEFAULT_REMOTE_URL_PATH } from '../config';
29
+ import { DEFAULT_REMOTE_SERVER_URL } from '../config';
31
30
  import { DEFAULT_CSV_SETTINGS } from '../config';
32
31
  import { DEFAULT_IS_VERBOSE } from '../config';
33
32
  import { SET_IS_VERBOSE } from '../config';
@@ -46,6 +45,7 @@ import type { CallbackInterfaceToolsOptions } from '../dialogs/callback/Callback
46
45
  import { BoilerplateError } from '../errors/0-BoilerplateError';
47
46
  import { PROMPTBOOK_ERRORS } from '../errors/0-index';
48
47
  import { AbstractFormatError } from '../errors/AbstractFormatError';
48
+ import { AuthenticationError } from '../errors/AuthenticationError';
49
49
  import { CollectionError } from '../errors/CollectionError';
50
50
  import { EnvironmentMismatchError } from '../errors/EnvironmentMismatchError';
51
51
  import { ExpectError } from '../errors/ExpectError';
@@ -58,7 +58,9 @@ import { ParseError } from '../errors/ParseError';
58
58
  import { PipelineExecutionError } from '../errors/PipelineExecutionError';
59
59
  import { PipelineLogicError } from '../errors/PipelineLogicError';
60
60
  import { PipelineUrlError } from '../errors/PipelineUrlError';
61
+ import { PromptbookFetchError } from '../errors/PromptbookFetchError';
61
62
  import { UnexpectedError } from '../errors/UnexpectedError';
63
+ import { WrappedError } from '../errors/WrappedError';
62
64
  import { createPipelineExecutor } from '../execution/createPipelineExecutor/00-createPipelineExecutor';
63
65
  import { embeddingVectorToString } from '../execution/embeddingVectorToString';
64
66
  import { executionReportJsonToString } from '../execution/execution-report/executionReportJsonToString';
@@ -112,11 +114,14 @@ import { isPipelinePrepared } from '../prepare/isPipelinePrepared';
112
114
  import { preparePipeline } from '../prepare/preparePipeline';
113
115
  import { prepareTasks } from '../prepare/prepareTasks';
114
116
  import { unpreparePipeline } from '../prepare/unpreparePipeline';
117
+ import { identificationToPromptbookToken } from '../remote-server/socket-types/_subtypes/identificationToPromptbookToken';
118
+ import { promptbookTokenToIdentification } from '../remote-server/socket-types/_subtypes/promptbookTokenToIdentification';
115
119
  import { _BoilerplateScraperMetadataRegistration } from '../scrapers/_boilerplate/register-metadata';
116
120
  import { prepareKnowledgePieces } from '../scrapers/_common/prepareKnowledgePieces';
117
121
  import { $scrapersMetadataRegister } from '../scrapers/_common/register/$scrapersMetadataRegister';
118
122
  import { $scrapersRegister } from '../scrapers/_common/register/$scrapersRegister';
119
123
  import { makeKnowledgeSourceHandler } from '../scrapers/_common/utils/makeKnowledgeSourceHandler';
124
+ import { promptbookFetch } from '../scrapers/_common/utils/promptbookFetch';
120
125
  import { _LegacyDocumentScraperMetadataRegistration } from '../scrapers/document-legacy/register-metadata';
121
126
  import { _DocumentScraperMetadataRegistration } from '../scrapers/document/register-metadata';
122
127
  import { _MarkdownScraperMetadataRegistration } from '../scrapers/markdown/register-metadata';
@@ -130,6 +135,7 @@ import { MODEL_VARIANTS } from '../types/ModelVariant';
130
135
  import { NonTaskSectionTypes } from '../types/SectionType';
131
136
  import { SectionTypes } from '../types/SectionType';
132
137
  import { TaskTypes } from '../types/TaskType';
138
+ import { REMOTE_SERVER_URLS } from '../../servers';
133
139
  export { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION };
134
140
  export { collectionToJson };
135
141
  export { createCollectionFromJson };
@@ -140,8 +146,6 @@ export { NAME };
140
146
  export { ADMIN_EMAIL };
141
147
  export { ADMIN_GITHUB_NAME };
142
148
  export { CLAIM };
143
- export { LOGO_LIGHT_SRC };
144
- export { LOGO_DARK_SRC };
145
149
  export { DEFAULT_BOOK_TITLE };
146
150
  export { DEFAULT_TASK_TITLE };
147
151
  export { DEFAULT_PROMPT_TASK_TITLE };
@@ -157,9 +161,10 @@ export { DEFAULT_BOOKS_DIRNAME };
157
161
  export { DEFAULT_DOWNLOAD_CACHE_DIRNAME };
158
162
  export { DEFAULT_EXECUTION_CACHE_DIRNAME };
159
163
  export { DEFAULT_SCRAPE_CACHE_DIRNAME };
164
+ export { CLI_APP_ID };
165
+ export { PLAYGROUND_APP_ID };
160
166
  export { DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME };
161
- export { DEFAULT_REMOTE_URL };
162
- export { DEFAULT_REMOTE_URL_PATH };
167
+ export { DEFAULT_REMOTE_SERVER_URL };
163
168
  export { DEFAULT_CSV_SETTINGS };
164
169
  export { DEFAULT_IS_VERBOSE };
165
170
  export { SET_IS_VERBOSE };
@@ -178,6 +183,7 @@ export type { CallbackInterfaceToolsOptions };
178
183
  export { BoilerplateError };
179
184
  export { PROMPTBOOK_ERRORS };
180
185
  export { AbstractFormatError };
186
+ export { AuthenticationError };
181
187
  export { CollectionError };
182
188
  export { EnvironmentMismatchError };
183
189
  export { ExpectError };
@@ -190,7 +196,9 @@ export { ParseError };
190
196
  export { PipelineExecutionError };
191
197
  export { PipelineLogicError };
192
198
  export { PipelineUrlError };
199
+ export { PromptbookFetchError };
193
200
  export { UnexpectedError };
201
+ export { WrappedError };
194
202
  export { createPipelineExecutor };
195
203
  export { embeddingVectorToString };
196
204
  export { executionReportJsonToString };
@@ -244,11 +252,14 @@ export { isPipelinePrepared };
244
252
  export { preparePipeline };
245
253
  export { prepareTasks };
246
254
  export { unpreparePipeline };
255
+ export { identificationToPromptbookToken };
256
+ export { promptbookTokenToIdentification };
247
257
  export { _BoilerplateScraperMetadataRegistration };
248
258
  export { prepareKnowledgePieces };
249
259
  export { $scrapersMetadataRegister };
250
260
  export { $scrapersRegister };
251
261
  export { makeKnowledgeSourceHandler };
262
+ export { promptbookFetch };
252
263
  export { _LegacyDocumentScraperMetadataRegistration };
253
264
  export { _DocumentScraperMetadataRegistration };
254
265
  export { _MarkdownScraperMetadataRegistration };
@@ -262,3 +273,4 @@ export { MODEL_VARIANTS };
262
273
  export { NonTaskSectionTypes };
263
274
  export { SectionTypes };
264
275
  export { TaskTypes };
276
+ export { REMOTE_SERVER_URLS };
@@ -2,17 +2,15 @@ import { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION } from '../version';
2
2
  import { compilePipelineOnRemoteServer } from '../conversion/compilePipelineOnRemoteServer';
3
3
  import { RemoteLlmExecutionTools } from '../llm-providers/remote/RemoteLlmExecutionTools';
4
4
  import { preparePipelineOnRemoteServer } from '../prepare/preparePipelineOnRemoteServer';
5
- import type { PromptbookServer_Identification } from '../remote-server/socket-types/_subtypes/PromptbookServer_Identification';
6
- import type { PromptbookServer_ApplicationIdentification } from '../remote-server/socket-types/_subtypes/PromptbookServer_Identification';
7
- import type { PromptbookServer_AnonymousIdentification } from '../remote-server/socket-types/_subtypes/PromptbookServer_Identification';
5
+ import type { Identification } from '../remote-server/socket-types/_subtypes/Identification';
6
+ import type { ApplicationModeIdentification } from '../remote-server/socket-types/_subtypes/Identification';
7
+ import type { AnonymousModeIdentification } from '../remote-server/socket-types/_subtypes/Identification';
8
8
  import type { RemoteClientOptions } from '../remote-server/types/RemoteClientOptions';
9
- import type { RemoteServerOptions } from '../remote-server/types/RemoteServerOptions';
10
9
  export { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION };
11
10
  export { compilePipelineOnRemoteServer };
12
11
  export { RemoteLlmExecutionTools };
13
12
  export { preparePipelineOnRemoteServer };
14
- export type { PromptbookServer_Identification };
15
- export type { PromptbookServer_ApplicationIdentification };
16
- export type { PromptbookServer_AnonymousIdentification };
13
+ export type { Identification };
14
+ export type { ApplicationModeIdentification };
15
+ export type { AnonymousModeIdentification };
17
16
  export type { RemoteClientOptions };
18
- export type { RemoteServerOptions };
@@ -1,12 +1,12 @@
1
1
  import { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION } from '../version';
2
- import type { PromptbookServer_Identification } from '../remote-server/socket-types/_subtypes/PromptbookServer_Identification';
3
- import type { PromptbookServer_ApplicationIdentification } from '../remote-server/socket-types/_subtypes/PromptbookServer_Identification';
4
- import type { PromptbookServer_AnonymousIdentification } from '../remote-server/socket-types/_subtypes/PromptbookServer_Identification';
2
+ import type { Identification } from '../remote-server/socket-types/_subtypes/Identification';
3
+ import type { ApplicationModeIdentification } from '../remote-server/socket-types/_subtypes/Identification';
4
+ import type { AnonymousModeIdentification } from '../remote-server/socket-types/_subtypes/Identification';
5
5
  import { startRemoteServer } from '../remote-server/startRemoteServer';
6
6
  import type { RemoteServerOptions } from '../remote-server/types/RemoteServerOptions';
7
7
  export { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION };
8
- export type { PromptbookServer_Identification };
9
- export type { PromptbookServer_ApplicationIdentification };
10
- export type { PromptbookServer_AnonymousIdentification };
8
+ export type { Identification };
9
+ export type { ApplicationModeIdentification };
10
+ export type { AnonymousModeIdentification };
11
11
  export { startRemoteServer };
12
12
  export type { RemoteServerOptions };
@@ -106,20 +106,23 @@ import type { ScriptTaskJson } from '../pipeline/PipelineJson/ScriptTaskJson';
106
106
  import type { SimpleTaskJson } from '../pipeline/PipelineJson/SimpleTaskJson';
107
107
  import type { TaskJson } from '../pipeline/PipelineJson/TaskJson';
108
108
  import type { PipelineString } from '../pipeline/PipelineString';
109
- import type { paths } from '../playground/brjapp-api-schema';
110
- import type { webhooks } from '../playground/brjapp-api-schema';
111
- import type { components } from '../playground/brjapp-api-schema';
112
- import type { $defs } from '../playground/brjapp-api-schema';
113
- import type { operations } from '../playground/brjapp-api-schema';
114
109
  import type { PrepareAndScrapeOptions } from '../prepare/PrepareAndScrapeOptions';
115
- import type { PromptbookServer_Identification } from '../remote-server/socket-types/_subtypes/PromptbookServer_Identification';
116
- import type { PromptbookServer_ApplicationIdentification } from '../remote-server/socket-types/_subtypes/PromptbookServer_Identification';
117
- import type { PromptbookServer_AnonymousIdentification } from '../remote-server/socket-types/_subtypes/PromptbookServer_Identification';
110
+ import type { paths } from '../remote-server/openapi-types';
111
+ import type { webhooks } from '../remote-server/openapi-types';
112
+ import type { components } from '../remote-server/openapi-types';
113
+ import type { $defs } from '../remote-server/openapi-types';
114
+ import type { operations } from '../remote-server/openapi-types';
115
+ import type { RemoteServer } from '../remote-server/RemoteServer';
116
+ import type { Identification } from '../remote-server/socket-types/_subtypes/Identification';
117
+ import type { ApplicationModeIdentification } from '../remote-server/socket-types/_subtypes/Identification';
118
+ import type { AnonymousModeIdentification } from '../remote-server/socket-types/_subtypes/Identification';
118
119
  import type { RemoteClientOptions } from '../remote-server/types/RemoteClientOptions';
119
120
  import type { RemoteServerOptions } from '../remote-server/types/RemoteServerOptions';
120
121
  import type { AnonymousRemoteServerOptions } from '../remote-server/types/RemoteServerOptions';
121
122
  import type { ApplicationRemoteServerOptions } from '../remote-server/types/RemoteServerOptions';
122
123
  import type { ApplicationRemoteServerClientOptions } from '../remote-server/types/RemoteServerOptions';
124
+ import type { LoginRequest } from '../remote-server/types/RemoteServerOptions';
125
+ import type { LoginResponse } from '../remote-server/types/RemoteServerOptions';
123
126
  import type { Converter } from '../scrapers/_common/Converter';
124
127
  import type { ScraperAndConverterMetadata } from '../scrapers/_common/register/ScraperAndConverterMetadata';
125
128
  import type { ScraperConstructor } from '../scrapers/_common/register/ScraperConstructor';
@@ -192,6 +195,7 @@ import type { string_css_property } from '../types/typeAliases';
192
195
  import type { string_css_value } from '../types/typeAliases';
193
196
  import type { string_css_selector } from '../types/typeAliases';
194
197
  import type { string_url } from '../types/typeAliases';
198
+ import type { string_promptbook_server_url } from '../types/typeAliases';
195
199
  import type { string_base_url } from '../types/typeAliases';
196
200
  import type { string_pipeline_root_url } from '../types/typeAliases';
197
201
  import type { string_pipeline_url } from '../types/typeAliases';
@@ -224,6 +228,7 @@ import type { string_dirname } from '../types/typeAliases';
224
228
  import type { string_person_fullname } from '../types/typeAliases';
225
229
  import type { string_person_profile } from '../types/typeAliases';
226
230
  import type { string_license } from '../types/typeAliases';
231
+ import type { string_legal_entity } from '../types/typeAliases';
227
232
  import type { string_attribute } from '../types/typeAliases';
228
233
  import type { string_attribute_value_scope } from '../types/typeAliases';
229
234
  import type { string_color } from '../types/typeAliases';
@@ -235,6 +240,7 @@ import type { string_postprocessing_function_name } from '../types/typeAliases';
235
240
  import type { id } from '../types/typeAliases';
236
241
  import type { task_id } from '../types/typeAliases';
237
242
  import type { string_token } from '../types/typeAliases';
243
+ import type { string_promptbook_token } from '../types/typeAliases';
238
244
  import type { string_license_token } from '../types/typeAliases';
239
245
  import type { string_password } from '../types/typeAliases';
240
246
  import type { string_ssh_key } from '../types/typeAliases';
@@ -395,20 +401,23 @@ export type { ScriptTaskJson };
395
401
  export type { SimpleTaskJson };
396
402
  export type { TaskJson };
397
403
  export type { PipelineString };
404
+ export type { PrepareAndScrapeOptions };
398
405
  export type { paths };
399
406
  export type { webhooks };
400
407
  export type { components };
401
408
  export type { $defs };
402
409
  export type { operations };
403
- export type { PrepareAndScrapeOptions };
404
- export type { PromptbookServer_Identification };
405
- export type { PromptbookServer_ApplicationIdentification };
406
- export type { PromptbookServer_AnonymousIdentification };
410
+ export type { RemoteServer };
411
+ export type { Identification };
412
+ export type { ApplicationModeIdentification };
413
+ export type { AnonymousModeIdentification };
407
414
  export type { RemoteClientOptions };
408
415
  export type { RemoteServerOptions };
409
416
  export type { AnonymousRemoteServerOptions };
410
417
  export type { ApplicationRemoteServerOptions };
411
418
  export type { ApplicationRemoteServerClientOptions };
419
+ export type { LoginRequest };
420
+ export type { LoginResponse };
412
421
  export type { Converter };
413
422
  export type { ScraperAndConverterMetadata };
414
423
  export type { ScraperConstructor };
@@ -481,6 +490,7 @@ export type { string_css_property };
481
490
  export type { string_css_value };
482
491
  export type { string_css_selector };
483
492
  export type { string_url };
493
+ export type { string_promptbook_server_url };
484
494
  export type { string_base_url };
485
495
  export type { string_pipeline_root_url };
486
496
  export type { string_pipeline_url };
@@ -513,6 +523,7 @@ export type { string_dirname };
513
523
  export type { string_person_fullname };
514
524
  export type { string_person_profile };
515
525
  export type { string_license };
526
+ export type { string_legal_entity };
516
527
  export type { string_attribute };
517
528
  export type { string_attribute_value_scope };
518
529
  export type { string_color };
@@ -524,6 +535,7 @@ export type { string_postprocessing_function_name };
524
535
  export type { id };
525
536
  export type { task_id };
526
537
  export type { string_token };
538
+ export type { string_promptbook_token };
527
539
  export type { string_license_token };
528
540
  export type { string_password };
529
541
  export type { string_ssh_key };
@@ -8,7 +8,6 @@ import type { Command as Program } from 'commander';
8
8
  */
9
9
  export declare function $initializeLoginCommand(program: Program): void;
10
10
  /**
11
- * TODO: Pass remote server URL (and path)
12
11
  * TODO: Implement non-interactive login
13
12
  * Note: [💞] Ignore a discrepancy between file name and entity name
14
13
  * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
@@ -0,0 +1,7 @@
1
+ import { Command } from 'commander';
2
+ /**
3
+ * Note: `$` is used to indicate that this function is not a pure function - it registers an option in the CLI
4
+ *
5
+ * @private utility of CLI
6
+ */
7
+ export declare function $addGlobalOptionsToCommand(command: Command): void;
@@ -0,0 +1,28 @@
1
+ import type { LlmExecutionToolsWithTotalUsage } from '../../llm-providers/_common/utils/count-total-usage/LlmExecutionToolsWithTotalUsage';
2
+ import type { CacheLlmToolsOptions } from '../../llm-providers/_common/utils/cache/CacheLlmToolsOptions';
3
+ import type { string_promptbook_server_url } from '../../types/typeAliases';
4
+ type ProvideLlmToolsForCliOptions = Pick<CacheLlmToolsOptions, 'isCacheReloaded'> & {
5
+ /**
6
+ * If true, user will be always prompted for login
7
+ *
8
+ * Note: This is used in `ptbk login` command
9
+ */
10
+ isLoginloaded?: true;
11
+ /**
12
+ * CLI options
13
+ */
14
+ cliOptions: {
15
+ verbose: boolean;
16
+ interactive: boolean;
17
+ provider: 'BYOK' | 'BRING_YOUR_OWN_KEYS' | 'REMOTE_SERVER' | 'RS' | string;
18
+ remoteServerUrl: string_promptbook_server_url;
19
+ };
20
+ };
21
+ /**
22
+ * @private utility of CLI
23
+ */
24
+ export declare function $provideLlmToolsForCli(options: ProvideLlmToolsForCliOptions): Promise<{
25
+ strategy: 'BRING_YOUR_OWN_KEYS' | 'REMOTE_SERVER';
26
+ llm: LlmExecutionToolsWithTotalUsage;
27
+ }>;
28
+ export {};
@@ -2,4 +2,4 @@
2
2
  /**
3
3
  * Note: [🔺] Purpose of this file is to test and use the current CLI in development environment
4
4
  */
5
- import '../../_packages/cli.index.ts';
5
+ import '../../_packages/cli.index';
@@ -1,6 +1,8 @@
1
1
  import type { PipelineTaskCommandParser } from '../_common/types/CommandParser';
2
2
  import type { ExpectCommand } from './ExpectCommand';
3
3
  /**
4
+ import { WrappedError } from '../../errors/WrappedError';
5
+ import { assertsError } from '../../errors/assertsError';
4
6
  * Parses the expect command
5
7
  *
6
8
  * @see `documentationUrl` for more details
@@ -1,8 +1,9 @@
1
1
  import type { CsvSettings } from './formats/csv/CsvSettings';
2
2
  import type { IntermediateFilesStrategy } from './types/IntermediateFilesStrategy';
3
+ import type { string_app_id } from './types/typeAliases';
3
4
  import type { string_email } from './types/typeAliases';
4
5
  import type { string_name } from './types/typeAliases';
5
- import type { string_url_image } from './types/typeAliases';
6
+ import type { string_promptbook_server_url } from './types/typeAliases';
6
7
  /**
7
8
  * Warning message for the generated sections and files files
8
9
  *
@@ -37,22 +38,6 @@ export declare const ADMIN_GITHUB_NAME: string_name;
37
38
  * @public exported from `@promptbook/core`
38
39
  */
39
40
  export declare const CLAIM = "It's time for a paradigm shift. The future of software in plain English, French or Latin";
40
- /**
41
- * Logo for the light theme
42
- *
43
- * TODO: [🗽] Unite branding and make single place for it
44
- *
45
- * @public exported from `@promptbook/core`
46
- */
47
- export declare const LOGO_LIGHT_SRC: string_url_image;
48
- /**
49
- * Logo for the dark theme
50
- *
51
- * TODO: [🗽] Unite branding and make single place for it
52
- *
53
- * @public exported from `@promptbook/core`
54
- */
55
- export declare const LOGO_DARK_SRC: string_url_image;
56
41
  /**
57
42
  * When the title is not provided, the default title is used
58
43
  *
@@ -89,6 +74,12 @@ export declare const DEFAULT_MAX_FILE_SIZE: number;
89
74
  * @private within the repository
90
75
  */
91
76
  export declare const GENERATOR_WARNING_BY_PROMPTBOOK_CLI = "\u26A0\uFE0F WARNING: This code has been generated by `@promptbook/cli` so that any manual changes will be overwritten";
77
+ /**
78
+ * Warning message for the automatically generated sections of `.env` files
79
+ *
80
+ * @private within the repository
81
+ */
82
+ export declare const GENERATOR_WARNING_IN_ENV = "Note: Added by Promptbook";
92
83
  /**
93
84
  * The maximum number of iterations for a loops
94
85
  *
@@ -114,6 +105,7 @@ export declare const VALUE_STRINGS: {
114
105
  readonly infinity: "(infinity; ∞)";
115
106
  readonly negativeInfinity: "(negative infinity; -∞)";
116
107
  readonly unserializable: "(unserializable value)";
108
+ readonly circular: "(circular JSON)";
117
109
  };
118
110
  /**
119
111
  * Small number limit
@@ -208,6 +200,18 @@ export declare const DEFAULT_EXECUTION_CACHE_DIRNAME = "./.promptbook/execution-
208
200
  * @public exported from `@promptbook/core`
209
201
  */
210
202
  export declare const DEFAULT_SCRAPE_CACHE_DIRNAME = "./.promptbook/scrape-cache";
203
+ /**
204
+ * Id of application for the CLI when using remote server
205
+ *
206
+ * @public exported from `@promptbook/core`
207
+ */
208
+ export declare const CLI_APP_ID: string_app_id;
209
+ /**
210
+ * Id of application for the playground
211
+ *
212
+ * @public exported from `@promptbook/core`
213
+ */
214
+ export declare const PLAYGROUND_APP_ID: string_app_id;
211
215
  /**
212
216
  * The name of the builded pipeline collection made by CLI `ptbk make` and for lookup in `createCollectionFromDirectory`
213
217
  *
@@ -224,17 +228,11 @@ export declare const MOMENT_ARG_THRESHOLDS: {
224
228
  readonly ss: 3;
225
229
  };
226
230
  /**
227
- * @@@
228
- *
229
- * @public exported from `@promptbook/core`
230
- */
231
- export declare const DEFAULT_REMOTE_URL = "https://api.pavolhejny.com/";
232
- /**
233
- * @@@
231
+ * Default remote server URL for the Promptbook
234
232
  *
235
233
  * @public exported from `@promptbook/core`
236
234
  */
237
- export declare const DEFAULT_REMOTE_URL_PATH = "/promptbook/socket.io";
235
+ export declare const DEFAULT_REMOTE_SERVER_URL: string_promptbook_server_url;
238
236
  /**
239
237
  * @@@
240
238
  *
@@ -281,5 +279,5 @@ export declare const IS_PIPELINE_LOGIC_VALIDATED: boolean;
281
279
  export declare const IS_COST_PREVENTED: boolean;
282
280
  /**
283
281
  * Note: [💞] Ignore a discrepancy between file name and entity name
284
- * TODO: [🧠][🧜‍♂️] Maybe join remoteUrl and path into single value
282
+ * TODO: [🧠][🧜‍♂️] Maybe join remoteServerUrl and path into single value
285
283
  */
@@ -1,5 +1,6 @@
1
1
  import { CsvFormatError } from '../formats/csv/CsvFormatError';
2
2
  import { AbstractFormatError } from './AbstractFormatError';
3
+ import { AuthenticationError } from './AuthenticationError';
3
4
  import { CollectionError } from './CollectionError';
4
5
  import { EnvironmentMismatchError } from './EnvironmentMismatchError';
5
6
  import { ExpectError } from './ExpectError';
@@ -12,7 +13,9 @@ import { ParseError } from './ParseError';
12
13
  import { PipelineExecutionError } from './PipelineExecutionError';
13
14
  import { PipelineLogicError } from './PipelineLogicError';
14
15
  import { PipelineUrlError } from './PipelineUrlError';
16
+ import { PromptbookFetchError } from './PromptbookFetchError';
15
17
  import { UnexpectedError } from './UnexpectedError';
18
+ import { WrappedError } from './WrappedError';
16
19
  /**
17
20
  * Index of all custom errors
18
21
  *
@@ -33,7 +36,10 @@ export declare const PROMPTBOOK_ERRORS: {
33
36
  readonly PipelineExecutionError: typeof PipelineExecutionError;
34
37
  readonly PipelineLogicError: typeof PipelineLogicError;
35
38
  readonly PipelineUrlError: typeof PipelineUrlError;
39
+ readonly AuthenticationError: typeof AuthenticationError;
40
+ readonly PromptbookFetchError: typeof PromptbookFetchError;
36
41
  readonly UnexpectedError: typeof UnexpectedError;
42
+ readonly WrappedError: typeof WrappedError;
37
43
  };
38
44
  /**
39
45
  * Index of all javascript errors
@@ -78,7 +84,10 @@ export declare const ALL_ERRORS: {
78
84
  readonly PipelineExecutionError: typeof PipelineExecutionError;
79
85
  readonly PipelineLogicError: typeof PipelineLogicError;
80
86
  readonly PipelineUrlError: typeof PipelineUrlError;
87
+ readonly AuthenticationError: typeof AuthenticationError;
88
+ readonly PromptbookFetchError: typeof PromptbookFetchError;
81
89
  readonly UnexpectedError: typeof UnexpectedError;
90
+ readonly WrappedError: typeof WrappedError;
82
91
  };
83
92
  /**
84
93
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -0,0 +1,9 @@
1
+ /**
2
+ * AuthenticationError is thrown from login function which is dependency of remote server
3
+ *
4
+ * @public exported from `@promptbook/core`
5
+ */
6
+ export declare class AuthenticationError extends Error {
7
+ readonly name = "AuthenticationError";
8
+ constructor(message: string);
9
+ }
@@ -10,5 +10,5 @@ export declare class PipelineExecutionError extends Error {
10
10
  constructor(message: string);
11
11
  }
12
12
  /**
13
- * TODO: !!!!!! Add id to all errors
13
+ * TODO: [🧠][🌂] Add id to all errors
14
14
  */
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Error thrown when a fetch request fails
3
+ *
4
+ * @public exported from `@promptbook/core`
5
+ */
6
+ export declare class PromptbookFetchError extends Error {
7
+ readonly name = "PromptbookFetchError";
8
+ constructor(message: string);
9
+ }
@@ -0,0 +1,10 @@
1
+ import type { really_any } from '../utils/organization/really_any';
2
+ /**
3
+ * This error type indicates that somewhere in the code non-Error object was thrown and it was wrapped into the `WrappedError`
4
+ *
5
+ * @public exported from `@promptbook/core`
6
+ */
7
+ export declare class WrappedError extends Error {
8
+ readonly name = "WrappedError";
9
+ constructor(whatWasThrown: really_any);
10
+ }
@@ -0,0 +1,11 @@
1
+ import type { really_unknown } from '../utils/organization/really_unknown';
2
+ /**
3
+ * Helper used in catch blocks to assert that the error is an instance of `Error`
4
+ *
5
+ * @param whatWasThrown Any object that was thrown
6
+ * @returns Nothing if the error is an instance of `Error`
7
+ * @throws `WrappedError` or `UnexpectedError` if the error is not standard
8
+ *
9
+ * @private within the repository
10
+ */
11
+ export declare function assertsError(whatWasThrown: really_unknown): asserts whatWasThrown is Error;
@@ -7,6 +7,6 @@ import type { string_url } from '../types/typeAliases';
7
7
  *
8
8
  * It is used in theese places:
9
9
  * - Fetching knowledge sources
10
- * - Callbacks from remote server ([👩🏾‍🤝‍🧑🏾] Not yet implemented)
10
+ * - Callbacks from remote server
11
11
  */
12
12
  export type PromptbookFetch = (url: string_url, init?: RequestInit) => Promise<Response>;
@@ -0,0 +1,12 @@
1
+ import type { string_filename } from '../../../types/typeAliases';
2
+ /**
3
+ * Provides the path to the `.env` file
4
+ *
5
+ * Note: `$` is used to indicate that this function is not a pure function - it uses filesystem to access `.env` file
6
+ *
7
+ * @private within the repository - for CLI utils
8
+ */
9
+ export declare function $provideEnvFilename(): Promise<string_filename | null>;
10
+ /**
11
+ * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
12
+ */
@@ -3,6 +3,7 @@ import type { LlmToolsConfiguration } from './LlmToolsConfiguration';
3
3
  * @@@
4
4
  *
5
5
  * @@@ .env
6
+ * Note: `$` is used to indicate that this function is not a pure function - it uses filesystem to access `.env` file
6
7
  *
7
8
  * It looks for environment variables:
8
9
  * - `process.env.OPENAI_API_KEY`
@@ -14,12 +15,5 @@ import type { LlmToolsConfiguration } from './LlmToolsConfiguration';
14
15
  */
15
16
  export declare function $provideLlmToolsConfigurationFromEnv(): Promise<LlmToolsConfiguration>;
16
17
  /**
17
- * TODO: [🧠][🪁] Maybe do allow to do auto-install if package not registered and not found
18
- * TODO: Add Azure OpenAI
19
- * TODO: [🧠][🍛]
20
- * TODO: [🧠] Is there some meaningfull way how to test this util
21
18
  * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
22
- * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
23
- * TODO: This should be maybe not under `_common` but under `utils`
24
- * TODO: [🧠][⚛] Maybe pass env as argument
25
- * TODO: [®] DRY Register logic */
19
+ */
@@ -12,6 +12,8 @@ type GetLlmToolsForTestingAndScriptsAndPlaygroundOptions = CreateLlmToolsFromCon
12
12
  /**
13
13
  * Returns LLM tools for testing purposes
14
14
  *
15
+ * Note: `$` is used to indicate that this function is not a pure function - it uses filesystem to access `.env` file
16
+ *
15
17
  * @private within the repository - JUST FOR TESTS, SCRIPTS AND PLAYGROUND
16
18
  */
17
19
  export declare function $provideLlmToolsForTestingAndScriptsAndPlayground(options?: GetLlmToolsForTestingAndScriptsAndPlaygroundOptions): Promise<LlmExecutionToolsWithTotalUsage>;