@promptbook/editable 0.85.0-9 → 0.86.0-2

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.
@@ -3,7 +3,7 @@ import type { FormfactorCommand } from './FormfactorCommand';
3
3
  /**
4
4
  * Parses the formfactor command
5
5
  *
6
- * Note: @@@ This command is used as formfactor for new commands - it should NOT be used in any `.book.md` file
6
+ * Note: @@@ This command is used as formfactor for new commands - it should NOT be used in any `.book` file
7
7
  *
8
8
  * @see `documentationUrl` for more details
9
9
  * @public exported from `@promptbook/editable`
@@ -3,7 +3,7 @@ import type { BoilerplateCommand } from './BoilerplateCommand';
3
3
  /**
4
4
  * Parses the boilerplate command
5
5
  *
6
- * Note: @@@ This command is used as boilerplate for new commands - it should NOT be used in any `.book.md` file
6
+ * Note: @@@ This command is used as boilerplate for new commands - it should NOT be used in any `.book` file
7
7
  *
8
8
  * @see `documentationUrl` for more details
9
9
  * @private within the commands folder
@@ -2,7 +2,7 @@ import type { PipelineJson } from '../../pipeline/PipelineJson/PipelineJson';
2
2
  import type { PipelineString } from '../../pipeline/PipelineString';
3
3
  import type { string_json } from '../../types/typeAliases';
4
4
  /**
5
- * Import the pipeline.book.md or pipeline.book.json file
5
+ * Import the pipeline.book or pipeline.book.json file
6
6
  *
7
7
  * Note: Using here custom import to work in jest tests
8
8
  * Note: Using sync version is 💩 in the production code, but it's ok here in tests
@@ -10,7 +10,7 @@ import type { string_json } from '../../types/typeAliases';
10
10
  * @param path - The path to the file relative to examples/pipelines directory
11
11
  * @private internal function of tests
12
12
  */
13
- export declare function importPipelineWithoutPreparation(path: `${string}.book.md`): PipelineString;
13
+ export declare function importPipelineWithoutPreparation(path: `${string}.book`): PipelineString;
14
14
  export declare function importPipelineWithoutPreparation(path: `${string}.book.json`): PipelineJson;
15
15
  /**
16
16
  * Import the pipeline.book.json file as parsed JSON
@@ -29,12 +29,12 @@ export type PipelineJson = {
29
29
  * Note: It must be unique across all pipeline collections
30
30
  * Note: It must use HTTPs URL
31
31
  * Tip: You can do versioning in the URL
32
- * For example: https://promptbook.studio/webgpt/write-website-content-cs.book.md@1.0.0
32
+ * For example: https://promptbook.studio/webgpt/write-website-content-cs.book@1.0.0
33
33
  * Warning: Do not hash part of the URL, hash part is used for identification of the task in the pipeline
34
34
  */
35
35
  readonly pipelineUrl?: string_pipeline_url;
36
36
  /**
37
- * Internal helper for tracking the source `.book.md` file of the pipeline
37
+ * Internal helper for tracking the source `.book` file of the pipeline
38
38
  */
39
39
  readonly sourceFile?: string_filename;
40
40
  /**
@@ -95,7 +95,7 @@ export type CommonPrompt = {
95
95
  /**
96
96
  * Unique identifier of the pipeline with specific task name as hash
97
97
  *
98
- * @example https://promptbook.studio/webgpt/write-website-content-cs.book.md#keywords
98
+ * @example https://promptbook.studio/webgpt/write-website-content-cs.book#keywords
99
99
  */
100
100
  readonly pipelineUrl?: string_pipeline_url_with_task_hash;
101
101
  /**
@@ -328,13 +328,13 @@ export type string_pipeline_root_url = string;
328
328
  /**
329
329
  * Semantic helper
330
330
  *
331
- * For example `"https://promptbook.studio/webgpt/write-website-content-cs.book.md"`
331
+ * For example `"https://promptbook.studio/webgpt/write-website-content-cs.book"`
332
332
  */
333
333
  export type string_pipeline_url = string;
334
334
  /**
335
335
  * Semantic helper
336
336
  *
337
- * For example `"https://promptbook.studio/webgpt/write-website-content-cs.book.md#keywords"`
337
+ * For example `"https://promptbook.studio/webgpt/write-website-content-cs.book#keywords"`
338
338
  */
339
339
  export type string_pipeline_url_with_task_hash = string;
340
340
  /**
@@ -9,7 +9,7 @@ import type { string_json } from '../../../types/typeAliases';
9
9
  */
10
10
  export declare function stringifyPipelineJson<TType>(pipeline: TType): string_json<TType>;
