@promptbook/node 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 +122 -1
- package/esm/index.es.js.map +1 -1
- package/esm/src/book-2.0/agent-source/AgentBasicInformation.d.ts +1 -0
- package/esm/src/commitments/META/META.d.ts +2 -0
- package/esm/src/commitments/META_DOMAIN/META_DOMAIN.d.ts +33 -0
- package/esm/src/commitments/index.d.ts +2 -1
- package/esm/src/utils/validators/url/normalizeDomainForMatching.d.ts +11 -0
- package/esm/src/utils/validators/url/normalizeDomainForMatching.test.d.ts +1 -0
- package/esm/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +122 -1
- package/umd/index.umd.js.map +1 -1
- package/umd/src/book-2.0/agent-source/AgentBasicInformation.d.ts +1 -0
- package/umd/src/commitments/META/META.d.ts +2 -0
- package/umd/src/commitments/META_DOMAIN/META_DOMAIN.d.ts +33 -0
- package/umd/src/commitments/index.d.ts +2 -1
- package/umd/src/utils/validators/url/normalizeDomainForMatching.d.ts +11 -0
- package/umd/src/utils/validators/url/normalizeDomainForMatching.test.d.ts +1 -0
- package/umd/src/version.d.ts +1 -1
package/esm/index.es.js
CHANGED
|
@@ -35,7 +35,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
35
35
|
* @generated
|
|
36
36
|
* @see https://github.com/webgptorg/promptbook
|
|
37
37
|
*/
|
|
38
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.111.0-
|
|
38
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.111.0-11';
|
|
39
39
|
/**
|
|
40
40
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
41
41
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -16038,6 +16038,7 @@ class MessageSuffixCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
16038
16038
|
* The META commitment handles all meta-information about the agent such as:
|
|
16039
16039
|
* - META IMAGE: Sets the agent's avatar/profile image URL
|
|
16040
16040
|
* - META LINK: Provides profile/source links for the person the agent models
|
|
16041
|
+
* - META DOMAIN: Sets the canonical custom domain/host of the agent
|
|
16041
16042
|
* - META TITLE: Sets the agent's display title
|
|
16042
16043
|
* - META DESCRIPTION: Sets the agent's description
|
|
16043
16044
|
* - META [ANYTHING]: Any other meta information in uppercase format
|
|
@@ -16050,6 +16051,7 @@ class MessageSuffixCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
16050
16051
|
* ```book
|
|
16051
16052
|
* META IMAGE https://example.com/avatar.jpg
|
|
16052
16053
|
* META LINK https://twitter.com/username
|
|
16054
|
+
* META DOMAIN my-agent.com
|
|
16053
16055
|
* META TITLE Professional Assistant
|
|
16054
16056
|
* META DESCRIPTION An AI assistant specialized in business tasks
|
|
16055
16057
|
* META AUTHOR John Doe
|
|
@@ -16087,6 +16089,7 @@ class MetaCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
16087
16089
|
|
|
16088
16090
|
- **META IMAGE** - Sets the agent's avatar/profile image URL
|
|
16089
16091
|
- **META LINK** - Provides profile/source links for the person the agent models
|
|
16092
|
+
- **META DOMAIN** - Sets the canonical custom domain/host of the agent
|
|
16090
16093
|
- **META TITLE** - Sets the agent's display title
|
|
16091
16094
|
- **META DESCRIPTION** - Sets the agent's description
|
|
16092
16095
|
- **META [ANYTHING]** - Any other meta information in uppercase format
|
|
@@ -16273,6 +16276,73 @@ class MetaColorCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
16273
16276
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
16274
16277
|
*/
|
|
16275
16278
|
|
|
16279
|
+
/**
|
|
16280
|
+
* META DOMAIN commitment definition
|
|
16281
|
+
*
|
|
16282
|
+
* The `META DOMAIN` commitment sets the canonical host/domain of the agent.
|
|
16283
|
+
* This commitment is metadata-only and does not modify model requirements.
|
|
16284
|
+
*
|
|
16285
|
+
* @private [🪔] Maybe export the commitments through some package
|
|
16286
|
+
*/
|
|
16287
|
+
class MetaDomainCommitmentDefinition extends BaseCommitmentDefinition {
|
|
16288
|
+
constructor() {
|
|
16289
|
+
super('META DOMAIN', ['DOMAIN']);
|
|
16290
|
+
}
|
|
16291
|
+
/**
|
|
16292
|
+
* Short one-line description of META DOMAIN.
|
|
16293
|
+
*/
|
|
16294
|
+
get description() {
|
|
16295
|
+
return "Set the agent's canonical domain/host.";
|
|
16296
|
+
}
|
|
16297
|
+
/**
|
|
16298
|
+
* Icon for this commitment.
|
|
16299
|
+
*/
|
|
16300
|
+
get icon() {
|
|
16301
|
+
return '🌐';
|
|
16302
|
+
}
|
|
16303
|
+
/**
|
|
16304
|
+
* Markdown documentation for META DOMAIN commitment.
|
|
16305
|
+
*/
|
|
16306
|
+
get documentation() {
|
|
16307
|
+
return spaceTrim$1(`
|
|
16308
|
+
# META DOMAIN
|
|
16309
|
+
|
|
16310
|
+
Sets the canonical domain (host) of the agent, for example a custom domain that should open this agent directly.
|
|
16311
|
+
|
|
16312
|
+
## Key aspects
|
|
16313
|
+
|
|
16314
|
+
- Does not modify the agent's behavior or responses.
|
|
16315
|
+
- Used by server routing to map incoming hostnames to this agent.
|
|
16316
|
+
- If multiple \`META DOMAIN\` commitments are specified, the last one takes precedence.
|
|
16317
|
+
- Prefer hostname-only values such as \`my-agent.com\`.
|
|
16318
|
+
|
|
16319
|
+
## Examples
|
|
16320
|
+
|
|
16321
|
+
\`\`\`book
|
|
16322
|
+
My agent
|
|
16323
|
+
|
|
16324
|
+
PERSONA My agent is an expert in something.
|
|
16325
|
+
META DOMAIN my-agent.com
|
|
16326
|
+
\`\`\`
|
|
16327
|
+
`);
|
|
16328
|
+
}
|
|
16329
|
+
applyToAgentModelRequirements(requirements, content) {
|
|
16330
|
+
// META DOMAIN does not modify the model requirements.
|
|
16331
|
+
// It is consumed by profile parsing and server routing.
|
|
16332
|
+
return requirements;
|
|
16333
|
+
}
|
|
16334
|
+
/**
|
|
16335
|
+
* Extracts the domain value from commitment content.
|
|
16336
|
+
*/
|
|
16337
|
+
extractDomain(content) {
|
|
16338
|
+
const trimmedContent = content.trim();
|
|
16339
|
+
return trimmedContent || null;
|
|
16340
|
+
}
|
|
16341
|
+
}
|
|
16342
|
+
/**
|
|
16343
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
16344
|
+
*/
|
|
16345
|
+
|
|
16276
16346
|
/**
|
|
16277
16347
|
* META DISCLAIMER commitment definition
|
|
16278
16348
|
*
|
|
@@ -19631,6 +19701,7 @@ const COMMITMENT_REGISTRY = [
|
|
|
19631
19701
|
new MetaColorCommitmentDefinition(),
|
|
19632
19702
|
new MetaFontCommitmentDefinition(),
|
|
19633
19703
|
new MetaLinkCommitmentDefinition(),
|
|
19704
|
+
new MetaDomainCommitmentDefinition(),
|
|
19634
19705
|
new MetaDisclaimerCommitmentDefinition(),
|
|
19635
19706
|
new MetaCommitmentDefinition(),
|
|
19636
19707
|
new MetaVoiceCommitmentDefinition(),
|
|
@@ -21563,6 +21634,42 @@ function createDefaultAgentName(agentSource) {
|
|
|
21563
21634
|
return normalizeAgentName(`Agent ${agentHash.substring(0, LIMITS.SHORT_NAME_LENGTH)}`);
|
|
21564
21635
|
}
|
|
21565
21636
|
|
|
21637
|
+
/**
|
|
21638
|
+
* Normalizes a domain-like string into a comparable hostname form.
|
|
21639
|
+
*
|
|
21640
|
+
* The returned value is lowercased and stripped to hostname only
|
|
21641
|
+
* (protocol, path, query, hash, and port are removed).
|
|
21642
|
+
*
|
|
21643
|
+
* @param rawDomain - Raw domain value (for example `my-agent.com` or `https://my-agent.com/path`).
|
|
21644
|
+
* @returns Normalized hostname or `null` when the value cannot be normalized.
|
|
21645
|
+
* @private utility for host/domain matching
|
|
21646
|
+
*/
|
|
21647
|
+
function normalizeDomainForMatching(rawDomain) {
|
|
21648
|
+
const trimmedDomain = rawDomain.trim();
|
|
21649
|
+
if (!trimmedDomain) {
|
|
21650
|
+
return null;
|
|
21651
|
+
}
|
|
21652
|
+
const candidateUrl = hasHttpProtocol(trimmedDomain) ? trimmedDomain : `https://${trimmedDomain}`;
|
|
21653
|
+
try {
|
|
21654
|
+
const parsedUrl = new URL(candidateUrl);
|
|
21655
|
+
const normalizedHostname = parsedUrl.hostname.trim().toLowerCase();
|
|
21656
|
+
return normalizedHostname || null;
|
|
21657
|
+
}
|
|
21658
|
+
catch (_a) {
|
|
21659
|
+
return null;
|
|
21660
|
+
}
|
|
21661
|
+
}
|
|
21662
|
+
/**
|
|
21663
|
+
* Checks whether the value already includes an HTTP(S) protocol prefix.
|
|
21664
|
+
*
|
|
21665
|
+
* @param value - Raw value to inspect.
|
|
21666
|
+
* @returns True when the value starts with `http://` or `https://`.
|
|
21667
|
+
* @private utility for host/domain matching
|
|
21668
|
+
*/
|
|
21669
|
+
function hasHttpProtocol(value) {
|
|
21670
|
+
return value.startsWith('http://') || value.startsWith('https://');
|
|
21671
|
+
}
|
|
21672
|
+
|
|
21566
21673
|
/**
|
|
21567
21674
|
* Regex pattern to match horizontal lines (markdown thematic breaks)
|
|
21568
21675
|
* Matches 3 or more hyphens, underscores, or asterisks (with optional spaces between)
|
|
@@ -22047,6 +22154,10 @@ function parseAgentSource(agentSource) {
|
|
|
22047
22154
|
meta.link = linkValue;
|
|
22048
22155
|
continue;
|
|
22049
22156
|
}
|
|
22157
|
+
if (commitment.type === 'META DOMAIN') {
|
|
22158
|
+
meta.domain = normalizeMetaDomain(commitment.content);
|
|
22159
|
+
continue;
|
|
22160
|
+
}
|
|
22050
22161
|
if (commitment.type === 'META IMAGE') {
|
|
22051
22162
|
meta.image = spaceTrim$2(commitment.content);
|
|
22052
22163
|
continue;
|
|
@@ -22121,6 +22232,16 @@ function normalizeSeparator(content) {
|
|
|
22121
22232
|
}
|
|
22122
22233
|
return trimmed.split(/\s+/).join(', ');
|
|
22123
22234
|
}
|
|
22235
|
+
/**
|
|
22236
|
+
* Normalizes META DOMAIN content to a hostname-like value when possible.
|
|
22237
|
+
*
|
|
22238
|
+
* @param content - Raw META DOMAIN content.
|
|
22239
|
+
* @returns Normalized domain or a trimmed fallback.
|
|
22240
|
+
*/
|
|
22241
|
+
function normalizeMetaDomain(content) {
|
|
22242
|
+
const trimmed = spaceTrim$2(content);
|
|
22243
|
+
return normalizeDomainForMatching(trimmed) || trimmed.toLowerCase();
|
|
22244
|
+
}
|
|
22124
22245
|
/**
|
|
22125
22246
|
* TODO: [🕛] Unite `AgentBasicInformation`, `ChatParticipant`, `LlmExecutionTools` + `LlmToolsMetadata`
|
|
22126
22247
|
*/
|