@promptbook/cli 0.84.0-16 โ†’ 0.84.0-17

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 CHANGED
@@ -16,7 +16,7 @@
16
16
 
17
17
  ## ๐ŸŒŸ New Features
18
18
 
19
- - ๐Ÿ‹ **Support of [DeepSeek models](https://www.deepseek.com/)**
19
+ - ๐Ÿ‹ **Support of [DeepSeek models](https://www.npmjs.com/package/@promptbook/deepseek)**
20
20
  - ๐Ÿ’™ Working [the **Book** language v1.0.0](https://github.com/webgptorg/book)
21
21
  - ๐Ÿ–ค Run books from CLI - `npx ptbk run path/to/your/book`
22
22
  - ๐Ÿ“š Support of `.docx`, `.doc` and `.pdf` documents as knowledge
@@ -492,6 +492,12 @@ See [TODO.md](./TODO.md)
492
492
 
493
493
 
494
494
 
495
+
496
+ ## ๐Ÿค Partners
497
+
498
+ [![Technology Incubation](./other/partners/CI-Technology-Incubation.png)](https://technologickainkubace.org/en/about-technology-incubation/about-the-project/)
499
+
500
+
495
501
  ## ๐Ÿ–‹๏ธ Contributing
496
502
 
497
503
  I am open to pull requests, feedback, and suggestions. Or if you like this utility, you can [โ˜• buy me a coffee](https://www.buymeacoffee.com/hejny) or [donate via cryptocurrencies](https://github.com/hejny/hejny/blob/main/documents/crypto.md).
package/esm/index.es.js CHANGED
@@ -38,7 +38,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
38
38
  * @generated
39
39
  * @see https://github.com/webgptorg/promptbook
40
40
  */
41
- var PROMPTBOOK_ENGINE_VERSION = '0.84.0-15';
41
+ var PROMPTBOOK_ENGINE_VERSION = '0.84.0-16';
42
42
  /**
43
43
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
44
44
  * Note: [๐Ÿ’ž] Ignore a discrepancy between file name and entity name
@@ -235,6 +235,12 @@ var DEFAULT_TASK_TITLE = "Task";
235
235
  * @public exported from `@promptbook/core`
236
236
  */
237
237
  var DEFAULT_BOOK_OUTPUT_PARAMETER_NAME = 'result';
238
+ /**
239
+ * Maximum file size limit
240
+ *
241
+ * @public exported from `@promptbook/core`
242
+ */
243
+ var DEFAULT_MAX_FILE_SIZE = 100 * 1024 * 1024; // 100MB
238
244
  /**
239
245
  * Warning message for the generated sections and files files
240
246
  *
@@ -6527,11 +6533,10 @@ var scraperFetch = function (url, init) { return __awaiter(void 0, void 0, void
6527
6533
  function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
6528
6534
  var _a;
6529
6535
  return __awaiter(this, void 0, void 0, function () {
6530
- var _b, fetch, knowledgeSourceContent, name, _c, _d, rootDirname, url, response_1, mimeType, basename, hash, rootDirname_1, filepath, _f, _g, _h, _j, _k, filename_1, fileExtension, mimeType;
6531
- return __generator(this, function (_l) {
6532
- switch (_l.label) {
6536
+ var _b, fetch, knowledgeSourceContent, name, _c, _d, rootDirname, url, response_1, mimeType, basename, hash, rootDirname_1, filepath, fileContent, _f, _g, filename_1, fileExtension, mimeType;
6537
+ return __generator(this, function (_h) {
6538
+ switch (_h.label) {
6533
6539
  case 0:
6534
- console.log('!!! makeKnowledgeSourceHandler', knowledgeSource);
6535
6540
  _b = tools.fetch, fetch = _b === void 0 ? scraperFetch : _b;
6536
6541
  knowledgeSourceContent = knowledgeSource.knowledgeSourceContent;
6537
6542
  name = knowledgeSource.name;
@@ -6543,7 +6548,7 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
6543
6548
  url = knowledgeSourceContent;
6544
6549
  return [4 /*yield*/, fetch(url)];
6545
6550
  case 1:
6546
- response_1 = _l.sent();
6551
+ response_1 = _h.sent();
6547
6552
  mimeType = ((_a = response_1.headers.get('content-type')) === null || _a === void 0 ? void 0 : _a.split(';')[0]) || 'text/html';
6548
6553
  if (tools.fs === undefined || !url.endsWith('.pdf' /* <- TODO: [๐Ÿ’ต] */)) {
6549
6554
  return [2 /*return*/, {
@@ -6593,17 +6598,19 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
6593
6598
  filepath = join.apply(void 0, __spreadArray(__spreadArray([], __read(nameToSubfolderPath(hash /* <- TODO: [๐ŸŽŽ] Maybe add some SHA256 prefix */)), false), ["".concat(basename.substring(0, MAX_FILENAME_LENGTH), ".").concat(mimeTypeToExtension(mimeType))], false));
6594
6599
  return [4 /*yield*/, tools.fs.mkdir(dirname(join(rootDirname_1, filepath)), { recursive: true })];
6595
6600
  case 2:
6596
- _l.sent();
6597
- _g = (_f = tools.fs).writeFile;
6598
- _h = [join(rootDirname_1, filepath)];
6599
- _k = (_j = Buffer).from;
6601
+ _h.sent();
6602
+ _g = (_f = Buffer).from;
6600
6603
  return [4 /*yield*/, response_1.arrayBuffer()];
6601
- case 3: return [4 /*yield*/, _g.apply(_f, _h.concat([_k.apply(_j, [_l.sent()])]))];
6604
+ case 3:
6605
+ fileContent = _g.apply(_f, [_h.sent()]);
6606
+ if (fileContent.length > DEFAULT_MAX_FILE_SIZE /* <- TODO: Allow to pass different value to remote server */) {
6607
+ throw new LimitReachedError("File is too large (".concat(Math.round(fileContent.length / 1024 / 1024), "MB). Maximum allowed size is ").concat(Math.round(DEFAULT_MAX_FILE_SIZE / 1024 / 1024), "MB."));
6608
+ }
6609
+ return [4 /*yield*/, tools.fs.writeFile(join(rootDirname_1, filepath), fileContent)];
6602
6610
  case 4:
6603
- _l.sent();
6611
+ _h.sent();
6604
6612
  // TODO: [๐Ÿ’ต] Check the file security
6605
- // TODO: !!!!!!!! Check the file size (if it is not too big)
6606
- // TODO: !!!!!!!! Delete the file after the scraping is done
6613
+ // TODO: [๐Ÿงน][๐Ÿง ] Delete the file after the scraping is done
6607
6614
  return [2 /*return*/, makeKnowledgeSourceHandler({ name: name, knowledgeSourceContent: filepath }, tools, __assign(__assign({}, options), { rootDirname: rootDirname_1 }))];
6608
6615
  case 5:
6609
6616
  if (!isValidFilePath(knowledgeSourceContent)) return [3 /*break*/, 7];
@@ -6620,7 +6627,7 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
6620
6627
  mimeType = extensionToMimeType(fileExtension || '');
6621
6628
  return [4 /*yield*/, isFileExisting(filename_1, tools.fs)];
6622
6629
  case 6:
6623
- if (!(_l.sent())) {
6630
+ if (!(_h.sent())) {
6624
6631
  throw new NotFoundError(spaceTrim(function (block) { return "\n Can not make source handler for file which does not exist:\n\n File:\n ".concat(block(knowledgeSourceContent), "\n\n Full file path:\n ").concat(block(filename_1), "\n "); }));
6625
6632
  }
6626
6633
  // TODO: [๐Ÿง ][๐Ÿ˜ฟ] Test security file - file is scoped to the project (BUT maybe do this in `filesystemTools`)
@@ -15286,7 +15293,7 @@ var createDeepseekExecutionTools = Object.assign(function (options) {
15286
15293
  // TODO: [๐Ÿ•˜] Maybe list models in same way as in other providers - in separate file with metadata
15287
15294
  'deepseek-chat',
15288
15295
  'deepseek-reasoner',
15289
- // <- TODO: !!!!!! Picking of default model
15296
+ // <- TODO: How picking of the default model looks like in `createExecutionToolsFromVercelProvider`
15290
15297
  ].map(function (modelName) { return ({ modelName: modelName, modelVariant: 'CHAT' }); }) }, options));
15291
15298
  }, {
15292
15299
  packageName: '@promptbook/deepseek',
@@ -17112,7 +17119,7 @@ var MarkitdownScraper = /** @class */ (function () {
17112
17119
  // Note: Module `markitdown-ts` has no types available, so it is imported using `require`
17113
17120
  // eslint-disable-next-line @typescript-eslint/no-var-requires
17114
17121
  var MarkItDown = require('markitdown-ts').MarkItDown;
17115
- // <- TODO: 'Use Markitdown directly not through this package
17122
+ // <- TODO: [๐Ÿ€] Use Markitdown directly not through this package
17116
17123
  this.markitdown = new MarkItDown();
17117
17124
  }
17118
17125
  Object.defineProperty(MarkitdownScraper.prototype, "metadata", {
@@ -17157,7 +17164,7 @@ var MarkitdownScraper = /** @class */ (function () {
17157
17164
  case 2:
17158
17165
  if (!!(_f.sent())) return [3 /*break*/, 5];
17159
17166
  src = source.filename || source.url || null;
17160
- // console.log('!!!', { src, source, cacheFilehandler });
17167
+ // console.log('!!', { src, source, cacheFilehandler });
17161
17168
  if (src === null) {
17162
17169
  throw new UnexpectedError('Source has no filename or url');
17163
17170
  }
@@ -17170,12 +17177,12 @@ var MarkitdownScraper = /** @class */ (function () {
17170
17177
  result = _f.sent();
17171
17178
  if (result === null || result === undefined) {
17172
17179
  throw new Error("Markitdown could not convert the \"".concat(source.source, "\""));
17173
- // <- TODO: !!! Make MarkitdownError
17180
+ // <- TODO: [๐Ÿ€] Make MarkitdownError
17174
17181
  }
17175
- // console.log('!!!', { result, cacheFilehandler });
17182
+ // console.log('!!', { result, cacheFilehandler });
17176
17183
  return [4 /*yield*/, this.tools.fs.writeFile(cacheFilehandler.filename, result.text_content)];
17177
17184
  case 4:
17178
- // console.log('!!!', { result, cacheFilehandler });
17185
+ // console.log('!!', { result, cacheFilehandler });
17179
17186
  _f.sent();
17180
17187
  _f.label = 5;
17181
17188
  case 5: return [2 /*return*/, cacheFilehandler];