@promptbook/cli 0.103.0-44 → 0.103.0-46
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/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/book/route.ts +86 -0
- package/apps/agents-server/src/app/agents/[agentName]/api/book/test.http +37 -0
- package/apps/agents-server/src/app/agents/[agentName]/api/chat/route.ts +60 -0
- package/apps/agents-server/src/app/agents/[agentName]/book/BookEditorWrapper.tsx +74 -0
- package/apps/agents-server/src/app/agents/[agentName]/book/page.tsx +21 -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 +160 -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 +40 -6
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/book-2.0/agent-source/padBook.d.ts +2 -0
- package/esm/typings/src/book-2.0/agent-source/string_book.d.ts +2 -0
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +4 -0
- package/esm/typings/src/conversion/validation/validatePipeline.d.ts +2 -0
- package/esm/typings/src/execution/utils/validatePromptResult.d.ts +2 -0
- package/esm/typings/src/pipeline/validatePipelineString.d.ts +2 -0
- 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/utils/validators/parameterName/validateParameterName.d.ts +2 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +40 -6
- package/umd/index.umd.js.map +1 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use server';
|
|
2
|
+
|
|
3
|
+
import { OpenAiAssistantExecutionTools } from '@promptbook-local/openai';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Cache of provided OpenAiAssistantExecutionTools
|
|
7
|
+
*
|
|
8
|
+
* @private internal cache for `$provideOpenAiAssistantExecutionToolsForServer`
|
|
9
|
+
*/
|
|
10
|
+
let executionTools: null | OpenAiAssistantExecutionTools = null;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* !!!!
|
|
14
|
+
*/
|
|
15
|
+
export async function $provideOpenAiAssistantExecutionToolsForServer(): Promise<OpenAiAssistantExecutionTools> {
|
|
16
|
+
// TODO: !!!! [🌕] DRY
|
|
17
|
+
const isVerbose = true; // <- TODO: !!!! Pass
|
|
18
|
+
|
|
19
|
+
if (executionTools !== null) {
|
|
20
|
+
console.log('!!! Returning cached OpenAiAssistantExecutionTools');
|
|
21
|
+
return executionTools;
|
|
22
|
+
// TODO: !!!! Be aware of options changes
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
console.log('!!! Creating NEW OpenAiAssistantExecutionTools');
|
|
26
|
+
|
|
27
|
+
executionTools = new OpenAiAssistantExecutionTools({
|
|
28
|
+
apiKey: process.env.OPENAI_API_KEY,
|
|
29
|
+
assistantId: '!!!! null',
|
|
30
|
+
isCreatingNewAssistantsAllowed: true,
|
|
31
|
+
isVerbose,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
return executionTools;
|
|
35
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Config } from 'tailwindcss';
|
|
2
|
+
|
|
3
|
+
const config: Config = {
|
|
4
|
+
content: [
|
|
5
|
+
'./src/pages/**/*.{js,ts,jsx,tsx,mdx}',
|
|
6
|
+
'./src/components/**/*.{js,ts,jsx,tsx,mdx}',
|
|
7
|
+
'./src/app/**/*.{js,ts,jsx,tsx,mdx}',
|
|
8
|
+
],
|
|
9
|
+
theme: {
|
|
10
|
+
extend: {
|
|
11
|
+
fontFamily: {
|
|
12
|
+
sans: ['var(--font-geist-sans)', 'Arial', 'Helvetica', 'sans-serif'],
|
|
13
|
+
mono: ['var(--font-geist-mono)', 'Courier New', 'monospace'],
|
|
14
|
+
},
|
|
15
|
+
colors: {
|
|
16
|
+
background: 'var(--background)',
|
|
17
|
+
foreground: 'var(--foreground)',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
plugins: [],
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default config;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "esnext",
|
|
4
|
+
"lib": ["dom", "dom.iterable", "esnext"],
|
|
5
|
+
"allowJs": true,
|
|
6
|
+
"skipLibCheck": true,
|
|
7
|
+
"strict": true,
|
|
8
|
+
"noEmit": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"module": "esnext",
|
|
11
|
+
"moduleResolution": "bundler",
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"isolatedModules": true,
|
|
14
|
+
"jsx": "preserve",
|
|
15
|
+
"incremental": true,
|
|
16
|
+
"plugins": [
|
|
17
|
+
{
|
|
18
|
+
"name": "next"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"paths": {
|
|
22
|
+
"@/*": ["./*"],
|
|
23
|
+
"@common/*": ["../_common/*"],
|
|
24
|
+
"@promptbook-local/*": ["../../src/_packages/*.index"]
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
|
28
|
+
"exclude": ["node_modules"]
|
|
29
|
+
}
|
package/esm/index.es.js
CHANGED
|
@@ -47,7 +47,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
47
47
|
* @generated
|
|
48
48
|
* @see https://github.com/webgptorg/promptbook
|
|
49
49
|
*/
|
|
50
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-
|
|
50
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-46';
|
|
51
51
|
/**
|
|
52
52
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
53
53
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -3947,6 +3947,8 @@ function checkExpectations(expectations, value) {
|
|
|
3947
3947
|
* This function provides a common abstraction for result validation that can be used
|
|
3948
3948
|
* by both execution logic and caching logic to ensure consistency.
|
|
3949
3949
|
*
|
|
3950
|
+
* Note: [🔂] This function is idempotent.
|
|
3951
|
+
*
|
|
3950
3952
|
* @param options - The validation options including result string, expectations, and format
|
|
3951
3953
|
* @returns Validation result with processed string and validity status
|
|
3952
3954
|
* @private internal function of `createPipelineExecutor` and `cacheLlmTools`
|
|
@@ -5714,6 +5716,8 @@ function isValidPipelineUrl(url) {
|
|
|
5714
5716
|
* - if it is valid json
|
|
5715
5717
|
* - if it is meaningful
|
|
5716
5718
|
*
|
|
5719
|
+
* Note: [🔂] This function is idempotent.
|
|
5720
|
+
*
|
|
5717
5721
|
* @param pipeline valid or invalid PipelineJson
|
|
5718
5722
|
* @returns the same pipeline if it is logically valid
|
|
5719
5723
|
* @throws {PipelineLogicError} on logical error in the pipeline
|
|
@@ -6030,6 +6034,8 @@ var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"
|
|
|
6030
6034
|
* Function `validatePipelineString` will validate the if the string is a valid pipeline string
|
|
6031
6035
|
* It does not check if the string is fully logically correct, but if it is a string that can be a pipeline string or the string looks completely different.
|
|
6032
6036
|
*
|
|
6037
|
+
* Note: [🔂] This function is idempotent.
|
|
6038
|
+
*
|
|
6033
6039
|
* @param {string} pipelineString the candidate for a pipeline string
|
|
6034
6040
|
* @returns {PipelineString} the same string as input, but validated as valid
|
|
6035
6041
|
* @throws {ParseError} if the string is not a valid pipeline string
|
|
@@ -10086,6 +10092,8 @@ function removeQuotes(text) {
|
|
|
10086
10092
|
* Function `validateParameterName` will normalize and validate a parameter name for use in pipelines.
|
|
10087
10093
|
* It removes diacritics, emojis, and quotes, normalizes to camelCase, and checks for reserved names and invalid characters.
|
|
10088
10094
|
*
|
|
10095
|
+
* Note: [🔂] This function is idempotent.
|
|
10096
|
+
*
|
|
10089
10097
|
* @param parameterName The parameter name to validate and normalize.
|
|
10090
10098
|
* @returns The validated and normalized parameter name.
|
|
10091
10099
|
* @throws {ParseError} If the parameter name is empty, reserved, or contains invalid characters.
|
|
@@ -12066,6 +12074,8 @@ const PADDING_LINES = 11;
|
|
|
12066
12074
|
/**
|
|
12067
12075
|
* A function that adds padding to the book content
|
|
12068
12076
|
*
|
|
12077
|
+
* Note: [🔂] This function is idempotent.
|
|
12078
|
+
*
|
|
12069
12079
|
* @public exported from `@promptbook/core`
|
|
12070
12080
|
*/
|
|
12071
12081
|
function padBook(content) {
|
|
@@ -15061,6 +15071,33 @@ function $initializeRunCommand(program) {
|
|
|
15061
15071
|
* TODO: [🖇] What about symlinks? Maybe flag --follow-symlinks
|
|
15062
15072
|
*/
|
|
15063
15073
|
|
|
15074
|
+
/**
|
|
15075
|
+
* !!!!!
|
|
15076
|
+
* Remote server is a proxy server that uses its execution tools internally and exposes the executor interface externally.
|
|
15077
|
+
*
|
|
15078
|
+
* You can simply use `RemoteExecutionTools` on client-side javascript and connect to your remote server.
|
|
15079
|
+
* This is useful to make all logic on browser side but not expose your API keys or no need to use customer's GPU.
|
|
15080
|
+
*
|
|
15081
|
+
* @see https://github.com/webgptorg/promptbook#remote-server
|
|
15082
|
+
* @public exported from `@promptbook/remote-server`
|
|
15083
|
+
* <- TODO: !!!! Maybe change to `@promptbook/agent-server`
|
|
15084
|
+
*/
|
|
15085
|
+
async function startAgentServer(options) {
|
|
15086
|
+
const { port = 4440 } = options;
|
|
15087
|
+
// TODO: !!!! [🌕]
|
|
15088
|
+
console.trace(`!!! Starting agents server on port ${port}...`);
|
|
15089
|
+
console.log(`!!! cwd`, process.cwd());
|
|
15090
|
+
console.log(`!!! __dirname`, __dirname);
|
|
15091
|
+
await $execCommand({
|
|
15092
|
+
cwd: './apps/agents-server',
|
|
15093
|
+
command: `next dev --port ${port} `,
|
|
15094
|
+
isVerbose: true,
|
|
15095
|
+
});
|
|
15096
|
+
}
|
|
15097
|
+
/**
|
|
15098
|
+
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
15099
|
+
*/
|
|
15100
|
+
|
|
15064
15101
|
/**
|
|
15065
15102
|
* Initializes `start-agents-server` command for Promptbook CLI utilities
|
|
15066
15103
|
*
|
|
@@ -15140,11 +15177,7 @@ function $initializeStartAgentsServerCommand(program) {
|
|
|
15140
15177
|
isVerbose: true,
|
|
15141
15178
|
});
|
|
15142
15179
|
*/
|
|
15143
|
-
await
|
|
15144
|
-
cwd: './apps/agents-server',
|
|
15145
|
-
command: `next dev --port ${port} `,
|
|
15146
|
-
isVerbose: true,
|
|
15147
|
-
});
|
|
15180
|
+
await startAgentServer({ port });
|
|
15148
15181
|
}));
|
|
15149
15182
|
}
|
|
15150
15183
|
/**
|
|
@@ -16371,6 +16404,7 @@ function startRemoteServer(options) {
|
|
|
16371
16404
|
* TODO: [🃏] Pass here some security token to prevent malitious usage and/or DDoS
|
|
16372
16405
|
* TODO: [0] Set unavailable models as undefined in `RemoteLlmExecutionTools` NOT throw error here
|
|
16373
16406
|
* TODO: Allow to constrain anonymous mode for specific models / providers
|
|
16407
|
+
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
16374
16408
|
*/
|
|
16375
16409
|
|
|
16376
16410
|
/**
|