@promptbook/cli 0.112.0-115 → 0.112.0-118

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.
Files changed (82) hide show
  1. package/apps/agents-server/src/app/agents/[agentName]/chat/AgentChatSidebarDefault.tsx +5 -6
  2. package/apps/agents-server/src/utils/externalChatRunner/processExternalUserChatJob.ts +17 -7
  3. package/apps/agents-server/src/utils/localChatRunner/processLocalUserChatJob.ts +17 -7
  4. package/apps/agents-server/src/utils/userChat/createImmediateUserChatAnswerModelRequirements.ts +11 -0
  5. package/apps/agents-server/src/utils/userChat/listUserChats.ts +5 -7
  6. package/esm/index.es.js +451 -95
  7. package/esm/index.es.js.map +1 -1
  8. package/esm/scripts/run-codex-prompts/common/parseDuration.d.ts +19 -0
  9. package/esm/src/_packages/components.index.d.ts +2 -0
  10. package/esm/src/_packages/node.index.d.ts +20 -0
  11. package/esm/src/book-3.0/BookNodeAgentSource.d.ts +1 -1
  12. package/esm/src/book-3.0/CliAgent.d.ts +15 -17
  13. package/esm/src/book-3.0/agentFolderPaths.d.ts +30 -0
  14. package/esm/src/book-3.0/cliAgentEnv.d.ts +33 -0
  15. package/esm/src/book-components/BookEditor/BookEditorBrowserConfig.d.ts +2 -0
  16. package/esm/src/book-components/BookEditor/BookEditorForClient.d.ts +7 -0
  17. package/esm/src/book-components/BookEditor/createDeprecatedCommitmentDiagnostics.browser.d.ts +9 -0
  18. package/esm/src/cli/cli-commands/agent-folder/agentProjectPaths.d.ts +2 -30
  19. package/esm/src/cli/cli-commands/common/promptRunnerCliOptions.d.ts +2 -18
  20. package/esm/src/scrapers/website/utils/createShowdownConverter.d.ts +2 -2
  21. package/esm/src/version.d.ts +1 -1
  22. package/package.json +1 -1
  23. package/src/_packages/components.index.ts +2 -0
  24. package/src/_packages/node.index.ts +20 -0
  25. package/src/avatars/avatarAnimationScheduler.ts +33 -2
  26. package/src/avatars/visuals/fractalAvatarVisual.ts +5 -4
  27. package/src/avatars/visuals/minecraft2AvatarVisual.ts +16 -11
  28. package/src/avatars/visuals/minecraftAvatarVisual.ts +21 -7
  29. package/src/avatars/visuals/octopus3d2AvatarVisual.ts +69 -17
  30. package/src/avatars/visuals/octopus3d3AvatarVisual.ts +81 -18
  31. package/src/avatars/visuals/octopus3dAvatarVisual.ts +69 -17
  32. package/src/book-3.0/Book.ts +3 -1
  33. package/src/book-3.0/BookNodeAgentSource.ts +2 -2
  34. package/src/book-3.0/CliAgent.ts +87 -71
  35. package/src/book-3.0/agentFolderPaths.ts +38 -0
  36. package/src/book-3.0/cliAgentEnv.ts +46 -0
  37. package/src/book-components/BookEditor/BookEditor.tsx +1 -1
  38. package/src/book-components/BookEditor/BookEditorAboutPromptbookInformation.tsx +2 -4
  39. package/src/book-components/BookEditor/BookEditorActionbar.tsx +32 -2
  40. package/src/book-components/BookEditor/BookEditorBrowserConfig.ts +11 -0
  41. package/src/book-components/BookEditor/BookEditorForClient.tsx +33 -0
  42. package/src/book-components/BookEditor/BookEditorMonaco.tsx +1 -1
  43. package/src/book-components/BookEditor/BookEditorMonacoTokenization.ts +83 -15
  44. package/src/book-components/BookEditor/createDeprecatedCommitmentDiagnostics.browser.ts +11 -0
  45. package/src/book-components/BookEditor/useBookEditorMonacoLanguage.ts +32 -46
  46. package/src/book-components/BookEditor/useBookEditorMonacoStyles.ts +1 -1
  47. package/src/book-components/BookEditor/useBookEditorMonacoUploads.ts +1 -1
  48. package/src/book-components/Chat/utils/renderMarkdown.ts +3 -2
  49. package/src/cli/cli-commands/agent-folder/agentProjectPaths.ts +15 -35
  50. package/src/cli/cli-commands/coder/run.ts +28 -3
  51. package/src/cli/cli-commands/common/promptRunnerCliOptions.ts +9 -29
  52. package/src/commands/KNOWLEDGE/utils/knowledgeSourceContentToName.ts +2 -2
  53. package/src/commitments/_common/teamInternalAgentAccess.ts +2 -2
  54. package/src/formats/csv/CsvFormatParser.ts +4 -4
  55. package/src/formats/csv/utils/csvParse.ts +2 -2
  56. package/src/llm-providers/agent/AgentLlmExecutionTools.ts +2 -2
  57. package/src/llm-providers/agent/AgentLlmExecutionToolsAgentKitRunner.ts +2 -2
  58. package/src/llm-providers/agent/AgentLlmExecutionToolsOpenAiAssistantRunner.ts +2 -2
  59. package/src/other/templates/getTemplatesPipelineCollection.ts +712 -807
  60. package/src/scrapers/_common/utils/getScraperIntermediateSource.ts +2 -2
  61. package/src/scrapers/website/WebsiteScraper.ts +1 -1
  62. package/src/scrapers/website/utils/createShowdownConverter.ts +2 -2
  63. package/src/utils/misc/computeHash.ts +2 -2
  64. package/src/utils/random/$randomToken.ts +2 -2
  65. package/src/version.ts +2 -2
  66. package/src/versions.txt +3 -0
  67. package/umd/index.umd.js +453 -94
  68. package/umd/index.umd.js.map +1 -1
  69. package/umd/scripts/run-codex-prompts/common/parseDuration.d.ts +19 -0
  70. package/umd/src/_packages/components.index.d.ts +2 -0
  71. package/umd/src/_packages/node.index.d.ts +20 -0
  72. package/umd/src/book-3.0/BookNodeAgentSource.d.ts +1 -1
  73. package/umd/src/book-3.0/CliAgent.d.ts +15 -17
  74. package/umd/src/book-3.0/agentFolderPaths.d.ts +30 -0
  75. package/umd/src/book-3.0/cliAgentEnv.d.ts +33 -0
  76. package/umd/src/book-components/BookEditor/BookEditorBrowserConfig.d.ts +2 -0
  77. package/umd/src/book-components/BookEditor/BookEditorForClient.d.ts +7 -0
  78. package/umd/src/book-components/BookEditor/createDeprecatedCommitmentDiagnostics.browser.d.ts +9 -0
  79. package/umd/src/cli/cli-commands/agent-folder/agentProjectPaths.d.ts +2 -30
  80. package/umd/src/cli/cli-commands/common/promptRunnerCliOptions.d.ts +2 -18
  81. package/umd/src/scrapers/website/utils/createShowdownConverter.d.ts +2 -2
  82. package/umd/src/version.d.ts +1 -1
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Parses a human-readable duration string into milliseconds.
3
+ *
4
+ * Supported formats: `Xh`, `Xm`, `Xs`, and combinations like `1h30m`, `1h30m5s`.
5
+ *
6
+ * @returns Duration in milliseconds
7
+ * @throws When the string does not match any supported format
8
+ *
9
+ * @private internal utility of `ptbk coder run`
10
+ */
11
+ export declare function parseDuration(durationString: string): number;
12
+ /**
13
+ * Formats a duration in milliseconds into a compact human-readable string.
14
+ *
15
+ * Examples: `3600000` → `"1h"`, `90000` → `"1m 30s"`, `5000` → `"5s"`.
16
+ *
17
+ * @private internal utility of `ptbk coder run`
18
+ */
19
+ export declare function formatDurationMs(ms: number): string;
@@ -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';
@@ -95,6 +96,7 @@ export type { BookEditorUploadProgressCallback };
95
96
  export type { BookEditorUploadOptions };
