@promptbook/vercel 0.112.0-98 → 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.
Files changed (156) hide show
  1. package/README.md +37 -21
  2. package/esm/index.es.js +3 -3
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/src/_packages/components.index.d.ts +4 -0
  5. package/esm/src/_packages/core.index.d.ts +0 -2
  6. package/esm/src/_packages/node.index.d.ts +40 -0
  7. package/esm/src/_packages/types.index.d.ts +18 -0
  8. package/esm/src/avatars/avatarAnimationScheduler.d.ts +4 -0
  9. package/esm/src/avatars/types/AvatarVisualDefinition.d.ts +1 -1
  10. package/esm/src/avatars/visuals/octopus3d3AvatarVisual.d.ts +7 -0
  11. package/esm/src/avatars/visuals/octopus3d4AvatarVisual.d.ts +7 -0
  12. package/esm/src/book-3.0/BookNodeAgentSource.d.ts +38 -0
  13. package/esm/src/book-3.0/CliAgent.d.ts +66 -0
  14. package/esm/src/book-3.0/CliAgent.test.d.ts +1 -0
  15. package/esm/src/book-3.0/LiteAgent.d.ts +68 -0
  16. package/esm/src/book-3.0/LiteAgent.test.d.ts +1 -0
  17. package/esm/src/book-3.0/agentFolderPaths.d.ts +30 -0
  18. package/esm/src/book-3.0/cliAgentEnv.d.ts +33 -0
  19. package/esm/src/book-components/BookEditor/BookEditor.d.ts +6 -5
  20. package/esm/src/book-components/BookEditor/BookEditorAboutPromptbookInformation.d.ts +12 -0
  21. package/esm/src/book-components/BookEditor/BookEditorBrowserConfig.d.ts +2 -0
  22. package/esm/src/book-components/BookEditor/BookEditorForClient.d.ts +7 -0
  23. package/esm/src/book-components/BookEditor/BookEditorMonacoTokenization.d.ts +1 -0
  24. package/esm/src/book-components/BookEditor/BookEditorTheme.d.ts +24 -0
  25. package/esm/src/book-components/BookEditor/createDeprecatedCommitmentDiagnostics.browser.d.ts +9 -0
  26. package/esm/src/book-components/BookEditor/useBookEditorMonacoLanguage.d.ts +1 -6
  27. package/esm/src/book-components/BookEditor/useBookEditorMonacoLifecycle.d.ts +1 -4
  28. package/esm/src/book-components/BookEditor/useBookEditorMonacoStyles.d.ts +2 -1
  29. package/esm/src/book-components/Chat/Chat/ChatCitationModal.d.ts +2 -0
  30. package/esm/src/book-components/Chat/Chat/ChatMessageItem.d.ts +4 -0
  31. package/esm/src/book-components/Chat/Chat/ChatMessageList.d.ts +4 -0
  32. package/esm/src/book-components/Chat/Chat/ChatProps.d.ts +5 -0
  33. package/esm/src/book-components/Chat/Chat/ChatToolCallModal.d.ts +2 -0
  34. package/esm/src/book-components/Chat/Chat/ChatToolCallModalContent.d.ts +3 -1
  35. package/esm/src/book-components/Chat/Chat/CitationIframePreview.d.ts +20 -0
  36. package/esm/src/book-components/Chat/Chat/TeamToolCallModalContent.d.ts +2 -0
  37. package/esm/src/book-components/Chat/MarkdownContent/MarkdownContent.d.ts +1 -0
  38. package/esm/src/book-components/Chat/SourceChip/SourceChip.d.ts +6 -1
  39. package/esm/src/book-components/Chat/hooks/useResolvedCitationLabel.d.ts +12 -0
  40. package/esm/src/book-components/Chat/types/ChatMessage.d.ts +4 -0
  41. package/esm/src/book-components/Chat/types/ChatParticipant.d.ts +1 -1
  42. package/esm/src/book-components/Chat/types/CitationLabelResolver.d.ts +8 -0
  43. package/esm/src/book-components/Chat/utils/citationHelpers.d.ts +9 -0
  44. package/esm/src/book-components/Chat/utils/decodeJsonUnicodeEscapesInMarkdownText.d.ts +14 -0
  45. package/esm/src/book-components/Chat/utils/decodeJsonUnicodeEscapesInMarkdownText.test.d.ts +1 -0
  46. package/esm/src/book-components/Chat/utils/isVisibleChatToolCall.d.ts +10 -0
  47. package/esm/src/book-components/Chat/utils/parseCitationsFromContent.d.ts +4 -0
  48. package/esm/src/book-components/_common/Dropdown/Dropdown.d.ts +1 -1
  49. package/esm/src/book-components/_common/MenuHoisting/MenuHoistingContext.d.ts +1 -1
  50. package/esm/src/book-components/_common/Modal/Modal.d.ts +1 -1
  51. package/esm/src/book-components/icons/AboutIcon.d.ts +1 -1
  52. package/esm/src/book-components/icons/DownloadIcon.d.ts +1 -1
  53. package/esm/src/book-components/icons/ExitFullscreenIcon.d.ts +1 -1
  54. package/esm/src/book-components/icons/FullscreenIcon.d.ts +1 -1
  55. package/esm/src/cli/cli-commands/agent/agentCliOptions.d.ts +38 -0
  56. package/esm/src/cli/cli-commands/agent/chat.d.ts +10 -0
  57. package/esm/src/cli/cli-commands/agent/exec.d.ts +10 -0
  58. package/esm/src/cli/cli-commands/agent/run.test.d.ts +1 -0
  59. package/esm/src/cli/cli-commands/agent-folder/agentProjectPaths.d.ts +2 -24
  60. package/esm/src/cli/cli-commands/agent.d.ts +14 -0
  61. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer.d.ts +17 -1
  62. package/esm/src/cli/cli-commands/agents-server/run.d.ts +6 -0
  63. package/esm/src/cli/cli-commands/agents-server/startAgentsServer.d.ts +9 -2
  64. package/esm/src/cli/cli-commands/coder/ThinkingLevel.d.ts +1 -1
  65. package/esm/src/cli/cli-commands/coder/ensureCoderDeveloperAgentFile.d.ts +25 -0
  66. package/esm/src/cli/cli-commands/coder/find-unwritten.d.ts +10 -0
  67. package/esm/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.d.ts +2 -0
  68. package/esm/src/cli/cli-commands/coder/server.d.ts +13 -0
  69. package/esm/src/cli/cli-commands/coder/waitOptions.d.ts +14 -0
  70. package/esm/src/cli/cli-commands/common/promptRunnerCliOptions.d.ts +9 -25
  71. package/esm/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +22 -0
  72. package/esm/src/commitments/_common/teamInternalAgentAccess.d.ts +9 -1
  73. package/esm/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts +1 -1
  74. package/esm/src/llm-providers/_common/register/$provideLlmToolsFromEnv.d.ts +1 -1
  75. package/esm/src/scrapers/website/utils/createShowdownConverter.d.ts +2 -2
  76. package/esm/src/utils/isTimingSafeEqualString.d.ts +25 -0
  77. package/esm/src/utils/validators/url/isValidAgentUrl.d.ts +5 -0
  78. package/esm/src/version.d.ts +1 -1
  79. package/package.json +3 -3
  80. package/umd/index.umd.js +7 -6
  81. package/umd/index.umd.js.map +1 -1
  82. package/umd/src/_packages/components.index.d.ts +4 -0
  83. package/umd/src/_packages/core.index.d.ts +0 -2
  84. package/umd/src/_packages/node.index.d.ts +40 -0
  85. package/umd/src/_packages/types.index.d.ts +18 -0
  86. package/umd/src/avatars/avatarAnimationScheduler.d.ts +4 -0
  87. package/umd/src/avatars/types/AvatarVisualDefinition.d.ts +1 -1
  88. package/umd/src/avatars/visuals/octopus3d3AvatarVisual.d.ts +7 -0
  89. package/umd/src/avatars/visuals/octopus3d4AvatarVisual.d.ts +7 -0
  90. package/umd/src/book-3.0/BookNodeAgentSource.d.ts +38 -0
  91. package/umd/src/book-3.0/CliAgent.d.ts +66 -0
  92. package/umd/src/book-3.0/CliAgent.test.d.ts +1 -0
  93. package/umd/src/book-3.0/LiteAgent.d.ts +68 -0
  94. package/umd/src/book-3.0/LiteAgent.test.d.ts +1 -0
  95. package/umd/src/book-3.0/agentFolderPaths.d.ts +30 -0
  96. package/umd/src/book-3.0/cliAgentEnv.d.ts +33 -0
  97. package/umd/src/book-components/BookEditor/BookEditor.d.ts +6 -5
  98. package/umd/src/book-components/BookEditor/BookEditorAboutPromptbookInformation.d.ts +12 -0
  99. package/umd/src/book-components/BookEditor/BookEditorBrowserConfig.d.ts +2 -0
  100. package/umd/src/book-components/BookEditor/BookEditorForClient.d.ts +7 -0
  101. package/umd/src/book-components/BookEditor/BookEditorMonacoTokenization.d.ts +1 -0
  102. package/umd/src/book-components/BookEditor/BookEditorTheme.d.ts +24 -0
  103. package/umd/src/book-components/BookEditor/createDeprecatedCommitmentDiagnostics.browser.d.ts +9 -0
  104. package/umd/src/book-components/BookEditor/useBookEditorMonacoLanguage.d.ts +1 -6
  105. package/umd/src/book-components/BookEditor/useBookEditorMonacoLifecycle.d.ts +1 -4
  106. package/umd/src/book-components/BookEditor/useBookEditorMonacoStyles.d.ts +2 -1
  107. package/umd/src/book-components/Chat/Chat/ChatCitationModal.d.ts +2 -0
  108. package/umd/src/book-components/Chat/Chat/ChatMessageItem.d.ts +4 -0
  109. package/umd/src/book-components/Chat/Chat/ChatMessageList.d.ts +4 -0
  110. package/umd/src/book-components/Chat/Chat/ChatProps.d.ts +5 -0
  111. package/umd/src/book-components/Chat/Chat/ChatToolCallModal.d.ts +2 -0
  112. package/umd/src/book-components/Chat/Chat/ChatToolCallModalContent.d.ts +3 -1
  113. package/umd/src/book-components/Chat/Chat/CitationIframePreview.d.ts +20 -0
  114. package/umd/src/book-components/Chat/Chat/TeamToolCallModalContent.d.ts +2 -0
  115. package/umd/src/book-components/Chat/MarkdownContent/MarkdownContent.d.ts +1 -0
  116. package/umd/src/book-components/Chat/SourceChip/SourceChip.d.ts +6 -1
  117. package/umd/src/book-components/Chat/hooks/useResolvedCitationLabel.d.ts +12 -0
  118. package/umd/src/book-components/Chat/types/ChatMessage.d.ts +4 -0
  119. package/umd/src/book-components/Chat/types/ChatParticipant.d.ts +1 -1
  120. package/umd/src/book-components/Chat/types/CitationLabelResolver.d.ts +8 -0
  121. package/umd/src/book-components/Chat/utils/citationHelpers.d.ts +9 -0
  122. package/umd/src/book-components/Chat/utils/decodeJsonUnicodeEscapesInMarkdownText.d.ts +14 -0
  123. package/umd/src/book-components/Chat/utils/decodeJsonUnicodeEscapesInMarkdownText.test.d.ts +1 -0
  124. package/umd/src/book-components/Chat/utils/isVisibleChatToolCall.d.ts +10 -0
  125. package/umd/src/book-components/Chat/utils/parseCitationsFromContent.d.ts +4 -0
  126. package/umd/src/book-components/_common/Dropdown/Dropdown.d.ts +1 -1
  127. package/umd/src/book-components/_common/MenuHoisting/MenuHoistingContext.d.ts +1 -1
  128. package/umd/src/book-components/_common/Modal/Modal.d.ts +1 -1
  129. package/umd/src/book-components/icons/AboutIcon.d.ts +1 -1
  130. package/umd/src/book-components/icons/DownloadIcon.d.ts +1 -1
  131. package/umd/src/book-components/icons/ExitFullscreenIcon.d.ts +1 -1
  132. package/umd/src/book-components/icons/FullscreenIcon.d.ts +1 -1
  133. package/umd/src/cli/cli-commands/agent/agentCliOptions.d.ts +38 -0
  134. package/umd/src/cli/cli-commands/agent/chat.d.ts +10 -0
  135. package/umd/src/cli/cli-commands/agent/exec.d.ts +10 -0
  136. package/umd/src/cli/cli-commands/agent/run.test.d.ts +1 -0
  137. package/umd/src/cli/cli-commands/agent-folder/agentProjectPaths.d.ts +2 -24
  138. package/umd/src/cli/cli-commands/agent.d.ts +14 -0
  139. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer.d.ts +17 -1
  140. package/umd/src/cli/cli-commands/agents-server/run.d.ts +6 -0
  141. package/umd/src/cli/cli-commands/agents-server/startAgentsServer.d.ts +9 -2
  142. package/umd/src/cli/cli-commands/coder/ThinkingLevel.d.ts +1 -1
  143. package/umd/src/cli/cli-commands/coder/ensureCoderDeveloperAgentFile.d.ts +25 -0
  144. package/umd/src/cli/cli-commands/coder/find-unwritten.d.ts +10 -0
  145. package/umd/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.d.ts +2 -0
  146. package/umd/src/cli/cli-commands/coder/server.d.ts +13 -0
  147. package/umd/src/cli/cli-commands/coder/waitOptions.d.ts +14 -0
  148. package/umd/src/cli/cli-commands/common/promptRunnerCliOptions.d.ts +9 -25
  149. package/umd/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +22 -0
  150. package/umd/src/commitments/_common/teamInternalAgentAccess.d.ts +9 -1
  151. package/umd/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts +1 -1
  152. package/umd/src/llm-providers/_common/register/$provideLlmToolsFromEnv.d.ts +1 -1
  153. package/umd/src/scrapers/website/utils/createShowdownConverter.d.ts +2 -2
  154. package/umd/src/utils/isTimingSafeEqualString.d.ts +25 -0
  155. package/umd/src/utils/validators/url/isValidAgentUrl.d.ts +5 -0
  156. package/umd/src/version.d.ts +1 -1
