@promptbook/editable 0.89.0-15 → 0.89.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.
@@ -3,7 +3,7 @@ import type { IntermediateFilesStrategy } from './types/IntermediateFilesStrateg
3
3
  import type { string_app_id } from './types/typeAliases';
4
4
  import type { string_email } from './types/typeAliases';
5
5
  import type { string_name } from './types/typeAliases';
6
- import type { string_url_image } from './types/typeAliases';
6
+ import type { string_promptbook_server_url } from './types/typeAliases';
7
7
  /**
8
8
  * Warning message for the generated sections and files files
9
9
  *
@@ -38,22 +38,6 @@ export declare const ADMIN_GITHUB_NAME: string_name;
38
38
  * @public exported from `@promptbook/core`
39
39
  */
40
40
  export declare const CLAIM = "It's time for a paradigm shift. The future of software in plain English, French or Latin";
41
- /**
42
- * Logo for the light theme
43
- *
44
- * TODO: [🗽] Unite branding and make single place for it
45
- *
46
- * @public exported from `@promptbook/core`
47
- */
48
- export declare const LOGO_LIGHT_SRC: string_url_image;
49
- /**
50
- * Logo for the dark theme
51
- *
52
- * TODO: [🗽] Unite branding and make single place for it
53
- *
54
- * @public exported from `@promptbook/core`
55
- */
56
- export declare const LOGO_DARK_SRC: string_url_image;
57
41
  /**
58
42
  * When the title is not provided, the default title is used
59
43
  *
@@ -90,6 +74,12 @@ export declare const DEFAULT_MAX_FILE_SIZE: number;
90
74
  * @private within the repository
91
75
  */
92
76
  export declare const GENERATOR_WARNING_BY_PROMPTBOOK_CLI = "\u26A0\uFE0F WARNING: This code has been generated by `@promptbook/cli` so that any manual changes will be overwritten";
77
+ /**
78
+ * Warning message for the automatically generated sections of `.env` files
79
+ *
80
+ * @private within the repository
81
+ */
82
+ export declare const GENERATOR_WARNING_IN_ENV = "Note: Added by Promptbook";
93
83
  /**
94
84
  * The maximum number of iterations for a loops
95
85
  *
@@ -238,11 +228,17 @@ export declare const MOMENT_ARG_THRESHOLDS: {
238
228
  readonly ss: 3;
239
229
  };
240
230
  /**
241
- * @@@
231
+ * Available remote servers for the Promptbook
232
+ *
233
+ * @public exported from `@promptbook/core`
234
+ */
235
+ export declare const REMOTE_SERVER_URLS: Array<string_promptbook_server_url>;
236
+ /**
237
+ * Default remote server URL for the Promptbook
242
238
  *
243
239
  * @public exported from `@promptbook/core`
244
240
  */
245
- export declare const DEFAULT_REMOTE_SERVER_URL = "https://api.pavolhejny.com/promptbook";
241
+ export declare const DEFAULT_REMOTE_SERVER_URL: string_promptbook_server_url;
246
242
  /**
247
243
  * @@@
248
244
  *
@@ -10,5 +10,5 @@ export declare class PipelineExecutionError extends Error {
10
10
  constructor(message: string);
11
11
  }
12
12
  /**
13
- * TODO: !!!!!! Add id to all errors
13
+ * TODO: [🧠][🌂] Add id to all errors
14
14
  */
@@ -1,9 +1,10 @@
1
1
  import type { really_unknown } from '../utils/organization/really_unknown';
2
2
  /**
3
- * !!!@@@
3
+ * Helper used in catch blocks to assert that the error is an instance of `Error`
4
4
  *
5
- * @param whatWasThrown !!!@@@
6
- * @returns !!!@@@
5
+ * @param whatWasThrown Any object that was thrown
6
+ * @returns Nothing if the error is an instance of `Error`
7
+ * @throws `WrappedError` or `UnexpectedError` if the error is not standard
7
8
  *
8
9
  * @private within the repository
9
10
  */
