@promptbook/cli 0.52.0-8 → 0.52.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 (50) hide show
  1. package/README.md +1 -13
  2. package/esm/index.es.js +4 -1
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/_packages/core.index.d.ts +4 -2
  5. package/esm/typings/_packages/utils.index.d.ts +2 -0
  6. package/esm/typings/errors/PromptbookLibraryError.d.ts +7 -0
  7. package/esm/typings/execution/ExecutionTools.d.ts +5 -3
  8. package/esm/typings/execution/plugins/llm-execution-tools/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +0 -1
  9. package/esm/typings/execution/plugins/llm-execution-tools/azure-openai/AzureOpenAiExecutionTools.d.ts +0 -1
  10. package/esm/typings/execution/plugins/llm-execution-tools/langtail/LangtailExecutionTools.d.ts +0 -3
  11. package/esm/typings/execution/plugins/llm-execution-tools/openai/OpenAiExecutionTools.d.ts +1 -1
  12. package/esm/typings/execution/plugins/llm-execution-tools/remote/RemoteLlmExecutionTools.d.ts +1 -1
  13. package/esm/typings/execution/plugins/llm-execution-tools/remote/startRemoteServer.d.ts +1 -0
  14. package/esm/typings/execution/utils/forEachAsync.d.ts +18 -0
  15. package/esm/typings/library/constructors/createPromptbookLibraryFromDirectory.d.ts +28 -4
  16. package/esm/typings/library/constructors/createPromptbookLibraryFromDirectory.test.d.ts +1 -0
  17. package/esm/typings/library/constructors/createPromptbookLibraryFromPromise.d.ts +2 -2
  18. package/esm/typings/library/constructors/createPromptbookLibraryFromPromise.test.d.ts +1 -0
  19. package/esm/typings/library/constructors/createPromptbookLibraryFromSources.test.d.ts +1 -0
  20. package/esm/typings/library/constructors/createPromptbookLibraryFromUrl.d.ts +22 -5
  21. package/esm/typings/library/constructors/justTestFsImport.d.ts +7 -0
  22. package/esm/typings/types/Prompt.d.ts +1 -1
  23. package/esm/typings/types/typeAliases.d.ts +2 -2
  24. package/package.json +4 -4
  25. package/umd/index.umd.js +4 -1
  26. package/umd/index.umd.js.map +1 -1
  27. package/umd/typings/_packages/core.index.d.ts +4 -2
  28. package/umd/typings/_packages/utils.index.d.ts +2 -0
  29. package/umd/typings/errors/PromptbookLibraryError.d.ts +7 -0
  30. package/umd/typings/execution/ExecutionTools.d.ts +5 -3
  31. package/umd/typings/execution/plugins/llm-execution-tools/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +0 -1
  32. package/umd/typings/execution/plugins/llm-execution-tools/azure-openai/AzureOpenAiExecutionTools.d.ts +0 -1
  33. package/umd/typings/execution/plugins/llm-execution-tools/langtail/LangtailExecutionTools.d.ts +0 -3
  34. package/umd/typings/execution/plugins/llm-execution-tools/openai/OpenAiExecutionTools.d.ts +1 -1
  35. package/umd/typings/execution/plugins/llm-execution-tools/remote/RemoteLlmExecutionTools.d.ts +1 -1
  36. package/umd/typings/execution/plugins/llm-execution-tools/remote/startRemoteServer.d.ts +1 -0
  37. package/umd/typings/execution/utils/forEachAsync.d.ts +18 -0
  38. package/umd/typings/library/constructors/createPromptbookLibraryFromDirectory.d.ts +28 -4
  39. package/umd/typings/library/constructors/createPromptbookLibraryFromDirectory.test.d.ts +1 -0
  40. package/umd/typings/library/constructors/createPromptbookLibraryFromPromise.d.ts +2 -2
  41. package/umd/typings/library/constructors/createPromptbookLibraryFromPromise.test.d.ts +1 -0
  42. package/umd/typings/library/constructors/createPromptbookLibraryFromSources.test.d.ts +1 -0
  43. package/umd/typings/library/constructors/createPromptbookLibraryFromUrl.d.ts +22 -5
  44. package/umd/typings/library/constructors/justTestFsImport.d.ts +7 -0
  45. package/umd/typings/types/Prompt.d.ts +1 -1
  46. package/umd/typings/types/typeAliases.d.ts +2 -2
  47. package/esm/typings/wizzard/Wizzard.d.ts +0 -4
  48. package/esm/typings/wizzard/sample.d.ts +0 -6
  49. package/umd/typings/wizzard/Wizzard.d.ts +0 -4
  50. package/umd/typings/wizzard/sample.d.ts +0 -6
