@promptbook/javascript 0.103.0-42 → 0.103.0-43
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/esm/index.es.js +19 -97
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +6 -0
- package/esm/typings/src/_packages/node.index.d.ts +0 -2
- package/esm/typings/src/_packages/types.index.d.ts +14 -0
- package/esm/typings/src/_packages/utils.index.d.ts +2 -0
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +2 -4
- package/esm/typings/src/book-2.0/agent-source/padBook.d.ts +1 -1
- package/esm/typings/src/book-2.0/agent-source/string_book.d.ts +1 -0
- package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/AvatarProfile.d.ts +1 -1
- package/esm/typings/src/book-components/BookEditor/BookEditor.d.ts +1 -1
- package/esm/typings/src/book-components/Chat/save/_common/ChatSaveFormatDefinition.d.ts +1 -1
- package/esm/typings/src/book-components/Chat/types/ChatParticipant.d.ts +1 -1
- package/esm/typings/src/book-components/Qr/BrandedQrCode.d.ts +1 -1
- package/esm/typings/src/book-components/Qr/useQrCode.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/_boilerplate.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/about.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/hello.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/list-models.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/list-scrapers.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/login.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/make.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/prettify.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/run.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/start-agents-server.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/start-pipelines-server.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/test-command.d.ts +1 -1
- package/esm/typings/src/cli/common/$addGlobalOptionsToCommand.d.ts +1 -1
- package/esm/typings/src/collection/agent-collection/AgentCollection.d.ts +11 -12
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +55 -0
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema.d.ts +129 -0
- package/esm/typings/src/commands/_common/types/CommandParser.d.ts +1 -1
- package/esm/typings/src/config.d.ts +1 -1
- package/esm/typings/src/errors/0-index.d.ts +3 -0
- package/esm/typings/src/errors/DatabaseError.d.ts +9 -0
- package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +1 -1
- package/esm/typings/src/high-level-abstractions/_common/HighLevelAbstraction.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/$registeredLlmToolsMessage.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/LlmToolsMetadata.d.ts +1 -1
- package/esm/typings/src/llm-providers/agent/Agent.d.ts +5 -2
- package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/agent/AgentOptions.d.ts +4 -2
- package/esm/typings/src/llm-providers/agent/CreateAgentLlmExecutionToolsOptions.d.ts +2 -2
- package/esm/typings/src/llm-providers/agent/createAgentLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/prepare/PrepareAndScrapeOptions.d.ts +1 -0
- package/esm/typings/src/remote-server/startAgentServer.d.ts +2 -2
- package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +0 -19
- package/esm/typings/src/storage/env-storage/$EnvStorage.d.ts +1 -1
- package/esm/typings/src/transpilers/_common/BookTranspiler.d.ts +5 -1
- package/esm/typings/src/transpilers/_common/BookTranspilerOptions.d.ts +1 -1
- package/esm/typings/src/transpilers/_common/register/$bookTranspilersRegister.d.ts +1 -1
- package/esm/typings/src/transpilers/formatted-book-in-markdown/FormattedBookInMarkdownTranspiler.d.ts +4 -1
- package/esm/typings/src/transpilers/formatted-book-in-markdown/register.d.ts +1 -1
- package/esm/typings/src/transpilers/openai-sdk/OpenAiSdkTranspiler.d.ts +4 -1
- package/esm/typings/src/transpilers/openai-sdk/register.d.ts +1 -1
- package/esm/typings/src/utils/color/operators/darken.d.ts +1 -1
- package/esm/typings/src/utils/color/operators/grayscale.d.ts +1 -1
- package/esm/typings/src/utils/color/operators/lighten.d.ts +1 -1
- package/esm/typings/src/utils/color/operators/mixWithColor.d.ts +1 -1
- package/esm/typings/src/utils/color/operators/saturate.d.ts +1 -1
- package/esm/typings/src/utils/environment/$detectRuntimeEnvironment.d.ts +16 -0
- package/esm/typings/src/utils/execCommand/$execCommand.d.ts +1 -1
- package/esm/typings/src/utils/execCommand/$execCommands.d.ts +1 -1
- package/esm/typings/src/utils/files/$induceBookDownload.d.ts +2 -2
- package/esm/typings/src/utils/files/$induceFileDownload.d.ts +2 -2
- package/esm/typings/src/utils/files/ObjectUrl.d.ts +1 -1
- package/esm/typings/src/utils/misc/aboutPromptbookInformation.d.ts +6 -0
- package/esm/typings/src/utils/organization/$side_effect.d.ts +1 -1
- package/esm/typings/src/utils/random/$generateBookBoilerplate.d.ts +22 -0
- package/esm/typings/src/utils/random/$randomToken.d.ts +1 -0
- package/esm/typings/src/utils/serialization/$deepFreeze.d.ts +1 -1
- package/esm/typings/src/utils/serialization/serializeToPromptbookJavascript.d.ts +2 -2
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +19 -97
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/collection/agent-collection/constructors/AgentCollectionInDirectory.d.ts +0 -89
- package/esm/typings/src/collection/agent-collection/constructors/AgentCollectionInDirectory.test.d.ts +0 -1
- package/esm/typings/src/execution/utils/logLlmCall.d.ts +0 -8
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { number_percent } from '../../../types/typeAliases';
|
|
1
2
|
import { Color } from '../Color';
|
|
2
3
|
import type { ColorTransformer } from './ColorTransformer';
|
|
3
|
-
import { number_percent } from '../../../types/typeAliases';
|
|
4
4
|
/**
|
|
5
5
|
* Makes color transformer which returns a mix of two colors based on a ratio
|
|
6
6
|
*
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns information about the current runtime environment
|
|
3
|
+
*
|
|
4
|
+
* Note: `$` is used to indicate that this function is not a pure function - it looks at the global object to determine the environments
|
|
5
|
+
*
|
|
6
|
+
* @public exported from `@promptbook/utils`
|
|
7
|
+
*/
|
|
8
|
+
export declare function $detectRuntimeEnvironment(): {
|
|
9
|
+
isRunningInBrowser: any;
|
|
10
|
+
isRunningInJest: any;
|
|
11
|
+
isRunningInNode: any;
|
|
12
|
+
isRunningInWebWorker: any;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* TODO: [🎺] Also detect and report node version here
|
|
16
|
+
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { string_book } from '../../
|
|
2
|
-
import { $side_effect } from '../organization/$side_effect';
|
|
1
|
+
import type { string_book } from '../../book-2.0/agent-source/string_book';
|
|
2
|
+
import type { $side_effect } from '../organization/$side_effect';
|
|
3
3
|
/**
|
|
4
4
|
* Download a Book in a browser
|
|
5
5
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { string_url } from '../../types/typeAliases';
|
|
2
|
-
import { $side_effect } from '../organization/$side_effect';
|
|
1
|
+
import type { string_url } from '../../types/typeAliases';
|
|
2
|
+
import type { $side_effect } from '../organization/$side_effect';
|
|
3
3
|
/**
|
|
4
4
|
* Download a File in a browser
|
|
5
5
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IDestroyable, Registration } from 'destroyable';
|
|
2
|
-
import { string_mime_type, string_url } from '../../types/typeAliases';
|
|
2
|
+
import type { string_mime_type, string_url } from '../../types/typeAliases';
|
|
3
3
|
/**
|
|
4
4
|
* Converts Blob, File or MediaSource to url using URL.createObjectURL
|
|
5
5
|
*
|
|
@@ -6,6 +6,12 @@ export type AboutPromptbookInformationOptions = {
|
|
|
6
6
|
* @default true
|
|
7
7
|
*/
|
|
8
8
|
isServersInfoIncluded?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Include information about runtime environment
|
|
11
|
+
*
|
|
12
|
+
* @default true
|
|
13
|
+
*/
|
|
14
|
+
isRuntimeEnvironmentInfoIncluded?: boolean;
|
|
9
15
|
};
|
|
10
16
|
/**
|
|
11
17
|
* Provide information about Promptbook, engine version, book language version, servers, ...
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { PartialDeep } from 'type-fest';
|
|
2
|
+
import type { AgentBasicInformation } from '../../book-2.0/agent-source/AgentBasicInformation';
|
|
3
|
+
import { string_book } from '../../book-2.0/agent-source/string_book';
|
|
4
|
+
import { string_agent_name } from '../../types/typeAliases';
|
|
5
|
+
type GenerateBookBoilerplateOptions = PartialDeep<Omit<AgentBasicInformation, 'parameters'>> & {
|
|
6
|
+
/**
|
|
7
|
+
* Name of the parent agent to inherit from
|
|
8
|
+
*
|
|
9
|
+
* @default 'Adam'
|
|
10
|
+
*/
|
|
11
|
+
parentAgentName?: string_agent_name;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Generates boilerplate for a new agent book
|
|
15
|
+
*
|
|
16
|
+
* Note: `$` is used to indicate that this function is not a pure function - it is not deterministic
|
|
17
|
+
* Note: This function is using cryptographically secure components internally
|
|
18
|
+
*
|
|
19
|
+
* @public exported from `@promptbook/core`
|
|
20
|
+
*/
|
|
21
|
+
export declare function $generateBookBoilerplate(options?: GenerateBookBoilerplateOptions): string_book;
|
|
22
|
+
export {};
|
|
@@ -2,6 +2,7 @@ import type { string_token } from '../../types/typeAliases';
|
|
|
2
2
|
/**
|
|
3
3
|
* Generates random token
|
|
4
4
|
*
|
|
5
|
+
* Note: `$` is used to indicate that this function is not a pure function - it is not deterministic
|
|
5
6
|
* Note: This function is cryptographically secure (it uses crypto.randomBytes internally)
|
|
6
7
|
*
|
|
7
8
|
* @private internal helper function
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { string_javascript } from '../../types/typeAliases';
|
|
2
|
-
import { TODO_any } from '../organization/TODO_any';
|
|
1
|
+
import type { string_javascript } from '../../types/typeAliases';
|
|
2
|
+
import type { TODO_any } from '../organization/TODO_any';
|
|
3
3
|
type SerializeToPromptbookJavascriptReturn = {
|
|
4
4
|
/**
|
|
5
5
|
* Array of import statements required for the `value` to work
|
|
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
|
|
|
15
15
|
export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
|
|
16
16
|
/**
|
|
17
17
|
* Represents the version string of the Promptbook engine.
|
|
18
|
-
* It follows semantic versioning (e.g., `0.103.0-
|
|
18
|
+
* It follows semantic versioning (e.g., `0.103.0-42`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/javascript",
|
|
3
|
-
"version": "0.103.0-
|
|
3
|
+
"version": "0.103.0-43",
|
|
4
4
|
"description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"module": "./esm/index.es.js",
|
|
95
95
|
"typings": "./esm/typings/src/_packages/javascript.index.d.ts",
|
|
96
96
|
"peerDependencies": {
|
|
97
|
-
"@promptbook/core": "0.103.0-
|
|
97
|
+
"@promptbook/core": "0.103.0-43"
|
|
98
98
|
},
|
|
99
99
|
"dependencies": {
|
|
100
100
|
"crypto": "1.0.1",
|
package/umd/index.umd.js
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* @generated
|
|
23
23
|
* @see https://github.com/webgptorg/promptbook
|
|
24
24
|
*/
|
|
25
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-
|
|
25
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-43';
|
|
26
26
|
/**
|
|
27
27
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
28
28
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -686,6 +686,23 @@
|
|
|
686
686
|
* TODO: Maybe connect with textures
|
|
687
687
|
*/
|
|
688
688
|
|
|
689
|
+
/**
|
|
690
|
+
* Makes color transformer which returns a grayscale version of the color
|
|
691
|
+
*
|
|
692
|
+
* @param amount from 0 to 1
|
|
693
|
+
*
|
|
694
|
+
* @public exported from `@promptbook/color`
|
|
695
|
+
*/
|
|
696
|
+
function grayscale(amount) {
|
|
697
|
+
return ({ red, green, blue, alpha }) => {
|
|
698
|
+
const average = (red + green + blue) / 3;
|
|
699
|
+
red = Math.round(average * amount + red * (1 - amount));
|
|
700
|
+
green = Math.round(average * amount + green * (1 - amount));
|
|
701
|
+
blue = Math.round(average * amount + blue * (1 - amount));
|
|
702
|
+
return Color.fromValues(red, green, blue, alpha);
|
|
703
|
+
};
|
|
704
|
+
}
|
|
705
|
+
|
|
689
706
|
/**
|
|
690
707
|
* Converts HSL values to RGB values
|
|
691
708
|
*
|
|
@@ -801,102 +818,6 @@
|
|
|
801
818
|
* TODO: Maybe implement by mix+hsl
|
|
802
819
|
*/
|
|
803
820
|
|
|
804
|
-
/**
|
|
805
|
-
* Calculates distance between two colors
|
|
806
|
-
*
|
|
807
|
-
* @param color1 first color
|
|
808
|
-
* @param color2 second color
|
|
809
|
-
*
|
|
810
|
-
* Note: This function is inefficient. Use colorDistanceSquared instead if possible.
|
|
811
|
-
*
|
|
812
|
-
* @public exported from `@promptbook/color`
|
|
813
|
-
*/
|
|
814
|
-
/**
|
|
815
|
-
* Calculates distance between two colors without square root
|
|
816
|
-
*
|
|
817
|
-
* @param color1 first color
|
|
818
|
-
* @param color2 second color
|
|
819
|
-
*
|
|
820
|
-
* @public exported from `@promptbook/color`
|
|
821
|
-
*/
|
|
822
|
-
function colorDistanceSquared(color1, color2) {
|
|
823
|
-
const rmean = (color1.red + color2.red) / 2;
|
|
824
|
-
const r = color1.red - color2.red;
|
|
825
|
-
const g = color1.green - color2.green;
|
|
826
|
-
const b = color1.blue - color2.blue;
|
|
827
|
-
const weightR = 2 + rmean / 256;
|
|
828
|
-
const weightG = 4.0;
|
|
829
|
-
const weightB = 2 + (255 - rmean) / 256;
|
|
830
|
-
const distance = weightR * r * r + weightG * g * g + weightB * b * b;
|
|
831
|
-
return distance;
|
|
832
|
-
}
|
|
833
|
-
|
|
834
|
-
/**
|
|
835
|
-
* Makes color transformer which finds the nearest color from the given list
|
|
836
|
-
*
|
|
837
|
-
* @param colors array of colors to choose from
|
|
838
|
-
*
|
|
839
|
-
* @public exported from `@promptbook/color`
|
|
840
|
-
*/
|
|
841
|
-
function nearest(...colors) {
|
|
842
|
-
return (color) => {
|
|
843
|
-
const distances = colors.map((c) => colorDistanceSquared(c, color));
|
|
844
|
-
const minDistance = Math.min(...distances);
|
|
845
|
-
const minIndex = distances.indexOf(minDistance);
|
|
846
|
-
const nearestColor = colors[minIndex];
|
|
847
|
-
return nearestColor;
|
|
848
|
-
};
|
|
849
|
-
}
|
|
850
|
-
|
|
851
|
-
/**
|
|
852
|
-
* Color transformer which returns the negative color
|
|
853
|
-
*
|
|
854
|
-
* @public exported from `@promptbook/color`
|
|
855
|
-
*/
|
|
856
|
-
function negative(color) {
|
|
857
|
-
const r = 255 - color.red;
|
|
858
|
-
const g = 255 - color.green;
|
|
859
|
-
const b = 255 - color.blue;
|
|
860
|
-
return Color.fromValues(r, g, b, color.alpha);
|
|
861
|
-
}
|
|
862
|
-
|
|
863
|
-
/**
|
|
864
|
-
* Makes color transformer which finds the furthest color from the given list
|
|
865
|
-
*
|
|
866
|
-
* @param colors array of colors to choose from
|
|
867
|
-
*
|
|
868
|
-
* @public exported from `@promptbook/color`
|
|
869
|
-
*/
|
|
870
|
-
function furthest(...colors) {
|
|
871
|
-
return (color) => {
|
|
872
|
-
const furthestColor = negative(nearest(...colors.map(negative))(color));
|
|
873
|
-
return furthestColor;
|
|
874
|
-
};
|
|
875
|
-
}
|
|
876
|
-
/**
|
|
877
|
-
* Makes color transformer which finds the best text color (black or white) for the given background color
|
|
878
|
-
*
|
|
879
|
-
* @public exported from `@promptbook/color`
|
|
880
|
-
*/
|
|
881
|
-
furthest(Color.get('white'), Color.from('black'));
|
|
882
|
-
|
|
883
|
-
/**
|
|
884
|
-
* Makes color transformer which returns a grayscale version of the color
|
|
885
|
-
*
|
|
886
|
-
* @param amount from 0 to 1
|
|
887
|
-
*
|
|
888
|
-
* @public exported from `@promptbook/color`
|
|
889
|
-
*/
|
|
890
|
-
function grayscale(amount) {
|
|
891
|
-
return ({ red, green, blue, alpha }) => {
|
|
892
|
-
const average = (red + green + blue) / 3;
|
|
893
|
-
red = Math.round(average * amount + red * (1 - amount));
|
|
894
|
-
green = Math.round(average * amount + green * (1 - amount));
|
|
895
|
-
blue = Math.round(average * amount + blue * (1 - amount));
|
|
896
|
-
return Color.fromValues(red, green, blue, alpha);
|
|
897
|
-
};
|
|
898
|
-
}
|
|
899
|
-
|
|
900
821
|
/**
|
|
901
822
|
* Makes color transformer which saturate the given color
|
|
902
823
|
*
|
|
@@ -1815,6 +1736,7 @@
|
|
|
1815
1736
|
/**
|
|
1816
1737
|
* Generates random token
|
|
1817
1738
|
*
|
|
1739
|
+
* Note: `$` is used to indicate that this function is not a pure function - it is not deterministic
|
|
1818
1740
|
* Note: This function is cryptographically secure (it uses crypto.randomBytes internally)
|
|
1819
1741
|
*
|
|
1820
1742
|
* @private internal helper function
|