@promptbook/browser 0.104.0-17 โ†’ 0.104.0-19

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.
@@ -1,5 +1,5 @@
1
1
  import type { LlmToolDefinition } from '../../types/LlmToolDefinition';
2
- import type { string_knowledge_source_link } from '../../types/typeAliases';
2
+ import type { string_agent_url, string_knowledge_source_link } from '../../types/typeAliases';
3
3
  import type { TODO_any } from '../../utils/organization/TODO_any';
4
4
  /**
5
5
  * Model requirements for an agent
@@ -21,8 +21,13 @@ export type AgentModelRequirements = {
21
21
  readonly mcpServers?: ReadonlyArray<string>;
22
22
  /**
23
23
  * Optional link to the parent agent from which this agent inherits
24
+ *
25
+ * Note: [๐Ÿ†“] There are several cases what the agent ancestor could be:
26
+ * - 1) `parentAgentUrl` is `string_agent_url` valid agent URL
27
+ * - 2) `parentAgentUrl` is explicitly `null` (forcefully no parent)
28
+ * - 3) `parentAgentUrl` is not defined `undefined`, the default ancestor agent, Adam, will be used
24
29
  */
25
- readonly parentAgentUrl?: string_knowledge_source_link;
30
+ readonly parentAgentUrl?: string_agent_url | null;
26
31
  /**
27
32
  * Optional list of knowledge source links that the agent can use
28
33
  */
