@promptbook/wizard 0.105.0-5 → 0.105.0-7
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 +31 -12
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/utils.index.d.ts +2 -0
- package/esm/typings/src/commitments/NOTE/NOTE.d.ts +2 -2
- package/esm/typings/src/commitments/index.d.ts +1 -1
- package/esm/typings/src/llm-providers/agent/Agent.d.ts +1 -0
- package/esm/typings/src/llm-providers/agent/AgentOptions.d.ts +7 -0
- package/esm/typings/src/llm-providers/agent/RemoteAgentOptions.d.ts +1 -1
- package/esm/typings/src/utils/misc/linguisticHash.d.ts +6 -0
- package/esm/typings/src/utils/misc/linguisticHash.test.d.ts +1 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +31 -12
- package/umd/index.umd.js.map +1 -1
|
@@ -29,6 +29,7 @@ import { CountUtils } from '../utils/expectation-counters/index';
|
|
|
29
29
|
import { $getCurrentDate } from '../utils/misc/$getCurrentDate';
|
|
30
30
|
import { computeHash } from '../utils/misc/computeHash';
|
|
31
31
|
import { debounce } from '../utils/misc/debounce';
|
|
32
|
+
import { linguisticHash } from '../utils/misc/linguisticHash';
|
|
32
33
|
import { parseNumber } from '../utils/misc/parseNumber';
|
|
33
34
|
import { capitalize } from '../utils/normalization/capitalize';
|
|
34
35
|
import { decapitalize } from '../utils/normalization/decapitalize';
|
|
@@ -118,6 +119,7 @@ export { CountUtils };
|
|
|
118
119
|
export { $getCurrentDate };
|
|
119
120
|
export { computeHash };
|
|
120
121
|
export { debounce };
|
|
122
|
+
export { linguisticHash };
|
|
121
123
|
export { parseNumber };
|
|
122
124
|
export { capitalize };
|
|
123
125
|
export { decapitalize };
|
|
@@ -26,8 +26,8 @@ import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
|
26
26
|
*
|
|
27
27
|
* @private [🪔] Maybe export the commitments through some package
|
|
28
28
|
*/
|
|
29
|
-
export declare class NoteCommitmentDefinition extends BaseCommitmentDefinition<'NOTE' | 'NOTES' | 'COMMENT' | 'NONCE'> {
|
|
30
|
-
constructor(type?: 'NOTE' | 'NOTES' | 'COMMENT' | 'NONCE');
|
|
29
|
+
export declare class NoteCommitmentDefinition extends BaseCommitmentDefinition<'NOTE' | 'NOTES' | 'COMMENT' | 'NONCE' | 'TODO'> {
|
|
30
|
+
constructor(type?: 'NOTE' | 'NOTES' | 'COMMENT' | 'NONCE' | 'TODO');
|
|
31
31
|
/**
|
|
32
32
|
* Short one-line description of NOTE.
|
|
33
33
|
*/
|
|
@@ -44,7 +44,7 @@ import { NotYetImplementedCommitmentDefinition } from './_base/NotYetImplemented
|
|
|
44
44
|
*
|
|
45
45
|
* @private Use functions to access commitments instead of this array directly
|
|
46
46
|
*/
|
|
47
|
-
export declare const COMMITMENT_REGISTRY: readonly [PersonaCommitmentDefinition, PersonaCommitmentDefinition, KnowledgeCommitmentDefinition, MemoryCommitmentDefinition, MemoryCommitmentDefinition, StyleCommitmentDefinition, StyleCommitmentDefinition, RuleCommitmentDefinition, RuleCommitmentDefinition, LanguageCommitmentDefinition, LanguageCommitmentDefinition, SampleCommitmentDefinition, SampleCommitmentDefinition, FormatCommitmentDefinition, FormatCommitmentDefinition, FromCommitmentDefinition, ImportCommitmentDefinition, ImportCommitmentDefinition, ModelCommitmentDefinition, ModelCommitmentDefinition, ActionCommitmentDefinition, ActionCommitmentDefinition, ComponentCommitmentDefinition, MetaImageCommitmentDefinition, MetaColorCommitmentDefinition, MetaFontCommitmentDefinition, MetaLinkCommitmentDefinition, MetaCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, GoalCommitmentDefinition, GoalCommitmentDefinition, InitialMessageCommitmentDefinition, UserMessageCommitmentDefinition, AgentMessageCommitmentDefinition, MessageCommitmentDefinition, MessageCommitmentDefinition, ScenarioCommitmentDefinition, ScenarioCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DictionaryCommitmentDefinition, OpenCommitmentDefinition, ClosedCommitmentDefinition, UseBrowserCommitmentDefinition, UseSearchEngineCommitmentDefinition, UseTimeCommitmentDefinition, UseMcpCommitmentDefinition, UseCommitmentDefinition, NotYetImplementedCommitmentDefinition<"EXPECT">, NotYetImplementedCommitmentDefinition<"BEHAVIOUR">, NotYetImplementedCommitmentDefinition<"BEHAVIOURS">, NotYetImplementedCommitmentDefinition<"AVOID">, NotYetImplementedCommitmentDefinition<"AVOIDANCE">, NotYetImplementedCommitmentDefinition<"CONTEXT">];
|
|
47
|
+
export declare const COMMITMENT_REGISTRY: readonly [PersonaCommitmentDefinition, PersonaCommitmentDefinition, KnowledgeCommitmentDefinition, MemoryCommitmentDefinition, MemoryCommitmentDefinition, StyleCommitmentDefinition, StyleCommitmentDefinition, RuleCommitmentDefinition, RuleCommitmentDefinition, LanguageCommitmentDefinition, LanguageCommitmentDefinition, SampleCommitmentDefinition, SampleCommitmentDefinition, FormatCommitmentDefinition, FormatCommitmentDefinition, FromCommitmentDefinition, ImportCommitmentDefinition, ImportCommitmentDefinition, ModelCommitmentDefinition, ModelCommitmentDefinition, ActionCommitmentDefinition, ActionCommitmentDefinition, ComponentCommitmentDefinition, MetaImageCommitmentDefinition, MetaColorCommitmentDefinition, MetaFontCommitmentDefinition, MetaLinkCommitmentDefinition, MetaCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, GoalCommitmentDefinition, GoalCommitmentDefinition, InitialMessageCommitmentDefinition, UserMessageCommitmentDefinition, AgentMessageCommitmentDefinition, MessageCommitmentDefinition, MessageCommitmentDefinition, ScenarioCommitmentDefinition, ScenarioCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DictionaryCommitmentDefinition, OpenCommitmentDefinition, ClosedCommitmentDefinition, UseBrowserCommitmentDefinition, UseSearchEngineCommitmentDefinition, UseTimeCommitmentDefinition, UseMcpCommitmentDefinition, UseCommitmentDefinition, NotYetImplementedCommitmentDefinition<"EXPECT">, NotYetImplementedCommitmentDefinition<"BEHAVIOUR">, NotYetImplementedCommitmentDefinition<"BEHAVIOURS">, NotYetImplementedCommitmentDefinition<"AVOID">, NotYetImplementedCommitmentDefinition<"AVOIDANCE">, NotYetImplementedCommitmentDefinition<"CONTEXT">];
|
|
48
48
|
/**
|
|
49
49
|
* Gets a commitment definition by its type
|
|
50
50
|
* @param type The commitment type to look up
|
|
@@ -72,6 +72,7 @@ export declare class Agent extends AgentLlmExecutionTools implements LlmExecutio
|
|
|
72
72
|
*/
|
|
73
73
|
get parameters(): Array<BookParameter>;
|
|
74
74
|
readonly agentSource: BehaviorSubject<string_book>;
|
|
75
|
+
private readonly teacherAgent;
|
|
75
76
|
constructor(options: AgentOptions);
|
|
76
77
|
/**
|
|
77
78
|
* Calls the chat model with agent-specific system prompt and requirements with streaming
|
|
@@ -2,6 +2,7 @@ import type { string_book } from '../../book-2.0/agent-source/string_book';
|
|
|
2
2
|
import type { CommonToolsOptions } from '../../execution/CommonToolsOptions';
|
|
3
3
|
import type { ExecutionTools } from '../../execution/ExecutionTools';
|
|
4
4
|
import type { Updatable } from '../../types/Updatable';
|
|
5
|
+
import { Agent } from './Agent';
|
|
5
6
|
/**
|
|
6
7
|
* Options for creating an Agent
|
|
7
8
|
*/
|
|
@@ -16,4 +17,10 @@ export type AgentOptions = CommonToolsOptions & {
|
|
|
16
17
|
* The source of the agent
|
|
17
18
|
*/
|
|
18
19
|
agentSource: Updatable<string_book>;
|
|
20
|
+
/**
|
|
21
|
+
* Teacher agent for self-learning
|
|
22
|
+
*
|
|
23
|
+
* Note: If provided, the agent can do full self-learning from the teacher agent during its operation.
|
|
24
|
+
*/
|
|
25
|
+
teacherAgent: Agent | null;
|
|
19
26
|
};
|
|
@@ -3,7 +3,7 @@ import type { string_agent_url } from '../../types/typeAliases';
|
|
|
3
3
|
/**
|
|
4
4
|
* Options for creating a Remote Agent
|
|
5
5
|
*/
|
|
6
|
-
export type RemoteAgentOptions = CommonToolsOptions & {
|
|
6
|
+
export type RemoteAgentOptions = Omit<CommonToolsOptions, 'teacherAgent'> & {
|
|
7
7
|
/**
|
|
8
8
|
* Url of the remote agent
|
|
9
9
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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.105.0-
|
|
18
|
+
* It follows semantic versioning (e.g., `0.105.0-6`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/wizard",
|
|
3
|
-
"version": "0.105.0-
|
|
3
|
+
"version": "0.105.0-7",
|
|
4
4
|
"description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"module": "./esm/index.es.js",
|
|
96
96
|
"typings": "./esm/typings/src/_packages/wizard.index.d.ts",
|
|
97
97
|
"peerDependencies": {
|
|
98
|
-
"@promptbook/core": "0.105.0-
|
|
98
|
+
"@promptbook/core": "0.105.0-7"
|
|
99
99
|
},
|
|
100
100
|
"dependencies": {
|
|
101
101
|
"@ai-sdk/deepseek": "0.1.17",
|
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.105.0-
|
|
51
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.105.0-7';
|
|
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
|
|
@@ -7505,6 +7505,17 @@
|
|
|
7505
7505
|
* TODO: [🥬][🥬] Use this ACRY
|
|
7506
7506
|
*/
|
|
7507
7507
|
|
|
7508
|
+
/**
|
|
7509
|
+
* Makes first letter of a string uppercase
|
|
7510
|
+
*
|
|
7511
|
+
* Note: [🔂] This function is idempotent.
|
|
7512
|
+
*
|
|
7513
|
+
* @public exported from `@promptbook/utils`
|
|
7514
|
+
*/
|
|
7515
|
+
function capitalize(word) {
|
|
7516
|
+
return word.substring(0, 1).toUpperCase() + word.substring(1);
|
|
7517
|
+
}
|
|
7518
|
+
|
|
7508
7519
|
/**
|
|
7509
7520
|
* Function parseNumber will parse number from string
|
|
7510
7521
|
*
|
|
@@ -7577,17 +7588,6 @@
|
|
|
7577
7588
|
* TODO: [🧠][🌻] Maybe export through `@promptbook/markdown-utils` not `@promptbook/utils`
|
|
7578
7589
|
*/
|
|
7579
7590
|
|
|
7580
|
-
/**
|
|
7581
|
-
* Makes first letter of a string uppercase
|
|
7582
|
-
*
|
|
7583
|
-
* Note: [🔂] This function is idempotent.
|
|
7584
|
-
*
|
|
7585
|
-
* @public exported from `@promptbook/utils`
|
|
7586
|
-
*/
|
|
7587
|
-
function capitalize(word) {
|
|
7588
|
-
return word.substring(0, 1).toUpperCase() + word.substring(1);
|
|
7589
|
-
}
|
|
7590
|
-
|
|
7591
7591
|
/**
|
|
7592
7592
|
* Makes first letter of a string lowercase
|
|
7593
7593
|
*
|
|
@@ -7717,6 +7717,16 @@
|
|
|
7717
7717
|
trimmedText = spaceTrim$1.spaceTrim(trimmedText);
|
|
7718
7718
|
}
|
|
7719
7719
|
let processedText = trimmedText;
|
|
7720
|
+
// Check for markdown code block
|
|
7721
|
+
const codeBlockRegex = /^```[a-z]*\n([\s\S]*?)\n```\s*$/;
|
|
7722
|
+
const codeBlockMatch = processedText.match(codeBlockRegex);
|
|
7723
|
+
if (codeBlockMatch && codeBlockMatch[1] !== undefined) {
|
|
7724
|
+
// Check if there's only one code block
|
|
7725
|
+
const codeBlockCount = (processedText.match(/```/g) || []).length / 2;
|
|
7726
|
+
if (codeBlockCount === 1) {
|
|
7727
|
+
return unwrapResult(codeBlockMatch[1], { isTrimmed: false, isIntroduceSentenceRemoved: false });
|
|
7728
|
+
}
|
|
7729
|
+
}
|
|
7720
7730
|
if (isIntroduceSentenceRemoved) {
|
|
7721
7731
|
const introduceSentenceRegex = /^[a-zěščřžýáíéúů:\s]*:\s*/i;
|
|
7722
7732
|
if (introduceSentenceRegex.test(text)) {
|
|
@@ -7724,6 +7734,14 @@
|
|
|
7724
7734
|
processedText = processedText.replace(introduceSentenceRegex, '');
|
|
7725
7735
|
}
|
|
7726
7736
|
processedText = spaceTrim$1.spaceTrim(processedText);
|
|
7737
|
+
// Check again for code block after removing introduce sentence
|
|
7738
|
+
const codeBlockMatch2 = processedText.match(codeBlockRegex);
|
|
7739
|
+
if (codeBlockMatch2 && codeBlockMatch2[1] !== undefined) {
|
|
7740
|
+
const codeBlockCount = (processedText.match(/```/g) || []).length / 2;
|
|
7741
|
+
if (codeBlockCount === 1) {
|
|
7742
|
+
return unwrapResult(codeBlockMatch2[1], { isTrimmed: false, isIntroduceSentenceRemoved: false });
|
|
7743
|
+
}
|
|
7744
|
+
}
|
|
7727
7745
|
}
|
|
7728
7746
|
if (processedText.length < 3) {
|
|
7729
7747
|
return trimmedText;
|
|
@@ -18061,6 +18079,7 @@
|
|
|
18061
18079
|
new NoteCommitmentDefinition('NOTES'),
|
|
18062
18080
|
new NoteCommitmentDefinition('COMMENT'),
|
|
18063
18081
|
new NoteCommitmentDefinition('NONCE'),
|
|
18082
|
+
new NoteCommitmentDefinition('TODO'),
|
|
18064
18083
|
new GoalCommitmentDefinition('GOAL'),
|
|
18065
18084
|
new GoalCommitmentDefinition('GOALS'),
|
|
18066
18085
|
new InitialMessageCommitmentDefinition(),
|