@@ -5,7 +5,14 @@ import type { string_url } from '../../../types/typeAliases';
5
5
  import type { really_any } from '../../../utils/organization/really_any';
6
6
  import type { CacheLlmToolsOptions } from '../utils/cache/CacheLlmToolsOptions';
7
7
  import type { LlmExecutionToolsWithTotalUsage } from '../utils/count-total-usage/LlmExecutionToolsWithTotalUsage';
8
- type ProvideLlmToolsForWizzardOrCliOptions = Pick<CacheLlmToolsOptions, 'isCacheReloaded'> & ({
8
+ type ProvideLlmToolsForWizzardOrCliOptions = {
9
+ /**
10
+ * If true, user will be always prompted for login
11
+ *
12
+ * Note: This is used in `ptbk login` command
13
+ */
14
+ isLoginloaded?: true;
15
+ } & Pick<CacheLlmToolsOptions, 'isCacheReloaded'> & ({
9
16
  /**
10
17
  * Use local keys and execute LLMs directly
11
18
  */
@@ -29,6 +36,8 @@ type ProvideLlmToolsForWizzardOrCliOptions = Pick<CacheLlmToolsOptions, 'isCache
29
36
  readonly appId: string_app_id;
30
37
  /**
31
38
  *
39
+ *
40
+ * Note: When login prompt fails, `process.exit(1)` is called
32
41
  */
33
42
  loginPrompt(): Promisable<Identification<really_any>>;
34
43
  });
@@ -0,0 +1,11 @@
1
+ import type { string_promptbook_token } from '../../../types/typeAliases';
2
+ import type { really_unknown } from '../../../utils/organization/really_unknown';
3
+ import type { ApplicationModeIdentification } from './Identification';
4
+ /**
5
+ * Convert identification to Promptbook token
6
+ *
7
+ * @param identification
8
+ *
9
+ * @public exported from `@promptbook/core`
10
+ */
11
+ export declare function identificationToPromptbookToken(identification: ApplicationModeIdentification<really_unknown>): string_promptbook_token;
@@ -0,0 +1,10 @@
1
+ import type { string_promptbook_token } from '../../../types/typeAliases';
2
+ import type { ApplicationModeIdentification } from './Identification';
3
+ /**
4
+ * Convert Promptbook token to identification
5
+ *
6
+ * @param promptbookToken
7
+ *
8
+ * @public exported from `@promptbook/core`
9
+ */
10
+ export declare function promptbookTokenToIdentification(promptbookToken: string_promptbook_token): ApplicationModeIdentification<undefined>;
@@ -1,6 +1,6 @@
1
1
  import type { PromptbookStorage } from '../_common/PromptbookStorage';
2
2
  /**
3
- * Stores data in .env variables (Remove !!! nonce 1)
3
+ * Stores data in .env variables
4
4
  *
5
5
  * Note: `$` is used to indicate that this function is not a pure function - it uses filesystem to access `.env` file and also writes to `process.env`
6
6
  *
@@ -35,3 +35,6 @@ export declare class $EnvStorage<TItem> implements PromptbookStorage<TItem> {
35
35
  */
36
36
  removeItem(key: string): void;
37
37
  }
38
+ /**
39
+ * TODO: Write file more securely - ensure that there can be no accidental overwriting of existing variables and other content
40
+ */
@@ -325,6 +325,12 @@ export type string_css_selector = string;
325
325
  * For example `"https://collboard.com/9SeSQTupmQHwuSrLi"`
326
326
  */
327
327
  export type string_url = string;
328
+ /**
329
+ * Semantic helper
330
+ *
331
+ * For example `"https://s1.ptbk.io/promptbook"`
332
+ */
333
+ export type string_promptbook_server_url = string;
328
334
  /**
329
335
  * Semantic helper
330
336
  *
@@ -570,6 +576,12 @@ export type string_postprocessing_function_name = string;
570
576
  export type id = string | number;
571
577
  export type task_id = string;
572
578
  export type string_token = string;
579
+ /**
580
+ * Semantic helper
581
+ *
582
+ * Made by `identificationToPromptbookToken` exported from `@promptbook/core`
583
+ */
584
+ export type string_promptbook_token = string_token;
573
585
  export type string_license_token = string_token;
574
586
  export type string_password = string;
575
587
  export type string_ssh_key = string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/editable",
3
- "version": "0.89.0-15",
3
+ "version": "0.89.0-17",
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,
@@ -51,7 +51,7 @@
51
51
  "module": "./esm/index.es.js",
52
52
  "typings": "./esm/typings/src/_packages/editable.index.d.ts",
53
53
  "peerDependencies": {
54
- "@promptbook/core": "0.89.0-15"
54
+ "@promptbook/core": "0.89.0-17"
55
55
  },
56
56
  "dependencies": {
57
57
  "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
- const PROMPTBOOK_ENGINE_VERSION = '0.89.0-15';
26
+ const PROMPTBOOK_ENGINE_VERSION = '0.89.0-17';
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
@@ -69,6 +69,7 @@
69
69
  * @public exported from `@promptbook/core`
70
70
  */
71
71
  const ADMIN_GITHUB_NAME = 'hejny';
72
+ // <- TODO: [🐊] Pick the best claim
72
73
  /**
73
74
  * When the title is not provided, the default title is used
74
75
  *
@@ -432,44 +433,42 @@
432
433
  constructor(whatWasThrown) {
433
434
  const tag = `[🤮]`;
434
435
  console.error(tag, whatWasThrown);
435
- super(spaceTrim.spaceTrim((block) => `
436
- ${ /* Fixing tests !!! block(valueToString(whatWasThrown)) */block(`non-Error object was thrown`)}
437
-
438
- Note: Look for ${tag} in the console for more details
439
- !!! Note: \`WrappedError\` indicates that somewhere in the code non-Error object was thrown and it was wrapped
440
-
441
- Please report issue on ${ADMIN_EMAIL}
436
+ super(spaceTrim.spaceTrim(`
437
+ Non-Error object was thrown
442
438
 
443
- `));
439
+ Note: Look for ${tag} in the console for more details
440
+ Please report issue on ${ADMIN_EMAIL}
441
+ `));
444
442
  this.name = 'WrappedError';