@@ -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 {};
@@ -1,33 +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
9
  /**
32
10
  * Relative path to generated local agent documentation initialized by `ptbk agent-folder init`.
33
11
  *
@@ -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;
@@ -34,6 +34,14 @@ export type AgentsServerBuildArtifacts = {
34
34
  readonly nodeModulesPath: string;
35
35
  readonly nextCliPath: string;
36
36
  };
37
+ /**
38
+ * Runtime paths resolved for Agents Server commands before choosing build or dev execution.
39
+ *
40
+ * @private internal type of `ptbk agents-server`
41
+ */
42
+ export type PreparedAgentsServerRuntime = AgentsServerBuildArtifacts & {
43
+ readonly isAppPathMaterialized: boolean;
44
+ };
37
45
  /**
38
46
  * Input paths required to validate or update the cached Agents Server build.
39
47
  *
@@ -48,7 +56,15 @@ type AgentsServerBuildCacheOptions = {
48
56
  *
49
57
  * @private internal utility of `ptbk agents-server`
50
58
  */
51
- export declare function ensureAgentsServerBuild(options?: EnsureAgentsServerBuildOptions): Promise<AgentsServerBuildArtifacts>;
59
+ export declare function ensureAgentsServerBuild(options?: EnsureAgentsServerBuildOptions): Promise<PreparedAgentsServerRuntime>;
60
+ /**
61
+ * Resolves the runtime app and dependency paths shared by Agents Server start and dev commands.
62
+ *
63
+ * @private internal utility of `ptbk agents-server`
64
+ */
65
+ export declare function prepareAgentsServerRuntime(options?: {
66
+ readonly appPath?: string;
67
+ }): Promise<PreparedAgentsServerRuntime>;
52
68
  /**
53
69
  * Returns true when the production build marker and source fingerprint still match.
54
70
  *
@@ -6,6 +6,12 @@ import type { $side_effect } from '../../../utils/organization/$side_effect';
6
6
  * @private internal function of `promptbookCli`
7
7
  */
