@promptbook/browser 0.104.0 → 0.105.0-0
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 +4 -0
- package/esm/index.es.js +78 -3
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +2 -0
- package/esm/typings/src/book-2.0/agent-source/AgentModelRequirements.d.ts +4 -0
- package/esm/typings/src/book-components/Chat/types/ChatMessage.d.ts +17 -0
- package/esm/typings/src/commitments/IMPORT/IMPORT.d.ts +34 -0
- package/esm/typings/src/commitments/index.d.ts +2 -1
- package/esm/typings/src/config.d.ts +6 -0
- package/esm/typings/src/errors/utils/deserializeError.d.ts +1 -1
- package/esm/typings/src/execution/PromptResult.d.ts +24 -1
- package/esm/typings/src/llm-providers/openai/OpenAiCompatibleExecutionToolsOptions.d.ts +5 -0
- package/esm/typings/src/types/LlmToolDefinition.d.ts +8 -1
- package/esm/typings/src/types/Prompt.d.ts +13 -0
- package/esm/typings/src/utils/misc/parseNumber.d.ts +1 -1
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +78 -3
- package/umd/index.umd.js.map +1 -1
package/README.md
CHANGED
|
@@ -27,6 +27,10 @@ Turn your company's scattered knowledge into AI ready Books
|
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
|
|
30
|
+
<blockquote style="color: #ff8811">
|
|
31
|
+
<b>⚠ Warning:</b> This is a pre-release version of the library. It is not yet ready for production use. Please look at <a href="https://www.npmjs.com/package/@promptbook/core?activeTab=versions">latest stable release</a>.
|
|
32
|
+
</blockquote>
|
|
33
|
+
|
|
30
34
|
## 📦 Package `@promptbook/browser`
|
|
31
35
|
|
|
32
36
|
- Promptbooks are [divided into several](#-packages) packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
|
package/esm/index.es.js
CHANGED
|
@@ -19,7 +19,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
19
19
|
* @generated
|
|
20
20
|
* @see https://github.com/webgptorg/promptbook
|
|
21
21
|
*/
|
|
22
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.
|
|
22
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.105.0-0';
|
|
23
23
|
/**
|
|
24
24
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
25
25
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -3406,6 +3406,79 @@ class FromCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
3406
3406
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
3407
3407
|
*/
|
|
3408
3408
|
|
|
3409
|
+
/**
|
|
3410
|
+
* IMPORT commitment definition
|
|
3411
|
+
*
|
|
3412
|
+
* The IMPORT commitment tells the agent to import content from another agent at the current location.
|
|
3413
|
+
*
|
|
3414
|
+
* Example usage in agent source:
|
|
3415
|
+
*
|
|
3416
|
+
* ```book
|
|
3417
|
+
* IMPORT https://s6.ptbk.io/benjamin-white
|
|
3418
|
+
* ```
|
|
3419
|
+
*
|
|
3420
|
+
* @private [🪔] Maybe export the commitments through some package
|
|
3421
|
+
*/
|
|
3422
|
+
class ImportCommitmentDefinition extends BaseCommitmentDefinition {
|
|
3423
|
+
constructor(type = 'IMPORT') {
|
|
3424
|
+
super(type);
|
|
3425
|
+
}
|
|
3426
|
+
/**
|
|
3427
|
+
* Short one-line description of IMPORT.
|
|
3428
|
+
*/
|
|
3429
|
+
get description() {
|
|
3430
|
+
return 'Import content from another agent.';
|
|
3431
|
+
}
|
|
3432
|
+
/**
|
|
3433
|
+
* Icon for this commitment.
|
|
3434
|
+
*/
|
|
3435
|
+
get icon() {
|
|
3436
|
+
return '📥';
|
|
3437
|
+
}
|
|
3438
|
+
/**
|
|
3439
|
+
* Markdown documentation for IMPORT commitment.
|
|
3440
|
+
*/
|
|
3441
|
+
get documentation() {
|
|
3442
|
+
return spaceTrim$1(`
|
|
3443
|
+
# ${this.type}
|
|
3444
|
+
|
|
3445
|
+
Imports content from another agent at the location of the commitment.
|
|
3446
|
+
|
|
3447
|
+
## Examples
|
|
3448
|
+
|
|
3449
|
+
\`\`\`book
|
|
3450
|
+
My AI Agent
|
|
3451
|
+
|
|
3452
|
+
IMPORT https://s6.ptbk.io/benjamin-white
|
|
3453
|
+
RULE Speak only in English.
|
|
3454
|
+
\`\`\`
|
|
3455
|
+
`);
|
|
3456
|
+
}
|
|
3457
|
+
applyToAgentModelRequirements(requirements, content) {
|
|
3458
|
+
const trimmedContent = content.trim();
|
|
3459
|
+
if (!trimmedContent) {
|
|
3460
|
+
return requirements;
|
|
3461
|
+
}
|
|
3462
|
+
if (!isValidAgentUrl(trimmedContent)) {
|
|
3463
|
+
throw new Error(spaceTrim$1((block) => `
|
|
3464
|
+
Invalid agent URL in IMPORT commitment: "${trimmedContent}"
|
|
3465
|
+
|
|
3466
|
+
\`\`\`book
|
|
3467
|
+
${block(content)}
|
|
3468
|
+
\`\`\`
|
|
3469
|
+
`));
|
|
3470
|
+
}
|
|
3471
|
+
const importedAgentUrl = trimmedContent;
|
|
3472
|
+
return {
|
|
3473
|
+
...requirements,
|
|
3474
|
+
importedAgentUrls: [...(requirements.importedAgentUrls || []), importedAgentUrl],
|
|
3475
|
+
};
|
|
3476
|
+
}
|
|
3477
|
+
}
|
|
3478
|
+
/**
|
|
3479
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
3480
|
+
*/
|
|
3481
|
+
|
|
3409
3482
|
/**
|
|
3410
3483
|
* GOAL commitment definition
|
|
3411
3484
|
*
|
|
@@ -5767,7 +5840,7 @@ class UseBrowserCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
5767
5840
|
// Add 'web_browser' to tools if not already present
|
|
5768
5841
|
const updatedTools = existingTools.some((tool) => tool.name === 'web_browser')
|
|
5769
5842
|
? existingTools
|
|
5770
|
-
: [
|
|
5843
|
+
: ([
|
|
5771
5844
|
// TODO: [🔰] Use through proper MCP server
|
|
5772
5845
|
...existingTools,
|
|
5773
5846
|
{
|
|
@@ -5787,7 +5860,7 @@ class UseBrowserCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
5787
5860
|
required: ['url'],
|
|
5788
5861
|
},
|
|
5789
5862
|
},
|
|
5790
|
-
];
|
|
5863
|
+
]);
|
|
5791
5864
|
// Return requirements with updated tools and metadata
|
|
5792
5865
|
return {
|
|
5793
5866
|
...requirements,
|
|
@@ -6089,6 +6162,8 @@ const COMMITMENT_REGISTRY = [
|
|
|
6089
6162
|
new FormatCommitmentDefinition('FORMAT'),
|
|
6090
6163
|
new FormatCommitmentDefinition('FORMATS'),
|
|
6091
6164
|
new FromCommitmentDefinition('FROM'),
|
|
6165
|
+
new ImportCommitmentDefinition('IMPORT'),
|
|
6166
|
+
new ImportCommitmentDefinition('IMPORTS'),
|
|
6092
6167
|
new ModelCommitmentDefinition('MODEL'),
|
|
6093
6168
|
new ModelCommitmentDefinition('MODELS'),
|
|
6094
6169
|
new ActionCommitmentDefinition('ACTION'),
|