@promptbook/remote-server
Version:
Promptbook: Create persistent AI agents that turn your company's scattered knowledge into action
111 lines (110 loc) • 4.24 kB
TypeScript
import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
import type { ToolFunction } from '../../scripting/javascript/JavascriptExecutionToolsOptions';
import type { string_javascript_name } from '../../types/string_person_fullname';
/**
* Optional UI/docs-only deprecation metadata for one commitment keyword.
*
* @private internal type of `CommitmentDefinition`
*/
type CommitmentDeprecation = {
/**
* Human-readable deprecation note shown in editors and documentation.
*/
readonly message: string;
/**
* Preferred replacement commitments, when applicable.
*/
readonly replacedBy?: ReadonlyArray<string>;
};
/**
* Definition of a commitment that can be applied to agent model requirements.
*
* Each commitment is self-contained and manages its own logic for:
* - Creating regex patterns for parsing
* - Applying its effects to agent model requirements
*
* @public exported from `@promptbook/core`
*/
export type CommitmentDefinition = {
/**
* The type/name of this commitment (e.g., 'PERSONA', 'KNOWLEDGE', etc.)
*/
readonly type: string;
/**
* Short one-line markdown description of this commitment (no lists or code blocks).
* Keep it concise; may use inline markdown like **bold** or *italic*.
*/
readonly description: string;
/**
* Icon for this commitment.
* It should be a single emoji.
*/
readonly icon: string;
/**
* Whether this commitment should be prioritized in menus, documentation, and intellisense.
*/
readonly isImportant: boolean;
/**
* Whether this commitment is unfinished and not ready to use.
*
* Unfinished commitments are surfaced with low-level caution in the UI,
* documentation, and editor diagnostics.
*/
readonly isUnfinished: boolean;
/**
* Whether this commitment is low-level and should be surfaced with caution.
*
* Low-level commitments are fully implemented, but they are intended for
* advanced use and are not used by most users.
*/
readonly isLowLevel: boolean;
/**
* Human-readable markdown documentation for this commitment.
* Should explain what the commitment does and include example usage.
* This is available at runtime for UIs, docs, and tooling.
*/
readonly documentation: string;
/**
* Optional deprecation metadata for backward-compatible commitment aliases.
*
* This is intentionally UI/docs metadata only. It must not change runtime
* model requirements on its own.
*/
readonly deprecation?: CommitmentDeprecation;
/**
* Creates a regex pattern to match this commitment in agent source
* This regex should capture the commitment content in a 'contents' named group
*
* @returns RegExp that matches the full commitment line
*/
createRegex(): RegExp;
/**
* Creates a regex pattern to match just the commitment type
* This is useful for checking if a line contains this commitment type
*
* @returns RegExp that matches just the commitment type
*/
createTypeRegex(): RegExp;
/**
* Applies this commitment's logic to the agent model requirements
* This method should be pure and return a new requirements object
*
* @param requirements Current agent model requirements
* @param content The content part of the commitment (after the type)
* @returns Updated agent model requirements
*/
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
/**
* Gets tool function implementations provided by this commitment
*
* When the `applyToAgentModelRequirements` adds tools to the requirements, this method should return the corresponding function definitions.
*/
getToolFunctions(): Record<string_javascript_name, ToolFunction>;
/**
* Gets human-readable titles for tool functions provided by this commitment
*
* This is used in the UI to show a user-friendly name instead of the technical function name.
*/
getToolTitles(): Record<string_javascript_name, string>;
};
export {};