11
11
  /**
12
- * TODO: [🐝] Not Working propperly @see https://promptbook.studio/examples/mixed-knowledge.book.md
12
+ * TODO: [🐝] Not Working propperly @see https://promptbook.studio/examples/mixed-knowledge.book
13
13
  * TODO: [🧠][0] Maybe rename to `stringifyPipelineJson`, `stringifyIndexedJson`,...
14
14
  * TODO: [🧠] Maybe more elegant solution than replacing via regex
15
15
  * TODO: [🍙] Make some standard order of json properties
@@ -19,9 +19,9 @@ declare class Wizzard {
19
19
  * Run the book
20
20
  *
21
21
  * It can be loaded from:
22
- * 1) As a file ./books/write-cv.book.md
23
- * 2) As a URL https://promptbook.studio/hejny/write-cv.book.md found in ./books folder recursively
24
- * 2) As a URL https://promptbook.studio/hejny/write-cv.book.md fetched from the internet
22
+ * 1) As a file ./books/write-cv.book
23
+ * 2) As a URL https://promptbook.studio/hejny/write-cv.book found in ./books folder recursively
24
+ * 2) As a URL https://promptbook.studio/hejny/write-cv.book fetched from the internet
25
25
  * 3) As a string
26
26
  *
27
27
  * Note: This works simmilar to the `ptbk run` command
@@ -43,9 +43,9 @@ declare class Wizzard {
43
43
  * Load book from the source
44
44
  *
45
45
  * Pipelines can be loaded from:
46
- * 1) As a file ./books/write-cv.book.md
47
- * 2) As a URL https://promptbook.studio/hejny/write-cv.book.md found in ./books folder recursively
48
- * 2) As a URL https://promptbook.studio/hejny/write-cv.book.md fetched from the internet
46
+ * 1) As a file ./books/write-cv.book
47
+ * 2) As a URL https://promptbook.studio/hejny/write-cv.book found in ./books folder recursively
48
+ * 2) As a URL https://promptbook.studio/hejny/write-cv.book fetched from the internet
49
49
  * 3) As a string
50
50
  *
51
51
  * @param pipelineSource
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/editable",
3
- "version": "0.85.0-9",
3
+ "version": "0.86.0-2",
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,
@@ -42,12 +42,12 @@
42
42
  "bugs": {
43
43
  "url": "https://github.com/webgptorg/promptbook/issues"
44
44
  },
45
- "homepage": "https://www.npmjs.com/package/@promptbook/core",
45
+ "homepage": "https://ptbk.io/",
46
46
  "main": "./umd/index.umd.js",
47
47
  "module": "./esm/index.es.js",
48
48
  "typings": "./esm/typings/src/_packages/editable.index.d.ts",
49
49
  "peerDependencies": {
50
- "@promptbook/core": "0.85.0-9"
50
+ "@promptbook/core": "0.86.0-2"
51
51
  },
52
52
  "dependencies": {
53
53
  "crypto-js": "4.2.0",
package/umd/index.umd.js CHANGED
@@ -23,7 +23,7 @@
23
23
  * @generated
24
24
  * @see https://github.com/webgptorg/promptbook
25
25
  */
26
- var PROMPTBOOK_ENGINE_VERSION = '0.85.0-8';
26
+ var PROMPTBOOK_ENGINE_VERSION = '0.86.0-1';
27
27
  /**
28
28
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
29
29
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -280,7 +280,7 @@
280
280
  /**
281
281
  * Parses the boilerplate command
282
282
  *
283
- * Note: @@@ This command is used as boilerplate for new commands - it should NOT be used in any `.book.md` file
283
+ * Note: @@@ This command is used as boilerplate for new commands - it should NOT be used in any `.book` file
284
284
  *
285
285
  * @see `documentationUrl` for more details
286
286
  * @private within the commands folder
@@ -1808,7 +1808,7 @@
1808
1808
  /**
1809
1809
  * Parses the foreach command
1810
1810
  *
1811
- * Note: @@@ This command is used as foreach for new commands - it should NOT be used in any `.book.md` file
1811
+ * Note: @@@ This command is used as foreach for new commands - it should NOT be used in any `.book` file
1812
1812
  *
1813
1813
  * @see `documentationUrl` for more details
1814
1814
  * @public exported from `@promptbook/editable`
@@ -2259,7 +2259,7 @@
2259
2259
  /**
2260
2260
  * Parses the formfactor command
2261
2261
  *
2262
- * Note: @@@ This command is used as formfactor for new commands - it should NOT be used in any `.book.md` file
2262
+ * Note: @@@ This command is used as formfactor for new commands - it should NOT be used in any `.book` file
2263
2263
  *
2264
2264
  * @see `documentationUrl` for more details
2265
2265
  * @public exported from `@promptbook/editable`
@@ -3359,57 +3359,6 @@
3359
3359
  * ```
3360
3360
  */
