@promptbook/remote-server 0.85.0-10 → 0.85.0-12

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.
@@ -6,7 +6,7 @@ import type { PipelineCollection } from '../PipelineCollection';
6
6
  /**
7
7
  * Options for `createCollectionFromDirectory` function
8
8
  *
9
- * Note: `rootDirname` is not needed because it is the folder in which `.book.md` file is located
9
+ * Note: `rootDirname` is not needed because it is the folder in which `.book` or `.book.md` file is located
10
10
  * This is not same as `path` which is the first argument of `createCollectionFromDirectory` - it can be a subfolder
11
11
  */
12
12
  type CreatePipelineCollectionFromDirectoryOptions = Omit<PrepareAndScrapeOptions, 'rootDirname'> & {
@@ -51,13 +51,13 @@ type CreatePipelineCollectionFromDirectoryOptions = Omit<PrepareAndScrapeOptions
51
51
  *
52
52
  * Note: Works only in Node.js environment because it reads the file system
53
53
  *
54
- * @param path - path to the directory with pipelines
54
+ * @param rootPath - path to the directory with pipelines
55
55
  * @param tools - Execution tools to be used for pipeline preparation if needed - If not provided, `$provideExecutionToolsForNode` will be used
56
56
  * @param options - Options for the collection creation
57
57
  * @returns PipelineCollection
58
58
  * @public exported from `@promptbook/node`
59
59
  */
60
- export declare function createCollectionFromDirectory(path: string_dirname, tools?: Pick<ExecutionTools, 'llm' | 'fs' | 'scrapers'>, options?: CreatePipelineCollectionFromDirectoryOptions): Promise<PipelineCollection>;
60
+ export declare function createCollectionFromDirectory(rootPath: string_dirname, tools?: Pick<ExecutionTools, 'llm' | 'fs' | 'scrapers'>, options?: CreatePipelineCollectionFromDirectoryOptions): Promise<PipelineCollection>;
61
61
  export {};
62
62
  /**
63
63
  * TODO: [🖇] What about symlinks? Maybe option isSymlinksFollowed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/remote-server",
3
- "version": "0.85.0-10",
3
+ "version": "0.85.0-12",
4
4
  "description": "It's time for a paradigm shift. The future of software in plain English, French or Latin",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -47,7 +47,7 @@
47
47
  "module": "./esm/index.es.js",
48
48
  "typings": "./esm/typings/src/_packages/remote-server.index.d.ts",
49
49
  "peerDependencies": {
50
- "@promptbook/core": "0.85.0-10"
50
+ "@promptbook/core": "0.85.0-12"
51
51
  },
52
52
  "dependencies": {
53
53
  "colors": "1.4.0",
package/umd/index.umd.js CHANGED
@@ -28,7 +28,7 @@
28
28
  * @generated
29
29
  * @see https://github.com/webgptorg/promptbook
30
30
  */
31
- var PROMPTBOOK_ENGINE_VERSION = '0.85.0-9';
31
+ var PROMPTBOOK_ENGINE_VERSION = '0.85.0-11';
32
32
  /**
33
33
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
34
34
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -1488,57 +1488,6 @@
1488
1488
  return true;
1489
1489
  }
1490
1490
 
1491
- /**
1492
- * Checks if an URL is reserved for private networks or localhost.
1493
- *
1494
- * Note: There are two simmilar functions:
1495
- * - `isUrlOnPrivateNetwork` which tests full URL
1496
- * - `isHostnameOnPrivateNetwork` *(this one)* which tests just hostname
1497
- *
1498
- * @public exported from `@promptbook/utils`
1499
- */
1500
- function isHostnameOnPrivateNetwork(hostname) {
1501
- if (hostname === 'example.com' ||
1502
- hostname === 'localhost' ||
1503
- hostname.endsWith('.localhost') ||
1504
- hostname.endsWith('.local') ||
1505
- hostname.endsWith('.test') ||
1506
- hostname === '127.0.0.1' ||
1507
- hostname === '::1') {
1508
- return true;
1509
- }
1510
- if (hostname.includes(':')) {
1511
- // IPv6
1512
- var ipParts = hostname.split(':');
1513
- return ipParts[0] === 'fc00' || ipParts[0] === 'fd00' || ipParts[0] === 'fe80';
1514
- }
1515
- else {
1516
- // IPv4
1517
- var ipParts = hostname.split('.').map(function (part) { return Number.parseInt(part, 10); });
1518
- return (ipParts[0] === 10 ||
1519
- (ipParts[0] === 172 && ipParts[1] >= 16 && ipParts[1] <= 31) ||
1520
- (ipParts[0] === 192 && ipParts[1] === 168));
1521
- }
1522
- }
1523
-
1524
- /**
1525
- * Checks if an IP address or hostname is reserved for private networks or localhost.
1526
- *
1527
- * Note: There are two simmilar functions:
1528
- * - `isUrlOnPrivateNetwork` *(this one)* which tests full URL
1529
- * - `isHostnameOnPrivateNetwork` which tests just hostname
1530
- *
1531
- * @param {string} ipAddress - The IP address to check.
1532
- * @returns {boolean} Returns true if the IP address is reserved for private networks or localhost, otherwise false.
1533
- * @public exported from `@promptbook/utils`
1534
- */
1535
- function isUrlOnPrivateNetwork(url) {
1536
- if (typeof url === 'string') {
1537
- url = new URL(url);
1538
- }
1539
- return isHostnameOnPrivateNetwork(url.hostname);
1540
- }
1541
-
1542
1491
  /**
1543
1492
  * Tests if given string is valid URL.
1544
1493
  *
@@ -1581,16 +1530,19 @@
1581
1530
  if (!isValidUrl(url)) {
1582
1531
  return false;
1583
1532
  }
1584
- if (!url.startsWith('https://')) {
1533
+ if (!url.startsWith('https://') && !url.startsWith('http://') /* <- Note: [👣] */) {
1585
1534
  return false;
1586
1535
  }
1587
1536
  if (url.includes('#')) {
1588
1537
  // TODO: [🐠]
1589
1538
  return false;
1590
1539
  }
1540
+ /*
1541
+ Note: [👣][🧠] Is it secure to allow pipeline URLs on private and unsecured networks?
1591
1542
  if (isUrlOnPrivateNetwork(url)) {
1592
1543
  return false;
1593
1544
  }
1545
+ */
1594
1546
  return true;
1595
1547
  }
1596
1548
  /**