@promptbook/vercel 0.103.0-54 → 0.103.0-56

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.
@@ -0,0 +1,53 @@
1
+ import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
2
+ import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
3
+ /**
4
+ * USE commitment definition
5
+ *
6
+ * The USE commitment indicates that the agent should utilize specific tools or capabilities
7
+ * to access and interact with external systems when necessary.
8
+ *
9
+ * Supported USE types:
10
+ * - USE BROWSER: Enables the agent to use a web browser tool
11
+ * - USE SEARCH ENGINE (future): Enables search engine access
12
+ * - USE FILE SYSTEM (future): Enables file system operations
13
+ * - USE MCP (future): Enables MCP server connections
14
+ *
15
+ * The content following the USE commitment is ignored (similar to NOTE).
16
+ *
17
+ * Example usage in agent source:
18
+ *
19
+ * ```book
20
+ * USE BROWSER
21
+ * USE SEARCH ENGINE
22
+ * ```
23
+ *
24
+ * @private [🪔] Maybe export the commitments through some package
25
+ */
26
+ export declare class UseCommitmentDefinition extends BaseCommitmentDefinition<`USE${string}`> {
27
+ constructor();
28
+ /**
29
+ * Short one-line description of USE commitments.
30
+ */
31
+ get description(): string;
32
+ /**
33
+ * Icon for this commitment.
34
+ */
35
+ get icon(): string;
36
+ /**
37
+ * Markdown documentation for USE commitment.
38
+ */
39
+ get documentation(): string;
40
+ applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
41
+ /**
42
+ * Extracts the tool type from the USE commitment
43
+ * This is used by the parsing logic
44
+ */
45
+ extractToolType(content: string): string | null;
46
+ /**
47
+ * Checks if this is a known USE type
48
+ */
49
+ isKnownUseType(useType: string): boolean;
50
+ }
51
+ /**
52
+ * Note: [💞] Ignore a discrepancy between file name and entity name
53
+ */
@@ -0,0 +1,38 @@
1
+ import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
2
+ import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
3
+ /**
4
+ * USE BROWSER commitment definition
5
+ *
6
+ * The `USE BROWSER` commitment indicates that the agent should utilize a web browser tool
7
+ * to access and retrieve up-to-date information from the internet when necessary.
8
+ *
9
+ * The content following `USE BROWSER` is ignored (similar to NOTE).
10
+ *
11
+ * Example usage in agent source:
12
+ *
13
+ * ```book
14
+ * USE BROWSER
15
+ * USE BROWSER This will be ignored
16
+ * ```
17
+ *
18
+ * @private [🪔] Maybe export the commitments through some package
19
+ */
20
+ export declare class UseBrowserCommitmentDefinition extends BaseCommitmentDefinition<'USE BROWSER'> {
21
+ constructor();
22
+ /**
23
+ * Short one-line description of USE BROWSER.
24
+ */
25
+ get description(): string;
26
+ /**
27
+ * Icon for this commitment.
28
+ */
29
+ get icon(): string;
30
+ /**
31
+ * Markdown documentation for USE BROWSER commitment.
32
+ */
33
+ get documentation(): string;
34
+ applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
35
+ }
36
+ /**
37
+ * Note: [💞] Ignore a discrepancy between file name and entity name
38
+ */
@@ -0,0 +1,37 @@
1
+ import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
2
+ import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
3
+ /**
4
+ * USE MCP commitment definition
5
+ *
6
+ * The `USE MCP` commitment allows to specify an MCP server URL which the agent will connect to
7
+ * for retrieving additional instructions and actions.
8
+ *
9
+ * The content following `USE MCP` is the URL of the MCP server.
10
+ *
11
+ * Example usage in agent source:
12
+ *
13
+ * ```book
14
+ * USE MCP http://mcp-server-url.com
15
+ * ```
16
+ *
17
+ * @private [🪔] Maybe export the commitments through some package
18
+ */
19
+ export declare class UseMcpCommitmentDefinition extends BaseCommitmentDefinition<'USE MCP'> {
20
+ constructor();
21
+ /**
22
+ * Short one-line description of USE MCP.
23
+ */
24
+ get description(): string;
25
+ /**
26
+ * Icon for this commitment.
27
+ */
28
+ get icon(): string;
29
+ /**
30
+ * Markdown documentation for USE MCP commitment.
31
+ */
32
+ get documentation(): string;
33
+ applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
34
+ }
35
+ /**
36
+ * Note: [💞] Ignore a discrepancy between file name and entity name
37
+ */
@@ -0,0 +1,38 @@
1
+ import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
2
+ import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
3
+ /**
4
+ * USE SEARCH ENGINE commitment definition
5
+ *
6
+ * The `USE SEARCH ENGINE` commitment indicates that the agent should utilize a search engine tool
7
+ * to access and retrieve up-to-date information from the internet when necessary.
8
+ *
9
+ * The content following `USE SEARCH ENGINE` is ignored (similar to NOTE).
10
+ *
11
+ * Example usage in agent source:
12
+ *
13
+ * ```book
14
+ * USE SEARCH ENGINE
15
+ * USE SEARCH ENGINE This will be ignored
16
+ * ```
17
+ *
18
+ * @private [🪔] Maybe export the commitments through some package
19
+ */
20
+ export declare class UseSearchEngineCommitmentDefinition extends BaseCommitmentDefinition<'USE SEARCH ENGINE'> {
21
+ constructor();
22
+ /**
23
+ * Short one-line description of USE SEARCH ENGINE.
24
+ */
25
+ get description(): string;
26
+ /**
27
+ * Icon for this commitment.
28
+ */
29
+ get icon(): string;
30
+ /**
31
+ * Markdown documentation for USE SEARCH ENGINE commitment.
32
+ */
33
+ get documentation(): string;
34
+ applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
35
+ }
36
+ /**
37
+ * Note: [💞] Ignore a discrepancy between file name and entity name
38
+ */
@@ -1,10 +1,14 @@
1
1
  import type { BookCommitment } from './_base/BookCommitment';