8
8
  export declare function $initializeAgentsServerStartCommand(program: Program): $side_effect;
9
+ /**
10
+ * Initializes `agents-server dev` command for Promptbook CLI utilities.
11
+ *
12
+ * @private internal function of `promptbookCli`
13
+ */
14
+ export declare function $initializeAgentsServerDevCommand(program: Program): $side_effect;
9
15
  /**
10
16
  * Initializes `agents-server build` command for Promptbook CLI utilities.
11
17
  *
@@ -1,6 +1,12 @@
1
1
  import type { ThinkingLevel } from '../coder/ThinkingLevel';
2
- import type { PromptRunnerAgentName } from '../common/promptRunnerCliOptions';
2
+ import type { PromptRunnerHarnessName } from '../common/promptRunnerCliOptions';
3
3
  import type { number_port } from '../../../types/number_positive';
4
+ /**
5
+ * Next runtime mode supported by the local Agents Server foreground launcher.
6
+ *
7
+ * @private internal type of `ptbk agents-server`
8
+ */
9
+ export type AgentsServerNextRuntimeMode = 'start' | 'dev';
4
10
  /**
5
11
  * Options required to start the foreground Agents Server service group.
6
12
  *
@@ -8,11 +14,12 @@ import type { number_port } from '../../../types/number_positive';
8
14
  */
