@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.
@@ -82,6 +82,7 @@ export type AgentBasicInformation = {
82
82
  disclaimer?: string;
83
83
  messageSuffix?: string;
84
84
  image?: string_url_image;
85
+ domain?: string;
85
86
  font?: string_fonts;
86
87
  color?: string_color;
87
88
  voice?: string;
@@ -6,6 +6,7 @@ import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
6
6
  * The META commitment handles all meta-information about the agent such as:
7
7
  * - META IMAGE: Sets the agent's avatar/profile image URL
8
8
  * - META LINK: Provides profile/source links for the person the agent models
9
+ * - META DOMAIN: Sets the canonical custom domain/host of the agent
9
10
  * - META TITLE: Sets the agent's display title
10
11
  * - META DESCRIPTION: Sets the agent's description
11
12
  * - META [ANYTHING]: Any other meta information in uppercase format
@@ -18,6 +19,7 @@ import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
18
19
  * ```book
19
20
  * META IMAGE https://example.com/avatar.jpg
20
21
  * META LINK https://twitter.com/username
22
+ * META DOMAIN my-agent.com
21
23
  * META TITLE Professional Assistant
22
24
  * META DESCRIPTION An AI assistant specialized in business tasks
23
25
  * META AUTHOR John Doe
@@ -0,0 +1,33 @@
1
+ import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
2
+ import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
3
+ /**
4
+ * META DOMAIN commitment definition
5
+ *
6
+ * The `META DOMAIN` commitment sets the canonical host/domain of the agent.
7
+ * This commitment is metadata-only and does not modify model requirements.
8
+ *
9
+ * @private [🪔] Maybe export the commitments through some package
10
+ */
11
+ export declare class MetaDomainCommitmentDefinition extends BaseCommitmentDefinition<'META DOMAIN'> {
12
+ constructor();
13
+ /**
14
+ * Short one-line description of META DOMAIN.
15
+ */
16
+ get description(): string;
17
+ /**
18
+ * Icon for this commitment.
19
+ */
20
+ get icon(): string;
21
+ /**
22
+ * Markdown documentation for META DOMAIN commitment.
23
+ */
24
+ get documentation(): string;
25
+ applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
26
+ /**
27
+ * Extracts the domain value from commitment content.
28
+ */
29
+ extractDomain(content: string): string | null;
30
+ }
31
+ /**
32
+ * Note: [💞] Ignore a discrepancy between file name and entity name
33
+ */
@@ -17,6 +17,7 @@ import { UserMessageCommitmentDefinition } from './MESSAGE/UserMessageCommitment
17
17
  import { MessageSuffixCommitmentDefinition } from './MESSAGE_SUFFIX/MESSAGE_SUFFIX';
18
18
  import { MetaCommitmentDefinition } from './META/META';
19
19
  import { MetaColorCommitmentDefinition } from './META_COLOR/META_COLOR';
20
+ import { MetaDomainCommitmentDefinition } from './META_DOMAIN/META_DOMAIN';
20
21
  import { MetaDisclaimerCommitmentDefinition } from './META_DISCLAIMER/META_DISCLAIMER';
21
22
  import { MetaFontCommitmentDefinition } from './META_FONT/META_FONT';
22
23
  import { MetaImageCommitmentDefinition } from './META_IMAGE/META_IMAGE';
@@ -48,7 +49,7 @@ import { NotYetImplementedCommitmentDefinition } from './_base/NotYetImplemented
48
49
  *
49
50
  * @private Use functions to access commitments instead of this array directly
50
51
  */
51
- export declare const COMMITMENT_REGISTRY: readonly [PersonaCommitmentDefinition, PersonaCommitmentDefinition, KnowledgeCommitmentDefinition, MemoryCommitmentDefinition, MemoryCommitmentDefinition, StyleCommitmentDefinition, StyleCommitmentDefinition, RuleCommitmentDefinition, RuleCommitmentDefinition, LanguageCommitmentDefinition, LanguageCommitmentDefinition, SampleCommitmentDefinition, SampleCommitmentDefinition, FormatCommitmentDefinition, FormatCommitmentDefinition, TemplateCommitmentDefinition, TemplateCommitmentDefinition, FromCommitmentDefinition, ImportCommitmentDefinition, ImportCommitmentDefinition, ModelCommitmentDefinition, ModelCommitmentDefinition, ActionCommitmentDefinition, ActionCommitmentDefinition, ComponentCommitmentDefinition, MetaImageCommitmentDefinition, MetaColorCommitmentDefinition, MetaFontCommitmentDefinition, MetaLinkCommitmentDefinition, MetaDisclaimerCommitmentDefinition, MetaCommitmentDefinition, MetaVoiceCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, GoalCommitmentDefinition, GoalCommitmentDefinition, InitialMessageCommitmentDefinition, UserMessageCommitmentDefinition, AgentMessageCommitmentDefinition, MessageSuffixCommitmentDefinition, MessageCommitmentDefinition, MessageCommitmentDefinition, ScenarioCommitmentDefinition, ScenarioCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DictionaryCommitmentDefinition, OpenCommitmentDefinition, ClosedCommitmentDefinition, TeamCommitmentDefinition, UseBrowserCommitmentDefinition, UseSearchEngineCommitmentDefinition, UseTimeCommitmentDefinition, UseUserLocationCommitmentDefinition, UseEmailCommitmentDefinition, UseImageGeneratorCommitmentDefinition, UseMcpCommitmentDefinition, UseCommitmentDefinition, NotYetImplementedCommitmentDefinition<"EXPECT">, NotYetImplementedCommitmentDefinition<"BEHAVIOUR">, NotYetImplementedCommitmentDefinition<"BEHAVIOURS">, NotYetImplementedCommitmentDefinition<"AVOID">, NotYetImplementedCommitmentDefinition<"AVOIDANCE">, NotYetImplementedCommitmentDefinition<"CONTEXT">];
52
+ export declare const COMMITMENT_REGISTRY: readonly [PersonaCommitmentDefinition, PersonaCommitmentDefinition, KnowledgeCommitmentDefinition, MemoryCommitmentDefinition, MemoryCommitmentDefinition, StyleCommitmentDefinition, StyleCommitmentDefinition, RuleCommitmentDefinition, RuleCommitmentDefinition, LanguageCommitmentDefinition, LanguageCommitmentDefinition, SampleCommitmentDefinition, SampleCommitmentDefinition, FormatCommitmentDefinition, FormatCommitmentDefinition, TemplateCommitmentDefinition, TemplateCommitmentDefinition, FromCommitmentDefinition, ImportCommitmentDefinition, ImportCommitmentDefinition, ModelCommitmentDefinition, ModelCommitmentDefinition, ActionCommitmentDefinition, ActionCommitmentDefinition, ComponentCommitmentDefinition, MetaImageCommitmentDefinition, MetaColorCommitmentDefinition, MetaFontCommitmentDefinition, MetaLinkCommitmentDefinition, MetaDomainCommitmentDefinition, MetaDisclaimerCommitmentDefinition, MetaCommitmentDefinition, MetaVoiceCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, GoalCommitmentDefinition, GoalCommitmentDefinition, InitialMessageCommitmentDefinition, UserMessageCommitmentDefinition, AgentMessageCommitmentDefinition, MessageSuffixCommitmentDefinition, MessageCommitmentDefinition, MessageCommitmentDefinition, ScenarioCommitmentDefinition, ScenarioCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DictionaryCommitmentDefinition, OpenCommitmentDefinition, ClosedCommitmentDefinition, TeamCommitmentDefinition, UseBrowserCommitmentDefinition, UseSearchEngineCommitmentDefinition, UseTimeCommitmentDefinition, UseUserLocationCommitmentDefinition, UseEmailCommitmentDefinition, UseImageGeneratorCommitmentDefinition, UseMcpCommitmentDefinition, UseCommitmentDefinition, NotYetImplementedCommitmentDefinition<"EXPECT">, NotYetImplementedCommitmentDefinition<"BEHAVIOUR">, NotYetImplementedCommitmentDefinition<"BEHAVIOURS">, NotYetImplementedCommitmentDefinition<"AVOID">, NotYetImplementedCommitmentDefinition<"AVOIDANCE">, NotYetImplementedCommitmentDefinition<"CONTEXT">];
52
53
  /**
53
54
  * TODO: [🧠] Maybe create through standardized $register
54
55
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Normalizes a domain-like string into a comparable hostname form.
3
+ *
4
+ * The returned value is lowercased and stripped to hostname only
5
+ * (protocol, path, query, hash, and port are removed).
6
+ *
7
+ * @param rawDomain - Raw domain value (for example `my-agent.com` or `https://my-agent.com/path`).
8
+ * @returns Normalized hostname or `null` when the value cannot be normalized.
9
+ * @private utility for host/domain matching
10
+ */
11
+ export declare function normalizeDomainForMatching(rawDomain: string): string | null;
@@ -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.111.0-9`).
18
+ * It follows semantic versioning (e.g., `0.111.0-10`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/node",
3
- "version": "0.111.0-10",
3
+ "version": "0.111.0-11",
4
4
  "description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -96,7 +96,7 @@
96
96
  "module": "./esm/index.es.js",
97
97
  "typings": "./esm/typings/src/_packages/node.index.d.ts",
98
98
  "peerDependencies": {
99
- "@promptbook/core": "0.111.0-10"
99
+ "@promptbook/core": "0.111.0-11"
100
100
  },
101
101
  "dependencies": {
102
102
  "@mozilla/readability": "0.6.0",
package/umd/index.umd.js CHANGED
@@ -48,7 +48,7 @@
48
48
  * @generated
49
49
  * @see https://github.com/webgptorg/promptbook
50
50
  */
51
- const PROMPTBOOK_ENGINE_VERSION = '0.111.0-10';
51
+ const PROMPTBOOK_ENGINE_VERSION = '0.111.0-11';
52
52
  /**
53
53
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
54
54
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -16051,6 +16051,7 @@
16051
16051
  * The META commitment handles all meta-information about the agent such as:
16052
16052
  * - META IMAGE: Sets the agent's avatar/profile image URL
16053
16053
  * - META LINK: Provides profile/source links for the person the agent models
16054
+ * - META DOMAIN: Sets the canonical custom domain/host of the agent
16054
16055
  * - META TITLE: Sets the agent's display title
16055
16056
  * - META DESCRIPTION: Sets the agent's description
16056
16057
  * - META [ANYTHING]: Any other meta information in uppercase format
@@ -16063,6 +16064,7 @@
16063
16064
  * ```book
16064
16065
  * META IMAGE https://example.com/avatar.jpg
16065
16066
  * META LINK https://twitter.com/username
16067
+ * META DOMAIN my-agent.com
16066
16068
  * META TITLE Professional Assistant
16067
16069
  * META DESCRIPTION An AI assistant specialized in business tasks
16068
16070
  * META AUTHOR John Doe
@@ -16100,6 +16102,7 @@
16100
16102
 
16101
16103
  - **META IMAGE** - Sets the agent's avatar/profile image URL
16102
16104
  - **META LINK** - Provides profile/source links for the person the agent models
16105
+ - **META DOMAIN** - Sets the canonical custom domain/host of the agent
16103
16106
  - **META TITLE** - Sets the agent's display title
16104
16107
  - **META DESCRIPTION** - Sets the agent's description
16105
16108
  - **META [ANYTHING]** - Any other meta information in uppercase format
@@ -16286,6 +16289,73 @@
16286
16289
  * Note: [💞] Ignore a discrepancy between file name and entity name
16287
16290
  */
16288
16291
 
16292
+ /**
16293
+ * META DOMAIN commitment definition
16294
+ *
16295
+ * The `META DOMAIN` commitment sets the canonical host/domain of the agent.
16296
+ * This commitment is metadata-only and does not modify model requirements.
16297
+ *
16298
+ * @private [🪔] Maybe export the commitments through some package
16299
+ */
16300
+ class MetaDomainCommitmentDefinition extends BaseCommitmentDefinition {
16301
+ constructor() {
16302
+ super('META DOMAIN', ['DOMAIN']);
16303
+ }
16304
+ /**
16305
+ * Short one-line description of META DOMAIN.
16306
+ */
16307
+ get description() {
16308
+ return "Set the agent's canonical domain/host.";
16309
+ }
16310
+ /**
16311
+ * Icon for this commitment.
16312
+ */
16313
+ get icon() {
16314
+ return '🌐';
16315
+ }
16316
+ /**
16317
+ * Markdown documentation for META DOMAIN commitment.
16318
+ */
16319
+ get documentation() {
16320
+ return spaceTrim$1.spaceTrim(`
16321
+ # META DOMAIN
16322
+
16323
+ Sets the canonical domain (host) of the agent, for example a custom domain that should open this agent directly.
16324
+
16325
+ ## Key aspects
16326
+
16327
+ - Does not modify the agent's behavior or responses.
16328
+ - Used by server routing to map incoming hostnames to this agent.
16329
+ - If multiple \`META DOMAIN\` commitments are specified, the last one takes precedence.
16330
+ - Prefer hostname-only values such as \`my-agent.com\`.
16331
+
16332
+ ## Examples
16333
+
16334
+ \`\`\`book
16335
+ My agent
16336
+
16337
+ PERSONA My agent is an expert in something.
16338
+ META DOMAIN my-agent.com
16339
+ \`\`\`
16340
+ `);
16341
+ }
16342
+ applyToAgentModelRequirements(requirements, content) {
16343
+ // META DOMAIN does not modify the model requirements.
16344
+ // It is consumed by profile parsing and server routing.
16345
+ return requirements;
16346
+ }
16347
+ /**
16348
+ * Extracts the domain value from commitment content.
16349
+ */
16350
+ extractDomain(content) {
16351
+ const trimmedContent = content.trim();
16352
+ return trimmedContent || null;
16353
+ }
16354
+ }
16355
+ /**
16356
+ * Note: [💞] Ignore a discrepancy between file name and entity name
16357
+ */
16358
+
16289
16359
  /**
16290
16360
  * META DISCLAIMER commitment definition
16291
16361
  *
@@ -19644,6 +19714,7 @@
19644
19714
  new MetaColorCommitmentDefinition(),
19645
19715
  new MetaFontCommitmentDefinition(),
19646
19716
  new MetaLinkCommitmentDefinition(),
19717
+ new MetaDomainCommitmentDefinition(),
19647
19718
  new MetaDisclaimerCommitmentDefinition(),
19648
19719
  new MetaCommitmentDefinition(),
19649
19720
  new MetaVoiceCommitmentDefinition(),
@@ -21576,6 +21647,42 @@
21576
21647
  return normalizeAgentName(`Agent ${agentHash.substring(0, LIMITS.SHORT_NAME_LENGTH)}`);
21577
21648
  }
21578
21649
 
21650
+ /**
21651
+ * Normalizes a domain-like string into a comparable hostname form.
21652
+ *
21653
+ * The returned value is lowercased and stripped to hostname only
21654
+ * (protocol, path, query, hash, and port are removed).
21655
+ *
21656
+ * @param rawDomain - Raw domain value (for example `my-agent.com` or `https://my-agent.com/path`).
21657
+ * @returns Normalized hostname or `null` when the value cannot be normalized.
21658
+ * @private utility for host/domain matching
21659
+ */
21660
+ function normalizeDomainForMatching(rawDomain) {
21661
+ const trimmedDomain = rawDomain.trim();
21662
+ if (!trimmedDomain) {
21663
+ return null;
21664
+ }
21665
+ const candidateUrl = hasHttpProtocol(trimmedDomain) ? trimmedDomain : `https://${trimmedDomain}`;
21666
+ try {
21667
+ const parsedUrl = new URL(candidateUrl);
21668
+ const normalizedHostname = parsedUrl.hostname.trim().toLowerCase();
21669
+ return normalizedHostname || null;
21670
+ }
21671
+ catch (_a) {
21672
+ return null;
21673
+ }
21674
+ }
21675
+ /**
21676
+ * Checks whether the value already includes an HTTP(S) protocol prefix.
21677
+ *
21678
+ * @param value - Raw value to inspect.
21679
+ * @returns True when the value starts with `http://` or `https://`.
21680
+ * @private utility for host/domain matching
21681
+ */
21682
+ function hasHttpProtocol(value) {
21683
+ return value.startsWith('http://') || value.startsWith('https://');
21684
+ }
21685
+
21579
21686
  /**
21580
21687
  * Regex pattern to match horizontal lines (markdown thematic breaks)
21581
21688
  * Matches 3 or more hyphens, underscores, or asterisks (with optional spaces between)
@@ -22060,6 +22167,10 @@
22060
22167
  meta.link = linkValue;
22061
22168
  continue;
22062
22169
  }
22170
+ if (commitment.type === 'META DOMAIN') {
22171
+ meta.domain = normalizeMetaDomain(commitment.content);
22172
+ continue;
22173
+ }
22063
22174
  if (commitment.type === 'META IMAGE') {
22064
22175
  meta.image = spaceTrim__default["default"](commitment.content);
22065
22176
  continue;
@@ -22134,6 +22245,16 @@
22134
22245
  }
22135
22246
  return trimmed.split(/\s+/).join(', ');
22136
22247
  }
22248
+ /**
22249
+ * Normalizes META DOMAIN content to a hostname-like value when possible.
22250
+ *
22251
+ * @param content - Raw META DOMAIN content.
22252
+ * @returns Normalized domain or a trimmed fallback.
22253
+ */
22254
+ function normalizeMetaDomain(content) {
22255
+ const trimmed = spaceTrim__default["default"](content);
22256
+ return normalizeDomainForMatching(trimmed) || trimmed.toLowerCase();
22257
+ }
22137
22258
  /**
22138
22259
  * TODO: [🕛] Unite `AgentBasicInformation`, `ChatParticipant`, `LlmExecutionTools` + `LlmToolsMetadata`
22139
22260
  */