@promptbook/remote-server 0.112.0-30 → 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 +35 -2
- 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 +35 -2
- 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/remote-server",
|
|
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,
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"module": "./esm/index.es.js",
|
|
99
99
|
"typings": "./esm/typings/src/_packages/remote-server.index.d.ts",
|
|
100
100
|
"peerDependencies": {
|
|
101
|
-
"@promptbook/core": "0.112.0-
|
|
101
|
+
"@promptbook/core": "0.112.0-31"
|
|
102
102
|
},
|
|
103
103
|
"dependencies": {
|
|
104
104
|
"@mozilla/readability": "0.6.0",
|
package/umd/index.umd.js
CHANGED
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
* @generated
|
|
51
51
|
* @see https://github.com/webgptorg/promptbook
|
|
52
52
|
*/
|
|
53
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
53
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-31';
|
|
54
54
|
/**
|
|
55
55
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
56
56
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -31229,6 +31229,7 @@
|
|
|
31229
31229
|
|
|
31230
31230
|
- Decide what the agent should learn from this interaction.
|
|
31231
31231
|
- Append new commitments at the end of the agent source.
|
|
31232
|
+
- Return only newly learned commitments, never repeat commitments that are already present.
|
|
31232
31233
|
- Do not modify the current agent source, just return new commitments (KNOWLEDGE, RULE, etc.).
|
|
31233
31234
|
- If there is nothing new to learn, return empty book code block
|
|
31234
31235
|
- Wrap the commitments in a book code block.
|
|
@@ -31281,10 +31282,42 @@
|
|
|
31281
31282
|
*/
|
|
31282
31283
|
appendToAgentSource(section) {
|
|
31283
31284
|
const currentSource = this.options.getAgentSource();
|
|
31284
|
-
const
|
|
31285
|
+
const normalizedSection = normalizeBookSection(section);
|
|
31286
|
+
if (!normalizedSection) {
|
|
31287
|
+
return;
|
|
31288
|
+
}
|
|
31289
|
+
if (containsNormalizedBookSection(currentSource, normalizedSection)) {
|
|
31290
|
+
return;
|
|
31291
|
+
}
|
|
31292
|
+
const newSource = padBook(validateBook(`${normalizeBookSection(currentSource)}\n\n${normalizedSection}`));
|
|
31285
31293
|
this.options.updateAgentSource(newSource);
|
|
31286
31294
|
}
|
|
31287
31295
|
}
|
|
31296
|
+
/**
|
|
31297
|
+
* Normalizes one book fragment for deduplication and append composition.
|
|
31298
|
+
*
|
|
31299
|
+
* @param section Raw fragment from self-learning workflow.
|
|
31300
|
+
* @returns Trimmed fragment, or empty string when nothing remains.
|
|
31301
|
+
* @private function of Agent
|
|
31302
|
+
*/
|
|
31303
|
+
function normalizeBookSection(section) {
|
|
31304
|
+
return _spaceTrim.spaceTrim(section).replace(/\r\n/g, '\n');
|
|
31305
|
+
}
|
|
31306
|
+
/**
|
|
31307
|
+
* Checks whether one normalized fragment already exists inside the current source.
|
|
31308
|
+
*
|
|
31309
|
+
* @param agentSource Current source.
|
|
31310
|
+
* @param normalizedSection Candidate fragment expected to be normalized first.
|
|
31311
|
+
* @returns True when appending would duplicate an existing fragment.
|
|
31312
|
+
* @private function of Agent
|
|
31313
|
+
*/
|
|
31314
|
+
function containsNormalizedBookSection(agentSource, normalizedSection) {
|
|
31315
|
+
if (!normalizedSection) {
|
|
31316
|
+
return true;
|
|
31317
|
+
}
|
|
31318
|
+
const normalizedSource = normalizeBookSection(agentSource);
|
|
31319
|
+
return normalizedSource.includes(normalizedSection);
|
|
31320
|
+
}
|
|
31288
31321
|
/**
|
|
31289
31322
|
* Determines whether the interaction runs in OpenAI-compatible JSON schema mode.
|
|
31290
31323
|
*
|