@@ -10,20 +10,44 @@ type CreatePromptbookLibraryFromDirectoryOptions = {
10
10
  * @default true
11
11
  */
12
12
  isRecursive?: boolean;
13
+ /**
14
+ * If true, the library creation outputs information about each file it reads
15
+ *
16
+ * @default false
17
+ */
18
+ isVerbose?: boolean;
19
+ /**
20
+ * If true, directory will be scanned only when needed not during the construction
21
+ *
22
+ * @default false
23
+ */
24
+ isLazyLoaded?: boolean;
25
+ /**
26
+ * If true, whole library creation crashes on error in any promptbook
27
+ * If true and isLazyLoaded is true, the error is thrown on first access to the promptbook
28
+ *
29
+ * @default true
30
+ */
31
+ isCrashOnError?: boolean;
13
32
  };
14
33
  /**
15
34
  * Constructs Promptbook from given directory
16
35
  *
17
36
  * Note: Works only in Node.js environment because it reads the file system
18
- * Note: The function does NOT return promise it returns the library directly which dynamically loads promptbooks when needed
19
- * SO during the construction syntax and logic sources IS NOT validated
20
37
  *
21
38
  * @param path - path to the directory with promptbooks
22
39
  * @param options - Misc options for the library
23
40
  * @returns PromptbookLibrary
24
41
  */
25
- export declare function createPromptbookLibraryFromDirectory(path: string_folder_path, options?: CreatePromptbookLibraryFromDirectoryOptions): PromptbookLibrary;
42
+ export declare function createPromptbookLibraryFromDirectory(path: string_folder_path, options?: CreatePromptbookLibraryFromDirectoryOptions): Promise<PromptbookLibrary>;
26
43
  export {};
27
44
  /***
28
- * TODO: [🍓][🚯] !!! Add to README and samples + maybe make `@promptbook/library` package
45
+ * TODO: [🧠] Maybe do not do hacks like [1] and just create package @promptbook/node
46
+ * [🍓][🚯] maybe make `@promptbook/library` package
47
+ * TODO: Fix the dynamic import issue in Webpack (! Not working !)
48
+ * > ./node_modules/@promptbook/core/esm/index.es.js
49
+ * > Critical dependency: the request of a dependency is an expression
50
+ *
51
+ * Note: [1] Using require(just('fs/promises')) to allow
52
+ * the `@promptbook/core` work for both Node.js and browser environments
29
53
  */
@@ -14,11 +14,11 @@ import { PromptbookLibrary } from '../PromptbookLibrary';
14
14
  * Note: The function does NOT return promise it returns the library directly which waits for the sources to be resolved
15
15
  * when error occurs in given promise or factory function, it is thrown during `listPromptbooks` or `getPromptbookByUrl` call
16
16
  *
17
+ * Note: Consider using `createPromptbookLibraryFromDirectory` or `createPromptbookLibraryFromUrl`
17
18
  *
18
19
  * @param promptbookSourcesPromiseOrFactory
19
20
  * @returns PromptbookLibrary
20
- *
21
- * @deprecated Consider using `createPromptbookLibraryFromUrl` or `createPromptbookLibraryFromDirectory`
21
+ * @private Just internal tool for other constructor functions
22
22
  */
23
23
  export declare function createPromptbookLibraryFromPromise(promptbookSourcesPromiseOrFactory: Promise<Array<PromptbookJson | PromptbookString>> | (() => Promise<Array<PromptbookJson | PromptbookString>>)): PromptbookLibrary;