2
2
  import type { CommitmentDefinition } from './_base/CommitmentDefinition';
3
3
  import { ActionCommitmentDefinition } from './ACTION/ACTION';
4
+ import { ClosedCommitmentDefinition } from './CLOSED/CLOSED';
5
+ import { ComponentCommitmentDefinition } from './COMPONENT/COMPONENT';
4
6
  import { DeleteCommitmentDefinition } from './DELETE/DELETE';
5
7
  import { FormatCommitmentDefinition } from './FORMAT/FORMAT';
8
+ import { FromCommitmentDefinition } from './FROM/FROM';
6
9
  import { GoalCommitmentDefinition } from './GOAL/GOAL';
7
10
  import { KnowledgeCommitmentDefinition } from './KNOWLEDGE/KNOWLEDGE';
11
+ import { LanguageCommitmentDefinition } from './LANGUAGE/LANGUAGE';
8
12
  import { MemoryCommitmentDefinition } from './MEMORY/MEMORY';
9
13
  import { AgentMessageCommitmentDefinition } from './MESSAGE/AgentMessageCommitmentDefinition';
10
14
  import { InitialMessageCommitmentDefinition } from './MESSAGE/InitialMessageCommitmentDefinition';
@@ -12,14 +16,21 @@ import { MessageCommitmentDefinition } from './MESSAGE/MESSAGE';
12
16
  import { UserMessageCommitmentDefinition } from './MESSAGE/UserMessageCommitmentDefinition';
13
17
  import { MetaCommitmentDefinition } from './META/META';
14
18
  import { MetaColorCommitmentDefinition } from './META_COLOR/META_COLOR';
19
+ import { MetaFontCommitmentDefinition } from './META_FONT/META_FONT';
15
20
  import { MetaImageCommitmentDefinition } from './META_IMAGE/META_IMAGE';