96
97
  export type { BookEditorProps };
97
98
  export { BookEditor };
99
+ export { BookEditorForClient };
98
100
  export { AgentChat };
99
101
  export type { AgentChatProps };
100
102
  export { Chat };
@@ -1,4 +1,9 @@
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';
2
7
  import type { BookNodeAgentSource } from '../book-3.0/BookNodeAgentSource';
3
8
  import type { BookNodeAgentSourceOptions } from '../book-3.0/BookNodeAgentSource';
4
9
  import type { CliAgentHarness } from '../book-3.0/CliAgent';
@@ -6,6 +11,11 @@ import type { CliAgentThinkingLevel } from '../book-3.0/CliAgent';
6
11
  import type { CliAgentRunOptions } from '../book-3.0/CliAgent';
7
12
  import type { CliAgentOptions } from '../book-3.0/CliAgent';
8
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';
9
19
  import type { LiteAgentOptions } from '../book-3.0/LiteAgent';
10
20
  import type { LiteAgentRunOptions } from '../book-3.0/LiteAgent';
11
21
  import { LiteAgent } from '../book-3.0/LiteAgent';
@@ -22,6 +32,11 @@ import { FileCacheStorage } from '../storage/file-cache-storage/FileCacheStorage
22
32
  import { $execCommand } from '../utils/execCommand/$execCommand';
