@promptbook/documents 0.112.0-112 → 0.112.0-113
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 +7 -7
- package/esm/index.es.js +1 -1
- package/esm/src/_packages/node.index.d.ts +20 -0
- package/esm/src/_packages/types.index.d.ts +16 -0
- package/esm/src/book-3.0/BookNodeAgentSource.d.ts +38 -0
- package/esm/src/book-3.0/CliAgent.d.ts +68 -0
- package/esm/src/book-3.0/LiteAgent.d.ts +68 -0
- package/esm/src/book-components/BookEditor/BookEditorAboutPromptbookInformation.d.ts +12 -0
- package/esm/src/cli/cli-commands/agent/agentCliOptions.d.ts +29 -0
- package/esm/src/cli/cli-commands/agent/chat.d.ts +10 -0
- package/esm/src/cli/cli-commands/agent/exec.d.ts +10 -0
- package/esm/src/cli/cli-commands/agent/run.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/agent.d.ts +14 -0
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer.d.ts +3 -4
- package/esm/src/cli/cli-commands/common/promptRunnerCliOptions.d.ts +9 -9
- package/esm/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +1 -1
- package/umd/src/_packages/node.index.d.ts +20 -0
- package/umd/src/_packages/types.index.d.ts +16 -0
- package/umd/src/book-3.0/BookNodeAgentSource.d.ts +38 -0
- package/umd/src/book-3.0/CliAgent.d.ts +68 -0
- package/umd/src/book-3.0/CliAgent.test.d.ts +1 -0
- package/umd/src/book-3.0/LiteAgent.d.ts +68 -0
- package/umd/src/book-3.0/LiteAgent.test.d.ts +1 -0
- package/umd/src/book-components/BookEditor/BookEditorAboutPromptbookInformation.d.ts +12 -0
- package/umd/src/cli/cli-commands/agent/agentCliOptions.d.ts +29 -0
- package/umd/src/cli/cli-commands/agent/chat.d.ts +10 -0
- package/umd/src/cli/cli-commands/agent/exec.d.ts +10 -0
- package/umd/src/cli/cli-commands/agent/run.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/agent.d.ts +14 -0
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer.d.ts +3 -4
- package/umd/src/cli/cli-commands/common/promptRunnerCliOptions.d.ts +9 -9
- package/umd/src/version.d.ts +1 -1
- /package/esm/src/{cli/cli-commands/agents-server/startAgentsServer.test.d.ts → book-3.0/CliAgent.test.d.ts} +0 -0
- /package/{umd/src/cli/cli-commands/agents-server/startAgentsServer.test.d.ts → esm/src/book-3.0/LiteAgent.test.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -443,11 +443,11 @@ npx ts-node ./src/cli/test/ptbk.ts coder generate-boilerplates --template prompt
|
|
|
443
443
|
|
|
444
444
|
npx ts-node ./src/cli/test/ptbk.ts coder generate-boilerplates --template prompts/templates/agents-server.md
|
|
445
445
|
|
|
446
|
-
npx ts-node ./src/cli/test/ptbk.ts coder run --
|
|
446
|
+
npx ts-node ./src/cli/test/ptbk.ts coder run --harness github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md
|
|
447
447
|
|
|
448
|
-
npx ts-node ./src/cli/test/ptbk.ts coder run --
|
|
448
|
+
npx ts-node ./src/cli/test/ptbk.ts coder run --harness github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md --auto-push
|
|
449
449
|
|
|
450
|
-
npx ts-node ./src/cli/test/ptbk.ts coder run --
|
|
450
|
+
npx ts-node ./src/cli/test/ptbk.ts coder run --harness github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md --ignore-git-changes --no-wait
|
|
451
451
|
|
|
452
452
|
npx ts-node ./src/cli/test/ptbk.ts coder find-refactor-candidates
|
|
453
453
|
|
|
@@ -469,11 +469,11 @@ ptbk coder generate-boilerplates
|
|
|
469
469
|
|
|
470
470
|
ptbk coder generate-boilerplates --template prompts/templates/common.md
|
|
471
471
|
|
|
472
|
-
ptbk coder run --
|
|
472
|
+
ptbk coder run --harness github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md --test npm run test
|
|
473
473
|
|
|
474
|
-
ptbk coder run --
|
|
474
|
+
ptbk coder run --harness github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md --auto-push
|
|
475
475
|
|
|
476
|
-
ptbk coder run --
|
|
476
|
+
ptbk coder run --harness github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md --test npm run test --ignore-git-changes --no-wait
|
|
477
477
|
|
|
478
478
|
ptbk coder find-refactor-candidates
|
|
479
479
|
|
|
@@ -498,7 +498,7 @@ ptbk coder verify
|
|
|
498
498
|
|
|
499
499
|
| Flag | Purpose |
|
|
500
500
|
| -------------------------- | -------------------------------------------------------------------------------------------------- |
|
|
501
|
-
| `--
|
|
501
|
+
| `--harness <name>` | Selects the coding harness. |
|
|
502
502
|
| `--model <model>` | Chooses the runner model; required for `openai-codex` and `gemini`, optional for `github-copilot`. |
|
|
503
503
|
| `--context <text-or-file>` | Appends extra instructions inline or from a file like `AGENTS.md`. |
|
|
504
504
|
| `--test <command>` | Runs a verification command after each prompt attempt and feeds failing output back for retries. |
|
package/esm/index.es.js
CHANGED
|
@@ -26,7 +26,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
26
26
|
* @generated
|
|
27
27
|
* @see https://github.com/webgptorg/promptbook
|
|
28
28
|
*/
|
|
29
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
29
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-113';
|
|
30
30
|
/**
|
|
31
31
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
32
32
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION } from '../version';
|
|
2
|
+
import type { BookNodeAgentSource } from '../book-3.0/BookNodeAgentSource';
|
|
3
|
+
import type { BookNodeAgentSourceOptions } from '../book-3.0/BookNodeAgentSource';
|
|
4
|
+
import type { CliAgentHarness } from '../book-3.0/CliAgent';
|
|
5
|
+
import type { CliAgentThinkingLevel } from '../book-3.0/CliAgent';
|
|
6
|
+
import type { CliAgentRunOptions } from '../book-3.0/CliAgent';
|
|
7
|
+
import type { CliAgentOptions } from '../book-3.0/CliAgent';
|
|
8
|
+
import { CliAgent } from '../book-3.0/CliAgent';
|
|
9
|
+
import type { LiteAgentOptions } from '../book-3.0/LiteAgent';
|
|
10
|
+
import type { LiteAgentRunOptions } from '../book-3.0/LiteAgent';
|
|
11
|
+
import { LiteAgent } from '../book-3.0/LiteAgent';
|
|
2
12
|
import { createPipelineCollectionFromDirectory } from '../collection/pipeline-collection/constructors/createPipelineCollectionFromDirectory';
|
|
3
13
|
import { getAllCommitmentsToolFunctionsForNode } from '../commitments/_common/getAllCommitmentsToolFunctionsForNode';
|
|
4
14
|
import { $provideExecutablesForNode } from '../executables/$provideExecutablesForNode';
|
|
@@ -12,6 +22,16 @@ import { FileCacheStorage } from '../storage/file-cache-storage/FileCacheStorage
|
|
|
12
22
|
import { $execCommand } from '../utils/execCommand/$execCommand';
|
|
13
23
|
import { $execCommands } from '../utils/execCommand/$execCommands';
|
|
14
24
|
export { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION };
|
|
25
|
+
export type { BookNodeAgentSource };
|
|
26
|
+
export type { BookNodeAgentSourceOptions };
|
|
27
|
+
export type { CliAgentHarness };
|
|
28
|
+
export type { CliAgentThinkingLevel };
|
|
29
|
+
export type { CliAgentRunOptions };
|
|
30
|
+
export type { CliAgentOptions };
|
|
31
|
+
export { CliAgent };
|
|
32
|
+
export type { LiteAgentOptions };
|
|
33
|
+
export type { LiteAgentRunOptions };
|
|
34
|
+
export { LiteAgent };
|
|
15
35
|
export { createPipelineCollectionFromDirectory };
|
|
16
36
|
export { getAllCommitmentsToolFunctionsForNode };
|
|
17
37
|
export { $provideExecutablesForNode };
|
|
@@ -4,6 +4,14 @@ import type { AgentBasicInformation } from '../book-2.0/agent-source/AgentBasicI
|
|
|
4
4
|
import type { AgentModelRequirements } from '../book-2.0/agent-source/AgentModelRequirements';
|
|
5
5
|
import type { CreateAgentModelRequirementsOptions } from '../book-2.0/agent-source/CreateAgentModelRequirementsOptions';
|
|
6
6
|
import type { string_book } from '../book-2.0/agent-source/string_book';
|
|
7
|
+
import type { BookNodeAgentSource } from '../book-3.0/BookNodeAgentSource';
|
|
8
|
+
import type { BookNodeAgentSourceOptions } from '../book-3.0/BookNodeAgentSource';
|
|
9
|
+
import type { CliAgentHarness } from '../book-3.0/CliAgent';
|
|
10
|
+
import type { CliAgentThinkingLevel } from '../book-3.0/CliAgent';
|
|
11
|
+
import type { CliAgentRunOptions } from '../book-3.0/CliAgent';
|
|
12
|
+
import type { CliAgentOptions } from '../book-3.0/CliAgent';
|
|
13
|
+
import type { LiteAgentOptions } from '../book-3.0/LiteAgent';
|
|
14
|
+
import type { LiteAgentRunOptions } from '../book-3.0/LiteAgent';
|
|
7
15
|
import type { AvatarChipProps } from '../book-components/AvatarProfile/AvatarChip/AvatarChip';
|
|
8
16
|
import type { AvatarChipFromSourceProps } from '../book-components/AvatarProfile/AvatarChip/AvatarChipFromSource';
|
|
9
17
|
import type { AvatarProfileProps } from '../book-components/AvatarProfile/AvatarProfile/AvatarProfile';
|
|
@@ -437,6 +445,14 @@ export type { AgentBasicInformation };
|
|
|
437
445
|
export type { AgentModelRequirements };
|
|
438
446
|
export type { CreateAgentModelRequirementsOptions };
|
|
439
447
|
export type { string_book };
|
|
448
|
+
export type { BookNodeAgentSource };
|
|
449
|
+
export type { BookNodeAgentSourceOptions };
|
|
450
|
+
export type { CliAgentHarness };
|
|
451
|
+
export type { CliAgentThinkingLevel };
|
|
452
|
+
export type { CliAgentRunOptions };
|
|
453
|
+
export type { CliAgentOptions };
|
|
454
|
+
export type { LiteAgentOptions };
|
|
455
|
+
export type { LiteAgentRunOptions };
|
|
440
456
|
export type { AvatarChipProps };
|
|
441
457
|
export type { AvatarChipFromSourceProps };
|
|
442
458
|
export type { AvatarProfileProps };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { string_book } from '../book-2.0/agent-source/string_book';
|
|
2
|
+
import { Book } from './Book';
|
|
3
|
+
/**
|
|
4
|
+
* Book source value accepted by Node-backed Book agents.
|
|
5
|
+
*
|
|
6
|
+
* @public exported from `@promptbook/node`
|
|
7
|
+
*/
|
|
8
|
+
export type BookNodeAgentSource = Book | string_book;
|
|
9
|
+
/**
|
|
10
|
+
* Common source options shared by Node-backed Book agents.
|
|
11
|
+
*
|
|
12
|
+
* Provide either `agentPath` or `book`.
|
|
13
|
+
*
|
|
14
|
+
* @public exported from `@promptbook/node`
|
|
15
|
+
*/
|
|
16
|
+
export type BookNodeAgentSourceOptions = {
|
|
17
|
+
readonly agentPath?: string;
|
|
18
|
+
readonly book?: BookNodeAgentSource;
|
|
19
|
+
readonly currentWorkingDirectory?: string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Normalized source snapshot used internally by Node-backed Book agents.
|
|
23
|
+
*
|
|
24
|
+
* @private internal utility of `CliAgent` and `LiteAgent`
|
|
25
|
+
*/
|
|
26
|
+
export type ResolvedBookNodeAgentSource = {
|
|
27
|
+
readonly agentName: string;
|
|
28
|
+
readonly agentPath: string | null;
|
|
29
|
+
readonly agentSource: string_book;
|
|
30
|
+
readonly currentWorkingDirectory: string;
|
|
31
|
+
readonly sourceDirectoryPath: string;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Resolves shared Node-backed Book source options into one normalized source snapshot.
|
|
35
|
+
*
|
|
36
|
+
* @private internal utility of `CliAgent` and `LiteAgent`
|
|
37
|
+
*/
|
|
38
|
+
export declare function resolveBookNodeAgentSource(options: BookNodeAgentSourceOptions): Promise<ResolvedBookNodeAgentSource>;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { BookNodeAgentSourceOptions } from './BookNodeAgentSource';
|
|
2
|
+
/**
|
|
3
|
+
* CLI harness names supported by `ptbk agent exec`.
|
|
4
|
+
*
|
|
5
|
+
* @public exported from `@promptbook/node`
|
|
6
|
+
*/
|
|
7
|
+
export type CliAgentHarness = 'openai-codex' | 'github-copilot' | 'cline' | 'claude-code' | 'opencode' | 'gemini';
|
|
8
|
+
/**
|
|
9
|
+
* Thinking levels supported by CLI coding harnesses.
|
|
10
|
+
*
|
|
11
|
+
* @public exported from `@promptbook/node`
|
|
12
|
+
*/
|
|
13
|
+
export type CliAgentThinkingLevel = 'low' | 'medium' | 'high' | 'xhigh';
|
|
14
|
+
/**
|
|
15
|
+
* Per-run CLI options exposed by `CliAgent`.
|
|
16
|
+
*
|
|
17
|
+
* `noUi` defaults to `true` so command output stays suitable for JavaScript callers.
|
|
18
|
+
*
|
|
19
|
+
* @public exported from `@promptbook/node`
|
|
20
|
+
*/
|
|
21
|
+
export type CliAgentRunOptions = {
|
|
22
|
+
readonly allowCredits?: boolean;
|
|
23
|
+
readonly context?: string;
|
|
24
|
+
readonly harness?: CliAgentHarness;
|
|
25
|
+
readonly model?: string;
|
|
26
|
+
readonly noUi?: boolean;
|
|
27
|
+
readonly thinkingLevel?: CliAgentThinkingLevel;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Constructor options for `CliAgent`.
|
|
31
|
+
*
|
|
32
|
+
* @public exported from `@promptbook/node`
|
|
33
|
+
*/
|
|
34
|
+
export type CliAgentOptions = BookNodeAgentSourceOptions & CliAgentRunOptions & {
|
|
35
|
+
/**
|
|
36
|
+
* Executable used for the wrapper command.
|
|
37
|
+
*
|
|
38
|
+
* @default ptbk
|
|
39
|
+
*/
|
|
40
|
+
readonly command?: string;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Lightweight JavaScript wrapper around `ptbk agent exec`.
|
|
44
|
+
*
|
|
45
|
+
* It uses the same CLI harnesses as Promptbook's agent command, making it the most faithful
|
|
46
|
+
* way to run a local Book agent from Node.js when you want the CLI execution flow.
|
|
47
|
+
*
|
|
48
|
+
* @public exported from `@promptbook/node`
|
|
49
|
+
*/
|
|
50
|
+
export declare class CliAgent {
|
|
51
|
+
private readonly options;
|
|
52
|
+
private temporaryAgentPath;
|
|
53
|
+
constructor(options: CliAgentOptions);
|
|
54
|
+
/**
|
|
55
|
+
* Runs one non-interactive agent turn through `ptbk agent exec`.
|
|
56
|
+
*
|
|
57
|
+
* @param message - User message sent to the agent.
|
|
58
|
+
* @param options - Optional per-run CLI overrides.
|
|
59
|
+
* @returns Raw stdout emitted by the CLI command.
|
|
60
|
+
*/
|
|
61
|
+
run(message: string, options?: CliAgentRunOptions): Promise<string>;
|
|
62
|
+
/**
|
|
63
|
+
* Resolves the agent path passed to the CLI, materializing one temporary `.book` file when needed.
|
|
64
|
+
*
|
|
65
|
+
* @private internal utility of `CliAgent`
|
|
66
|
+
*/
|
|
67
|
+
private resolveExecutableAgentPath;
|
|
68
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { CreateAgentModelRequirementsOptions } from '../book-2.0/agent-source/CreateAgentModelRequirementsOptions';
|
|
2
|
+
import type { ScriptExecutionTools } from '../execution/ScriptExecutionTools';
|
|
3
|
+
import type { string_model_name } from '../types/string_model_name';
|
|
4
|
+
import type { BookNodeAgentSourceOptions } from './BookNodeAgentSource';
|
|
5
|
+
/**
|
|
6
|
+
* Options for constructing one `LiteAgent`.
|
|
7
|
+
*
|
|
8
|
+
* `LiteAgent` is intentionally smaller than the CLI harnesses. It runs the Book through the
|
|
9
|
+
* OpenAI Agents SDK directly, while keeping Promptbook tool definitions and hosted knowledge
|
|
10
|
+
* whenever those features fit inside the lighter runtime.
|
|
11
|
+
*
|
|
12
|
+
* @public exported from `@promptbook/node`
|
|
13
|
+
*/
|
|
14
|
+
export type LiteAgentOptions = BookNodeAgentSourceOptions & {
|
|
15
|
+
readonly apiKey?: string;
|
|
16
|
+
readonly baseURL?: string;
|
|
17
|
+
readonly createAgentModelRequirementsOptions?: CreateAgentModelRequirementsOptions;
|
|
18
|
+
readonly isVerbose?: boolean;
|
|
19
|
+
readonly maxRequestsPerMinute?: number;
|
|
20
|
+
readonly modelName?: string_model_name;
|
|
21
|
+
readonly organization?: string;
|
|
22
|
+
readonly project?: string;
|
|
23
|
+
readonly scriptExecutionTools?: ScriptExecutionTools | ReadonlyArray<ScriptExecutionTools>;
|
|
24
|
+
readonly userId?: string;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Per-run options for `LiteAgent`.
|
|
28
|
+
*
|
|
29
|
+
* @public exported from `@promptbook/node`
|
|
30
|
+
*/
|
|
31
|
+
export type LiteAgentRunOptions = {
|
|
32
|
+
readonly context?: string;
|
|
33
|
+
readonly signal?: AbortSignal;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Lightweight Node.js wrapper around the OpenAI Agents SDK for Promptbook Books.
|
|
37
|
+
*
|
|
38
|
+
* This path is intentionally simpler than `ptbk agent exec`: it prepares one SDK agent in-process
|
|
39
|
+
* and reuses it across calls, which keeps JavaScript integration small while still honoring the
|
|
40
|
+
* compiled Promptbook system message, prompt suffix, tools, and hosted knowledge when supported.
|
|
41
|
+
*
|
|
42
|
+
* @public exported from `@promptbook/node`
|
|
43
|
+
*/
|
|
44
|
+
export declare class LiteAgent {
|
|
45
|
+
private readonly options;
|
|
46
|
+
private preparedAgentPromise;
|
|
47
|
+
constructor(options: LiteAgentOptions);
|
|
48
|
+
/**
|
|
49
|
+
* Runs one user message through the prepared OpenAI Agents SDK agent.
|
|
50
|
+
*
|
|
51
|
+
* @param message - User message sent to the agent.
|
|
52
|
+
* @param options - Optional context and cancellation signal.
|
|
53
|
+
* @returns Final text returned by the SDK agent.
|
|
54
|
+
*/
|
|
55
|
+
run(message: string, options?: LiteAgentRunOptions): Promise<string>;
|
|
56
|
+
/**
|
|
57
|
+
* Lazily prepares and caches the underlying OpenAI Agents SDK runtime.
|
|
58
|
+
*
|
|
59
|
+
* @private internal utility of `LiteAgent`
|
|
60
|
+
*/
|
|
61
|
+
private prepareAgent;
|
|
62
|
+
/**
|
|
63
|
+
* Builds the in-process OpenAI Agents SDK runtime from the Book source.
|
|
64
|
+
*
|
|
65
|
+
* @private internal utility of `LiteAgent`
|
|
66
|
+
*/
|
|
67
|
+
private createPreparedAgent;
|
|
68
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { AboutPromptbookInformationOptions } from '../../utils/misc/aboutPromptbookInformation';
|
|
2
|
+
/**
|
|
3
|
+
* Browser-safe Promptbook information used by `BookEditor`.
|
|
4
|
+
*
|
|
5
|
+
* The shared `AboutPromptbookInformation` component renders markdown through the
|
|
6
|
+
* chat markdown pipeline, which has a server-side JSDOM sanitizer path. Keeping
|
|
7
|
+
* this component plain JSX prevents BookEditor from pulling JSDOM into client
|
|
8
|
+
* bundles.
|
|
9
|
+
*
|
|
10
|
+
* @private Internal component used by `BookEditorActionbar`
|
|
11
|
+
*/
|
|
12
|
+
export declare function BookEditorAboutPromptbookInformation(props?: AboutPromptbookInformationOptions): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { NormalizedPromptRunnerSelectionCliOptions, PromptRunnerSelectionCliOptions } from '../common/promptRunnerCliOptions';
|
|
2
|
+
/**
|
|
3
|
+
* Commander option bag shared by `ptbk agent` subcommands.
|
|
4
|
+
*
|
|
5
|
+
* @private internal utility of `ptbk agent`
|
|
6
|
+
*/
|
|
7
|
+
export type AgentCommandCliOptions = PromptRunnerSelectionCliOptions & {
|
|
8
|
+
readonly agent?: string;
|
|
9
|
+
readonly context?: string;
|
|
10
|
+
readonly message?: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Normalizes shared runner flags for local agent subcommands.
|
|
14
|
+
*
|
|
15
|
+
* @private internal utility of `ptbk agent`
|
|
16
|
+
*/
|
|
17
|
+
export declare function normalizeAgentCommandRunnerOptions(cliOptions: AgentCommandCliOptions): NormalizedPromptRunnerSelectionCliOptions;
|
|
18
|
+
/**
|
|
19
|
+
* Returns the required agent book path from Commander options.
|
|
20
|
+
*
|
|
21
|
+
* @private internal utility of `ptbk agent`
|
|
22
|
+
*/
|
|
23
|
+
export declare function resolveRequiredAgentPath(cliOptions: AgentCommandCliOptions): string;
|
|
24
|
+
/**
|
|
25
|
+
* Returns the required single-turn user message from Commander options.
|
|
26
|
+
*
|
|
27
|
+
* @private internal utility of `ptbk agent`
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolveRequiredAgentMessage(cliOptions: AgentCommandCliOptions): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Command as Program } from 'commander';
|
|
2
|
+
import type { $side_effect } from '../../../utils/organization/$side_effect';
|
|
3
|
+
/**
|
|
4
|
+
* Initializes `agent chat` command for Promptbook CLI utilities.
|
|
5
|
+
*
|
|
6
|
+
* Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI.
|
|
7
|
+
*
|
|
8
|
+
* @private internal function of `promptbookCli`
|
|
9
|
+
*/
|
|
10
|
+
export declare function $initializeAgentChatCommand(program: Program): $side_effect;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Command as Program } from 'commander';
|
|
2
|
+
import type { $side_effect } from '../../../utils/organization/$side_effect';
|
|
3
|
+
/**
|
|
4
|
+
* Initializes `agent exec` command for Promptbook CLI utilities.
|
|
5
|
+
*
|
|
6
|
+
* Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI.
|
|
7
|
+
*
|
|
8
|
+
* @private internal function of `promptbookCli`
|
|
9
|
+
*/
|
|
10
|
+
export declare function $initializeAgentExecCommand(program: Program): $side_effect;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Command as Program } from 'commander';
|
|
2
|
+
import type { $side_effect } from '../../utils/organization/$side_effect';
|
|
3
|
+
/**
|
|
4
|
+
* Initializes `agent` command with subcommands for Promptbook CLI utilities.
|
|
5
|
+
*
|
|
6
|
+
* The agent command runs one `.book` source directly through a selected CLI harness:
|
|
7
|
+
* - chat: Run an interactive terminal chat session
|
|
8
|
+
* - exec: Send one message and print the response
|
|
9
|
+
*
|
|
10
|
+
* Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI.
|
|
11
|
+
*
|
|
12
|
+
* @private internal function of `promptbookCli`
|
|
13
|
+
*/
|
|
14
|
+
export declare function $initializeAgentCommand(program: Program): $side_effect;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ThinkingLevel } from '../coder/ThinkingLevel';
|
|
2
|
-
import type {
|
|
2
|
+
import type { PromptRunnerHarnessName } from '../common/promptRunnerCliOptions';
|
|
3
3
|
import type { number_port } from '../../../types/number_positive';
|
|
4
4
|
/**
|
|
5
5
|
* Next runtime mode supported by the local Agents Server foreground launcher.
|
|
@@ -14,7 +14,7 @@ export type AgentsServerNextRuntimeMode = 'start' | 'dev';
|
|
|
14
14
|
*/
|
|
15
15
|
export type StartAgentsServerOptions = {
|
|
16
16
|
readonly port: number_port;
|
|
17
|
-
readonly agentName:
|
|
17
|
+
readonly agentName: PromptRunnerHarnessName;
|
|
18
18
|
readonly model?: string;
|
|
19
19
|
readonly noUi: boolean;
|
|
20
20
|
readonly thinkingLevel?: ThinkingLevel;
|
|
@@ -29,8 +29,7 @@ export type StartAgentsServerOptions = {
|
|
|
29
29
|
*/
|
|
30
30
|
export declare function startAgentsServer(options: StartAgentsServerOptions): Promise<void>;
|
|
31
31
|
/**
|
|
32
|
-
* Loads
|
|
33
|
-
* to the launch-directory `.env`.
|
|
32
|
+
* Loads launch-directory `.env` values without overriding explicit process environment.
|
|
34
33
|
*
|
|
35
34
|
* @private internal utility of `ptbk agents-server`
|
|
36
35
|
*/
|
|
@@ -5,13 +5,13 @@ import type { ThinkingLevel } from '../coder/ThinkingLevel';
|
|
|
5
5
|
*
|
|
6
6
|
* @private internal utility of `promptbookCli`
|
|
7
7
|
*/
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const PROMPT_RUNNER_HARNESS_NAMES: readonly ["openai-codex", "github-copilot", "cline", "claude-code", "opencode", "gemini"];
|
|
9
9
|
/**
|
|
10
|
-
* Environment variable used as the default runner identifier when `--
|
|
10
|
+
* Environment variable used as the default runner identifier when `--harness` is omitted.
|
|
11
11
|
*
|
|
12
12
|
* @private internal utility of `promptbookCli`
|
|
13
13
|
*/
|
|
14
|
-
export declare const
|
|
14
|
+
export declare const PTBK_HARNESS_ENV = "PTBK_HARNESS";
|
|
15
15
|
/**
|
|
16
16
|
* Environment variable used as the default runner model when `--model` is omitted.
|
|
17
17
|
*
|
|
@@ -29,14 +29,14 @@ export declare const PTBK_THINKING_LEVEL_ENV = "PTBK_THINKING_LEVEL";
|
|
|
29
29
|
*
|
|
30
30
|
* @private internal utility of `promptbookCli`
|
|
31
31
|
*/
|
|
32
|
-
export type
|
|
32
|
+
export type PromptRunnerHarnessName = (typeof PROMPT_RUNNER_HARNESS_NAMES)[number];
|
|
33
33
|
/**
|
|
34
34
|
* Commander option bag for shared runner flags.
|
|
35
35
|
*
|
|
36
36
|
* @private internal utility of `promptbookCli`
|
|
37
37
|
*/
|
|
38
38
|
export type PromptRunnerCliOptions = {
|
|
39
|
-
readonly
|
|
39
|
+
readonly harness?: string;
|
|
40
40
|
readonly model?: string;
|
|
41
41
|
readonly ui: boolean;
|
|
42
42
|
readonly thinkingLevel?: ThinkingLevel;
|
|
@@ -52,14 +52,14 @@ export type PromptRunnerCliOptions = {
|
|
|
52
52
|
*
|
|
53
53
|
* @private internal utility of `promptbookCli`
|
|
54
54
|
*/
|
|
55
|
-
export type PromptRunnerSelectionCliOptions = Pick<PromptRunnerCliOptions, '
|
|
55
|
+
export type PromptRunnerSelectionCliOptions = Pick<PromptRunnerCliOptions, 'harness' | 'model' | 'ui' | 'thinkingLevel' | 'allowCredits'>;
|
|
56
56
|
/**
|
|
57
57
|
* Normalized runner options used by runner-backed CLI commands.
|
|
58
58
|
*
|
|
59
59
|
* @private internal utility of `promptbookCli`
|
|
60
60
|
*/
|
|
61
61
|
export type NormalizedPromptRunnerCliOptions = {
|
|
62
|
-
readonly agentName?:
|
|
62
|
+
readonly agentName?: PromptRunnerHarnessName;
|
|
63
63
|
readonly model?: string;
|
|
64
64
|
readonly noUi: boolean;
|
|
65
65
|
readonly thinkingLevel?: ThinkingLevel;
|
|
@@ -83,11 +83,11 @@ export type NormalizedPromptRunnerSelectionCliOptions = Pick<NormalizedPromptRun
|
|
|
83
83
|
*/
|
|
84
84
|
export declare const PROMPT_RUNNER_DESCRIPTION: string;
|
|
85
85
|
/**
|
|
86
|
-
* Commander description for the `--
|
|
86
|
+
* Commander description for the `--harness` option.
|
|
87
87
|
*
|
|
88
88
|
* @private internal utility of `promptbookCli`
|
|
89
89
|
*/
|
|
90
|
-
export declare const
|
|
90
|
+
export declare const PROMPT_RUNNER_HARNESS_OPTION_DESCRIPTION = "Select runner: openai-codex, github-copilot, cline, claude-code, opencode, gemini (required for non-dry-run)";
|
|
91
91
|
/**
|
|
92
92
|
* Commander description for the `--model` option.
|
|
93
93
|
*
|
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-112`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/documents",
|
|
3
|
-
"version": "0.112.0-
|
|
3
|
+
"version": "0.112.0-113",
|
|
4
4
|
"description": "Promptbook: Create persistent AI agents that turn your company's scattered knowledge into action",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"types": "./esm/src/_packages/documents.index.d.ts",
|
|
100
100
|
"typings": "./esm/src/_packages/documents.index.d.ts",
|
|
101
101
|
"peerDependencies": {
|
|
102
|
-
"@promptbook/core": "0.112.0-
|
|
102
|
+
"@promptbook/core": "0.112.0-113"
|
|
103
103
|
},
|
|
104
104
|
"dependencies": {
|
|
105
105
|
"colors": "1.4.0",
|
package/umd/index.umd.js
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* @generated
|
|
25
25
|
* @see https://github.com/webgptorg/promptbook
|
|
26
26
|
*/
|
|
27
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
27
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-113';
|
|
28
28
|
/**
|
|
29
29
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
30
30
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION } from '../version';
|
|
2
|
+
import type { BookNodeAgentSource } from '../book-3.0/BookNodeAgentSource';
|
|
3
|
+
import type { BookNodeAgentSourceOptions } from '../book-3.0/BookNodeAgentSource';
|
|
4
|
+
import type { CliAgentHarness } from '../book-3.0/CliAgent';
|
|
5
|
+
import type { CliAgentThinkingLevel } from '../book-3.0/CliAgent';
|
|
6
|
+
import type { CliAgentRunOptions } from '../book-3.0/CliAgent';
|
|
7
|
+
import type { CliAgentOptions } from '../book-3.0/CliAgent';
|
|
8
|
+
import { CliAgent } from '../book-3.0/CliAgent';
|
|
9
|
+
import type { LiteAgentOptions } from '../book-3.0/LiteAgent';
|
|
10
|
+
import type { LiteAgentRunOptions } from '../book-3.0/LiteAgent';
|
|
11
|
+
import { LiteAgent } from '../book-3.0/LiteAgent';
|
|
2
12
|
import { createPipelineCollectionFromDirectory } from '../collection/pipeline-collection/constructors/createPipelineCollectionFromDirectory';
|
|
3
13
|
import { getAllCommitmentsToolFunctionsForNode } from '../commitments/_common/getAllCommitmentsToolFunctionsForNode';
|
|
4
14
|
import { $provideExecutablesForNode } from '../executables/$provideExecutablesForNode';
|
|
@@ -12,6 +22,16 @@ import { FileCacheStorage } from '../storage/file-cache-storage/FileCacheStorage
|
|
|
12
22
|
import { $execCommand } from '../utils/execCommand/$execCommand';
|
|
13
23
|
import { $execCommands } from '../utils/execCommand/$execCommands';
|
|
14
24
|
export { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION };
|
|
25
|
+
export type { BookNodeAgentSource };
|
|
26
|
+
export type { BookNodeAgentSourceOptions };
|
|
27
|
+
export type { CliAgentHarness };
|
|
28
|
+
export type { CliAgentThinkingLevel };
|
|
29
|
+
export type { CliAgentRunOptions };
|
|
30
|
+
export type { CliAgentOptions };
|
|
31
|
+
export { CliAgent };
|
|
32
|
+
export type { LiteAgentOptions };
|
|
33
|
+
export type { LiteAgentRunOptions };
|
|
34
|
+
export { LiteAgent };
|
|
15
35
|
export { createPipelineCollectionFromDirectory };
|
|
16
36
|
export { getAllCommitmentsToolFunctionsForNode };
|
|
17
37
|
export { $provideExecutablesForNode };
|
|
@@ -4,6 +4,14 @@ import type { AgentBasicInformation } from '../book-2.0/agent-source/AgentBasicI
|
|
|
4
4
|
import type { AgentModelRequirements } from '../book-2.0/agent-source/AgentModelRequirements';
|
|
5
5
|
import type { CreateAgentModelRequirementsOptions } from '../book-2.0/agent-source/CreateAgentModelRequirementsOptions';
|
|
6
6
|
import type { string_book } from '../book-2.0/agent-source/string_book';
|
|
7
|
+
import type { BookNodeAgentSource } from '../book-3.0/BookNodeAgentSource';
|
|
8
|
+
import type { BookNodeAgentSourceOptions } from '../book-3.0/BookNodeAgentSource';
|
|
9
|
+
import type { CliAgentHarness } from '../book-3.0/CliAgent';
|
|
10
|
+
import type { CliAgentThinkingLevel } from '../book-3.0/CliAgent';
|
|
11
|
+
import type { CliAgentRunOptions } from '../book-3.0/CliAgent';
|
|
12
|
+
import type { CliAgentOptions } from '../book-3.0/CliAgent';
|
|
13
|
+
import type { LiteAgentOptions } from '../book-3.0/LiteAgent';
|
|
14
|
+
import type { LiteAgentRunOptions } from '../book-3.0/LiteAgent';
|
|
7
15
|
import type { AvatarChipProps } from '../book-components/AvatarProfile/AvatarChip/AvatarChip';
|
|
8
16
|
import type { AvatarChipFromSourceProps } from '../book-components/AvatarProfile/AvatarChip/AvatarChipFromSource';
|
|
9
17
|
import type { AvatarProfileProps } from '../book-components/AvatarProfile/AvatarProfile/AvatarProfile';
|
|
@@ -437,6 +445,14 @@ export type { AgentBasicInformation };
|
|
|
437
445
|
export type { AgentModelRequirements };
|
|
438
446
|
export type { CreateAgentModelRequirementsOptions };
|
|
439
447
|
export type { string_book };
|
|
448
|
+
export type { BookNodeAgentSource };
|
|
449
|
+
export type { BookNodeAgentSourceOptions };
|
|
450
|
+
export type { CliAgentHarness };
|
|
451
|
+
export type { CliAgentThinkingLevel };
|
|
452
|
+
export type { CliAgentRunOptions };
|
|
453
|
+
export type { CliAgentOptions };
|
|
454
|
+
export type { LiteAgentOptions };
|
|
455
|
+
export type { LiteAgentRunOptions };
|
|
440
456
|
export type { AvatarChipProps };
|
|
441
457
|
export type { AvatarChipFromSourceProps };
|
|
442
458
|
export type { AvatarProfileProps };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { string_book } from '../book-2.0/agent-source/string_book';
|
|
2
|
+
import { Book } from './Book';
|
|
3
|
+
/**
|
|
4
|
+
* Book source value accepted by Node-backed Book agents.
|
|
5
|
+
*
|
|
6
|
+
* @public exported from `@promptbook/node`
|
|
7
|
+
*/
|
|
8
|
+
export type BookNodeAgentSource = Book | string_book;
|
|
9
|
+
/**
|
|
10
|
+
* Common source options shared by Node-backed Book agents.
|
|
11
|
+
*
|
|
12
|
+
* Provide either `agentPath` or `book`.
|
|
13
|
+
*
|
|
14
|
+
* @public exported from `@promptbook/node`
|
|
15
|
+
*/
|
|
16
|
+
export type BookNodeAgentSourceOptions = {
|
|
17
|
+
readonly agentPath?: string;
|
|
18
|
+
readonly book?: BookNodeAgentSource;
|
|
19
|
+
readonly currentWorkingDirectory?: string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Normalized source snapshot used internally by Node-backed Book agents.
|
|
23
|
+
*
|
|
24
|
+
* @private internal utility of `CliAgent` and `LiteAgent`
|
|
25
|
+
*/
|
|
26
|
+
export type ResolvedBookNodeAgentSource = {
|
|
27
|
+
readonly agentName: string;
|
|
28
|
+
readonly agentPath: string | null;
|
|
29
|
+
readonly agentSource: string_book;
|
|
30
|
+
readonly currentWorkingDirectory: string;
|
|
31
|
+
readonly sourceDirectoryPath: string;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Resolves shared Node-backed Book source options into one normalized source snapshot.
|
|
35
|
+
*
|
|
36
|
+
* @private internal utility of `CliAgent` and `LiteAgent`
|
|
37
|
+
*/
|
|
38
|
+
export declare function resolveBookNodeAgentSource(options: BookNodeAgentSourceOptions): Promise<ResolvedBookNodeAgentSource>;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { BookNodeAgentSourceOptions } from './BookNodeAgentSource';
|
|
2
|
+
/**
|
|
3
|
+
* CLI harness names supported by `ptbk agent exec`.
|
|
4
|
+
*
|
|
5
|
+
* @public exported from `@promptbook/node`
|
|
6
|
+
*/
|
|
7
|
+
export type CliAgentHarness = 'openai-codex' | 'github-copilot' | 'cline' | 'claude-code' | 'opencode' | 'gemini';
|
|
8
|
+
/**
|
|
9
|
+
* Thinking levels supported by CLI coding harnesses.
|
|
10
|
+
*
|
|
11
|
+
* @public exported from `@promptbook/node`
|
|
12
|
+
*/
|
|
13
|
+
export type CliAgentThinkingLevel = 'low' | 'medium' | 'high' | 'xhigh';
|
|
14
|
+
/**
|
|
15
|
+
* Per-run CLI options exposed by `CliAgent`.
|
|
16
|
+
*
|
|
17
|
+
* `noUi` defaults to `true` so command output stays suitable for JavaScript callers.
|
|
18
|
+
*
|
|
19
|
+
* @public exported from `@promptbook/node`
|
|
20
|
+
*/
|
|
21
|
+
export type CliAgentRunOptions = {
|
|
22
|
+
readonly allowCredits?: boolean;
|
|
23
|
+
readonly context?: string;
|
|
24
|
+
readonly harness?: CliAgentHarness;
|
|
25
|
+
readonly model?: string;
|
|
26
|
+
readonly noUi?: boolean;
|
|
27
|
+
readonly thinkingLevel?: CliAgentThinkingLevel;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Constructor options for `CliAgent`.
|
|
31
|
+
*
|
|
32
|
+
* @public exported from `@promptbook/node`
|
|
33
|
+
*/
|
|
34
|
+
export type CliAgentOptions = BookNodeAgentSourceOptions & CliAgentRunOptions & {
|
|
35
|
+
/**
|
|
36
|
+
* Executable used for the wrapper command.
|
|
37
|
+
*
|
|
38
|
+
* @default ptbk
|
|
39
|
+
*/
|
|
40
|
+
readonly command?: string;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Lightweight JavaScript wrapper around `ptbk agent exec`.
|
|
44
|
+
*
|
|
45
|
+
* It uses the same CLI harnesses as Promptbook's agent command, making it the most faithful
|
|
46
|
+
* way to run a local Book agent from Node.js when you want the CLI execution flow.
|
|
47
|
+
*
|
|
48
|
+
* @public exported from `@promptbook/node`
|
|
49
|
+
*/
|
|
50
|
+
export declare class CliAgent {
|
|
51
|
+
private readonly options;
|
|
52
|
+
private temporaryAgentPath;
|
|
53
|
+
constructor(options: CliAgentOptions);
|
|
54
|
+
/**
|
|
55
|
+
* Runs one non-interactive agent turn through `ptbk agent exec`.
|
|
56
|
+
*
|
|
57
|
+
* @param message - User message sent to the agent.
|
|
58
|
+
* @param options - Optional per-run CLI overrides.
|
|
59
|
+
* @returns Raw stdout emitted by the CLI command.
|
|
60
|
+
*/
|
|
61
|
+
run(message: string, options?: CliAgentRunOptions): Promise<string>;
|
|
62
|
+
/**
|
|
63
|
+
* Resolves the agent path passed to the CLI, materializing one temporary `.book` file when needed.
|
|
64
|
+
*
|
|
65
|
+
* @private internal utility of `CliAgent`
|
|
66
|
+
*/
|
|
67
|
+
private resolveExecutableAgentPath;
|
|
68
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { CreateAgentModelRequirementsOptions } from '../book-2.0/agent-source/CreateAgentModelRequirementsOptions';
|
|
2
|
+
import type { ScriptExecutionTools } from '../execution/ScriptExecutionTools';
|
|
3
|
+
import type { string_model_name } from '../types/string_model_name';
|
|
4
|
+
import type { BookNodeAgentSourceOptions } from './BookNodeAgentSource';
|
|
5
|
+
/**
|
|
6
|
+
* Options for constructing one `LiteAgent`.
|
|
7
|
+
*
|
|
8
|
+
* `LiteAgent` is intentionally smaller than the CLI harnesses. It runs the Book through the
|
|
9
|
+
* OpenAI Agents SDK directly, while keeping Promptbook tool definitions and hosted knowledge
|
|
10
|
+
* whenever those features fit inside the lighter runtime.
|
|
11
|
+
*
|
|
12
|
+
* @public exported from `@promptbook/node`
|
|
13
|
+
*/
|
|
14
|
+
export type LiteAgentOptions = BookNodeAgentSourceOptions & {
|
|
15
|
+
readonly apiKey?: string;
|
|
16
|
+
readonly baseURL?: string;
|
|
17
|
+
readonly createAgentModelRequirementsOptions?: CreateAgentModelRequirementsOptions;
|
|
18
|
+
readonly isVerbose?: boolean;
|
|
19
|
+
readonly maxRequestsPerMinute?: number;
|
|
20
|
+
readonly modelName?: string_model_name;
|
|
21
|
+
readonly organization?: string;
|
|
22
|
+
readonly project?: string;
|
|
23
|
+
readonly scriptExecutionTools?: ScriptExecutionTools | ReadonlyArray<ScriptExecutionTools>;
|
|
24
|
+
readonly userId?: string;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Per-run options for `LiteAgent`.
|
|
28
|
+
*
|
|
29
|
+
* @public exported from `@promptbook/node`
|
|
30
|
+
*/
|
|
31
|
+
export type LiteAgentRunOptions = {
|
|
32
|
+
readonly context?: string;
|
|
33
|
+
readonly signal?: AbortSignal;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Lightweight Node.js wrapper around the OpenAI Agents SDK for Promptbook Books.
|
|
37
|
+
*
|
|
38
|
+
* This path is intentionally simpler than `ptbk agent exec`: it prepares one SDK agent in-process
|
|
39
|
+
* and reuses it across calls, which keeps JavaScript integration small while still honoring the
|
|
40
|
+
* compiled Promptbook system message, prompt suffix, tools, and hosted knowledge when supported.
|
|
41
|
+
*
|
|
42
|
+
* @public exported from `@promptbook/node`
|
|
43
|
+
*/
|
|
44
|
+
export declare class LiteAgent {
|
|
45
|
+
private readonly options;
|
|
46
|
+
private preparedAgentPromise;
|
|
47
|
+
constructor(options: LiteAgentOptions);
|
|
48
|
+
/**
|
|
49
|
+
* Runs one user message through the prepared OpenAI Agents SDK agent.
|
|
50
|
+
*
|
|
51
|
+
* @param message - User message sent to the agent.
|
|
52
|
+
* @param options - Optional context and cancellation signal.
|
|
53
|
+
* @returns Final text returned by the SDK agent.
|
|
54
|
+
*/
|
|
55
|
+
run(message: string, options?: LiteAgentRunOptions): Promise<string>;
|
|
56
|
+
/**
|
|
57
|
+
* Lazily prepares and caches the underlying OpenAI Agents SDK runtime.
|
|
58
|
+
*
|
|
59
|
+
* @private internal utility of `LiteAgent`
|
|
60
|
+
*/
|
|
61
|
+
private prepareAgent;
|
|
62
|
+
/**
|
|
63
|
+
* Builds the in-process OpenAI Agents SDK runtime from the Book source.
|
|
64
|
+
*
|
|
65
|
+
* @private internal utility of `LiteAgent`
|
|
66
|
+
*/
|
|
67
|
+
private createPreparedAgent;
|
|
68
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { AboutPromptbookInformationOptions } from '../../utils/misc/aboutPromptbookInformation';
|
|
2
|
+
/**
|
|
3
|
+
* Browser-safe Promptbook information used by `BookEditor`.
|
|
4
|
+
*
|
|
5
|
+
* The shared `AboutPromptbookInformation` component renders markdown through the
|
|
6
|
+
* chat markdown pipeline, which has a server-side JSDOM sanitizer path. Keeping
|
|
7
|
+
* this component plain JSX prevents BookEditor from pulling JSDOM into client
|
|
8
|
+
* bundles.
|
|
9
|
+
*
|
|
10
|
+
* @private Internal component used by `BookEditorActionbar`
|
|
11
|
+
*/
|
|
12
|
+
export declare function BookEditorAboutPromptbookInformation(props?: AboutPromptbookInformationOptions): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { NormalizedPromptRunnerSelectionCliOptions, PromptRunnerSelectionCliOptions } from '../common/promptRunnerCliOptions';
|
|
2
|
+
/**
|
|
3
|
+
* Commander option bag shared by `ptbk agent` subcommands.
|
|
4
|
+
*
|
|
5
|
+
* @private internal utility of `ptbk agent`
|
|
6
|
+
*/
|
|
7
|
+
export type AgentCommandCliOptions = PromptRunnerSelectionCliOptions & {
|
|
8
|
+
readonly agent?: string;
|
|
9
|
+
readonly context?: string;
|
|
10
|
+
readonly message?: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Normalizes shared runner flags for local agent subcommands.
|
|
14
|
+
*
|
|
15
|
+
* @private internal utility of `ptbk agent`
|
|
16
|
+
*/
|
|
17
|
+
export declare function normalizeAgentCommandRunnerOptions(cliOptions: AgentCommandCliOptions): NormalizedPromptRunnerSelectionCliOptions;
|
|
18
|
+
/**
|
|
19
|
+
* Returns the required agent book path from Commander options.
|
|
20
|
+
*
|
|
21
|
+
* @private internal utility of `ptbk agent`
|
|
22
|
+
*/
|
|
23
|
+
export declare function resolveRequiredAgentPath(cliOptions: AgentCommandCliOptions): string;
|
|
24
|
+
/**
|
|
25
|
+
* Returns the required single-turn user message from Commander options.
|
|
26
|
+
*
|
|
27
|
+
* @private internal utility of `ptbk agent`
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolveRequiredAgentMessage(cliOptions: AgentCommandCliOptions): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Command as Program } from 'commander';
|
|
2
|
+
import type { $side_effect } from '../../../utils/organization/$side_effect';
|
|
3
|
+
/**
|
|
4
|
+
* Initializes `agent chat` command for Promptbook CLI utilities.
|
|
5
|
+
*
|
|
6
|
+
* Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI.
|
|
7
|
+
*
|
|
8
|
+
* @private internal function of `promptbookCli`
|
|
9
|
+
*/
|
|
10
|
+
export declare function $initializeAgentChatCommand(program: Program): $side_effect;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Command as Program } from 'commander';
|
|
2
|
+
import type { $side_effect } from '../../../utils/organization/$side_effect';
|
|
3
|
+
/**
|
|
4
|
+
* Initializes `agent exec` command for Promptbook CLI utilities.
|
|
5
|
+
*
|
|
6
|
+
* Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI.
|
|
7
|
+
*
|
|
8
|
+
* @private internal function of `promptbookCli`
|
|
9
|
+
*/
|
|
10
|
+
export declare function $initializeAgentExecCommand(program: Program): $side_effect;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Command as Program } from 'commander';
|
|
2
|
+
import type { $side_effect } from '../../utils/organization/$side_effect';
|
|
3
|
+
/**
|
|
4
|
+
* Initializes `agent` command with subcommands for Promptbook CLI utilities.
|
|
5
|
+
*
|
|
6
|
+
* The agent command runs one `.book` source directly through a selected CLI harness:
|
|
7
|
+
* - chat: Run an interactive terminal chat session
|
|
8
|
+
* - exec: Send one message and print the response
|
|
9
|
+
*
|
|
10
|
+
* Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI.
|
|
11
|
+
*
|
|
12
|
+
* @private internal function of `promptbookCli`
|
|
13
|
+
*/
|
|
14
|
+
export declare function $initializeAgentCommand(program: Program): $side_effect;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ThinkingLevel } from '../coder/ThinkingLevel';
|
|
2
|
-
import type {
|
|
2
|
+
import type { PromptRunnerHarnessName } from '../common/promptRunnerCliOptions';
|
|
3
3
|
import type { number_port } from '../../../types/number_positive';
|
|
4
4
|
/**
|
|
5
5
|
* Next runtime mode supported by the local Agents Server foreground launcher.
|
|
@@ -14,7 +14,7 @@ export type AgentsServerNextRuntimeMode = 'start' | 'dev';
|
|
|
14
14
|
*/
|
|
15
15
|
export type StartAgentsServerOptions = {
|
|
16
16
|
readonly port: number_port;
|
|
17
|
-
readonly agentName:
|
|
17
|
+
readonly agentName: PromptRunnerHarnessName;
|
|
18
18
|
readonly model?: string;
|
|
19
19
|
readonly noUi: boolean;
|
|
20
20
|
readonly thinkingLevel?: ThinkingLevel;
|
|
@@ -29,8 +29,7 @@ export type StartAgentsServerOptions = {
|
|
|
29
29
|
*/
|
|
30
30
|
export declare function startAgentsServer(options: StartAgentsServerOptions): Promise<void>;
|
|
31
31
|
/**
|
|
32
|
-
* Loads
|
|
33
|
-
* to the launch-directory `.env`.
|
|
32
|
+
* Loads launch-directory `.env` values without overriding explicit process environment.
|
|
34
33
|
*
|
|
35
34
|
* @private internal utility of `ptbk agents-server`
|
|
36
35
|
*/
|
|
@@ -5,13 +5,13 @@ import type { ThinkingLevel } from '../coder/ThinkingLevel';
|
|
|
5
5
|
*
|
|
6
6
|
* @private internal utility of `promptbookCli`
|
|
7
7
|
*/
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const PROMPT_RUNNER_HARNESS_NAMES: readonly ["openai-codex", "github-copilot", "cline", "claude-code", "opencode", "gemini"];
|
|
9
9
|
/**
|
|
10
|
-
* Environment variable used as the default runner identifier when `--
|
|
10
|
+
* Environment variable used as the default runner identifier when `--harness` is omitted.
|
|
11
11
|
*
|
|
12
12
|
* @private internal utility of `promptbookCli`
|
|
13
13
|
*/
|
|
14
|
-
export declare const
|
|
14
|
+
export declare const PTBK_HARNESS_ENV = "PTBK_HARNESS";
|
|
15
15
|
/**
|
|
16
16
|
* Environment variable used as the default runner model when `--model` is omitted.
|
|
17
17
|
*
|
|
@@ -29,14 +29,14 @@ export declare const PTBK_THINKING_LEVEL_ENV = "PTBK_THINKING_LEVEL";
|
|
|
29
29
|
*
|
|
30
30
|
* @private internal utility of `promptbookCli`
|
|
31
31
|
*/
|
|
32
|
-
export type
|
|
32
|
+
export type PromptRunnerHarnessName = (typeof PROMPT_RUNNER_HARNESS_NAMES)[number];
|
|
33
33
|
/**
|
|
34
34
|
* Commander option bag for shared runner flags.
|
|
35
35
|
*
|
|
36
36
|
* @private internal utility of `promptbookCli`
|
|
37
37
|
*/
|
|
38
38
|
export type PromptRunnerCliOptions = {
|
|
39
|
-
readonly
|
|
39
|
+
readonly harness?: string;
|
|
40
40
|
readonly model?: string;
|
|
41
41
|
readonly ui: boolean;
|
|
42
42
|
readonly thinkingLevel?: ThinkingLevel;
|
|
@@ -52,14 +52,14 @@ export type PromptRunnerCliOptions = {
|
|
|
52
52
|
*
|
|
53
53
|
* @private internal utility of `promptbookCli`
|
|
54
54
|
*/
|
|
55
|
-
export type PromptRunnerSelectionCliOptions = Pick<PromptRunnerCliOptions, '
|
|
55
|
+
export type PromptRunnerSelectionCliOptions = Pick<PromptRunnerCliOptions, 'harness' | 'model' | 'ui' | 'thinkingLevel' | 'allowCredits'>;
|
|
56
56
|
/**
|
|
57
57
|
* Normalized runner options used by runner-backed CLI commands.
|
|
58
58
|
*
|
|
59
59
|
* @private internal utility of `promptbookCli`
|
|
60
60
|
*/
|
|
61
61
|
export type NormalizedPromptRunnerCliOptions = {
|
|
62
|
-
readonly agentName?:
|
|
62
|
+
readonly agentName?: PromptRunnerHarnessName;
|
|
63
63
|
readonly model?: string;
|
|
64
64
|
readonly noUi: boolean;
|
|
65
65
|
readonly thinkingLevel?: ThinkingLevel;
|
|
@@ -83,11 +83,11 @@ export type NormalizedPromptRunnerSelectionCliOptions = Pick<NormalizedPromptRun
|
|
|
83
83
|
*/
|
|
84
84
|
export declare const PROMPT_RUNNER_DESCRIPTION: string;
|
|
85
85
|
/**
|
|
86
|
-
* Commander description for the `--
|
|
86
|
+
* Commander description for the `--harness` option.
|
|
87
87
|
*
|
|
88
88
|
* @private internal utility of `promptbookCli`
|
|
89
89
|
*/
|
|
90
|
-
export declare const
|
|
90
|
+
export declare const PROMPT_RUNNER_HARNESS_OPTION_DESCRIPTION = "Select runner: openai-codex, github-copilot, cline, claude-code, opencode, gemini (required for non-dry-run)";
|
|
91
91
|
/**
|
|
92
92
|
* Commander description for the `--model` option.
|
|
93
93
|
*
|
package/umd/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-112`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
|
File without changes
|
|
File without changes
|