@promptbook/utils 0.112.0-112 → 0.112.0-114
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 +38 -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 +1 -1
- 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 +38 -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
|
@@ -743,11 +743,11 @@ npx ts-node ./src/cli/test/ptbk.ts coder generate-boilerplates --template prompt
|
|
|
743
743
|
|
|
744
744
|
npx ts-node ./src/cli/test/ptbk.ts coder generate-boilerplates --template prompts/templates/agents-server.md
|
|
745
745
|
|
|
746
|
-
npx ts-node ./src/cli/test/ptbk.ts coder run --
|
|
746
|
+
npx ts-node ./src/cli/test/ptbk.ts coder run --harness github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md
|
|
747
747
|
|
|
748
|
-
npx ts-node ./src/cli/test/ptbk.ts coder run --
|
|
748
|
+
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
|
|
749
749
|
|
|
750
|
-
npx ts-node ./src/cli/test/ptbk.ts coder run --
|
|
750
|
+
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
|
|
751
751
|
|
|
752
752
|
npx ts-node ./src/cli/test/ptbk.ts coder find-refactor-candidates
|
|
753
753
|
|
|
@@ -769,11 +769,11 @@ ptbk coder generate-boilerplates
|
|
|
769
769
|
|
|
770
770
|
ptbk coder generate-boilerplates --template prompts/templates/common.md
|
|
771
771
|
|
|
772
|
-
ptbk coder run --
|
|
772
|
+
ptbk coder run --harness github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md --test npm run test
|
|
773
773
|
|
|
774
|
-
ptbk coder run --
|
|
774
|
+
ptbk coder run --harness github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md --auto-push
|
|
775
775
|
|
|
776
|
-
ptbk coder run --
|
|
776
|
+
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
|
|
777
777
|
|
|
778
778
|
ptbk coder find-refactor-candidates
|
|
779
779
|
|
|
@@ -798,7 +798,7 @@ ptbk coder verify
|
|
|
798
798
|
|
|
799
799
|
| Flag | Purpose |
|
|
800
800
|
| -------------------------- | -------------------------------------------------------------------------------------------------- |
|
|
801
|
-
| `--
|
|
801
|
+
| `--harness <name>` | Selects the coding harness. |
|
|
802
802
|
| `--model <model>` | Chooses the runner model; required for `openai-codex` and `gemini`, optional for `github-copilot`. |
|
|
803
803
|
| `--context <text-or-file>` | Appends extra instructions inline or from a file like `AGENTS.md`. |
|
|
804
804
|
| `--test <command>` | Runs a verification command after each prompt attempt and feeds failing output back for retries. |
|
package/esm/index.es.js
CHANGED
|
@@ -18,7 +18,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
18
18
|
* @generated
|
|
19
19
|
* @see https://github.com/webgptorg/promptbook
|
|
20
20
|
*/
|
|
21
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
21
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-114';
|
|
22
22
|
/**
|
|
23
23
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
24
24
|
* 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,38 @@
|
|
|
1
|
+
import type { Command as Program } from 'commander';
|
|
2
|
+
import type { NormalizedPromptRunnerSelectionCliOptions, PromptRunnerSelectionCliOptions } from '../common/promptRunnerCliOptions';
|
|
3
|
+
/**
|
|
4
|
+
* Commander option bag shared by `ptbk agent` subcommands.
|
|
5
|
+
*
|
|
6
|
+
* @private internal utility of `ptbk agent`
|
|
7
|
+
*/
|
|
8
|
+
export type AgentCommandCliOptions = PromptRunnerSelectionCliOptions & {
|
|
9
|
+
readonly agent?: string;
|
|
10
|
+
readonly context?: string;
|
|
11
|
+
readonly message?: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Normalized shared options used by local `ptbk agent` subcommands.
|
|
15
|
+
*
|
|
16
|
+
* @private internal utility of `ptbk agent`
|
|
17
|
+
*/
|
|
18
|
+
export type NormalizedAgentCommandRunnerOptions = NormalizedPromptRunnerSelectionCliOptions & {
|
|
19
|
+
readonly isVerbose: boolean;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Normalizes shared runner flags for local agent subcommands.
|
|
23
|
+
*
|
|
24
|
+
* @private internal utility of `ptbk agent`
|
|
25
|
+
*/
|
|
26
|
+
export declare function normalizeAgentCommandRunnerOptions(cliOptions: AgentCommandCliOptions, command: Program): NormalizedAgentCommandRunnerOptions;
|
|
27
|
+
/**
|
|
28
|
+
* Returns the required agent book path from Commander options.
|
|
29
|
+
*
|
|
30
|
+
* @private internal utility of `ptbk agent`
|
|
31
|
+
*/
|
|
32
|
+
export declare function resolveRequiredAgentPath(cliOptions: AgentCommandCliOptions): string;
|
|
33
|
+
/**
|
|
34
|
+
* Returns the required single-turn user message from Commander options.
|
|
35
|
+
*
|
|
36
|
+
* @private internal utility of `ptbk agent`
|
|
37
|
+
*/
|
|
38
|
+
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-113`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
package/umd/index.umd.js
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* @generated
|
|
23
23
|
* @see https://github.com/webgptorg/promptbook
|
|
24
24
|
*/
|
|
25
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
25
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-114';
|
|
26
26
|
/**
|
|
27
27
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
28
28
|
* 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,38 @@
|
|
|
1
|
+
import type { Command as Program } from 'commander';
|
|
2
|
+
import type { NormalizedPromptRunnerSelectionCliOptions, PromptRunnerSelectionCliOptions } from '../common/promptRunnerCliOptions';
|
|
3
|
+
/**
|
|
4
|
+
* Commander option bag shared by `ptbk agent` subcommands.
|
|
5
|
+
*
|
|
6
|
+
* @private internal utility of `ptbk agent`
|
|
7
|
+
*/
|
|
8
|
+
export type AgentCommandCliOptions = PromptRunnerSelectionCliOptions & {
|
|
9
|
+
readonly agent?: string;
|
|
10
|
+
readonly context?: string;
|
|
11
|
+
readonly message?: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Normalized shared options used by local `ptbk agent` subcommands.
|
|
15
|
+
*
|
|
16
|
+
* @private internal utility of `ptbk agent`
|
|
17
|
+
*/
|
|
18
|
+
export type NormalizedAgentCommandRunnerOptions = NormalizedPromptRunnerSelectionCliOptions & {
|
|
19
|
+
readonly isVerbose: boolean;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Normalizes shared runner flags for local agent subcommands.
|
|
23
|
+
*
|
|
24
|
+
* @private internal utility of `ptbk agent`
|
|
25
|
+
*/
|
|
26
|
+
export declare function normalizeAgentCommandRunnerOptions(cliOptions: AgentCommandCliOptions, command: Program): NormalizedAgentCommandRunnerOptions;
|
|
27
|
+
/**
|
|
28
|
+
* Returns the required agent book path from Commander options.
|
|
29
|
+
*
|
|
30
|
+
* @private internal utility of `ptbk agent`
|
|
31
|
+
*/
|
|
32
|
+
export declare function resolveRequiredAgentPath(cliOptions: AgentCommandCliOptions): string;
|
|
33
|
+
/**
|
|
34
|
+
* Returns the required single-turn user message from Commander options.
|
|
35
|
+
*
|
|
36
|
+
* @private internal utility of `ptbk agent`
|
|
37
|
+
*/
|
|
38
|
+
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-113`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
|
File without changes
|
|
File without changes
|