@promptbook/core 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.
@@ -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/core",
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
@@ -28,7 +28,7 @@
28
28
  * @generated
29
29
  * @see https://github.com/webgptorg/promptbook
30
30
  */
31
- const PROMPTBOOK_ENGINE_VERSION = '0.103.0-44';
31
+ const PROMPTBOOK_ENGINE_VERSION = '0.103.0-46';
32
32
  /**
33
33
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
34
34
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -1543,6 +1543,8 @@
1543
1543
  * Function `validatePipelineString` will validate the if the string is a valid pipeline string
1544
1544
  * 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.
1545
1545
  *
1546
+ * Note: [🔂] This function is idempotent.
1547
+ *
1546
1548
  * @param {string} pipelineString the candidate for a pipeline string
1547
1549
  * @returns {PipelineString} the same string as input, but validated as valid
1548
1550
  * @throws {ParseError} if the string is not a valid pipeline string
@@ -2174,6 +2176,8 @@
2174
2176
  * - if it is valid json
2175
2177
  * - if it is meaningful
2176
2178
  *
2179
+ * Note: [🔂] This function is idempotent.
2180
+ *
2177
2181
  * @param pipeline valid or invalid PipelineJson
2178
2182
  * @returns the same pipeline if it is logically valid
2179
2183
  * @throws {PipelineLogicError} on logical error in the pipeline
@@ -6031,6 +6035,8 @@
6031
6035
  * This function provides a common abstraction for result validation that can be used
6032
6036
  * by both execution logic and caching logic to ensure consistency.
6033
6037
  *
6038
+ * Note: [🔂] This function is idempotent.
6039
+ *
6034
6040
  * @param options - The validation options including result string, expectations, and format
6035
6041
  * @returns Validation result with processed string and validity status
6036
6042
  * @private internal function of `createPipelineExecutor` and `cacheLlmTools`
@@ -9823,6 +9829,8 @@
9823
9829
  /**
9824
9830
  * A function that adds padding to the book content
9825
9831
  *
9832
+ * Note: [🔂] This function is idempotent.
9833
+ *
9826
9834
  * @public exported from `@promptbook/core`
9827
9835
  */
9828
9836
  function padBook(content) {
@@ -9868,6 +9876,8 @@
9868
9876
  * This function should be used when you have a string that you know represents agent source
9869
9877
  * but need to convert it to the branded type for type safety
9870
9878
  *
9879
+ * Note: [🔂] This function is idempotent.
9880
+ *
9871
9881
  * @public exported from `@promptbook/core`
9872
9882
  */
9873
9883
  function validateBook(source) {
@@ -10074,6 +10084,37 @@
10074
10084
  }
10075
10085
  return agentProfile;
10076
10086
  }
10087
+ /**
10088
+ * Updates an existing agent in the collection
10089
+ */
10090
+ async updateAgentSource(agentName, agentSource) {
10091
+ const agentProfile = parseAgentSource(agentSource);
10092
+ // TODO: !!!!!! What about agentName change
10093
+ console.log('!!! agentName', agentName);
10094
+ const oldAgentSource = await this.getAgentSource(agentName);
10095
+ const result = await this.supabaseClient
10096
+ .from('AgentCollection' /* <- TODO: !!!! Change to `Agent` */)
10097
+ .update({
10098
+ // TODO: !!!! Compare not update> agentName: agentProfile.agentName || '!!!!!' /* <- TODO: !!!! Remove */,
10099
+ agentProfile,
10100
+ updatedAt: new Date().toISOString(),
10101
+ agentVersion: 0,
10102
+ agentSource: agentSource,
10103
+ })
10104
+ .eq('agentName', agentName);
10105
+ const newAgentSource = await this.getAgentSource(agentName);
10106
+ console.log('!!! updateAgent', result);
10107
+ console.log('!!! old', oldAgentSource);
10108
+ console.log('!!! new', newAgentSource);
10109
+ if (result.error) {
10110
+ throw new DatabaseError(spaceTrim((block) => `
10111
+ Error updating agent "${agentName}" in Supabase:
10112
+
10113
+ ${block(result.error.message)}
10114
+ `));
10115
+ }
10116
+ }
10117
+ // TODO: !!!! getAgentSourceSubject
10077
10118
  /**
10078
10119
  * Deletes an agent from the collection
10079
10120
  */
@@ -10965,6 +11006,8 @@
10965
11006
  * Function `validateParameterName` will normalize and validate a parameter name for use in pipelines.
10966
11007
  * It removes diacritics, emojis, and quotes, normalizes to camelCase, and checks for reserved names and invalid characters.
10967
11008
  *
11009
+ * Note: [🔂] This function is idempotent.
11010
+ *
10968
11011
  * @param parameterName The parameter name to validate and normalize.
10969
11012
  * @returns The validated and normalized parameter name.
10970
11013
  * @throws {ParseError} If the parameter name is empty, reserved, or contains invalid characters.