@promptbook/javascript 0.104.0-0 → 0.104.0-2

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 (29) hide show
  1. package/esm/index.es.js +1 -77
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/src/_packages/types.index.d.ts +6 -2
  4. package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +6 -1
  5. package/esm/typings/src/book-components/Chat/Chat/ChatMessageItem.d.ts +5 -1
  6. package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +5 -0
  7. package/esm/typings/src/book-components/Chat/CodeBlock/CodeBlock.d.ts +13 -0
  8. package/esm/typings/src/book-components/Chat/MarkdownContent/MarkdownContent.d.ts +1 -0
  9. package/esm/typings/src/book-components/_common/Dropdown/Dropdown.d.ts +2 -2
  10. package/esm/typings/src/book-components/_common/MenuHoisting/MenuHoistingContext.d.ts +56 -0
  11. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +13 -7
  12. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema.d.ts +6 -0
  13. package/esm/typings/src/commitments/DICTIONARY/DICTIONARY.d.ts +46 -0
  14. package/esm/typings/src/commitments/index.d.ts +2 -1
  15. package/esm/typings/src/llm-providers/ollama/OllamaExecutionTools.d.ts +1 -1
  16. package/esm/typings/src/llm-providers/openai/createOpenAiCompatibleExecutionTools.d.ts +1 -1
  17. package/esm/typings/src/types/typeAliases.d.ts +12 -0
  18. package/esm/typings/src/utils/environment/$detectRuntimeEnvironment.d.ts +4 -4
  19. package/esm/typings/src/utils/environment/$isRunningInBrowser.d.ts +1 -1
  20. package/esm/typings/src/utils/environment/$isRunningInJest.d.ts +1 -1
  21. package/esm/typings/src/utils/environment/$isRunningInNode.d.ts +1 -1
  22. package/esm/typings/src/utils/environment/$isRunningInWebWorker.d.ts +1 -1
  23. package/esm/typings/src/utils/markdown/extractAllBlocksFromMarkdown.d.ts +2 -2
  24. package/esm/typings/src/utils/markdown/extractOneBlockFromMarkdown.d.ts +2 -2
  25. package/esm/typings/src/utils/random/$randomBase58.d.ts +12 -0
  26. package/esm/typings/src/version.d.ts +1 -1
  27. package/package.json +2 -2
  28. package/umd/index.umd.js +1 -77
  29. package/umd/index.umd.js.map +1 -1