445
443
  Object.setPrototypeOf(this, WrappedError.prototype);
446
444
  }
447
445
  }
448
446
 
449
447
  /**
450
- * !!!@@@
448
+ * Helper used in catch blocks to assert that the error is an instance of `Error`
451
449
  *
452
- * @param whatWasThrown !!!@@@
453
- * @returns !!!@@@
450
+ * @param whatWasThrown Any object that was thrown
451
+ * @returns Nothing if the error is an instance of `Error`
452
+ * @throws `WrappedError` or `UnexpectedError` if the error is not standard
454
453
  *
455
454
  * @private within the repository
456
455
  */
457
456
  function assertsError(whatWasThrown) {
458
- // Case 1: !!!@@@
457
+ // Case 1: Handle error which was rethrown as `WrappedError`
459
458
  if (whatWasThrown instanceof WrappedError) {
460
459
  const wrappedError = whatWasThrown;
461
460
  throw wrappedError;
462
461
  }
463
- // Case 2: !!!@@@
462
+ // Case 2: Handle unexpected errors
464
463
  if (whatWasThrown instanceof UnexpectedError) {
465
464
  const unexpectedError = whatWasThrown;
466
465
  throw unexpectedError;
467
466
  }
468
- // Case 3: !!!@@@
467
+ // Case 3: Handle standard errors - keep them up to consumer
469
468
  if (whatWasThrown instanceof Error) {
470
469
  return;
471
470
  }
472
- // Case 4: !!!@@@
471
+ // Case 4: Handle non-standard errors - wrap them into `WrappedError` and throw
473
472
  throw new WrappedError(whatWasThrown);
474
473
  }
475
474