@promptbook/node 0.112.0-29 → 0.112.0-31
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 +40 -3
- package/esm/index.es.js.map +1 -1
- package/esm/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +40 -3
- package/umd/index.umd.js.map +1 -1
- package/umd/src/version.d.ts +1 -1
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-30`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/node",
|
|
3
|
-
"version": "0.112.0-
|
|
3
|
+
"version": "0.112.0-31",
|
|
4
4
|
"description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"module": "./esm/index.es.js",
|
|
97
97
|
"typings": "./esm/typings/src/_packages/node.index.d.ts",
|
|
98
98
|
"peerDependencies": {
|
|
99
|
-
"@promptbook/core": "0.112.0-
|
|
99
|
+
"@promptbook/core": "0.112.0-31"
|
|
100
100
|
},
|
|
101
101
|
"dependencies": {
|
|
102
102
|
"@mozilla/readability": "0.6.0",
|
package/umd/index.umd.js
CHANGED
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
* @generated
|
|
49
49
|
* @see https://github.com/webgptorg/promptbook
|
|
50
50
|
*/
|
|
51
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
51
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-31';
|
|
52
52
|
/**
|
|
53
53
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
54
54
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -19201,7 +19201,11 @@
|
|
|
19201
19201
|
*
|
|
19202
19202
|
* @private internal constant for `aggregateUseCommitmentSystemMessages`
|
|
19203
19203
|
*/
|
|
19204
|
-
const AGGREGATED_USE_COMMITMENT_TYPES = [
|
|
19204
|
+
const AGGREGATED_USE_COMMITMENT_TYPES = [
|
|
19205
|
+
'USE BROWSER',
|
|
19206
|
+
'USE SEARCH ENGINE',
|
|
19207
|
+
'USE TIME',
|
|
19208
|
+
];
|
|
19205
19209
|
/**
|
|
19206
19210
|
* Prefix used for temporary in-system-message placeholders that preserve the first-occurrence position of aggregated `USE` sections.
|
|
19207
19211
|
*
|
|
@@ -34124,6 +34128,7 @@
|
|
|
34124
34128
|
|
|
34125
34129
|
- Decide what the agent should learn from this interaction.
|
|
34126
34130
|
- Append new commitments at the end of the agent source.
|
|
34131
|
+
- Return only newly learned commitments, never repeat commitments that are already present.
|
|
34127
34132
|
- Do not modify the current agent source, just return new commitments (KNOWLEDGE, RULE, etc.).
|
|
34128
34133
|
- If there is nothing new to learn, return empty book code block
|
|
34129
34134
|
- Wrap the commitments in a book code block.
|
|
@@ -34176,10 +34181,42 @@
|
|
|
34176
34181
|
*/
|
|
34177
34182
|
appendToAgentSource(section) {
|
|
34178
34183
|
const currentSource = this.options.getAgentSource();
|
|
34179
|
-
const
|
|
34184
|
+
const normalizedSection = normalizeBookSection(section);
|
|
34185
|
+
if (!normalizedSection) {
|
|
34186
|
+
return;
|
|
34187
|
+
}
|
|
34188
|
+
if (containsNormalizedBookSection(currentSource, normalizedSection)) {
|
|
34189
|
+
return;
|
|
34190
|
+
}
|
|
34191
|
+
const newSource = padBook(validateBook(`${normalizeBookSection(currentSource)}\n\n${normalizedSection}`));
|
|
34180
34192
|
this.options.updateAgentSource(newSource);
|
|
34181
34193
|
}
|
|
34182
34194
|
}
|
|
34195
|
+
/**
|
|
34196
|
+
* Normalizes one book fragment for deduplication and append composition.
|
|
34197
|
+
*
|
|
34198
|
+
* @param section Raw fragment from self-learning workflow.
|
|
34199
|
+
* @returns Trimmed fragment, or empty string when nothing remains.
|
|
34200
|
+
* @private function of Agent
|
|
34201
|
+
*/
|
|
34202
|
+
function normalizeBookSection(section) {
|
|
34203
|
+
return _spaceTrim.spaceTrim(section).replace(/\r\n/g, '\n');
|
|
34204
|
+
}
|
|
34205
|
+
/**
|
|
34206
|
+
* Checks whether one normalized fragment already exists inside the current source.
|
|
34207
|
+
*
|
|
34208
|
+
* @param agentSource Current source.
|
|
34209
|
+
* @param normalizedSection Candidate fragment expected to be normalized first.
|
|
34210
|
+
* @returns True when appending would duplicate an existing fragment.
|
|
34211
|
+
* @private function of Agent
|
|
34212
|
+
*/
|
|
34213
|
+
function containsNormalizedBookSection(agentSource, normalizedSection) {
|
|
34214
|
+
if (!normalizedSection) {
|
|
34215
|
+
return true;
|
|
34216
|
+
}
|
|
34217
|
+
const normalizedSource = normalizeBookSection(agentSource);
|
|
34218
|
+
return normalizedSource.includes(normalizedSection);
|
|
34219
|
+
}
|
|
34183
34220
|
/**
|
|
34184
34221
|
* Determines whether the interaction runs in OpenAI-compatible JSON schema mode.
|
|
34185
34222
|
*
|