3361
3361
 
3362
- /**
3363
- * Checks if an URL is reserved for private networks or localhost.
3364
- *
3365
- * Note: There are two simmilar functions:
3366
- * - `isUrlOnPrivateNetwork` which tests full URL
3367
- * - `isHostnameOnPrivateNetwork` *(this one)* which tests just hostname
3368
- *
3369
- * @public exported from `@promptbook/utils`
3370
- */
3371
- function isHostnameOnPrivateNetwork(hostname) {
3372
- if (hostname === 'example.com' ||
3373
- hostname === 'localhost' ||
3374
- hostname.endsWith('.localhost') ||
3375
- hostname.endsWith('.local') ||
3376
- hostname.endsWith('.test') ||
3377
- hostname === '127.0.0.1' ||
3378
- hostname === '::1') {
3379
- return true;
3380
- }
3381
- if (hostname.includes(':')) {
3382
- // IPv6
3383
- var ipParts = hostname.split(':');
3384
- return ipParts[0] === 'fc00' || ipParts[0] === 'fd00' || ipParts[0] === 'fe80';
3385
- }
3386
- else {
3387
- // IPv4
3388
- var ipParts = hostname.split('.').map(function (part) { return Number.parseInt(part, 10); });
3389
- return (ipParts[0] === 10 ||
3390
- (ipParts[0] === 172 && ipParts[1] >= 16 && ipParts[1] <= 31) ||
3391
- (ipParts[0] === 192 && ipParts[1] === 168));
3392
- }
3393
- }
3394
-
3395
- /**
3396
- * Checks if an IP address or hostname is reserved for private networks or localhost.
3397
- *
3398
- * Note: There are two simmilar functions:
3399
- * - `isUrlOnPrivateNetwork` *(this one)* which tests full URL
3400
- * - `isHostnameOnPrivateNetwork` which tests just hostname
3401
- *
3402
- * @param {string} ipAddress - The IP address to check.
3403
- * @returns {boolean} Returns true if the IP address is reserved for private networks or localhost, otherwise false.
3404
- * @public exported from `@promptbook/utils`
3405
- */
3406
- function isUrlOnPrivateNetwork(url) {
3407
- if (typeof url === 'string') {
3408
- url = new URL(url);
3409
- }
3410
- return isHostnameOnPrivateNetwork(url.hostname);
3411
- }
3412
-
3413
3362
  /**
3414
3363
  * Tests if given string is valid pipeline URL URL.
3415
3364
  *
@@ -3423,16 +3372,19 @@
3423
3372
  if (!isValidUrl(url)) {
3424
3373
  return false;
3425
3374
  }
3426
- if (!url.startsWith('https://')) {
3375
+ if (!url.startsWith('https://') && !url.startsWith('http://') /* <- Note: [👣] */) {
3427
3376
  return false;
3428
3377
  }
3429
3378
  if (url.includes('#')) {
3430
3379
  // TODO: [🐠]
3431
3380
  return false;
3432
3381
  }
3382
+ /*
3383
+ Note: [👣][🧠] Is it secure to allow pipeline URLs on private and unsecured networks?
3433
3384
  if (isUrlOnPrivateNetwork(url)) {
3434
3385
  return false;
3435
3386
  }
3387
+ */
3436
3388
  return true;
3437
3389
  }
3438
3390
  /**
@@ -3472,9 +3424,9 @@
3472
3424
  * Example usages of the URL command
3473
3425
  */
3474
3426
  examples: [
3475
- 'PIPELINE URL https://promptbook.studio/library/write-cv.book.md',
3476
- 'URL https://promptbook.studio/library/write-cv.book.md',
3477
- 'https://promptbook.studio/library/write-cv.book.md',
3427
+ 'PIPELINE URL https://promptbook.studio/library/write-cv.book',
3428
+ 'URL https://promptbook.studio/library/write-cv.book',
3429
+ 'https://promptbook.studio/library/write-cv.book',
3478
3430
  ],
3479
3431
  /**
3480
3432
  * Parses the URL command
@@ -4246,7 +4198,7 @@
4246
4198
  return pipelineJsonStringified;
4247
4199
  }
4248
4200
  /**
4249
- * TODO: [🐝] Not Working propperly @see https://promptbook.studio/examples/mixed-knowledge.book.md
4201
+ * TODO: [🐝] Not Working propperly @see https://promptbook.studio/examples/mixed-knowledge.book
4250
4202
  * TODO: [🧠][0] Maybe rename to `stringifyPipelineJson`, `stringifyIndexedJson`,...
4251
4203
  * TODO: [🧠] Maybe more elegant solution than replacing via regex
4252
4204
  * TODO: [🍙] Make some standard order of json properties