@promptbook/wizard 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
@@ -38,7 +38,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
38
38
  * @generated
39
39
  * @see https://github.com/webgptorg/promptbook
40
40
  */
41
- const PROMPTBOOK_ENGINE_VERSION = '0.111.0-10';
41
+ const PROMPTBOOK_ENGINE_VERSION = '0.111.0-11';
42
42
  /**
43
43
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
44
44
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -19759,6 +19759,7 @@ class MessageSuffixCommitmentDefinition extends BaseCommitmentDefinition {
19759
19759
  * The META commitment handles all meta-information about the agent such as:
19760
19760
  * - META IMAGE: Sets the agent's avatar/profile image URL
19761
19761
  * - META LINK: Provides profile/source links for the person the agent models
19762
+ * - META DOMAIN: Sets the canonical custom domain/host of the agent
19762
19763
  * - META TITLE: Sets the agent's display title
19763
19764
  * - META DESCRIPTION: Sets the agent's description
19764
19765
  * - META [ANYTHING]: Any other meta information in uppercase format
@@ -19771,6 +19772,7 @@ class MessageSuffixCommitmentDefinition extends BaseCommitmentDefinition {
19771
19772
  * ```book
19772
19773
  * META IMAGE https://example.com/avatar.jpg
19773
19774
  * META LINK https://twitter.com/username
19775
+ * META DOMAIN my-agent.com
19774
19776
  * META TITLE Professional Assistant
19775
19777
  * META DESCRIPTION An AI assistant specialized in business tasks
19776
19778
  * META AUTHOR John Doe
@@ -19808,6 +19810,7 @@ class MetaCommitmentDefinition extends BaseCommitmentDefinition {
19808
19810
 
19809
19811
  - **META IMAGE** - Sets the agent's avatar/profile image URL
19810
19812
  - **META LINK** - Provides profile/source links for the person the agent models
19813
+ - **META DOMAIN** - Sets the canonical custom domain/host of the agent
19811
19814
  - **META TITLE** - Sets the agent's display title
19812
19815
  - **META DESCRIPTION** - Sets the agent's description
19813
19816
  - **META [ANYTHING]** - Any other meta information in uppercase format
@@ -19994,6 +19997,73 @@ class MetaColorCommitmentDefinition extends BaseCommitmentDefinition {
19994
19997
  * Note: [💞] Ignore a discrepancy between file name and entity name
19995
19998
  */
19996
19999
 