23
33
  import { $execCommands } from '../utils/execCommand/$execCommands';
24
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 };
25
40
  export type { BookNodeAgentSource };
26
41
  export type { BookNodeAgentSourceOptions };
27
42
  export type { CliAgentHarness };
@@ -29,6 +44,11 @@ export type { CliAgentThinkingLevel };
29
44
  export type { CliAgentRunOptions };
30
45
  export type { CliAgentOptions };
31
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 };
32
52
  export type { LiteAgentOptions };
33
53
  export type { LiteAgentRunOptions };
34
54
  export { LiteAgent };
@@ -15,7 +15,7 @@ export type BookNodeAgentSource = Book | string_book;
15
15
  */
16
16
  export type BookNodeAgentSourceOptions = {
17
17
  readonly agentPath?: string;
18
- readonly book?: BookNodeAgentSource;
18
+ readonly book?: string | BookNodeAgentSource;
19
19
  readonly currentWorkingDirectory?: string;
20
20
  };
21
21
  /**
@@ -1,16 +1,17 @@
1
1
  import type { BookNodeAgentSourceOptions } from './BookNodeAgentSource';
2
+ import { CLI_AGENT_HARNESS_NAMES, CLI_AGENT_THINKING_LEVEL_VALUES } from './cliAgentEnv';
2
3
  /**
3
4
  * CLI harness names supported by `ptbk agent exec`.
4
5
  *
5
6
  * @public exported from `@promptbook/node`
6
7
  */
7
- export type CliAgentHarness = 'openai-codex' | 'github-copilot' | 'cline' | 'claude-code' | 'opencode' | 'gemini';
8
+ export type CliAgentHarness = (typeof CLI_AGENT_HARNESS_NAMES)[number];
8
9
  /**
9
10
  * Thinking levels supported by CLI coding harnesses.
10
11
  *
11
12
  * @public exported from `@promptbook/node`
12
13
  */
13
- export type CliAgentThinkingLevel = 'low' | 'medium' | 'high' | 'xhigh';
14
+ export type CliAgentThinkingLevel = (typeof CLI_AGENT_THINKING_LEVEL_VALUES)[number];
14
15
  /**
15
16
  * Per-run CLI options exposed by `CliAgent`.
16
17
  *
@@ -22,6 +23,7 @@ export type CliAgentRunOptions = {
22
23
  readonly allowCredits?: boolean;
23
24
  readonly context?: string;
24
25
  readonly harness?: CliAgentHarness;
26
+ readonly isVerbose?: boolean;
25
27
  readonly model?: string;
26
28
  readonly noUi?: boolean;
27
29
  readonly thinkingLevel?: CliAgentThinkingLevel;
@@ -31,19 +33,15 @@ export type CliAgentRunOptions = {
31
33
  *
32
34
  * @public exported from `@promptbook/node`
33
35
  */
34
- export type CliAgentOptions = BookNodeAgentSourceOptions & CliAgentRunOptions & {
35
- /**
36
- * Executable used for the wrapper command.
37
- *
38
- * @default ptbk
39
- */
40
- readonly command?: string;
41
- };
36
+ export type CliAgentOptions = BookNodeAgentSourceOptions & CliAgentRunOptions;
42
37
  /**
43
- * Lightweight JavaScript wrapper around `ptbk agent exec`.
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.
44
42
  *
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.
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.
47
45
  *
48
46
  * @public exported from `@promptbook/node`
49
47
  */
