@promptbook/node 0.112.0-59 → 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 +9 -5
- package/esm/index.es.js.map +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/llm-providers/openai/OpenAiAgentKitExecutionTools.d.ts +2 -0
- package/esm/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +9 -5
- package/umd/index.umd.js.map +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/llm-providers/openai/OpenAiAgentKitExecutionTools.d.ts +2 -0
- package/umd/src/version.d.ts +1 -1
|
@@ -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 {};
|
|
@@ -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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/node",
|
|
3
|
-
"version": "0.112.0-
|
|
3
|
+
"version": "0.112.0-60",
|
|
4
4
|
"description": "Promptbook: Create persistent AI agents that turn your company's scattered knowledge into action",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"types": "./esm/src/_packages/node.index.d.ts",
|
|
98
98
|
"typings": "./esm/src/_packages/node.index.d.ts",
|
|
99
99
|
"peerDependencies": {
|
|
100
|
-
"@promptbook/core": "0.112.0-
|
|
100
|
+
"@promptbook/core": "0.112.0-60"
|
|
101
101
|
},
|
|
102
102
|
"dependencies": {
|
|
103
103
|
"@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-60';
|
|
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
|
|
@@ -37368,8 +37368,8 @@
|
|
|
37368
37368
|
* Prepares an AgentKit agent with optional knowledge sources and tool definitions.
|
|
37369
37369
|
*/
|
|
37370
37370
|
async prepareAgentKitAgent(options) {
|
|
37371
|
-
var _a, _b;
|
|
37372
|
-
const { name, instructions, knowledgeSources, tools, vectorStoreId: cachedVectorStoreId, storeAsPrepared, } = options;
|
|
37371
|
+
var _a, _b, _c;
|
|
37372
|
+
const { name, instructions, knowledgeSources, tools, nativeAgentKitTools, vectorStoreId: cachedVectorStoreId, storeAsPrepared, } = options;
|
|
37373
37373
|
await this.ensureAgentKitDefaults();
|
|
37374
37374
|
if (this.options.isVerbose) {
|
|
37375
37375
|
console.info('[🤰]', 'Preparing OpenAI AgentKit agent', {
|
|
@@ -37377,6 +37377,7 @@
|
|
|
37377
37377
|
instructionsLength: instructions.length,
|
|
37378
37378
|
knowledgeSourcesCount: (_a = knowledgeSources === null || knowledgeSources === void 0 ? void 0 : knowledgeSources.length) !== null && _a !== void 0 ? _a : 0,
|
|
37379
37379
|
toolsCount: (_b = tools === null || tools === void 0 ? void 0 : tools.length) !== null && _b !== void 0 ? _b : 0,
|
|
37380
|
+
nativeAgentKitToolsCount: (_c = nativeAgentKitTools === null || nativeAgentKitTools === void 0 ? void 0 : nativeAgentKitTools.length) !== null && _c !== void 0 ? _c : 0,
|
|
37380
37381
|
});
|
|
37381
37382
|
}
|
|
37382
37383
|
let vectorStoreId = cachedVectorStoreId;
|
|
@@ -37395,7 +37396,7 @@
|
|
|
37395
37396
|
vectorStoreId,
|
|
37396
37397
|
});
|
|
37397
37398
|
}
|
|
37398
|
-
const agentKitTools = this.buildAgentKitTools({ tools, vectorStoreId });
|
|
37399
|
+
const agentKitTools = this.buildAgentKitTools({ tools, nativeAgentKitTools, vectorStoreId });
|
|
37399
37400
|
const openAiAgentKitAgent = new agents.Agent({
|
|
37400
37401
|
name,
|
|
37401
37402
|
model: this.agentKitModelName,
|
|
@@ -37434,11 +37435,14 @@
|
|
|
37434
37435
|
* Builds the tool list for AgentKit, including hosted file search when applicable.
|
|
37435
37436
|
*/
|
|
37436
37437
|
buildAgentKitTools(options) {
|
|
37437
|
-
const { tools, vectorStoreId } = options;
|
|
37438
|
+
const { tools, nativeAgentKitTools, vectorStoreId } = options;
|
|
37438
37439
|
const agentKitTools = [];
|
|
37439
37440
|
if (vectorStoreId) {
|
|
37440
37441
|
agentKitTools.push(agents.fileSearchTool(vectorStoreId));
|
|
37441
37442
|
}
|
|
37443
|
+
if (nativeAgentKitTools && nativeAgentKitTools.length > 0) {
|
|
37444
|
+
agentKitTools.push(...nativeAgentKitTools);
|
|
37445
|
+
}
|
|
37442
37446
|
if (tools && tools.length > 0) {
|
|
37443
37447
|
let scriptTools = null;
|
|
37444
37448
|
for (const toolDefinition of tools) {
|