@promptbook/remote-server
Version:
Promptbook: Create persistent AI agents that turn your company's scattered knowledge into action
171 lines (170 loc) • 4.75 kB
TypeScript
import type { TODO_any } from '../utils/organization/TODO_any';
import type { string_date_iso8601 } from './string_token';
/**
* Explicit lifecycle state of one tool call snapshot.
*/
export type ToolCallState = 'PENDING' | 'PARTIAL' | 'COMPLETE' | 'ERROR';
/**
* Severity level attached to one tool-call log entry.
*/
export type ToolCallLogLevel = 'info' | 'warning' | 'error';
/**
* Incremental log entry emitted while one tool call is running.
*
* These logs are designed to stream progressively so chat chips can expose
* partial details before the final result is available.
*/
export type ToolCallLogEntry = {
/**
* Timestamp when this log entry was observed.
*/
readonly createdAt?: string_date_iso8601;
/**
* Stable machine-friendly log kind such as `request`, `browser-action`, or `result`.
*/
readonly kind?: string;
/**
* Severity level used by UI renderers.
*/
readonly level?: ToolCallLogLevel;
/**
* Short human-readable title for the log row.
*/
readonly title?: string;
/**
* Human-readable message associated with the log row.
*/
readonly message?: string;
/**
* Optional structured payload for advanced/raw inspection.
*/
readonly payload?: TODO_any;
};
/**
* Represents a single tool call with its inputs, outputs, and timing.
*
* Note: This is fully serializable as JSON.
*/
export type ToolCall = {
/**
* Name of the tool.
*/
readonly name: string;
/**
* Arguments for the tool call.
*/
readonly arguments?: string | Record<string, TODO_any>;
/**
* Result of the tool call.
*/
readonly result?: TODO_any;
/**
* Raw tool call payload from the model.
*/
readonly rawToolCall?: TODO_any;
/**
* Explicit lifecycle state of this tool call snapshot.
*
* When omitted, consumers should infer the state from available result/error data.
*/
readonly state?: ToolCallState;
/**
* Idempotency identifier that should not change between partial updates of the same tool call.
*/
readonly idempotencyKey?: string;
/**
* Timestamp when the tool call was initiated.
*/
readonly createdAt?: string_date_iso8601;
/**
* Errors thrown during tool execution.
*/
readonly errors?: ReadonlyArray<TODO_any>;
/**
* Warnings reported during tool execution.
*/
readonly warnings?: ReadonlyArray<TODO_any>;
/**
* Incremental logs observed while the tool call is running.
*/
readonly logs?: ReadonlyArray<ToolCallLogEntry>;
};
/**
* Breakdown of teacher-learned commitment categories for self-learning.
*/
export type SelfLearningCommitmentTypeCounts = {
/**
* Total number of learned commitments.
*/
readonly total: number;
/**
* Count of knowledge commitments.
*/
readonly knowledge: number;
/**
* Count of rule commitments.
*/
readonly rule: number;
/**
* Count of persona commitments.
*/
readonly persona: number;
/**
* Count of other commitment types.
*/
readonly other: number;
};
/**
* Summary of the teacher review step during self-learning.
*/
export type SelfLearningTeacherSummary = {
/**
* Indicates whether the teacher step was used.
*/
readonly used: boolean;
/**
* Commitment breakdown produced by the teacher step.
*/
readonly commitmentTypes: SelfLearningCommitmentTypeCounts;
/**
* Normalized commitment lines produced by the teacher step.
*/
readonly commitments?: ReadonlyArray<string>;
};
/**
* Result payload for the self-learning tool call.
*/
export type SelfLearningToolCallResult = {
/**
* Indicates whether self-learning completed successfully.
*/
readonly success: boolean;
/**
* Timestamp for when self-learning started.
*/
readonly startedAt?: string_date_iso8601;
/**
* Timestamp for when self-learning finished.
*/
readonly completedAt?: string_date_iso8601;
/**
* Number of conversation examples saved from this turn.
*/
readonly samplesAdded?: number;
/**
* Summary of the teacher review step.
*/
readonly teacher?: SelfLearningTeacherSummary;
};
/**
* Tool call name emitted while preparing a GPT assistant for an agent.
*
* @public exported from `@promptbook/types`
*/
export declare const ASSISTANT_PREPARATION_TOOL_CALL_NAME = "assistant_preparation";
/**
* Checks whether a tool call is the assistant preparation marker.
*
* @public exported from `@promptbook/types`
*/
export declare function isAssistantPreparationToolCall(toolCall: ToolCall): boolean;