@promptbook/types 0.112.0-99 → 0.112.0
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 +37 -21
- package/esm/src/_packages/components.index.d.ts +4 -0
- package/esm/src/_packages/core.index.d.ts +0 -2
- package/esm/src/_packages/node.index.d.ts +40 -0
- package/esm/src/_packages/types.index.d.ts +18 -0
- package/esm/src/avatars/avatarAnimationScheduler.d.ts +4 -0
- package/esm/src/avatars/types/AvatarVisualDefinition.d.ts +1 -1
- package/esm/src/avatars/visuals/octopus3d3AvatarVisual.d.ts +7 -0
- package/esm/src/avatars/visuals/octopus3d4AvatarVisual.d.ts +7 -0
- package/esm/src/book-3.0/BookNodeAgentSource.d.ts +38 -0
- package/esm/src/book-3.0/CliAgent.d.ts +66 -0
- package/esm/src/book-3.0/CliAgent.test.d.ts +1 -0
- package/esm/src/book-3.0/LiteAgent.d.ts +68 -0
- package/esm/src/book-3.0/LiteAgent.test.d.ts +1 -0
- package/esm/src/book-3.0/agentFolderPaths.d.ts +30 -0
- package/esm/src/book-3.0/cliAgentEnv.d.ts +33 -0
- package/esm/src/book-components/BookEditor/BookEditor.d.ts +6 -5
- package/esm/src/book-components/BookEditor/BookEditorAboutPromptbookInformation.d.ts +12 -0
- package/esm/src/book-components/BookEditor/BookEditorBrowserConfig.d.ts +2 -0
- package/esm/src/book-components/BookEditor/BookEditorForClient.d.ts +7 -0
- package/esm/src/book-components/BookEditor/BookEditorMonacoTokenization.d.ts +1 -0
- package/esm/src/book-components/BookEditor/BookEditorTheme.d.ts +24 -0
- package/esm/src/book-components/BookEditor/createDeprecatedCommitmentDiagnostics.browser.d.ts +9 -0
- package/esm/src/book-components/BookEditor/useBookEditorMonacoLanguage.d.ts +1 -6
- package/esm/src/book-components/BookEditor/useBookEditorMonacoLifecycle.d.ts +1 -4
- package/esm/src/book-components/BookEditor/useBookEditorMonacoStyles.d.ts +2 -1
- package/esm/src/book-components/Chat/Chat/ChatCitationModal.d.ts +2 -0
- package/esm/src/book-components/Chat/Chat/ChatMessageItem.d.ts +4 -0
- package/esm/src/book-components/Chat/Chat/ChatMessageList.d.ts +4 -0
- package/esm/src/book-components/Chat/Chat/ChatProps.d.ts +5 -0
- package/esm/src/book-components/Chat/Chat/ChatToolCallModal.d.ts +2 -0
- package/esm/src/book-components/Chat/Chat/ChatToolCallModalContent.d.ts +3 -1
- package/esm/src/book-components/Chat/Chat/CitationIframePreview.d.ts +20 -0
- package/esm/src/book-components/Chat/Chat/TeamToolCallModalContent.d.ts +2 -0
- package/esm/src/book-components/Chat/MarkdownContent/MarkdownContent.d.ts +1 -0
- package/esm/src/book-components/Chat/SourceChip/SourceChip.d.ts +6 -1
- package/esm/src/book-components/Chat/hooks/useResolvedCitationLabel.d.ts +12 -0
- package/esm/src/book-components/Chat/types/ChatMessage.d.ts +4 -0
- package/esm/src/book-components/Chat/types/ChatParticipant.d.ts +1 -1
- package/esm/src/book-components/Chat/types/CitationLabelResolver.d.ts +8 -0
- package/esm/src/book-components/Chat/utils/citationHelpers.d.ts +9 -0
- package/esm/src/book-components/Chat/utils/decodeJsonUnicodeEscapesInMarkdownText.d.ts +14 -0
- package/esm/src/book-components/Chat/utils/decodeJsonUnicodeEscapesInMarkdownText.test.d.ts +1 -0
- package/esm/src/book-components/Chat/utils/isVisibleChatToolCall.d.ts +10 -0
- package/esm/src/book-components/Chat/utils/parseCitationsFromContent.d.ts +4 -0
- package/esm/src/book-components/_common/Dropdown/Dropdown.d.ts +1 -1
- package/esm/src/book-components/_common/MenuHoisting/MenuHoistingContext.d.ts +1 -1
- package/esm/src/book-components/_common/Modal/Modal.d.ts +1 -1
- package/esm/src/book-components/icons/AboutIcon.d.ts +1 -1
- package/esm/src/book-components/icons/DownloadIcon.d.ts +1 -1
- package/esm/src/book-components/icons/ExitFullscreenIcon.d.ts +1 -1
- package/esm/src/book-components/icons/FullscreenIcon.d.ts +1 -1
- 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-folder/agentProjectPaths.d.ts +2 -24
- package/esm/src/cli/cli-commands/agent.d.ts +14 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer.d.ts +17 -1
- package/esm/src/cli/cli-commands/agents-server/run.d.ts +6 -0
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer.d.ts +9 -2
- package/esm/src/cli/cli-commands/coder/ThinkingLevel.d.ts +1 -1
- package/esm/src/cli/cli-commands/coder/ensureCoderDeveloperAgentFile.d.ts +25 -0
- package/esm/src/cli/cli-commands/coder/find-unwritten.d.ts +10 -0
- package/esm/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.d.ts +2 -0
- package/esm/src/cli/cli-commands/coder/server.d.ts +13 -0
- package/esm/src/cli/cli-commands/coder/waitOptions.d.ts +14 -0
- package/esm/src/cli/cli-commands/common/promptRunnerCliOptions.d.ts +9 -25
- package/esm/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +22 -0
- package/esm/src/commitments/_common/teamInternalAgentAccess.d.ts +9 -1
- package/esm/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts +1 -1
- package/esm/src/llm-providers/_common/register/$provideLlmToolsFromEnv.d.ts +1 -1
- package/esm/src/scrapers/website/utils/createShowdownConverter.d.ts +2 -2
- package/esm/src/utils/isTimingSafeEqualString.d.ts +25 -0
- package/esm/src/utils/validators/url/isValidAgentUrl.d.ts +5 -0
- package/esm/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/src/_packages/components.index.d.ts +4 -0
- package/umd/src/_packages/core.index.d.ts +0 -2
- package/umd/src/_packages/node.index.d.ts +40 -0
- package/umd/src/_packages/types.index.d.ts +18 -0
- package/umd/src/avatars/avatarAnimationScheduler.d.ts +4 -0
- package/umd/src/avatars/types/AvatarVisualDefinition.d.ts +1 -1
- package/umd/src/avatars/visuals/octopus3d3AvatarVisual.d.ts +7 -0
- package/umd/src/avatars/visuals/octopus3d4AvatarVisual.d.ts +7 -0
- package/umd/src/book-3.0/BookNodeAgentSource.d.ts +38 -0
- package/umd/src/book-3.0/CliAgent.d.ts +66 -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-3.0/agentFolderPaths.d.ts +30 -0
- package/umd/src/book-3.0/cliAgentEnv.d.ts +33 -0
- package/umd/src/book-components/BookEditor/BookEditor.d.ts +6 -5
- package/umd/src/book-components/BookEditor/BookEditorAboutPromptbookInformation.d.ts +12 -0
- package/umd/src/book-components/BookEditor/BookEditorBrowserConfig.d.ts +2 -0
- package/umd/src/book-components/BookEditor/BookEditorForClient.d.ts +7 -0
- package/umd/src/book-components/BookEditor/BookEditorMonacoTokenization.d.ts +1 -0
- package/umd/src/book-components/BookEditor/BookEditorTheme.d.ts +24 -0
- package/umd/src/book-components/BookEditor/createDeprecatedCommitmentDiagnostics.browser.d.ts +9 -0
- package/umd/src/book-components/BookEditor/useBookEditorMonacoLanguage.d.ts +1 -6
- package/umd/src/book-components/BookEditor/useBookEditorMonacoLifecycle.d.ts +1 -4
- package/umd/src/book-components/BookEditor/useBookEditorMonacoStyles.d.ts +2 -1
- package/umd/src/book-components/Chat/Chat/ChatCitationModal.d.ts +2 -0
- package/umd/src/book-components/Chat/Chat/ChatMessageItem.d.ts +4 -0
- package/umd/src/book-components/Chat/Chat/ChatMessageList.d.ts +4 -0
- package/umd/src/book-components/Chat/Chat/ChatProps.d.ts +5 -0
- package/umd/src/book-components/Chat/Chat/ChatToolCallModal.d.ts +2 -0
- package/umd/src/book-components/Chat/Chat/ChatToolCallModalContent.d.ts +3 -1
- package/umd/src/book-components/Chat/Chat/CitationIframePreview.d.ts +20 -0
- package/umd/src/book-components/Chat/Chat/TeamToolCallModalContent.d.ts +2 -0
- package/umd/src/book-components/Chat/MarkdownContent/MarkdownContent.d.ts +1 -0
- package/umd/src/book-components/Chat/SourceChip/SourceChip.d.ts +6 -1
- package/umd/src/book-components/Chat/hooks/useResolvedCitationLabel.d.ts +12 -0
- package/umd/src/book-components/Chat/types/ChatMessage.d.ts +4 -0
- package/umd/src/book-components/Chat/types/ChatParticipant.d.ts +1 -1
- package/umd/src/book-components/Chat/types/CitationLabelResolver.d.ts +8 -0
- package/umd/src/book-components/Chat/utils/citationHelpers.d.ts +9 -0
- package/umd/src/book-components/Chat/utils/decodeJsonUnicodeEscapesInMarkdownText.d.ts +14 -0
- package/umd/src/book-components/Chat/utils/decodeJsonUnicodeEscapesInMarkdownText.test.d.ts +1 -0
- package/umd/src/book-components/Chat/utils/isVisibleChatToolCall.d.ts +10 -0
- package/umd/src/book-components/Chat/utils/parseCitationsFromContent.d.ts +4 -0
- package/umd/src/book-components/_common/Dropdown/Dropdown.d.ts +1 -1
- package/umd/src/book-components/_common/MenuHoisting/MenuHoistingContext.d.ts +1 -1
- package/umd/src/book-components/_common/Modal/Modal.d.ts +1 -1
- package/umd/src/book-components/icons/AboutIcon.d.ts +1 -1
- package/umd/src/book-components/icons/DownloadIcon.d.ts +1 -1
- package/umd/src/book-components/icons/ExitFullscreenIcon.d.ts +1 -1
- package/umd/src/book-components/icons/FullscreenIcon.d.ts +1 -1
- 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-folder/agentProjectPaths.d.ts +2 -24
- package/umd/src/cli/cli-commands/agent.d.ts +14 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer.d.ts +17 -1
- package/umd/src/cli/cli-commands/agents-server/run.d.ts +6 -0
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer.d.ts +9 -2
- package/umd/src/cli/cli-commands/coder/ThinkingLevel.d.ts +1 -1
- package/umd/src/cli/cli-commands/coder/ensureCoderDeveloperAgentFile.d.ts +25 -0
- package/umd/src/cli/cli-commands/coder/find-unwritten.d.ts +10 -0
- package/umd/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.d.ts +2 -0
- package/umd/src/cli/cli-commands/coder/server.d.ts +13 -0
- package/umd/src/cli/cli-commands/coder/waitOptions.d.ts +14 -0
- package/umd/src/cli/cli-commands/common/promptRunnerCliOptions.d.ts +9 -25
- package/umd/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +22 -0
- package/umd/src/commitments/_common/teamInternalAgentAccess.d.ts +9 -1
- package/umd/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts +1 -1
- package/umd/src/llm-providers/_common/register/$provideLlmToolsFromEnv.d.ts +1 -1
- package/umd/src/scrapers/website/utils/createShowdownConverter.d.ts +2 -2
- package/umd/src/utils/isTimingSafeEqualString.d.ts +25 -0
- package/umd/src/utils/validators/url/isValidAgentUrl.d.ts +5 -0
- package/umd/src/version.d.ts +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Command as Program } from 'commander';
|
|
2
|
+
import type { $side_effect } from '../../../utils/organization/$side_effect';
|
|
3
|
+
/**
|
|
4
|
+
* Initializes `coder find-unwritten` 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 $initializeCoderFindUnwrittenCommand(program: Program): $side_effect;
|
|
@@ -9,6 +9,8 @@ export type CoderInitializationSummary = {
|
|
|
9
9
|
readonly promptsDoneDirectoryStatus: InitializationStatus;
|
|
10
10
|
readonly promptsTemplatesDirectoryStatus: InitializationStatus;
|
|
11
11
|
readonly promptTemplateFileStatuses: ReadonlyArray<EnsuredCoderPromptTemplateFile>;
|
|
12
|
+
readonly agentsDirectoryStatus: InitializationStatus;
|
|
13
|
+
readonly developerAgentFileStatus: InitializationStatus;
|
|
12
14
|
readonly agentsFileStatus: InitializationStatus;
|
|
13
15
|
readonly agentCodingFileStatus: InitializationStatus;
|
|
14
16
|
readonly envFileStatus: InitializationStatus;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Command as Program } from 'commander';
|
|
2
|
+
import type { $side_effect } from '../../../utils/organization/$side_effect';
|
|
3
|
+
/**
|
|
4
|
+
* Initializes `coder server` command for Promptbook CLI utilities.
|
|
5
|
+
*
|
|
6
|
+
* Runs the same prompt processing logic as `ptbk coder run` but keeps the process alive
|
|
7
|
+
* and serves a kanban web UI on the configured port.
|
|
8
|
+
*
|
|
9
|
+
* Note: `$` is used to indicate that this function is not a pure function - it registers a command in the CLI
|
|
10
|
+
*
|
|
11
|
+
* @private internal function of `promptbookCli`
|
|
12
|
+
*/
|
|
13
|
+
export declare function $initializeCoderServerCommand(program: Program): $side_effect;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default wait duration applied before retrying a prompt round after an error (10 minutes).
|
|
3
|
+
*
|
|
4
|
+
* @private internal constant of `ptbk coder` wait handling
|
|
5
|
+
*/
|
|
6
|
+
export declare const DEFAULT_WAIT_AFTER_ERROR_MS: number;
|
|
7
|
+
/**
|
|
8
|
+
* Parses an optional Commander duration string and returns the resolved milliseconds.
|
|
9
|
+
*
|
|
10
|
+
* Returns `defaultMs` when the flag was not provided or was provided without a non-empty value.
|
|
11
|
+
*
|
|
12
|
+
* @private internal utility of `ptbk coder` wait handling
|
|
13
|
+
*/
|
|
14
|
+
export declare function parseOptionalWaitDuration(value: string | undefined, defaultMs: number): number;
|
|
@@ -1,42 +1,26 @@
|
|
|
1
1
|
import { Command as Program } from 'commander';
|
|
2
2
|
import type { ThinkingLevel } from '../coder/ThinkingLevel';
|
|
3
|
+
import { PTBK_HARNESS_ENV, PTBK_MODEL_ENV, PTBK_THINKING_LEVEL_ENV } from '../../../book-3.0/cliAgentEnv';
|
|
4
|
+
export { PTBK_HARNESS_ENV, PTBK_MODEL_ENV, PTBK_THINKING_LEVEL_ENV };
|
|
3
5
|
/**
|
|
4
6
|
* Runner identifiers supported by Promptbook CLI agent orchestration commands.
|
|
5
7
|
*
|
|
6
8
|
* @private internal utility of `promptbookCli`
|
|
7
9
|
*/
|
|
8
|
-
export declare const
|
|
9
|
-
/**
|
|
10
|
-
* Environment variable used as the default runner identifier when `--agent` is omitted.
|
|
11
|
-
*
|
|
12
|
-
* @private internal utility of `promptbookCli`
|
|
13
|
-
*/
|
|
14
|
-
export declare const PTBK_AGENT_ENV = "PTBK_AGENT";
|
|
15
|
-
/**
|
|
16
|
-
* Environment variable used as the default runner model when `--model` is omitted.
|
|
17
|
-
*
|
|
18
|
-
* @private internal utility of `promptbookCli`
|
|
19
|
-
*/
|
|
20
|
-
export declare const PTBK_MODEL_ENV = "PTBK_MODEL";
|
|
21
|
-
/**
|
|
22
|
-
* Environment variable used as the default runner thinking level when `--thinking-level` is omitted.
|
|
23
|
-
*
|
|
24
|
-
* @private internal utility of `promptbookCli`
|
|
25
|
-
*/
|
|
26
|
-
export declare const PTBK_THINKING_LEVEL_ENV = "PTBK_THINKING_LEVEL";
|
|
10
|
+
export declare const PROMPT_RUNNER_HARNESS_NAMES: readonly ["openai-codex", "github-copilot", "cline", "claude-code", "opencode", "gemini"];
|
|
27
11
|
/**
|
|
28
12
|
* Runner identifier supported by Promptbook CLI agent orchestration commands.
|
|
29
13
|
*
|
|
30
14
|
* @private internal utility of `promptbookCli`
|
|
31
15
|
*/
|
|
32
|
-
export type
|
|
16
|
+
export type PromptRunnerHarnessName = (typeof PROMPT_RUNNER_HARNESS_NAMES)[number];
|
|
33
17
|
/**
|
|
34
18
|
* Commander option bag for shared runner flags.
|
|
35
19
|
*
|
|
36
20
|
* @private internal utility of `promptbookCli`
|
|
37
21
|
*/
|
|
38
22
|
export type PromptRunnerCliOptions = {
|
|
39
|
-
readonly
|
|
23
|
+
readonly harness?: string;
|
|
40
24
|
readonly model?: string;
|
|
41
25
|
readonly ui: boolean;
|
|
42
26
|
readonly thinkingLevel?: ThinkingLevel;
|
|
@@ -52,14 +36,14 @@ export type PromptRunnerCliOptions = {
|
|
|
52
36
|
*
|
|
53
37
|
* @private internal utility of `promptbookCli`
|
|
54
38
|
*/
|
|
55
|
-
export type PromptRunnerSelectionCliOptions = Pick<PromptRunnerCliOptions, '
|
|
39
|
+
export type PromptRunnerSelectionCliOptions = Pick<PromptRunnerCliOptions, 'harness' | 'model' | 'ui' | 'thinkingLevel' | 'allowCredits'>;
|
|
56
40
|
/**
|
|
57
41
|
* Normalized runner options used by runner-backed CLI commands.
|
|
58
42
|
*
|
|
59
43
|
* @private internal utility of `promptbookCli`
|
|
60
44
|
*/
|
|
61
45
|
export type NormalizedPromptRunnerCliOptions = {
|
|
62
|
-
readonly agentName?:
|
|
46
|
+
readonly agentName?: PromptRunnerHarnessName;
|
|
63
47
|
readonly model?: string;
|
|
64
48
|
readonly noUi: boolean;
|
|
65
49
|
readonly thinkingLevel?: ThinkingLevel;
|
|
@@ -83,11 +67,11 @@ export type NormalizedPromptRunnerSelectionCliOptions = Pick<NormalizedPromptRun
|
|
|
83
67
|
*/
|
|
84
68
|
export declare const PROMPT_RUNNER_DESCRIPTION: string;
|
|
85
69
|
/**
|
|
86
|
-
* Commander description for the `--
|
|
70
|
+
* Commander description for the `--harness` option.
|
|
87
71
|
*
|
|
88
72
|
* @private internal utility of `promptbookCli`
|
|
89
73
|
*/
|
|
90
|
-
export declare const
|
|
74
|
+
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
75
|
/**
|
|
92
76
|
* Commander description for the `--model` option.
|
|
93
77
|
*
|
|
@@ -60,6 +60,28 @@ export declare class AgentCollectionInSupabase {
|
|
|
60
60
|
* Gets all agents in the collection
|
|
61
61
|
*/
|
|
62
62
|
listAgents(): Promise<ReadonlyArray<AgentBasicInformation>>;
|
|
63
|
+
/**
|
|
64
|
+
* Finds one active agent profile by its human-readable name or permanent id.
|
|
65
|
+
*
|
|
66
|
+
* This keeps route-level lookups from loading the whole agent collection when only
|
|
67
|
+
* one canonical route identifier is needed.
|
|
68
|
+
*
|
|
69
|
+
* @param agentNameOrPermanentId - Agent name or stable permanent identifier.
|
|
70
|
+
* @returns Matching active agent profile or `null` when not found.
|
|
71
|
+
*
|
|
72
|
+
* @public exported from `@promptbook/core`
|
|
73
|
+
*/
|
|
74
|
+
findAgentBasicInformation(agentNameOrPermanentId: string_agent_name | string_agent_permanent_id): Promise<AgentBasicInformation | null>;
|
|
75
|
+
/**
|
|
76
|
+
* Converts one database row into public agent information.
|
|
77
|
+
*
|
|
78
|
+
* @param row - Database row carrying the persisted profile snapshot.
|
|
79
|
+
* @param isVerbose - Whether profile-name mismatches should be logged.
|
|
80
|
+
* @returns Agent profile with canonical database name and permanent id.
|
|
81
|
+
*
|
|
82
|
+
* @private internal helper of `AgentCollectionInSupabase`
|
|
83
|
+
*/
|
|
84
|
+
private mapAgentBasicInformationRow;
|
|
63
85
|
/**
|
|
64
86
|
* Retrieves the permanent ID of an agent by its name or permanent ID.
|
|
65
87
|
*/
|
|
@@ -26,7 +26,15 @@ export type TeamInternalAgentAccessHeadersOptions = {
|
|
|
26
26
|
/**
|
|
27
27
|
* Resolves the internal token used by same-server TEAM calls.
|
|
28
28
|
*
|
|
29
|
-
*
|
|
29
|
+
* `PROMPTBOOK_TEAM_AGENT_ACCESS_TOKEN` must be a dedicated secret — falling
|
|
30
|
+
* back to `ADMIN_PASSWORD`, `SUPABASE_SERVICE_ROLE_KEY`, or any other shared
|
|
31
|
+
* credential would let a leak of one secret compromise both authentication
|
|
32
|
+
* boundaries (admin login and same-server teammate-agent access). When the
|
|
33
|
+
* dedicated variable is missing, this function returns `null` so the calling
|
|
34
|
+
* server fails closed — same-server TEAM access is disabled and no header is
|
|
35
|
+
* sent — instead of silently authorizing requests with the wrong secret.
|
|
36
|
+
*
|
|
37
|
+
* @returns Hashed token, or `null` when the dedicated secret is not configured.
|
|
30
38
|
*
|
|
31
39
|
* @private internal Agents Server access wiring
|
|
32
40
|
*/
|
|
@@ -6,7 +6,7 @@ import type { LlmToolsConfiguration } from './LlmToolsConfiguration';
|
|
|
6
6
|
*
|
|
7
7
|
* It looks for environment variables:
|
|
8
8
|
* - `process.env.OPENAI_API_KEY`
|
|
9
|
-
* - `process.env.ANTHROPIC_CLAUDE_API_KEY`
|
|
9
|
+
* - `process.env.ANTHROPIC_API_KEY` (or the deprecated `process.env.ANTHROPIC_CLAUDE_API_KEY`)
|
|
10
10
|
* - ...
|
|
11
11
|
*
|
|
12
12
|
* @see Environment variables documentation or .env file for required variables.
|
|
@@ -13,7 +13,7 @@ import type { CreateLlmToolsFromConfigurationOptions } from './createLlmToolsFro
|
|
|
13
13
|
*
|
|
14
14
|
* It looks for environment variables:
|
|
15
15
|
* - `process.env.OPENAI_API_KEY`
|
|
16
|
-
* - `process.env.ANTHROPIC_CLAUDE_API_KEY`
|
|
16
|
+
* - `process.env.ANTHROPIC_API_KEY` (or the deprecated `process.env.ANTHROPIC_CLAUDE_API_KEY`)
|
|
17
17
|
* - ...
|
|
18
18
|
*
|
|
19
19
|
* @param options Configuration options for the LLM tools
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import showdown from 'showdown';
|
|
2
2
|
/**
|
|
3
3
|
* Create a new showdown converter instance
|
|
4
4
|
*
|
|
5
5
|
* @private utility of `WebsiteScraper`
|
|
6
6
|
*/
|
|
7
|
-
export declare function createShowdownConverter():
|
|
7
|
+
export declare function createShowdownConverter(): showdown.Converter;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compares two strings in constant time to prevent timing attacks.
|
|
3
|
+
*
|
|
4
|
+
* Plain JavaScript `===` / `!==` string comparisons short-circuit on the first
|
|
5
|
+
* byte that differs, which lets a remote attacker who can measure response
|
|
6
|
+
* timing recover the expected value one byte at a time. This helper performs
|
|
7
|
+
* the comparison through Node's `timingSafeEqual`, which always inspects every
|
|
8
|
+
* byte of the equal-length buffers.
|
|
9
|
+
*
|
|
10
|
+
* Returning `false` early when the byte lengths differ does not expose
|
|
11
|
+
* character content — only length — which is an acceptable trade-off, since
|
|
12
|
+
* `timingSafeEqual` requires equal-length buffers and length is typically not
|
|
13
|
+
* secret.
|
|
14
|
+
*
|
|
15
|
+
* `null` and `undefined` inputs are treated as non-matching so callers can
|
|
16
|
+
* forward raw request values (for example `request.headers.get(name)`) without
|
|
17
|
+
* an extra guard.
|
|
18
|
+
*
|
|
19
|
+
* @param candidate - Value supplied by the caller (for example a request header or cookie).
|
|
20
|
+
* @param expected - Value to compare against (for example a configured secret).
|
|
21
|
+
* @returns `true` when both values are strings of equal length with identical bytes.
|
|
22
|
+
*
|
|
23
|
+
* @private internal helper function
|
|
24
|
+
*/
|
|
25
|
+
export declare function isTimingSafeEqualString(candidate: string | null | undefined, expected: string | null | undefined): boolean;
|
|
@@ -8,6 +8,11 @@ import type { really_unknown } from '../../organization/really_unknown';
|
|
|
8
8
|
* - `isValidAgentUrl` *(this one)* which tests just agent URL
|
|
9
9
|
* - `isValidPipelineUrl` which tests just pipeline URL
|
|
10
10
|
*
|
|
11
|
+
* Note: This is a pure structural validator and does not block private/internal network
|
|
12
|
+
* addresses. Callers that fetch the URL server-side from an untrusted network context must
|
|
13
|
+
* additionally apply the `assertSafeUrl` SSRF guard from the Agents Server before any
|
|
14
|
+
* outbound request.
|
|
15
|
+
*
|
|
11
16
|
* @public exported from `@promptbook/utils`
|
|
12
17
|
*/
|
|
13
18
|
export declare function isValidAgentUrl(url: really_unknown): url is string_agent_url;
|
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-140`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/types",
|
|
3
|
-
"version": "0.112.0
|
|
3
|
+
"version": "0.112.0",
|
|
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,
|
|
@@ -96,6 +96,6 @@
|
|
|
96
96
|
"types": "./esm/src/_packages/types.index.d.ts",
|
|
97
97
|
"typings": "./esm/src/_packages/types.index.d.ts",
|
|
98
98
|
"peerDependencies": {
|
|
99
|
-
"@promptbook/core": "0.112.0
|
|
99
|
+
"@promptbook/core": "0.112.0"
|
|
100
100
|
}
|
|
101
101
|
}
|
|
@@ -12,6 +12,7 @@ import type { BookEditorUploadProgressCallback } from '../book-components/BookEd
|
|
|
12
12
|
import type { BookEditorUploadOptions } from '../book-components/BookEditor/BookEditor';
|
|
13
13
|
import type { BookEditorProps } from '../book-components/BookEditor/BookEditor';
|
|
14
14
|
import { BookEditor } from '../book-components/BookEditor/BookEditor';
|
|
15
|
+
import { BookEditorForClient } from '../book-components/BookEditor/BookEditorForClient';
|
|
15
16
|
import { AgentChat } from '../book-components/Chat/AgentChat/AgentChat';
|
|
16
17
|
import type { AgentChatProps } from '../book-components/Chat/AgentChat/AgentChatProps';
|
|
17
18
|
import { Chat } from '../book-components/Chat/Chat/Chat';
|
|
@@ -65,6 +66,7 @@ import type { ChatProgressCard } from '../book-components/Chat/types/ChatMessage
|
|
|
65
66
|
import type { ChatMessageReplyingTo } from '../book-components/Chat/types/ChatMessage';
|
|
66
67
|
import type { ChatMessage } from '../book-components/Chat/types/ChatMessage';
|
|
67
68
|
import type { ChatParticipant } from '../book-components/Chat/types/ChatParticipant';
|
|
69
|
+
import type { CitationLabelResolver } from '../book-components/Chat/types/CitationLabelResolver';
|
|
68
70
|
import type { MessageButton } from '../book-components/Chat/utils/parseMessageButtons';
|
|
69
71
|
import { parseMessageButtons } from '../book-components/Chat/utils/parseMessageButtons';
|
|
70
72
|
import { ArrowIcon } from '../book-components/icons/ArrowIcon';
|
|
@@ -95,6 +97,7 @@ export type { BookEditorUploadProgressCallback };
|
|
|
95
97
|
export type { BookEditorUploadOptions };
|
|
96
98
|
export type { BookEditorProps };
|
|
97
99
|
export { BookEditor };
|
|
100
|
+
export { BookEditorForClient };
|
|
98
101
|
export { AgentChat };
|
|
99
102
|
export type { AgentChatProps };
|
|
100
103
|
export { Chat };
|
|
@@ -148,6 +151,7 @@ export type { ChatProgressCard };
|
|
|
148
151
|
export type { ChatMessageReplyingTo };
|
|
149
152
|
export type { ChatMessage };
|
|
150
153
|
export type { ChatParticipant };
|
|
154
|
+
export type { CitationLabelResolver };
|
|
151
155
|
export type { MessageButton };
|
|
152
156
|
export { parseMessageButtons };
|
|
153
157
|
export { ArrowIcon };
|
|
@@ -221,7 +221,6 @@ import { normalizeChatAttachments } from '../utils/chat/chatAttachments/normaliz
|
|
|
221
221
|
import { resolveChatAttachmentContents } from '../utils/chat/chatAttachments/resolveChatAttachmentContents';
|
|
222
222
|
import { aboutPromptbookInformation } from '../utils/misc/aboutPromptbookInformation';
|
|
223
223
|
import { $generateBookBoilerplate } from '../utils/random/$generateBookBoilerplate';
|
|
224
|
-
import { CORE_AGENTS_SERVER } from '../../servers';
|
|
225
224
|
import { CORE_AGENTS_SERVER_WELL_KNOWN_AGENT_NAMES } from '../../servers';
|
|
226
225
|
import { PUBLIC_AGENTS_SERVERS } from '../../servers';
|
|
227
226
|
export { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION };
|
|
@@ -447,6 +446,5 @@ export { normalizeChatAttachments };
|
|
|
447
446
|
export { resolveChatAttachmentContents };
|
|
448
447
|
export { aboutPromptbookInformation };
|
|
449
448
|
export { $generateBookBoilerplate };
|
|
450
|
-
export { CORE_AGENTS_SERVER };
|
|
451
449
|
export { CORE_AGENTS_SERVER_WELL_KNOWN_AGENT_NAMES };
|
|
452
450
|
export { PUBLIC_AGENTS_SERVERS };
|
|
@@ -1,4 +1,24 @@
|
|
|
1
1
|
import { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION } from '../version';
|
|
2
|
+
import { AGENT_BOOK_FILE_PATH } from '../book-3.0/agentFolderPaths';
|
|
3
|
+
import { AGENT_MESSAGES_DIRECTORY_PATH } from '../book-3.0/agentFolderPaths';
|
|
4
|
+
import { AGENT_QUEUED_MESSAGES_DIRECTORY_PATH } from '../book-3.0/agentFolderPaths';
|
|
5
|
+
import { AGENT_FINISHED_MESSAGES_DIRECTORY_PATH } from '../book-3.0/agentFolderPaths';
|
|
6
|
+
import { AGENT_FAILED_MESSAGES_DIRECTORY_PATH } from '../book-3.0/agentFolderPaths';
|
|
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 { CliAgent } from '../book-3.0/CliAgent';
|
|
14
|
+
import { CLI_AGENT_HARNESS_NAMES } from '../book-3.0/cliAgentEnv';
|
|
15
|
+
import { CLI_AGENT_THINKING_LEVEL_VALUES } from '../book-3.0/cliAgentEnv';
|
|
16
|
+
import { PTBK_HARNESS_ENV } from '../book-3.0/cliAgentEnv';
|
|
17
|
+
import { PTBK_MODEL_ENV } from '../book-3.0/cliAgentEnv';
|
|
18
|
+
import { PTBK_THINKING_LEVEL_ENV } from '../book-3.0/cliAgentEnv';
|
|
19
|
+
import type { LiteAgentOptions } from '../book-3.0/LiteAgent';
|
|
20
|
+
import type { LiteAgentRunOptions } from '../book-3.0/LiteAgent';
|
|
21
|
+
import { LiteAgent } from '../book-3.0/LiteAgent';
|
|
2
22
|
import { createPipelineCollectionFromDirectory } from '../collection/pipeline-collection/constructors/createPipelineCollectionFromDirectory';
|
|
3
23
|
import { getAllCommitmentsToolFunctionsForNode } from '../commitments/_common/getAllCommitmentsToolFunctionsForNode';
|
|
4
24
|
import { $provideExecutablesForNode } from '../executables/$provideExecutablesForNode';
|
|
@@ -12,6 +32,26 @@ import { FileCacheStorage } from '../storage/file-cache-storage/FileCacheStorage
|
|
|
12
32
|
import { $execCommand } from '../utils/execCommand/$execCommand';
|
|
13
33
|
import { $execCommands } from '../utils/execCommand/$execCommands';
|
|
14
34
|
export { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION };
|
|
35
|
+
export { AGENT_BOOK_FILE_PATH };
|
|
36
|
+
export { AGENT_MESSAGES_DIRECTORY_PATH };
|
|
37
|
+
export { AGENT_QUEUED_MESSAGES_DIRECTORY_PATH };
|
|
38
|
+
export { AGENT_FINISHED_MESSAGES_DIRECTORY_PATH };
|
|
39
|
+
export { AGENT_FAILED_MESSAGES_DIRECTORY_PATH };
|
|
40
|
+
export type { BookNodeAgentSource };
|
|
41
|
+
export type { BookNodeAgentSourceOptions };
|
|
42
|
+
export type { CliAgentHarness };
|
|
43
|
+
export type { CliAgentThinkingLevel };
|
|
44
|
+
export type { CliAgentRunOptions };
|
|
45
|
+
export type { CliAgentOptions };
|
|
46
|
+
export { CliAgent };
|
|
47
|
+
export { CLI_AGENT_HARNESS_NAMES };
|
|
48
|
+
export { CLI_AGENT_THINKING_LEVEL_VALUES };
|
|
49
|
+
export { PTBK_HARNESS_ENV };
|
|
50
|
+
export { PTBK_MODEL_ENV };
|
|
51
|
+
export { PTBK_THINKING_LEVEL_ENV };
|
|
52
|
+
export type { LiteAgentOptions };
|
|
53
|
+
export type { LiteAgentRunOptions };
|
|
54
|
+
export { LiteAgent };
|
|
15
55
|
export { createPipelineCollectionFromDirectory };
|
|
16
56
|
export { getAllCommitmentsToolFunctionsForNode };
|
|
17
57
|
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';
|
|
@@ -47,6 +55,7 @@ import type { ChatProgressCard } from '../book-components/Chat/types/ChatMessage
|
|
|
47
55
|
import type { ChatMessageReplyingTo } from '../book-components/Chat/types/ChatMessage';
|
|
48
56
|
import type { ChatMessage } from '../book-components/Chat/types/ChatMessage';
|
|
49
57
|
import type { ChatParticipant } from '../book-components/Chat/types/ChatParticipant';
|
|
58
|
+
import type { CitationLabelResolver } from '../book-components/Chat/types/CitationLabelResolver';
|
|
50
59
|
import type { ParsedCitation } from '../book-components/Chat/utils/parseCitationsFromContent';
|
|
51
60
|
import type { MessageButton } from '../book-components/Chat/utils/parseMessageButtons';
|
|
52
61
|
import type { TeamToolResult } from '../book-components/Chat/utils/toolCallParsing/TeamToolResult';
|
|
@@ -437,6 +446,14 @@ export type { AgentBasicInformation };
|
|
|
437
446
|
export type { AgentModelRequirements };
|
|
438
447
|
export type { CreateAgentModelRequirementsOptions };
|
|
439
448
|
export type { string_book };
|
|
449
|
+
export type { BookNodeAgentSource };
|
|
450
|
+
export type { BookNodeAgentSourceOptions };
|
|
451
|
+
export type { CliAgentHarness };
|
|
452
|
+
export type { CliAgentThinkingLevel };
|
|
453
|
+
export type { CliAgentRunOptions };
|
|
454
|
+
export type { CliAgentOptions };
|
|
455
|
+
export type { LiteAgentOptions };
|
|
456
|
+
export type { LiteAgentRunOptions };
|
|
440
457
|
export type { AvatarChipProps };
|
|
441
458
|
export type { AvatarChipFromSourceProps };
|
|
442
459
|
export type { AvatarProfileProps };
|
|
@@ -480,6 +497,7 @@ export type { ChatProgressCard };
|
|
|
480
497
|
export type { ChatMessageReplyingTo };
|
|
481
498
|
export type { ChatMessage };
|
|
482
499
|
export type { ChatParticipant };
|
|
500
|
+
export type { CitationLabelResolver };
|
|
483
501
|
export type { ParsedCitation };
|
|
484
502
|
export type { MessageButton };
|
|
485
503
|
export type { TeamToolResult };
|
|
@@ -7,6 +7,10 @@ type AvatarAnimationListener = (now: number) => void;
|
|
|
7
7
|
/**
|
|
8
8
|
* Registers one avatar animation callback in the shared animation loop.
|
|
9
9
|
*
|
|
10
|
+
* Each listener is staggered at registration time so it does not fire on the same animation
|
|
11
|
+
* frame as the existing listeners, and the shared loop further caps how many listeners run
|
|
12
|
+
* per frame, keeping the main thread responsive when many avatars are mounted.
|
|
13
|
+
*
|
|
10
14
|
* @param avatarAnimationListener Frame callback invoked on every animation frame.
|
|
11
15
|
* @returns Cleanup function that unregisters the callback.
|
|
12
16
|
*
|
|
@@ -7,7 +7,7 @@ import type { AvatarDefinition } from './AvatarDefinition';
|
|
|
7
7
|
*
|
|
8
8
|
* @private shared contract for the avatar rendering system
|
|
9
9
|
*/
|
|
10
|
-
export type AvatarVisualId = 'pixel-art' | 'octopus' | 'octopus2' | 'octopus3' | 'octopus3d' | 'octopus3d2' | 'ascii-octopus' | 'minecraft' | 'minecraft2' | 'fractal' | 'orb';
|
|
10
|
+
export type AvatarVisualId = 'pixel-art' | 'octopus' | 'octopus2' | 'octopus3' | 'octopus3d' | 'octopus3d2' | 'octopus3d3' | 'octopus3d4' | 'ascii-octopus' | 'minecraft' | 'minecraft2' | 'fractal' | 'orb';
|
|
11
11
|
/**
|
|
12
12
|
* Derived color palette used by avatar visuals.
|
|
13
13
|
*
|
|
@@ -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?: string | 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,66 @@
|
|
|
1
|
+
import type { BookNodeAgentSourceOptions } from './BookNodeAgentSource';
|
|
2
|
+
import { CLI_AGENT_HARNESS_NAMES, CLI_AGENT_THINKING_LEVEL_VALUES } from './cliAgentEnv';
|
|
3
|
+
/**
|
|
4
|
+
* CLI harness names supported by `ptbk agent exec`.
|
|
5
|
+
*
|
|
6
|
+
* @public exported from `@promptbook/node`
|
|
7
|
+
*/
|
|
8
|
+
export type CliAgentHarness = (typeof CLI_AGENT_HARNESS_NAMES)[number];
|
|
9
|
+
/**
|
|
10
|
+
* Thinking levels supported by CLI coding harnesses.
|
|
11
|
+
*
|
|
12
|
+
* @public exported from `@promptbook/node`
|
|
13
|
+
*/
|
|
14
|
+
export type CliAgentThinkingLevel = (typeof CLI_AGENT_THINKING_LEVEL_VALUES)[number];
|
|
15
|
+
/**
|
|
16
|
+
* Per-run CLI options exposed by `CliAgent`.
|
|
17
|
+
*
|
|
18
|
+
* `noUi` defaults to `true` so command output stays suitable for JavaScript callers.
|
|
19
|
+
*
|
|
20
|
+
* @public exported from `@promptbook/node`
|
|
21
|
+
*/
|
|
22
|
+
export type CliAgentRunOptions = {
|
|
23
|
+
readonly allowCredits?: boolean;
|
|
24
|
+
readonly context?: string;
|
|
25
|
+
readonly harness?: CliAgentHarness;
|
|
26
|
+
readonly isVerbose?: boolean;
|
|
27
|
+
readonly model?: string;
|
|
28
|
+
readonly noUi?: boolean;
|
|
29
|
+
readonly thinkingLevel?: CliAgentThinkingLevel;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Constructor options for `CliAgent`.
|
|
33
|
+
*
|
|
34
|
+
* @public exported from `@promptbook/node`
|
|
35
|
+
*/
|
|
36
|
+
export type CliAgentOptions = BookNodeAgentSourceOptions & CliAgentRunOptions;
|
|
37
|
+
/**
|
|
38
|
+
* Lightweight JavaScript wrapper around the Promptbook agent execution pipeline.
|
|
39
|
+
*
|
|
40
|
+
* It uses the same harnesses and execution path as `ptbk agent exec`, running the runner
|
|
41
|
+
* in-process instead of spawning a separate CLI process.
|
|
42
|
+
*
|
|
43
|
+
* When no `harness` is provided in the constructor or per-run options, `CliAgent` falls back
|
|
44
|
+
* to the `PTBK_HARNESS` environment variable, mirroring `ptbk agent exec` behavior.
|
|
45
|
+
*
|
|
46
|
+
* @public exported from `@promptbook/node`
|
|
47
|
+
*/
|
|
48
|
+
export declare class CliAgent {
|
|
49
|
+
private readonly options;
|
|
50
|
+
private temporaryAgentPath;
|
|
51
|
+
constructor(options: CliAgentOptions);
|
|
52
|
+
/**
|
|
53
|
+
* Runs one non-interactive agent turn through the selected harness.
|
|
54
|
+
*
|
|
55
|
+
* @param message - User message sent to the agent.
|
|
56
|
+
* @param options - Optional per-run overrides.
|
|
57
|
+
* @returns Final agent answer.
|
|
58
|
+
*/
|
|
59
|
+
run(message: string, options?: CliAgentRunOptions): Promise<string>;
|
|
60
|
+
/**
|
|
61
|
+
* Resolves the agent path passed to the runner, materializing one temporary `.book` file when needed.
|
|
62
|
+
*
|
|
63
|
+
* @private internal utility of `CliAgent`
|
|
64
|
+
*/
|
|
65
|
+
private resolveExecutableAgentPath;
|
|
66
|
+
}
|
|
@@ -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 {};
|