@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.
Files changed (54) hide show
  1. package/apps/agents-server/README.md +3 -0
  2. package/apps/agents-server/TODO.txt +6 -0
  3. package/apps/agents-server/config.ts.todo +312 -0
  4. package/apps/agents-server/next.config.ts +42 -0
  5. package/apps/agents-server/package.json +11 -0
  6. package/apps/agents-server/postcss.config.mjs +8 -0
  7. package/apps/agents-server/public/.gitkeep +0 -0
  8. package/apps/agents-server/public/favicon.ico +0 -0
  9. package/apps/agents-server/public/logo-blue-white-256.png +0 -0
  10. package/apps/agents-server/src/app/AddAgentButton.tsx +20 -0
  11. package/apps/agents-server/src/app/actions.ts +14 -0
  12. package/apps/agents-server/src/app/agents/[agentName]/AgentUrlCopy.tsx +41 -0
  13. package/apps/agents-server/src/app/agents/[agentName]/TODO.txt +1 -0
  14. package/apps/agents-server/src/app/agents/[agentName]/api/book/route.ts +86 -0
  15. package/apps/agents-server/src/app/agents/[agentName]/api/book/test.http +37 -0
  16. package/apps/agents-server/src/app/agents/[agentName]/api/chat/route.ts +60 -0
  17. package/apps/agents-server/src/app/agents/[agentName]/book/BookEditorWrapper.tsx +74 -0
  18. package/apps/agents-server/src/app/agents/[agentName]/book/page.tsx +21 -0
  19. package/apps/agents-server/src/app/agents/[agentName]/book+chat/SelfLearningBook.tsx +203 -0
  20. package/apps/agents-server/src/app/agents/[agentName]/book+chat/page.tsx +18 -0
  21. package/apps/agents-server/src/app/agents/[agentName]/page.tsx +160 -0
  22. package/apps/agents-server/src/app/api/chat/route.ts +32 -0
  23. package/apps/agents-server/src/app/api/chat-streaming/route.ts +44 -0
  24. package/apps/agents-server/src/app/api/long-running-task/route.ts +7 -0
  25. package/apps/agents-server/src/app/api/long-streaming/route.ts +20 -0
  26. package/apps/agents-server/src/app/globals.css +113 -0
  27. package/apps/agents-server/src/app/layout.tsx +72 -0
  28. package/apps/agents-server/src/app/page.tsx +115 -0
  29. package/apps/agents-server/src/deamons/longRunningTask.ts +37 -0
  30. package/apps/agents-server/src/supabase/TODO.txt +1 -0
  31. package/apps/agents-server/src/supabase/getSupabase.ts +25 -0
  32. package/apps/agents-server/src/supabase/getSupabaseForBrowser.ts +37 -0
  33. package/apps/agents-server/src/supabase/getSupabaseForServer.ts +48 -0
  34. package/apps/agents-server/src/supabase/getSupabaseForWorker.ts +42 -0
  35. package/apps/agents-server/src/tools/$provideAgentCollectionForServer.ts +49 -0
  36. package/apps/agents-server/src/tools/$provideExecutionToolsForServer.ts +110 -0
  37. package/apps/agents-server/src/tools/$provideOpenAiAssistantExecutionToolsForServer.ts +35 -0
  38. package/apps/agents-server/tailwind.config.ts +24 -0
  39. package/apps/agents-server/tsconfig.json +29 -0
  40. package/esm/index.es.js +40 -6
  41. package/esm/index.es.js.map +1 -1
  42. package/esm/typings/src/book-2.0/agent-source/padBook.d.ts +2 -0
  43. package/esm/typings/src/book-2.0/agent-source/string_book.d.ts +2 -0
  44. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +4 -0
  45. package/esm/typings/src/conversion/validation/validatePipeline.d.ts +2 -0
  46. package/esm/typings/src/execution/utils/validatePromptResult.d.ts +2 -0
  47. package/esm/typings/src/pipeline/validatePipelineString.d.ts +2 -0
  48. package/esm/typings/src/remote-server/startAgentServer.d.ts +3 -0
  49. package/esm/typings/src/remote-server/startRemoteServer.d.ts +1 -0
  50. package/esm/typings/src/utils/validators/parameterName/validateParameterName.d.ts +2 -0
  51. package/esm/typings/src/version.d.ts +1 -1
  52. package/package.json +1 -1
  53. package/umd/index.umd.js +40 -6
  54. package/umd/index.umd.js.map +1 -1
