@promptbook/browser 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 +164 -8
- 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 +164 -7
- package/umd/index.umd.js.map +1 -1
package/README.md
CHANGED
|
@@ -100,19 +100,20 @@ Rest of the documentation is common for **entire promptbook ecosystem**:
|
|
|
100
100
|
|
|
101
101
|
## 📖 The Book Whitepaper
|
|
102
102
|
|
|
103
|
-
|
|
103
|
+
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.
|
|
104
104
|
|
|
105
|
-
The main challenge
|
|
105
|
+
The main challenge lies in **managing the context**, providing rules and knowledge, and narrowing the personality.
|
|
106
106
|
|
|
107
|
-
Promptbook
|
|
107
|
+
In Promptbook, you can define your context **using simple Books** that are very explicit, easy to understand and write, reliable, and highly portable.
|
|
108
108
|
|
|
109
109
|
<table style="border: 1px solid #777; border-radius: 10px;"><tr><td>
|
|
110
110
|
|
|
111
|
-
**<ins>Paul Smith
|
|
111
|
+
**<ins>Paul Smith</ins>**<br/>
|
|
112
112
|
<br/>
|
|
113
113
|
**PERSONA** You are a company lawyer.<br/>
|
|
114
114
|
Your job is to provide legal advice and support to the company and its employees.<br/>
|
|
115
|
-
You are knowledgeable, professional, and detail-oriented.<br/>
|
|
115
|
+
**RULE** You are knowledgeable, professional, and detail-oriented.<br/>
|
|
116
|
+
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/>
|
|
116
117
|
|
|
117
118
|
</td></tr></table>
|
|
118
119
|
|
|
@@ -122,7 +123,9 @@ You are knowledgeable, professional, and detail-oriented.<br/>
|
|
|
122
123
|
|
|
123
124
|
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.
|
|
124
125
|
|
|
125
|
-
You can look at it as prompting (or writing a system message), but decorated by **commitments**.
|
|
126
|
+
You can look at it as "prompting" _(or writing a system message)_, but decorated by **commitments**.
|
|
127
|
+
|
|
128
|
+
**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.
|
|
126
129
|
|
|
127
130
|
#### `Persona` commitment
|
|
128
131
|
|
|
@@ -133,8 +136,6 @@ Personas define the character of your AI persona, its role, and how it should in
|
|
|
133
136
|
**<ins>Paul Smith & Associés</ins>**<br/>
|
|
134
137
|
<br/>
|
|
135
138
|
**PERSONA** You are a company lawyer.<br/>
|
|
136
|
-
Your job is to provide legal advice and support to the company and its employees.<br/>
|
|
137
|
-
You are knowledgeable, professional, and detail-oriented.<br/>
|
|
138
139
|
|
|
139
140
|
</td></tr></table>
|
|
140
141
|
|
|
@@ -154,7 +155,7 @@ Promptbook Engine will automatically enforce this knowledge during interactions.
|
|
|
154
155
|
Your job is to provide legal advice and support to the company and its employees.<br/>
|
|
155
156
|
You are knowledgeable, professional, and detail-oriented.<br/>
|
|
156
157
|
<br/>
|
|
157
|
-
**KNOWLEDGE**
|
|
158
|
+
**KNOWLEDGE** https://company.com/company-policies.pdf<br/>
|
|
158
159
|
**KNOWLEDGE** https://company.com/internal-documents/employee-handbook.docx<br/>
|
|
159
160
|
|
|
160
161
|
</td></tr></table>
|
|
@@ -176,14 +177,14 @@ You are knowledgeable, professional, and detail-oriented.<br/>
|
|
|
176
177
|
**RULE** Always ensure compliance with laws and regulations.<br/>
|
|
177
178
|
**RULE** Never provide legal advice outside your area of expertise.<br/>
|
|
178
179
|
**RULE** Never provide legal advice about criminal law.<br/>
|
|
179
|
-
**KNOWLEDGE**
|
|
180
|
+
**KNOWLEDGE** https://company.com/company-policies.pdf<br/>
|
|
180
181
|
**KNOWLEDGE** https://company.com/internal-documents/employee-handbook.docx<br/>
|
|
181
182
|
|
|
182
183
|
</td></tr></table>
|
|
183
184
|
|
|
184
|
-
#### `
|
|
185
|
+
#### `Team` commitment
|
|
185
186
|
|
|
186
|
-
|
|
187
|
+
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.
|
|
187
188
|
|
|
188
189
|
<table style="border: 1px solid #777; border-radius: 10px;"><tr><td>
|
|
189
190
|
|
|
@@ -196,81 +197,36 @@ You are knowledgeable, professional, and detail-oriented.<br/>
|
|
|
196
197
|
**RULE** Always ensure compliance with laws and regulations.<br/>
|
|
197
198
|
**RULE** Never provide legal advice outside your area of expertise.<br/>
|
|
198
199
|
**RULE** Never provide legal advice about criminal law.<br/>
|
|
199
|
-
**KNOWLEDGE**
|
|
200
|
+
**KNOWLEDGE** https://company.com/company-policies.pdf<br/>
|
|
200
201
|
**KNOWLEDGE** https://company.com/internal-documents/employee-handbook.docx<br/>
|
|
201
|
-
|
|
202
|
+
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/>
|
|
202
203
|
|
|
203
204
|
</td></tr></table>
|
|
204
205
|
|
|
205
|
-
[Read more about the language](./BLUEPRINT.md)
|
|
206
|
-
|
|
207
|
-
<div style="page-break-after: always;"></div>
|
|
208
|
-
|
|
209
|
-
### Where to use your AI agent in book
|
|
210
|
-
|
|
211
|
-
Books can be useful in various applications and scenarios. Here are some examples:
|
|
212
|
-
|
|
213
|
-
#### Chat apps:
|
|
214
206
|
|
|
215
|
-
Create your own chat shopping assistant and place it in your eShop.
|
|
216
|
-
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.
|
|
217
207
|
|
|
218
|
-
|
|
208
|
+
### Promptbook Ecosystem
|
|
219
209
|
|
|
220
|
-
|
|
210
|
+
!!!@@@
|
|
221
211
|
|
|
222
|
-
####
|
|
223
|
-
|
|
224
|
-
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.
|
|
225
|
-
|
|
226
|
-
This can be integrated to almost any Vibecoding platform, like GitHub Copilot, Amazon CodeWhisperer, Cursor, Cline, Kilocode, Roocode,...
|
|
227
|
-
|
|
228
|
-
They will work the same as you are used to, but with your specific rules written in book.
|
|
229
|
-
|
|
230
|
-
#### Internal Expertise
|
|
231
|
-
|
|
232
|
-
Do you have an app written in TypeScript, Python, C#, Java, or any other language, and you are integrating the AI.
|
|
233
|
-
|
|
234
|
-
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.
|
|
235
|
-
|
|
236
|
-
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.
|
|
237
|
-
|
|
238
|
-
Even works in no-code platforms!
|
|
239
|
-
|
|
240
|
-
<div style="page-break-after: always;"></div>
|
|
212
|
+
#### Promptbook Server
|
|
241
213
|
|
|
242
|
-
|
|
214
|
+
!!!@@@
|
|
243
215
|
|
|
244
|
-
|
|
216
|
+
#### Promptbook Engine
|
|
245
217
|
|
|
246
|
-
|
|
218
|
+
!!!@@@
|
|
247
219
|
|
|
248
|
-
We have written ai asistant in book who can help you with writing your first book.
|
|
249
220
|
|
|
250
|
-
#### Your AI twin
|
|
251
221
|
|
|
252
|
-
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.
|
|
253
222
|
|
|
254
|
-
#### AI persona workpool
|
|
255
223
|
|
|
256
|
-
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.
|
|
257
224
|
|
|
258
225
|
|
|
259
226
|
|
|
260
227
|
|
|
261
228
|
|
|
262
229
|
|
|
263
|
-
## 🚀 Get started
|
|
264
|
-
|
|
265
|
-
Take a look at the simple starter kit with books integrated into the **Hello World** sample applications:
|
|
266
|
-
|
|
267
|
-
- [Hello Book](https://github.com/webgptorg/hello-world)
|
|
268
|
-
- [Hello Book in Node.js](https://github.com/webgptorg/hello-world-node-js)
|
|
269
|
-
- [Hello Book in Next.js](https://github.com/webgptorg/hello-world-next-js)
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
230
|
|
|
275
231
|
|
|
276
232
|
## 💜 The Promptbook Project
|
|
@@ -286,33 +242,32 @@ Promptbook project is ecosystem of multiple projects and tools, following is a l
|
|
|
286
242
|
</thead>
|
|
287
243
|
<tbody>
|
|
288
244
|
<tr>
|
|
289
|
-
<td><a href="https://
|
|
245
|
+
<td><a href="https://gallery.ptbk.io/">Agents Server</a></td>
|
|
290
246
|
<td>
|
|
291
|
-
|
|
292
|
-
<hr>
|
|
293
|
-
There is also <a href="https://github.com/webgptorg/book-extension">a plugin for VSCode</a> to support <code>.book</code> file extension
|
|
247
|
+
Place where you "AI agents live". It allows to create, manage, deploy, and interact with AI agents created in Book language.
|
|
294
248
|
</td>
|
|
295
249
|
</tr>
|
|
296
250
|
<tr>
|
|
297
|
-
<td><a href="https://github.com/webgptorg/
|
|
251
|
+
<td><a href="https://github.com/webgptorg/book">Book language</a></td>
|
|
298
252
|
<td>
|
|
299
|
-
|
|
253
|
+
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.
|
|
254
|
+
<hr>
|
|
255
|
+
There is also <a href="https://github.com/webgptorg/book-extension">a plugin for VSCode</a> to support <code>.book</code> file extension
|
|
300
256
|
</td>
|
|
301
257
|
</tr>
|
|
302
258
|
<tr>
|
|
303
|
-
<td><a href="https://promptbook
|
|
259
|
+
<td><a href="https://github.com/webgptorg/promptbook">Promptbook Engine</a></td>
|
|
304
260
|
<td>
|
|
305
|
-
Promptbook
|
|
261
|
+
Promptbook engine can run AI agents based on Book language.
|
|
262
|
+
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>
|
|
263
|
+
Agent Server is based on Promptbook Engine.
|
|
306
264
|
</td>
|
|
307
265
|
</tr>
|
|
266
|
+
|
|
308
267
|
</tbody>
|
|
309
268
|
</table>
|
|
310
269
|
|
|
311
|
-
Hello world examples:
|
|
312
270
|
|
|
313
|
-
- [Hello world](https://github.com/webgptorg/hello-world)
|
|
314
|
-
- [Hello world in Node.js](https://github.com/webgptorg/hello-world-node-js)
|
|
315
|
-
- [Hello world in Next.js](https://github.com/webgptorg/hello-world-next-js)
|
|
316
271
|
|
|
317
272
|
### 🌐 Community & Social Media
|
|
318
273
|
|
|
@@ -370,6 +325,8 @@ Join our growing community of developers and users:
|
|
|
370
325
|
|
|
371
326
|
|
|
372
327
|
|
|
328
|
+
|
|
329
|
+
|
|
373
330
|
## 📚 Documentation
|
|
374
331
|
|
|
375
332
|
See detailed guides and API reference in the [docs](https://github.com/webgptorg/promptbook/discussions/categories/concepts) or [online](https://discord.gg/x3QWNaa89N).
|
|
@@ -446,6 +403,8 @@ The following glossary is used to clarify certain concepts:
|
|
|
446
403
|
|
|
447
404
|
_Note: This section is not a complete dictionary, more list of general AI / LLM terms that has connection with Promptbook_
|
|
448
405
|
|
|
406
|
+
|
|
407
|
+
|
|
449
408
|
### 💯 Core concepts
|
|
450
409
|
|
|
451
410
|
- [📚 Collection of pipelines](https://github.com/webgptorg/promptbook/discussions/65)
|
package/esm/index.es.js
CHANGED
|
@@ -19,7 +19,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
19
19
|
* @generated
|
|
20
20
|
* @see https://github.com/webgptorg/promptbook
|
|
21
21
|
*/
|
|
22
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.105.0-
|
|
22
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.105.0-5';
|
|
23
23
|
/**
|
|
24
24
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
25
25
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -1406,6 +1406,104 @@ async function $provideScrapersForBrowser(tools, options) {
|
|
|
1406
1406
|
return scrapers;
|
|
1407
1407
|
}
|
|
1408
1408
|
|
|
1409
|
+
/**
|
|
1410
|
+
* Speech recognition using Web Speech API `SpeechRecognition` available in modern browsers
|
|
1411
|
+
*
|
|
1412
|
+
* @public exported from `@promptbook/browser`
|
|
1413
|
+
*/
|
|
1414
|
+
class BrowserSpeechRecognition {
|
|
1415
|
+
get state() {
|
|
1416
|
+
return this._state;
|
|
1417
|
+
}
|
|
1418
|
+
constructor() {
|
|
1419
|
+
this.recognition = null;
|
|
1420
|
+
this.callbacks = [];
|
|
1421
|
+
this._state = 'IDLE';
|
|
1422
|
+
if (typeof window !== 'undefined') {
|
|
1423
|
+
const SpeechRecognitionValue = window.SpeechRecognition ||
|
|
1424
|
+
window /* <- TODO: !!!! Make special windowAny */.webkitSpeechRecognition;
|
|
1425
|
+
if (SpeechRecognitionValue) {
|
|
1426
|
+
this.recognition = new SpeechRecognitionValue();
|
|
1427
|
+
this.recognition.continuous = true;
|
|
1428
|
+
this.recognition.interimResults = true;
|
|
1429
|
+
this.recognition.onstart = () => {
|
|
1430
|
+
this._state = 'RECORDING';
|
|
1431
|
+
this.emit({ type: 'START' });
|
|
1432
|
+
};
|
|
1433
|
+
this.recognition.onresult = (event) => {
|
|
1434
|
+
let finalTranscript = '';
|
|
1435
|
+
let interimTranscript = '';
|
|
1436
|
+
for (let i = event.resultIndex; i < event.results.length; ++i) {
|
|
1437
|
+
if (event.results[i].isFinal) {
|
|
1438
|
+
finalTranscript += event.results[i][0].transcript;
|
|
1439
|
+
}
|
|
1440
|
+
else {
|
|
1441
|
+
interimTranscript += event.results[i][0].transcript;
|
|
1442
|
+
}
|
|
1443
|
+
}
|
|
1444
|
+
const text = (finalTranscript + interimTranscript).trim();
|
|
1445
|
+
if (text) {
|
|
1446
|
+
this.emit({
|
|
1447
|
+
type: 'RESULT',
|
|
1448
|
+
text,
|
|
1449
|
+
isFinal: interimTranscript === '',
|
|
1450
|
+
});
|
|
1451
|
+
}
|
|
1452
|
+
};
|
|
1453
|
+
this.recognition.onerror = (event) => {
|
|
1454
|
+
this._state = 'ERROR';
|
|
1455
|
+
this.emit({ type: 'ERROR', message: event.error || 'Unknown error' });
|
|
1456
|
+
};
|
|
1457
|
+
this.recognition.onend = () => {
|
|
1458
|
+
this._state = 'IDLE';
|
|
1459
|
+
this.emit({ type: 'STOP' });
|
|
1460
|
+
};
|
|
1461
|
+
}
|
|
1462
|
+
}
|
|
1463
|
+
}
|
|
1464
|
+
$start(options = {}) {
|
|
1465
|
+
var _a;
|
|
1466
|
+
if (!this.recognition) {
|
|
1467
|
+
this.emit({ type: 'ERROR', message: 'Speech recognition is not supported in this browser.' });
|
|
1468
|
+
return;
|
|
1469
|
+
}
|
|
1470
|
+
if (this._state !== 'IDLE') {
|
|
1471
|
+
return;
|
|
1472
|
+
}
|
|
1473
|
+
this._state = 'STARTING';
|
|
1474
|
+
this.recognition.lang = options.language || 'en'; // Note: Web Speech API usually accepts ISO-639-1 or BCP-47
|
|
1475
|
+
this.recognition.interimResults = (_a = options.interimResults) !== null && _a !== void 0 ? _a : true;
|
|
1476
|
+
try {
|
|
1477
|
+
this.recognition.start();
|
|
1478
|
+
}
|
|
1479
|
+
catch (error) {
|
|
1480
|
+
this._state = 'ERROR';
|
|
1481
|
+
this.emit({ type: 'ERROR', message: error.message });
|
|
1482
|
+
}
|
|
1483
|
+
}
|
|
1484
|
+
$stop() {
|
|
1485
|
+
if (!this.recognition || this._state === 'IDLE') {
|
|
1486
|
+
return;
|
|
1487
|
+
}
|
|
1488
|
+
this.recognition.stop();
|
|
1489
|
+
}
|
|
1490
|
+
subscribe(callback) {
|
|
1491
|
+
this.callbacks.push(callback);
|
|
1492
|
+
return () => {
|
|
1493
|
+
this.callbacks = this.callbacks.filter((cb) => cb !== callback);
|
|
1494
|
+
};
|
|
1495
|
+
}
|
|
1496
|
+
emit(event) {
|
|
1497
|
+
for (const callback of this.callbacks) {
|
|
1498
|
+
callback(event);
|
|
1499
|
+
}
|
|
1500
|
+
}
|
|
1501
|
+
}
|
|
1502
|
+
/**
|
|
1503
|
+
* TODO: !!!! Search ACRY for `window` and put -> [🔵]
|
|
1504
|
+
* Note: [🔵] Code in this file should never be published outside of `@promptbook/browser`
|
|
1505
|
+
*/
|
|
1506
|
+
|
|
1409
1507
|
/**
|
|
1410
1508
|
* Creates a PromptbookStorage backed by IndexedDB.
|
|
1411
1509
|
* Uses a single object store named 'promptbook'.
|
|
@@ -6148,7 +6246,12 @@ class UseTimeCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
6148
6246
|
description: 'Get the current date and time in ISO 8601 format.',
|
|
6149
6247
|
parameters: {
|
|
6150
6248
|
type: 'object',
|
|
6151
|
-
properties: {
|
|
6249
|
+
properties: {
|
|
6250
|
+
timezone: {
|
|
6251
|
+
type: 'string',
|
|
6252
|
+
description: 'Optional timezone name (e.g. "Europe/Prague", "UTC", "America/New_York").',
|
|
6253
|
+
},
|
|
6254
|
+
},
|
|
6152
6255
|
required: [],
|
|
6153
6256
|
},
|
|
6154
6257
|
},
|
|
@@ -6168,9 +6271,36 @@ class UseTimeCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
6168
6271
|
*/
|
|
6169
6272
|
getToolFunctions() {
|
|
6170
6273
|
return {
|
|
6171
|
-
async get_current_time() {
|
|
6172
|
-
|
|
6173
|
-
|
|
6274
|
+
async get_current_time(args) {
|
|
6275
|
+
var _a;
|
|
6276
|
+
console.log('!!!! [Tool] get_current_time called', { args });
|
|
6277
|
+
const { timezone } = args;
|
|
6278
|
+
if (!timezone) {
|
|
6279
|
+
return new Date().toISOString();
|
|
6280
|
+
}
|
|
6281
|
+
try {
|
|
6282
|
+
// Note: Returning ISO 8601 string but in the requested timezone
|
|
6283
|
+
const formatter = new Intl.DateTimeFormat('en-CA', {
|
|
6284
|
+
timeZone: timezone,
|
|
6285
|
+
year: 'numeric',
|
|
6286
|
+
month: '2-digit',
|
|
6287
|
+
day: '2-digit',
|
|
6288
|
+
hour: '2-digit',
|
|
6289
|
+
minute: '2-digit',
|
|
6290
|
+
second: '2-digit',
|
|
6291
|
+
hour12: false,
|
|
6292
|
+
timeZoneName: 'shortOffset',
|
|
6293
|
+
});
|
|
6294
|
+
const parts = formatter.formatToParts(new Date());
|
|
6295
|
+
const part = (type) => { var _a; return (_a = parts.find((p) => p.type === type)) === null || _a === void 0 ? void 0 : _a.value; };
|
|
6296
|
+
// en-CA format is YYYY-MM-DD
|
|
6297
|
+
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', '')}`;
|
|
6298
|
+
return isoString;
|
|
6299
|
+
}
|
|
6300
|
+
catch (error) {
|
|
6301
|
+
// Fallback to UTC if timezone is invalid
|
|
6302
|
+
return new Date().toISOString();
|
|
6303
|
+
}
|
|
6174
6304
|
},
|
|
6175
6305
|
};
|
|
6176
6306
|
}
|
|
@@ -6645,26 +6775,52 @@ function parseAgentSource(agentSource) {
|
|
|
6645
6775
|
});
|
|
6646
6776
|
continue;
|
|
6647
6777
|
}
|
|
6778
|
+
if (commitment.type === 'FROM') {
|
|
6779
|
+
const content = spaceTrim$2(commitment.content).split('\n')[0] || '';
|
|
6780
|
+
if (content === 'Adam' || content === '' /* <- Note: Adam is implicit */) {
|
|
6781
|
+
continue;
|
|
6782
|
+
}
|
|
6783
|
+
let label = content;
|
|
6784
|
+
let iconName = 'SquareArrowOutUpRight'; // Inheritance remote
|
|
6785
|
+
if (content.startsWith('./') || content.startsWith('../') || content.startsWith('/')) {
|
|
6786
|
+
label = content.split('/').pop() || content;
|
|
6787
|
+
iconName = 'SquareArrowUpRight'; // Inheritance local
|
|
6788
|
+
}
|
|
6789
|
+
if (content === 'VOID') {
|
|
6790
|
+
label = 'VOID';
|
|
6791
|
+
iconName = 'ShieldAlert'; // [🧠] Or some other icon for VOID
|
|
6792
|
+
}
|
|
6793
|
+
capabilities.push({
|
|
6794
|
+
type: 'inheritance',
|
|
6795
|
+
label,
|
|
6796
|
+
iconName,
|
|
6797
|
+
agentUrl: content,
|
|
6798
|
+
});
|
|
6799
|
+
continue;
|
|
6800
|
+
}
|
|
6648
6801
|
if (commitment.type === 'IMPORT') {
|
|
6649
6802
|
const content = spaceTrim$2(commitment.content).split('\n')[0] || '';
|
|
6650
6803
|
let label = content;
|
|
6651
|
-
|
|
6804
|
+
let iconName = 'ExternalLink'; // Import remote
|
|
6652
6805
|
try {
|
|
6653
6806
|
if (content.startsWith('http://') || content.startsWith('https://')) {
|
|
6654
6807
|
const url = new URL(content);
|
|
6655
6808
|
label = url.hostname.replace(/^www\./, '') + '.../' + url.pathname.split('/').pop();
|
|
6809
|
+
iconName = 'ExternalLink';
|
|
6656
6810
|
}
|
|
6657
6811
|
else if (content.startsWith('./') || content.startsWith('../') || content.startsWith('/')) {
|
|
6658
6812
|
label = content.split('/').pop() || content;
|
|
6813
|
+
iconName = 'Link'; // Import local
|
|
6659
6814
|
}
|
|
6660
6815
|
}
|
|
6661
6816
|
catch (e) {
|
|
6662
6817
|
// Invalid URL or path, keep default label
|
|
6663
6818
|
}
|
|
6664
6819
|
capabilities.push({
|
|
6665
|
-
type: '
|
|
6820
|
+
type: 'import',
|
|
6666
6821
|
label,
|
|
6667
6822
|
iconName,
|
|
6823
|
+
agentUrl: content,
|
|
6668
6824
|
});
|
|
6669
6825
|
continue;
|
|
6670
6826
|
}
|
|
@@ -6890,5 +7046,5 @@ async function $induceBookDownload(book) {
|
|
|
6890
7046
|
* Note: [🔵] Code in this file should never be published outside of `@promptbook/browser`
|
|
6891
7047
|
*/
|
|
6892
7048
|
|
|
6893
|
-
export { $induceBookDownload, $induceFileDownload, $provideScrapersForBrowser, BOOK_LANGUAGE_VERSION, ObjectUrl, PROMPTBOOK_ENGINE_VERSION, SimplePromptInterfaceTools, getIndexedDbStorage, getLocalStorage, getSessionStorage };
|
|
7049
|
+
export { $induceBookDownload, $induceFileDownload, $provideScrapersForBrowser, BOOK_LANGUAGE_VERSION, BrowserSpeechRecognition, ObjectUrl, PROMPTBOOK_ENGINE_VERSION, SimplePromptInterfaceTools, getIndexedDbStorage, getLocalStorage, getSessionStorage };
|
|
6894
7050
|
//# sourceMappingURL=index.es.js.map
|