@promptbook/core 0.111.0-10 → 0.111.0-11

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.
package/esm/index.es.js CHANGED
@@ -28,7 +28,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
28
28
  * @generated
29
29
  * @see https://github.com/webgptorg/promptbook
30
30
  */
31
- const PROMPTBOOK_ENGINE_VERSION = '0.111.0-10';
31
+ const PROMPTBOOK_ENGINE_VERSION = '0.111.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
@@ -12414,6 +12414,7 @@ class MessageSuffixCommitmentDefinition extends BaseCommitmentDefinition {
12414
12414
  * The META commitment handles all meta-information about the agent such as:
12415
12415
  * - META IMAGE: Sets the agent's avatar/profile image URL
12416
12416
  * - META LINK: Provides profile/source links for the person the agent models
12417
+ * - META DOMAIN: Sets the canonical custom domain/host of the agent
12417
12418
  * - META TITLE: Sets the agent's display title
12418
12419
  * - META DESCRIPTION: Sets the agent's description
12419
12420
  * - META [ANYTHING]: Any other meta information in uppercase format
@@ -12426,6 +12427,7 @@ class MessageSuffixCommitmentDefinition extends BaseCommitmentDefinition {
12426
12427
  * ```book
12427
12428
  * META IMAGE https://example.com/avatar.jpg
12428
12429
  * META LINK https://twitter.com/username
12430
+ * META DOMAIN my-agent.com
12429
12431
  * META TITLE Professional Assistant
12430
12432
  * META DESCRIPTION An AI assistant specialized in business tasks
12431
12433
  * META AUTHOR John Doe
@@ -12463,6 +12465,7 @@ class MetaCommitmentDefinition extends BaseCommitmentDefinition {
12463
12465
 
12464
12466
  - **META IMAGE** - Sets the agent's avatar/profile image URL
12465
12467
  - **META LINK** - Provides profile/source links for the person the agent models
12468
+ - **META DOMAIN** - Sets the canonical custom domain/host of the agent
12466
12469
  - **META TITLE** - Sets the agent's display title
12467
12470
  - **META DESCRIPTION** - Sets the agent's description
12468
12471
  - **META [ANYTHING]** - Any other meta information in uppercase format
@@ -12649,6 +12652,73 @@ class MetaColorCommitmentDefinition extends BaseCommitmentDefinition {
12649
12652
  * Note: [💞] Ignore a discrepancy between file name and entity name
12650
12653
  */
12651
12654
 
12655
+ /**
12656
+ * META DOMAIN commitment definition
12657
+ *
12658
+ * The `META DOMAIN` commitment sets the canonical host/domain of the agent.
12659
+ * This commitment is metadata-only and does not modify model requirements.
12660
+ *
12661
+ * @private [🪔] Maybe export the commitments through some package
12662
+ */
12663
+ class MetaDomainCommitmentDefinition extends BaseCommitmentDefinition {
12664
+ constructor() {
12665
+ super('META DOMAIN', ['DOMAIN']);
12666
+ }
12667
+ /**
12668
+ * Short one-line description of META DOMAIN.
12669
+ */
12670
+ get description() {
12671
+ return "Set the agent's canonical domain/host.";
12672
+ }
12673
+ /**
12674
+ * Icon for this commitment.
12675
+ */
12676
+ get icon() {
12677
+ return '🌐';
12678
+ }
12679
+ /**
12680
+ * Markdown documentation for META DOMAIN commitment.
12681
+ */
12682
+ get documentation() {
12683
+ return spaceTrim$1(`
12684
+ # META DOMAIN
12685
+
12686
+ Sets the canonical domain (host) of the agent, for example a custom domain that should open this agent directly.
12687
+
12688
+ ## Key aspects
12689
+
12690
+ - Does not modify the agent's behavior or responses.
12691
+ - Used by server routing to map incoming hostnames to this agent.
12692
+ - If multiple \`META DOMAIN\` commitments are specified, the last one takes precedence.
12693
+ - Prefer hostname-only values such as \`my-agent.com\`.
12694
+
12695
+ ## Examples
12696
+
12697
+ \`\`\`book
12698
+ My agent
12699
+
12700
+ PERSONA My agent is an expert in something.
12701
+ META DOMAIN my-agent.com
12702
+ \`\`\`
12703
+ `);
12704
+ }
12705
+ applyToAgentModelRequirements(requirements, content) {
12706
+ // META DOMAIN does not modify the model requirements.
12707
+ // It is consumed by profile parsing and server routing.
12708
+ return requirements;
12709
+ }
12710
+ /**
12711
+ * Extracts the domain value from commitment content.
12712
+ */
12713
+ extractDomain(content) {
12714
+ const trimmedContent = content.trim();
12715
+ return trimmedContent || null;
12716
+ }
12717
+ }
12718
+ /**
12719
+ * Note: [💞] Ignore a discrepancy between file name and entity name
12720
+ */
12721
+
12652
12722
  /**
12653
12723
  * META DISCLAIMER commitment definition
12654
12724
  *
@@ -16007,6 +16077,7 @@ const COMMITMENT_REGISTRY = [
16007
16077
  new MetaColorCommitmentDefinition(),
16008
16078
  new MetaFontCommitmentDefinition(),
16009
16079
  new MetaLinkCommitmentDefinition(),
16080
+ new MetaDomainCommitmentDefinition(),
16010
16081
  new MetaDisclaimerCommitmentDefinition(),
16011
16082
  new MetaCommitmentDefinition(),
16012
16083
  new MetaVoiceCommitmentDefinition(),
@@ -16726,6 +16797,42 @@ function isBinaryMimeType(mimeType) {
16726
16797
  return binaryPrefixes.some((prefix) => mimeType.startsWith(prefix));
16727
16798
  }
16728
16799
 
16800
+ /**
16801
+ * Normalizes a domain-like string into a comparable hostname form.
16802
+ *
16803
+ * The returned value is lowercased and stripped to hostname only
16804
+ * (protocol, path, query, hash, and port are removed).
16805
+ *
16806
+ * @param rawDomain - Raw domain value (for example `my-agent.com` or `https://my-agent.com/path`).
16807
+ * @returns Normalized hostname or `null` when the value cannot be normalized.
16808
+ * @private utility for host/domain matching
16809
+ */
16810
+ function normalizeDomainForMatching(rawDomain) {
16811
+ const trimmedDomain = rawDomain.trim();
16812
+ if (!trimmedDomain) {
16813
+ return null;
16814
+ }
16815
+ const candidateUrl = hasHttpProtocol(trimmedDomain) ? trimmedDomain : `https://${trimmedDomain}`;
16816
+ try {
16817
+ const parsedUrl = new URL(candidateUrl);
16818
+ const normalizedHostname = parsedUrl.hostname.trim().toLowerCase();
16819
+ return normalizedHostname || null;
16820
+ }
16821
+ catch (_a) {
16822
+ return null;
16823
+ }
16824
+ }
16825
+ /**
16826
+ * Checks whether the value already includes an HTTP(S) protocol prefix.
16827
+ *
16828
+ * @param value - Raw value to inspect.
16829
+ * @returns True when the value starts with `http://` or `https://`.
16830
+ * @private utility for host/domain matching
16831
+ */
16832
+ function hasHttpProtocol(value) {
16833
+ return value.startsWith('http://') || value.startsWith('https://');
16834
+ }
16835
+
16729
16836
  /**
16730
16837
  * Normalizes agent name from arbitrary string to valid agent name
16731
16838
  *
@@ -16987,6 +17094,10 @@ function parseAgentSource(agentSource) {
16987
17094
  meta.link = linkValue;
16988
17095
  continue;
16989
17096
  }
17097
+ if (commitment.type === 'META DOMAIN') {
17098
+ meta.domain = normalizeMetaDomain(commitment.content);
17099
+ continue;
17100
+ }
16990
17101
  if (commitment.type === 'META IMAGE') {
16991
17102
  meta.image = spaceTrim$2(commitment.content);
16992
17103
  continue;
@@ -17061,6 +17172,16 @@ function normalizeSeparator(content) {
17061
17172
  }
17062
17173
  return trimmed.split(/\s+/).join(', ');
17063
17174
  }
17175
+ /**
17176
+ * Normalizes META DOMAIN content to a hostname-like value when possible.
17177
+ *
17178
+ * @param content - Raw META DOMAIN content.
17179
+ * @returns Normalized domain or a trimmed fallback.
17180
+ */
17181
+ function normalizeMetaDomain(content) {
17182
+ const trimmed = spaceTrim$2(content);
17183
+ return normalizeDomainForMatching(trimmed) || trimmed.toLowerCase();
17184
+ }
17064
17185
  /**
17065
17186
  * TODO: [🕛] Unite `AgentBasicInformation`, `ChatParticipant`, `LlmExecutionTools` + `LlmToolsMetadata`
17066
17187
  */