@promptbook/wizard 0.112.0-41 → 0.112.0-43
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/README.md +10 -3
- package/esm/index.es.js +113 -22
- package/esm/index.es.js.map +1 -1
- package/esm/src/book-components/Chat/Chat/ChatProps.d.ts +1 -1
- package/esm/src/cli/cli-commands/coder/getTypescriptModule.d.ts +19 -0
- package/esm/src/cli/cli-commands/coder/getTypescriptModule.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/coder/mergeStringRecordJsonFile.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/coder/verify.test.d.ts +1 -0
- package/esm/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +2 -14
- package/esm/src/collection/agent-collection/constructors/agent-collection-in-supabase/createAgentPersistenceRecords.d.ts +40 -0
- package/esm/src/collection/agent-collection/constructors/agent-collection-in-supabase/createAgentPersistenceRecords.test.d.ts +1 -0
- package/esm/src/llm-providers/agent/Agent.test.d.ts +1 -0
- package/esm/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +4 -0
- package/esm/src/llm-providers/agent/AgentOptions.d.ts +8 -0
- package/esm/src/llm-providers/agent/CreateAgentLlmExecutionToolsOptions.d.ts +9 -0
- package/esm/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +113 -22
- package/umd/index.umd.js.map +1 -1
- package/umd/src/book-components/Chat/Chat/ChatProps.d.ts +1 -1
- package/umd/src/cli/cli-commands/coder/getTypescriptModule.d.ts +19 -0
- package/umd/src/cli/cli-commands/coder/getTypescriptModule.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/coder/mergeStringRecordJsonFile.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/coder/verify.test.d.ts +1 -0
- package/umd/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +2 -14
- package/umd/src/collection/agent-collection/constructors/agent-collection-in-supabase/createAgentPersistenceRecords.d.ts +40 -0
- package/umd/src/collection/agent-collection/constructors/agent-collection-in-supabase/createAgentPersistenceRecords.test.d.ts +1 -0
- package/umd/src/llm-providers/agent/Agent.test.d.ts +1 -0
- package/umd/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +4 -0
- package/umd/src/llm-providers/agent/AgentOptions.d.ts +8 -0
- package/umd/src/llm-providers/agent/CreateAgentLlmExecutionToolsOptions.d.ts +9 -0
- package/umd/src/version.d.ts +1 -1
|
@@ -745,7 +745,7 @@ export type ChatProps = {
|
|
|
745
745
|
* - `BUBBLE_MODE`: keeps the default bubble appearance for all messages.
|
|
746
746
|
* - `ARTICLE_MODE`: keeps user bubbles while rendering assistant replies as borderless article blocks.
|
|
747
747
|
*
|
|
748
|
-
* @default '
|
|
748
|
+
* @default 'ARTICLE_MODE'
|
|
749
749
|
*/
|
|
750
750
|
readonly CHAT_VISUAL_MODE?: ChatVisualMode;
|
|
751
751
|
/**
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Possible runtime shapes returned when importing the `typescript` package.
|
|
3
|
+
*/
|
|
4
|
+
type ImportedTypescriptModule = typeof import('typescript') | {
|
|
5
|
+
default: typeof import('typescript');
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Loads the TypeScript runtime used for parsing JSONC-style project files.
|
|
9
|
+
*
|
|
10
|
+
* @private internal utility of `coder init`
|
|
11
|
+
*/
|
|
12
|
+
export declare function getTypescriptModule(): Promise<typeof import('typescript')>;
|
|
13
|
+
/**
|
|
14
|
+
* Normalizes CommonJS-via-`default` and direct namespace imports of TypeScript.
|
|
15
|
+
*
|
|
16
|
+
* @private internal utility of `getTypescriptModule`
|
|
17
|
+
*/
|
|
18
|
+
export declare function normalizeImportedTypescriptModule(importedTypescriptModule: ImportedTypescriptModule): typeof import('typescript');
|
|
19
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -4,23 +4,11 @@ import type { string_book } from '../../../../book-2.0/agent-source/string_book'
|
|
|
4
4
|
import type { string_agent_name, string_agent_permanent_id } from '../../../../types/typeAliases';
|
|
5
5
|
import { AgentCollectionInSupabaseOptions } from './AgentCollectionInSupabaseOptions';
|
|
6
6
|
import type { AgentsDatabaseSchema } from './AgentsDatabaseSchema';
|
|
7
|
+
import { type CreateAgentPersistenceRecordsOptions } from './createAgentPersistenceRecords';
|
|
7
8
|
/**
|
|
8
9
|
* Options for creating a new agent entry.
|
|
9
10
|
*/
|
|
10
|
-
type CreateAgentOptions =
|
|
11
|
-
/**
|
|
12
|
-
* Visibility for the new agent.
|
|
13
|
-
*/
|
|
14
|
-
readonly visibility?: 'PRIVATE' | 'UNLISTED' | 'PUBLIC';
|
|
15
|
-
/**
|
|
16
|
-
* Folder identifier to assign the new agent to.
|
|
17
|
-
*/
|
|
18
|
-
readonly folderId?: number | null;
|
|
19
|
-
/**
|
|
20
|
-
* Sort order for the agent within its parent folder.
|
|
21
|
-
*/
|
|
22
|
-
readonly sortOrder?: number;
|
|
23
|
-
};
|
|
11
|
+
type CreateAgentOptions = CreateAgentPersistenceRecordsOptions;
|
|
24
12
|
/**
|
|
25
13
|
* Optional controls for persisting one source update.
|
|
26
14
|
*/
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { AgentBasicInformation } from '../../../../book-2.0/agent-source/AgentBasicInformation';
|
|
2
|
+
import type { string_book } from '../../../../book-2.0/agent-source/string_book';
|
|
3
|
+
import type { CreateAgentInput } from '../../CreateAgentInput';
|
|
4
|
+
import type { AgentsDatabaseSchema } from './AgentsDatabaseSchema';
|
|
5
|
+
/**
|
|
6
|
+
* Optional persistence overrides for one new agent row.
|
|
7
|
+
*
|
|
8
|
+
* @private shared persistence helper for `AgentCollectionInSupabase`
|
|
9
|
+
*/
|
|
10
|
+
export type CreateAgentPersistenceRecordsOptions = Omit<CreateAgentInput, 'source'>;
|
|
11
|
+
/**
|
|
12
|
+
* Prepared insert rows and returned profile for one newly persisted agent.
|
|
13
|
+
*
|
|
14
|
+
* @private shared persistence helper for `AgentCollectionInSupabase`
|
|
15
|
+
*/
|
|
16
|
+
export type CreateAgentPersistenceRecordsResult = {
|
|
17
|
+
/**
|
|
18
|
+
* Parsed created agent profile including the resolved permanent id.
|
|
19
|
+
*/
|
|
20
|
+
readonly createdAgent: AgentBasicInformation & Required<Pick<AgentBasicInformation, 'permanentId'>>;
|
|
21
|
+
/**
|
|
22
|
+
* Insert row for the `Agent` table.
|
|
23
|
+
*/
|
|
24
|
+
readonly agentInsertRecord: AgentsDatabaseSchema['public']['Tables']['Agent']['Insert'];
|
|
25
|
+
/**
|
|
26
|
+
* Insert row for the `AgentHistory` table.
|
|
27
|
+
*/
|
|
28
|
+
readonly agentHistoryInsertRecord: AgentsDatabaseSchema['public']['Tables']['AgentHistory']['Insert'];
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Builds normalized insert rows for a newly created persisted agent.
|
|
32
|
+
*
|
|
33
|
+
* @param agentSource - Source content of the agent.
|
|
34
|
+
* @param options - Optional folder placement, ordering, and visibility overrides.
|
|
35
|
+
* @param createdAt - Shared creation timestamp used across all persisted rows.
|
|
36
|
+
* @returns Insert rows and the created agent profile.
|
|
37
|
+
*
|
|
38
|
+
* @private shared persistence helper for `AgentCollectionInSupabase`
|
|
39
|
+
*/
|
|
40
|
+
export declare function createAgentPersistenceRecords(agentSource: string_book, options?: CreateAgentPersistenceRecordsOptions, createdAt?: string): CreateAgentPersistenceRecordsResult;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -44,6 +44,10 @@ export declare class AgentLlmExecutionTools implements LlmExecutionTools {
|
|
|
44
44
|
* Cached parsed agent information
|
|
45
45
|
*/
|
|
46
46
|
private _cachedAgentInfo;
|
|
47
|
+
/**
|
|
48
|
+
* Optional server-precomputed model requirements reused until the source changes.
|
|
49
|
+
*/
|
|
50
|
+
private precomputedModelRequirements;
|
|
47
51
|
/**
|
|
48
52
|
* Creates new AgentLlmExecutionTools
|
|
49
53
|
*
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { string_book } from '../../book-2.0/agent-source/string_book';
|
|
2
|
+
import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
|
|
2
3
|
import type { CommonToolsOptions } from '../../execution/CommonToolsOptions';
|
|
3
4
|
import type { ExecutionTools } from '../../execution/ExecutionTools';
|
|
4
5
|
import type { Updatable } from '../../types/Updatable';
|
|
@@ -27,6 +28,13 @@ export type AgentOptions = CommonToolsOptions & {
|
|
|
27
28
|
* The source of the agent
|
|
28
29
|
*/
|
|
29
30
|
agentSource: Updatable<string_book>;
|
|
31
|
+
/**
|
|
32
|
+
* Optional precomputed model requirements reused until `agentSource` changes.
|
|
33
|
+
*
|
|
34
|
+
* This keeps the actual runtime prompt aligned with server-prepared requirements
|
|
35
|
+
* such as compact-reference-resolved `TEAM` tools.
|
|
36
|
+
*/
|
|
37
|
+
precomputedModelRequirements?: AgentModelRequirements;
|
|
30
38
|
/**
|
|
31
39
|
* Teacher agent for self-learning
|
|
32
40
|
*
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { string_book } from '../../book-2.0/agent-source/string_book';
|
|
2
|
+
import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
|
|
2
3
|
import type { CommonToolsOptions } from '../../execution/CommonToolsOptions';
|
|
3
4
|
import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
|
|
4
5
|
import type { OpenAiAgentKitExecutionTools } from '../openai/OpenAiAgentKitExecutionTools';
|
|
@@ -25,4 +26,12 @@ export type CreateAgentLlmExecutionToolsOptions = CommonToolsOptions & {
|
|
|
25
26
|
* The agent source string that defines the agent's behavior
|
|
26
27
|
*/
|
|
27
28
|
agentSource: string_book;
|
|
29
|
+
/**
|
|
30
|
+
* Optional precomputed model requirements reused until `agentSource` changes.
|
|
31
|
+
*
|
|
32
|
+
* This is useful for runtimes such as Agents Server that already resolved compact
|
|
33
|
+
* references (for example in `TEAM`) and need the executed prompt to stay aligned
|
|
34
|
+
* with the server-prepared tool list.
|
|
35
|
+
*/
|
|
36
|
+
precomputedModelRequirements?: AgentModelRequirements;
|
|
28
37
|
};
|
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-42`).
|
|
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.112.0-
|
|
3
|
+
"version": "0.112.0-43",
|
|
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/wizard.index.d.ts",
|
|
100
100
|
"peerDependencies": {
|
|
101
|
-
"@promptbook/core": "0.112.0-
|
|
101
|
+
"@promptbook/core": "0.112.0-43"
|
|
102
102
|
},
|
|
103
103
|
"dependencies": {
|
|
104
104
|
"@ai-sdk/deepseek": "0.1.17",
|
package/umd/index.umd.js
CHANGED
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
* @generated
|
|
50
50
|
* @see https://github.com/webgptorg/promptbook
|
|
51
51
|
*/
|
|
52
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
52
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-43';
|
|
53
53
|
/**
|
|
54
54
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
55
55
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -18795,7 +18795,7 @@
|
|
|
18795
18795
|
systemMessage: '',
|
|
18796
18796
|
promptSuffix: '',
|
|
18797
18797
|
// modelName: 'gpt-5',
|
|
18798
|
-
modelName: '
|
|
18798
|
+
modelName: 'gpt-5.4-mini',
|
|
18799
18799
|
temperature: 0.7,
|
|
18800
18800
|
topP: 0.9,
|
|
18801
18801
|
topK: 50,
|
|
@@ -23241,6 +23241,15 @@
|
|
|
23241
23241
|
* Map of team tool titles.
|
|
23242
23242
|
*/
|
|
23243
23243
|
const teamToolTitles = {};
|
|
23244
|
+
/**
|
|
23245
|
+
* Shared TEAM usage rules appended ahead of teammate listings.
|
|
23246
|
+
*
|
|
23247
|
+
* @private
|
|
23248
|
+
*/
|
|
23249
|
+
const TEAM_SYSTEM_MESSAGE_GUIDANCE_LINES = [
|
|
23250
|
+
'- If a teammate is relevant to the request, consult that teammate using the matching tool.',
|
|
23251
|
+
'- Do not ask the user for information that a listed teammate can provide directly.',
|
|
23252
|
+
];
|
|
23244
23253
|
/**
|
|
23245
23254
|
* Constant for remote agents by Url.
|
|
23246
23255
|
*/
|
|
@@ -23330,12 +23339,9 @@
|
|
|
23330
23339
|
if (updatedTools.some((tool) => tool.name === entry.toolName)) {
|
|
23331
23340
|
continue;
|
|
23332
23341
|
}
|
|
23333
|
-
const toolDescription = entry.description
|
|
23334
|
-
? `Consult teammate ${entry.teammate.label}\n${entry.description}`
|
|
23335
|
-
: `Consult teammate ${entry.teammate.label}`;
|
|
23336
23342
|
updatedTools.push({
|
|
23337
23343
|
name: entry.toolName,
|
|
23338
|
-
description:
|
|
23344
|
+
description: buildTeamToolDescription(entry),
|
|
23339
23345
|
parameters: {
|
|
23340
23346
|
type: 'object',
|
|
23341
23347
|
properties: {
|
|
@@ -23404,22 +23410,72 @@
|
|
|
23404
23410
|
/**
|
|
23405
23411
|
* Builds the textual TEAM section body for the final system message.
|
|
23406
23412
|
*
|
|
23407
|
-
* Each teammate is listed with its tool name
|
|
23408
|
-
* Uses `spaceTrim` to ensure consistent whitespace and indentation.
|
|
23413
|
+
* Each teammate is listed with its tool name, TEAM instructions, and optional profile hints.
|
|
23409
23414
|
*/
|
|
23410
23415
|
function buildTeamSystemMessageBody(teamEntries) {
|
|
23411
|
-
const lines =
|
|
23412
|
-
|
|
23413
|
-
|
|
23414
|
-
|
|
23415
|
-
|
|
23416
|
-
|
|
23417
|
-
|
|
23418
|
-
|
|
23419
|
-
|
|
23420
|
-
});
|
|
23416
|
+
const lines = [
|
|
23417
|
+
...TEAM_SYSTEM_MESSAGE_GUIDANCE_LINES,
|
|
23418
|
+
'',
|
|
23419
|
+
...teamEntries.map((entry, index) => {
|
|
23420
|
+
const toolLine = `${index + 1}) ${entry.teammate.label} tool \`${entry.toolName}\``;
|
|
23421
|
+
const detailLines = collectTeamEntryDetails(entry).map(formatTeamEntryDetailLine);
|
|
23422
|
+
return [toolLine, ...detailLines].join('\n');
|
|
23423
|
+
}),
|
|
23424
|
+
];
|
|
23421
23425
|
return lines.join('\n');
|
|
23422
23426
|
}
|
|
23427
|
+
/**
|
|
23428
|
+
* Builds the model-visible description for one teammate tool.
|
|
23429
|
+
*
|
|
23430
|
+
* @private
|
|
23431
|
+
*/
|
|
23432
|
+
function buildTeamToolDescription(entry) {
|
|
23433
|
+
const detailLines = collectTeamEntryDetails(entry).map(({ label, content }) => `${label}: ${content}`);
|
|
23434
|
+
return [`Consult teammate ${entry.teammate.label}`, ...detailLines].join('\n');
|
|
23435
|
+
}
|
|
23436
|
+
/**
|
|
23437
|
+
* Collects structured teammate details that should stay visible to the model.
|
|
23438
|
+
*
|
|
23439
|
+
* @private
|
|
23440
|
+
*/
|
|
23441
|
+
function collectTeamEntryDetails(entry) {
|
|
23442
|
+
var _a;
|
|
23443
|
+
const details = [];
|
|
23444
|
+
const instructions = entry.teammate.instructions.trim();
|
|
23445
|
+
const description = ((_a = entry.description) === null || _a === void 0 ? void 0 : _a.trim()) || '';
|
|
23446
|
+
if (instructions) {
|
|
23447
|
+
details.push({
|
|
23448
|
+
label: 'TEAM instructions',
|
|
23449
|
+
content: instructions,
|
|
23450
|
+
});
|
|
23451
|
+
}
|
|
23452
|
+
if (description) {
|
|
23453
|
+
details.push({
|
|
23454
|
+
label: 'Profile',
|
|
23455
|
+
content: description,
|
|
23456
|
+
});
|
|
23457
|
+
}
|
|
23458
|
+
return details;
|
|
23459
|
+
}
|
|
23460
|
+
/**
|
|
23461
|
+
* Formats one teammate detail line for the TEAM system-message section.
|
|
23462
|
+
*
|
|
23463
|
+
* @private
|
|
23464
|
+
*/
|
|
23465
|
+
function formatTeamEntryDetailLine(detail) {
|
|
23466
|
+
return indentMultilineText(`${detail.label}: ${detail.content}`, ' ');
|
|
23467
|
+
}
|
|
23468
|
+
/**
|
|
23469
|
+
* Indents all lines of one potentially multi-line text block.
|
|
23470
|
+
*
|
|
23471
|
+
* @private
|
|
23472
|
+
*/
|
|
23473
|
+
function indentMultilineText(text, prefix) {
|
|
23474
|
+
return text
|
|
23475
|
+
.split('\n')
|
|
23476
|
+
.map((line) => `${prefix}${line}`)
|
|
23477
|
+
.join('\n');
|
|
23478
|
+
}
|
|
23423
23479
|
/**
|
|
23424
23480
|
* Registers tool function and title for a teammate tool.
|
|
23425
23481
|
*/
|
|
@@ -39044,7 +39100,7 @@
|
|
|
39044
39100
|
/**
|
|
39045
39101
|
* Constant for default agent kit model name.
|
|
39046
39102
|
*/
|
|
39047
|
-
const DEFAULT_AGENT_KIT_MODEL_NAME = 'gpt-5.4-
|
|
39103
|
+
const DEFAULT_AGENT_KIT_MODEL_NAME = 'gpt-5.4-mini';
|
|
39048
39104
|
/**
|
|
39049
39105
|
* Creates one structured log entry for streamed tool-call updates.
|
|
39050
39106
|
*
|
|
@@ -40094,6 +40150,7 @@
|
|
|
40094
40150
|
* @param agentSource The agent source string that defines the agent's behavior
|
|
40095
40151
|
*/
|
|
40096
40152
|
constructor(options) {
|
|
40153
|
+
var _a;
|
|
40097
40154
|
this.options = options;
|
|
40098
40155
|
/**
|
|
40099
40156
|
* Cached model requirements to avoid re-parsing the agent source
|
|
@@ -40103,6 +40160,7 @@
|
|
|
40103
40160
|
* Cached parsed agent information
|
|
40104
40161
|
*/
|
|
40105
40162
|
this._cachedAgentInfo = null;
|
|
40163
|
+
this.precomputedModelRequirements = (_a = options.precomputedModelRequirements) !== null && _a !== void 0 ? _a : null;
|
|
40106
40164
|
}
|
|
40107
40165
|
/**
|
|
40108
40166
|
* Updates the agent source and clears the cache
|
|
@@ -40110,9 +40168,13 @@
|
|
|
40110
40168
|
* @param agentSource The new agent source string
|
|
40111
40169
|
*/
|
|
40112
40170
|
updateAgentSource(agentSource) {
|
|
40171
|
+
if (this.options.agentSource === agentSource) {
|
|
40172
|
+
return;
|
|
40173
|
+
}
|
|
40113
40174
|
this.options.agentSource = agentSource;
|
|
40114
40175
|
this._cachedAgentInfo = null;
|
|
40115
40176
|
this._cachedModelRequirements = null;
|
|
40177
|
+
this.precomputedModelRequirements = null;
|
|
40116
40178
|
}
|
|
40117
40179
|
/**
|
|
40118
40180
|
* Get cached or parse agent information
|
|
@@ -40129,6 +40191,16 @@
|
|
|
40129
40191
|
* Note: [🐤] This is names `getModelRequirements` *(not `getAgentModelRequirements`)* because in future these two will be united
|
|
40130
40192
|
*/
|
|
40131
40193
|
async getModelRequirements() {
|
|
40194
|
+
var _a, _b;
|
|
40195
|
+
if (this.precomputedModelRequirements !== null) {
|
|
40196
|
+
if (this.options.isVerbose) {
|
|
40197
|
+
console.info('[🤰]', 'Using precomputed agent model requirements', {
|
|
40198
|
+
agent: this.title,
|
|
40199
|
+
toolCount: (_b = (_a = this.precomputedModelRequirements.tools) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0,
|
|
40200
|
+
});
|
|
40201
|
+
}
|
|
40202
|
+
return this.precomputedModelRequirements;
|
|
40203
|
+
}
|
|
40132
40204
|
if (this._cachedModelRequirements === null) {
|
|
40133
40205
|
const preparationStartedAtMs = Date.now();
|
|
40134
40206
|
if (this.options.isVerbose) {
|
|
@@ -40238,6 +40310,7 @@
|
|
|
40238
40310
|
* Resolves agent requirements, attachments, and runtime overrides into one forwarded chat prompt.
|
|
40239
40311
|
*/
|
|
40240
40312
|
async prepareChatPrompt(prompt) {
|
|
40313
|
+
var _a;
|
|
40241
40314
|
const chatPrompt = this.requireChatPrompt(prompt);
|
|
40242
40315
|
const { sanitizedRequirements, promptSuffix } = await this.getSanitizedAgentModelRequirements();
|
|
40243
40316
|
const attachments = normalizeChatAttachments(chatPrompt.attachments);
|
|
@@ -40255,7 +40328,16 @@
|
|
|
40255
40328
|
mergedTools,
|
|
40256
40329
|
knowledgeSourcesForAgent,
|
|
40257
40330
|
});
|
|
40258
|
-
|
|
40331
|
+
if (this.options.isVerbose) {
|
|
40332
|
+
console.info('[🤰]', 'Prepared agent chat prompt', {
|
|
40333
|
+
agent: this.title,
|
|
40334
|
+
usedPrecomputedModelRequirements: this.precomputedModelRequirements !== null,
|
|
40335
|
+
toolNames: mergedTools.map((tool) => tool.name),
|
|
40336
|
+
knowledgeSourcesCount: (_a = knowledgeSourcesForAgent === null || knowledgeSourcesForAgent === void 0 ? void 0 : knowledgeSourcesForAgent.length) !== null && _a !== void 0 ? _a : 0,
|
|
40337
|
+
promptSuffixLength: promptSuffix.length,
|
|
40338
|
+
systemMessageLength: sanitizedRequirements.systemMessage.length,
|
|
40339
|
+
});
|
|
40340
|
+
}
|
|
40259
40341
|
return {
|
|
40260
40342
|
forwardedPrompt,
|
|
40261
40343
|
sanitizedRequirements,
|
|
@@ -40442,6 +40524,7 @@
|
|
|
40442
40524
|
* Runs one prepared prompt through the deprecated OpenAI Assistant backend.
|
|
40443
40525
|
*/
|
|
40444
40526
|
async callOpenAiAssistantChatModelStream(options) {
|
|
40527
|
+
var _a, _b, _c, _d;
|
|
40445
40528
|
const assistant = await this.getOrPrepareOpenAiAssistant({
|
|
40446
40529
|
llmTools: options.llmTools,
|
|
40447
40530
|
originalPrompt: options.originalPrompt,
|
|
@@ -40449,7 +40532,14 @@
|
|
|
40449
40532
|
onProgress: options.onProgress,
|
|
40450
40533
|
});
|
|
40451
40534
|
const promptWithAgentModelRequirementsForOpenAiAssistantExecutionTools = createOpenAiAssistantPrompt(options.preparedChatPrompt.forwardedPrompt);
|
|
40452
|
-
|
|
40535
|
+
if (this.options.isVerbose) {
|
|
40536
|
+
console.info('[🤰]', 'Prepared OpenAI Assistant prompt', {
|
|
40537
|
+
agent: this.title,
|
|
40538
|
+
toolNames: (_b = (_a = promptWithAgentModelRequirementsForOpenAiAssistantExecutionTools.modelRequirements.tools) === null || _a === void 0 ? void 0 : _a.map((tool) => tool.name)) !== null && _b !== void 0 ? _b : [],
|
|
40539
|
+
knowledgeSourcesCount: (_d = (_c = promptWithAgentModelRequirementsForOpenAiAssistantExecutionTools.modelRequirements
|
|
40540
|
+
.knowledgeSources) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0,
|
|
40541
|
+
});
|
|
40542
|
+
}
|
|
40453
40543
|
return assistant.callChatModelStream(promptWithAgentModelRequirementsForOpenAiAssistantExecutionTools, options.onProgress, options.streamOptions);
|
|
40454
40544
|
}
|
|
40455
40545
|
/**
|
|
@@ -41140,7 +41230,8 @@
|
|
|
41140
41230
|
isVerbose: options.isVerbose,
|
|
41141
41231
|
llmTools: getSingleLlmExecutionTools(options.executionTools.llm),
|
|
41142
41232
|
assistantPreparationMode: options.assistantPreparationMode,
|
|
41143
|
-
agentSource: agentSource.value,
|
|
41233
|
+
agentSource: agentSource.value,
|
|
41234
|
+
precomputedModelRequirements: options.precomputedModelRequirements,
|
|
41144
41235
|
});
|
|
41145
41236
|
this._agentName = undefined;
|
|
41146
41237
|
/**
|