@promptbook/fake-llm 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
@@ -0,0 +1,56 @@
1
+ import { ReactNode } from 'react';
2
+ /**
3
+ * Item that can be hoisted to the top menu
4
+ *
5
+ * @private mechanism inside Promptbook
6
+ */
7
+ export type HoistedMenuItem = {
8
+ /**
9
+ * Unique key for the menu item
10
+ */
11
+ key?: string;
12
+ /**
13
+ * Icon to display
14
+ */
15
+ icon: ReactNode;
16
+ /**
17
+ * Name/Tooltip of the item
18
+ */
19
+ name: string;
20
+ /**
21
+ * Action to perform when clicked
22
+ */
23
+ onClick: () => void;
24
+ /**
25
+ * If true, the item is active/toggled
26
+ */
27
+ isActive?: boolean;
28
+ };
29
+ type MenuHoistingContextType = {
30
+ /**
31
+ * The currently hoisted menu items
32
+ */
33
+ menu: HoistedMenuItem[];
34
+ /**
35
+ * Set the hoisted menu items
36
+ */
37
+ setMenu: (items: HoistedMenuItem[]) => void;
38
+ };
39
+ /**
40
+ * Provider for menu hoisting
41
+ *
42
+ * @private mechanism inside Promptbook
43
+ */
44
+ export declare function MenuHoistingProvider({ children }: {
45
+ children: ReactNode;
46
+ }): import("react/jsx-runtime").JSX.Element;
47
+ /**
48
+ * Hook to use the menu hoisting system
49
+ *
50
+ * @private mechanism inside Promptbook
51
+ */
52
+ export declare function useMenuHoisting(): MenuHoistingContextType | null;
53
+ export {};
54
+ /**
55
+ * Note: [💞] Ignore a discrepancy between file name and entity name
56
+ */
@@ -34,15 +34,15 @@ export declare class AgentCollectionInSupabase {
34
34
  *
35
35
  * Note: You can set 'PARENT' in the agent source to inherit from another agent in the collection.
36
36
  */
37
- createAgent(agentSource: string_book): Promise<AgentBasicInformation>;
37
+ createAgent(agentSource: string_book): Promise<AgentBasicInformation & Required<Pick<AgentBasicInformation, 'permanentId'>>>;
38
38
  /**
39
39
  * Updates an existing agent in the collection
40
40
  */
41
41
  updateAgentSource(agentName: string_agent_name, agentSource: string_book): Promise<void>;
42
42
  /**
43
- * Deletes an agent from the collection
43
+ * List agents that are soft deleted (deletedAt IS NOT NULL)
44
44
  */
45
- deleteAgent(agentName: string_agent_name): Promise<void>;
45
+ listDeletedAgents(): Promise<ReadonlyArray<AgentBasicInformation>>;
46
46
  /**
47
47
  * List history of an agent
48
48
  */
@@ -53,13 +53,19 @@ export declare class AgentCollectionInSupabase {
53
53
  promptbookEngineVersion: string;
54
54
  }>>;
55
55
  /**
56
- * List agents that are in history but not in the active agents list
56
+ * Restore a soft-deleted agent by setting deletedAt to NULL
57
57
  */
58
- listDeletedAgents(): Promise<ReadonlyArray<string_agent_name>>;
58
+ restoreAgent(agentIdentifier: string): Promise<void>;
59
59
  /**
60
- * Restore an agent from history
60
+ * Restore an agent from a specific history entry
61
+ *
62
+ * This will update the current agent with the source from the history entry
63
+ */
64
+ restoreAgentFromHistory(historyId: number): Promise<void>;
65
+ /**
66
+ * Soft delete an agent by setting deletedAt to current timestamp
61
67
  */
62
- restoreAgent(historyId: number): Promise<void>;
68
+ deleteAgent(agentIdentifier: string): Promise<void>;
63
69
  /**
64
70
  * Get the Supabase table name with prefix
65
71
  *
@@ -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/fake-llm",
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,
@@ -96,7 +96,7 @@
96
96
  "module": "./esm/index.es.js",
97
97
  "typings": "./esm/typings/src/_packages/fake-llm.index.d.ts",
98
98
  "peerDependencies": {
99
- "@promptbook/core": "0.104.0-0"
99
+ "@promptbook/core": "0.104.0-2"
100
100
  },
101
101
  "dependencies": {
102
102
  "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
@@ -2477,82 +2477,6 @@
2477
2477
  * Note: [💞] Ignore a discrepancy between file name and entity name
2478
2478
  */
2479
2479
 
2480
- /**
2481
- * Detects if the code is running in a browser environment in main thread (Not in a web worker)
2482
- *
2483
- * Note: `$` is used to indicate that this function is not a pure function - it looks at the global object to determine the environment
2484
- *
2485
- * @public exported from `@promptbook/utils`
2486
- */
2487
- new Function(`
2488
- try {
2489
- return this === window;
2490
- } catch (e) {
2491
- return false;
2492
- }
2493
- `);
2494
- /**
2495
- * TODO: [🎺]
2496
- */
2497
-
2498
- /**
2499
- * Detects if the code is running in jest environment
2500
- *
2501
- * Note: `$` is used to indicate that this function is not a pure function - it looks at the global object to determine the environment
2502
- *
2503
- * @public exported from `@promptbook/utils`
2504
- */
2505
- new Function(`
2506
- try {
2507
- return process.env.JEST_WORKER_ID !== undefined;
2508
- } catch (e) {
2509
- return false;
2510
- }
2511
- `);
2512
- /**
2513
- * TODO: [🎺]
2514
- */
2515
-
2516
- /**
2517
- * Detects if the code is running in a Node.js environment
2518
- *
2519
- * Note: `$` is used to indicate that this function is not a pure function - it looks at the global object to determine the environment
2520
- *
2521
- * @public exported from `@promptbook/utils`
2522
- */
2523
- new Function(`
2524
- try {
2525
- return this === global;
2526
- } catch (e) {
2527
- return false;
2528
- }
2529
- `);
2530
- /**
2531
- * TODO: [🎺]
2532
- */
2533
-
2534
- /**
2535
- * Detects if the code is running in a web worker
2536
- *
2537
- * Note: `$` is used to indicate that this function is not a pure function - it looks at the global object to determine the environment
2538
- *
2539
- * @public exported from `@promptbook/utils`
2540
- */
2541
- new Function(`
2542
- try {
2543
- if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) {
2544
- return true;
2545
- } else {
2546
- return false;
2547
- }
2548
- } catch (e) {
2549
- return false;
2550
- }
2551
- `);
2552
- /**
2553
- * TODO: [🎺]
2554
- */
2555
-
2556
2480
  /**
2557
2481
  * Makes first letter of a string uppercase
2558
2482
  *