@@ -8,6 +8,8 @@ export declare const PADDING_LINES = 11;
8
8
  /**
9
9
  * A function that adds padding to the book content
10
10
  *
11
+ * Note: [🔂] This function is idempotent.
12
+ *
11
13
  * @public exported from `@promptbook/core`
12
14
  */
13
15
  export declare function padBook(content: string_book): string_book;
@@ -15,6 +15,8 @@ export declare function isValidBook(value: string): value is string_book;
15
15
  * This function should be used when you have a string that you know represents agent source
16
16
  * but need to convert it to the branded type for type safety
17
17
  *
18
+ * Note: [🔂] This function is idempotent.
19
+ *
18
20
  * @public exported from `@promptbook/core`
19
21
  */
20
22
  export declare function validateBook(source: string): string_book;
@@ -95,6 +95,10 @@ export declare class AgentCollectionInSupabase {
95
95
  * Note: You can set 'PARENT' in the agent source to inherit from another agent in the collection.
96
96
  */
97
97
  createAgent(agentSource: string_book): Promise<AgentBasicInformation>;
98
+ /**
99
+ * Updates an existing agent in the collection
100
+ */
101
+ updateAgentSource(agentName: string_agent_name, agentSource: string_book): Promise<void>;
98
102
  /**
99
103
  * Deletes an agent from the collection
100
104
  */
@@ -9,6 +9,8 @@ import type { PipelineJson } from '../../pipeline/PipelineJson/PipelineJson';
9
9
  * - if it is valid json
10
10
  * - if it is meaningful
11
11
  *
12
+ * Note: [🔂] This function is idempotent.
13
+ *
12
14
  * @param pipeline valid or invalid PipelineJson
13
15
  * @returns the same pipeline if it is logically valid
14
16
  * @throws {PipelineLogicError} on logical error in the pipeline
@@ -46,6 +46,8 @@ export type ValidatePromptResultResult = {
46
46
  * This function provides a common abstraction for result validation that can be used
47
47
  * by both execution logic and caching logic to ensure consistency.
48
48
  *
49
+ * Note: [🔂] This function is idempotent.
50
+ *
49
51
  * @param options - The validation options including result string, expectations, and format
50
52
  * @returns Validation result with processed string and validity status
51
53
  * @private internal function of `createPipelineExecutor` and `cacheLlmTools`
@@ -3,6 +3,8 @@ import type { PipelineString } from './PipelineString';
3
3
  * Function `validatePipelineString` will validate the if the string is a valid pipeline string
4
4
  * 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.
5
5
  *
6
+ * Note: [🔂] This function is idempotent.
7
+ *
6
8
  * @param {string} pipelineString the candidate for a pipeline string
7
9
  * @returns {PipelineString} the same string as input, but validated as valid
8
10
  * @throws {ParseError} if the string is not a valid pipeline string
@@ -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
  */
@@ -3,6 +3,8 @@ import type { string_parameter_name } from '../../../types/typeAliases';
3
3
  * Function `validateParameterName` will normalize and validate a parameter name for use in pipelines.
4
4
  * It removes diacritics, emojis, and quotes, normalizes to camelCase, and checks for reserved names and invalid characters.
5
5
  *
6
+ * Note: [🔂] This function is idempotent.
7
+ *
6
8
  * @param parameterName The parameter name to validate and normalize.
7
9
  * @returns The validated and normalized parameter name.
8
10
  * @throws {ParseError} If the parameter name is empty, reserved, or contains invalid characters.
@@ -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-43`).
18
+ * It follows semantic versioning (e.g., `0.103.0-45`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/cli",
3
- "version": "0.103.0-44",
3
+ "version": "0.103.0-46",
4
4
  "description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
5
5
  "private": false,
6
6
  "sideEffects": false,
package/umd/index.umd.js CHANGED
@@ -56,7 +56,7 @@
56
56
  * @generated
57
57
  * @see https://github.com/webgptorg/promptbook
58
58
  */
59
- const PROMPTBOOK_ENGINE_VERSION = '0.103.0-44';
59
+ const PROMPTBOOK_ENGINE_VERSION = '0.103.0-46';
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
@@ -3956,6 +3956,8 @@
3956
3956
  * This function provides a common abstraction for result validation that can be used
3957
3957
  * by both execution logic and caching logic to ensure consistency.
3958
3958
  *
3959
+ * Note: [🔂] This function is idempotent.
3960
+ *
3959
3961
  * @param options - The validation options including result string, expectations, and format
3960
3962
  * @returns Validation result with processed string and validity status
3961
3963
  * @private internal function of `createPipelineExecutor` and `cacheLlmTools`
@@ -5723,6 +5725,8 @@
5723
5725
  * - if it is valid json
5724
5726
  * - if it is meaningful
5725
5727
  *
5728
+ * Note: [🔂] This function is idempotent.
5729
+ *
5726
5730
  * @param pipeline valid or invalid PipelineJson
5727
5731
  * @returns the same pipeline if it is logically valid
5728
5732
  * @throws {PipelineLogicError} on logical error in the pipeline
@@ -6039,6 +6043,8 @@
6039
6043
  * Function `validatePipelineString` will validate the if the string is a valid pipeline string
6040
6044
  * 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.
6041
6045
  *
6046
+ * Note: [🔂] This function is idempotent.
6047
+ *
6042
6048
  * @param {string} pipelineString the candidate for a pipeline string
6043
6049
  * @returns {PipelineString} the same string as input, but validated as valid
6044
6050
  * @throws {ParseError} if the string is not a valid pipeline string
@@ -10095,6 +10101,8 @@
10095
10101
  * Function `validateParameterName` will normalize and validate a parameter name for use in pipelines.
10096
10102
  * It removes diacritics, emojis, and quotes, normalizes to camelCase, and checks for reserved names and invalid characters.
10097
10103
  *
10104
+ * Note: [🔂] This function is idempotent.
10105
+ *
10098
10106
  * @param parameterName The parameter name to validate and normalize.
10099
10107
  * @returns The validated and normalized parameter name.
10100
10108
  * @throws {ParseError} If the parameter name is empty, reserved, or contains invalid characters.
@@ -12075,6 +12083,8 @@
12075
12083
  /**
12076
12084
  * A function that adds padding to the book content
12077
12085
  *
12086
+ * Note: [🔂] This function is idempotent.
12087
+ *
12078
12088
  * @public exported from `@promptbook/core`
12079
12089
  */
12080
12090
  function padBook(content) {
@@ -15070,6 +15080,33 @@
15070
15080
  * TODO: [🖇] What about symlinks? Maybe flag --follow-symlinks
15071
15081
  */
15072
15082
 
15083
+ /**
15084
+ * !!!!!
15085
+ * Remote server is a proxy server that uses its execution tools internally and exposes the executor interface externally.
15086
+ *
15087
+ * You can simply use `RemoteExecutionTools` on client-side javascript and connect to your remote server.
15088
+ * This is useful to make all logic on browser side but not expose your API keys or no need to use customer's GPU.
15089
+ *
15090
+ * @see https://github.com/webgptorg/promptbook#remote-server
15091
+ * @public exported from `@promptbook/remote-server`
15092
+ * <- TODO: !!!! Maybe change to `@promptbook/agent-server`
15093
+ */
15094
+ async function startAgentServer(options) {
15095
+ const { port = 4440 } = options;
15096
+ // TODO: !!!! [🌕]
15097
+ console.trace(`!!! Starting agents server on port ${port}...`);
15098
+ console.log(`!!! cwd`, process.cwd());
15099
+ console.log(`!!! __dirname`, __dirname);
15100
+ await $execCommand({
15101
+ cwd: './apps/agents-server',
15102
+ command: `next dev --port ${port} `,
15103
+ isVerbose: true,
15104
+ });
15105
+ }
15106
+ /**
15107
+ * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
15108
+ */
15109
+
15073
15110
  /**
15074
15111
  * Initializes `start-agents-server` command for Promptbook CLI utilities
15075
15112
  *
@@ -15149,11 +15186,7 @@
15149
15186
  isVerbose: true,
15150
15187
  });
15151
15188
  */
15152
- await $execCommand({
15153
- cwd: './apps/agents-server',
15154
- command: `next dev --port ${port} `,
15155
- isVerbose: true,
15156
- });
15189
+ await startAgentServer({ port });
15157
15190
  }));
15158
15191
  }
15159
15192
  /**
@@ -16380,6 +16413,7 @@
16380
16413
  * TODO: [🃏] Pass here some security token to prevent malitious usage and/or DDoS
16381
16414
  * TODO: [0] Set unavailable models as undefined in `RemoteLlmExecutionTools` NOT throw error here
16382
16415
  * TODO: Allow to constrain anonymous mode for specific models / providers
16416
+ * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
16383
16417
  */
16384
16418
 
16385
16419
  /**