24
24
  /***
@@ -1,13 +1,30 @@
1
+ import { string_url } from '../../types/typeAliases';
1
2
  import { PromptbookLibrary } from '../PromptbookLibrary';
3
+ /**
4
+ * Options for `createPromptbookLibraryFromDirectory` function
5
+ */
6
+ type CreatePromptbookLibraryFromUrlyOptions = {
7
+ /**
8
+ * If true, the library creation outputs information about each file it reads
9
+ *
10
+ * @default false
11
+ */
12
+ isVerbose?: boolean;
13
+ /**
14
+ * If true, directory will be scanned only when needed not during the construction
15
+ *
16
+ * @default false
17
+ */
18
+ isLazyLoaded?: boolean;
19
+ };
2
20
  /**
3
21
  * Constructs Promptbook from remote Promptbase URL
4
- *
5
- * Note: The function does NOT return promise it returns the library directly which dynamically loads promptbooks when needed
6
- * SO during the construction syntax and logic sources IS NOT validated
7
- *
22
+
8
23
  * @returns PromptbookLibrary
9
24
  */
10
- export declare function createPromptbookLibraryFromUrl(): PromptbookLibrary;
25
+ export declare function createPromptbookLibraryFromUrl(url: string_url | URL, options: CreatePromptbookLibraryFromUrlyOptions): Promise<PromptbookLibrary>;
26
+ export {};
11
27
  /***
28
+ * TODO: [⚖] Compatible with remote server
12
29
  * TODO: [🍓][🚯] !!! Add to README and samples + maybe make `@promptbook/library` package
13
30
  */
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Just testing imports and compatibility
3
+ */
4
+ export declare function justTestFsImport(): Promise<void>;
5
+ /**
6
+ * TODO: !!! Remove this file
7
+ */
@@ -39,7 +39,7 @@ export type Prompt = {
39
39
  /**
40
40
  * Unique identifier of the promptbook with specific template name as hash
41
41
  *
42
- * @example https://promptbook.webgpt.com/cs/write-website-content.ptbk.md@v2.4.15#keywords
42
+ * @example https://promptbook.webgpt.com/cs/write-website-content.ptbk.md#keywords
43
43
  */
44
44
  readonly promptbookUrl: string_promptbook_url_with_hashtemplate;
45
45
  /**
@@ -179,13 +179,13 @@ export type string_url = string;
179
179
  /**
180
180
  * Semantic helper
181
181
  *
182
- * For example `"https://promptbook.webgpt.com/cs/write-website-content.ptbk.md@v2.4.15"`
182
+ * For example `"https://promptbook.webgpt.com/cs/write-website-content.ptbk.md"`
183
183
  */
184
184
  export type string_promptbook_url = string;
185
185
  /**
186
186
  * Semantic helper
187
187
  *
188
- * For example `"https://promptbook.webgpt.com/cs/write-website-content.ptbk.md@v2.4.15#keywords"`
188
+ * For example `"https://promptbook.webgpt.com/cs/write-website-content.ptbk.md#keywords"`
189
189
  */
190
190
  export type string_promptbook_url_with_hashtemplate = string;
191
191
  /**
@@ -1,4 +0,0 @@
1
- export declare const Wizzard: any;
2
- /**
3
- * TODO: [🧙‍♂️]
4
- */
@@ -1,6 +0,0 @@
1
- export {};
2
- /**
3
- * TODO: [🧙‍♂️]
4
- url, sources nebo folder
5
- * TODO: [🧠] OpenAi apiKey vs token
6
- */
@@ -1,4 +0,0 @@
1
- export declare const Wizzard: any;
2
- /**
3
- * TODO: [🧙‍♂️]
4
- */
@@ -1,6 +0,0 @@
1
- export {};
2
- /**
3
- * TODO: [🧙‍♂️]
4
- url, sources nebo folder
5
- * TODO: [🧠] OpenAi apiKey vs token
6
- */