21
+ import { MetaLinkCommitmentDefinition } from './META_LINK/META_LINK';
16
22
  import { ModelCommitmentDefinition } from './MODEL/MODEL';
17
23
  import { NoteCommitmentDefinition } from './NOTE/NOTE';
24
+ import { OpenCommitmentDefinition } from './OPEN/OPEN';
18
25
  import { PersonaCommitmentDefinition } from './PERSONA/PERSONA';
19
26
  import { RuleCommitmentDefinition } from './RULE/RULE';
20
27
  import { SampleCommitmentDefinition } from './SAMPLE/SAMPLE';
21
28
  import { ScenarioCommitmentDefinition } from './SCENARIO/SCENARIO';
22
29
  import { StyleCommitmentDefinition } from './STYLE/STYLE';
30
+ import { UseCommitmentDefinition } from './USE/USE';
31
+ import { UseBrowserCommitmentDefinition } from './USE_BROWSER/USE_BROWSER';
32
+ import { UseMcpCommitmentDefinition } from './USE_MCP/USE_MCP';
33
+ import { UseSearchEngineCommitmentDefinition } from './USE_SEARCH_ENGINE/USE_SEARCH_ENGINE';
23
34
  import { NotYetImplementedCommitmentDefinition } from './_base/NotYetImplementedCommitmentDefinition';
24
35
  /**
25
36
  * Registry of all available commitment definitions
@@ -28,7 +39,7 @@ import { NotYetImplementedCommitmentDefinition } from './_base/NotYetImplemented
28
39
  *
29
40
  * @private Use functions to access commitments instead of this array directly
30
41
  */
