@promptbook/wizard 0.105.0-3 → 0.105.0-5
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 +36 -77
- package/esm/index.es.js +122 -12
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/browser.index.d.ts +2 -0
- package/esm/typings/src/_packages/types.index.d.ts +12 -0
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +6 -1
- package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +3 -6
- package/esm/typings/src/book-components/Chat/types/ChatMessage.d.ts +9 -0
- package/esm/typings/src/execution/LlmExecutionTools.d.ts +3 -1
- package/esm/typings/src/llm-providers/openai/OpenAiCompatibleExecutionTools.d.ts +7 -0
- package/esm/typings/src/search-engines/_index.d.ts +6 -0
- package/esm/typings/src/search-engines/google/GoogleSearchEngine.d.ts +18 -0
- package/esm/typings/src/search-engines/serp/SerpSearchEngine.d.ts +15 -0
- package/esm/typings/src/speech-recognition/BrowserSpeechRecognition.d.ts +21 -0
- package/esm/typings/src/speech-recognition/OpenAiSpeechRecognition.d.ts +32 -0
- package/esm/typings/src/types/SpeechRecognition.d.ts +58 -0
- package/esm/typings/src/types/typeAliases.d.ts +4 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +122 -12
- package/umd/index.umd.js.map +1 -1
package/README.md
CHANGED
|
@@ -72,19 +72,20 @@ Rest of the documentation is common for **entire promptbook ecosystem**:
|
|
|
72
72
|
|
|
73
73
|
## 📖 The Book Whitepaper
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
Nowadays, the biggest challenge for most business applications isn't the raw capabilities of AI models. Large language models such as GPT-5.2 and Claude-4.5 are incredibly capable.
|
|
76
76
|
|
|
77
|
-
The main challenge
|
|
77
|
+
The main challenge lies in **managing the context**, providing rules and knowledge, and narrowing the personality.
|
|
78
78
|
|
|
79
|
-
Promptbook
|
|
79
|
+
In Promptbook, you can define your context **using simple Books** that are very explicit, easy to understand and write, reliable, and highly portable.
|
|
80
80
|
|
|
81
81
|
<table style="border: 1px solid #777; border-radius: 10px;"><tr><td>
|
|
82
82
|
|
|
83
|
-
**<ins>Paul Smith
|
|
83
|
+
**<ins>Paul Smith</ins>**<br/>
|
|
84
84
|
<br/>
|
|
85
85
|
**PERSONA** You are a company lawyer.<br/>
|
|
86
86
|
Your job is to provide legal advice and support to the company and its employees.<br/>
|
|
87
|
-
You are knowledgeable, professional, and detail-oriented.<br/>
|
|
87
|
+
**RULE** You are knowledgeable, professional, and detail-oriented.<br/>
|
|
88
|
+
TEAM You are part of the legal team of Paul Smith & Associés, you discuss with {Emily White}, the head of the compliance department. {George Brown} is expert in corporate law and {Sophia Black} is expert in labor law.<br/>
|
|
88
89
|
|
|
89
90
|
</td></tr></table>
|
|
90
91
|
|
|
@@ -94,7 +95,9 @@ You are knowledgeable, professional, and detail-oriented.<br/>
|
|
|
94
95
|
|
|
95
96
|
We have created a language called **Book**, which allows you to write AI agents in their native language and create your own AI persona. Book provides a guide to define all the traits and commitments.
|
|
96
97
|
|
|
97
|
-
You can look at it as prompting (or writing a system message), but decorated by **commitments**.
|
|
98
|
+
You can look at it as "prompting" _(or writing a system message)_, but decorated by **commitments**.
|
|
99
|
+
|
|
100
|
+
**Commitments** are special syntax elements that define contracts between you and the AI agent. They are transformed by Promptbook Engine into low-level parameters like which model to use, its temperature, system message, RAG index, MCP servers, and many other parameters. For some commitments _(for example `RULE` commitment)_ Promptbook Engine can even create adversary agents and extra checks to enforce the rules.
|
|
98
101
|
|
|
99
102
|
#### `Persona` commitment
|
|
100
103
|
|
|
@@ -105,8 +108,6 @@ Personas define the character of your AI persona, its role, and how it should in
|
|
|
105
108
|
**<ins>Paul Smith & Associés</ins>**<br/>
|
|
106
109
|
<br/>
|
|
107
110
|
**PERSONA** You are a company lawyer.<br/>
|
|
108
|
-
Your job is to provide legal advice and support to the company and its employees.<br/>
|
|
109
|
-
You are knowledgeable, professional, and detail-oriented.<br/>
|
|
110
111
|
|
|
111
112
|
</td></tr></table>
|
|
112
113
|
|
|
@@ -126,7 +127,7 @@ Promptbook Engine will automatically enforce this knowledge during interactions.
|
|
|
126
127
|
Your job is to provide legal advice and support to the company and its employees.<br/>
|
|
127
128
|
You are knowledgeable, professional, and detail-oriented.<br/>
|
|
128
129
|
<br/>
|
|
129
|
-
**KNOWLEDGE**
|
|
130
|
+
**KNOWLEDGE** https://company.com/company-policies.pdf<br/>
|
|
130
131
|
**KNOWLEDGE** https://company.com/internal-documents/employee-handbook.docx<br/>
|
|
131
132
|
|
|
132
133
|
</td></tr></table>
|
|
@@ -148,14 +149,14 @@ You are knowledgeable, professional, and detail-oriented.<br/>
|
|
|
148
149
|
**RULE** Always ensure compliance with laws and regulations.<br/>
|
|
149
150
|
**RULE** Never provide legal advice outside your area of expertise.<br/>
|
|
150
151
|
**RULE** Never provide legal advice about criminal law.<br/>
|
|
151
|
-
**KNOWLEDGE**
|
|
152
|
+
**KNOWLEDGE** https://company.com/company-policies.pdf<br/>
|
|
152
153
|
**KNOWLEDGE** https://company.com/internal-documents/employee-handbook.docx<br/>
|
|
153
154
|
|
|
154
155
|
</td></tr></table>
|
|
155
156
|
|
|
156
|
-
#### `
|
|
157
|
+
#### `Team` commitment
|
|
157
158
|
|
|
158
|
-
|
|
159
|
+
Team commitment allows you to define the team structure and advisory fellow members the AI can consult with. This allows the AI to simulate collaboration and consultation with other experts, enhancing the quality of its responses.
|
|
159
160
|
|
|
160
161
|
<table style="border: 1px solid #777; border-radius: 10px;"><tr><td>
|
|
161
162
|
|
|
@@ -168,81 +169,36 @@ You are knowledgeable, professional, and detail-oriented.<br/>
|
|
|
168
169
|
**RULE** Always ensure compliance with laws and regulations.<br/>
|
|
169
170
|
**RULE** Never provide legal advice outside your area of expertise.<br/>
|
|
170
171
|
**RULE** Never provide legal advice about criminal law.<br/>
|
|
171
|
-
**KNOWLEDGE**
|
|
172
|
+
**KNOWLEDGE** https://company.com/company-policies.pdf<br/>
|
|
172
173
|
**KNOWLEDGE** https://company.com/internal-documents/employee-handbook.docx<br/>
|
|
173
|
-
|
|
174
|
+
TEAM You are part of the legal team of Paul Smith & Associés, you discuss with {Emily White}, the head of the compliance department. {George Brown} is expert in corporate law and {Sophia Black} is expert in labor law.<br/>
|
|
174
175
|
|
|
175
176
|
</td></tr></table>
|
|
176
177
|
|
|
177
|
-
[Read more about the language](./BLUEPRINT.md)
|
|
178
|
-
|
|
179
|
-
<div style="page-break-after: always;"></div>
|
|
180
|
-
|
|
181
|
-
### Where to use your AI agent in book
|
|
182
|
-
|
|
183
|
-
Books can be useful in various applications and scenarios. Here are some examples:
|
|
184
|
-
|
|
185
|
-
#### Chat apps:
|
|
186
178
|
|
|
187
|
-
Create your own chat shopping assistant and place it in your eShop.
|
|
188
|
-
You will be able to answer customer questions, help them find products, and provide personalized recommendations. Everything is tightly controlled by the book you have written.
|
|
189
179
|
|
|
190
|
-
|
|
180
|
+
### Promptbook Ecosystem
|
|
191
181
|
|
|
192
|
-
|
|
182
|
+
!!!@@@
|
|
193
183
|
|
|
194
|
-
####
|
|
195
|
-
|
|
196
|
-
Do you love Vibecoding, but the AI code is not always aligned with your coding style and architecture, rules, security, etc.? Create your own coding agent to help enforce your specific coding standards and practices.
|
|
197
|
-
|
|
198
|
-
This can be integrated to almost any Vibecoding platform, like GitHub Copilot, Amazon CodeWhisperer, Cursor, Cline, Kilocode, Roocode,...
|
|
199
|
-
|
|
200
|
-
They will work the same as you are used to, but with your specific rules written in book.
|
|
201
|
-
|
|
202
|
-
#### Internal Expertise
|
|
203
|
-
|
|
204
|
-
Do you have an app written in TypeScript, Python, C#, Java, or any other language, and you are integrating the AI.
|
|
205
|
-
|
|
206
|
-
You can avoid struggle with choosing the best model, its settings like temperature, max tokens, etc., by writing a book agent and using it as your AI expertise.
|
|
207
|
-
|
|
208
|
-
Doesn't matter if you do automations, data analysis, customer support, sentiment analysis, classification, or any other task. Your AI agent will be tailored to your specific needs and requirements.
|
|
209
|
-
|
|
210
|
-
Even works in no-code platforms!
|
|
211
|
-
|
|
212
|
-
<div style="page-break-after: always;"></div>
|
|
184
|
+
#### Promptbook Server
|
|
213
185
|
|
|
214
|
-
|
|
186
|
+
!!!@@@
|
|
215
187
|
|
|
216
|
-
|
|
188
|
+
#### Promptbook Engine
|
|
217
189
|
|
|
218
|
-
|
|
190
|
+
!!!@@@
|
|
219
191
|
|
|
220
|
-
We have written ai asistant in book who can help you with writing your first book.
|
|
221
192
|
|
|
222
|
-
#### Your AI twin
|
|
223
193
|
|
|
224
|
-
Copy your own behavior, personality, and knowledge into book and create your AI twin. It can help you with your work, personal life, or any other task.
|
|
225
194
|
|
|
226
|
-
#### AI persona workpool
|
|
227
195
|
|
|
228
|
-
Or you can pick from our library of pre-written books for various roles and tasks. You can find books for customer support, coding, marketing, sales, HR, legal, and many other roles.
|
|
229
196
|
|
|
230
197
|
|
|
231
198
|
|
|
232
199
|
|
|
233
200
|
|
|
234
201
|
|
|
235
|
-
## 🚀 Get started
|
|
236
|
-
|
|
237
|
-
Take a look at the simple starter kit with books integrated into the **Hello World** sample applications:
|
|
238
|
-
|
|
239
|
-
- [Hello Book](https://github.com/webgptorg/hello-world)
|
|
240
|
-
- [Hello Book in Node.js](https://github.com/webgptorg/hello-world-node-js)
|
|
241
|
-
- [Hello Book in Next.js](https://github.com/webgptorg/hello-world-next-js)
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
202
|
|
|
247
203
|
|
|
248
204
|
## 💜 The Promptbook Project
|
|
@@ -258,33 +214,32 @@ Promptbook project is ecosystem of multiple projects and tools, following is a l
|
|
|
258
214
|
</thead>
|
|
259
215
|
<tbody>
|
|
260
216
|
<tr>
|
|
261
|
-
<td><a href="https://
|
|
217
|
+
<td><a href="https://gallery.ptbk.io/">Agents Server</a></td>
|
|
262
218
|
<td>
|
|
263
|
-
|
|
264
|
-
<hr>
|
|
265
|
-
There is also <a href="https://github.com/webgptorg/book-extension">a plugin for VSCode</a> to support <code>.book</code> file extension
|
|
219
|
+
Place where you "AI agents live". It allows to create, manage, deploy, and interact with AI agents created in Book language.
|
|
266
220
|
</td>
|
|
267
221
|
</tr>
|
|
268
222
|
<tr>
|
|
269
|
-
<td><a href="https://github.com/webgptorg/
|
|
223
|
+
<td><a href="https://github.com/webgptorg/book">Book language</a></td>
|
|
270
224
|
<td>
|
|
271
|
-
|
|
225
|
+
Human-friendly, high-level language that abstracts away low-level details of AI. It allows to focus on personality, behavior, knowledge, and rules of AI agents rather than on models, parameters, and prompt engineering.
|
|
226
|
+
<hr>
|
|
227
|
+
There is also <a href="https://github.com/webgptorg/book-extension">a plugin for VSCode</a> to support <code>.book</code> file extension
|
|
272
228
|
</td>
|
|
273
229
|
</tr>
|
|
274
230
|
<tr>
|
|
275
|
-
<td><a href="https://promptbook
|
|
231
|
+
<td><a href="https://github.com/webgptorg/promptbook">Promptbook Engine</a></td>
|
|
276
232
|
<td>
|
|
277
|
-
Promptbook
|
|
233
|
+
Promptbook engine can run AI agents based on Book language.
|
|
234
|
+
It is released as <a href="https://www.npmjs.com/package/@promptbook/core#-packages-for-developers">multiple NPM packages</a> and <a href="https://hub.docker.com/r/hejny/promptbook">Promptbook Agent Server as Docker Package</a>
|
|
235
|
+
Agent Server is based on Promptbook Engine.
|
|
278
236
|
</td>
|
|
279
237
|
</tr>
|
|
238
|
+
|
|
280
239
|
</tbody>
|
|
281
240
|
</table>
|
|
282
241
|
|
|
283
|
-
Hello world examples:
|
|
284
242
|
|
|
285
|
-
- [Hello world](https://github.com/webgptorg/hello-world)
|
|
286
|
-
- [Hello world in Node.js](https://github.com/webgptorg/hello-world-node-js)
|
|
287
|
-
- [Hello world in Next.js](https://github.com/webgptorg/hello-world-next-js)
|
|
288
243
|
|
|
289
244
|
### 🌐 Community & Social Media
|
|
290
245
|
|
|
@@ -342,6 +297,8 @@ Join our growing community of developers and users:
|
|
|
342
297
|
|
|
343
298
|
|
|
344
299
|
|
|
300
|
+
|
|
301
|
+
|
|
345
302
|
## 📚 Documentation
|
|
346
303
|
|
|
347
304
|
See detailed guides and API reference in the [docs](https://github.com/webgptorg/promptbook/discussions/categories/concepts) or [online](https://discord.gg/x3QWNaa89N).
|
|
@@ -418,6 +375,8 @@ The following glossary is used to clarify certain concepts:
|
|
|
418
375
|
|
|
419
376
|
_Note: This section is not a complete dictionary, more list of general AI / LLM terms that has connection with Promptbook_
|
|
420
377
|
|
|
378
|
+
|
|
379
|
+
|
|
421
380
|
### 💯 Core concepts
|
|
422
381
|
|
|
423
382
|
- [📚 Collection of pipelines](https://github.com/webgptorg/promptbook/discussions/65)
|
package/esm/index.es.js
CHANGED
|
@@ -36,7 +36,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
36
36
|
* @generated
|
|
37
37
|
* @see https://github.com/webgptorg/promptbook
|
|
38
38
|
*/
|
|
39
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.105.0-
|
|
39
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.105.0-5';
|
|
40
40
|
/**
|
|
41
41
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
42
42
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -5832,20 +5832,29 @@ class OpenAiCompatibleExecutionTools {
|
|
|
5832
5832
|
});
|
|
5833
5833
|
return availableModels;
|
|
5834
5834
|
}
|
|
5835
|
+
/**
|
|
5836
|
+
* Calls OpenAI compatible API to use a chat model.
|
|
5837
|
+
*/
|
|
5835
5838
|
/**
|
|
5836
5839
|
* Calls OpenAI compatible API to use a chat model.
|
|
5837
5840
|
*/
|
|
5838
5841
|
async callChatModel(prompt) {
|
|
5842
|
+
return this.callChatModelStream(prompt, () => { });
|
|
5843
|
+
}
|
|
5844
|
+
/**
|
|
5845
|
+
* Calls OpenAI compatible API to use a chat model with streaming.
|
|
5846
|
+
*/
|
|
5847
|
+
async callChatModelStream(prompt, onProgress) {
|
|
5839
5848
|
// Deep clone prompt and modelRequirements to avoid mutation across calls
|
|
5840
5849
|
const clonedPrompt = JSON.parse(JSON.stringify(prompt));
|
|
5841
5850
|
// Use local Set for retried parameters to ensure independence and thread safety
|
|
5842
5851
|
const retriedUnsupportedParameters = new Set();
|
|
5843
|
-
return this.callChatModelWithRetry(clonedPrompt, clonedPrompt.modelRequirements, [], retriedUnsupportedParameters);
|
|
5852
|
+
return this.callChatModelWithRetry(clonedPrompt, clonedPrompt.modelRequirements, [], retriedUnsupportedParameters, onProgress);
|
|
5844
5853
|
}
|
|
5845
5854
|
/**
|
|
5846
5855
|
* Internal method that handles parameter retry for chat model calls
|
|
5847
5856
|
*/
|
|
5848
|
-
async callChatModelWithRetry(prompt, currentModelRequirements, attemptStack = [], retriedUnsupportedParameters = new Set()) {
|
|
5857
|
+
async callChatModelWithRetry(prompt, currentModelRequirements, attemptStack = [], retriedUnsupportedParameters = new Set(), onProgress) {
|
|
5849
5858
|
var _a;
|
|
5850
5859
|
if (this.options.isVerbose) {
|
|
5851
5860
|
console.info(`💬 ${this.title} callChatModel call`, { prompt, currentModelRequirements });
|
|
@@ -5951,6 +5960,23 @@ class OpenAiCompatibleExecutionTools {
|
|
|
5951
5960
|
const usage = this.computeUsage(content || '', responseMessage.content || '', rawResponse);
|
|
5952
5961
|
totalUsage = addUsage(totalUsage, usage);
|
|
5953
5962
|
if (responseMessage.tool_calls && responseMessage.tool_calls.length > 0) {
|
|
5963
|
+
if (onProgress) {
|
|
5964
|
+
onProgress({
|
|
5965
|
+
content: responseMessage.content || '',
|
|
5966
|
+
modelName: rawResponse.model || modelName,
|
|
5967
|
+
timing: { start, complete: $getCurrentDate() },
|
|
5968
|
+
usage: totalUsage,
|
|
5969
|
+
toolCalls: responseMessage.tool_calls.map((toolCall) => ({
|
|
5970
|
+
name: toolCall.function.name,
|
|
5971
|
+
arguments: toolCall.function.arguments,
|
|
5972
|
+
result: '',
|
|
5973
|
+
rawToolCall: toolCall,
|
|
5974
|
+
})),
|
|
5975
|
+
rawPromptContent,
|
|
5976
|
+
rawRequest,
|
|
5977
|
+
rawResponse,
|
|
5978
|
+
});
|
|
5979
|
+
}
|
|
5954
5980
|
await forEachAsync(responseMessage.tool_calls, {}, async (toolCall) => {
|
|
5955
5981
|
const functionName = toolCall.function.name;
|
|
5956
5982
|
const functionArgs = toolCall.function.arguments;
|
|
@@ -5972,7 +5998,7 @@ class OpenAiCompatibleExecutionTools {
|
|
|
5972
5998
|
const args = ${functionArgs};
|
|
5973
5999
|
return await ${functionName}(args);
|
|
5974
6000
|
`,
|
|
5975
|
-
parameters:
|
|
6001
|
+
parameters: prompt.parameters,
|
|
5976
6002
|
});
|
|
5977
6003
|
}
|
|
5978
6004
|
catch (error) {
|
|
@@ -6078,7 +6104,7 @@ class OpenAiCompatibleExecutionTools {
|
|
|
6078
6104
|
});
|
|
6079
6105
|
// Remove the unsupported parameter and retry
|
|
6080
6106
|
const modifiedModelRequirements = removeUnsupportedModelRequirement(currentModelRequirements, unsupportedParameter);
|
|
6081
|
-
return this.callChatModelWithRetry(prompt, modifiedModelRequirements, attemptStack, retriedUnsupportedParameters);
|
|
6107
|
+
return this.callChatModelWithRetry(prompt, modifiedModelRequirements, attemptStack, retriedUnsupportedParameters, onProgress);
|
|
6082
6108
|
}
|
|
6083
6109
|
}
|
|
6084
6110
|
throw new PipelineExecutionError(`Tool calling loop did not return a result from ${this.title}`);
|
|
@@ -8192,6 +8218,15 @@ class OpenAiAssistantExecutionTools extends OpenAiExecutionTools {
|
|
|
8192
8218
|
// [🐱🚀] When tools are present, we need to use the non-streaming Runs API
|
|
8193
8219
|
// because streaming doesn't support tool execution flow properly
|
|
8194
8220
|
if (hasTools) {
|
|
8221
|
+
onProgress({
|
|
8222
|
+
content: '',
|
|
8223
|
+
modelName: 'assistant',
|
|
8224
|
+
timing: { start, complete: $getCurrentDate() },
|
|
8225
|
+
usage: UNCERTAIN_USAGE,
|
|
8226
|
+
rawPromptContent,
|
|
8227
|
+
rawRequest: null,
|
|
8228
|
+
rawResponse: null,
|
|
8229
|
+
});
|
|
8195
8230
|
const rawRequest = {
|
|
8196
8231
|
assistant_id: this.assistantId,
|
|
8197
8232
|
thread: {
|
|
@@ -8215,6 +8250,23 @@ class OpenAiAssistantExecutionTools extends OpenAiExecutionTools {
|
|
|
8215
8250
|
if (toolCall.type === 'function') {
|
|
8216
8251
|
const functionName = toolCall.function.name;
|
|
8217
8252
|
const functionArgs = JSON.parse(toolCall.function.arguments);
|
|
8253
|
+
onProgress({
|
|
8254
|
+
content: '',
|
|
8255
|
+
modelName: 'assistant',
|
|
8256
|
+
timing: { start, complete: $getCurrentDate() },
|
|
8257
|
+
usage: UNCERTAIN_USAGE,
|
|
8258
|
+
rawPromptContent,
|
|
8259
|
+
rawRequest: null,
|
|
8260
|
+
rawResponse: null,
|
|
8261
|
+
toolCalls: [
|
|
8262
|
+
{
|
|
8263
|
+
name: functionName,
|
|
8264
|
+
arguments: toolCall.function.arguments,
|
|
8265
|
+
result: '',
|
|
8266
|
+
rawToolCall: toolCall,
|
|
8267
|
+
},
|
|
8268
|
+
],
|
|
8269
|
+
});
|
|
8218
8270
|
if (this.options.isVerbose) {
|
|
8219
8271
|
console.info(`🔧 Executing tool: ${functionName}`, functionArgs);
|
|
8220
8272
|
}
|
|
@@ -8237,7 +8289,7 @@ class OpenAiAssistantExecutionTools extends OpenAiExecutionTools {
|
|
|
8237
8289
|
const args = ${JSON.stringify(functionArgs)};
|
|
8238
8290
|
return await ${functionName}(args);
|
|
8239
8291
|
`,
|
|
8240
|
-
parameters:
|
|
8292
|
+
parameters: prompt.parameters,
|
|
8241
8293
|
});
|
|
8242
8294
|
if (this.options.isVerbose) {
|
|
8243
8295
|
console.info(`✅ Tool ${functionName} executed:`, functionResponse);
|
|
@@ -17826,7 +17878,12 @@ class UseTimeCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
17826
17878
|
description: 'Get the current date and time in ISO 8601 format.',
|
|
17827
17879
|
parameters: {
|
|
17828
17880
|
type: 'object',
|
|
17829
|
-
properties: {
|
|
17881
|
+
properties: {
|
|
17882
|
+
timezone: {
|
|
17883
|
+
type: 'string',
|
|
17884
|
+
description: 'Optional timezone name (e.g. "Europe/Prague", "UTC", "America/New_York").',
|
|
17885
|
+
},
|
|
17886
|
+
},
|
|
17830
17887
|
required: [],
|
|
17831
17888
|
},
|
|
17832
17889
|
},
|
|
@@ -17846,9 +17903,36 @@ class UseTimeCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
17846
17903
|
*/
|
|
17847
17904
|
getToolFunctions() {
|
|
17848
17905
|
return {
|
|
17849
|
-
async get_current_time() {
|
|
17850
|
-
|
|
17851
|
-
|
|
17906
|
+
async get_current_time(args) {
|
|
17907
|
+
var _a;
|
|
17908
|
+
console.log('!!!! [Tool] get_current_time called', { args });
|
|
17909
|
+
const { timezone } = args;
|
|
17910
|
+
if (!timezone) {
|
|
17911
|
+
return new Date().toISOString();
|
|
17912
|
+
}
|
|
17913
|
+
try {
|
|
17914
|
+
// Note: Returning ISO 8601 string but in the requested timezone
|
|
17915
|
+
const formatter = new Intl.DateTimeFormat('en-CA', {
|
|
17916
|
+
timeZone: timezone,
|
|
17917
|
+
year: 'numeric',
|
|
17918
|
+
month: '2-digit',
|
|
17919
|
+
day: '2-digit',
|
|
17920
|
+
hour: '2-digit',
|
|
17921
|
+
minute: '2-digit',
|
|
17922
|
+
second: '2-digit',
|
|
17923
|
+
hour12: false,
|
|
17924
|
+
timeZoneName: 'shortOffset',
|
|
17925
|
+
});
|
|
17926
|
+
const parts = formatter.formatToParts(new Date());
|
|
17927
|
+
const part = (type) => { var _a; return (_a = parts.find((p) => p.type === type)) === null || _a === void 0 ? void 0 : _a.value; };
|
|
17928
|
+
// en-CA format is YYYY-MM-DD
|
|
17929
|
+
const isoString = `${part('year')}-${part('month')}-${part('day')}T${part('hour')}:${part('minute')}:${part('second')}${(_a = part('timeZoneName')) === null || _a === void 0 ? void 0 : _a.replace('GMT', '')}`;
|
|
17930
|
+
return isoString;
|
|
17931
|
+
}
|
|
17932
|
+
catch (error) {
|
|
17933
|
+
// Fallback to UTC if timezone is invalid
|
|
17934
|
+
return new Date().toISOString();
|
|
17935
|
+
}
|
|
17852
17936
|
},
|
|
17853
17937
|
};
|
|
17854
17938
|
}
|
|
@@ -18715,26 +18799,52 @@ function parseAgentSource(agentSource) {
|
|
|
18715
18799
|
});
|
|
18716
18800
|
continue;
|
|
18717
18801
|
}
|
|
18802
|
+
if (commitment.type === 'FROM') {
|
|
18803
|
+
const content = spaceTrim$2(commitment.content).split('\n')[0] || '';
|
|
18804
|
+
if (content === 'Adam' || content === '' /* <- Note: Adam is implicit */) {
|
|
18805
|
+
continue;
|
|
18806
|
+
}
|
|
18807
|
+
let label = content;
|
|
18808
|
+
let iconName = 'SquareArrowOutUpRight'; // Inheritance remote
|
|
18809
|
+
if (content.startsWith('./') || content.startsWith('../') || content.startsWith('/')) {
|
|
18810
|
+
label = content.split('/').pop() || content;
|
|
18811
|
+
iconName = 'SquareArrowUpRight'; // Inheritance local
|
|
18812
|
+
}
|
|
18813
|
+
if (content === 'VOID') {
|
|
18814
|
+
label = 'VOID';
|
|
18815
|
+
iconName = 'ShieldAlert'; // [🧠] Or some other icon for VOID
|
|
18816
|
+
}
|
|
18817
|
+
capabilities.push({
|
|
18818
|
+
type: 'inheritance',
|
|
18819
|
+
label,
|
|
18820
|
+
iconName,
|
|
18821
|
+
agentUrl: content,
|
|
18822
|
+
});
|
|
18823
|
+
continue;
|
|
18824
|
+
}
|
|
18718
18825
|
if (commitment.type === 'IMPORT') {
|
|
18719
18826
|
const content = spaceTrim$2(commitment.content).split('\n')[0] || '';
|
|
18720
18827
|
let label = content;
|
|
18721
|
-
|
|
18828
|
+
let iconName = 'ExternalLink'; // Import remote
|
|
18722
18829
|
try {
|
|
18723
18830
|
if (content.startsWith('http://') || content.startsWith('https://')) {
|
|
18724
18831
|
const url = new URL(content);
|
|
18725
18832
|
label = url.hostname.replace(/^www\./, '') + '.../' + url.pathname.split('/').pop();
|
|
18833
|
+
iconName = 'ExternalLink';
|
|
18726
18834
|
}
|
|
18727
18835
|
else if (content.startsWith('./') || content.startsWith('../') || content.startsWith('/')) {
|
|
18728
18836
|
label = content.split('/').pop() || content;
|
|
18837
|
+
iconName = 'Link'; // Import local
|
|
18729
18838
|
}
|
|
18730
18839
|
}
|
|
18731
18840
|
catch (e) {
|
|
18732
18841
|
// Invalid URL or path, keep default label
|
|
18733
18842
|
}
|
|
18734
18843
|
capabilities.push({
|
|
18735
|
-
type: '
|
|
18844
|
+
type: 'import',
|
|
18736
18845
|
label,
|
|
18737
18846
|
iconName,
|
|
18847
|
+
agentUrl: content,
|
|
18738
18848
|
});
|
|
18739
18849
|
continue;
|
|
18740
18850
|
}
|