@promptbook/components 0.112.0 → 0.113.0-0
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/README.md +45 -29
- package/esm/index.es.js +139 -13
- package/esm/index.es.js.map +1 -1
- package/esm/src/_packages/core.index.d.ts +22 -0
- package/esm/src/_packages/types.index.d.ts +2 -0
- package/esm/src/book-2.0/agent-source/AgentBasicInformation.d.ts +2 -0
- package/esm/src/book-2.0/agent-source/agentSourceVisibility.d.ts +97 -0
- package/esm/src/book-2.0/agent-source/agentSourceVisibility.test.d.ts +1 -0
- package/esm/src/book-components/BookEditor/BookEditorMonacoTokenization.d.ts +1 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer.d.ts +6 -0
- package/esm/src/collection/agent-collection/CreateAgentInput.d.ts +2 -1
- package/esm/src/collection/agent-collection/constructors/agent-collection-in-supabase/prepareAgentSourceForPersistence.d.ts +21 -1
- package/esm/src/commitments/META_VISIBILITY/META_VISIBILITY.d.ts +27 -0
- package/esm/src/commitments/index.d.ts +2 -1
- package/esm/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +139 -13
- package/umd/index.umd.js.map +1 -1
- package/umd/src/_packages/core.index.d.ts +22 -0
- package/umd/src/_packages/types.index.d.ts +2 -0
- package/umd/src/book-2.0/agent-source/AgentBasicInformation.d.ts +2 -0
- package/umd/src/book-2.0/agent-source/agentSourceVisibility.d.ts +97 -0
- package/umd/src/book-2.0/agent-source/agentSourceVisibility.test.d.ts +1 -0
- package/umd/src/book-components/BookEditor/BookEditorMonacoTokenization.d.ts +1 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer.d.ts +6 -0
- package/umd/src/collection/agent-collection/CreateAgentInput.d.ts +2 -1
- package/umd/src/collection/agent-collection/constructors/agent-collection-in-supabase/prepareAgentSourceForPersistence.d.ts +21 -1
- package/umd/src/commitments/META_VISIBILITY/META_VISIBILITY.d.ts +27 -0
- package/umd/src/commitments/index.d.ts +2 -1
- package/umd/src/version.d.ts +1 -1
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION } from '../version';
|
|
2
|
+
import { AGENT_VISIBILITY_VALUES } from '../book-2.0/agent-source/agentSourceVisibility';
|
|
3
|
+
import type { AgentVisibility } from '../book-2.0/agent-source/agentSourceVisibility';
|
|
4
|
+
import { DEFAULT_AGENT_VISIBILITY } from '../book-2.0/agent-source/agentSourceVisibility';
|
|
5
|
+
import { isAgentVisibility } from '../book-2.0/agent-source/agentSourceVisibility';
|
|
6
|
+
import { normalizeAgentVisibility } from '../book-2.0/agent-source/agentSourceVisibility';
|
|
7
|
+
import { parseAgentVisibility } from '../book-2.0/agent-source/agentSourceVisibility';
|
|
8
|
+
import { parseAgentVisibilityStrict } from '../book-2.0/agent-source/agentSourceVisibility';
|
|
9
|
+
import { parseAgentSourceVisibility } from '../book-2.0/agent-source/agentSourceVisibility';
|
|
10
|
+
import { isPublicAgentVisibility } from '../book-2.0/agent-source/agentSourceVisibility';
|
|
11
|
+
import { getNextAgentVisibility } from '../book-2.0/agent-source/agentSourceVisibility';
|
|
12
|
+
import { setAgentSourceVisibility } from '../book-2.0/agent-source/agentSourceVisibility';
|
|
2
13
|
import { computeAgentHash } from '../book-2.0/agent-source/computeAgentHash';
|
|
3
14
|
import { createAgentModelRequirements } from '../book-2.0/agent-source/createAgentModelRequirements';
|
|
4
15
|
import type { CreateAgentModelRequirementsOptions } from '../book-2.0/agent-source/CreateAgentModelRequirementsOptions';
|
|
@@ -224,6 +235,17 @@ import { $generateBookBoilerplate } from '../utils/random/$generateBookBoilerpla
|
|
|
224
235
|
import { CORE_AGENTS_SERVER_WELL_KNOWN_AGENT_NAMES } from '../../servers';
|
|
225
236
|
import { PUBLIC_AGENTS_SERVERS } from '../../servers';
|
|
226
237
|
export { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION };
|
|
238
|
+
export { AGENT_VISIBILITY_VALUES };
|
|
239
|
+
export type { AgentVisibility };
|
|
240
|
+
export { DEFAULT_AGENT_VISIBILITY };
|
|
241
|
+
export { isAgentVisibility };
|
|
242
|
+
export { normalizeAgentVisibility };
|
|
243
|
+
export { parseAgentVisibility };
|
|
244
|
+
export { parseAgentVisibilityStrict };
|
|
245
|
+
export { parseAgentSourceVisibility };
|
|
246
|
+
export { isPublicAgentVisibility };
|
|
247
|
+
export { getNextAgentVisibility };
|
|
248
|
+
export { setAgentSourceVisibility };
|
|
227
249
|
export { computeAgentHash };
|
|
228
250
|
export { createAgentModelRequirements };
|
|
229
251
|
export type { CreateAgentModelRequirementsOptions };
|
|
@@ -2,6 +2,7 @@ import type { BookParameter } from '../book-2.0/agent-source/AgentBasicInformati
|
|
|
2
2
|
import type { AgentCapability } from '../book-2.0/agent-source/AgentBasicInformation';
|
|
3
3
|
import type { AgentBasicInformation } from '../book-2.0/agent-source/AgentBasicInformation';
|
|
4
4
|
import type { AgentModelRequirements } from '../book-2.0/agent-source/AgentModelRequirements';
|
|
5
|
+
import type { AgentVisibility } from '../book-2.0/agent-source/agentSourceVisibility';
|
|
5
6
|
import type { CreateAgentModelRequirementsOptions } from '../book-2.0/agent-source/CreateAgentModelRequirementsOptions';
|
|
6
7
|
import type { string_book } from '../book-2.0/agent-source/string_book';
|
|
7
8
|
import type { BookNodeAgentSource } from '../book-3.0/BookNodeAgentSource';
|
|
@@ -444,6 +445,7 @@ export type { BookParameter };
|
|
|
444
445
|
export type { AgentCapability };
|
|
445
446
|
export type { AgentBasicInformation };
|
|
446
447
|
export type { AgentModelRequirements };
|
|
448
|
+
export type { AgentVisibility };
|
|
447
449
|
export type { CreateAgentModelRequirementsOptions };
|
|
448
450
|
export type { string_book };
|
|
449
451
|
export type { BookNodeAgentSource };
|
|
@@ -4,6 +4,7 @@ import type { string_agent_url } from '../../types/string_agent_url';
|
|
|
4
4
|
import type { string_fonts } from '../../types/string_markdown';
|
|
5
5
|
import type { string_color } from '../../types/string_person_fullname';
|
|
6
6
|
import type { string_url_image } from '../../types/string_url_image';
|
|
7
|
+
import type { AgentVisibility } from './agentSourceVisibility';
|
|
7
8
|
/**
|
|
8
9
|
* Unified parameter representation that supports two different notations:
|
|
9
10
|
* 1. @Parameter - single word parameter starting with @
|
|
@@ -97,6 +98,7 @@ export type AgentBasicInformation = {
|
|
|
97
98
|
font?: string_fonts;
|
|
98
99
|
color?: string_color;
|
|
99
100
|
voice?: string;
|
|
101
|
+
visibility?: AgentVisibility;
|
|
100
102
|
[key: string]: string | undefined;
|
|
101
103
|
};
|
|
102
104
|
/**
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import type { string_book } from './string_book';
|
|
2
|
+
/**
|
|
3
|
+
* Supported visibility states for persisted agents.
|
|
4
|
+
*
|
|
5
|
+
* @public exported from `@promptbook/core`
|
|
6
|
+
*/
|
|
7
|
+
export declare const AGENT_VISIBILITY_VALUES: readonly ["PRIVATE", "UNLISTED", "PUBLIC"];
|
|
8
|
+
/**
|
|
9
|
+
* Canonical visibility union for agents.
|
|
10
|
+
*
|
|
11
|
+
* @public exported from `@promptbook/core`
|
|
12
|
+
*/
|
|
13
|
+
export type AgentVisibility = (typeof AGENT_VISIBILITY_VALUES)[number];
|
|
14
|
+
/**
|
|
15
|
+
* Fallback visibility used when no valid value is configured.
|
|
16
|
+
*
|
|
17
|
+
* @public exported from `@promptbook/core`
|
|
18
|
+
*/
|
|
19
|
+
export declare const DEFAULT_AGENT_VISIBILITY: AgentVisibility;
|
|
20
|
+
/**
|
|
21
|
+
* Returns `true` when the value is one of supported visibility states.
|
|
22
|
+
*
|
|
23
|
+
* @param value - Raw value to validate.
|
|
24
|
+
* @returns Whether the value is a valid `AgentVisibility`.
|
|
25
|
+
*
|
|
26
|
+
* @public exported from `@promptbook/core`
|
|
27
|
+
*/
|
|
28
|
+
export declare function isAgentVisibility(value: unknown): value is AgentVisibility;
|
|
29
|
+
/**
|
|
30
|
+
* Normalizes raw visibility text into a supported value.
|
|
31
|
+
*
|
|
32
|
+
* @param value - Raw visibility value.
|
|
33
|
+
* @returns Normalized visibility, or `null` when invalid.
|
|
34
|
+
*
|
|
35
|
+
* @public exported from `@promptbook/core`
|
|
36
|
+
*/
|
|
37
|
+
export declare function normalizeAgentVisibility(value: unknown): AgentVisibility | null;
|
|
38
|
+
/**
|
|
39
|
+
* Parses visibility from an unknown value with a safe fallback.
|
|
40
|
+
*
|
|
41
|
+
* @param value - Raw visibility value.
|
|
42
|
+
* @param fallback - Fallback when the value is invalid.
|
|
43
|
+
* @returns Parsed visibility.
|
|
44
|
+
*
|
|
45
|
+
* @public exported from `@promptbook/core`
|
|
46
|
+
*/
|
|
47
|
+
export declare function parseAgentVisibility(value: unknown, fallback?: AgentVisibility): AgentVisibility;
|
|
48
|
+
/**
|
|
49
|
+
* Parses visibility and throws when the value is not supported.
|
|
50
|
+
*
|
|
51
|
+
* @param value - Raw visibility value.
|
|
52
|
+
* @param sourceLabel - Human-readable source used in the error message.
|
|
53
|
+
* @returns Parsed visibility.
|
|
54
|
+
*
|
|
55
|
+
* @public exported from `@promptbook/core`
|
|
56
|
+
*/
|
|
57
|
+
export declare function parseAgentVisibilityStrict(value: unknown, sourceLabel?: string): AgentVisibility;
|
|
58
|
+
/**
|
|
59
|
+
* Extracts the last `META VISIBILITY` value from an agent source.
|
|
60
|
+
*
|
|
61
|
+
* @param agentSource - Raw book source.
|
|
62
|
+
* @param options - Strict parsing options.
|
|
63
|
+
* @returns Normalized visibility, or `null` when no commitment is present.
|
|
64
|
+
*
|
|
65
|
+
* @public exported from `@promptbook/core`
|
|
66
|
+
*/
|
|
67
|
+
export declare function parseAgentSourceVisibility(agentSource: string_book, options?: {
|
|
68
|
+
readonly isStrict?: boolean;
|
|
69
|
+
}): AgentVisibility | null;
|
|
70
|
+
/**
|
|
71
|
+
* Returns whether an agent should be listed publicly in anonymous views.
|
|
72
|
+
*
|
|
73
|
+
* @param visibility - Agent visibility to evaluate.
|
|
74
|
+
* @returns `true` for publicly listed agents.
|
|
75
|
+
*
|
|
76
|
+
* @public exported from `@promptbook/core`
|
|
77
|
+
*/
|
|
78
|
+
export declare function isPublicAgentVisibility(visibility: AgentVisibility | null | undefined): boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Returns the next visibility in UI rotation order.
|
|
81
|
+
*
|
|
82
|
+
* @param visibility - Current visibility.
|
|
83
|
+
* @returns Next visibility value.
|
|
84
|
+
*
|
|
85
|
+
* @public exported from `@promptbook/core`
|
|
86
|
+
*/
|
|
87
|
+
export declare function getNextAgentVisibility(visibility: AgentVisibility | null | undefined): AgentVisibility;
|
|
88
|
+
/**
|
|
89
|
+
* Inserts or replaces the `META VISIBILITY` commitment in a book source.
|
|
90
|
+
*
|
|
91
|
+
* @param agentSource - Raw book source.
|
|
92
|
+
* @param visibility - Visibility to persist.
|
|
93
|
+
* @returns Source with exactly one normalized `META VISIBILITY` line.
|
|
94
|
+
*
|
|
95
|
+
* @public exported from `@promptbook/core`
|
|
96
|
+
*/
|
|
97
|
+
export declare function setAgentSourceVisibility(agentSource: string_book, visibility: AgentVisibility): string_book;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -19,6 +19,7 @@ export declare const BookEditorMonacoTokenization: {
|
|
|
19
19
|
AGENT_URL_REFERENCE_REGEX: RegExp;
|
|
20
20
|
AGENT_REFERENCE_TOKEN_REGEX: RegExp;
|
|
21
21
|
AGENT_REFERENCE_BRACED_REGEX: RegExp;
|
|
22
|
+
NON_AGENT_REFERENCE_INLINE_AT_TOKEN_REGEX: RegExp;
|
|
22
23
|
AGENT_REFERENCE_HIGHLIGHT_REGEXES: readonly [RegExp, RegExp, RegExp];
|
|
23
24
|
extractAgentReferenceValue: (token: string) => string;
|
|
24
25
|
resolveAgentReferenceToUrl: (referenceValue: string) => string | null;
|
|
@@ -6,6 +6,12 @@
|
|
|
6
6
|
* @private internal constant of `ptbk agents-server`
|
|
7
7
|
*/
|
|
8
8
|
export declare const PTBK_AGENTS_SERVER_NODE_MODULES_PATH_ENV = "PTBK_AGENTS_SERVER_NODE_MODULES_PATH";
|
|
9
|
+
/**
|
|
10
|
+
* Environment variable consumed by `apps/agents-server/next.config.ts` to throttle build workers.
|
|
11
|
+
*
|
|
12
|
+
* @private internal constant of `ptbk agents-server`
|
|
13
|
+
*/
|
|
14
|
+
export declare const PTBK_AGENTS_SERVER_BUILD_WORKER_COUNT_ENV = "PTBK_AGENTS_SERVER_BUILD_WORKER_COUNT";
|
|
9
15
|
/**
|
|
10
16
|
* Environment variable used only by the CLI-owned production build.
|
|
11
17
|
*
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { string_book } from '../../book-2.0/agent-source/string_book';
|
|
2
|
+
import { type AgentVisibility } from '../../book-2.0/agent-source/agentSourceVisibility';
|
|
2
3
|
import type { LlmToolDefinition } from '../../types/LlmToolDefinition';
|
|
3
4
|
/**
|
|
4
5
|
* Supported visibility options for agent creation.
|
|
@@ -11,7 +12,7 @@ export declare const CREATE_AGENT_VISIBILITY_VALUES: readonly ["PRIVATE", "UNLIS
|
|
|
11
12
|
*
|
|
12
13
|
* @private shared create-agent contract
|
|
13
14
|
*/
|
|
14
|
-
export type CreateAgentVisibility =
|
|
15
|
+
export type CreateAgentVisibility = AgentVisibility;
|
|
15
16
|
/**
|
|
16
17
|
* Canonical input payload for creating one persisted agent entity.
|
|
17
18
|
*
|
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
import type { AgentBasicInformation } from '../../../../book-2.0/agent-source/AgentBasicInformation';
|
|
2
|
+
import { type AgentVisibility } from '../../../../book-2.0/agent-source/agentSourceVisibility';
|
|
2
3
|
import type { string_book } from '../../../../book-2.0/agent-source/string_book';
|
|
3
4
|
import type { string_agent_permanent_id } from '../../../../types/string_agent_name';
|
|
5
|
+
/**
|
|
6
|
+
* Options used while preparing a source for persistence.
|
|
7
|
+
*
|
|
8
|
+
* @private shared persistence helper for `AgentCollectionInSupabase`
|
|
9
|
+
*/
|
|
10
|
+
export type PrepareAgentSourceForPersistenceOptions = {
|
|
11
|
+
/**
|
|
12
|
+
* Visibility value that should be written into the book when present.
|
|
13
|
+
*/
|
|
14
|
+
readonly visibility?: AgentVisibility | null;
|
|
15
|
+
/**
|
|
16
|
+
* Whether `visibility` should replace an existing `META VISIBILITY` commitment.
|
|
17
|
+
*/
|
|
18
|
+
readonly isVisibilityOverride?: boolean;
|
|
19
|
+
};
|
|
4
20
|
/**
|
|
5
21
|
* Prepared agent source payload ready for database persistence.
|
|
6
22
|
*
|
|
@@ -22,6 +38,10 @@ export type PreparedAgentSourceForPersistence = {
|
|
|
22
38
|
* Permanent id extracted from the original source before stripping `META ID`.
|
|
23
39
|
*/
|
|
24
40
|
readonly permanentId: string_agent_permanent_id | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Visibility parsed from the normalized source.
|
|
43
|
+
*/
|
|
44
|
+
readonly visibility: AgentVisibility | undefined;
|
|
25
45
|
};
|
|
26
46
|
/**
|
|
27
47
|
* Normalizes one agent source before persistence.
|
|
@@ -33,4 +53,4 @@ export type PreparedAgentSourceForPersistence = {
|
|
|
33
53
|
*
|
|
34
54
|
* @private shared persistence helper for `AgentCollectionInSupabase`
|
|
35
55
|
*/
|
|
36
|
-
export declare function prepareAgentSourceForPersistence(agentSource: string_book): PreparedAgentSourceForPersistence;
|
|
56
|
+
export declare function prepareAgentSourceForPersistence(agentSource: string_book, options?: PrepareAgentSourceForPersistenceOptions): PreparedAgentSourceForPersistence;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
|
|
2
|
+
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
3
|
+
/**
|
|
4
|
+
* META VISIBILITY commitment definition.
|
|
5
|
+
*
|
|
6
|
+
* The `META VISIBILITY` commitment stores whether an agent is public, private, or unlisted.
|
|
7
|
+
* Agents Server mirrors this value into the database for efficient filtering, but the book
|
|
8
|
+
* commitment remains the editable source of truth.
|
|
9
|
+
*
|
|
10
|
+
* @private Metadata-only commitment used by Agents Server.
|
|
11
|
+
*/
|
|
12
|
+
export declare class MetaVisibilityCommitmentDefinition extends BaseCommitmentDefinition<'META VISIBILITY'> {
|
|
13
|
+
constructor();
|
|
14
|
+
/**
|
|
15
|
+
* Short one-line description of META VISIBILITY.
|
|
16
|
+
*/
|
|
17
|
+
get description(): string;
|
|
18
|
+
/**
|
|
19
|
+
* Icon for this commitment.
|
|
20
|
+
*/
|
|
21
|
+
get icon(): string;
|
|
22
|
+
/**
|
|
23
|
+
* Markdown documentation for META VISIBILITY commitment.
|
|
24
|
+
*/
|
|
25
|
+
get documentation(): string;
|
|
26
|
+
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
|
|
27
|
+
}
|
|
@@ -25,6 +25,7 @@ import { MetaFontCommitmentDefinition } from './META_FONT/META_FONT';
|
|
|
25
25
|
import { MetaImageCommitmentDefinition } from './META_IMAGE/META_IMAGE';
|
|
26
26
|
import { MetaInputPlaceholderCommitmentDefinition } from './META_INPUT_PLACEHOLDER/META_INPUT_PLACEHOLDER';
|
|
27
27
|
import { MetaLinkCommitmentDefinition } from './META_LINK/META_LINK';
|
|
28
|
+
import { MetaVisibilityCommitmentDefinition } from './META_VISIBILITY/META_VISIBILITY';
|
|
28
29
|
import { MetaVoiceCommitmentDefinition } from './META_VOICE/META_VOICE';
|
|
29
30
|
import { ModelCommitmentDefinition } from './MODEL/MODEL';
|
|
30
31
|
import { NoteCommitmentDefinition } from './NOTE/NOTE';
|
|
@@ -61,4 +62,4 @@ import { NotYetImplementedCommitmentDefinition } from './_base/NotYetImplemented
|
|
|
61
62
|
*
|
|
62
63
|
* @private Use functions to access commitments instead of this array directly
|
|
63
64
|
*/
|
|
64
|
-
export declare const COMMITMENT_REGISTRY: readonly [PersonaCommitmentDefinition, PersonaCommitmentDefinition, KnowledgeCommitmentDefinition, MemoryCommitmentDefinition, MemoryCommitmentDefinition, StyleCommitmentDefinition, StyleCommitmentDefinition, RuleCommitmentDefinition, RuleCommitmentDefinition, LanguageCommitmentDefinition, LanguageCommitmentDefinition, WritingSampleCommitmentDefinition, WritingRulesCommitmentDefinition, SampleCommitmentDefinition, SampleCommitmentDefinition, FormatCommitmentDefinition, FormatCommitmentDefinition, TemplateCommitmentDefinition, TemplateCommitmentDefinition, FromCommitmentDefinition, ImportCommitmentDefinition, ImportCommitmentDefinition, ModelCommitmentDefinition, ModelCommitmentDefinition, ActionCommitmentDefinition, ActionCommitmentDefinition, ComponentCommitmentDefinition, MetaAvatarCommitmentDefinition, MetaImageCommitmentDefinition, MetaColorCommitmentDefinition, MetaFontCommitmentDefinition, MetaLinkCommitmentDefinition, MetaDomainCommitmentDefinition, MetaDisclaimerCommitmentDefinition, MetaInputPlaceholderCommitmentDefinition, MetaCommitmentDefinition, MetaVoiceCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, GoalCommitmentDefinition, GoalCommitmentDefinition, InitialMessageCommitmentDefinition, UserMessageCommitmentDefinition, InternalMessageCommitmentDefinition, AgentMessageCommitmentDefinition, MessageSuffixCommitmentDefinition, MessageCommitmentDefinition, MessageCommitmentDefinition, WalletCommitmentDefinition, WalletCommitmentDefinition, ScenarioCommitmentDefinition, ScenarioCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DictionaryCommitmentDefinition, OpenCommitmentDefinition, ClosedCommitmentDefinition, TeamCommitmentDefinition, UseBrowserCommitmentDefinition, UseDeepSearchCommitmentDefinition, UseSearchEngineCommitmentDefinition, UseSpawnCommitmentDefinition, UseTimeoutCommitmentDefinition, UseTimeCommitmentDefinition, UseUserLocationCommitmentDefinition, UseCalendarCommitmentDefinition, UseEmailCommitmentDefinition, UsePopupCommitmentDefinition, UseImageGeneratorCommitmentDefinition, UseMcpCommitmentDefinition, UsePrivacyCommitmentDefinition, UseProjectCommitmentDefinition, NotYetImplementedCommitmentDefinition<"EXPECT">, NotYetImplementedCommitmentDefinition<"BEHAVIOUR">, NotYetImplementedCommitmentDefinition<"BEHAVIOURS">, NotYetImplementedCommitmentDefinition<"AVOID">, NotYetImplementedCommitmentDefinition<"AVOIDANCE">, NotYetImplementedCommitmentDefinition<"CONTEXT">];
|
|
65
|
+
export declare const COMMITMENT_REGISTRY: readonly [PersonaCommitmentDefinition, PersonaCommitmentDefinition, KnowledgeCommitmentDefinition, MemoryCommitmentDefinition, MemoryCommitmentDefinition, StyleCommitmentDefinition, StyleCommitmentDefinition, RuleCommitmentDefinition, RuleCommitmentDefinition, LanguageCommitmentDefinition, LanguageCommitmentDefinition, WritingSampleCommitmentDefinition, WritingRulesCommitmentDefinition, SampleCommitmentDefinition, SampleCommitmentDefinition, FormatCommitmentDefinition, FormatCommitmentDefinition, TemplateCommitmentDefinition, TemplateCommitmentDefinition, FromCommitmentDefinition, ImportCommitmentDefinition, ImportCommitmentDefinition, ModelCommitmentDefinition, ModelCommitmentDefinition, ActionCommitmentDefinition, ActionCommitmentDefinition, ComponentCommitmentDefinition, MetaAvatarCommitmentDefinition, MetaImageCommitmentDefinition, MetaColorCommitmentDefinition, MetaFontCommitmentDefinition, MetaLinkCommitmentDefinition, MetaDomainCommitmentDefinition, MetaDisclaimerCommitmentDefinition, MetaInputPlaceholderCommitmentDefinition, MetaVisibilityCommitmentDefinition, MetaCommitmentDefinition, MetaVoiceCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, GoalCommitmentDefinition, GoalCommitmentDefinition, InitialMessageCommitmentDefinition, UserMessageCommitmentDefinition, InternalMessageCommitmentDefinition, AgentMessageCommitmentDefinition, MessageSuffixCommitmentDefinition, MessageCommitmentDefinition, MessageCommitmentDefinition, WalletCommitmentDefinition, WalletCommitmentDefinition, ScenarioCommitmentDefinition, ScenarioCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DictionaryCommitmentDefinition, OpenCommitmentDefinition, ClosedCommitmentDefinition, TeamCommitmentDefinition, UseBrowserCommitmentDefinition, UseDeepSearchCommitmentDefinition, UseSearchEngineCommitmentDefinition, UseSpawnCommitmentDefinition, UseTimeoutCommitmentDefinition, UseTimeCommitmentDefinition, UseUserLocationCommitmentDefinition, UseCalendarCommitmentDefinition, UseEmailCommitmentDefinition, UsePopupCommitmentDefinition, UseImageGeneratorCommitmentDefinition, UseMcpCommitmentDefinition, UsePrivacyCommitmentDefinition, UseProjectCommitmentDefinition, NotYetImplementedCommitmentDefinition<"EXPECT">, NotYetImplementedCommitmentDefinition<"BEHAVIOUR">, NotYetImplementedCommitmentDefinition<"BEHAVIOURS">, NotYetImplementedCommitmentDefinition<"AVOID">, NotYetImplementedCommitmentDefinition<"AVOIDANCE">, NotYetImplementedCommitmentDefinition<"CONTEXT">];
|
package/esm/src/version.d.ts
CHANGED
|
@@ -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.112.0
|
|
18
|
+
* It follows semantic versioning (e.g., `0.112.0`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
package/umd/index.umd.js
CHANGED
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
* @generated
|
|
35
35
|
* @see https://github.com/webgptorg/promptbook
|
|
36
36
|
*/
|
|
37
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.
|
|
37
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.113.0-0';
|
|
38
38
|
/**
|
|
39
39
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
40
40
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -12685,6 +12685,70 @@
|
|
|
12685
12685
|
}
|
|
12686
12686
|
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
12687
12687
|
|
|
12688
|
+
/**
|
|
12689
|
+
* META VISIBILITY commitment definition.
|
|
12690
|
+
*
|
|
12691
|
+
* The `META VISIBILITY` commitment stores whether an agent is public, private, or unlisted.
|
|
12692
|
+
* Agents Server mirrors this value into the database for efficient filtering, but the book
|
|
12693
|
+
* commitment remains the editable source of truth.
|
|
12694
|
+
*
|
|
12695
|
+
* @private Metadata-only commitment used by Agents Server.
|
|
12696
|
+
*/
|
|
12697
|
+
class MetaVisibilityCommitmentDefinition extends BaseCommitmentDefinition {
|
|
12698
|
+
constructor() {
|
|
12699
|
+
super('META VISIBILITY');
|
|
12700
|
+
}
|
|
12701
|
+
/**
|
|
12702
|
+
* Short one-line description of META VISIBILITY.
|
|
12703
|
+
*/
|
|
12704
|
+
get description() {
|
|
12705
|
+
return 'Set whether the agent is private, unlisted, or public.';
|
|
12706
|
+
}
|
|
12707
|
+
/**
|
|
12708
|
+
* Icon for this commitment.
|
|
12709
|
+
*/
|
|
12710
|
+
get icon() {
|
|
12711
|
+
return '👁️';
|
|
12712
|
+
}
|
|
12713
|
+
/**
|
|
12714
|
+
* Markdown documentation for META VISIBILITY commitment.
|
|
12715
|
+
*/
|
|
12716
|
+
get documentation() {
|
|
12717
|
+
return spacetrim.spaceTrim(`
|
|
12718
|
+
# META VISIBILITY
|
|
12719
|
+
|
|
12720
|
+
Sets the agent visibility used by Agents Server.
|
|
12721
|
+
|
|
12722
|
+
## Allowed values
|
|
12723
|
+
|
|
12724
|
+
- \`PRIVATE\` - accessible only to signed-in users with access.
|
|
12725
|
+
- \`UNLISTED\` - accessible by direct link but hidden from public listings.
|
|
12726
|
+
- \`PUBLIC\` - visible in public listings and accessible by anyone.
|
|
12727
|
+
|
|
12728
|
+
## Key aspects
|
|
12729
|
+
|
|
12730
|
+
- Does not modify the agent's behavior, system message, or tools.
|
|
12731
|
+
- Whitespace and letter case are normalized when persisted.
|
|
12732
|
+
- If multiple \`META VISIBILITY\` commitments are present, persistence keeps one normalized value.
|
|
12733
|
+
- Agents Server mirrors the value into the database for filtering, but the book is the source of truth.
|
|
12734
|
+
|
|
12735
|
+
## Example
|
|
12736
|
+
|
|
12737
|
+
\`\`\`book
|
|
12738
|
+
Helpful Assistant
|
|
12739
|
+
|
|
12740
|
+
GOAL Be helpful and friendly.
|
|
12741
|
+
META VISIBILITY PUBLIC
|
|
12742
|
+
\`\`\`
|
|
12743
|
+
`);
|
|
12744
|
+
}
|
|
12745
|
+
applyToAgentModelRequirements(requirements, content) {
|
|
12746
|
+
// META VISIBILITY is metadata only and does not alter model requirements.
|
|
12747
|
+
return requirements;
|
|
12748
|
+
}
|
|
12749
|
+
}
|
|
12750
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
12751
|
+
|
|
12688
12752
|
/**
|
|
12689
12753
|
* META VOICE commitment definition
|
|
12690
12754
|
*
|
|
@@ -19180,31 +19244,65 @@
|
|
|
19180
19244
|
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
19181
19245
|
|
|
19182
19246
|
/**
|
|
19183
|
-
* This error
|
|
19247
|
+
* This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
|
|
19184
19248
|
*
|
|
19185
19249
|
* @public exported from `@promptbook/core`
|
|
19186
19250
|
*/
|
|
19187
|
-
class
|
|
19251
|
+
class ParseError extends Error {
|
|
19188
19252
|
constructor(message) {
|
|
19189
19253
|
super(message);
|
|
19190
|
-
this.name = '
|
|
19191
|
-
Object.setPrototypeOf(this,
|
|
19254
|
+
this.name = 'ParseError';
|
|
19255
|
+
Object.setPrototypeOf(this, ParseError.prototype);
|
|
19192
19256
|
}
|
|
19193
19257
|
}
|
|
19258
|
+
// TODO: Maybe split `ParseError` and `ApplyError`
|
|
19194
19259
|
|
|
19195
19260
|
/**
|
|
19196
|
-
*
|
|
19261
|
+
* Supported visibility states for persisted agents.
|
|
19197
19262
|
*
|
|
19198
19263
|
* @public exported from `@promptbook/core`
|
|
19199
19264
|
*/
|
|
19200
|
-
|
|
19265
|
+
const AGENT_VISIBILITY_VALUES = ['PRIVATE', 'UNLISTED', 'PUBLIC'];
|
|
19266
|
+
/**
|
|
19267
|
+
* Returns `true` when the value is one of supported visibility states.
|
|
19268
|
+
*
|
|
19269
|
+
* @param value - Raw value to validate.
|
|
19270
|
+
* @returns Whether the value is a valid `AgentVisibility`.
|
|
19271
|
+
*
|
|
19272
|
+
* @public exported from `@promptbook/core`
|
|
19273
|
+
*/
|
|
19274
|
+
function isAgentVisibility(value) {
|
|
19275
|
+
return typeof value === 'string' && AGENT_VISIBILITY_VALUES.includes(value);
|
|
19276
|
+
}
|
|
19277
|
+
/**
|
|
19278
|
+
* Normalizes raw visibility text into a supported value.
|
|
19279
|
+
*
|
|
19280
|
+
* @param value - Raw visibility value.
|
|
19281
|
+
* @returns Normalized visibility, or `null` when invalid.
|
|
19282
|
+
*
|
|
19283
|
+
* @public exported from `@promptbook/core`
|
|
19284
|
+
*/
|
|
19285
|
+
function normalizeAgentVisibility(value) {
|
|
19286
|
+
if (typeof value !== 'string') {
|
|
19287
|
+
return null;
|
|
19288
|
+
}
|
|
19289
|
+
const normalized = value.trim().toUpperCase();
|
|
19290
|
+
return isAgentVisibility(normalized) ? normalized : null;
|
|
19291
|
+
}
|
|
19292
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
19293
|
+
|
|
19294
|
+
/**
|
|
19295
|
+
* This error type indicates that some limit was reached
|
|
19296
|
+
*
|
|
19297
|
+
* @public exported from `@promptbook/core`
|
|
19298
|
+
*/
|
|
19299
|
+
class LimitReachedError extends Error {
|
|
19201
19300
|
constructor(message) {
|
|
19202
19301
|
super(message);
|
|
19203
|
-
this.name = '
|
|
19204
|
-
Object.setPrototypeOf(this,
|
|
19302
|
+
this.name = 'LimitReachedError';
|
|
19303
|
+
Object.setPrototypeOf(this, LimitReachedError.prototype);
|
|
19205
19304
|
}
|
|
19206
19305
|
}
|
|
19207
|
-
// TODO: Maybe split `ParseError` and `ApplyError`
|
|
19208
19306
|
|
|
19209
19307
|
/**
|
|
19210
19308
|
* Maximum allowed source length for create-agent payloads.
|
|
@@ -21539,6 +21637,7 @@
|
|
|
21539
21637
|
new MetaDomainCommitmentDefinition(),
|
|
21540
21638
|
new MetaDisclaimerCommitmentDefinition(),
|
|
21541
21639
|
new MetaInputPlaceholderCommitmentDefinition(),
|
|
21640
|
+
new MetaVisibilityCommitmentDefinition(),
|
|
21542
21641
|
new MetaCommitmentDefinition(),
|
|
21543
21642
|
new MetaVoiceCommitmentDefinition(),
|
|
21544
21643
|
new NoteCommitmentDefinition('NOTE'),
|
|
@@ -21990,6 +22089,7 @@
|
|
|
21990
22089
|
'META COLOR': applyMetaColorContent,
|
|
21991
22090
|
'META FONT': applyMetaFontContent,
|
|
21992
22091
|
'META VOICE': applyMetaVoiceContent,
|
|
22092
|
+
'META VISIBILITY': applyMetaVisibilityContent,
|
|
21993
22093
|
};
|
|
21994
22094
|
/**
|
|
21995
22095
|
* Applies META-style commitments that mutate parsed profile metadata.
|
|
@@ -22019,6 +22119,10 @@
|
|
|
22019
22119
|
applyMetaAvatarContent(state, metaValue);
|
|
22020
22120
|
return;
|
|
22021
22121
|
}
|
|
22122
|
+
if (metaTypeRaw.toUpperCase() === 'VISIBILITY') {
|
|
22123
|
+
applyMetaVisibilityContent(state, metaValue);
|
|
22124
|
+
return;
|
|
22125
|
+
}
|
|
22022
22126
|
const metaType = normalizeTo_camelCase(metaTypeRaw);
|
|
22023
22127
|
state.meta[metaType] = metaValue;
|
|
22024
22128
|
}
|
|
@@ -22095,6 +22199,15 @@
|
|
|
22095
22199
|
function applyMetaVoiceContent(state, content) {
|
|
22096
22200
|
state.meta.voice = spacetrim.spaceTrim(content);
|
|
22097
22201
|
}
|
|
22202
|
+
/**
|
|
22203
|
+
* Applies META VISIBILITY content into the normalized `meta.visibility` field.
|
|
22204
|
+
*/
|
|
22205
|
+
function applyMetaVisibilityContent(state, content) {
|
|
22206
|
+
const visibility = normalizeAgentVisibility(content);
|
|
22207
|
+
if (visibility) {
|
|
22208
|
+
state.meta.visibility = visibility;
|
|
22209
|
+
}
|
|
22210
|
+
}
|
|
22098
22211
|
/**
|
|
22099
22212
|
* Normalizes the separator in the content
|
|
22100
22213
|
*
|
|
@@ -23599,6 +23712,15 @@
|
|
|
23599
23712
|
* @private function of BookEditorMonaco
|
|
23600
23713
|
*/
|
|
23601
23714
|
const AGENT_REFERENCE_BRACED_PATTERN = '\\{[^{}\\r\\n]+\\}';
|
|
23715
|
+
/**
|
|
23716
|
+
* Pattern matching plain inline `@` tokens, for example email addresses.
|
|
23717
|
+
*
|
|
23718
|
+
* Monaco tokenizes from the current offset, so `team@foo.bar` can otherwise reach
|
|
23719
|
+
* the `@foo` suffix and look like a standalone compact reference.
|
|
23720
|
+
*
|
|
23721
|
+
* @private function of BookEditorMonaco
|
|
23722
|
+
*/
|
|
23723
|
+
const NON_AGENT_REFERENCE_INLINE_AT_TOKEN_REGEX = /[^\s{}]*[^\s@{}]@[^\s{}]+/;
|
|
23602
23724
|
/**
|
|
23603
23725
|
* Commitment types where compact agent references are supported.
|
|
23604
23726
|
*
|
|
@@ -23835,6 +23957,7 @@
|
|
|
23835
23957
|
AGENT_URL_REFERENCE_REGEX,
|
|
23836
23958
|
AGENT_REFERENCE_TOKEN_REGEX,
|
|
23837
23959
|
AGENT_REFERENCE_BRACED_REGEX,
|
|
23960
|
+
NON_AGENT_REFERENCE_INLINE_AT_TOKEN_REGEX,
|
|
23838
23961
|
AGENT_REFERENCE_HIGHLIGHT_REGEXES,
|
|
23839
23962
|
extractAgentReferenceValue,
|
|
23840
23963
|
resolveAgentReferenceToUrl,
|
|
@@ -24066,13 +24189,15 @@
|
|
|
24066
24189
|
const commitmentRegex = BookEditorMonacoTokenization.DYNAMIC_COMMITMENT_REGEX;
|
|
24067
24190
|
const agentReferenceCommitmentRegex = /^\s*(FROM|IMPORT|IMPORTS|TEAM)(?=\s|$)/;
|
|
24068
24191
|
const commitmentTransitionRules = createCommitmentTransitionRules(noteLikeCommitmentStates, agentReferenceCommitmentRegex, commitmentRegex);
|
|
24069
|
-
const
|
|
24192
|
+
const PARAMETER_REGEX = /@([a-zA-Z0-9_á-žÁ-Žč-řČ-Řš-žŠ-Žа-яА-ЯёЁ]+)/;
|
|
24193
|
+
const NON_AGENT_REFERENCE_INLINE_AT_TOKEN_REGEX = BookEditorMonacoTokenization.NON_AGENT_REFERENCE_INLINE_AT_TOKEN_REGEX;
|
|
24070
24194
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
24071
24195
|
const defaultBodyRules = [
|
|
24072
24196
|
[/^---[-]*$/, ''],
|
|
24073
24197
|
[CODE_BLOCK_FENCE_REGEX, 'code-block', '@codeblock'],
|
|
24074
24198
|
...commitmentTransitionRules,
|
|
24075
|
-
[
|
|
24199
|
+
[NON_AGENT_REFERENCE_INLINE_AT_TOKEN_REGEX, ''],
|
|
24200
|
+
[PARAMETER_REGEX, 'parameter'],
|
|
24076
24201
|
[/\{[^}]+\}/, 'parameter'],
|
|
24077
24202
|
];
|
|
24078
24203
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -24081,7 +24206,8 @@
|
|
|
24081
24206
|
[CODE_BLOCK_FENCE_REGEX, 'code-block', '@codeblock'],
|
|
24082
24207
|
...commitmentTransitionRules,
|
|
24083
24208
|
...BookEditorMonacoTokenization.AGENT_REFERENCE_HIGHLIGHT_REGEXES.map((regex) => [regex, 'agent-reference']),
|
|
24084
|
-
[
|
|
24209
|
+
[NON_AGENT_REFERENCE_INLINE_AT_TOKEN_REGEX, ''],
|
|
24210
|
+
[PARAMETER_REGEX, 'parameter'],
|
|
24085
24211
|
[/\{[^}]+\}/, 'parameter'],
|
|
24086
24212
|
];
|
|
24087
24213
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|