@@ -52,15 +50,15 @@ export declare class CliAgent {
52
50
  private temporaryAgentPath;
53
51
  constructor(options: CliAgentOptions);
54
52
  /**
55
- * Runs one non-interactive agent turn through `ptbk agent exec`.
53
+ * Runs one non-interactive agent turn through the selected harness.
56
54
  *
57
55
  * @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.
56
+ * @param options - Optional per-run overrides.
57
+ * @returns Final agent answer.
60
58
  */
61
59
  run(message: string, options?: CliAgentRunOptions): Promise<string>;
62
60
  /**
63
- * Resolves the agent path passed to the CLI, materializing one temporary `.book` file when needed.
61
+ * Resolves the agent path passed to the runner, materializing one temporary `.book` file when needed.
64
62
  *
65
63
  * @private internal utility of `CliAgent`
66
64
  */
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Relative path to the local agent source used by the agent folder convention.
3
+ *
4
+ * @public exported from `@promptbook/node`
5
+ */
6
+ export declare const AGENT_BOOK_FILE_PATH = "agent.book";
7
+ /**
8
+ * Relative path to the message queue root used by the agent folder convention.
9
+ *
10
+ * @public exported from `@promptbook/node`
11
+ */
12
+ export declare const AGENT_MESSAGES_DIRECTORY_PATH = "messages";
13
+ /**
14
+ * Relative path to queued user messages consumed by the agent runner.
15
+ *
16
+ * @public exported from `@promptbook/node`
17
+ */
18
+ export declare const AGENT_QUEUED_MESSAGES_DIRECTORY_PATH: string;
19
+ /**
20
+ * Relative path to answered messages written by the agent runner.
21
+ *
22
+ * @public exported from `@promptbook/node`
23
+ */
24
+ export declare const AGENT_FINISHED_MESSAGES_DIRECTORY_PATH: string;
25
+ /**
26
+ * Relative path to messages that the agent runner stopped retrying.
27
+ *
28
+ * @public exported from `@promptbook/node`
29
+ */
30
+ export declare const AGENT_FAILED_MESSAGES_DIRECTORY_PATH: string;
@@ -0,0 +1,33 @@
1
+ /**
2
+ * All CLI harness names supported by `CliAgent` and `ptbk agent exec`.
3
+ *
4
+ * @public exported from `@promptbook/node`
5
+ */
6
+ export declare const CLI_AGENT_HARNESS_NAMES: readonly ["openai-codex", "github-copilot", "cline", "claude-code", "opencode", "gemini"];
7
+ /**
8
+ * All supported thinking-level values for CLI coding-agent runners.
9
+ *
10
+ * @public exported from `@promptbook/node`
11
+ */
12
+ export declare const CLI_AGENT_THINKING_LEVEL_VALUES: readonly ["low", "medium", "high", "xhigh"];
13
+ /**
14
+ * Environment variable used as the default runner identifier when `--harness` is omitted or not set in `CliAgent`.
15
+ *
16
+ * Set this to one of the harness names (`openai-codex`, `github-copilot`, `cline`, `claude-code`, `opencode`, `gemini`)
17
+ * so that `CliAgent` and `ptbk agent exec` can run without an explicit `harness` option.
18
+ *
19
+ * @public exported from `@promptbook/node`
20
+ */
21
+ export declare const PTBK_HARNESS_ENV = "PTBK_HARNESS";
22
+ /**
23
+ * Environment variable used as the default runner model when `--model` is omitted or not set in `CliAgent`.
24
+ *
25
+ * @public exported from `@promptbook/node`
26
+ */
27
+ export declare const PTBK_MODEL_ENV = "PTBK_MODEL";
28
+ /**
29
+ * Environment variable used as the default thinking level when `--thinking-level` is omitted or not set in `CliAgent`.
30
+ *
31
+ * @public exported from `@promptbook/node`
32
+ */
33
+ export declare const PTBK_THINKING_LEVEL_ENV = "PTBK_THINKING_LEVEL";
@@ -0,0 +1,2 @@
1
+ export { NAME, CLAIM, PROMPTBOOK_LEGAL_ENTITY, IS_COST_PREVENTED, DEFAULT_IS_VERBOSE, DEFAULT_MAX_CONCURRENT_UPLOADS, PROMPTBOOK_SYNTAX_COLORS, } from '../../config';
2
+ export { PUBLIC_AGENTS_SERVERS } from '../../../servers';
@@ -0,0 +1,7 @@
1
+ import { BookEditorProps } from './BookEditor';
2
+ /**
3
+ * Renders a book editor
4
+ *
5
+ * @public exported from `@promptbook/components`
6
+ */
7
+ export declare function BookEditorForClient(props: BookEditorProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Browser-compatible stub for `createDeprecatedCommitmentDiagnostics`.
3
+ *
4
+ * In the browser build the full Node.js implementation is not available,
5
+ * so this stub always returns an empty array to keep the editor functional.
6
+ *
7
+ * @private internal utility of `BookEditorMonaco`
8
+ */
9
+ export declare function createDeprecatedCommitmentDiagnostics(_agentSource?: string): [];
@@ -1,39 +1,11 @@
1
- /**
2
- * Relative path to the local agent source initialized by `ptbk agent-folder init`.
3
- *
4
- * @private internal utility of `ptbk agent-folder`
5
- */
6
- export declare const AGENT_BOOK_FILE_PATH = "agent.book";
1
+ import { AGENT_BOOK_FILE_PATH, AGENT_FAILED_MESSAGES_DIRECTORY_PATH, AGENT_FINISHED_MESSAGES_DIRECTORY_PATH, AGENT_MESSAGES_DIRECTORY_PATH, AGENT_QUEUED_MESSAGES_DIRECTORY_PATH } from '../../../book-3.0/agentFolderPaths';
2
+ export { AGENT_BOOK_FILE_PATH, AGENT_FAILED_MESSAGES_DIRECTORY_PATH, AGENT_FINISHED_MESSAGES_DIRECTORY_PATH, AGENT_MESSAGES_DIRECTORY_PATH, AGENT_QUEUED_MESSAGES_DIRECTORY_PATH, };
7
3
  /**
8
4
  * Relative path to local knowledge files initialized by `ptbk agent-folder init`.
9
5
  *
10
6
  * @private internal utility of `ptbk agent-folder`
11
7
  */
12
8
  export declare const AGENT_KNOWLEDGE_DIRECTORY_PATH = "knowledge";
13
- /**
14
- * Relative path to the message queue root initialized by `ptbk agent-folder init`.
15
- *
16
- * @private internal utility of `ptbk agent-folder`
17
- */
18
- export declare const AGENT_MESSAGES_DIRECTORY_PATH = "messages";
19
- /**
20
- * Relative path to queued user messages consumed by `ptbk agent-folder run-once`.
21
- *
22
- * @private internal utility of `ptbk agent-folder`
23
- */
24
- export declare const AGENT_QUEUED_MESSAGES_DIRECTORY_PATH: string;
25
- /**
26
- * Relative path to answered messages written by `ptbk agent-folder run-once`.
27
- *
28
- * @private internal utility of `ptbk agent-folder`
29
- */
30
- export declare const AGENT_FINISHED_MESSAGES_DIRECTORY_PATH: string;
31
- /**
32
- * Relative path to messages that the agent runner stopped retrying.
33
- *
34
- * @private internal utility of `ptbk agent-folder`
35
- */
36
- export declare const AGENT_FAILED_MESSAGES_DIRECTORY_PATH: string;
37
9
  /**
38
10
  * Relative path to generated local agent documentation initialized by `ptbk agent-folder init`.
39
11
  *
@@ -1,29 +1,13 @@
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
10
  export declare const PROMPT_RUNNER_HARNESS_NAMES: readonly ["openai-codex", "github-copilot", "cline", "claude-code", "opencode", "gemini"];
9
- /**
10
- * Environment variable used as the default runner identifier when `--harness` is omitted.
11
- *
12
- * @private internal utility of `promptbookCli`
13
- */
14
- export declare const PTBK_HARNESS_ENV = "PTBK_HARNESS";
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";
27
11
  /**
28
12
  * Runner identifier supported by Promptbook CLI agent orchestration commands.
29
13
  *
@@ -1,7 +1,7 @@
1
- import { Converter as ShowdownConverter } from 'showdown';
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(): ShowdownConverter;
7
+ export declare function createShowdownConverter(): showdown.Converter;
@@ -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-114`).
18
+ * It follows semantic versioning (e.g., `0.112.0-117`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/cli",
3
- "version": "0.112.0-115",
3
+ "version": "0.112.0-118",
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,
@@ -17,6 +17,7 @@ import type { BookEditorUploadProgressCallback } from '../book-components/BookEd
17
17
  import type { BookEditorUploadOptions } from '../book-components/BookEditor/BookEditor';
18
18
  import type { BookEditorProps } from '../book-components/BookEditor/BookEditor';
19
19
  import { BookEditor } from '../book-components/BookEditor/BookEditor';
20
+ import { BookEditorForClient } from '../book-components/BookEditor/BookEditorForClient';
20
21
  import { AgentChat } from '../book-components/Chat/AgentChat/AgentChat';
21
22
  import type { AgentChatProps } from '../book-components/Chat/AgentChat/AgentChatProps';
22
23
  import { Chat } from '../book-components/Chat/Chat/Chat';
@@ -106,6 +107,7 @@ export type { BookEditorUploadProgressCallback };
106
107
  export type { BookEditorUploadOptions };
107
108
  export type { BookEditorProps };
108
109
  export { BookEditor };
110
+ export { BookEditorForClient };
109
111
  export { AgentChat };
110
112
  export type { AgentChatProps };
111
113
  export { Chat };
@@ -2,6 +2,11 @@
2
2
  // `@promptbook/node`
3
3
 
4
4
  import { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION } from '../version';
5
+ import { AGENT_BOOK_FILE_PATH } from '../book-3.0/agentFolderPaths';
6
+ import { AGENT_MESSAGES_DIRECTORY_PATH } from '../book-3.0/agentFolderPaths';
7
+ import { AGENT_QUEUED_MESSAGES_DIRECTORY_PATH } from '../book-3.0/agentFolderPaths';
8
+ import { AGENT_FINISHED_MESSAGES_DIRECTORY_PATH } from '../book-3.0/agentFolderPaths';
9
+ import { AGENT_FAILED_MESSAGES_DIRECTORY_PATH } from '../book-3.0/agentFolderPaths';
5
10
  import type { BookNodeAgentSource } from '../book-3.0/BookNodeAgentSource';
6
11
  import type { BookNodeAgentSourceOptions } from '../book-3.0/BookNodeAgentSource';
7
12
  import type { CliAgentHarness } from '../book-3.0/CliAgent';
@@ -9,6 +14,11 @@ import type { CliAgentThinkingLevel } from '../book-3.0/CliAgent';
9
14
  import type { CliAgentRunOptions } from '../book-3.0/CliAgent';
10
15
  import type { CliAgentOptions } from '../book-3.0/CliAgent';
11
16
  import { CliAgent } from '../book-3.0/CliAgent';
17
+ import { CLI_AGENT_HARNESS_NAMES } from '../book-3.0/cliAgentEnv';
18
+ import { CLI_AGENT_THINKING_LEVEL_VALUES } from '../book-3.0/cliAgentEnv';
19
+ import { PTBK_HARNESS_ENV } from '../book-3.0/cliAgentEnv';
20
+ import { PTBK_MODEL_ENV } from '../book-3.0/cliAgentEnv';
21
+ import { PTBK_THINKING_LEVEL_ENV } from '../book-3.0/cliAgentEnv';
12
22
  import type { LiteAgentOptions } from '../book-3.0/LiteAgent';
13
23
  import type { LiteAgentRunOptions } from '../book-3.0/LiteAgent';
14
24
  import { LiteAgent } from '../book-3.0/LiteAgent';
@@ -31,6 +41,11 @@ export { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION };
31
41
 
32
42
 
33
43
  // Note: Entities of the `@promptbook/node`
44
+ export { AGENT_BOOK_FILE_PATH };
45
+ export { AGENT_MESSAGES_DIRECTORY_PATH };
46
+ export { AGENT_QUEUED_MESSAGES_DIRECTORY_PATH };
47
+ export { AGENT_FINISHED_MESSAGES_DIRECTORY_PATH };
48
+ export { AGENT_FAILED_MESSAGES_DIRECTORY_PATH };
34
49
  export type { BookNodeAgentSource };
35
50
  export type { BookNodeAgentSourceOptions };
36
51
  export type { CliAgentHarness };
@@ -38,6 +53,11 @@ export type { CliAgentThinkingLevel };
38
53
  export type { CliAgentRunOptions };
39
54
  export type { CliAgentOptions };
40
55
  export { CliAgent };
56
+ export { CLI_AGENT_HARNESS_NAMES };
57
+ export { CLI_AGENT_THINKING_LEVEL_VALUES };
58
+ export { PTBK_HARNESS_ENV };
59
+ export { PTBK_MODEL_ENV };
60
+ export { PTBK_THINKING_LEVEL_ENV };
41
61
  export type { LiteAgentOptions };
42
62
  export type { LiteAgentRunOptions };
43
63
  export { LiteAgent };
@@ -7,6 +7,24 @@
7
7
  */
8
8
  type AvatarAnimationListener = (now: number) => void;
9
9
 
10
+ /**
11
+ * Target frames per second for the shared avatar animation loop.
12
+ *
13
+ * Animated octopus visuals change slowly enough that 24 fps is indistinguishable
14
+ * from 60 fps in practice, while cutting rendering work by ~60% when multiple
15
+ * avatars are on screen simultaneously.
16
+ *
17
+ * @private utility of the avatar rendering system
18
+ */
19
+ const AVATAR_TARGET_FPS = 24;
20
+
21
+ /**
22
+ * Minimum elapsed time in milliseconds required between avatar render passes.
23
+ *
24
+ * @private utility of the avatar rendering system
25
+ */
26
+ const AVATAR_TARGET_FRAME_INTERVAL_MS = 1000 / AVATAR_TARGET_FPS;
27
+
10
28
  /**
11
29
  * Next registration id used by the shared avatar animation scheduler.
12
30
  *
@@ -28,6 +46,15 @@ const avatarAnimationListeners = new Map<number, AvatarAnimationListener>();
28
46
  */
29
47
  let avatarAnimationFrameId: number | null = null;
30
48
 
49
+ /**
50
+ * Timestamp of the most recently rendered avatar frame.
51
+ *
52
+ * Used to throttle callbacks to `AVATAR_TARGET_FRAME_INTERVAL_MS`.
53
+ *
54
+ * @private utility of the avatar rendering system
55
+ */
56
+ let lastAvatarFrameTime = 0;
57
+
31
58
  /**
32
59
  * Registers one avatar animation callback in the shared animation loop.
33
60
  *
@@ -68,8 +95,12 @@ function ensureAvatarAnimationLoop(): void {
68
95
  const runFrame = (now: number) => {
69
96
  avatarAnimationFrameId = null;
70
97
 
71
- for (const avatarAnimationListener of [...avatarAnimationListeners.values()]) {
72
- avatarAnimationListener(now);
98
+ if (now - lastAvatarFrameTime >= AVATAR_TARGET_FRAME_INTERVAL_MS) {
99
+ lastAvatarFrameTime = now;
100
+
101
+ for (const avatarAnimationListener of [...avatarAnimationListeners.values()]) {
102
+ avatarAnimationListener(now);
103
+ }
73
104
  }
74
105
 
75
106
  ensureAvatarAnimationLoop();
@@ -290,7 +290,7 @@ function drawDragonCurveLayer(
290
290
  layerIndex: number;
291
291
  },
292
292
  ): void {
293
- const { size, primaryColor, secondaryColor, tertiaryColor, shadowColor, strokeWidth, timeMs, layerIndex } = options;
293
+ const { primaryColor, secondaryColor, tertiaryColor, shadowColor, strokeWidth, timeMs, layerIndex } = options;
294
294
  const firstPoint = points[0]!;
295
295
  const lastPoint = points[points.length - 1]!;
296
296
  const ribbonGradient = context.createLinearGradient(firstPoint.x, firstPoint.y, lastPoint.x, lastPoint.y);
@@ -298,14 +298,15 @@ function drawDragonCurveLayer(
298
298
  ribbonGradient.addColorStop(0.5, `${secondaryColor}e6`);
299
299
  ribbonGradient.addColorStop(1, `${tertiaryColor}f2`);
300
300
 
301
+ // Approximate the blurred shadow stroke with a wider semi-transparent stroke instead of
302
+ // context.filter blur, which triggers a costly software rasterization pass every frame.
301
303
  context.save();
302
304
  context.beginPath();
303
305
  tracePolyline(context, points);
304
- context.strokeStyle = `${shadowColor}82`;
305
- context.lineWidth = strokeWidth * 1.8;
306
+ context.strokeStyle = `${shadowColor}48`;
307
+ context.lineWidth = strokeWidth * 4.5;
306
308
  context.lineJoin = 'round';
307
309
  context.lineCap = 'round';
308
- context.filter = `blur(${size * 0.022}px)`;
309
310
  context.stroke();
310
311
  context.restore();
311
312
 
@@ -218,19 +218,24 @@ function drawMinecraftShadow(
218
218
  },
219
219
  timeMs: number,
220
220
  ): void {
221
+ const cx = size * 0.5 + interaction.gazeX * size * 0.03;
222
+ const cy = size * 0.85 + Math.sin(timeMs / 880) * size * 0.01;
223
+ const rx = size * (0.16 + interaction.intensity * 0.015);
224
+ const ry = size * 0.055;
225
+
226
+ // Radial gradient approximates the blurry ellipse shadow without context.filter blur.
221
227
  context.save();
222
- context.fillStyle = `${palette.shadow}66`;
223
- context.filter = `blur(${size * 0.02}px)`;
228
+ context.translate(cx, cy);
229
+ context.scale(1, ry / rx);
230
+ const blurRadius = rx * 1.4;
231
+ const shadowGradient = context.createRadialGradient(0, 0, 0, 0, 0, blurRadius);
232
+ shadowGradient.addColorStop(0, `${palette.shadow}7a`);
233
+ shadowGradient.addColorStop(0.45, `${palette.shadow}44`);
234
+ shadowGradient.addColorStop(0.8, `${palette.shadow}1a`);
235
+ shadowGradient.addColorStop(1, `${palette.shadow}00`);
236
+ context.fillStyle = shadowGradient;
224
237
  context.beginPath();
225
- context.ellipse(
226
- size * 0.5 + interaction.gazeX * size * 0.03,
227
- size * 0.85 + Math.sin(timeMs / 880) * size * 0.01,
228
- size * (0.16 + interaction.intensity * 0.015),
229
- size * 0.055,
230
- 0,
231
- 0,
232
- Math.PI * 2,
233
- );
238
+ context.arc(0, 0, blurRadius, 0, Math.PI * 2);
234
239
  context.fill();
235
240
  context.restore();
236
241
  }
@@ -45,13 +45,27 @@ export const minecraftAvatarVisual: AvatarVisualDefinition = {
45
45
  context.fillStyle = spotlight;
46
46
  context.fillRect(0, 0, size, size);
47
47
 
48
- context.save();
49
- context.fillStyle = 'rgba(0, 0, 0, 0.22)';
50
- context.filter = `blur(${size * 0.018}px)`;
51
- context.beginPath();
52
- context.ellipse(size * 0.5, size * 0.86, size * 0.2, size * 0.06, 0, 0, Math.PI * 2);
53
- context.fill();
54
- context.restore();
48
+ {
49
+ // Radial gradient approximates the blurry ellipse shadow without context.filter blur.
50
+ const cx = size * 0.5;
51
+ const cy = size * 0.86;
52
+ const rx = size * 0.2;
53
+ const ry = size * 0.06;
54
+ const blurRadius = rx * 1.4;
55
+ const shadowGradient = context.createRadialGradient(0, 0, 0, 0, 0, blurRadius);
56
+ shadowGradient.addColorStop(0, 'rgba(0,0,0,0.28)');
57
+ shadowGradient.addColorStop(0.45, 'rgba(0,0,0,0.14)');
58
+ shadowGradient.addColorStop(0.8, 'rgba(0,0,0,0.05)');
59
+ shadowGradient.addColorStop(1, 'rgba(0,0,0,0)');
60
+ context.save();
61
+ context.translate(cx, cy);
62
+ context.scale(1, ry / rx);
63
+ context.fillStyle = shadowGradient;
64
+ context.beginPath();
65
+ context.arc(0, 0, blurRadius, 0, Math.PI * 2);
66
+ context.fill();
67
+ context.restore();
68
+ }
55
69
 
56
70
  drawVoxelCuboid(context, {
57
71
  x: bodyX,