@@ -22,6 +22,7 @@ export type AgentsDatabaseSchema = {
22
22
  agentName: string;
23
23
  createdAt: string;
24
24
  updatedAt: string | null;
25
+ permanentId: string | null;
25
26
  agentHash: string;
26
27
  agentSource: string;
27
28
  agentProfile: Json;
@@ -29,12 +30,14 @@ export type AgentsDatabaseSchema = {
29
30
  usage: Json | null;
30
31
  preparedModelRequirements: Json | null;
31
32
  preparedExternals: Json | null;
33
+ deletedAt: string | null;
32
34
  };
33
35
  Insert: {
34
36
  id?: number;
35
37
  agentName: string;
36
38
  createdAt: string;
37
39
  updatedAt?: string | null;
40
+ permanentId?: string | null;
38
41
  agentHash: string;
39
42
  agentSource: string;
40
43
  agentProfile: Json;
@@ -42,12 +45,14 @@ export type AgentsDatabaseSchema = {
42
45
  usage?: Json | null;
43
46
  preparedModelRequirements?: Json | null;
44
47
  preparedExternals?: Json | null;
48
+ deletedAt?: string | null;
45
49
  };
46
50
  Update: {
47
51
  id?: number;
48
52
  agentName?: string;
49
53
  createdAt?: string;
50
54
  updatedAt?: string | null;
55
+ permanentId?: string | null;
51
56
  agentHash?: string;
52
57
  agentSource?: string;
53
58
  agentProfile?: Json;
@@ -55,6 +60,7 @@ export type AgentsDatabaseSchema = {
55
60
  usage?: Json | null;
56
61
  preparedModelRequirements?: Json | null;
57
62
  preparedExternals?: Json | null;
63
+ deletedAt?: string | null;
58
64
  };
59
65
  Relationships: [];
60
66
  };
@@ -0,0 +1,46 @@
1
+ import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
2
+ import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
3
+ /**
4
+ * DICTIONARY commitment definition
5
+ *
6
+ * The DICTIONARY commitment defines specific terms and their meanings that the agent should use correctly
7
+ * in its reasoning and responses. This ensures consistent terminology usage.
8
+ *
9
+ * Key features:
10
+ * - Multiple DICTIONARY commitments are automatically merged into one
11
+ * - Content is placed in a dedicated section of the system message
12
+ * - Terms and definitions are stored in metadata.DICTIONARY for debugging
13
+ * - Agent should use the defined terms correctly in responses
14
+ *
15
+ * Example usage in agent source:
16
+ *
17
+ * ```book
18
+ * Legal Assistant
19
+ *
20
+ * PERSONA You are a knowledgeable legal assistant
21
+ * DICTIONARY Misdemeanor is a minor wrongdoing or criminal offense
22
+ * DICTIONARY Felony is a serious crime usually punishable by imprisonment for more than one year
23
+ * DICTIONARY Tort is a civil wrong that causes harm or loss to another person, leading to legal liability
24
+ * ```
25
+ *
26
+ * @private [🪔] Maybe export the commitments through some package
27
+ */
28
+ export declare class DictionaryCommitmentDefinition extends BaseCommitmentDefinition<'DICTIONARY'> {
29
+ constructor();
30
+ /**
31
+ * Short one-line description of DICTIONARY.
32
+ */
33
+ get description(): string;
34
+ /**
35
+ * Icon for this commitment.
36
+ */
37
+ get icon(): string;
38
+ /**
39
+ * Markdown documentation for DICTIONARY commitment.
40
+ */
41
+ get documentation(): string;
42
+ applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
43
+ }
44
+ /**
45
+ * Note: [💞] Ignore a discrepancy between file name and entity name
46
+ */
@@ -4,6 +4,7 @@ import { ActionCommitmentDefinition } from './ACTION/ACTION';
4
4
  import { ClosedCommitmentDefinition } from './CLOSED/CLOSED';
5
5
  import { ComponentCommitmentDefinition } from './COMPONENT/COMPONENT';
6
6
  import { DeleteCommitmentDefinition } from './DELETE/DELETE';
7
+ import { DictionaryCommitmentDefinition } from './DICTIONARY/DICTIONARY';
7
8
  import { FormatCommitmentDefinition } from './FORMAT/FORMAT';
8
9
  import { FromCommitmentDefinition } from './FROM/FROM';
9
10
  import { GoalCommitmentDefinition } from './GOAL/GOAL';
@@ -39,7 +40,7 @@ import { NotYetImplementedCommitmentDefinition } from './_base/NotYetImplemented
39
40
  *
40
41
  * @private Use functions to access commitments instead of this array directly
41
42
  */
42
- export declare const COMMITMENT_REGISTRY: readonly [PersonaCommitmentDefinition, PersonaCommitmentDefinition, KnowledgeCommitmentDefinition, MemoryCommitmentDefinition, MemoryCommitmentDefinition, StyleCommitmentDefinition, StyleCommitmentDefinition, RuleCommitmentDefinition, RuleCommitmentDefinition, LanguageCommitmentDefinition, LanguageCommitmentDefinition, SampleCommitmentDefinition, SampleCommitmentDefinition, FormatCommitmentDefinition, FormatCommitmentDefinition, FromCommitmentDefinition, ModelCommitmentDefinition, ModelCommitmentDefinition, ActionCommitmentDefinition, ActionCommitmentDefinition, ComponentCommitmentDefinition, MetaImageCommitmentDefinition, MetaColorCommitmentDefinition, MetaFontCommitmentDefinition, MetaLinkCommitmentDefinition, MetaCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, GoalCommitmentDefinition, GoalCommitmentDefinition, InitialMessageCommitmentDefinition, UserMessageCommitmentDefinition, AgentMessageCommitmentDefinition, MessageCommitmentDefinition, MessageCommitmentDefinition, ScenarioCommitmentDefinition, ScenarioCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, OpenCommitmentDefinition, ClosedCommitmentDefinition, UseBrowserCommitmentDefinition, UseSearchEngineCommitmentDefinition, UseMcpCommitmentDefinition, UseCommitmentDefinition, NotYetImplementedCommitmentDefinition<"EXPECT">, NotYetImplementedCommitmentDefinition<"BEHAVIOUR">, NotYetImplementedCommitmentDefinition<"BEHAVIOURS">, NotYetImplementedCommitmentDefinition<"AVOID">, NotYetImplementedCommitmentDefinition<"AVOIDANCE">, NotYetImplementedCommitmentDefinition<"CONTEXT">];
43
+ export declare const COMMITMENT_REGISTRY: readonly [PersonaCommitmentDefinition, PersonaCommitmentDefinition, KnowledgeCommitmentDefinition, MemoryCommitmentDefinition, MemoryCommitmentDefinition, StyleCommitmentDefinition, StyleCommitmentDefinition, RuleCommitmentDefinition, RuleCommitmentDefinition, LanguageCommitmentDefinition, LanguageCommitmentDefinition, SampleCommitmentDefinition, SampleCommitmentDefinition, FormatCommitmentDefinition, FormatCommitmentDefinition, FromCommitmentDefinition, ModelCommitmentDefinition, ModelCommitmentDefinition, ActionCommitmentDefinition, ActionCommitmentDefinition, ComponentCommitmentDefinition, MetaImageCommitmentDefinition, MetaColorCommitmentDefinition, MetaFontCommitmentDefinition, MetaLinkCommitmentDefinition, MetaCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, GoalCommitmentDefinition, GoalCommitmentDefinition, InitialMessageCommitmentDefinition, UserMessageCommitmentDefinition, AgentMessageCommitmentDefinition, MessageCommitmentDefinition, MessageCommitmentDefinition, ScenarioCommitmentDefinition, ScenarioCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DictionaryCommitmentDefinition, OpenCommitmentDefinition, ClosedCommitmentDefinition, UseBrowserCommitmentDefinition, UseSearchEngineCommitmentDefinition, UseMcpCommitmentDefinition, UseCommitmentDefinition, NotYetImplementedCommitmentDefinition<"EXPECT">, NotYetImplementedCommitmentDefinition<"BEHAVIOUR">, NotYetImplementedCommitmentDefinition<"BEHAVIOURS">, NotYetImplementedCommitmentDefinition<"AVOID">, NotYetImplementedCommitmentDefinition<"AVOIDANCE">, NotYetImplementedCommitmentDefinition<"CONTEXT">];
43
44
  /**
44
45
  * Gets a commitment definition by its type
45
46
  * @param type The commitment type to look up
@@ -39,7 +39,7 @@ export declare class OllamaExecutionTools extends OpenAiCompatibleExecutionTools
39
39
  */
40
40
  protected getDefaultEmbeddingModel(): AvailableModel;
41
41
  /**
42
- * Default model for image generation variant.
42
+ * Default model for completion variant.
43
43
  */
44
44
  protected getDefaultImageGenerationModel(): AvailableModel;
45
45
  }
@@ -64,7 +64,7 @@ export declare class HardcodedOpenAiCompatibleExecutionTools extends OpenAiCompa
64
64
  */
65
65
  protected getDefaultEmbeddingModel(): AvailableModel;
66
66
  /**
67
- * Default model for image generation variant.
67
+ * Default model for completion variant.
68
68
  */
69
69
  protected getDefaultImageGenerationModel(): AvailableModel;
70
70
  }