@@ -7,7 +7,7 @@ import type { string_agent_name, string_agent_permanent_id, string_url, string_u
7
7
  *
8
8
  * @public exported from `@promptbook/core`
9
9
  */
10
- export declare function generatePlaceholderAgentProfileImageUrl(agentIdOrName: string_agent_permanent_id | string_agent_name, agentsServerUrl?: URL | string_url): string_url_image;
10
+ export declare function generatePlaceholderAgentProfileImageUrl(agentIdOrName: string_agent_permanent_id | string_agent_name, agentsServerUrl: URL | string_url): string_url_image;
11
11
  /**
12
12
  * TODO: [๐Ÿคน] Figure out best placeholder image generator https://i.pravatar.cc/1000?u=568
13
13
  */
@@ -1,6 +1,6 @@
1
1
  import type { CsvSettings } from './formats/csv/CsvSettings';
2
2
  import type { IntermediateFilesStrategy } from './types/IntermediateFilesStrategy';
3
- import type { string_app_id, string_email, string_name, string_promptbook_server_url } from './types/typeAliases';
3
+ import type { string_app_id, string_email, string_legal_entity, string_name, string_promptbook_server_url } from './types/typeAliases';
4
4
  import { Color } from './utils/color/Color';
5
5
  /**
6
6
  * Warning message for the generated sections and files files
@@ -22,6 +22,12 @@ export declare const NAME = "Promptbook";
22
22
  * @public exported from `@promptbook/core`
23
23
  */
24
24
  export declare const ADMIN_EMAIL: string_email;
25
+ /**
26
+ * Email of the responsible person
27
+ *
28
+ * @public exported from `@promptbook/core`
29
+ */
30
+ export declare const PROMPTBOOK_LEGAL_ENTITY: string_legal_entity;
25
31
  /**
26
32
  * Name of the responsible person for the Promptbook on GitHub
27
33
  *
@@ -295,6 +301,7 @@ export declare const MOMENT_ARG_THRESHOLDS: {
295
301
  /**
296
302
  * Default remote server URL for the Promptbook
297
303
  *
304
+ * @deprecated !!!! Deprecate all pipelines server
298
305
  * @public exported from `@promptbook/core`
299
306
  */
300
307
  export declare const DEFAULT_REMOTE_SERVER_URL: string_promptbook_server_url;
@@ -0,0 +1,16 @@
1
+ import type { string_agent_url } from '../../../types/typeAliases';
2
+ import type { really_unknown } from '../../organization/really_unknown';
3
+ /**
4
+ * Tests if given string is valid agent URL
5
+ *
6
+ * Note: There are few similar functions:
7
+ * - `isValidUrl` which tests any URL
8
+ * - `isValidAgentUrl` *(this one)* which tests just agent URL
9
+ * - `isValidPipelineUrl` which tests just pipeline URL
10
+ *
11
+ * @public exported from `@promptbook/utils`
12
+ */
13
+ export declare function isValidAgentUrl(url: really_unknown): url is string_agent_url;
14
+ /**
15
+ * TODO: [๐Ÿ ] Maybe more info why the URL is invalid
16
+ */
@@ -3,8 +3,9 @@ import type { really_unknown } from '../../organization/really_unknown';
3
3
  /**
4
4
  * Tests if given string is valid pipeline URL URL.
5
5
  *
6
- * Note: There are two similar functions:
6
+ * Note: There are few similar functions:
7
7
  * - `isValidUrl` which tests any URL
8
+ * - `isValidAgentUrl` which tests just agent URL
8
9
  * - `isValidPipelineUrl` *(this one)* which tests just pipeline URL
9
10
  *
10
11
  * @public exported from `@promptbook/utils`
@@ -5,9 +5,10 @@ import type { really_unknown } from '../../organization/really_unknown';
5
5
  *
6
6
  * Note: [๐Ÿ”‚] This function is idempotent.
7
7
  * Note: Dataurl are considered perfectly valid.
8
- * Note: There are two similar functions:
9
- * - `isValidUrl` which tests any URL
10
- * - `isValidPipelineUrl` *(this one)* which tests just promptbook URL
8
+ * Note: There are few similar functions:
9
+ * - `isValidUrl` *(this one)* which tests any URL
10
+ * - `isValidAgentUrl` which tests just agent URL
11
+ * - `isValidPipelineUrl` which tests just pipeline URL
11
12
  *
12
13
  * @public exported from `@promptbook/utils`
13
14
  */
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
15
15
  export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
16
16
  /**
17
17
  * Represents the version string of the Promptbook engine.
18
- * It follows semantic versioning (e.g., `0.104.0-16`).
18
+ * It follows semantic versioning (e.g., `0.104.0-18`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/browser",
3
- "version": "0.104.0-17",
3
+ "version": "0.104.0-19",
4
4
  "description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -94,7 +94,7 @@
94
94
  "module": "./esm/index.es.js",
95
95
  "typings": "./esm/typings/src/_packages/browser.index.d.ts",
96
96
  "peerDependencies": {
97
- "@promptbook/core": "0.104.0-17"
97
+ "@promptbook/core": "0.104.0-19"
98
98
  },
99
99
  "dependencies": {
100
100
  "crypto": "1.0.1",
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.104.0-17';
26
+ const PROMPTBOOK_ENGINE_VERSION = '0.104.0-19';
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
@@ -2212,9 +2212,10 @@
2212
2212
  *
2213
2213
  * Note: [๐Ÿ”‚] This function is idempotent.
2214
2214
  * Note: Dataurl are considered perfectly valid.
2215
- * Note: There are two similar functions:
2216
- * - `isValidUrl` which tests any URL
2217
- * - `isValidPipelineUrl` *(this one)* which tests just promptbook URL
2215
+ * Note: There are few similar functions:
2216
+ * - `isValidUrl` *(this one)* which tests any URL
2217
+ * - `isValidAgentUrl` which tests just agent URL
2218
+ * - `isValidPipelineUrl` which tests just pipeline URL
2218
2219
  *
2219
2220
  * @public exported from `@promptbook/utils`
2220
2221
  */
@@ -2624,6 +2625,39 @@
2624
2625
  * Note: [๐Ÿ’ž] Ignore a discrepancy between file name and entity name
2625
2626
  */
2626
2627
 
2628
+ /**
2629
+ * Tests if given string is valid agent URL
2630
+ *
2631
+ * Note: There are few similar functions:
2632
+ * - `isValidUrl` which tests any URL
2633
+ * - `isValidAgentUrl` *(this one)* which tests just agent URL
2634
+ * - `isValidPipelineUrl` which tests just pipeline URL
2635
+ *
2636
+ * @public exported from `@promptbook/utils`
2637
+ */
2638
+ function isValidAgentUrl(url) {
2639
+ if (!isValidUrl(url)) {
2640
+ return false;
2641
+ }
2642
+ if (!url.startsWith('https://') && !url.startsWith('http://') /* <- Note: [๐Ÿ‘ฃ] */) {
2643
+ return false;
2644
+ }
2645
+ if (url.includes('#')) {
2646
+ // TODO: [๐Ÿ ]
2647
+ return false;
2648
+ }
2649
+ /*
2650
+ Note: [๐Ÿ‘ฃ][๐Ÿง ] Is it secure to allow pipeline URLs on private and unsecured networks?
2651
+ if (isUrlOnPrivateNetwork(url)) {
2652
+ return false;
2653
+ }
2654
+ */
2655
+ return true;
2656
+ }
2657
+ /**
2658
+ * TODO: [๐Ÿ ] Maybe more info why the URL is invalid
2659
+ */
2660
+
2627
2661
  /**
2628
2662
  * Normalizes agent name from arbitrary string to valid agent name
2629
2663
  *
@@ -3340,21 +3374,36 @@
3340
3374
  applyToAgentModelRequirements(requirements, content) {
3341
3375
  const trimmedContent = content.trim();
3342
3376
  if (!trimmedContent) {
3343
- return requirements;
3377
+ return {
3378
+ ...requirements,
3379
+ parentAgentUrl: undefined,
3380
+ };
3344
3381
  }
3345
- // Validate URL
3346
- try {
3347
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
3348
- const url = new URL(trimmedContent);
3349
- // TODO: Add more validation if needed (e.g. check for valid protocol)
3382
+ if (trimmedContent.toUpperCase() === 'VOID' ||
3383
+ trimmedContent.toUpperCase() === 'NULL' ||
3384
+ trimmedContent.toUpperCase() === 'NONE' ||
3385
+ trimmedContent.toUpperCase() === 'NIL') {
3386
+ return {
3387
+ ...requirements,
3388
+ parentAgentUrl: null,
3389
+ };
3350
3390
  }
3351
- catch (error) {
3352
- console.warn(`Invalid URL in FROM commitment: ${trimmedContent}`);
3353
- return requirements;
3391
+ if (!isValidAgentUrl(trimmedContent)) {
3392
+ throw new Error(spaceTrim$1.spaceTrim((block) => `
3393
+ Invalid agent URL in FROM commitment: "${trimmedContent}"
3394
+
3395
+ \`\`\`book
3396
+ ${block(content)}
3397
+ \`\`\`
3398
+
3399
+
3400
+ `));
3354
3401
  }
3402
+ const parentAgentUrl = trimmedContent;
3403
+ console.log('!!!! parentAgentUrl', parentAgentUrl);
3355
3404
  return {
3356
3405
  ...requirements,
3357
- parentAgentUrl: trimmedContent,
3406
+ parentAgentUrl,
3358
3407
  };
3359
3408
  }
3360
3409
  }