9
15
  export type StartAgentsServerOptions = {
10
16
  readonly port: number_port;
11
- readonly agentName: PromptRunnerAgentName;
17
+ readonly agentName: PromptRunnerHarnessName;
12
18
  readonly model?: string;
13
19
  readonly noUi: boolean;
14
20
  readonly thinkingLevel?: ThinkingLevel;
15
21
  readonly allowCredits: boolean;
22
+ readonly nextRuntimeMode: AgentsServerNextRuntimeMode;
16
23
  readonly isBuildForced: boolean;
17
24
  };
18
25
  /**
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * @private internal shared utility of `ptbk coder run`
5
5
  */
6
- export declare const THINKING_LEVEL_VALUES: readonly ["low", "medium", "high", "xhigh"];
6
+ export declare const THINKING_LEVEL_VALUES: readonly ["low", "medium", "high", "xhigh", "max"];
7
7
  /**
8
8
  * Supported reasoning effort values for coding-agent runners with configurable thinking levels.
9
9
  *
@@ -0,0 +1,25 @@
1
+ import type { InitializationStatus } from './boilerplateTemplates';
2
+ /**
3
+ * Relative directory path for agents initialized by `ptbk coder init`.
4
+ *
5
+ * @private internal utility of `coder init` command
6
+ */
7
+ export declare const CODER_AGENTS_DIRECTORY_PATH = "agents";
8
+ /**
9
+ * Relative file path to the default developer agent initialized by `ptbk coder init`.
10
+ *
11
+ * @private internal utility of `coder init` command
12
+ */
13
+ export declare const CODER_DEVELOPER_AGENT_FILE_PATH = "agents/developer.book";
14
+ /**
15
+ * Source file path of the bundled developer agent inside the Promptbook repository.
16
+ *
17
+ * @private internal utility of `coder init` command
18
+ */
19
+ export declare const DEFAULT_CODER_DEVELOPER_AGENT_SOURCE_FILE_PATH = "agents/default/developer.book";
20
+ /**
21
+ * Ensures the default developer agent exists in the initialized project.
22
+ *
23
+ * @private function of `initializeCoderProjectConfiguration`
24
+ */
25
+ export declare function ensureCoderDeveloperAgentFile(projectPath: string): Promise<InitializationStatus>;
@@ -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 PROMPT_RUNNER_AGENT_NAMES: readonly ["openai-codex", "github-copilot", "cline", "claude-code", "opencode", "gemini"];
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 PromptRunnerAgentName = (typeof PROMPT_RUNNER_AGENT_NAMES)[number];
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 agent?: string;
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, 'agent' | 'model' | 'ui' | 'thinkingLevel' | 'allowCredits'>;
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?: PromptRunnerAgentName;
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 `--agent` option.
70
+ * Commander description for the `--harness` option.
87
71
  *
88
72
  * @private internal utility of `promptbookCli`
89
73
  */
90
- export declare const PROMPT_RUNNER_AGENT_OPTION_DESCRIPTION = "Select runner: openai-codex, github-copilot, cline, claude-code, opencode, gemini (required for non-dry-run)";
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
- * @returns Hashed token, or `null` when the server does not have a private secret.
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 { 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;
@@ -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;
@@ -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-97`).
18
+ * It follows semantic versioning (e.g., `0.112.0-140`).
19
19
  *
20
20
  * @generated
21
21
  */