@promptbook/documents
Version:
Promptbook: Create persistent AI agents that turn your company's scattered knowledge into action
67 lines (66 loc) • 2.33 kB
TypeScript
import type { BookNodeAgentSourceOptions } from './BookNodeAgentSource';
import { CLI_AGENT_HARNESS_NAMES, CLI_AGENT_THINKING_LEVEL_VALUES } from './cliAgentEnv';
/**
* CLI harness names supported by `ptbk agent exec`.
*
* @public exported from `@promptbook/node`
*/
export type CliAgentHarness = (typeof CLI_AGENT_HARNESS_NAMES)[number];
/**
* Thinking levels supported by CLI coding harnesses.
*
* @public exported from `@promptbook/node`
*/
export type CliAgentThinkingLevel = (typeof CLI_AGENT_THINKING_LEVEL_VALUES)[number];
/**
* Per-run CLI options exposed by `CliAgent`.
*
* `noUi` defaults to `true` so command output stays suitable for JavaScript callers.
*
* @public exported from `@promptbook/node`
*/
export type CliAgentRunOptions = {
readonly allowCredits?: boolean;
readonly context?: string;
readonly harness?: CliAgentHarness;
readonly isVerbose?: boolean;
readonly model?: string;
readonly noUi?: boolean;
readonly thinkingLevel?: CliAgentThinkingLevel;
};
/**
* Constructor options for `CliAgent`.
*
* @public exported from `@promptbook/node`
*/
export type CliAgentOptions = BookNodeAgentSourceOptions & CliAgentRunOptions;
/**
* Lightweight JavaScript wrapper around the Promptbook agent execution pipeline.
*
* It uses the same harnesses and execution path as `ptbk agent exec`, running the runner
* in-process instead of spawning a separate CLI process.
*
* When no `harness` is provided in the constructor or per-run options, `CliAgent` falls back
* to the `PTBK_HARNESS` environment variable, mirroring `ptbk agent exec` behavior.
*
* @public exported from `@promptbook/node`
*/
export declare class CliAgent {
private readonly options;
private temporaryAgentPath;
constructor(options: CliAgentOptions);
/**
* Runs one non-interactive agent turn through the selected harness.
*
* @param message - User message sent to the agent.
* @param options - Optional per-run overrides.
* @returns Final agent answer.
*/
run(message: string, options?: CliAgentRunOptions): Promise<string>;
/**
* Resolves the agent path passed to the runner, materializing one temporary `.book` file when needed.
*
* @private internal utility of `CliAgent`
*/
private resolveExecutableAgentPath;
}