@promptbook/vercel 0.78.4 → 0.80.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.
- package/README.md +4 -0
- package/esm/index.es.js +225 -143
- package/esm/index.es.js.map +1 -1
- package/esm/typings/books/index.d.ts +6 -6
- package/esm/typings/src/_packages/core.index.d.ts +4 -2
- package/esm/typings/src/_packages/types.index.d.ts +10 -0
- package/esm/typings/src/_packages/utils.index.d.ts +4 -0
- package/esm/typings/src/cli/cli-commands/runInteractiveChatbot.d.ts +32 -0
- package/esm/typings/src/commands/_common/types/CommandParser.d.ts +5 -2
- package/esm/typings/src/config.d.ts +0 -25
- package/esm/typings/src/constants.d.ts +35 -0
- package/esm/typings/src/conversion/pipelineJsonToString.d.ts +1 -0
- package/esm/typings/src/conversion/pipelineStringToJsonSync.d.ts +1 -0
- package/esm/typings/src/formfactors/generator/GeneratorFormfactorDefinition.d.ts +6 -1
- package/esm/typings/src/formfactors/index.d.ts +12 -2
- package/esm/typings/src/formfactors/matcher/MatcherFormfactorDefinition.d.ts +6 -1
- package/esm/typings/src/high-level-abstractions/_common/HighLevelAbstraction.d.ts +20 -0
- package/esm/typings/src/high-level-abstractions/implicit-formfactor/ImplicitFormfactorHla.d.ts +10 -0
- package/esm/typings/src/high-level-abstractions/index.d.ts +44 -0
- package/esm/typings/src/high-level-abstractions/quick-chatbot/QuickChatbotHla.d.ts +10 -0
- package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/remote/startRemoteServer.d.ts +1 -1
- package/esm/typings/src/prepare/prepareTasks.d.ts +1 -0
- package/esm/typings/src/types/typeAliases.d.ts +1 -1
- package/esm/typings/src/utils/normalization/orderJson.d.ts +21 -0
- package/esm/typings/src/utils/normalization/orderJson.test.d.ts +4 -0
- package/esm/typings/src/utils/organization/keepTypeImported.d.ts +9 -0
- package/esm/typings/src/utils/serialization/$deepFreeze.d.ts +1 -1
- package/esm/typings/src/utils/serialization/checkSerializableAsJson.d.ts +20 -2
- package/esm/typings/src/utils/serialization/deepClone.test.d.ts +1 -0
- package/esm/typings/src/utils/serialization/exportJson.d.ts +29 -0
- package/esm/typings/src/utils/serialization/isSerializableAsJson.d.ts +2 -1
- package/package.json +2 -2
- package/umd/index.umd.js +225 -143
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/utils/serialization/$asDeeplyFrozenSerializableJson.d.ts +0 -17
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { $PipelineJson } from '../../commands/_common/types/CommandParser';
|
|
2
|
+
/**
|
|
3
|
+
* Allow to define chatbot with no need to write full interface
|
|
4
|
+
*
|
|
5
|
+
* @private
|
|
6
|
+
*/
|
|
7
|
+
export declare const QuickChatbotHla: {
|
|
8
|
+
type: "SYNC";
|
|
9
|
+
$applyToPipelineJson($pipelineJson: $PipelineJson): void;
|
|
10
|
+
};
|
|
@@ -54,7 +54,7 @@ export declare class RemoteLlmExecutionTools<TCustomOptions = undefined> impleme
|
|
|
54
54
|
private callCommonModel;
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
|
-
* TODO: Maybe use `$
|
|
57
|
+
* TODO: Maybe use `$exportJson`
|
|
58
58
|
* TODO: [🧠][🛍] Maybe not `isAnonymous: boolean` BUT `mode: 'ANONYMOUS'|'COLLECTION'`
|
|
59
59
|
* TODO: [🍓] Allow to list compatible models with each variant
|
|
60
60
|
* TODO: [🗯] RemoteLlmExecutionTools should extend Destroyable and implement IDestroyable
|
|
@@ -11,7 +11,7 @@ import type { RemoteServerOptions } from './interfaces/RemoteServerOptions';
|
|
|
11
11
|
*/
|
|
12
12
|
export declare function startRemoteServer<TCustomOptions = undefined>(options: RemoteServerOptions<TCustomOptions>): IDestroyable;
|
|
13
13
|
/**
|
|
14
|
-
* TODO: Maybe use `$
|
|
14
|
+
* TODO: Maybe use `$exportJson`
|
|
15
15
|
* TODO: [🧠][🛍] Maybe not `isAnonymous: boolean` BUT `mode: 'ANONYMOUS'|'COLLECTION'`
|
|
16
16
|
* TODO: [⚖] Expose the collection to be able to connect to same collection via createCollectionFromUrl
|
|
17
17
|
* TODO: Handle progress - support streaming
|
|
@@ -22,6 +22,7 @@ type PreparedTasks = {
|
|
|
22
22
|
export declare function prepareTasks(pipeline: PrepareTaskInput, tools: Pick<ExecutionTools, 'llm' | 'fs' | 'scrapers'>, options: PrepareAndScrapeOptions): Promise<PreparedTasks>;
|
|
23
23
|
export {};
|
|
24
24
|
/**
|
|
25
|
+
* TODO: [😂] Adding knowledge should be convert to async high-level abstractions, simmilar thing with expectations to sync high-level abstractions
|
|
25
26
|
* TODO: [🧠] Add context to each task (if missing)
|
|
26
27
|
* TODO: [🧠] What is better name `prepareTask` or `prepareTaskAndParameters`
|
|
27
28
|
* TODO: [♨][main] !!! Prepare index the examples and maybe tasks
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { JsonArray, JsonObject } from 'type-fest';
|
|
2
|
+
/**
|
|
3
|
+
* Options for the `orderJson` function
|
|
4
|
+
*/
|
|
5
|
+
export type OrderJsonOptions<TObject extends JsonObject | JsonArray> = {
|
|
6
|
+
/**
|
|
7
|
+
* Value to checked, ordered and deeply frozen
|
|
8
|
+
*/
|
|
9
|
+
value: TObject;
|
|
10
|
+
/**
|
|
11
|
+
* Order of the object properties
|
|
12
|
+
*/
|
|
13
|
+
order: Array<keyof TObject>;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Orders JSON object by keys
|
|
17
|
+
*
|
|
18
|
+
* @returns The same type of object as the input re-ordered
|
|
19
|
+
* @public exported from `@promptbook/utils`
|
|
20
|
+
*/
|
|
21
|
+
export declare function orderJson<TObject extends JsonObject | JsonArray>(options: OrderJsonOptions<TObject>): TObject;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Just says that the type is used but `organize-imports-cli` does not recognize it.
|
|
3
|
+
* [🤛] This is a workaround for the issue.
|
|
4
|
+
*
|
|
5
|
+
* @param value any values
|
|
6
|
+
* @returns void
|
|
7
|
+
* @private within the repository
|
|
8
|
+
*/
|
|
9
|
+
export declare function keepTypeImported<TTypeToKeep>(): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ReadonlyDeep } from 'type-fest';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Freezes the given object and all its nested objects recursively
|
|
4
4
|
*
|
|
5
5
|
* Note: `$` is used to indicate that this function is not a pure function - it mutates given object
|
|
6
6
|
* Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
|
|
@@ -1,4 +1,22 @@
|
|
|
1
1
|
import type { string_name } from '../../types/typeAliases';
|
|
2
|
+
import type { really_unknown } from '../organization/really_unknown';
|
|
3
|
+
/**
|
|
4
|
+
* Options for the `checkSerializableAsJson` function
|
|
5
|
+
*/
|
|
6
|
+
export type CheckSerializableAsJsonOptions = {
|
|
7
|
+
/**
|
|
8
|
+
* Value to be checked
|
|
9
|
+
*/
|
|
10
|
+
value: really_unknown;
|
|
11
|
+
/**
|
|
12
|
+
* Semantic name of the value for debugging purposes
|
|
13
|
+
*/
|
|
14
|
+
name?: string_name;
|
|
15
|
+
/**
|
|
16
|
+
* Message alongside the value for debugging purposes
|
|
17
|
+
*/
|
|
18
|
+
message?: string;
|
|
19
|
+
};
|
|
2
20
|
/**
|
|
3
21
|
* Checks if the value is [🚉] serializable as JSON
|
|
4
22
|
* If not, throws an UnexpectedError with a rich error message and tracking
|
|
@@ -19,9 +37,9 @@ import type { string_name } from '../../types/typeAliases';
|
|
|
19
37
|
* @throws UnexpectedError if the value is not serializable as JSON
|
|
20
38
|
* @public exported from `@promptbook/utils`
|
|
21
39
|
*/
|
|
22
|
-
export declare function checkSerializableAsJson(
|
|
40
|
+
export declare function checkSerializableAsJson(options: CheckSerializableAsJsonOptions): void;
|
|
23
41
|
/**
|
|
24
|
-
* TODO:
|
|
42
|
+
* TODO: Can be return type more type-safe? like `asserts options.value is JsonValue`
|
|
25
43
|
* TODO: [🧠][main] !!! In-memory cache of same values to prevent multiple checks
|
|
26
44
|
* Note: [🐠] This is how `checkSerializableAsJson` + `isSerializableAsJson` together can just retun true/false or rich error message
|
|
27
45
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { JsonArray, JsonObject } from 'type-fest';
|
|
2
|
+
import type { OrderJsonOptions } from '../normalization/orderJson';
|
|
3
|
+
import type { CheckSerializableAsJsonOptions } from './checkSerializableAsJson';
|
|
4
|
+
/**
|
|
5
|
+
* Options for the `$exportJson` function
|
|
6
|
+
*/
|
|
7
|
+
export type ExportJsonOptions<TObject> = CheckSerializableAsJsonOptions & Partial<Pick<OrderJsonOptions<TObject & (JsonObject | JsonArray)>, 'order'>> & {
|
|
8
|
+
/**
|
|
9
|
+
* Value to be checked, ordered and deeply frozen
|
|
10
|
+
*/
|
|
11
|
+
value: TObject;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Utility to export a JSON object from a function
|
|
15
|
+
*
|
|
16
|
+
* 1) Checks if the value is serializable as JSON
|
|
17
|
+
* 2) Makes a deep clone of the object
|
|
18
|
+
* 2) Orders the object properties
|
|
19
|
+
* 2) Deeply freezes the cloned object
|
|
20
|
+
*
|
|
21
|
+
* Note: This function does not mutates the given object
|
|
22
|
+
*
|
|
23
|
+
* @returns The same type of object as the input but read-only and re-ordered
|
|
24
|
+
* @public exported from `@promptbook/utils`
|
|
25
|
+
*/
|
|
26
|
+
export declare function exportJson<TObject>(options: ExportJsonOptions<TObject>): TObject;
|
|
27
|
+
/**
|
|
28
|
+
* TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
29
|
+
*/
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { JsonValue } from 'type-fest';
|
|
1
2
|
/**
|
|
2
3
|
* Tests if the value is [🚉] serializable as JSON
|
|
3
4
|
*
|
|
@@ -17,7 +18,7 @@
|
|
|
17
18
|
*
|
|
18
19
|
* @public exported from `@promptbook/utils`
|
|
19
20
|
*/
|
|
20
|
-
export declare function isSerializableAsJson(value: unknown):
|
|
21
|
+
export declare function isSerializableAsJson(value: unknown): value is JsonValue;
|
|
21
22
|
/**
|
|
22
23
|
* TODO: [🧠][main] !!! In-memory cache of same values to prevent multiple checks
|
|
23
24
|
* TODO: [🧠][💺] Can be done this on type-level?
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/vercel",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.80.0-0",
|
|
4
4
|
"description": "It's time for a paradigm shift. The future of software in plain English, French or Latin",
|
|
5
5
|
"--note-0": " <- [🐊]",
|
|
6
6
|
"private": false,
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"module": "./esm/index.es.js",
|
|
55
55
|
"typings": "./esm/typings/src/_packages/vercel.index.d.ts",
|
|
56
56
|
"peerDependencies": {
|
|
57
|
-
"@promptbook/core": "0.
|
|
57
|
+
"@promptbook/core": "0.80.0-0"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"colors": "1.4.0",
|