@promptbook/cli 0.103.0-43 → 0.103.0-45
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 +6 -18
- package/apps/agents-server/README.md +3 -0
- package/apps/agents-server/TODO.txt +6 -0
- package/apps/agents-server/config.ts.todo +312 -0
- package/apps/agents-server/next.config.ts +42 -0
- package/apps/agents-server/package.json +11 -0
- package/apps/agents-server/postcss.config.mjs +8 -0
- package/apps/agents-server/public/.gitkeep +0 -0
- package/apps/agents-server/public/favicon.ico +0 -0
- package/apps/agents-server/public/logo-blue-white-256.png +0 -0
- package/apps/agents-server/src/app/AddAgentButton.tsx +20 -0
- package/apps/agents-server/src/app/actions.ts +14 -0
- package/apps/agents-server/src/app/agents/[agentName]/AgentUrlCopy.tsx +41 -0
- package/apps/agents-server/src/app/agents/[agentName]/TODO.txt +1 -0
- package/apps/agents-server/src/app/agents/[agentName]/api/chat/route.ts +60 -0
- package/apps/agents-server/src/app/agents/[agentName]/book+chat/SelfLearningBook.tsx +203 -0
- package/apps/agents-server/src/app/agents/[agentName]/book+chat/page.tsx +18 -0
- package/apps/agents-server/src/app/agents/[agentName]/page.tsx +155 -0
- package/apps/agents-server/src/app/api/chat/route.ts +32 -0
- package/apps/agents-server/src/app/api/chat-streaming/route.ts +44 -0
- package/apps/agents-server/src/app/api/long-running-task/route.ts +7 -0
- package/apps/agents-server/src/app/api/long-streaming/route.ts +20 -0
- package/apps/agents-server/src/app/globals.css +113 -0
- package/apps/agents-server/src/app/layout.tsx +72 -0
- package/apps/agents-server/src/app/page.tsx +115 -0
- package/apps/agents-server/src/deamons/longRunningTask.ts +37 -0
- package/apps/agents-server/src/supabase/TODO.txt +1 -0
- package/apps/agents-server/src/supabase/getSupabase.ts +25 -0
- package/apps/agents-server/src/supabase/getSupabaseForBrowser.ts +37 -0
- package/apps/agents-server/src/supabase/getSupabaseForServer.ts +48 -0
- package/apps/agents-server/src/supabase/getSupabaseForWorker.ts +42 -0
- package/apps/agents-server/src/tools/$provideAgentCollectionForServer.ts +49 -0
- package/apps/agents-server/src/tools/$provideExecutionToolsForServer.ts +110 -0
- package/apps/agents-server/src/tools/$provideOpenAiAssistantExecutionToolsForServer.ts +35 -0
- package/apps/agents-server/tailwind.config.ts +24 -0
- package/apps/agents-server/tsconfig.json +29 -0
- package/esm/index.es.js +57 -13
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/types.index.d.ts +8 -0
- package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/AvatarProfile.d.ts +5 -0
- package/esm/typings/src/collection/agent-collection/AgentCollection.d.ts +2 -28
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +61 -9
- package/esm/typings/src/errors/DatabaseError.d.ts +3 -0
- package/esm/typings/src/llm-providers/_multiple/getSingleLlmExecutionTools.d.ts +1 -0
- package/esm/typings/src/llm-providers/_multiple/joinLlmExecutionTools.d.ts +1 -0
- package/esm/typings/src/llm-providers/agent/CreateAgentLlmExecutionToolsOptions.d.ts +2 -1
- package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/google/google-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -1
- package/esm/typings/src/remote-server/startAgentServer.d.ts +3 -0
- package/esm/typings/src/remote-server/startRemoteServer.d.ts +1 -0
- package/esm/typings/src/types/typeAliases.d.ts +19 -1
- package/esm/typings/src/utils/color/$randomColor.d.ts +1 -0
- package/esm/typings/src/utils/random/$generateBookBoilerplate.d.ts +5 -2
- package/esm/typings/src/utils/random/$randomAgentPersona.d.ts +9 -0
- package/esm/typings/src/utils/random/$randomFullnameWithColor.d.ts +13 -0
- package/esm/typings/src/utils/random/$randomItem.d.ts +9 -0
- package/esm/typings/src/utils/random/$randomSeed.d.ts +3 -0
- package/esm/typings/src/utils/random/$randomToken.d.ts +1 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +57 -13
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/commands/_common/parseCommand.test.d.ts +0 -1
|
@@ -216,6 +216,7 @@ import type { string_reserved_parameter_name } from '../types/typeAliases';
|
|
|
216
216
|
import type { ReservedParameters } from '../types/typeAliases';
|
|
217
217
|
import type { string_title } from '../types/typeAliases';
|
|
218
218
|
import type { string_agent_name } from '../types/typeAliases';
|
|
219
|
+
import type { string_agent_name_in_book } from '../types/typeAliases';
|
|
219
220
|
import type { string_persona_description } from '../types/typeAliases';
|
|
220
221
|
import type { string_model_description } from '../types/typeAliases';
|
|
221
222
|
import type { string_knowledge_source_content } from '../types/typeAliases';
|
|
@@ -274,6 +275,8 @@ import type { string_absolute_dirname } from '../types/typeAliases';
|
|
|
274
275
|
import type { string_relative_dirname } from '../types/typeAliases';
|
|
275
276
|
import type { string_dirname } from '../types/typeAliases';
|
|
276
277
|
import type { string_person_fullname } from '../types/typeAliases';
|
|
278
|
+
import type { string_person_firstname } from '../types/typeAliases';
|
|
279
|
+
import type { string_person_lastname } from '../types/typeAliases';
|
|
277
280
|
import type { string_person_profile } from '../types/typeAliases';
|
|
278
281
|
import type { string_license } from '../types/typeAliases';
|
|
279
282
|
import type { string_legal_entity } from '../types/typeAliases';
|
|
@@ -342,6 +345,7 @@ import type { OrderJsonOptions } from '../utils/normalization/orderJson';
|
|
|
342
345
|
import type { empty_object } from '../utils/organization/empty_object';
|
|
343
346
|
import type { really_any } from '../utils/organization/really_any';
|
|
344
347
|
import type { TODO_any } from '../utils/organization/TODO_any';
|
|
348
|
+
import type { RandomFullnameWithColorResult } from '../utils/random/$randomFullnameWithColor';
|
|
345
349
|
import type { CheckSerializableAsJsonOptions } from '../utils/serialization/checkSerializableAsJson';
|
|
346
350
|
import type { ExportJsonOptions } from '../utils/serialization/exportJson';
|
|
347
351
|
import type { ITakeChain } from '../utils/take/interfaces/ITakeChain';
|
|
@@ -564,6 +568,7 @@ export type { string_reserved_parameter_name };
|
|
|
564
568
|
export type { ReservedParameters };
|
|
565
569
|
export type { string_title };
|
|
566
570
|
export type { string_agent_name };
|
|
571
|
+
export type { string_agent_name_in_book };
|
|
567
572
|
export type { string_persona_description };
|
|
568
573
|
export type { string_model_description };
|
|
569
574
|
export type { string_knowledge_source_content };
|
|
@@ -622,6 +627,8 @@ export type { string_absolute_dirname };
|
|
|
622
627
|
export type { string_relative_dirname };
|
|
623
628
|
export type { string_dirname };
|
|
624
629
|
export type { string_person_fullname };
|
|
630
|
+
export type { string_person_firstname };
|
|
631
|
+
export type { string_person_lastname };
|
|
625
632
|
export type { string_person_profile };
|
|
626
633
|
export type { string_license };
|
|
627
634
|
export type { string_legal_entity };
|
|
@@ -690,6 +697,7 @@ export type { OrderJsonOptions };
|
|
|
690
697
|
export type { empty_object };
|
|
691
698
|
export type { really_any };
|
|
692
699
|
export type { TODO_any };
|
|
700
|
+
export type { RandomFullnameWithColorResult };
|
|
693
701
|
export type { CheckSerializableAsJsonOptions };
|
|
694
702
|
export type { ExportJsonOptions };
|
|
695
703
|
export type { ITakeChain };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
1
2
|
import type { AgentBasicInformation } from '../../../book-2.0/agent-source/AgentBasicInformation';
|
|
2
3
|
import type { string_book } from '../../../book-2.0/agent-source/string_book';
|
|
3
4
|
import type { string_css_class } from '../../../types/typeAliases';
|
|
@@ -19,6 +20,10 @@ export type AvatarProfileProps = {
|
|
|
19
20
|
* Optional CSS class name which will be added to root <div> element
|
|
20
21
|
*/
|
|
21
22
|
readonly className?: string_css_class;
|
|
23
|
+
/**
|
|
24
|
+
* Optional CSS style which will be added to root <div/> element
|
|
25
|
+
*/
|
|
26
|
+
readonly style?: CSSProperties;
|
|
22
27
|
};
|
|
23
28
|
/**
|
|
24
29
|
* Shows a box with user avatar, name and description
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { AgentBasicInformation } from '../../book-2.0/agent-source/AgentBasicInformation';
|
|
3
|
-
import type { string_book } from '../../book-2.0/agent-source/string_book';
|
|
4
|
-
import { Agent } from '../../llm-providers/agent/Agent';
|
|
5
|
-
import type { string_agent_name } from '../../types/typeAliases';
|
|
1
|
+
import { AgentCollectionInSupabase } from './constructors/agent-collection-in-supabase/AgentCollectionInSupabase';
|
|
6
2
|
/**
|
|
7
3
|
* Collection that groups together multiple AI Agents
|
|
8
4
|
*
|
|
@@ -10,29 +6,7 @@ import type { string_agent_name } from '../../types/typeAliases';
|
|
|
10
6
|
* - `AgentCollection` - which groups together AI Agents
|
|
11
7
|
* - `PipelineCollection` - which groups together *(deprecated)* pipelines
|
|
12
8
|
*/
|
|
13
|
-
export type AgentCollection =
|
|
14
|
-
/**
|
|
15
|
-
* Gets all agents in the collection
|
|
16
|
-
*/
|
|
17
|
-
listAgents(): Promisable<ReadonlyArray<AgentBasicInformation>>;
|
|
18
|
-
/**
|
|
19
|
-
* Get one agent by its name
|
|
20
|
-
*
|
|
21
|
-
* Note: !!!! Agents are existing independently of you getting them or not, you can get the same agent multiple times.
|
|
22
|
-
* Note: Agents are changed by interacting with `Agent` objects directly. Only creation and deletion is done via the collection.
|
|
23
|
-
*/
|
|
24
|
-
spawnAgent(agentName: string_agent_name): Promisable<Agent>;
|
|
25
|
-
/**
|
|
26
|
-
* Creates a new agent in the collection
|
|
27
|
-
*
|
|
28
|
-
* Note: You can set 'PARENT' in the agent source to inherit from another agent in the collection.
|
|
29
|
-
*/
|
|
30
|
-
createAgent(agentSource: string_book): Promisable<AgentBasicInformation>;
|
|
31
|
-
/**
|
|
32
|
-
* Deletes an agent from the collection
|
|
33
|
-
*/
|
|
34
|
-
deleteAgent(agentName: string_agent_name): Promisable<void>;
|
|
35
|
-
};
|
|
9
|
+
export type AgentCollection = AgentCollectionInSupabase;
|
|
36
10
|
/**
|
|
37
11
|
* TODO: [🧠][🚙] `AgentXxx` vs `AgentsXxx` naming convention
|
|
38
12
|
*/
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import type { SupabaseClient } from '@supabase/supabase-js';
|
|
2
|
+
import { BehaviorSubject } from 'rxjs';
|
|
2
3
|
import type { AgentBasicInformation } from '../../../../book-2.0/agent-source/AgentBasicInformation';
|
|
3
4
|
import type { string_book } from '../../../../book-2.0/agent-source/string_book';
|
|
4
5
|
import type { CommonToolsOptions } from '../../../../execution/CommonToolsOptions';
|
|
5
|
-
import type { ExecutionTools } from '../../../../execution/ExecutionTools';
|
|
6
|
-
import { Agent } from '../../../../llm-providers/agent/Agent';
|
|
7
6
|
import type { PrepareAndScrapeOptions } from '../../../../prepare/PrepareAndScrapeOptions';
|
|
8
7
|
import type { string_agent_name } from '../../../../types/typeAliases';
|
|
9
|
-
import type { AgentCollection } from '../../AgentCollection';
|
|
10
8
|
import type { AgentsDatabaseSchema } from './AgentsDatabaseSchema';
|
|
11
9
|
/**
|
|
12
10
|
* Agent collection stored in Supabase table
|
|
@@ -16,28 +14,81 @@ import type { AgentsDatabaseSchema } from './AgentsDatabaseSchema';
|
|
|
16
14
|
* @public exported from `@promptbook/core`
|
|
17
15
|
* <- TODO: !!! Move to `@promptbook/supabase` package
|
|
18
16
|
*/
|
|
19
|
-
export declare class AgentCollectionInSupabase
|
|
17
|
+
export declare class AgentCollectionInSupabase {
|
|
20
18
|
private readonly supabaseClient;
|
|
21
|
-
private readonly tools?;
|
|
22
19
|
readonly options?: (PrepareAndScrapeOptions & CommonToolsOptions) | undefined;
|
|
23
20
|
/**
|
|
24
21
|
* @param rootPath - path to the directory with agents
|
|
25
|
-
* @param tools - Execution tools to be used in `Agent` itself and listing the agents
|
|
22
|
+
* @param tools - Execution tools to be used in !!! `Agent` itself and listing the agents
|
|
26
23
|
* @param options - Options for the collection creation
|
|
27
24
|
*/
|
|
28
|
-
constructor(supabaseClient: SupabaseClient<AgentsDatabaseSchema>,
|
|
25
|
+
constructor(supabaseClient: SupabaseClient<AgentsDatabaseSchema>, options?: (PrepareAndScrapeOptions & CommonToolsOptions) | undefined);
|
|
29
26
|
/**
|
|
30
27
|
* Cached defined execution tools
|
|
31
28
|
*/
|
|
32
|
-
private _definedTools;
|
|
33
29
|
/**
|
|
34
30
|
* Gets all agents in the collection
|
|
35
31
|
*/
|
|
36
32
|
listAgents(): Promise<ReadonlyArray<AgentBasicInformation>>;
|
|
37
33
|
/**
|
|
38
34
|
* !!!
|
|
35
|
+
* /
|
|
36
|
+
public async spawnAgent(agentName: string_agent_name): Promise<Agent> {
|
|
37
|
+
|
|
38
|
+
// <- TODO: !!! ENOENT: no such file or directory, open 'C:\Users\me\work\ai\promptbook\agents\examples\Asistent pro LŠVP.book
|
|
39
|
+
const { isVerbose = DEFAULT_IS_VERBOSE } = this.options || {};
|
|
40
|
+
const tools = await this.getTools();
|
|
41
|
+
|
|
42
|
+
const agentSourceValue = validateBook(await tools.fs!.readFile(agentSourcePath, 'utf-8'));
|
|
43
|
+
const agentSource = new BehaviorSubject(agentSourceValue);
|
|
44
|
+
|
|
45
|
+
// Note: Write file whenever agent source changes
|
|
46
|
+
agentSource.subscribe(async (newSource) => {
|
|
47
|
+
if (isVerbose) {
|
|
48
|
+
console.info(colors.cyan(`Writing agent source to file ${agentSourcePath}`));
|
|
49
|
+
}
|
|
50
|
+
await forTime(500); // <- TODO: [🙌] !!! Remove
|
|
51
|
+
await tools.fs!.writeFile(agentSourcePath, newSource, 'utf-8');
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// Note: Watch file for external changes
|
|
55
|
+
for await (const event of tools.fs!.watch(agentSourcePath)) {
|
|
56
|
+
// <- TODO: !!!! Solve the memory freeing when the watching is no longer needed
|
|
57
|
+
|
|
58
|
+
if (event.eventType !== 'change') {
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (isVerbose) {
|
|
63
|
+
console.info(
|
|
64
|
+
colors.cyan(`Detected external change in agent source file ${agentSourcePath}, reloading`),
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
await forTime(500); // <- TODO: [🙌] !!! Remove
|
|
68
|
+
const newSource = validateBook(await tools.fs!.readFile(agentSourcePath, 'utf-8'));
|
|
69
|
+
agentSource.next(newSource);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// TODO: [🙌] !!!! Debug the infinite loop when file is changed externally and agent source is updated which causes file to be written again
|
|
73
|
+
|
|
74
|
+
const agent = new Agent({
|
|
75
|
+
...this.options,
|
|
76
|
+
agentSource,
|
|
77
|
+
executionTools: this.tools || {},
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
if (isVerbose) {
|
|
81
|
+
console.info(colors.cyan(`Created agent "${agent.agentName}" from source file ${agentSourcePath}`));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return agent;
|
|
85
|
+
* /
|
|
86
|
+
}
|
|
87
|
+
*/
|
|
88
|
+
/**
|
|
89
|
+
* !!!@@@
|
|
39
90
|
*/
|
|
40
|
-
|
|
91
|
+
getAgentSource(agentName: string_agent_name): Promise<BehaviorSubject<string_book>>;
|
|
41
92
|
/**
|
|
42
93
|
* Creates a new agent in the collection
|
|
43
94
|
*
|
|
@@ -50,6 +101,7 @@ export declare class AgentCollectionInSupabase implements AgentCollection {
|
|
|
50
101
|
deleteAgent(agentName: string_agent_name): Promise<void>;
|
|
51
102
|
}
|
|
52
103
|
/**
|
|
104
|
+
* TODO: !!!! Implement it here correctly and update JSDoc comments here, and on interface + other implementations
|
|
53
105
|
* TODO: Write unit test
|
|
54
106
|
* TODO: [🧠][🚙] `AgentXxx` vs `AgentsXxx` naming convention
|
|
55
107
|
*/
|
|
@@ -7,5 +7,6 @@ import { MultipleLlmExecutionTools } from './MultipleLlmExecutionTools';
|
|
|
7
7
|
*/
|
|
8
8
|
export declare function getSingleLlmExecutionTools(oneOrMoreLlmExecutionTools: undefined | LlmExecutionTools | ReadonlyArray<LlmExecutionTools>): LlmExecutionTools | MultipleLlmExecutionTools;
|
|
9
9
|
/**
|
|
10
|
+
* TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
|
|
10
11
|
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
11
12
|
*/
|
|
@@ -18,5 +18,6 @@ import { MultipleLlmExecutionTools } from './MultipleLlmExecutionTools';
|
|
|
18
18
|
*/
|
|
19
19
|
export declare function joinLlmExecutionTools(title: string_title & string_markdown_text, ...llmExecutionTools: ReadonlyArray<LlmExecutionTools>): MultipleLlmExecutionTools;
|
|
20
20
|
/**
|
|
21
|
+
* TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
|
|
21
22
|
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
22
23
|
*/
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { string_book } from '../../book-2.0/agent-source/string_book';
|
|
2
|
+
import { CommonToolsOptions } from '../../execution/CommonToolsOptions';
|
|
2
3
|
import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
|
|
3
4
|
import { OpenAiAssistantExecutionTools } from '../openai/OpenAiAssistantExecutionTools';
|
|
4
5
|
/**
|
|
5
6
|
* Options for creating AgentLlmExecutionTools
|
|
6
7
|
*/
|
|
7
|
-
export type CreateAgentLlmExecutionToolsOptions = {
|
|
8
|
+
export type CreateAgentLlmExecutionToolsOptions = CommonToolsOptions & {
|
|
8
9
|
/**
|
|
9
10
|
* The underlying LLM execution tools to wrap
|
|
10
11
|
*/
|
|
@@ -3,7 +3,7 @@ import type { number_usd } from '../../types/typeAliases';
|
|
|
3
3
|
/**
|
|
4
4
|
* List of available Anthropic Claude models with pricing
|
|
5
5
|
*
|
|
6
|
-
* Note: Synced with official API docs at 2025-
|
|
6
|
+
* Note: Synced with official API docs at 2025-11-19
|
|
7
7
|
*
|
|
8
8
|
* @see https://docs.anthropic.com/en/docs/models-overview
|
|
9
9
|
* @public exported from `@promptbook/anthropic-claude`
|
|
@@ -3,7 +3,7 @@ import type { number_usd } from '../../types/typeAliases';
|
|
|
3
3
|
/**
|
|
4
4
|
* List of available Google models with descriptions
|
|
5
5
|
*
|
|
6
|
-
* Note: Synced with official API docs at 2025-
|
|
6
|
+
* Note: Synced with official API docs at 2025-11-19
|
|
7
7
|
*
|
|
8
8
|
* @see https://ai.google.dev/models/gemini
|
|
9
9
|
* @public exported from `@promptbook/google`
|
|
@@ -2,7 +2,7 @@ import type { AvailableModel } from '../../execution/AvailableModel';
|
|
|
2
2
|
/**
|
|
3
3
|
* List of available OpenAI models with pricing
|
|
4
4
|
*
|
|
5
|
-
* Note: Synced with official API docs at 2025-
|
|
5
|
+
* Note: Synced with official API docs at 2025-11-19
|
|
6
6
|
*
|
|
7
7
|
* @see https://platform.openai.com/docs/models/
|
|
8
8
|
* @see https://openai.com/api/pricing/
|
|
@@ -21,3 +21,6 @@ type AgentsServerOptions = {
|
|
|
21
21
|
*/
|
|
22
22
|
export declare function startAgentServer(options: AgentsServerOptions): Promise<TODO_any>;
|
|
23
23
|
export {};
|
|
24
|
+
/**
|
|
25
|
+
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
26
|
+
*/
|
|
@@ -25,4 +25,5 @@ export declare function startRemoteServer<TCustomOptions = undefined>(options: R
|
|
|
25
25
|
* TODO: [🃏] Pass here some security token to prevent malitious usage and/or DDoS
|
|
26
26
|
* TODO: [0] Set unavailable models as undefined in `RemoteLlmExecutionTools` NOT throw error here
|
|
27
27
|
* TODO: Allow to constrain anonymous mode for specific models / providers
|
|
28
|
+
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
28
29
|
*/
|
|
@@ -142,6 +142,12 @@ export type string_title = string;
|
|
|
142
142
|
* For example `"My AI Assistant"`
|
|
143
143
|
*/
|
|
144
144
|
export type string_agent_name = string;
|
|
145
|
+
/**
|
|
146
|
+
* Semantic helper
|
|
147
|
+
*
|
|
148
|
+
* For example `"My AI Assistant"`
|
|
149
|
+
*/
|
|
150
|
+
export type string_agent_name_in_book = string;
|
|
145
151
|
/**
|
|
146
152
|
* Unstructured description of the persona
|
|
147
153
|
*
|
|
@@ -530,7 +536,19 @@ export type string_dirname = string_absolute_dirname | string_relative_dirname;
|
|
|
530
536
|
*
|
|
531
537
|
* For example `"John Smith"`
|
|
532
538
|
*/
|
|
533
|
-
export type string_person_fullname = string;
|
|
539
|
+
export type string_person_fullname = `${string_person_firstname} ${string_person_lastname}` | string;
|
|
540
|
+
/**
|
|
541
|
+
* Semantic helper
|
|
542
|
+
*
|
|
543
|
+
* For example `"John Smith"`
|
|
544
|
+
*/
|
|
545
|
+
export type string_person_firstname = string;
|
|
546
|
+
/**
|
|
547
|
+
* Semantic helper
|
|
548
|
+
*
|
|
549
|
+
* For example `"John Smith"`
|
|
550
|
+
*/
|
|
551
|
+
export type string_person_lastname = string;
|
|
534
552
|
/**
|
|
535
553
|
* Semantic helper
|
|
536
554
|
* Full profile of the person with his email and web (like in package.json)
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { PartialDeep } from 'type-fest';
|
|
2
2
|
import type { AgentBasicInformation } from '../../book-2.0/agent-source/AgentBasicInformation';
|
|
3
3
|
import { string_book } from '../../book-2.0/agent-source/string_book';
|
|
4
|
-
import {
|
|
4
|
+
import { string_agent_name_in_book } from '../../types/typeAliases';
|
|
5
5
|
type GenerateBookBoilerplateOptions = PartialDeep<Omit<AgentBasicInformation, 'parameters'>> & {
|
|
6
6
|
/**
|
|
7
7
|
* Name of the parent agent to inherit from
|
|
8
8
|
*
|
|
9
9
|
* @default 'Adam'
|
|
10
10
|
*/
|
|
11
|
-
parentAgentName?:
|
|
11
|
+
parentAgentName?: string_agent_name_in_book;
|
|
12
12
|
};
|
|
13
13
|
/**
|
|
14
14
|
* Generates boilerplate for a new agent book
|
|
@@ -20,3 +20,6 @@ type GenerateBookBoilerplateOptions = PartialDeep<Omit<AgentBasicInformation, 'p
|
|
|
20
20
|
*/
|
|
21
21
|
export declare function $generateBookBoilerplate(options?: GenerateBookBoilerplateOptions): string_book;
|
|
22
22
|
export {};
|
|
23
|
+
/**
|
|
24
|
+
* TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
|
|
25
|
+
*/
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { string_color, string_person_fullname } from '../../types/typeAliases';
|
|
2
|
+
export type RandomFullnameWithColorResult = {
|
|
3
|
+
fullname: string_person_fullname;
|
|
4
|
+
color: string_color;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* @private internal helper function
|
|
9
|
+
*/
|
|
10
|
+
export declare function $randomFullnameWithColor(): RandomFullnameWithColorResult;
|
|
11
|
+
/**
|
|
12
|
+
* TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
|
|
13
|
+
*/
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pick random item from the received array
|
|
3
|
+
*
|
|
4
|
+
* @private internal helper function
|
|
5
|
+
*/
|
|
6
|
+
export declare function $randomItem<TItem>(...items: Array<TItem>): TItem;
|
|
7
|
+
/**
|
|
8
|
+
* TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
|
|
9
|
+
*/
|
|
@@ -10,5 +10,6 @@ import type { string_token } from '../../types/typeAliases';
|
|
|
10
10
|
*/
|
|
11
11
|
export declare function $randomToken(randomness: number): string_token;
|
|
12
12
|
/**
|
|
13
|
+
* TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
|
|
13
14
|
* TODO: Maybe use nanoid instead https://github.com/ai/nanoid
|
|
14
15
|
*/
|
|
@@ -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-44`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
package/umd/index.umd.js
CHANGED
|
@@ -49,14 +49,14 @@
|
|
|
49
49
|
* @generated
|
|
50
50
|
* @see https://github.com/webgptorg/book
|
|
51
51
|
*/
|
|
52
|
-
const BOOK_LANGUAGE_VERSION = '
|
|
52
|
+
const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
53
53
|
/**
|
|
54
54
|
* The version of the Promptbook engine
|
|
55
55
|
*
|
|
56
56
|
* @generated
|
|
57
57
|
* @see https://github.com/webgptorg/promptbook
|
|
58
58
|
*/
|
|
59
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-
|
|
59
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-45';
|
|
60
60
|
/**
|
|
61
61
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
62
62
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -3206,6 +3206,9 @@
|
|
|
3206
3206
|
Object.setPrototypeOf(this, DatabaseError.prototype);
|
|
3207
3207
|
}
|
|
3208
3208
|
}
|
|
3209
|
+
/**
|
|
3210
|
+
* TODO: !!!! Explain that NotFoundError (!!! and other specific errors) has priority over DatabaseError in some contexts
|
|
3211
|
+
*/
|
|
3209
3212
|
|
|
3210
3213
|
/**
|
|
3211
3214
|
* This error occurs when some expectation is not met in the execution of the pipeline
|
|
@@ -3322,6 +3325,7 @@
|
|
|
3322
3325
|
return crypto.randomBytes(randomness).toString('hex');
|
|
3323
3326
|
}
|
|
3324
3327
|
/**
|
|
3328
|
+
* TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
|
|
3325
3329
|
* TODO: Maybe use nanoid instead https://github.com/ai/nanoid
|
|
3326
3330
|
*/
|
|
3327
3331
|
|
|
@@ -4684,6 +4688,7 @@
|
|
|
4684
4688
|
return new MultipleLlmExecutionTools(title || 'Multiple LLM Providers joined by `joinLlmExecutionTools`', ...llmExecutionTools);
|
|
4685
4689
|
}
|
|
4686
4690
|
/**
|
|
4691
|
+
* TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
|
|
4687
4692
|
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
4688
4693
|
*/
|
|
4689
4694
|
|
|
@@ -7331,6 +7336,7 @@
|
|
|
7331
7336
|
return llmTools;
|
|
7332
7337
|
}
|
|
7333
7338
|
/**
|
|
7339
|
+
* TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
|
|
7334
7340
|
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
7335
7341
|
*/
|
|
7336
7342
|
|
|
@@ -16374,6 +16380,7 @@
|
|
|
16374
16380
|
* TODO: [🃏] Pass here some security token to prevent malitious usage and/or DDoS
|
|
16375
16381
|
* TODO: [0] Set unavailable models as undefined in `RemoteLlmExecutionTools` NOT throw error here
|
|
16376
16382
|
* TODO: Allow to constrain anonymous mode for specific models / providers
|
|
16383
|
+
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
16377
16384
|
*/
|
|
16378
16385
|
|
|
16379
16386
|
/**
|
|
@@ -16706,7 +16713,7 @@
|
|
|
16706
16713
|
/**
|
|
16707
16714
|
* List of available Anthropic Claude models with pricing
|
|
16708
16715
|
*
|
|
16709
|
-
* Note: Synced with official API docs at 2025-
|
|
16716
|
+
* Note: Synced with official API docs at 2025-11-19
|
|
16710
16717
|
*
|
|
16711
16718
|
* @see https://docs.anthropic.com/en/docs/models-overview
|
|
16712
16719
|
* @public exported from `@promptbook/anthropic-claude`
|
|
@@ -16714,6 +16721,26 @@
|
|
|
16714
16721
|
const ANTHROPIC_CLAUDE_MODELS = exportJson({
|
|
16715
16722
|
name: 'ANTHROPIC_CLAUDE_MODELS',
|
|
16716
16723
|
value: [
|
|
16724
|
+
{
|
|
16725
|
+
modelVariant: 'CHAT',
|
|
16726
|
+
modelTitle: 'Claude Sonnet 4.5',
|
|
16727
|
+
modelName: 'claude-sonnet-4-5-20250929',
|
|
16728
|
+
modelDescription: 'Our smartest model for complex agents and coding',
|
|
16729
|
+
pricing: {
|
|
16730
|
+
prompt: pricing(`$3.00 / 1M tokens`),
|
|
16731
|
+
output: pricing(`$15.00 / 1M tokens`),
|
|
16732
|
+
},
|
|
16733
|
+
},
|
|
16734
|
+
{
|
|
16735
|
+
modelVariant: 'CHAT',
|
|
16736
|
+
modelTitle: 'Claude Haiku 4.5',
|
|
16737
|
+
modelName: 'claude-haiku-4-5-20251001',
|
|
16738
|
+
modelDescription: 'Our fastest model with near-frontier intelligence',
|
|
16739
|
+
pricing: {
|
|
16740
|
+
prompt: pricing(`$1.00 / 1M tokens`),
|
|
16741
|
+
output: pricing(`$5.00 / 1M tokens`),
|
|
16742
|
+
},
|
|
16743
|
+
},
|
|
16717
16744
|
{
|
|
16718
16745
|
modelVariant: 'CHAT',
|
|
16719
16746
|
modelTitle: 'Claude Opus 4.1',
|
|
@@ -16728,7 +16755,7 @@
|
|
|
16728
16755
|
modelVariant: 'CHAT',
|
|
16729
16756
|
modelTitle: 'Claude Opus 4',
|
|
16730
16757
|
modelName: 'claude-opus-4-20250514',
|
|
16731
|
-
modelDescription: 'Previous flagship Claude model with 200K token context window. Features very high intelligence and capability with exceptional performance across reasoning, coding, and creative tasks. Maintains strong safety guardrails while delivering sophisticated outputs for complex professional applications.',
|
|
16758
|
+
modelDescription: 'Previous flagship Claude model with 200K token context window. Features very high intelligence and capability with exceptional performance across reasoning, coding, and creative tasks. Maintains strong safety guardrails while delivering sophisticated outputs for complex professional applications. DEPRECATED: Use Claude Opus 4.1 instead.',
|
|
16732
16759
|
pricing: {
|
|
16733
16760
|
prompt: pricing(`$15.00 / 1M tokens`),
|
|
16734
16761
|
output: pricing(`$75.00 / 1M tokens`),
|
|
@@ -16738,7 +16765,7 @@
|
|
|
16738
16765
|
modelVariant: 'CHAT',
|
|
16739
16766
|
modelTitle: 'Claude Sonnet 4',
|
|
16740
16767
|
modelName: 'claude-sonnet-4-20250514',
|
|
16741
|
-
modelDescription: 'High-performance Claude model with exceptional reasoning capabilities and 200K token context window (1M context beta available). Features balanced intelligence and efficiency with enhanced multimodal understanding. Offers optimal performance for most enterprise applications requiring sophisticated AI capabilities.',
|
|
16768
|
+
modelDescription: 'High-performance Claude model with exceptional reasoning capabilities and 200K token context window (1M context beta available). Features balanced intelligence and efficiency with enhanced multimodal understanding. Offers optimal performance for most enterprise applications requiring sophisticated AI capabilities. DEPRECATED: Use Claude Sonnet 4.5 instead.',
|
|
16742
16769
|
pricing: {
|
|
16743
16770
|
prompt: pricing(`$3.00 / 1M tokens`),
|
|
16744
16771
|
output: pricing(`$15.00 / 1M tokens`),
|
|
@@ -17267,7 +17294,7 @@
|
|
|
17267
17294
|
/**
|
|
17268
17295
|
* List of available OpenAI models with pricing
|
|
17269
17296
|
*
|
|
17270
|
-
* Note: Synced with official API docs at 2025-
|
|
17297
|
+
* Note: Synced with official API docs at 2025-11-19
|
|
17271
17298
|
*
|
|
17272
17299
|
* @see https://platform.openai.com/docs/models/
|
|
17273
17300
|
* @see https://openai.com/api/pricing/
|
|
@@ -17277,11 +17304,21 @@
|
|
|
17277
17304
|
name: 'OPENAI_MODELS',
|
|
17278
17305
|
value: [
|
|
17279
17306
|
/**/
|
|
17307
|
+
{
|
|
17308
|
+
modelVariant: 'CHAT',
|
|
17309
|
+
modelTitle: 'gpt-5.1',
|
|
17310
|
+
modelName: 'gpt-5.1',
|
|
17311
|
+
modelDescription: 'The best model for coding and agentic tasks with configurable reasoning effort.',
|
|
17312
|
+
pricing: {
|
|
17313
|
+
prompt: pricing(`$1.25 / 1M tokens`),
|
|
17314
|
+
output: pricing(`$10.00 / 1M tokens`),
|
|
17315
|
+
},
|
|
17316
|
+
},
|
|
17280
17317
|
{
|
|
17281
17318
|
modelVariant: 'CHAT',
|
|
17282
17319
|
modelTitle: 'gpt-5',
|
|
17283
17320
|
modelName: 'gpt-5',
|
|
17284
|
-
modelDescription: "OpenAI's most advanced language model with unprecedented reasoning capabilities and 200K context window. Features revolutionary improvements in complex problem-solving, scientific reasoning, and creative tasks. Demonstrates human-level performance across diverse domains with enhanced safety measures and alignment. Represents the next generation of AI with superior understanding, nuanced responses, and advanced multimodal capabilities.",
|
|
17321
|
+
modelDescription: "OpenAI's most advanced language model with unprecedented reasoning capabilities and 200K context window. Features revolutionary improvements in complex problem-solving, scientific reasoning, and creative tasks. Demonstrates human-level performance across diverse domains with enhanced safety measures and alignment. Represents the next generation of AI with superior understanding, nuanced responses, and advanced multimodal capabilities. DEPRECATED: Use gpt-5.1 instead.",
|
|
17285
17322
|
pricing: {
|
|
17286
17323
|
prompt: pricing(`$1.25 / 1M tokens`),
|
|
17287
17324
|
output: pricing(`$10.00 / 1M tokens`),
|
|
@@ -18716,7 +18753,7 @@
|
|
|
18716
18753
|
/**
|
|
18717
18754
|
* List of available Google models with descriptions
|
|
18718
18755
|
*
|
|
18719
|
-
* Note: Synced with official API docs at 2025-
|
|
18756
|
+
* Note: Synced with official API docs at 2025-11-19
|
|
18720
18757
|
*
|
|
18721
18758
|
* @see https://ai.google.dev/models/gemini
|
|
18722
18759
|
* @public exported from `@promptbook/google`
|
|
@@ -18724,6 +18761,13 @@
|
|
|
18724
18761
|
const GOOGLE_MODELS = exportJson({
|
|
18725
18762
|
name: 'GOOGLE_MODELS',
|
|
18726
18763
|
value: [
|
|
18764
|
+
{
|
|
18765
|
+
modelVariant: 'CHAT',
|
|
18766
|
+
modelTitle: 'Gemini 3 Pro',
|
|
18767
|
+
modelName: 'gemini-3-pro-preview',
|
|
18768
|
+
modelDescription: 'The best model in the world for multimodal understanding, and our most powerful agentic and vibe-coding model yet, delivering richer visuals and deeper interactivity, all built on a foundation of state-of-the-art reasoning.',
|
|
18769
|
+
// TODO: [🧠] Add pricing information for Gemini 3 Pro
|
|
18770
|
+
},
|
|
18727
18771
|
{
|
|
18728
18772
|
modelVariant: 'CHAT',
|
|
18729
18773
|
modelTitle: 'Gemini 2.5 Pro',
|
|
@@ -20525,11 +20569,11 @@
|
|
|
20525
20569
|
if (!this.isCreatingNewAssistantsAllowed) {
|
|
20526
20570
|
throw new NotAllowed(`Creating new assistants is not allowed. Set \`isCreatingNewAssistantsAllowed: true\` in options to enable this feature.`);
|
|
20527
20571
|
}
|
|
20528
|
-
await this.playground();
|
|
20572
|
+
// await this.playground();
|
|
20529
20573
|
const { name, instructions } = options;
|
|
20530
20574
|
const client = await this.getClient();
|
|
20531
|
-
|
|
20532
|
-
TODO: !!!
|
|
20575
|
+
/*/
|
|
20576
|
+
//TODO: !!!
|
|
20533
20577
|
async function downloadFile(url: string, folder = './tmp'): Promise<string> {
|
|
20534
20578
|
const filename = path.basename(url.split('?')[0]);
|
|
20535
20579
|
const filepath = path.join(folder, filename);
|
|
@@ -20573,8 +20617,8 @@
|
|
|
20573
20617
|
const file = await uploadFileToOpenAI(filepath);
|
|
20574
20618
|
uploadedFiles.push(file.id);
|
|
20575
20619
|
}
|
|
20576
|
-
|
|
20577
|
-
alert('!!!! Creating new OpenAI assistant');
|
|
20620
|
+
/**/
|
|
20621
|
+
// alert('!!!! Creating new OpenAI assistant');
|
|
20578
20622
|
// 3️⃣ Create assistant with uploaded files
|
|
20579
20623
|
const assistant = await client.beta.assistants.create({
|
|
20580
20624
|
name,
|