@promptbook/browser 0.103.0-45 → 0.103.0-47
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/esm/index.es.js +36 -55
- package/esm/index.es.js.map +1 -1
- package/esm/typings/servers.d.ts +1 -7
- package/esm/typings/src/_packages/components.index.d.ts +4 -0
- package/esm/typings/src/_packages/core.index.d.ts +16 -14
- package/esm/typings/src/_packages/types.index.d.ts +12 -6
- package/esm/typings/src/book-2.0/agent-source/AgentModelRequirements.d.ts +6 -1
- package/esm/typings/src/book-2.0/agent-source/AgentSourceParseResult.d.ts +1 -1
- package/esm/typings/src/book-2.0/agent-source/createCommitmentRegex.d.ts +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/book-components/Chat/AgentChat/AgentChat.d.ts +14 -0
- package/esm/typings/src/book-components/Chat/AgentChat/AgentChat.test.d.ts +1 -0
- package/esm/typings/src/book-components/Chat/AgentChat/AgentChatProps.d.ts +13 -0
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +5 -60
- package/esm/typings/src/{book-2.0/commitments → commitments}/ACTION/ACTION.d.ts +1 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/DELETE/DELETE.d.ts +1 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/FORMAT/FORMAT.d.ts +1 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/GOAL/GOAL.d.ts +1 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/KNOWLEDGE/KNOWLEDGE.d.ts +1 -5
- package/esm/typings/src/{book-2.0/commitments → commitments}/MEMORY/MEMORY.d.ts +1 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/MESSAGE/MESSAGE.d.ts +1 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/META/META.d.ts +1 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/META_IMAGE/META_IMAGE.d.ts +1 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/META_LINK/META_LINK.d.ts +1 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/MODEL/MODEL.d.ts +1 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/NOTE/NOTE.d.ts +1 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/PERSONA/PERSONA.d.ts +1 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/RULE/RULE.d.ts +1 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/SAMPLE/SAMPLE.d.ts +1 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/SCENARIO/SCENARIO.d.ts +1 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/STYLE/STYLE.d.ts +1 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/_base/BaseCommitmentDefinition.d.ts +1 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/_base/CommitmentDefinition.d.ts +1 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/_base/NotYetImplementedCommitmentDefinition.d.ts +1 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/_base/createEmptyAgentModelRequirements.d.ts +1 -1
- package/esm/typings/src/conversion/validation/validatePipeline.d.ts +2 -0
- package/esm/typings/src/execution/LlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/execution/utils/validatePromptResult.d.ts +2 -0
- package/esm/typings/src/llm-providers/agent/Agent.d.ts +3 -7
- package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/agent/CreateAgentLlmExecutionToolsOptions.d.ts +1 -1
- package/esm/typings/src/llm-providers/agent/RemoteAgent.d.ts +32 -0
- package/esm/typings/src/llm-providers/agent/RemoteAgentOptions.d.ts +11 -0
- package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +5 -1
- package/esm/typings/src/pipeline/validatePipelineString.d.ts +2 -0
- package/esm/typings/src/storage/_common/PromptbookStorage.d.ts +1 -0
- package/esm/typings/src/types/typeAliases.d.ts +6 -0
- package/esm/typings/src/utils/color/internal-utils/checkChannelValue.d.ts +0 -3
- package/esm/typings/src/utils/random/$generateBookBoilerplate.d.ts +2 -2
- package/esm/typings/src/utils/random/$randomFullnameWithColor.d.ts +1 -1
- package/esm/typings/src/utils/validators/parameterName/validateParameterName.d.ts +2 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +36 -55
- package/umd/index.umd.js.map +1 -1
- /package/esm/typings/src/{book-2.0/commitments → commitments}/_base/BookCommitment.d.ts +0 -0
- /package/esm/typings/src/{book-2.0/commitments → commitments}/_base/ParsedCommitment.d.ts +0 -0
- /package/esm/typings/src/{book-2.0/commitments → commitments}/index.d.ts +0 -0
|
@@ -9,7 +9,7 @@ import { OpenAiExecutionTools } from './OpenAiExecutionTools';
|
|
|
9
9
|
*
|
|
10
10
|
* This is useful for calling OpenAI API with a single assistant, for more wide usage use `OpenAiExecutionTools`.
|
|
11
11
|
*
|
|
12
|
-
* Note: [🦖] There are several different things in Promptbook:
|
|
12
|
+
* !!! Note: [🦖] There are several different things in Promptbook:
|
|
13
13
|
* - `Agent` - which represents an AI Agent with its source, memories, actions, etc. Agent is a higher-level abstraction which is internally using:
|
|
14
14
|
* - `LlmExecutionTools` - which wraps one or more LLM models and provides an interface to execute them
|
|
15
15
|
* - `AgentLlmExecutionTools` - which is a specific implementation of `LlmExecutionTools` that wraps another LlmExecutionTools and applies agent-specific system prompts and requirements
|
|
@@ -42,6 +42,10 @@ export declare class OpenAiAssistantExecutionTools extends OpenAiExecutionTools
|
|
|
42
42
|
* Instructions for the new assistant
|
|
43
43
|
*/
|
|
44
44
|
readonly instructions: string_markdown;
|
|
45
|
+
/**
|
|
46
|
+
* Optional list of knowledge source links (URLs or file paths) to attach to the assistant via vector store
|
|
47
|
+
*/
|
|
48
|
+
readonly knowledgeSources?: ReadonlyArray<string>;
|
|
45
49
|
}): Promise<OpenAiAssistantExecutionTools>;
|
|
46
50
|
/**
|
|
47
51
|
* Discriminant for type guards
|
|
@@ -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
|
|
@@ -360,6 +360,12 @@ export type string_base_url = string;
|
|
|
360
360
|
* For example `"https://promptbook.studio/webgpt/"`
|
|
361
361
|
*/
|
|
362
362
|
export type string_pipeline_root_url = string;
|
|
363
|
+
/**
|
|
364
|
+
* Semantic helper
|
|
365
|
+
*
|
|
366
|
+
* For example `"https://s6.ptbk.io/agents/agent-007"`
|
|
367
|
+
*/
|
|
368
|
+
export type string_agent_url = string;
|
|
363
369
|
/**
|
|
364
370
|
* Semantic helper
|
|
365
371
|
*
|
|
@@ -9,6 +9,3 @@
|
|
|
9
9
|
* @private util of `@promptbook/color`
|
|
10
10
|
*/
|
|
11
11
|
export declare function checkChannelValue(channelName: string, value: number): asserts value is number;
|
|
12
|
-
/**
|
|
13
|
-
* TODO: [🧠][🚓] Is/which combination it better to use asserts/check, validate or is utility function?
|
|
14
|
-
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PartialDeep } from 'type-fest';
|
|
2
2
|
import type { AgentBasicInformation } from '../../book-2.0/agent-source/AgentBasicInformation';
|
|
3
|
-
import { string_book } from '../../book-2.0/agent-source/string_book';
|
|
4
|
-
import { string_agent_name_in_book } from '../../types/typeAliases';
|
|
3
|
+
import type { string_book } from '../../book-2.0/agent-source/string_book';
|
|
4
|
+
import type { 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
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { string_color, string_person_fullname } from '../../types/typeAliases';
|
|
1
|
+
import type { string_color, string_person_fullname } from '../../types/typeAliases';
|
|
2
2
|
export type RandomFullnameWithColorResult = {
|
|
3
3
|
fullname: string_person_fullname;
|
|
4
4
|
color: string_color;
|
|
@@ -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-
|
|
18
|
+
* It follows semantic versioning (e.g., `0.103.0-46`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/browser",
|
|
3
|
-
"version": "0.103.0-
|
|
3
|
+
"version": "0.103.0-47",
|
|
4
4
|
"description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"module": "./esm/index.es.js",
|
|
95
95
|
"typings": "./esm/typings/src/_packages/browser.index.d.ts",
|
|
96
96
|
"peerDependencies": {
|
|
97
|
-
"@promptbook/core": "0.103.0-
|
|
97
|
+
"@promptbook/core": "0.103.0-47"
|
|
98
98
|
},
|
|
99
99
|
"dependencies": {
|
|
100
100
|
"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.103.0-
|
|
25
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-47';
|
|
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
|
|
@@ -383,9 +383,6 @@
|
|
|
383
383
|
throw new Error(`${channelName} channel is greater than 255, it is ${value}`);
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
|
-
/**
|
|
387
|
-
* TODO: [🧠][🚓] Is/which combination it better to use asserts/check, validate or is utility function?
|
|
388
|
-
*/
|
|
389
386
|
|
|
390
387
|
/**
|
|
391
388
|
* Color object represents an RGB color with alpha channel
|
|
@@ -2455,6 +2452,36 @@
|
|
|
2455
2452
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
2456
2453
|
*/
|
|
2457
2454
|
|
|
2455
|
+
/**
|
|
2456
|
+
* Tests if given string is valid URL.
|
|
2457
|
+
*
|
|
2458
|
+
* Note: [🔂] This function is idempotent.
|
|
2459
|
+
* Note: Dataurl are considered perfectly valid.
|
|
2460
|
+
* Note: There are two similar functions:
|
|
2461
|
+
* - `isValidUrl` which tests any URL
|
|
2462
|
+
* - `isValidPipelineUrl` *(this one)* which tests just promptbook URL
|
|
2463
|
+
*
|
|
2464
|
+
* @public exported from `@promptbook/utils`
|
|
2465
|
+
*/
|
|
2466
|
+
function isValidUrl(url) {
|
|
2467
|
+
if (typeof url !== 'string') {
|
|
2468
|
+
return false;
|
|
2469
|
+
}
|
|
2470
|
+
try {
|
|
2471
|
+
if (url.startsWith('blob:')) {
|
|
2472
|
+
url = url.replace(/^blob:/, '');
|
|
2473
|
+
}
|
|
2474
|
+
const urlObject = new URL(url /* because fail is handled */);
|
|
2475
|
+
if (!['http:', 'https:', 'data:'].includes(urlObject.protocol)) {
|
|
2476
|
+
return false;
|
|
2477
|
+
}
|
|
2478
|
+
return true;
|
|
2479
|
+
}
|
|
2480
|
+
catch (error) {
|
|
2481
|
+
return false;
|
|
2482
|
+
}
|
|
2483
|
+
}
|
|
2484
|
+
|
|
2458
2485
|
/**
|
|
2459
2486
|
* KNOWLEDGE commitment definition
|
|
2460
2487
|
*
|
|
@@ -2528,23 +2555,19 @@
|
|
|
2528
2555
|
`);
|
|
2529
2556
|
}
|
|
2530
2557
|
applyToAgentModelRequirements(requirements, content) {
|
|
2531
|
-
var _a;
|
|
2532
2558
|
const trimmedContent = content.trim();
|
|
2533
2559
|
if (!trimmedContent) {
|
|
2534
2560
|
return requirements;
|
|
2535
2561
|
}
|
|
2536
2562
|
// Check if content is a URL (external knowledge source)
|
|
2537
|
-
if (
|
|
2563
|
+
if (isValidUrl(trimmedContent)) {
|
|
2538
2564
|
// Store the URL for later async processing
|
|
2539
2565
|
const updatedRequirements = {
|
|
2540
2566
|
...requirements,
|
|
2541
|
-
|
|
2542
|
-
...requirements.
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
trimmedContent,
|
|
2546
|
-
],
|
|
2547
|
-
},
|
|
2567
|
+
knowledgeSources: [
|
|
2568
|
+
...(requirements.knowledgeSources || []),
|
|
2569
|
+
trimmedContent,
|
|
2570
|
+
],
|
|
2548
2571
|
};
|
|
2549
2572
|
// Add placeholder information about knowledge sources to system message
|
|
2550
2573
|
const knowledgeInfo = `Knowledge Source URL: ${trimmedContent} (will be processed for retrieval during chat)`;
|
|
@@ -2556,18 +2579,6 @@
|
|
|
2556
2579
|
return this.appendToSystemMessage(requirements, knowledgeSection, '\n\n');
|
|
2557
2580
|
}
|
|
2558
2581
|
}
|
|
2559
|
-
/**
|
|
2560
|
-
* Check if content is a URL
|
|
2561
|
-
*/
|
|
2562
|
-
isUrl(content) {
|
|
2563
|
-
try {
|
|
2564
|
-
new URL(content);
|
|
2565
|
-
return true;
|
|
2566
|
-
}
|
|
2567
|
-
catch (_a) {
|
|
2568
|
-
return false;
|
|
2569
|
-
}
|
|
2570
|
-
}
|
|
2571
2582
|
}
|
|
2572
2583
|
/**
|
|
2573
2584
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -4112,36 +4123,6 @@
|
|
|
4112
4123
|
* TODO: [🍏] Implement for MacOs
|
|
4113
4124
|
*/
|
|
4114
4125
|
|
|
4115
|
-
/**
|
|
4116
|
-
* Tests if given string is valid URL.
|
|
4117
|
-
*
|
|
4118
|
-
* Note: [🔂] This function is idempotent.
|
|
4119
|
-
* Note: Dataurl are considered perfectly valid.
|
|
4120
|
-
* Note: There are two similar functions:
|
|
4121
|
-
* - `isValidUrl` which tests any URL
|
|
4122
|
-
* - `isValidPipelineUrl` *(this one)* which tests just promptbook URL
|
|
4123
|
-
*
|
|
4124
|
-
* @public exported from `@promptbook/utils`
|
|
4125
|
-
*/
|
|
4126
|
-
function isValidUrl(url) {
|
|
4127
|
-
if (typeof url !== 'string') {
|
|
4128
|
-
return false;
|
|
4129
|
-
}
|
|
4130
|
-
try {
|
|
4131
|
-
if (url.startsWith('blob:')) {
|
|
4132
|
-
url = url.replace(/^blob:/, '');
|
|
4133
|
-
}
|
|
4134
|
-
const urlObject = new URL(url /* because fail is handled */);
|
|
4135
|
-
if (!['http:', 'https:', 'data:'].includes(urlObject.protocol)) {
|
|
4136
|
-
return false;
|
|
4137
|
-
}
|
|
4138
|
-
return true;
|
|
4139
|
-
}
|
|
4140
|
-
catch (error) {
|
|
4141
|
-
return false;
|
|
4142
|
-
}
|
|
4143
|
-
}
|
|
4144
|
-
|
|
4145
4126
|
const defaultDiacriticsRemovalMap = [
|
|
4146
4127
|
{
|
|
4147
4128
|
base: 'A',
|