@@ -154,6 +154,12 @@ export type string_agent_name_in_book = string;
154
154
  * For example `"b126926439c5fcb83609888a11283723c1ef137c0ad599a77a1be81812bd221d"`
155
155
  */
156
156
  export type string_agent_hash = string_sha256;
157
+ /**
158
+ * Semantic helper
159
+ *
160
+ * For example `"3mJr7AoUXx2Wqd"`
161
+ */
162
+ export type string_agent_permanent_id = string_base_58;
157
163
  /**
158
164
  * Unstructured description of the persona
159
165
  *
@@ -499,6 +505,12 @@ export type string_user_id = id | string_email;
499
505
  * For example `"b126926439c5fcb83609888a11283723c1ef137c0ad599a77a1be81812bd221d"`
500
506
  */
501
507
  export type string_sha256 = string;
508
+ /**
509
+ * Semantic helper
510
+ *
511
+ * For example `"4JmF3b2J5dGVz"`
512
+ */
513
+ export type string_base_58 = string;
502
514
  /**
503
515
  * Semantic helper
504
516
  *
@@ -6,10 +6,10 @@
6
6
  * @public exported from `@promptbook/utils`
7
7
  */
8
8
  export declare function $detectRuntimeEnvironment(): {
9
- isRunningInBrowser: any;
10
- isRunningInJest: any;
11
- isRunningInNode: any;
12
- isRunningInWebWorker: any;
9
+ isRunningInBrowser: boolean;
10
+ isRunningInJest: boolean;
11
+ isRunningInNode: boolean;
12
+ isRunningInWebWorker: boolean;
13
13
  };
