@promptbook/utils 0.112.0-58 → 0.112.0-60
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 +1 -1
- package/esm/src/book-components/BookEditor/useBookEditorMonacoInteractions.d.ts +40 -0
- package/esm/src/book-components/BookEditor/useBookEditorMonacoLifecycle.d.ts +34 -0
- package/esm/src/commitments/_base/BaseCommitmentDefinition.d.ts +26 -0
- package/esm/src/llm-providers/openai/OpenAiAgentKitExecutionTools.d.ts +2 -0
- package/esm/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +1 -1
- package/umd/src/book-components/BookEditor/useBookEditorMonacoInteractions.d.ts +40 -0
- package/umd/src/book-components/BookEditor/useBookEditorMonacoLifecycle.d.ts +34 -0
- package/umd/src/commitments/_base/BaseCommitmentDefinition.d.ts +26 -0
- package/umd/src/llm-providers/openai/OpenAiAgentKitExecutionTools.d.ts +2 -0
- package/umd/src/version.d.ts +1 -1
package/esm/index.es.js
CHANGED
|
@@ -18,7 +18,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
18
18
|
* @generated
|
|
19
19
|
* @see https://github.com/webgptorg/promptbook
|
|
20
20
|
*/
|
|
21
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
21
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-60';
|
|
22
22
|
/**
|
|
23
23
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
24
24
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { editor } from 'monaco-editor';
|
|
2
|
+
import { type ChangeEvent, type ClipboardEvent, type DragEvent, type RefObject, type TouchEvent } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Type describing the file handler used by Monaco upload interactions.
|
|
5
|
+
*/
|
|
6
|
+
type HandleFiles = (files: File[]) => Promise<void>;
|
|
7
|
+
/**
|
|
8
|
+
* Props for use book editor monaco interactions.
|
|
9
|
+
*/
|
|
10
|
+
type UseBookEditorMonacoInteractionsProps = {
|
|
11
|
+
readonly editor: editor.IStandaloneCodeEditor | null;
|
|
12
|
+
readonly handleFiles: HandleFiles;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Result of use book editor monaco interactions.
|
|
16
|
+
*/
|
|
17
|
+
type UseBookEditorMonacoInteractionsResult = {
|
|
18
|
+
readonly isDragOver: boolean;
|
|
19
|
+
readonly fileUploadInputRef: RefObject<HTMLInputElement | null>;
|
|
20
|
+
readonly cameraInputRef: RefObject<HTMLInputElement | null>;
|
|
21
|
+
readonly handleDrop: (event: DragEvent<HTMLDivElement>) => Promise<void>;
|
|
22
|
+
readonly handlePaste: (event: ClipboardEvent<HTMLDivElement>) => Promise<void>;
|
|
23
|
+
readonly handleUploadDocument: () => void;
|
|
24
|
+
readonly handleTakePhoto: () => void;
|
|
25
|
+
readonly handleFileInputChange: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
26
|
+
readonly handleDragOver: (event: DragEvent<HTMLDivElement>) => void;
|
|
27
|
+
readonly handleDragEnter: (event: DragEvent<HTMLDivElement>) => void;
|
|
28
|
+
readonly handleDragLeave: (event: DragEvent<HTMLDivElement>) => void;
|
|
29
|
+
readonly focusOverlayTouchHandlers: {
|
|
30
|
+
readonly onTouchStart: (event: TouchEvent<HTMLDivElement>) => void;
|
|
31
|
+
readonly onTouchEnd: (event: TouchEvent<HTMLDivElement>) => void;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Manages drag, paste and file input interactions for `BookEditorMonaco`.
|
|
36
|
+
*
|
|
37
|
+
* @private function of BookEditorMonaco
|
|
38
|
+
*/
|
|
39
|
+
export declare function useBookEditorMonacoInteractions({ editor, handleFiles, }: UseBookEditorMonacoInteractionsProps): UseBookEditorMonacoInteractionsResult;
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { editor } from 'monaco-editor';
|
|
2
|
+
/**
|
|
3
|
+
* Type describing monaco editor.
|
|
4
|
+
*/
|
|
5
|
+
type MonacoEditor = typeof import('monaco-editor');
|
|
6
|
+
/**
|
|
7
|
+
* Resolved visual theme supported by the Book editor.
|
|
8
|
+
*/
|
|
9
|
+
type BookEditorTheme = 'LIGHT' | 'DARK';
|
|
10
|
+
/**
|
|
11
|
+
* Props for use book editor monaco lifecycle.
|
|
12
|
+
*/
|
|
13
|
+
type UseBookEditorMonacoLifecycleProps = {
|
|
14
|
+
readonly monaco: MonacoEditor | null;
|
|
15
|
+
readonly theme: BookEditorTheme;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Result of use book editor monaco lifecycle.
|
|
19
|
+
*/
|
|
20
|
+
type UseBookEditorMonacoLifecycleResult = {
|
|
21
|
+
readonly editor: editor.IStandaloneCodeEditor | null;
|
|
22
|
+
readonly isFocused: boolean;
|
|
23
|
+
readonly isTouchDevice: boolean;
|
|
24
|
+
readonly isSavedShown: boolean;
|
|
25
|
+
readonly handleBeforeMonacoMount: (beforeMountMonaco: MonacoEditor) => void;
|
|
26
|
+
readonly handleMonacoMount: (mountedEditor: editor.IStandaloneCodeEditor, mountedMonaco: MonacoEditor) => void;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Manages Monaco lifecycle wiring for `BookEditorMonaco`.
|
|
30
|
+
*
|
|
31
|
+
* @private function of BookEditorMonaco
|
|
32
|
+
*/
|
|
33
|
+
export declare function useBookEditorMonacoLifecycle({ monaco, theme, }: UseBookEditorMonacoLifecycleProps): UseBookEditorMonacoLifecycleResult;
|
|
34
|
+
export {};
|
|
@@ -96,6 +96,32 @@ export declare abstract class BaseCommitmentDefinition<TBookCommitment extends s
|
|
|
96
96
|
* but can be useful for organizing and structuring the message during processing
|
|
97
97
|
*/
|
|
98
98
|
protected addCommentSection(requirements: AgentModelRequirements, commentTitle: string, content: string, position?: 'beginning' | 'end'): AgentModelRequirements;
|
|
99
|
+
/**
|
|
100
|
+
* Helper method to append a bullet point to an existing `## SectionTitle` section in the system
|
|
101
|
+
* message, or to create a new section when it does not yet exist.
|
|
102
|
+
*
|
|
103
|
+
* Handles the case where the same commitment type appears multiple times in the book source and
|
|
104
|
+
* all entries should be grouped under one shared heading rather than emitting a duplicate block.
|
|
105
|
+
*
|
|
106
|
+
* @param requirements - Current model requirements.
|
|
107
|
+
* @param sectionTitle - Section title without the `##` prefix.
|
|
108
|
+
* @param bulletContent - Bullet content without the leading `- ` prefix.
|
|
109
|
+
* @returns Requirements with the bullet appended to the section.
|
|
110
|
+
*/
|
|
111
|
+
protected appendBulletPointToSection(requirements: AgentModelRequirements, sectionTitle: string, bulletContent: string): AgentModelRequirements;
|
|
112
|
+
/**
|
|
113
|
+
* Helper method to replace an existing `## SectionTitle` section in the system message, or to
|
|
114
|
+
* append a new one when the section does not yet exist.
|
|
115
|
+
*
|
|
116
|
+
* Use this when a commitment type can appear multiple times and each subsequent occurrence should
|
|
117
|
+
* update the single shared section rather than appending a duplicate block.
|
|
118
|
+
*
|
|
119
|
+
* @param requirements - Current model requirements.
|
|
120
|
+
* @param sectionTitle - Section title without the `##` prefix.
|
|
121
|
+
* @param sectionContent - Full section content including the `## Title` header line.
|
|
122
|
+
* @returns Requirements with the section replaced or appended.
|
|
123
|
+
*/
|
|
124
|
+
protected replaceOrCreateSection(requirements: AgentModelRequirements, sectionTitle: string, sectionContent: string): AgentModelRequirements;
|
|
99
125
|
/**
|
|
100
126
|
* Gets tool function implementations provided by this commitment
|
|
101
127
|
*
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Tool as AgentKitTool } from '@openai/agents';
|
|
1
2
|
import { Agent as AgentFromKit } from '@openai/agents';
|
|
2
3
|
import OpenAI from 'openai';
|
|
3
4
|
import { TODO_any } from '../../_packages/types.index';
|
|
@@ -109,6 +110,7 @@ export declare class OpenAiAgentKitExecutionTools extends OpenAiVectorStoreHandl
|
|
|
109
110
|
readonly instructions: string_markdown;
|
|
110
111
|
readonly knowledgeSources?: ReadonlyArray<string>;
|
|
111
112
|
readonly tools?: ModelRequirements['tools'];
|
|
113
|
+
readonly nativeAgentKitTools?: ReadonlyArray<AgentKitTool>;
|
|
112
114
|
readonly vectorStoreId?: string;
|
|
113
115
|
readonly storeAsPrepared?: boolean;
|
|
114
116
|
}): Promise<OpenAiAgentKitPreparedAgent>;
|
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-59`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
package/umd/index.umd.js
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* @generated
|
|
23
23
|
* @see https://github.com/webgptorg/promptbook
|
|
24
24
|
*/
|
|
25
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
25
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-60';
|
|
26
26
|
/**
|
|
27
27
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
28
28
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { editor } from 'monaco-editor';
|
|
2
|
+
import { type ChangeEvent, type ClipboardEvent, type DragEvent, type RefObject, type TouchEvent } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Type describing the file handler used by Monaco upload interactions.
|
|
5
|
+
*/
|
|
6
|
+
type HandleFiles = (files: File[]) => Promise<void>;
|
|
7
|
+
/**
|
|
8
|
+
* Props for use book editor monaco interactions.
|
|
9
|
+
*/
|
|
10
|
+
type UseBookEditorMonacoInteractionsProps = {
|
|
11
|
+
readonly editor: editor.IStandaloneCodeEditor | null;
|
|
12
|
+
readonly handleFiles: HandleFiles;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Result of use book editor monaco interactions.
|
|
16
|
+
*/
|
|
17
|
+
type UseBookEditorMonacoInteractionsResult = {
|
|
18
|
+
readonly isDragOver: boolean;
|
|
19
|
+
readonly fileUploadInputRef: RefObject<HTMLInputElement | null>;
|
|
20
|
+
readonly cameraInputRef: RefObject<HTMLInputElement | null>;
|
|
21
|
+
readonly handleDrop: (event: DragEvent<HTMLDivElement>) => Promise<void>;
|
|
22
|
+
readonly handlePaste: (event: ClipboardEvent<HTMLDivElement>) => Promise<void>;
|
|
23
|
+
readonly handleUploadDocument: () => void;
|
|
24
|
+
readonly handleTakePhoto: () => void;
|
|
25
|
+
readonly handleFileInputChange: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
26
|
+
readonly handleDragOver: (event: DragEvent<HTMLDivElement>) => void;
|
|
27
|
+
readonly handleDragEnter: (event: DragEvent<HTMLDivElement>) => void;
|
|
28
|
+
readonly handleDragLeave: (event: DragEvent<HTMLDivElement>) => void;
|
|
29
|
+
readonly focusOverlayTouchHandlers: {
|
|
30
|
+
readonly onTouchStart: (event: TouchEvent<HTMLDivElement>) => void;
|
|
31
|
+
readonly onTouchEnd: (event: TouchEvent<HTMLDivElement>) => void;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Manages drag, paste and file input interactions for `BookEditorMonaco`.
|
|
36
|
+
*
|
|
37
|
+
* @private function of BookEditorMonaco
|
|
38
|
+
*/
|
|
39
|
+
export declare function useBookEditorMonacoInteractions({ editor, handleFiles, }: UseBookEditorMonacoInteractionsProps): UseBookEditorMonacoInteractionsResult;
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { editor } from 'monaco-editor';
|
|
2
|
+
/**
|
|
3
|
+
* Type describing monaco editor.
|
|
4
|
+
*/
|
|
5
|
+
type MonacoEditor = typeof import('monaco-editor');
|
|
6
|
+
/**
|
|
7
|
+
* Resolved visual theme supported by the Book editor.
|
|
8
|
+
*/
|
|
9
|
+
type BookEditorTheme = 'LIGHT' | 'DARK';
|
|
10
|
+
/**
|
|
11
|
+
* Props for use book editor monaco lifecycle.
|
|
12
|
+
*/
|
|
13
|
+
type UseBookEditorMonacoLifecycleProps = {
|
|
14
|
+
readonly monaco: MonacoEditor | null;
|
|
15
|
+
readonly theme: BookEditorTheme;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Result of use book editor monaco lifecycle.
|
|
19
|
+
*/
|
|
20
|
+
type UseBookEditorMonacoLifecycleResult = {
|
|
21
|
+
readonly editor: editor.IStandaloneCodeEditor | null;
|
|
22
|
+
readonly isFocused: boolean;
|
|
23
|
+
readonly isTouchDevice: boolean;
|
|
24
|
+
readonly isSavedShown: boolean;
|
|
25
|
+
readonly handleBeforeMonacoMount: (beforeMountMonaco: MonacoEditor) => void;
|
|
26
|
+
readonly handleMonacoMount: (mountedEditor: editor.IStandaloneCodeEditor, mountedMonaco: MonacoEditor) => void;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Manages Monaco lifecycle wiring for `BookEditorMonaco`.
|
|
30
|
+
*
|
|
31
|
+
* @private function of BookEditorMonaco
|
|
32
|
+
*/
|
|
33
|
+
export declare function useBookEditorMonacoLifecycle({ monaco, theme, }: UseBookEditorMonacoLifecycleProps): UseBookEditorMonacoLifecycleResult;
|
|
34
|
+
export {};
|
|
@@ -96,6 +96,32 @@ export declare abstract class BaseCommitmentDefinition<TBookCommitment extends s
|
|
|
96
96
|
* but can be useful for organizing and structuring the message during processing
|
|
97
97
|
*/
|
|
98
98
|
protected addCommentSection(requirements: AgentModelRequirements, commentTitle: string, content: string, position?: 'beginning' | 'end'): AgentModelRequirements;
|
|
99
|
+
/**
|
|
100
|
+
* Helper method to append a bullet point to an existing `## SectionTitle` section in the system
|
|
101
|
+
* message, or to create a new section when it does not yet exist.
|
|
102
|
+
*
|
|
103
|
+
* Handles the case where the same commitment type appears multiple times in the book source and
|
|
104
|
+
* all entries should be grouped under one shared heading rather than emitting a duplicate block.
|
|
105
|
+
*
|
|
106
|
+
* @param requirements - Current model requirements.
|
|
107
|
+
* @param sectionTitle - Section title without the `##` prefix.
|
|
108
|
+
* @param bulletContent - Bullet content without the leading `- ` prefix.
|
|
109
|
+
* @returns Requirements with the bullet appended to the section.
|
|
110
|
+
*/
|
|
111
|
+
protected appendBulletPointToSection(requirements: AgentModelRequirements, sectionTitle: string, bulletContent: string): AgentModelRequirements;
|
|
112
|
+
/**
|
|
113
|
+
* Helper method to replace an existing `## SectionTitle` section in the system message, or to
|
|
114
|
+
* append a new one when the section does not yet exist.
|
|
115
|
+
*
|
|
116
|
+
* Use this when a commitment type can appear multiple times and each subsequent occurrence should
|
|
117
|
+
* update the single shared section rather than appending a duplicate block.
|
|
118
|
+
*
|
|
119
|
+
* @param requirements - Current model requirements.
|
|
120
|
+
* @param sectionTitle - Section title without the `##` prefix.
|
|
121
|
+
* @param sectionContent - Full section content including the `## Title` header line.
|
|
122
|
+
* @returns Requirements with the section replaced or appended.
|
|
123
|
+
*/
|
|
124
|
+
protected replaceOrCreateSection(requirements: AgentModelRequirements, sectionTitle: string, sectionContent: string): AgentModelRequirements;
|
|
99
125
|
/**
|
|
100
126
|
* Gets tool function implementations provided by this commitment
|
|
101
127
|
*
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Tool as AgentKitTool } from '@openai/agents';
|
|
1
2
|
import { Agent as AgentFromKit } from '@openai/agents';
|
|
2
3
|
import OpenAI from 'openai';
|
|
3
4
|
import { TODO_any } from '../../_packages/types.index';
|
|
@@ -109,6 +110,7 @@ export declare class OpenAiAgentKitExecutionTools extends OpenAiVectorStoreHandl
|
|
|
109
110
|
readonly instructions: string_markdown;
|
|
110
111
|
readonly knowledgeSources?: ReadonlyArray<string>;
|
|
111
112
|
readonly tools?: ModelRequirements['tools'];
|
|
113
|
+
readonly nativeAgentKitTools?: ReadonlyArray<AgentKitTool>;
|
|
112
114
|
readonly vectorStoreId?: string;
|
|
113
115
|
readonly storeAsPrepared?: boolean;
|
|
114
116
|
}): Promise<OpenAiAgentKitPreparedAgent>;
|
package/umd/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-59`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|