@promptbook/wizard 0.103.0-56 → 0.103.0-67
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 +65 -10
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/components.index.d.ts +2 -2
- package/esm/typings/src/_packages/types.index.d.ts +6 -0
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +2 -1
- package/esm/typings/src/book-2.0/agent-source/createCommitmentRegex.d.ts +1 -1
- package/esm/typings/src/book-components/Chat/AgentChat/AgentChat.d.ts +3 -0
- package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +6 -0
- package/esm/typings/src/book-components/PromptbookAgent/PromptbookAgentIntegration.d.ts +52 -0
- package/esm/typings/src/book-components/PromptbookAgent/PromptbookAgentSeamlessIntegration.d.ts +14 -0
- package/esm/typings/src/book-components/icons/SendIcon.d.ts +3 -0
- package/esm/typings/src/commitments/CLOSED/CLOSED.d.ts +4 -0
- package/esm/typings/src/commitments/CLOSED/CLOSED.test.d.ts +4 -0
- package/esm/typings/src/commitments/USE_BROWSER/USE_BROWSER.d.ts +4 -0
- package/esm/typings/src/commitments/_base/BaseCommitmentDefinition.d.ts +6 -0
- package/esm/typings/src/llm-providers/agent/Agent.d.ts +3 -1
- package/esm/typings/src/other/templates/getTemplatesPipelineCollection.d.ts +1 -1
- package/esm/typings/src/types/typeAliases.d.ts +6 -0
- package/esm/typings/src/utils/color/Color.d.ts +1 -1
- package/esm/typings/src/utils/random/$generateBookBoilerplate.d.ts +6 -0
- package/esm/typings/src/utils/random/CzechNamePool.d.ts +7 -0
- package/esm/typings/src/utils/random/EnglishNamePool.d.ts +7 -0
- package/esm/typings/src/utils/random/NamePool.d.ts +17 -0
- package/esm/typings/src/utils/random/getNamePool.d.ts +10 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +3 -3
- package/umd/index.umd.js +65 -10
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/book-components/PromptbookAgent/PromptbookAgent.d.ts +0 -29
|
@@ -52,7 +52,7 @@ import { ResetIcon } from '../book-components/icons/ResetIcon';
|
|
|
52
52
|
import { SaveIcon } from '../book-components/icons/SaveIcon';
|
|
53
53
|
import { SendIcon } from '../book-components/icons/SendIcon';
|
|
54
54
|
import { TemplateIcon } from '../book-components/icons/TemplateIcon';
|
|
55
|
-
import {
|
|
55
|
+
import { PromptbookAgentIntegration } from '../book-components/PromptbookAgent/PromptbookAgentIntegration';
|
|
56
56
|
import { BrandedQrCode } from '../book-components/Qr/BrandedQrCode';
|
|
57
57
|
import { GenericQrCode } from '../book-components/Qr/GenericQrCode';
|
|
58
58
|
import { PromptbookQrCode } from '../book-components/Qr/PromptbookQrCode';
|
|
@@ -112,7 +112,7 @@ export { ResetIcon };
|
|
|
112
112
|
export { SaveIcon };
|
|
113
113
|
export { SendIcon };
|
|
114
114
|
export { TemplateIcon };
|
|
115
|
-
export {
|
|
115
|
+
export { PromptbookAgentIntegration };
|
|
116
116
|
export { BrandedQrCode };
|
|
117
117
|
export { GenericQrCode };
|
|
118
118
|
export { PromptbookQrCode };
|
|
@@ -245,6 +245,7 @@ import type { string_typescript } from '../types/typeAliases';
|
|
|
245
245
|
import type { string_json } from '../types/typeAliases';
|
|
246
246
|
import type { string_css_class } from '../types/typeAliases';
|
|
247
247
|
import type { string_css_property } from '../types/typeAliases';
|
|
248
|
+
import type { string_fonts } from '../types/typeAliases';
|
|
248
249
|
import type { string_css_value } from '../types/typeAliases';
|
|
249
250
|
import type { string_css_selector } from '../types/typeAliases';
|
|
250
251
|
import type { string_url } from '../types/typeAliases';
|
|
@@ -352,6 +353,8 @@ import type { empty_object } from '../utils/organization/empty_object';
|
|
|
352
353
|
import type { really_any } from '../utils/organization/really_any';
|
|
353
354
|
import type { TODO_any } from '../utils/organization/TODO_any';
|
|
354
355
|
import type { RandomFullnameWithColorResult } from '../utils/random/$randomFullnameWithColor';
|
|
356
|
+
import type { GenerateNameResult } from '../utils/random/NamePool';
|
|
357
|
+
import type { NamePool } from '../utils/random/NamePool';
|
|
355
358
|
import type { CheckSerializableAsJsonOptions } from '../utils/serialization/checkSerializableAsJson';
|
|
356
359
|
import type { ExportJsonOptions } from '../utils/serialization/exportJson';
|
|
357
360
|
import type { ITakeChain } from '../utils/take/interfaces/ITakeChain';
|
|
@@ -603,6 +606,7 @@ export type { string_typescript };
|
|
|
603
606
|
export type { string_json };
|
|
604
607
|
export type { string_css_class };
|
|
605
608
|
export type { string_css_property };
|
|
609
|
+
export type { string_fonts };
|
|
606
610
|
export type { string_css_value };
|
|
607
611
|
export type { string_css_selector };
|
|
608
612
|
export type { string_url };
|
|
@@ -710,6 +714,8 @@ export type { empty_object };
|
|
|
710
714
|
export type { really_any };
|
|
711
715
|
export type { TODO_any };
|
|
712
716
|
export type { RandomFullnameWithColorResult };
|
|
717
|
+
export type { GenerateNameResult };
|
|
718
|
+
export type { NamePool };
|
|
713
719
|
export type { CheckSerializableAsJsonOptions };
|
|
714
720
|
export type { ExportJsonOptions };
|
|
715
721
|
export type { ITakeChain };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { string_agent_hash, string_agent_name, string_agent_url, string_color, string_url_image } from '../../types/typeAliases';
|
|
1
|
+
import type { string_agent_hash, string_agent_name, string_agent_url, string_color, string_fonts, string_url_image } from '../../types/typeAliases';
|
|
2
2
|
/**
|
|
3
3
|
* Unified parameter representation that supports two different notations:
|
|
4
4
|
* 1. @Parameter - single word parameter starting with @
|
|
@@ -51,6 +51,7 @@ export type AgentBasicInformation = {
|
|
|
51
51
|
meta: {
|
|
52
52
|
fullname?: string;
|
|
53
53
|
image?: string_url_image;
|
|
54
|
+
font?: string_fonts;
|
|
54
55
|
color?: string_color;
|
|
55
56
|
[key: string]: string | undefined;
|
|
56
57
|
};
|
|
@@ -7,7 +7,7 @@ import type { BookCommitment } from '../../commitments/_base/BookCommitment';
|
|
|
7
7
|
*
|
|
8
8
|
* @private - TODO: [🧠] Maybe should be public?
|
|
9
9
|
*/
|
|
10
|
-
export declare function createCommitmentRegex(commitment: BookCommitment, aliases?: BookCommitment[]): RegExp;
|
|
10
|
+
export declare function createCommitmentRegex(commitment: BookCommitment, aliases?: BookCommitment[], requiresContent?: boolean): RegExp;
|
|
11
11
|
/**
|
|
12
12
|
* Generates a regex pattern to match a specific commitment type
|
|
13
13
|
*
|
|
@@ -12,3 +12,6 @@ import type { AgentChatProps } from './AgentChatProps';
|
|
|
12
12
|
* @public exported from `@promptbook/components`
|
|
13
13
|
*/
|
|
14
14
|
export declare function AgentChat(props: AgentChatProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
/**
|
|
16
|
+
* TODO: !!!! Search ACRY ".meta.color" and make sure that we count that we count color can be array
|
|
17
|
+
*/
|
|
@@ -3,6 +3,8 @@ import type { Promisable } from 'type-fest';
|
|
|
3
3
|
import type { string_chat_format_name } from '../save/_common/string_chat_format_name';
|
|
4
4
|
import type { ChatMessage } from '../types/ChatMessage';
|
|
5
5
|
import type { ChatParticipant } from '../types/ChatParticipant';
|
|
6
|
+
import { string_color } from '../../../types/typeAliases';
|
|
7
|
+
import { Color } from '../../../_packages/color.index';
|
|
6
8
|
/**
|
|
7
9
|
* @public exported from `@promptbook/components`
|
|
8
10
|
*/
|
|
@@ -87,6 +89,10 @@ export type ChatProps = {
|
|
|
87
89
|
* instead of its default position within the chat.
|
|
88
90
|
*/
|
|
89
91
|
readonly actionsContainer?: HTMLElement | null;
|
|
92
|
+
/**
|
|
93
|
+
* Color of the action buttons (send, reset, voice, etc.)
|
|
94
|
+
*/
|
|
95
|
+
readonly buttonColor?: string_color | Color;
|
|
90
96
|
/**
|
|
91
97
|
* Optional CSS class name which will be added to root <div/> element
|
|
92
98
|
*/
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
import type { AgentBasicInformation } from '../../book-2.0/agent-source/AgentBasicInformation';
|
|
3
|
+
import { string_css_class } from '../../types/typeAliases';
|
|
4
|
+
/**
|
|
5
|
+
* @private props of PromptbookAgentIntegration component
|
|
6
|
+
*/
|
|
7
|
+
export type PromptbookAgentIntegrationProps = {
|
|
8
|
+
/**
|
|
9
|
+
* URL of the agent to connect to
|
|
10
|
+
*
|
|
11
|
+
* @example "http://s6.ptbk.io/benjamin-white"
|
|
12
|
+
*/
|
|
13
|
+
readonly agentUrl: string;
|
|
14
|
+
/**
|
|
15
|
+
* Form of the agent integration
|
|
16
|
+
*
|
|
17
|
+
* @default `seamless`
|
|
18
|
+
*
|
|
19
|
+
* - `seamless` Default, current behavior
|
|
20
|
+
* - `book` Show the Agent as a book in BookEditor
|
|
21
|
+
* - `chat` Show the Agent as a chat which is not floating but as AgentChat component
|
|
22
|
+
* - `profile` Show the Agent as a profile using
|
|
23
|
+
*/
|
|
24
|
+
readonly formfactor?: 'seamless' | 'book' | 'chat' | 'profile';
|
|
25
|
+
/**
|
|
26
|
+
* Optional metadata to show before the agent is connected
|
|
27
|
+
* Or to override the agent metadata if the agent does not provide it
|
|
28
|
+
*/
|
|
29
|
+
readonly meta?: Partial<AgentBasicInformation['meta']>;
|
|
30
|
+
/**
|
|
31
|
+
* Callback when the window is opened or closed
|
|
32
|
+
*/
|
|
33
|
+
onOpenChange?(isOpen: boolean): void;
|
|
34
|
+
/**
|
|
35
|
+
* Optional CSS class name which will be added to root element
|
|
36
|
+
*/
|
|
37
|
+
readonly className?: string_css_class;
|
|
38
|
+
/**
|
|
39
|
+
* Optional CSS style which will be added to root element
|
|
40
|
+
*/
|
|
41
|
+
readonly style?: CSSProperties;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Renders a floating agent button that opens a chat window with the remote agent.
|
|
45
|
+
*
|
|
46
|
+
* @public exported from `@promptbook/components`
|
|
47
|
+
*/
|
|
48
|
+
export declare function PromptbookAgentIntegration(props: PromptbookAgentIntegrationProps): import("react/jsx-runtime").JSX.Element | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* TODO: !!! Load the full branding
|
|
51
|
+
* TODO: !!! <promptbook-agent> element
|
|
52
|
+
*/
|
package/esm/typings/src/book-components/PromptbookAgent/PromptbookAgentSeamlessIntegration.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { PromptbookAgentIntegrationProps } from './PromptbookAgentIntegration';
|
|
2
|
+
type PromptbookAgentSeamlessIntegrationProps = Omit<PromptbookAgentIntegrationProps, 'formfactor'>;
|
|
3
|
+
/**
|
|
4
|
+
* Renders a floating agent button that opens a chat window with the remote agent.
|
|
5
|
+
*
|
|
6
|
+
* @private component of PromptbookAgentIntegration
|
|
7
|
+
*/
|
|
8
|
+
export declare function PromptbookAgentSeamlessIntegration(props: PromptbookAgentSeamlessIntegrationProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
10
|
+
/**
|
|
11
|
+
* TODO: !!!! Use iframe here instead of implementing the chat directly, allow to switch between seamless and iframe mode via `isIframeUsed` prop
|
|
12
|
+
* TODO: !!! Load the full branding
|
|
13
|
+
* TODO: !!! <promptbook-agent> element
|
|
14
|
+
*/
|
|
@@ -16,6 +16,10 @@ import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
|
16
16
|
*/
|
|
17
17
|
export declare class ClosedCommitmentDefinition extends BaseCommitmentDefinition<'CLOSED'> {
|
|
18
18
|
constructor();
|
|
19
|
+
/**
|
|
20
|
+
* The `CLOSED` commitment is standalone.
|
|
21
|
+
*/
|
|
22
|
+
get requiresContent(): boolean;
|
|
19
23
|
/**
|
|
20
24
|
* Short one-line description of CLOSED.
|
|
21
25
|
*/
|
|
@@ -19,6 +19,10 @@ import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
|
19
19
|
*/
|
|
20
20
|
export declare class UseBrowserCommitmentDefinition extends BaseCommitmentDefinition<'USE BROWSER'> {
|
|
21
21
|
constructor();
|
|
22
|
+
/**
|
|
23
|
+
* The `USE BROWSER` commitment is standalone.
|
|
24
|
+
*/
|
|
25
|
+
get requiresContent(): boolean;
|
|
22
26
|
/**
|
|
23
27
|
* Short one-line description of USE BROWSER.
|
|
24
28
|
*/
|
|
@@ -15,6 +15,12 @@ export declare abstract class BaseCommitmentDefinition<TBookCommitment extends s
|
|
|
15
15
|
* Must be implemented by each concrete commitment.
|
|
16
16
|
*/
|
|
17
17
|
abstract get description(): string;
|
|
18
|
+
/**
|
|
19
|
+
* Whether this commitment requires content.
|
|
20
|
+
* If true, regex will match only if there is content after the commitment keyword.
|
|
21
|
+
* If false, regex will match even if there is no content.
|
|
22
|
+
*/
|
|
23
|
+
get requiresContent(): boolean;
|
|
18
24
|
/**
|
|
19
25
|
* Icon for this commitment.
|
|
20
26
|
* It should be a single emoji.
|
|
@@ -4,7 +4,7 @@ import type { string_book } from '../../book-2.0/agent-source/string_book';
|
|
|
4
4
|
import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
|
|
5
5
|
import type { ChatPromptResult } from '../../execution/PromptResult';
|
|
6
6
|
import type { Prompt } from '../../types/Prompt';
|
|
7
|
-
import type { string_agent_hash, string_agent_name, string_agent_url, string_url_image } from '../../types/typeAliases';
|
|
7
|
+
import type { string_agent_hash, string_agent_name, string_agent_url, string_color, string_fonts, string_url_image } from '../../types/typeAliases';
|
|
8
8
|
import { AgentLlmExecutionTools } from './AgentLlmExecutionTools';
|
|
9
9
|
import type { AgentOptions } from './AgentOptions';
|
|
10
10
|
/**
|
|
@@ -48,6 +48,8 @@ export declare class Agent extends AgentLlmExecutionTools implements LlmExecutio
|
|
|
48
48
|
fullname?: string;
|
|
49
49
|
image?: string_url_image;
|
|
50
50
|
link?: string;
|
|
51
|
+
font?: string_fonts;
|
|
52
|
+
color?: string_color;
|
|
51
53
|
title?: string;
|
|
52
54
|
description?: string;
|
|
53
55
|
[key: string]: string | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PipelineCollection } from '../../collection/pipeline-collection/
|
|
1
|
+
import type { PipelineCollection } from '../../collection/pipeline-collection/PipelineCollection';
|
|
2
2
|
/**
|
|
3
3
|
* Get pipeline collection for Untitled Promptbook project
|
|
4
4
|
*
|
|
@@ -330,6 +330,12 @@ export type string_css_class = string;
|
|
|
330
330
|
* For example `border`
|
|
331
331
|
*/
|
|
332
332
|
export type string_css_property = string;
|
|
333
|
+
/**
|
|
334
|
+
* Semantic helper
|
|
335
|
+
*
|
|
336
|
+
* For example `"Arial, sans-serif"`
|
|
337
|
+
*/
|
|
338
|
+
export type string_fonts = string;
|
|
333
339
|
/**
|
|
334
340
|
* Semantic helper
|
|
335
341
|
*
|
|
@@ -23,7 +23,7 @@ export declare class Color {
|
|
|
23
23
|
* @param color
|
|
24
24
|
* @returns Color object
|
|
25
25
|
*/
|
|
26
|
-
static from(color: string_color | Color): WithTake<Color>;
|
|
26
|
+
static from(color: string_color | Color, _isSingleValue?: boolean): WithTake<Color>;
|
|
27
27
|
/**
|
|
28
28
|
* Creates a new Color instance from miscellaneous formats
|
|
29
29
|
* It just does not throw error when it fails, it returns PROMPTBOOK_COLOR instead
|
|
@@ -9,6 +9,12 @@ type GenerateBookBoilerplateOptions = PartialDeep<Omit<AgentBasicInformation, 'p
|
|
|
9
9
|
* @default 'Adam'
|
|
10
10
|
*/
|
|
11
11
|
parentAgentName?: string_agent_name_in_book;
|
|
12
|
+
/**
|
|
13
|
+
* Name pool to use for generating agent name
|
|
14
|
+
*
|
|
15
|
+
* @default 'ENGLISH'
|
|
16
|
+
*/
|
|
17
|
+
namePool?: string;
|
|
12
18
|
};
|
|
13
19
|
/**
|
|
14
20
|
* Generates boilerplate for a new agent book
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { string_color, string_person_fullname } from '../../types/typeAliases';
|
|
2
|
+
/**
|
|
3
|
+
* Result of generating a name
|
|
4
|
+
*/
|
|
5
|
+
export type GenerateNameResult = {
|
|
6
|
+
fullname: string_person_fullname;
|
|
7
|
+
color: string_color;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Interface for a name pool
|
|
11
|
+
*/
|
|
12
|
+
export type NamePool = {
|
|
13
|
+
/**
|
|
14
|
+
* Generates a random name
|
|
15
|
+
*/
|
|
16
|
+
generateName(): GenerateNameResult;
|
|
17
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { NamePool } from './NamePool';
|
|
2
|
+
/**
|
|
3
|
+
* Gets the name pool based on the language code
|
|
4
|
+
*
|
|
5
|
+
* @param language - The language code (e.g. 'ENGLISH', 'CZECH')
|
|
6
|
+
* @returns The name pool
|
|
7
|
+
*
|
|
8
|
+
* @private [🍇] Maybe expose via some package
|
|
9
|
+
*/
|
|
10
|
+
export declare function getNamePool(language: string): NamePool;
|
|
@@ -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.103.0-
|
|
18
|
+
* It follows semantic versioning (e.g., `0.103.0-66`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/wizard",
|
|
3
|
-
"version": "0.103.0-
|
|
3
|
+
"version": "0.103.0-67",
|
|
4
4
|
"description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "https://github.com/webgptorg/promptbook"
|
|
9
|
+
"url": "git+https://github.com/webgptorg/promptbook.git"
|
|
10
10
|
},
|
|
11
11
|
"author": "Pavol Hejný <pavol@ptbk.io> (https://www.pavolhejny.com/)",
|
|
12
12
|
"contributors": [
|
|
@@ -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.103.0-
|
|
98
|
+
"@promptbook/core": "0.103.0-67"
|
|
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.103.0-
|
|
51
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-67';
|
|
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
|
|
@@ -375,15 +375,33 @@
|
|
|
375
375
|
* @param color
|
|
376
376
|
* @returns Color object
|
|
377
377
|
*/
|
|
378
|
-
static from(color) {
|
|
379
|
-
if (color
|
|
378
|
+
static from(color, _isSingleValue = false) {
|
|
379
|
+
if (color === '') {
|
|
380
|
+
throw new Error(`Can not create color from empty string`);
|
|
381
|
+
}
|
|
382
|
+
else if (color instanceof Color) {
|
|
380
383
|
return take(color);
|
|
381
384
|
}
|
|
382
385
|
else if (Color.isColor(color)) {
|
|
383
386
|
return take(color);
|
|
384
387
|
}
|
|
385
388
|
else if (typeof color === 'string') {
|
|
386
|
-
|
|
389
|
+
try {
|
|
390
|
+
return Color.fromString(color);
|
|
391
|
+
}
|
|
392
|
+
catch (error) {
|
|
393
|
+
// <- Note: Can not use `assertsError(error)` here because it causes circular dependency
|
|
394
|
+
if (_isSingleValue) {
|
|
395
|
+
throw error;
|
|
396
|
+
}
|
|
397
|
+
const parts = color.split(/[\s+,;|]/);
|
|
398
|
+
if (parts.length > 0) {
|
|
399
|
+
return Color.from(parts[0].trim(), true);
|
|
400
|
+
}
|
|
401
|
+
else {
|
|
402
|
+
throw new Error(`Can not create color from given string "${color}"`);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
387
405
|
}
|
|
388
406
|
else {
|
|
389
407
|
console.error({ color });
|
|
@@ -13489,15 +13507,19 @@
|
|
|
13489
13507
|
*
|
|
13490
13508
|
* @private - TODO: [🧠] Maybe should be public?
|
|
13491
13509
|
*/
|
|
13492
|
-
function createCommitmentRegex(commitment, aliases = []) {
|
|
13510
|
+
function createCommitmentRegex(commitment, aliases = [], requiresContent = true) {
|
|
13493
13511
|
const allCommitments = [commitment, ...aliases];
|
|
13494
13512
|
const patterns = allCommitments.map((c) => {
|
|
13495
13513
|
const escapedCommitment = c.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
13496
13514
|
return escapedCommitment.split(/\s+/).join('\\s+');
|
|
13497
13515
|
});
|
|
13498
13516
|
const keywordPattern = patterns.join('|');
|
|
13499
|
-
|
|
13500
|
-
|
|
13517
|
+
if (requiresContent) {
|
|
13518
|
+
return new RegExp(`^\\s*(?<type>${keywordPattern})\\b\\s+(?<contents>.+)$`, 'gim');
|
|
13519
|
+
}
|
|
13520
|
+
else {
|
|
13521
|
+
return new RegExp(`^\\s*(?<type>${keywordPattern})\\b(?:\\s+(?<contents>.+))?$`, 'gim');
|
|
13522
|
+
}
|
|
13501
13523
|
}
|
|
13502
13524
|
/**
|
|
13503
13525
|
* Generates a regex pattern to match a specific commitment type
|
|
@@ -13530,12 +13552,20 @@
|
|
|
13530
13552
|
this.type = type;
|
|
13531
13553
|
this.aliases = aliases;
|
|
13532
13554
|
}
|
|
13555
|
+
/**
|
|
13556
|
+
* Whether this commitment requires content.
|
|
13557
|
+
* If true, regex will match only if there is content after the commitment keyword.
|
|
13558
|
+
* If false, regex will match even if there is no content.
|
|
13559
|
+
*/
|
|
13560
|
+
get requiresContent() {
|
|
13561
|
+
return true;
|
|
13562
|
+
}
|
|
13533
13563
|
/**
|
|
13534
13564
|
* Creates a regex pattern to match this commitment in agent source
|
|
13535
13565
|
* Uses the existing createCommitmentRegex function as internal helper
|
|
13536
13566
|
*/
|
|
13537
13567
|
createRegex() {
|
|
13538
|
-
return createCommitmentRegex(this.type, this.aliases);
|
|
13568
|
+
return createCommitmentRegex(this.type, this.aliases, this.requiresContent);
|
|
13539
13569
|
}
|
|
13540
13570
|
/**
|
|
13541
13571
|
* Creates a regex pattern to match just the commitment type
|
|
@@ -13687,6 +13717,12 @@
|
|
|
13687
13717
|
constructor() {
|
|
13688
13718
|
super('CLOSED');
|
|
13689
13719
|
}
|
|
13720
|
+
/**
|
|
13721
|
+
* The `CLOSED` commitment is standalone.
|
|
13722
|
+
*/
|
|
13723
|
+
get requiresContent() {
|
|
13724
|
+
return false;
|
|
13725
|
+
}
|
|
13690
13726
|
/**
|
|
13691
13727
|
* Short one-line description of CLOSED.
|
|
13692
13728
|
*/
|
|
@@ -16366,6 +16402,12 @@
|
|
|
16366
16402
|
constructor() {
|
|
16367
16403
|
super('USE BROWSER', ['BROWSER']);
|
|
16368
16404
|
}
|
|
16405
|
+
/**
|
|
16406
|
+
* The `USE BROWSER` commitment is standalone.
|
|
16407
|
+
*/
|
|
16408
|
+
get requiresContent() {
|
|
16409
|
+
return false;
|
|
16410
|
+
}
|
|
16369
16411
|
/**
|
|
16370
16412
|
* Short one-line description of USE BROWSER.
|
|
16371
16413
|
*/
|
|
@@ -17587,11 +17629,11 @@
|
|
|
17587
17629
|
continue;
|
|
17588
17630
|
}
|
|
17589
17631
|
if (commitment.type === 'META COLOR') {
|
|
17590
|
-
meta.color =
|
|
17632
|
+
meta.color = normalizeSeparator(commitment.content);
|
|
17591
17633
|
continue;
|
|
17592
17634
|
}
|
|
17593
17635
|
if (commitment.type === 'META FONT') {
|
|
17594
|
-
meta.font =
|
|
17636
|
+
meta.font = normalizeSeparator(commitment.content);
|
|
17595
17637
|
continue;
|
|
17596
17638
|
}
|
|
17597
17639
|
if (commitment.type !== 'META') {
|
|
@@ -17627,6 +17669,19 @@
|
|
|
17627
17669
|
parameters,
|
|
17628
17670
|
};
|
|
17629
17671
|
}
|
|
17672
|
+
/**
|
|
17673
|
+
* Normalizes the separator in the content
|
|
17674
|
+
*
|
|
17675
|
+
* @param content - The content to normalize
|
|
17676
|
+
* @returns The content with normalized separators
|
|
17677
|
+
*/
|
|
17678
|
+
function normalizeSeparator(content) {
|
|
17679
|
+
const trimmed = spaceTrim__default["default"](content);
|
|
17680
|
+
if (trimmed.includes(',')) {
|
|
17681
|
+
return trimmed;
|
|
17682
|
+
}
|
|
17683
|
+
return trimmed.split(/\s+/).join(', ');
|
|
17684
|
+
}
|
|
17630
17685
|
/**
|
|
17631
17686
|
* TODO: [🕛] Unite `AgentBasicInformation`, `ChatParticipant`, `LlmExecutionTools` + `LlmToolsMetadata`
|
|
17632
17687
|
*/
|