14
14
  /**
15
15
  * TODO: [🎺] Also detect and report node version here
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * @public exported from `@promptbook/utils`
7
7
  */
8
- export declare const $isRunningInBrowser: Function;
8
+ export declare function $isRunningInBrowser(): boolean;
9
9
  /**
10
10
  * TODO: [🎺]
11
11
  */
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * @public exported from `@promptbook/utils`
7
7
  */
8
- export declare const $isRunningInJest: Function;
8
+ export declare function $isRunningInJest(): boolean;
9
9
  /**
10
10
  * TODO: [🎺]
11
11
  */
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * @public exported from `@promptbook/utils`
7
7
  */
8
- export declare const $isRunningInNode: Function;
8
+ export declare function $isRunningInNode(): boolean;
9
9
  /**
10
10
  * TODO: [🎺]
11
11
  */
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * @public exported from `@promptbook/utils`
7
7
  */
8
- export declare const $isRunningInWebWorker: Function;
8
+ export declare function $isRunningInWebWorker(): boolean;
9
9
  /**
10
10
  * TODO: [🎺]
11
11
  */
@@ -2,7 +2,7 @@ import type { string_markdown } from '../../types/typeAliases';
2
2
  /**
3
3
  * Single code block inside markdown.
4
4
  */
5
- export type CodeBlock = {
5
+ export type MarkdownCodeBlock = {
6
6
  /**
7
7
  * Which notation was used to open the code block
8
8
  */
@@ -30,7 +30,7 @@ export type CodeBlock = {
30
30
  * @throws {ParseError} if block is not closed properly
31
31
  * @public exported from `@promptbook/markdown-utils`
32
32
  */
33
- export declare function extractAllBlocksFromMarkdown(markdown: string_markdown): ReadonlyArray<CodeBlock>;
33
+ export declare function extractAllBlocksFromMarkdown(markdown: string_markdown): ReadonlyArray<MarkdownCodeBlock>;
34
34
  /**
35
35
  * TODO: Maybe name for `blockNotation` instead of '```' and '>'
36
36
  */
@@ -1,5 +1,5 @@
1
1
  import type { string_markdown } from '../../types/typeAliases';
2
- import type { CodeBlock } from './extractAllBlocksFromMarkdown';
2
+ import type { MarkdownCodeBlock } from './extractAllBlocksFromMarkdown';
3
3
  /**
4
4
  * Extracts exactly ONE code block from markdown.
5
5
  *
@@ -16,7 +16,7 @@ import type { CodeBlock } from './extractAllBlocksFromMarkdown';
16
16
  * @public exported from `@promptbook/markdown-utils`
17
17
  * @throws {ParseError} if there is not exactly one code block in the markdown
18
18
  */
19
- export declare function extractOneBlockFromMarkdown(markdown: string_markdown): CodeBlock;
19
+ export declare function extractOneBlockFromMarkdown(markdown: string_markdown): MarkdownCodeBlock;
20
20
  /***
21
21
  * TODO: [🍓][🌻] Decide of this is internal utility, external util OR validator/postprocessor
22
22
  */
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Generates random base58 string
3
+ *
4
+ * Note: `$` is used to indicate that this function is not a pure function - it is not deterministic
5
+ * Note: This function is cryptographically secure (it uses crypto.randomBytes internally)
6
+ *
7
+ * @param length - length of the string
8
+ * @returns secure random base58 string
9
+ *
10
+ * @private internal helper function
11
+ */
12
+ export declare function $randomBase58(length: number): string;
@@ -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.104.0-1`).
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.104.0-0",
3
+ "version": "0.104.0-2",
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.104.0-0"
97
+ "@promptbook/core": "0.104.0-2"
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.104.0-0';
25
+ const PROMPTBOOK_ENGINE_VERSION = '0.104.0-2';
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
@@ -1948,82 +1948,6 @@
1948
1948
  }
1949
1949
  }
1950
1950
 
1951
- /**
1952
- * Detects if the code is running in a browser environment in main thread (Not in a web worker)
1953
- *
1954
- * Note: `$` is used to indicate that this function is not a pure function - it looks at the global object to determine the environment
1955
- *
1956
- * @public exported from `@promptbook/utils`
1957
- */
1958
- new Function(`
1959
- try {
1960
- return this === window;
1961
- } catch (e) {
1962
- return false;
1963
- }
1964
- `);
1965
- /**
1966
- * TODO: [🎺]
1967
- */
1968
-
1969
- /**
1970
- * Detects if the code is running in jest environment
1971
- *
1972
- * Note: `$` is used to indicate that this function is not a pure function - it looks at the global object to determine the environment
1973
- *
1974
- * @public exported from `@promptbook/utils`
1975
- */
1976
- new Function(`
1977
- try {
1978
- return process.env.JEST_WORKER_ID !== undefined;
1979
- } catch (e) {
1980
- return false;
1981
- }
1982
- `);
1983
- /**
1984
- * TODO: [🎺]
1985
- */
1986
-
1987
- /**
1988
- * Detects if the code is running in a Node.js environment
1989
- *
1990
- * Note: `$` is used to indicate that this function is not a pure function - it looks at the global object to determine the environment
1991
- *
1992
- * @public exported from `@promptbook/utils`
1993
- */
1994
- new Function(`
1995
- try {
1996
- return this === global;
1997
- } catch (e) {
1998
- return false;
1999
- }
2000
- `);
2001
- /**
2002
- * TODO: [🎺]
2003
- */
2004
-
2005
- /**
2006
- * Detects if the code is running in a web worker
2007
- *
2008
- * Note: `$` is used to indicate that this function is not a pure function - it looks at the global object to determine the environment
2009
- *
2010
- * @public exported from `@promptbook/utils`
2011
- */
2012
- new Function(`
2013
- try {
2014
- if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) {
2015
- return true;
2016
- } else {
2017
- return false;
2018
- }
2019
- } catch (e) {
2020
- return false;
2021
- }
2022
- `);
2023
- /**
2024
- * TODO: [🎺]
2025
- */
2026
-
2027
1951
  /**
2028
1952
  * Makes first letter of a string uppercase
2029
1953
  *