20000
+ /**
20001
+ * META DOMAIN commitment definition
20002
+ *
20003
+ * The `META DOMAIN` commitment sets the canonical host/domain of the agent.
20004
+ * This commitment is metadata-only and does not modify model requirements.
20005
+ *
20006
+ * @private [🪔] Maybe export the commitments through some package
20007
+ */
20008
+ class MetaDomainCommitmentDefinition extends BaseCommitmentDefinition {
20009
+ constructor() {
20010
+ super('META DOMAIN', ['DOMAIN']);
20011
+ }
20012
+ /**
20013
+ * Short one-line description of META DOMAIN.
20014
+ */
20015
+ get description() {
20016
+ return "Set the agent's canonical domain/host.";
20017
+ }
20018
+ /**
20019
+ * Icon for this commitment.
20020
+ */
20021
+ get icon() {
20022
+ return '🌐';
20023
+ }
20024
+ /**
20025
+ * Markdown documentation for META DOMAIN commitment.
20026
+ */
20027
+ get documentation() {
20028
+ return spaceTrim$1(`
20029
+ # META DOMAIN
20030
+
20031
+ Sets the canonical domain (host) of the agent, for example a custom domain that should open this agent directly.
20032
+
20033
+ ## Key aspects
20034
+
20035
+ - Does not modify the agent's behavior or responses.
20036
+ - Used by server routing to map incoming hostnames to this agent.
20037
+ - If multiple \`META DOMAIN\` commitments are specified, the last one takes precedence.
20038
+ - Prefer hostname-only values such as \`my-agent.com\`.
20039
+
20040
+ ## Examples
20041
+
20042
+ \`\`\`book
20043
+ My agent
20044
+
20045
+ PERSONA My agent is an expert in something.
20046
+ META DOMAIN my-agent.com
20047
+ \`\`\`
20048
+ `);
20049
+ }
20050
+ applyToAgentModelRequirements(requirements, content) {
20051
+ // META DOMAIN does not modify the model requirements.
20052
+ // It is consumed by profile parsing and server routing.
20053
+ return requirements;
20054
+ }
20055
+ /**
20056
+ * Extracts the domain value from commitment content.
20057
+ */
20058
+ extractDomain(content) {
20059
+ const trimmedContent = content.trim();
20060
+ return trimmedContent || null;
20061
+ }
20062
+ }
20063
+ /**
20064
+ * Note: [💞] Ignore a discrepancy between file name and entity name
20065
+ */
20066
+
19997
20067
  /**
19998
20068
  * META DISCLAIMER commitment definition
19999
20069
  *
@@ -23352,6 +23422,7 @@ const COMMITMENT_REGISTRY = [
23352
23422
  new MetaColorCommitmentDefinition(),
23353
23423
  new MetaFontCommitmentDefinition(),
23354
23424
  new MetaLinkCommitmentDefinition(),
23425
+ new MetaDomainCommitmentDefinition(),
23355
23426
  new MetaDisclaimerCommitmentDefinition(),
23356
23427
  new MetaCommitmentDefinition(),
23357
23428
  new MetaVoiceCommitmentDefinition(),
@@ -24071,6 +24142,42 @@ function isBinaryMimeType(mimeType) {
24071
24142
  return binaryPrefixes.some((prefix) => mimeType.startsWith(prefix));
24072
24143
  }
24073
24144
 
24145
+ /**
24146
+ * Normalizes a domain-like string into a comparable hostname form.
24147
+ *
24148
+ * The returned value is lowercased and stripped to hostname only
24149
+ * (protocol, path, query, hash, and port are removed).
24150
+ *
24151
+ * @param rawDomain - Raw domain value (for example `my-agent.com` or `https://my-agent.com/path`).
24152
+ * @returns Normalized hostname or `null` when the value cannot be normalized.
24153
+ * @private utility for host/domain matching
24154
+ */
24155
+ function normalizeDomainForMatching(rawDomain) {
24156
+ const trimmedDomain = rawDomain.trim();
24157
+ if (!trimmedDomain) {
24158
+ return null;
24159
+ }
24160
+ const candidateUrl = hasHttpProtocol(trimmedDomain) ? trimmedDomain : `https://${trimmedDomain}`;
24161
+ try {
24162
+ const parsedUrl = new URL(candidateUrl);
24163
+ const normalizedHostname = parsedUrl.hostname.trim().toLowerCase();
24164
+ return normalizedHostname || null;
24165
+ }
24166
+ catch (_a) {
24167
+ return null;
24168
+ }
24169
+ }
24170
+ /**
24171
+ * Checks whether the value already includes an HTTP(S) protocol prefix.
24172
+ *
24173
+ * @param value - Raw value to inspect.
24174
+ * @returns True when the value starts with `http://` or `https://`.
24175
+ * @private utility for host/domain matching
24176
+ */
24177
+ function hasHttpProtocol(value) {
24178
+ return value.startsWith('http://') || value.startsWith('https://');
24179
+ }
24180
+
24074
24181
  /**
24075
24182
  * Computes SHA-256 hash of the agent source
24076
24183
  *
@@ -24341,6 +24448,10 @@ function parseAgentSource(agentSource) {
24341
24448
  meta.link = linkValue;
24342
24449
  continue;
24343
24450
  }
24451
+ if (commitment.type === 'META DOMAIN') {
24452
+ meta.domain = normalizeMetaDomain(commitment.content);
24453
+ continue;
24454
+ }
24344
24455
  if (commitment.type === 'META IMAGE') {
24345
24456
  meta.image = spaceTrim$2(commitment.content);
24346
24457
  continue;
@@ -24415,6 +24526,16 @@ function normalizeSeparator(content) {
24415
24526
  }
24416
24527
  return trimmed.split(/\s+/).join(', ');
24417
24528
  }
24529
+ /**
24530
+ * Normalizes META DOMAIN content to a hostname-like value when possible.
24531
+ *
24532
+ * @param content - Raw META DOMAIN content.
24533
+ * @returns Normalized domain or a trimmed fallback.
24534
+ */
24535
+ function normalizeMetaDomain(content) {
24536
+ const trimmed = spaceTrim$2(content);
24537
+ return normalizeDomainForMatching(trimmed) || trimmed.toLowerCase();
24538
+ }
24418
24539
  /**
24419
24540
  * TODO: [🕛] Unite `AgentBasicInformation`, `ChatParticipant`, `LlmExecutionTools` + `LlmToolsMetadata`
24420
24541
  */