31
- export declare const COMMITMENT_REGISTRY: readonly [PersonaCommitmentDefinition, PersonaCommitmentDefinition, KnowledgeCommitmentDefinition, MemoryCommitmentDefinition, MemoryCommitmentDefinition, StyleCommitmentDefinition, StyleCommitmentDefinition, RuleCommitmentDefinition, RuleCommitmentDefinition, SampleCommitmentDefinition, SampleCommitmentDefinition, FormatCommitmentDefinition, FormatCommitmentDefinition, ModelCommitmentDefinition, ModelCommitmentDefinition, ActionCommitmentDefinition, ActionCommitmentDefinition, MetaImageCommitmentDefinition, MetaColorCommitmentDefinition, MetaCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, GoalCommitmentDefinition, GoalCommitmentDefinition, InitialMessageCommitmentDefinition, UserMessageCommitmentDefinition, AgentMessageCommitmentDefinition, MessageCommitmentDefinition, MessageCommitmentDefinition, ScenarioCommitmentDefinition, ScenarioCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, NotYetImplementedCommitmentDefinition<"EXPECT">, NotYetImplementedCommitmentDefinition<"BEHAVIOUR">, NotYetImplementedCommitmentDefinition<"BEHAVIOURS">, NotYetImplementedCommitmentDefinition<"AVOID">, NotYetImplementedCommitmentDefinition<"AVOIDANCE">, NotYetImplementedCommitmentDefinition<"CONTEXT">];
42
+ export declare const COMMITMENT_REGISTRY: readonly [PersonaCommitmentDefinition, PersonaCommitmentDefinition, KnowledgeCommitmentDefinition, MemoryCommitmentDefinition, MemoryCommitmentDefinition, StyleCommitmentDefinition, StyleCommitmentDefinition, RuleCommitmentDefinition, RuleCommitmentDefinition, LanguageCommitmentDefinition, LanguageCommitmentDefinition, SampleCommitmentDefinition, SampleCommitmentDefinition, FormatCommitmentDefinition, FormatCommitmentDefinition, FromCommitmentDefinition, ModelCommitmentDefinition, ModelCommitmentDefinition, ActionCommitmentDefinition, ActionCommitmentDefinition, ComponentCommitmentDefinition, MetaImageCommitmentDefinition, MetaColorCommitmentDefinition, MetaFontCommitmentDefinition, MetaLinkCommitmentDefinition, MetaCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, GoalCommitmentDefinition, GoalCommitmentDefinition, InitialMessageCommitmentDefinition, UserMessageCommitmentDefinition, AgentMessageCommitmentDefinition, MessageCommitmentDefinition, MessageCommitmentDefinition, ScenarioCommitmentDefinition, ScenarioCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, OpenCommitmentDefinition, ClosedCommitmentDefinition, UseBrowserCommitmentDefinition, UseSearchEngineCommitmentDefinition, UseMcpCommitmentDefinition, UseCommitmentDefinition, NotYetImplementedCommitmentDefinition<"EXPECT">, NotYetImplementedCommitmentDefinition<"BEHAVIOUR">, NotYetImplementedCommitmentDefinition<"BEHAVIOURS">, NotYetImplementedCommitmentDefinition<"AVOID">, NotYetImplementedCommitmentDefinition<"AVOIDANCE">, NotYetImplementedCommitmentDefinition<"CONTEXT">];
32
43
  /**
33
44
  * Gets a commitment definition by its type
34
45
  * @param type The commitment type to look up
@@ -1,2 +1,5 @@
1
1
  #!/usr/bin/env ts-node
2
2
  export {};
3
+ /**
4
+ * Note: [⚫] Code in this file should never be published in any package
5
+ */
@@ -24,6 +24,14 @@ export declare class Color {
24
24
  * @returns Color object
25
25
  */
26
26
  static from(color: string_color | Color): WithTake<Color>;
27
+ /**
28
+ * Creates a new Color instance from miscellaneous formats
29
+ * It just does not throw error when it fails, it returns PROMPTBOOK_COLOR instead
30
+ *
31
+ * @param color
32
+ * @returns Color object
33
+ */
34
+ static fromSafe(color: string_color | Color): WithTake<Color>;
27
35
  /**
28
36
  * Creates a new Color instance from miscellaneous string formats
29
37
  *
@@ -4,6 +4,7 @@
4
4
  * @public exported from `@promptbook/color`
5
5
  */
6
6
  export declare const CSS_COLORS: {
7
+ readonly promptbook: "#79EAFD";
7
8
  readonly transparent: "rgba(0,0,0,0)";
8
9
  readonly aliceblue: "#f0f8ff";
9
10
  readonly antiquewhite: "#faebd7";
@@ -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.103.0-53`).
18
+ * It follows semantic versioning (e.g., `0.103.0-55`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/vercel",
3
- "version": "0.103.0-54",
3
+ "version": "0.103.0-56",
4
4
  "description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -87,14 +87,14 @@
87
87
  },
88
88
  "homepage": "https://ptbk.io/",
89
89
  "engines": {
90
- "node": ">=16.0.0",
90
+ "node": ">=18.18.0",
91
91
  "npm": ">=8.0.0"
92
92
  },
93
93
  "main": "./umd/index.umd.js",
94
94
  "module": "./esm/index.es.js",
95
95
  "typings": "./esm/typings/src/_packages/vercel.index.d.ts",
96
96
  "peerDependencies": {
97
- "@promptbook/core": "0.103.0-54"
97
+ "@promptbook/core": "0.103.0-56"
98
98
  },
99
99
  "dependencies": {
100
100
  "colors": "1.4.0",
package/umd/index.umd.js CHANGED
@@ -1,13 +1,13 @@
1
1
  (function (global, factory) {
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('colors'), require('spacetrim'), require('crypto')) :
3
3
  typeof define === 'function' && define.amd ? define(['exports', 'colors', 'spacetrim', 'crypto'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-vercel"] = {}, global.colors, global.spaceTrim, global.crypto));
5
- })(this, (function (exports, colors, spaceTrim, crypto) { 'use strict';
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-vercel"] = {}, global.colors, global.spaceTrim$1, global.crypto));
5
+ })(this, (function (exports, colors, spaceTrim$1, crypto) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
9
9
  var colors__default = /*#__PURE__*/_interopDefaultLegacy(colors);
10
- var spaceTrim__default = /*#__PURE__*/_interopDefaultLegacy(spaceTrim);
10
+ var spaceTrim__default = /*#__PURE__*/_interopDefaultLegacy(spaceTrim$1);
11
11
 
12
12
  // ⚠️ WARNING: This code has been generated so that any manual changes will be overwritten
13
13
  /**
@@ -23,7 +23,7 @@
23
23
  * @generated
24
24
  * @see https://github.com/webgptorg/promptbook
25
25
  */
26
- const PROMPTBOOK_ENGINE_VERSION = '0.103.0-54';
26
+ const PROMPTBOOK_ENGINE_VERSION = '0.103.0-56';
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
@@ -596,6 +596,17 @@
596
596
  return new Date().toISOString();
597
597
  }
598
598
 
599
+ /**
600
+ * Trims string from all 4 sides
601
+ *
602
+ * Note: This is a re-exported function from the `spacetrim` package which is
603
+ * Developed by same author @hejny as this package
604
+ *
605
+ * @public exported from `@promptbook/utils`
606
+ * @see https://github.com/hejny/spacetrim#usage
607
+ */
608
+ const spaceTrim = spaceTrim$1.spaceTrim;
609
+
599
610
  /**
600
611
  * @private util of `@promptbook/color`
601
612
  * @de
@@ -644,6 +655,7 @@
644
655
  * @public exported from `@promptbook/color`
645
656
  */
646
657
  const CSS_COLORS = {
658
+ promptbook: '#79EAFD',
647
659
  transparent: 'rgba(0,0,0,0)',
648
660
  aliceblue: '#f0f8ff',
649
661
  antiquewhite: '#faebd7',
@@ -859,6 +871,28 @@
859
871
  throw new Error(`Can not create color from given object`);
860
872
  }
861
873
  }
874
+ /**
875
+ * Creates a new Color instance from miscellaneous formats
876
+ * It just does not throw error when it fails, it returns PROMPTBOOK_COLOR instead
877
+ *
878
+ * @param color
879
+ * @returns Color object
880
+ */
881
+ static fromSafe(color) {
882
+ try {
883
+ return Color.from(color);
884
+ }
885
+ catch (error) {
886
+ // <- Note: Can not use `assertsError(error)` here because it causes circular dependency
887
+ console.warn(spaceTrim((block) => `
888
+ Color.fromSafe error:
889
+ ${block(error.message)}
890
+
891
+ Returning default PROMPTBOOK_COLOR.
892
+ `));
893
+ return Color.fromString('promptbook');
894
+ }
895
+ }
862
896
  /**
863
897
  * Creates a new Color instance from miscellaneous string formats
864
898
  *
@@ -1448,7 +1482,7 @@
1448
1482
  *
1449
1483
  * @public exported from `@promptbook/core`
1450
1484
  */
1451
- const PROMPTBOOK_COLOR = Color.fromHex('#79EAFD');
1485
+ const PROMPTBOOK_COLOR = Color.fromString('promptbook');
1452
1486
  // <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
1453
1487
  /**
1454
1488
  * Colors for syntax highlighting in the `<BookEditor/>`
@@ -1600,7 +1634,7 @@
1600
1634
  */
1601
1635
  class UnexpectedError extends Error {
1602
1636
  constructor(message) {
1603
- super(spaceTrim.spaceTrim((block) => `
1637
+ super(spaceTrim$1.spaceTrim((block) => `
1604
1638
  ${block(message)}
1605
1639
 
1606
1640
  Note: This error should not happen.
@@ -1626,7 +1660,7 @@
1626
1660
  constructor(whatWasThrown) {
1627
1661
  const tag = `[🤮]`;
1628
1662
  console.error(tag, whatWasThrown);
1629
- super(spaceTrim.spaceTrim(`
1663
+ super(spaceTrim$1.spaceTrim(`
1630
1664
  Non-Error object was thrown
1631
1665
 
1632
1666
  Note: Look for ${tag} in the console for more details