@promptbook/browser 0.112.0-26 → 0.112.0-28
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 +154 -35
- package/esm/index.es.js.map +1 -1
- package/esm/src/book-2.0/agent-source/createAgentModelRequirements.useCommitmentAggregation.test.d.ts +1 -0
- package/esm/src/book-components/_common/MenuHoisting/MenuHoistingContext.d.ts +0 -47
- package/esm/src/commitments/USE/aggregateUseCommitmentSystemMessages.d.ts +30 -0
- package/esm/src/commitments/USE_BROWSER/USE_BROWSER.d.ts +3 -2
- package/esm/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +157 -38
- package/umd/index.umd.js.map +1 -1
- package/umd/src/book-2.0/agent-source/createAgentModelRequirements.useCommitmentAggregation.test.d.ts +1 -0
- package/umd/src/book-components/_common/MenuHoisting/MenuHoistingContext.d.ts +0 -47
- package/umd/src/commitments/USE/aggregateUseCommitmentSystemMessages.d.ts +30 -0
- package/umd/src/commitments/USE_BROWSER/USE_BROWSER.d.ts +3 -2
- package/umd/src/version.d.ts +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -26,45 +26,6 @@ export type HoistedMenuItem = {
|
|
|
26
26
|
*/
|
|
27
27
|
isActive?: boolean;
|
|
28
28
|
};
|
|
29
|
-
/**
|
|
30
|
-
* Shared actions provided to hoisted mobile menu-section renderers.
|
|
31
|
-
*
|
|
32
|
-
* @private mechanism inside Promptbook
|
|
33
|
-
*/
|
|
34
|
-
export type HoistedMobileMenuSectionRenderOptions = {
|
|
35
|
-
/**
|
|
36
|
-
* Closes the owning mobile header menu.
|
|
37
|
-
*/
|
|
38
|
-
readonly closeMenu: () => void;
|
|
39
|
-
};
|
|
40
|
-
/**
|
|
41
|
-
* Mobile-only section hoisted into the shared application menu.
|
|
42
|
-
*
|
|
43
|
-
* @private mechanism inside Promptbook
|
|
44
|
-
*/
|
|
45
|
-
export type HoistedMobileMenuSection = {
|
|
46
|
-
/**
|
|
47
|
-
* Stable identifier used to preserve section open state.
|
|
48
|
-
*/
|
|
49
|
-
readonly key: string;
|
|
50
|
-
/**
|
|
51
|
-
* Visible section label rendered by the mobile menu.
|
|
52
|
-
*/
|
|
53
|
-
readonly label: ReactNode;
|
|
54
|
-
/**
|
|
55
|
-
* Whether the section should start expanded whenever the menu opens.
|
|
56
|
-
*/
|
|
57
|
-
readonly isDefaultOpen?: boolean;
|
|
58
|
-
/**
|
|
59
|
-
* Lazily renders section content inside the mobile header menu.
|
|
60
|
-
*/
|
|
61
|
-
readonly renderContent: (options: HoistedMobileMenuSectionRenderOptions) => ReactNode;
|
|
62
|
-
};
|
|
63
|
-
/**
|
|
64
|
-
* Value exposed through the shared menu-hoisting context.
|
|
65
|
-
*
|
|
66
|
-
* @private mechanism inside Promptbook
|
|
67
|
-
*/
|
|
68
29
|
type MenuHoistingContextType = {
|
|
69
30
|
/**
|
|
70
31
|
* The currently hoisted menu items
|
|
@@ -74,14 +35,6 @@ type MenuHoistingContextType = {
|
|
|
74
35
|
* Set the hoisted menu items
|
|
75
36
|
*/
|
|
76
37
|
setMenu: (items: HoistedMenuItem[]) => void;
|
|
77
|
-
/**
|
|
78
|
-
* Mobile-only sections hoisted into the shared application menu.
|
|
79
|
-
*/
|
|
80
|
-
mobileMenuSections: HoistedMobileMenuSection[];
|
|
81
|
-
/**
|
|
82
|
-
* Sets the mobile-only hoisted menu sections.
|
|
83
|
-
*/
|
|
84
|
-
setMobileMenuSections: (sections: HoistedMobileMenuSection[]) => void;
|
|
85
38
|
};
|
|
86
39
|
/**
|
|
87
40
|
* Provider for menu hoisting
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
|
|
2
|
+
import type { ParsedCommitment } from '../_base/ParsedCommitment';
|
|
3
|
+
/**
|
|
4
|
+
* `USE` commitment types whose system-message sections are aggregated after the
|
|
5
|
+
* commitment-by-commitment application step.
|
|
6
|
+
*
|
|
7
|
+
* @private internal utility of `createAgentModelRequirementsWithCommitments`
|
|
8
|
+
*/
|
|
9
|
+
type AggregatedUseCommitmentType = 'USE BROWSER' | 'USE SEARCH ENGINE' | 'USE TIME';
|
|
10
|
+
/**
|
|
11
|
+
* Adds the placeholder for an aggregated `USE` system-message section only once, preserving the section position from the first occurrence.
|
|
12
|
+
*
|
|
13
|
+
* @param requirements - Current model requirements.
|
|
14
|
+
* @param type - Aggregated `USE` commitment type being applied.
|
|
15
|
+
* @returns Requirements with the placeholder inserted when it was not already present.
|
|
16
|
+
* @private internal utility of `USE` commitments
|
|
17
|
+
*/
|
|
18
|
+
export declare function appendAggregatedUseCommitmentPlaceholder(requirements: AgentModelRequirements, type: AggregatedUseCommitmentType): AgentModelRequirements;
|
|
19
|
+
/**
|
|
20
|
+
* Replaces temporary `USE` placeholders with one aggregated system-message block per commitment type.
|
|
21
|
+
*
|
|
22
|
+
* Distinct additional-instruction blocks are merged in stable source order while the hard-coded section is emitted only once.
|
|
23
|
+
*
|
|
24
|
+
* @param requirements - Model requirements produced by commitment-by-commitment application.
|
|
25
|
+
* @param commitments - Filtered commitments in their original source order.
|
|
26
|
+
* @returns Requirements with aggregated `USE` system-message sections.
|
|
27
|
+
* @private internal utility of `createAgentModelRequirementsWithCommitments`
|
|
28
|
+
*/
|
|
29
|
+
export declare function aggregateUseCommitmentSystemMessages(requirements: AgentModelRequirements, commitments: ReadonlyArray<ParsedCommitment>): AgentModelRequirements;
|
|
30
|
+
export {};
|
|
@@ -12,13 +12,14 @@ import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
|
12
12
|
* 1. One-shot URL fetching: Simple function to fetch and scrape URL content
|
|
13
13
|
* 2. Running browser: For complex tasks like scrolling, clicking, form filling, etc.
|
|
14
14
|
*
|
|
15
|
-
* The content following `USE BROWSER` is
|
|
15
|
+
* The content following `USE BROWSER` is an arbitrary text that the agent should know
|
|
16
|
+
* (e.g. browsing scope or preferred sources).
|
|
16
17
|
*
|
|
17
18
|
* Example usage in agent source:
|
|
18
19
|
*
|
|
19
20
|
* ```book
|
|
20
21
|
* USE BROWSER
|
|
21
|
-
* USE BROWSER
|
|
22
|
+
* USE BROWSER Prefer official documentation and source websites.
|
|
22
23
|
* ```
|
|
23
24
|
*
|
|
24
25
|
* @private [🪔] Maybe export the commitments through some package
|
package/esm/src/version.d.ts
CHANGED
|
@@ -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.112.0-
|
|
18
|
+
* It follows semantic versioning (e.g., `0.112.0-27`).
|
|
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.112.0-
|
|
3
|
+
"version": "0.112.0-28",
|
|
4
4
|
"description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"module": "./esm/index.es.js",
|
|
98
98
|
"typings": "./esm/typings/src/_packages/browser.index.d.ts",
|
|
99
99
|
"peerDependencies": {
|
|
100
|
-
"@promptbook/core": "0.112.0-
|
|
100
|
+
"@promptbook/core": "0.112.0-28"
|
|
101
101
|
},
|
|
102
102
|
"dependencies": {
|
|
103
103
|
"@openai/agents": "0.4.12",
|
package/umd/index.umd.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('spacetrim'), require('destroyable'), require('rxjs'), require('crypto'), require('crypto-js'), require('crypto-js/enc-hex'), require('path'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'spacetrim', 'destroyable', 'rxjs', 'crypto', 'crypto-js', 'crypto-js/enc-hex', 'path', '
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-browser"] = {}, global.spacetrim, global.destroyable, global.rxjs, global.crypto, global.cryptoJs, global.hexEncoder, global.path, global.
|
|
5
|
-
})(this, (function (exports, spacetrim, destroyable, rxjs, crypto, cryptoJs, hexEncoder, path,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('spacetrim'), require('destroyable'), require('rxjs'), require('crypto'), require('crypto-js'), require('crypto-js/enc-hex'), require('path'), require('moment'), require('mime-types'), require('waitasecond'), require('crypto-js/sha256'), require('papaparse'), require('@openai/agents'), require('bottleneck'), require('colors'), require('openai')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'spacetrim', 'destroyable', 'rxjs', 'crypto', 'crypto-js', 'crypto-js/enc-hex', 'path', 'moment', 'mime-types', 'waitasecond', 'crypto-js/sha256', 'papaparse', '@openai/agents', 'bottleneck', 'colors', 'openai'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-browser"] = {}, global.spacetrim, global.destroyable, global.rxjs, global.crypto, global.cryptoJs, global.hexEncoder, global.path, global.moment, global.mimeTypes, global.waitasecond, global.sha256, global.papaparse, global.agents, global.Bottleneck, global.colors, global.OpenAI));
|
|
5
|
+
})(this, (function (exports, spacetrim, destroyable, rxjs, crypto, cryptoJs, hexEncoder, path, moment, mimeTypes, waitasecond, sha256, papaparse, agents, Bottleneck, colors, OpenAI) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* @generated
|
|
28
28
|
* @see https://github.com/webgptorg/promptbook
|
|
29
29
|
*/
|
|
30
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
30
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-28';
|
|
31
31
|
/**
|
|
32
32
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
33
33
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -10684,6 +10684,147 @@
|
|
|
10684
10684
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
10685
10685
|
*/
|
|
10686
10686
|
|
|
10687
|
+
/**
|
|
10688
|
+
* All `USE` commitment types currently participating in final system-message aggregation.
|
|
10689
|
+
*
|
|
10690
|
+
* @private internal constant for `aggregateUseCommitmentSystemMessages`
|
|
10691
|
+
*/
|
|
10692
|
+
const AGGREGATED_USE_COMMITMENT_TYPES = ['USE BROWSER', 'USE SEARCH ENGINE', 'USE TIME'];
|
|
10693
|
+
/**
|
|
10694
|
+
* Prefix used for temporary in-system-message placeholders that preserve the first-occurrence position of aggregated `USE` sections.
|
|
10695
|
+
*
|
|
10696
|
+
* @private internal constant for `appendAggregatedUseCommitmentPlaceholder`
|
|
10697
|
+
*/
|
|
10698
|
+
const AGGREGATED_USE_COMMITMENT_PLACEHOLDER_PREFIX = '# AGGREGATED USE COMMITMENT: ';
|
|
10699
|
+
/**
|
|
10700
|
+
* Type guard for `USE` commitment types that are aggregated in the final system message.
|
|
10701
|
+
*
|
|
10702
|
+
* @param type - Commitment type to check.
|
|
10703
|
+
* @returns `true` when the commitment participates in `USE` system-message aggregation.
|
|
10704
|
+
* @private internal utility of `aggregateUseCommitmentSystemMessages`
|
|
10705
|
+
*/
|
|
10706
|
+
function isAggregatedUseCommitmentType(type) {
|
|
10707
|
+
return AGGREGATED_USE_COMMITMENT_TYPES.includes(type);
|
|
10708
|
+
}
|
|
10709
|
+
/**
|
|
10710
|
+
* Creates the placeholder token used to reserve the first-occurrence position of an aggregated `USE` system-message section.
|
|
10711
|
+
*
|
|
10712
|
+
* @param type - Aggregated `USE` commitment type.
|
|
10713
|
+
* @returns Single-line placeholder comment stored in the interim system message.
|
|
10714
|
+
* @private internal utility of `appendAggregatedUseCommitmentPlaceholder`
|
|
10715
|
+
*/
|
|
10716
|
+
function getAggregatedUseCommitmentPlaceholder(type) {
|
|
10717
|
+
return `${AGGREGATED_USE_COMMITMENT_PLACEHOLDER_PREFIX}${type}`;
|
|
10718
|
+
}
|
|
10719
|
+
/**
|
|
10720
|
+
* Combines distinct additional instruction blocks in source order.
|
|
10721
|
+
*
|
|
10722
|
+
* @param additionalInstructions - Deduplicated instruction blocks collected from the agent source.
|
|
10723
|
+
* @returns Combined instruction text ready for `formatOptionalInstructionBlock`.
|
|
10724
|
+
* @private internal utility of `createAggregatedUseCommitmentSystemMessage`
|
|
10725
|
+
*/
|
|
10726
|
+
function combineAdditionalInstructions(additionalInstructions) {
|
|
10727
|
+
return additionalInstructions.join('\n');
|
|
10728
|
+
}
|
|
10729
|
+
/**
|
|
10730
|
+
* Creates the final aggregated system-message section for a supported `USE` commitment type.
|
|
10731
|
+
*
|
|
10732
|
+
* @param type - Aggregated `USE` commitment type.
|
|
10733
|
+
* @param additionalInstructions - Distinct additional instructions in source order.
|
|
10734
|
+
* @returns Final system-message block for the commitment type.
|
|
10735
|
+
* @private internal utility of `aggregateUseCommitmentSystemMessages`
|
|
10736
|
+
*/
|
|
10737
|
+
function createAggregatedUseCommitmentSystemMessage(type, additionalInstructions) {
|
|
10738
|
+
const combinedAdditionalInstructions = combineAdditionalInstructions(additionalInstructions);
|
|
10739
|
+
switch (type) {
|
|
10740
|
+
case 'USE TIME':
|
|
10741
|
+
return spacetrim.spaceTrim((block) => `
|
|
10742
|
+
Time and date context:
|
|
10743
|
+
- It is ${moment__default["default"]().format('MMMM YYYY')} now.
|
|
10744
|
+
- If you need more precise current time information, use the tool "get_current_time".
|
|
10745
|
+
${block(formatOptionalInstructionBlock('Time instructions', combinedAdditionalInstructions))}
|
|
10746
|
+
`);
|
|
10747
|
+
case 'USE BROWSER':
|
|
10748
|
+
return spacetrim.spaceTrim((block) => `
|
|
10749
|
+
You have access to browser tools to fetch and access content from the internet.
|
|
10750
|
+
- Use "fetch_url_content" to retrieve content from specific URLs (webpages or documents) using scrapers.
|
|
10751
|
+
- Use "run_browser" for real interactive browser automation (navigation, clicks, typing, waiting, scrolling).
|
|
10752
|
+
When you need to know information from a specific website or document, use the fetch_url_content tool.
|
|
10753
|
+
${block(formatOptionalInstructionBlock('Browser instructions', combinedAdditionalInstructions))}
|
|
10754
|
+
`);
|
|
10755
|
+
case 'USE SEARCH ENGINE':
|
|
10756
|
+
return spacetrim.spaceTrim((block) => `
|
|
10757
|
+
Tool:
|
|
10758
|
+
- You have access to the web search engine via the tool "web_search".
|
|
10759
|
+
- Use it to find up-to-date information or facts that you don't know.
|
|
10760
|
+
- When you need to know some information from the internet, use the tool provided to you.
|
|
10761
|
+
- Do not make up information when you can search for it.
|
|
10762
|
+
- Do not tell the user you cannot search for information, YOU CAN.
|
|
10763
|
+
${block(formatOptionalInstructionBlock('Search instructions', combinedAdditionalInstructions))}
|
|
10764
|
+
`);
|
|
10765
|
+
}
|
|
10766
|
+
}
|
|
10767
|
+
/**
|
|
10768
|
+
* Adds the placeholder for an aggregated `USE` system-message section only once, preserving the section position from the first occurrence.
|
|
10769
|
+
*
|
|
10770
|
+
* @param requirements - Current model requirements.
|
|
10771
|
+
* @param type - Aggregated `USE` commitment type being applied.
|
|
10772
|
+
* @returns Requirements with the placeholder inserted when it was not already present.
|
|
10773
|
+
* @private internal utility of `USE` commitments
|
|
10774
|
+
*/
|
|
10775
|
+
function appendAggregatedUseCommitmentPlaceholder(requirements, type) {
|
|
10776
|
+
const placeholder = getAggregatedUseCommitmentPlaceholder(type);
|
|
10777
|
+
if (requirements.systemMessage.includes(placeholder)) {
|
|
10778
|
+
return requirements;
|
|
10779
|
+
}
|
|
10780
|
+
const systemMessage = requirements.systemMessage.trim()
|
|
10781
|
+
? `${requirements.systemMessage}\n\n${placeholder}`
|
|
10782
|
+
: placeholder;
|
|
10783
|
+
return {
|
|
10784
|
+
...requirements,
|
|
10785
|
+
systemMessage,
|
|
10786
|
+
};
|
|
10787
|
+
}
|
|
10788
|
+
/**
|
|
10789
|
+
* Replaces temporary `USE` placeholders with one aggregated system-message block per commitment type.
|
|
10790
|
+
*
|
|
10791
|
+
* Distinct additional-instruction blocks are merged in stable source order while the hard-coded section is emitted only once.
|
|
10792
|
+
*
|
|
10793
|
+
* @param requirements - Model requirements produced by commitment-by-commitment application.
|
|
10794
|
+
* @param commitments - Filtered commitments in their original source order.
|
|
10795
|
+
* @returns Requirements with aggregated `USE` system-message sections.
|
|
10796
|
+
* @private internal utility of `createAgentModelRequirementsWithCommitments`
|
|
10797
|
+
*/
|
|
10798
|
+
function aggregateUseCommitmentSystemMessages(requirements, commitments) {
|
|
10799
|
+
const additionalInstructionsByType = new Map();
|
|
10800
|
+
for (const commitment of commitments) {
|
|
10801
|
+
if (!isAggregatedUseCommitmentType(commitment.type)) {
|
|
10802
|
+
continue;
|
|
10803
|
+
}
|
|
10804
|
+
let additionalInstructions = additionalInstructionsByType.get(commitment.type);
|
|
10805
|
+
if (!additionalInstructions) {
|
|
10806
|
+
additionalInstructions = [];
|
|
10807
|
+
additionalInstructionsByType.set(commitment.type, additionalInstructions);
|
|
10808
|
+
}
|
|
10809
|
+
const normalizedContent = spacetrim.spaceTrim(commitment.content);
|
|
10810
|
+
if (normalizedContent && !additionalInstructions.includes(normalizedContent)) {
|
|
10811
|
+
additionalInstructions.push(normalizedContent);
|
|
10812
|
+
}
|
|
10813
|
+
}
|
|
10814
|
+
let systemMessage = requirements.systemMessage;
|
|
10815
|
+
for (const [type, additionalInstructions] of additionalInstructionsByType) {
|
|
10816
|
+
const placeholder = getAggregatedUseCommitmentPlaceholder(type);
|
|
10817
|
+
if (!systemMessage.includes(placeholder)) {
|
|
10818
|
+
continue;
|
|
10819
|
+
}
|
|
10820
|
+
systemMessage = systemMessage.replace(placeholder, createAggregatedUseCommitmentSystemMessage(type, additionalInstructions));
|
|
10821
|
+
}
|
|
10822
|
+
return {
|
|
10823
|
+
...requirements,
|
|
10824
|
+
systemMessage,
|
|
10825
|
+
};
|
|
10826
|
+
}
|
|
10827
|
+
|
|
10687
10828
|
/**
|
|
10688
10829
|
* Client-side safe wrapper for fetching URL content
|
|
10689
10830
|
*
|
|
@@ -10734,13 +10875,14 @@
|
|
|
10734
10875
|
* 1. One-shot URL fetching: Simple function to fetch and scrape URL content
|
|
10735
10876
|
* 2. Running browser: For complex tasks like scrolling, clicking, form filling, etc.
|
|
10736
10877
|
*
|
|
10737
|
-
* The content following `USE BROWSER` is
|
|
10878
|
+
* The content following `USE BROWSER` is an arbitrary text that the agent should know
|
|
10879
|
+
* (e.g. browsing scope or preferred sources).
|
|
10738
10880
|
*
|
|
10739
10881
|
* Example usage in agent source:
|
|
10740
10882
|
*
|
|
10741
10883
|
* ```book
|
|
10742
10884
|
* USE BROWSER
|
|
10743
|
-
* USE BROWSER
|
|
10885
|
+
* USE BROWSER Prefer official documentation and source websites.
|
|
10744
10886
|
* ```
|
|
10745
10887
|
*
|
|
10746
10888
|
* @private [🪔] Maybe export the commitments through some package
|
|
@@ -10778,7 +10920,7 @@
|
|
|
10778
10920
|
|
|
10779
10921
|
## Key aspects
|
|
10780
10922
|
|
|
10781
|
-
- The content following \`USE BROWSER\` is
|
|
10923
|
+
- The content following \`USE BROWSER\` is an arbitrary text that the agent should know (e.g. browsing scope or preferred sources).
|
|
10782
10924
|
- Provides two levels of browser access:
|
|
10783
10925
|
1. **One-shot URL fetching**: Simple function to fetch and scrape URL content (active)
|
|
10784
10926
|
2. **Running browser**: For complex tasks like scrolling, clicking, form filling, etc. (runtime-dependent)
|
|
@@ -10895,20 +11037,14 @@
|
|
|
10895
11037
|
});
|
|
10896
11038
|
}
|
|
10897
11039
|
const updatedTools = [...existingTools, ...toolsToAdd];
|
|
10898
|
-
|
|
10899
|
-
return this.appendToSystemMessage({
|
|
11040
|
+
return appendAggregatedUseCommitmentPlaceholder({
|
|
10900
11041
|
...requirements,
|
|
10901
11042
|
tools: updatedTools,
|
|
10902
11043
|
_metadata: {
|
|
10903
11044
|
...requirements._metadata,
|
|
10904
11045
|
useBrowser: true,
|
|
10905
11046
|
},
|
|
10906
|
-
},
|
|
10907
|
-
You have access to browser tools to fetch and access content from the internet.
|
|
10908
|
-
- Use "fetch_url_content" to retrieve content from specific URLs (webpages or documents) using scrapers.
|
|
10909
|
-
- Use "run_browser" for real interactive browser automation (navigation, clicks, typing, waiting, scrolling).
|
|
10910
|
-
When you need to know information from a specific website or document, use the fetch_url_content tool.
|
|
10911
|
-
`));
|
|
11047
|
+
}, this.type);
|
|
10912
11048
|
}
|
|
10913
11049
|
/**
|
|
10914
11050
|
* Gets the browser tool function implementations.
|
|
@@ -14714,7 +14850,6 @@
|
|
|
14714
14850
|
`);
|
|
14715
14851
|
}
|
|
14716
14852
|
applyToAgentModelRequirements(requirements, content) {
|
|
14717
|
-
const extraInstructions = formatOptionalInstructionBlock('Search instructions', content);
|
|
14718
14853
|
// Get existing tools array or create new one
|
|
14719
14854
|
const existingTools = requirements.tools || [];
|
|
14720
14855
|
// Add 'web_search' to tools if not already present
|
|
@@ -14727,7 +14862,6 @@
|
|
|
14727
14862
|
description: spacetrim.spaceTrim(`
|
|
14728
14863
|
Search the internet for information.
|
|
14729
14864
|
Use this tool when you need to find up-to-date information or facts that you don't know.
|
|
14730
|
-
${!content ? '' : `Search scope / instructions: ${content}`}
|
|
14731
14865
|
`),
|
|
14732
14866
|
parameters: {
|
|
14733
14867
|
type: 'object',
|
|
@@ -14765,23 +14899,14 @@
|
|
|
14765
14899
|
},
|
|
14766
14900
|
},
|
|
14767
14901
|
];
|
|
14768
|
-
|
|
14769
|
-
return this.appendToSystemMessage({
|
|
14902
|
+
return appendAggregatedUseCommitmentPlaceholder({
|
|
14770
14903
|
...requirements,
|
|
14771
14904
|
tools: updatedTools,
|
|
14772
14905
|
_metadata: {
|
|
14773
14906
|
...requirements._metadata,
|
|
14774
14907
|
useSearchEngine: content || true,
|
|
14775
14908
|
},
|
|
14776
|
-
},
|
|
14777
|
-
Tool:
|
|
14778
|
-
- You have access to the web search engine via the tool "web_search".
|
|
14779
|
-
- Use it to find up-to-date information or facts that you don't know.
|
|
14780
|
-
- When you need to know some information from the internet, use the tool provided to you.
|
|
14781
|
-
- Do not make up information when you can search for it.
|
|
14782
|
-
- Do not tell the user you cannot search for information, YOU CAN.
|
|
14783
|
-
${block(extraInstructions)}
|
|
14784
|
-
`));
|
|
14909
|
+
}, this.type);
|
|
14785
14910
|
}
|
|
14786
14911
|
/**
|
|
14787
14912
|
* Gets human-readable titles for tool functions provided by this commitment.
|
|
@@ -15892,7 +16017,6 @@
|
|
|
15892
16017
|
`);
|
|
15893
16018
|
}
|
|
15894
16019
|
applyToAgentModelRequirements(requirements, content) {
|
|
15895
|
-
const extraInstructions = formatOptionalInstructionBlock('Time instructions', content);
|
|
15896
16020
|
// Get existing tools array or create new one
|
|
15897
16021
|
const existingTools = requirements.tools || [];
|
|
15898
16022
|
// Add 'get_current_time' to tools if not already present
|
|
@@ -15916,19 +16040,13 @@
|
|
|
15916
16040
|
},
|
|
15917
16041
|
// <- TODO: !!!! define the function in LLM tools
|
|
15918
16042
|
];
|
|
15919
|
-
|
|
15920
|
-
return this.appendToSystemMessage({
|
|
16043
|
+
return appendAggregatedUseCommitmentPlaceholder({
|
|
15921
16044
|
...requirements,
|
|
15922
16045
|
tools: updatedTools,
|
|
15923
16046
|
_metadata: {
|
|
15924
16047
|
...requirements._metadata,
|
|
15925
16048
|
},
|
|
15926
|
-
},
|
|
15927
|
-
Time and date context:
|
|
15928
|
-
- It is ${moment__default["default"]().format('MMMM YYYY')} now.
|
|
15929
|
-
- If you need more precise current time information, use the tool "get_current_time".
|
|
15930
|
-
${block(extraInstructions)}
|
|
15931
|
-
`));
|
|
16049
|
+
}, this.type);
|
|
15932
16050
|
}
|
|
15933
16051
|
/**
|
|
15934
16052
|
* Gets human-readable titles for tool functions provided by this commitment.
|
|
@@ -22610,6 +22728,7 @@
|
|
|
22610
22728
|
}
|
|
22611
22729
|
}
|
|
22612
22730
|
}
|
|
22731
|
+
requirements = aggregateUseCommitmentSystemMessages(requirements, filteredCommitments);
|
|
22613
22732
|
// Handle IMPORT commitments for generic files
|
|
22614
22733
|
// Note: This logic could be moved to ImportCommitmentDefinition, but it needs to be asynchronous
|
|
22615
22734
|
if (requirements.importedFileUrls && requirements.importedFileUrls.length > 0) {
|