@promptbook/node 0.113.0-9 → 0.114.0-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 +4 -3
- package/esm/index.es.js +463 -117
- package/esm/index.es.js.map +1 -1
- package/esm/scripts/run-agent-messages/messages/buildAgentMessagePrompt.d.ts +6 -1
- package/esm/scripts/run-agent-messages/messages/buildAgentProjectsPromptSection.d.ts +39 -0
- package/esm/scripts/run-codex-prompts/common/waitUntilWorldTimeDeadline.d.ts +27 -0
- package/esm/scripts/run-codex-prompts/runners/openai-codex/parseCodexLoginMethodFromOutput.d.ts +10 -0
- package/esm/src/_packages/components.index.d.ts +8 -0
- package/esm/src/_packages/core.index.d.ts +4 -0
- package/esm/src/_packages/types.index.d.ts +12 -0
- package/esm/src/book-2.0/agent-source/AgentBasicInformation.d.ts +7 -0
- package/esm/src/book-2.0/agent-source/parseAgentSource/ParsedAgentProfile.d.ts +1 -1
- package/esm/src/book-2.0/book-language-documentation/BookLanguageDocumentationExample.d.ts +5 -13
- package/esm/src/book-2.0/book-language-documentation/BookLanguageManualDictionary.d.ts +195 -0
- package/esm/src/book-2.0/book-language-documentation/bookLanguageDocumentationExamples.d.ts +2 -1
- package/esm/src/book-2.0/book-language-documentation/createStandaloneBookLanguageMarkdown.d.ts +43 -1
- package/esm/src/book-2.0/book-language-documentation/czechBookLanguageManualDictionary.d.ts +10 -0
- package/esm/src/book-2.0/book-language-documentation/englishBookLanguageManualDictionary.d.ts +10 -0
- package/esm/src/book-2.0/book-language-documentation/getBookLanguageManualCommitmentGroups.d.ts +33 -0
- package/esm/src/book-2.0/book-language-documentation/getBookLanguageManualDictionary.d.ts +15 -0
- package/esm/src/book-2.0/book-language-documentation/getSafeCodeBlock.d.ts +10 -0
- package/esm/src/book-2.0/book-language-documentation/renderCommitmentCatalogSection.d.ts +30 -0
- package/esm/src/book-2.0/book-language-documentation/renderGroupedCommitmentDocumentationMarkdown.d.ts +2 -1
- package/esm/src/book-2.0/book-language-documentation/toStableAnchorId.d.ts +12 -0
- package/esm/src/book-3.0/AgentMessageRunReport.d.ts +78 -0
- package/esm/src/book-3.0/agentFolderPaths.d.ts +9 -0
- package/esm/src/book-3.0/codexLoginMethod.d.ts +38 -0
- package/esm/src/book-components/BookEditor/BookEditorSyntaxTokenStyles.d.ts +39 -0
- package/esm/src/book-components/BookEditor/createBookSourceHighlightStyles.d.ts +12 -0
- package/esm/src/book-components/BookEditor/highlightBookSourceToHtml.d.ts +20 -0
- package/esm/src/book-components/Chat/Chat/ChatCitationModal.d.ts +5 -0
- package/esm/src/book-components/Chat/Chat/ChatCitationModal.test.d.ts +2 -0
- package/esm/src/book-components/Chat/Chat/ChatFeedbackStar.d.ts +37 -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/ChatMessageRichContent.d.ts +5 -0
- package/esm/src/book-components/Chat/Chat/ChatProps.d.ts +13 -0
- package/esm/src/book-components/Chat/Chat/ChatRatingModal.test.d.ts +2 -0
- package/esm/src/book-components/Chat/Chat/CitationIframePreview.d.ts +25 -2
- package/esm/src/book-components/Chat/Chat/pagePreview/LiveBrowserPreview.d.ts +39 -0
- package/esm/src/book-components/Chat/Chat/pagePreview/LiveBrowserPreview.test.d.ts +2 -0
- package/esm/src/book-components/Chat/Chat/pagePreview/LiveBrowserPreviewToolbar.d.ts +71 -0
- package/esm/src/book-components/Chat/Chat/pagePreview/PagePreviewInputEvent.d.ts +72 -0
- package/esm/src/book-components/Chat/Chat/pagePreview/PagePreviewInputQueue.d.ts +64 -0
- package/esm/src/book-components/Chat/Chat/pagePreview/PagePreviewInputQueue.test.d.ts +1 -0
- package/esm/src/book-components/Chat/Chat/pagePreview/PagePreviewSessionState.d.ts +14 -0
- package/esm/src/book-components/Chat/Chat/pagePreview/PagePreviewViewport.d.ts +37 -0
- package/esm/src/book-components/Chat/Chat/pagePreview/createPagePreviewSessionId.d.ts +20 -0
- package/esm/src/book-components/Chat/Chat/pagePreview/normalizePagePreviewInputEvent.d.ts +13 -0
- package/esm/src/book-components/Chat/Chat/pagePreview/normalizePagePreviewInputEvent.test.d.ts +1 -0
- package/esm/src/book-components/Chat/Chat/resolveChatRatingMessageKey.d.ts +8 -0
- package/esm/src/book-components/Chat/MarkdownContent/MarkdownContent.d.ts +2 -0
- package/esm/src/book-components/Chat/SourceChip/SourceChip.test.d.ts +2 -0
- package/esm/src/book-components/Chat/hooks/useResolvedCitationLabel.test.d.ts +2 -0
- package/esm/src/book-components/Chat/utils/renderMarkdown.d.ts +78 -0
- package/esm/src/book-components/Chat/utils/resolveCitationSourceDisplay.d.ts +149 -0
- package/esm/src/book-components/Chat/utils/thinkingMessageVariants.d.ts +9 -0
- package/esm/src/cli/cli-commands/agent-folder/agentProjectPaths.d.ts +2 -2
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerChildEnvironment.d.ts +1 -0
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerChildEnvironment.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/PreparedAgentsServerLaunch.d.ts +1 -1
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/forwardChildOutput.d.ts +1 -1
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/startNextServer.d.ts +1 -1
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/startUserChatJobWorkerPump.d.ts +1 -1
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer.d.ts +1 -1
- package/esm/src/cli/cli-commands/coder/add.d.ts +36 -0
- package/esm/src/cli/cli-commands/coder/add.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/coder/boilerplateTemplates.d.ts +24 -0
- package/esm/src/cli/cli-commands/coder.d.ts +1 -0
- package/esm/src/cli/cli-commands/common/createNonNegativeIntegerOptionParser.d.ts +10 -0
- package/esm/src/cli/cli-commands/common/harness/$applyHarnessInstallationStatus.d.ts +9 -0
- package/esm/src/cli/cli-commands/common/harness/$askForHarnessInstallationApproval.d.ts +9 -0
- package/esm/src/cli/cli-commands/common/harness/$checkHarnessInstallation.d.ts +10 -0
- package/esm/src/cli/cli-commands/common/harness/$ensureHarnessInstallations.d.ts +13 -0
- package/esm/src/cli/cli-commands/common/harness/$installHarness.d.ts +13 -0
- package/esm/src/cli/cli-commands/common/harness/$resolveInstalledHarnessVersion.d.ts +10 -0
- package/esm/src/cli/cli-commands/common/harness/$resolveLatestHarnessVersion.d.ts +10 -0
- package/esm/src/cli/cli-commands/common/harness/HarnessDefinition.d.ts +40 -0
- package/esm/src/cli/cli-commands/common/harness/HarnessDefinition.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/common/harness/HarnessInstallationStatus.d.ts +35 -0
- package/esm/src/cli/cli-commands/common/harness/buildHarnessInstallCommand.d.ts +10 -0
- package/esm/src/cli/cli-commands/common/harness/extractHarnessVersionFromOutput.d.ts +11 -0
- package/esm/src/cli/cli-commands/common/harness/extractHarnessVersionFromOutput.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/common/harness/formatHarnessInstallationWarning.d.ts +7 -0
- package/esm/src/cli/cli-commands/common/harness/isHarnessVersionOutdated.d.ts +9 -0
- package/esm/src/cli/cli-commands/common/harness/isHarnessVersionOutdated.test.d.ts +1 -0
- package/esm/src/collection/agent-collection/constructors/agent-collection-in-supabase/buildAgentNameOrPermanentIdFilter.d.ts +18 -0
- package/esm/src/collection/agent-collection/constructors/agent-collection-in-supabase/buildAgentNameOrPermanentIdFilter.test.d.ts +1 -0
- package/esm/src/commitments/META/META.d.ts +2 -0
- package/esm/src/commitments/META_THINKING_MESSAGE/META_THINKING_MESSAGE.d.ts +26 -0
- package/esm/src/commitments/index.d.ts +2 -1
- package/esm/src/execution/utils/formatUsagePrice.d.ts +12 -0
- package/esm/src/execution/utils/formatUsagePrice.test.d.ts +1 -0
- package/esm/src/utils/agent-message-runtime/agentMessageRuntimePaths.d.ts +24 -0
- package/esm/src/utils/agent-message-runtime/resolveAgentMessageRuntimeActivity.d.ts +16 -0
- package/esm/src/utils/agent-message-runtime/resolveAgentMessageRuntimeActivity.test.d.ts +1 -0
- package/esm/src/utils/agents/terminalAgentAvatarVisual.d.ts +104 -0
- package/esm/src/utils/agents/terminalAgentAvatarVisual.test.d.ts +1 -0
- package/esm/src/utils/html/escapeHtml.d.ts +9 -0
- package/esm/src/utils/markdown/shiftMarkdownHeadingLevels.d.ts +15 -0
- package/esm/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +463 -117
- package/umd/index.umd.js.map +1 -1
- package/umd/scripts/run-agent-messages/messages/buildAgentMessagePrompt.d.ts +6 -1
- package/umd/scripts/run-agent-messages/messages/buildAgentProjectsPromptSection.d.ts +39 -0
- package/umd/scripts/run-codex-prompts/common/waitUntilWorldTimeDeadline.d.ts +27 -0
- package/umd/scripts/run-codex-prompts/runners/openai-codex/parseCodexLoginMethodFromOutput.d.ts +10 -0
- package/umd/src/_packages/components.index.d.ts +8 -0
- package/umd/src/_packages/core.index.d.ts +4 -0
- package/umd/src/_packages/types.index.d.ts +12 -0
- package/umd/src/book-2.0/agent-source/AgentBasicInformation.d.ts +7 -0
- package/umd/src/book-2.0/agent-source/parseAgentSource/ParsedAgentProfile.d.ts +1 -1
- package/umd/src/book-2.0/book-language-documentation/BookLanguageDocumentationExample.d.ts +5 -13
- package/umd/src/book-2.0/book-language-documentation/BookLanguageManualDictionary.d.ts +195 -0
- package/umd/src/book-2.0/book-language-documentation/bookLanguageDocumentationExamples.d.ts +2 -1
- package/umd/src/book-2.0/book-language-documentation/createStandaloneBookLanguageMarkdown.d.ts +43 -1
- package/umd/src/book-2.0/book-language-documentation/createStandaloneBookLanguageMarkdown.test.d.ts +1 -0
- package/umd/src/book-2.0/book-language-documentation/czechBookLanguageManualDictionary.d.ts +10 -0
- package/umd/src/book-2.0/book-language-documentation/englishBookLanguageManualDictionary.d.ts +10 -0
- package/umd/src/book-2.0/book-language-documentation/getBookLanguageManualCommitmentGroups.d.ts +33 -0
- package/umd/src/book-2.0/book-language-documentation/getBookLanguageManualDictionary.d.ts +15 -0
- package/umd/src/book-2.0/book-language-documentation/getSafeCodeBlock.d.ts +10 -0
- package/umd/src/book-2.0/book-language-documentation/renderCommitmentCatalogSection.d.ts +30 -0
- package/umd/src/book-2.0/book-language-documentation/renderGroupedCommitmentDocumentationMarkdown.d.ts +2 -1
- package/umd/src/book-2.0/book-language-documentation/toStableAnchorId.d.ts +12 -0
- package/umd/src/book-3.0/AgentMessageRunReport.d.ts +78 -0
- package/umd/src/book-3.0/AgentMessageRunReport.test.d.ts +1 -0
- package/umd/src/book-3.0/agentFolderPaths.d.ts +9 -0
- package/umd/src/book-3.0/codexLoginMethod.d.ts +38 -0
- package/umd/src/book-components/BookEditor/BookEditorSyntaxTokenStyles.d.ts +39 -0
- package/umd/src/book-components/BookEditor/createBookSourceHighlightStyles.d.ts +12 -0
- package/umd/src/book-components/BookEditor/highlightBookSourceToHtml.d.ts +20 -0
- package/umd/src/book-components/Chat/Chat/ChatCitationModal.d.ts +5 -0
- package/umd/src/book-components/Chat/Chat/ChatCitationModal.test.d.ts +2 -0
- package/umd/src/book-components/Chat/Chat/ChatFeedbackStar.d.ts +37 -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/ChatMessageRichContent.d.ts +5 -0
- package/umd/src/book-components/Chat/Chat/ChatProps.d.ts +13 -0
- package/umd/src/book-components/Chat/Chat/ChatRatingModal.test.d.ts +2 -0
- package/umd/src/book-components/Chat/Chat/CitationIframePreview.d.ts +25 -2
- package/umd/src/book-components/Chat/Chat/pagePreview/LiveBrowserPreview.d.ts +39 -0
- package/umd/src/book-components/Chat/Chat/pagePreview/LiveBrowserPreview.test.d.ts +2 -0
- package/umd/src/book-components/Chat/Chat/pagePreview/LiveBrowserPreviewToolbar.d.ts +71 -0
- package/umd/src/book-components/Chat/Chat/pagePreview/PagePreviewInputEvent.d.ts +72 -0
- package/umd/src/book-components/Chat/Chat/pagePreview/PagePreviewInputQueue.d.ts +64 -0
- package/umd/src/book-components/Chat/Chat/pagePreview/PagePreviewInputQueue.test.d.ts +1 -0
- package/umd/src/book-components/Chat/Chat/pagePreview/PagePreviewSessionState.d.ts +14 -0
- package/umd/src/book-components/Chat/Chat/pagePreview/PagePreviewViewport.d.ts +37 -0
- package/umd/src/book-components/Chat/Chat/pagePreview/createPagePreviewSessionId.d.ts +20 -0
- package/umd/src/book-components/Chat/Chat/pagePreview/normalizePagePreviewInputEvent.d.ts +13 -0
- package/umd/src/book-components/Chat/Chat/pagePreview/normalizePagePreviewInputEvent.test.d.ts +1 -0
- package/umd/src/book-components/Chat/Chat/resolveChatRatingMessageKey.d.ts +8 -0
- package/umd/src/book-components/Chat/MarkdownContent/MarkdownContent.d.ts +2 -0
- package/umd/src/book-components/Chat/SourceChip/SourceChip.test.d.ts +2 -0
- package/umd/src/book-components/Chat/hooks/useResolvedCitationLabel.test.d.ts +2 -0
- package/umd/src/book-components/Chat/utils/renderMarkdown.d.ts +78 -0
- package/umd/src/book-components/Chat/utils/resolveCitationSourceDisplay.d.ts +149 -0
- package/umd/src/book-components/Chat/utils/thinkingMessageVariants.d.ts +9 -0
- package/umd/src/cli/cli-commands/agent-folder/agentProjectPaths.d.ts +2 -2
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerChildEnvironment.d.ts +1 -0
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerChildEnvironment.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/PreparedAgentsServerLaunch.d.ts +1 -1
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/forwardChildOutput.d.ts +1 -1
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/startNextServer.d.ts +1 -1
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/startUserChatJobWorkerPump.d.ts +1 -1
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer.d.ts +1 -1
- package/umd/src/cli/cli-commands/coder/add.d.ts +36 -0
- package/umd/src/cli/cli-commands/coder/add.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/coder/boilerplateTemplates.d.ts +24 -0
- package/umd/src/cli/cli-commands/coder.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/createNonNegativeIntegerOptionParser.d.ts +10 -0
- package/umd/src/cli/cli-commands/common/harness/$applyHarnessInstallationStatus.d.ts +9 -0
- package/umd/src/cli/cli-commands/common/harness/$askForHarnessInstallationApproval.d.ts +9 -0
- package/umd/src/cli/cli-commands/common/harness/$checkHarnessInstallation.d.ts +10 -0
- package/umd/src/cli/cli-commands/common/harness/$ensureHarnessInstallations.d.ts +13 -0
- package/umd/src/cli/cli-commands/common/harness/$installHarness.d.ts +13 -0
- package/umd/src/cli/cli-commands/common/harness/$resolveInstalledHarnessVersion.d.ts +10 -0
- package/umd/src/cli/cli-commands/common/harness/$resolveLatestHarnessVersion.d.ts +10 -0
- package/umd/src/cli/cli-commands/common/harness/HarnessDefinition.d.ts +40 -0
- package/umd/src/cli/cli-commands/common/harness/HarnessDefinition.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/harness/HarnessInstallationStatus.d.ts +35 -0
- package/umd/src/cli/cli-commands/common/harness/buildHarnessInstallCommand.d.ts +10 -0
- package/umd/src/cli/cli-commands/common/harness/extractHarnessVersionFromOutput.d.ts +11 -0
- package/umd/src/cli/cli-commands/common/harness/extractHarnessVersionFromOutput.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/harness/formatHarnessInstallationWarning.d.ts +7 -0
- package/umd/src/cli/cli-commands/common/harness/isHarnessVersionOutdated.d.ts +9 -0
- package/umd/src/cli/cli-commands/common/harness/isHarnessVersionOutdated.test.d.ts +1 -0
- package/umd/src/collection/agent-collection/constructors/agent-collection-in-supabase/buildAgentNameOrPermanentIdFilter.d.ts +18 -0
- package/umd/src/collection/agent-collection/constructors/agent-collection-in-supabase/buildAgentNameOrPermanentIdFilter.test.d.ts +1 -0
- package/umd/src/commitments/META/META.d.ts +2 -0
- package/umd/src/commitments/META_THINKING_MESSAGE/META_THINKING_MESSAGE.d.ts +26 -0
- package/umd/src/commitments/index.d.ts +2 -1
- package/umd/src/execution/utils/formatUsagePrice.d.ts +12 -0
- package/umd/src/execution/utils/formatUsagePrice.test.d.ts +1 -0
- package/umd/src/utils/agent-message-runtime/agentMessageRuntimePaths.d.ts +24 -0
- package/umd/src/utils/agent-message-runtime/resolveAgentMessageRuntimeActivity.d.ts +16 -0
- package/umd/src/utils/agent-message-runtime/resolveAgentMessageRuntimeActivity.test.d.ts +1 -0
- package/umd/src/utils/agents/terminalAgentAvatarVisual.d.ts +104 -0
- package/umd/src/utils/agents/terminalAgentAvatarVisual.test.d.ts +1 -0
- package/umd/src/utils/html/escapeHtml.d.ts +9 -0
- package/umd/src/utils/markdown/shiftMarkdownHeadingLevels.d.ts +15 -0
- package/umd/src/version.d.ts +1 -1
- package/esm/scripts/run-codex-prompts/common/runGoScript/buildTemporaryPromptScriptPath.d.ts +0 -14
- package/esm/src/book-2.0/book-language-documentation/bookLanguageCommonPitfalls.d.ts +0 -25
- package/esm/src/book-components/_common/react-utils/escapeHtml.d.ts +0 -6
- package/umd/scripts/run-codex-prompts/common/runGoScript/buildTemporaryPromptScriptPath.d.ts +0 -14
- package/umd/src/book-2.0/book-language-documentation/bookLanguageCommonPitfalls.d.ts +0 -25
- package/umd/src/book-components/_common/react-utils/escapeHtml.d.ts +0 -6
- /package/esm/src/{executables/browsers/locateInternetExplorer.test.d.ts → book-2.0/book-language-documentation/createStandaloneBookLanguageMarkdown.test.d.ts} +0 -0
- /package/{umd/src/executables/browsers/locateInternetExplorer.test.d.ts → esm/src/book-3.0/AgentMessageRunReport.test.d.ts} +0 -0
package/umd/index.umd.js
CHANGED
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
* @generated
|
|
52
52
|
* @see https://github.com/webgptorg/promptbook
|
|
53
53
|
*/
|
|
54
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.
|
|
54
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.114.0-0';
|
|
55
55
|
/**
|
|
56
56
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
57
57
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -88,6 +88,15 @@
|
|
|
88
88
|
* @public exported from `@promptbook/node`
|
|
89
89
|
*/
|
|
90
90
|
const AGENT_FAILED_MESSAGES_DIRECTORY_PATH = path.join(AGENT_MESSAGES_DIRECTORY_PATH, 'failed');
|
|
91
|
+
/**
|
|
92
|
+
* Relative path to the agent-owned projects root used by the agent folder convention.
|
|
93
|
+
*
|
|
94
|
+
* Each direct child directory is one project — an isolated folder the agent fully controls
|
|
95
|
+
* (files, scripts, optionally its own git repository).
|
|
96
|
+
*
|
|
97
|
+
* @private internal constant of the agent folder convention, used by agent runners and the Agents Server
|
|
98
|
+
*/
|
|
99
|
+
const AGENT_PROJECTS_DIRECTORY_PATH = 'projects';
|
|
91
100
|
|
|
92
101
|
/**
|
|
93
102
|
* Parser for the agent source for Promptbook agents in book language
|
|
@@ -484,48 +493,6 @@
|
|
|
484
493
|
}
|
|
485
494
|
}
|
|
486
495
|
|
|
487
|
-
/**
|
|
488
|
-
* Orders JSON object by keys
|
|
489
|
-
*
|
|
490
|
-
* @returns The same type of object as the input re-ordered
|
|
491
|
-
*
|
|
492
|
-
* @public exported from `@promptbook/utils`
|
|
493
|
-
*/
|
|
494
|
-
function orderJson(options) {
|
|
495
|
-
const { value, order } = options;
|
|
496
|
-
const orderedValue = {
|
|
497
|
-
...(order === undefined ? {} : Object.fromEntries(order.map((key) => [key, undefined]))),
|
|
498
|
-
...value,
|
|
499
|
-
};
|
|
500
|
-
return orderedValue;
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
/**
|
|
504
|
-
* Freezes the given object and all its nested objects recursively
|
|
505
|
-
*
|
|
506
|
-
* Note: `$` is used to indicate that this function is not a pure function - it mutates given object
|
|
507
|
-
* Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
|
|
508
|
-
*
|
|
509
|
-
* @returns The same object as the input, but deeply frozen
|
|
510
|
-
*
|
|
511
|
-
* @public exported from `@promptbook/utils`
|
|
512
|
-
*/
|
|
513
|
-
function $deepFreeze(objectValue) {
|
|
514
|
-
if (Array.isArray(objectValue)) {
|
|
515
|
-
return Object.freeze(objectValue.map((item) => $deepFreeze(item)));
|
|
516
|
-
}
|
|
517
|
-
const propertyNames = Object.getOwnPropertyNames(objectValue);
|
|
518
|
-
for (const propertyName of propertyNames) {
|
|
519
|
-
const value = objectValue[propertyName];
|
|
520
|
-
if (value && typeof value === 'object') {
|
|
521
|
-
$deepFreeze(value);
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
Object.freeze(objectValue);
|
|
525
|
-
return objectValue;
|
|
526
|
-
}
|
|
527
|
-
// TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
528
|
-
|
|
529
496
|
/**
|
|
530
497
|
* Class implementing take chain.
|
|
531
498
|
*
|
|
@@ -1830,6 +1797,110 @@
|
|
|
1830
1797
|
}
|
|
1831
1798
|
}
|
|
1832
1799
|
|
|
1800
|
+
/**
|
|
1801
|
+
* Single source of truth about how each supported CLI coding harness is installed and detected.
|
|
1802
|
+
*
|
|
1803
|
+
* @private internal utility of `promptbookCli`
|
|
1804
|
+
*/
|
|
1805
|
+
const HARNESS_DEFINITIONS = {
|
|
1806
|
+
'openai-codex': {
|
|
1807
|
+
harnessName: 'openai-codex',
|
|
1808
|
+
label: 'OpenAI Codex',
|
|
1809
|
+
commandName: 'codex',
|
|
1810
|
+
npmPackageName: '@openai/codex',
|
|
1811
|
+
},
|
|
1812
|
+
'github-copilot': {
|
|
1813
|
+
harnessName: 'github-copilot',
|
|
1814
|
+
label: 'GitHub Copilot',
|
|
1815
|
+
commandName: 'copilot',
|
|
1816
|
+
npmPackageName: '@github/copilot',
|
|
1817
|
+
// Note: The GitHub Copilot CLI downloads its native binary in a postinstall script
|
|
1818
|
+
npmInstallEnvironment: { npm_config_ignore_scripts: 'false' },
|
|
1819
|
+
},
|
|
1820
|
+
cline: {
|
|
1821
|
+
harnessName: 'cline',
|
|
1822
|
+
label: 'Cline',
|
|
1823
|
+
commandName: 'cline',
|
|
1824
|
+
npmPackageName: 'cline',
|
|
1825
|
+
},
|
|
1826
|
+
'claude-code': {
|
|
1827
|
+
harnessName: 'claude-code',
|
|
1828
|
+
label: 'Claude Code',
|
|
1829
|
+
commandName: 'claude',
|
|
1830
|
+
npmPackageName: '@anthropic-ai/claude-code',
|
|
1831
|
+
},
|
|
1832
|
+
opencode: {
|
|
1833
|
+
harnessName: 'opencode',
|
|
1834
|
+
label: 'Opencode',
|
|
1835
|
+
commandName: 'opencode',
|
|
1836
|
+
npmPackageName: 'opencode-ai',
|
|
1837
|
+
},
|
|
1838
|
+
gemini: {
|
|
1839
|
+
harnessName: 'gemini',
|
|
1840
|
+
label: 'Gemini CLI',
|
|
1841
|
+
commandName: 'gemini',
|
|
1842
|
+
npmPackageName: '@google/gemini-cli',
|
|
1843
|
+
},
|
|
1844
|
+
};
|
|
1845
|
+
/**
|
|
1846
|
+
* Looks up the definition of one supported CLI coding harness.
|
|
1847
|
+
*
|
|
1848
|
+
* @private internal utility of `promptbookCli`
|
|
1849
|
+
*/
|
|
1850
|
+
function getHarnessDefinition(harnessName) {
|
|
1851
|
+
const definition = HARNESS_DEFINITIONS[harnessName];
|
|
1852
|
+
if (definition === undefined) {
|
|
1853
|
+
throw new UnexpectedError(_spaceTrim.spaceTrim(`
|
|
1854
|
+
Missing harness definition for \`${harnessName}\`.
|
|
1855
|
+
|
|
1856
|
+
Every harness must be described in \`HARNESS_DEFINITIONS\`.
|
|
1857
|
+
`));
|
|
1858
|
+
}
|
|
1859
|
+
return definition;
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1862
|
+
/**
|
|
1863
|
+
* Orders JSON object by keys
|
|
1864
|
+
*
|
|
1865
|
+
* @returns The same type of object as the input re-ordered
|
|
1866
|
+
*
|
|
1867
|
+
* @public exported from `@promptbook/utils`
|
|
1868
|
+
*/
|
|
1869
|
+
function orderJson(options) {
|
|
1870
|
+
const { value, order } = options;
|
|
1871
|
+
const orderedValue = {
|
|
1872
|
+
...(order === undefined ? {} : Object.fromEntries(order.map((key) => [key, undefined]))),
|
|
1873
|
+
...value,
|
|
1874
|
+
};
|
|
1875
|
+
return orderedValue;
|
|
1876
|
+
}
|
|
1877
|
+
|
|
1878
|
+
/**
|
|
1879
|
+
* Freezes the given object and all its nested objects recursively
|
|
1880
|
+
*
|
|
1881
|
+
* Note: `$` is used to indicate that this function is not a pure function - it mutates given object
|
|
1882
|
+
* Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
|
|
1883
|
+
*
|
|
1884
|
+
* @returns The same object as the input, but deeply frozen
|
|
1885
|
+
*
|
|
1886
|
+
* @public exported from `@promptbook/utils`
|
|
1887
|
+
*/
|
|
1888
|
+
function $deepFreeze(objectValue) {
|
|
1889
|
+
if (Array.isArray(objectValue)) {
|
|
1890
|
+
return Object.freeze(objectValue.map((item) => $deepFreeze(item)));
|
|
1891
|
+
}
|
|
1892
|
+
const propertyNames = Object.getOwnPropertyNames(objectValue);
|
|
1893
|
+
for (const propertyName of propertyNames) {
|
|
1894
|
+
const value = objectValue[propertyName];
|
|
1895
|
+
if (value && typeof value === 'object') {
|
|
1896
|
+
$deepFreeze(value);
|
|
1897
|
+
}
|
|
1898
|
+
}
|
|
1899
|
+
Object.freeze(objectValue);
|
|
1900
|
+
return objectValue;
|
|
1901
|
+
}
|
|
1902
|
+
// TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
1903
|
+
|
|
1833
1904
|
/**
|
|
1834
1905
|
* This error type indicates that somewhere in the code non-Error object was thrown and it was wrapped into the `WrappedError`
|
|
1835
1906
|
*
|
|
@@ -3076,6 +3147,55 @@
|
|
|
3076
3147
|
});
|
|
3077
3148
|
}
|
|
3078
3149
|
|
|
3150
|
+
/**
|
|
3151
|
+
* Minimum timer duration used to avoid a zero-millisecond polling loop.
|
|
3152
|
+
*/
|
|
3153
|
+
const MINIMUM_WORLD_TIME_WAIT_POLL_INTERVAL_MS = 1;
|
|
3154
|
+
/**
|
|
3155
|
+
* Waits until one wall-clock deadline has passed.
|
|
3156
|
+
*
|
|
3157
|
+
* The remaining time is recalculated from `Date.now()` after every poll and after every tick callback.
|
|
3158
|
+
* This makes waits elapse while the process is paused at a checkpoint or the computer is asleep.
|
|
3159
|
+
*
|
|
3160
|
+
* @private internal utility of `ptbk coder` wait handling
|
|
3161
|
+
*/
|
|
3162
|
+
async function waitUntilWorldTimeDeadline(options) {
|
|
3163
|
+
var _a;
|
|
3164
|
+
const { deadlineTimeMs, pollIntervalMs, onTick, shouldStopWaiting } = options;
|
|
3165
|
+
const normalizedPollIntervalMs = Math.max(MINIMUM_WORLD_TIME_WAIT_POLL_INTERVAL_MS, pollIntervalMs);
|
|
3166
|
+
const waitForMilliseconds = (_a = options.waitForMilliseconds) !== null && _a !== void 0 ? _a : waitForRegularMilliseconds;
|
|
3167
|
+
while (true) {
|
|
3168
|
+
if (shouldStopWaiting === null || shouldStopWaiting === void 0 ? void 0 : shouldStopWaiting()) {
|
|
3169
|
+
return;
|
|
3170
|
+
}
|
|
3171
|
+
const remainingDurationMs = getRemainingDurationMs(deadlineTimeMs);
|
|
3172
|
+
if (remainingDurationMs <= 0) {
|
|
3173
|
+
return;
|
|
3174
|
+
}
|
|
3175
|
+
await (onTick === null || onTick === void 0 ? void 0 : onTick(remainingDurationMs));
|
|
3176
|
+
if (shouldStopWaiting === null || shouldStopWaiting === void 0 ? void 0 : shouldStopWaiting()) {
|
|
3177
|
+
return;
|
|
3178
|
+
}
|
|
3179
|
+
const remainingDurationAfterTickMs = getRemainingDurationMs(deadlineTimeMs);
|
|
3180
|
+
if (remainingDurationAfterTickMs <= 0) {
|
|
3181
|
+
return;
|
|
3182
|
+
}
|
|
3183
|
+
await waitForMilliseconds(Math.min(normalizedPollIntervalMs, remainingDurationAfterTickMs));
|
|
3184
|
+
}
|
|
3185
|
+
}
|
|
3186
|
+
/**
|
|
3187
|
+
* Returns the remaining wall-clock duration until a timestamp.
|
|
3188
|
+
*/
|
|
3189
|
+
function getRemainingDurationMs(deadlineTimeMs) {
|
|
3190
|
+
return Math.max(0, deadlineTimeMs - Date.now());
|
|
3191
|
+
}
|
|
3192
|
+
/**
|
|
3193
|
+
* Waits for one short polling interval.
|
|
3194
|
+
*/
|
|
3195
|
+
async function waitForRegularMilliseconds(durationMs) {
|
|
3196
|
+
await new Promise((resolve) => setTimeout(resolve, durationMs));
|
|
3197
|
+
}
|
|
3198
|
+
|
|
3079
3199
|
/**
|
|
3080
3200
|
* Base delimiter used for passing large prompts through stdin.
|
|
3081
3201
|
*/
|
|
@@ -3485,36 +3605,32 @@
|
|
|
3485
3605
|
* Waits until the Claude Code session can be resumed, keeping terminal status clear.
|
|
3486
3606
|
*/
|
|
3487
3607
|
async function waitForClaudeCodeSessionLimitReset(sessionLimit, resurrectionCount, options) {
|
|
3488
|
-
var _a, _b
|
|
3608
|
+
var _a, _b;
|
|
3489
3609
|
const delayMs = getClaudeCodeSessionLimitDelayMs(sessionLimit);
|
|
3610
|
+
const resetDeadlineTimeMs = Date.now() + delayMs;
|
|
3490
3611
|
const sessionLabel = formatClaudeCodeSessionIdForDisplay(sessionLimit.sessionId);
|
|
3491
3612
|
const resetSummary = formatClaudeCodeSessionLimitForDisplay(sessionLimit);
|
|
3492
3613
|
if ((_a = options.shouldPrintLiveOutput) !== null && _a !== void 0 ? _a : true) {
|
|
3493
3614
|
console.warn(colors__default["default"].yellow(`[claude-code] Session limit detected for ${sessionLimit.sessionId}. Resurrection #${resurrectionCount} will resume with --resume after ${formatDurationMs(delayMs)}. ${resetSummary}`));
|
|
3494
3615
|
}
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3616
|
+
await waitUntilWorldTimeDeadline({
|
|
3617
|
+
deadlineTimeMs: resetDeadlineTimeMs,
|
|
3618
|
+
pollIntervalMs: CLAUDE_CODE_SESSION_RESURRECTION_POLL_MS,
|
|
3619
|
+
onTick: async (remainingDelayMs) => {
|
|
3620
|
+
var _a;
|
|
3621
|
+
await ((_a = options.waitForPauseCheckpoint) === null || _a === void 0 ? void 0 : _a.call(options, {
|
|
3622
|
+
checkpointLabel: 'the Claude Code session limit reset',
|
|
3623
|
+
phase: 'waiting',
|
|
3624
|
+
statusMessage: `Claude Code session ${sessionLabel} hit its limit; resurrection #${resurrectionCount} resumes in ${formatDurationMs(Math.min(remainingDelayMs, delayMs))}`,
|
|
3625
|
+
}));
|
|
3626
|
+
},
|
|
3627
|
+
});
|
|
3628
|
+
await ((_b = options.waitForPauseCheckpoint) === null || _b === void 0 ? void 0 : _b.call(options, {
|
|
3507
3629
|
checkpointLabel: 'resurrecting the Claude Code session with --resume',
|
|
3508
3630
|
phase: 'running',
|
|
3509
3631
|
statusMessage: `Resurrecting Claude Code session ${sessionLabel} with --resume`,
|
|
3510
3632
|
}));
|
|
3511
3633
|
}
|
|
3512
|
-
/**
|
|
3513
|
-
* Waits for a fixed amount of milliseconds.
|
|
3514
|
-
*/
|
|
3515
|
-
async function waitFor$1(delayMs) {
|
|
3516
|
-
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
3517
|
-
}
|
|
3518
3634
|
/**
|
|
3519
3635
|
* Formats a Claude Code session id for compact terminal status lines.
|
|
3520
3636
|
*/
|
|
@@ -4122,6 +4238,27 @@
|
|
|
4122
4238
|
}
|
|
4123
4239
|
}
|
|
4124
4240
|
|
|
4241
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
4242
|
+
/**
|
|
4243
|
+
* Stable stdout marker printed by the generated Codex runner script to report which login method it used.
|
|
4244
|
+
*
|
|
4245
|
+
* The marker is followed by the resolved method keyword, for example `ptbk-codex-login-method: chatgpt`,
|
|
4246
|
+
* so `parseCodexLoginMethodFromOutput` can recover it from the captured runner output.
|
|
4247
|
+
*
|
|
4248
|
+
* @private internal constant of the OpenAI Codex runner
|
|
4249
|
+
*/
|
|
4250
|
+
const CODEX_LOGIN_METHOD_MARKER = 'ptbk-codex-login-method:';
|
|
4251
|
+
/**
|
|
4252
|
+
* Substring that the `codex login status` command prints when the Codex CLI is signed in with a
|
|
4253
|
+
* ChatGPT subscription account instead of an `OPENAI_API_KEY`.
|
|
4254
|
+
*
|
|
4255
|
+
* This is the single source of truth for detecting an active ChatGPT login, reused by the Codex runner
|
|
4256
|
+
* script and by the Agents Server harness authentication status resolver.
|
|
4257
|
+
*
|
|
4258
|
+
* @private internal constant of the OpenAI Codex runner and the Agents Server Harness Auth
|
|
4259
|
+
*/
|
|
4260
|
+
const CODEX_CHATGPT_LOGIN_STATUS_NEEDLE = 'Logged in using ChatGPT';
|
|
4261
|
+
|
|
4125
4262
|
/**
|
|
4126
4263
|
* Default Codex reasoning effort preserved for backwards compatibility when no CLI override is provided.
|
|
4127
4264
|
*/
|
|
@@ -4138,10 +4275,28 @@
|
|
|
4138
4275
|
const delimiter = resolveShellHereDocumentDelimiter(CODEX_PROMPT_DELIMITER, options.prompt);
|
|
4139
4276
|
const projectPath = toPosixPath(options.projectPath);
|
|
4140
4277
|
const loginMethodConfig = spaceTrim(`
|
|
4278
|
+
CODEX_LOGIN_STATUS="$(
|
|
4279
|
+
unset OPENAI_API_KEY OPENAI_BASE_URL CODEX_API_KEY
|
|
4280
|
+
# 'codex login status' prints the "Logged in using ChatGPT" line to stderr, so merge stderr into stdout (2>&1) to capture it
|
|
4281
|
+
${options.codexCommand} login status 2>&1 || true
|
|
4282
|
+
)"
|
|
4283
|
+
case "$CODEX_LOGIN_STATUS" in
|
|
4284
|
+
*"${CODEX_CHATGPT_LOGIN_STATUS_NEEDLE}"*)
|
|
4285
|
+
IS_CODEX_CHATGPT_LOGIN_ACTIVE=1
|
|
4286
|
+
;;
|
|
4287
|
+
*)
|
|
4288
|
+
IS_CODEX_CHATGPT_LOGIN_ACTIVE=0
|
|
4289
|
+
;;
|
|
4290
|
+
esac
|
|
4291
|
+
|
|
4292
|
+
CODEX_LOGIN_METHOD=chatgpt
|
|
4141
4293
|
${options.allowCredits ? 'CODEX_LOGIN_METHOD_ARGUMENTS=()' : 'CODEX_LOGIN_METHOD_ARGUMENTS=(-c forced_login_method=chatgpt)'}
|
|
4142
4294
|
unset CODEX_API_KEY
|
|
4143
|
-
if [ "
|
|
4295
|
+
if [ "$IS_CODEX_CHATGPT_LOGIN_ACTIVE" != "1" ] &&
|
|
4296
|
+
[ "\${PTBK_OPENAI_CODEX_USE_API_KEY:-0}" = "1" ] &&
|
|
4297
|
+
[ -n "\${OPENAI_API_KEY:-}" ]; then
|
|
4144
4298
|
CODEX_LOGIN_METHOD_ARGUMENTS=(-c forced_login_method=api)
|
|
4299
|
+
CODEX_LOGIN_METHOD=api
|
|
4145
4300
|
CODEX_API_KEY="\${OPENAI_API_KEY}"
|
|
4146
4301
|
export CODEX_API_KEY
|
|
4147
4302
|
fi
|
|
@@ -4160,11 +4315,15 @@
|
|
|
4160
4315
|
'',
|
|
4161
4316
|
loginMethodConfig,
|
|
4162
4317
|
'',
|
|
4163
|
-
'if [ "$
|
|
4318
|
+
'if [ "$IS_CODEX_CHATGPT_LOGIN_ACTIVE" = "1" ] ||',
|
|
4319
|
+
' [ "${PTBK_OPENAI_CODEX_USE_API_KEY:-0}" != "1" ] ||',
|
|
4320
|
+
' [ -z "${OPENAI_API_KEY:-}" ]; then',
|
|
4164
4321
|
'unset OPENAI_API_KEY',
|
|
4165
4322
|
'unset OPENAI_BASE_URL',
|
|
4166
4323
|
'fi',
|
|
4167
4324
|
'',
|
|
4325
|
+
`printf '%s %s\\n' '${CODEX_LOGIN_METHOD_MARKER}' "\${CODEX_LOGIN_METHOD}"`,
|
|
4326
|
+
'',
|
|
4168
4327
|
`${options.codexCommand} \\`,
|
|
4169
4328
|
' "${CODEX_LOGIN_METHOD_ARGUMENTS[@]}" \\',
|
|
4170
4329
|
` -c model_reasoning_effort="${thinkingLevel}" \\`,
|
|
@@ -4366,6 +4525,37 @@
|
|
|
4366
4525
|
return (_c = OPENAI_MODELS.find((model) => model.modelName === CODEX_FALLBACK_PRICING_MODEL)) === null || _c === void 0 ? void 0 : _c.pricing;
|
|
4367
4526
|
}
|
|
4368
4527
|
|
|
4528
|
+
/**
|
|
4529
|
+
* Detects which login method Codex used from the captured CLI output.
|
|
4530
|
+
*
|
|
4531
|
+
* The generated Codex runner script prints one `CODEX_LOGIN_METHOD_MARKER` line before invoking Codex.
|
|
4532
|
+
* The most recent marker wins so retries within one captured output resolve to the final decision.
|
|
4533
|
+
*
|
|
4534
|
+
* @returns The resolved login method, or `unknown` when no marker is present.
|
|
4535
|
+
*/
|
|
4536
|
+
function parseCodexLoginMethodFromOutput(output) {
|
|
4537
|
+
const lines = output.split(/\r?\n/);
|
|
4538
|
+
for (let index = lines.length - 1; index >= 0; index--) {
|
|
4539
|
+
const line = lines[index];
|
|
4540
|
+
if (line === undefined) {
|
|
4541
|
+
continue;
|
|
4542
|
+
}
|
|
4543
|
+
const markerIndex = line.indexOf(CODEX_LOGIN_METHOD_MARKER);
|
|
4544
|
+
if (markerIndex === -1) {
|
|
4545
|
+
continue;
|
|
4546
|
+
}
|
|
4547
|
+
const reportedMethod = line.slice(markerIndex + CODEX_LOGIN_METHOD_MARKER.length).trim().toLowerCase();
|
|
4548
|
+
if (reportedMethod === 'chatgpt') {
|
|
4549
|
+
return 'chatgpt';
|
|
4550
|
+
}
|
|
4551
|
+
if (reportedMethod === 'api') {
|
|
4552
|
+
return 'api';
|
|
4553
|
+
}
|
|
4554
|
+
return 'unknown';
|
|
4555
|
+
}
|
|
4556
|
+
return 'unknown';
|
|
4557
|
+
}
|
|
4558
|
+
|
|
4369
4559
|
/**
|
|
4370
4560
|
* Error signatures that mean Codex requires credit spending to continue.
|
|
4371
4561
|
*/
|
|
@@ -4475,12 +4665,6 @@
|
|
|
4475
4665
|
* Randomized delay proportion added/subtracted for retry jitter.
|
|
4476
4666
|
*/
|
|
4477
4667
|
const RATE_LIMIT_BACKOFF_JITTER_RATIO = 0.15;
|
|
4478
|
-
/**
|
|
4479
|
-
* Waits for one given amount of milliseconds.
|
|
4480
|
-
*/
|
|
4481
|
-
async function waitFor(delayMs) {
|
|
4482
|
-
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
4483
|
-
}
|
|
4484
4668
|
/**
|
|
4485
4669
|
* Formats a delay value into a concise `xh ym zs` style label.
|
|
4486
4670
|
*/
|
|
@@ -4558,7 +4742,10 @@
|
|
|
4558
4742
|
preserveArtifactsOnSuccess: options.preserveArtifactsOnSuccess,
|
|
4559
4743
|
});
|
|
4560
4744
|
this.rateLimitBackoff.reset();
|
|
4561
|
-
return {
|
|
4745
|
+
return {
|
|
4746
|
+
usage: buildCodexUsageFromOutput(output, this.options.model),
|
|
4747
|
+
loginMethod: parseCodexLoginMethodFromOutput(output),
|
|
4748
|
+
};
|
|
4562
4749
|
}
|
|
4563
4750
|
catch (error) {
|
|
4564
4751
|
const details = extractCodexFailureDetails(error);
|
|
@@ -4570,13 +4757,18 @@
|
|
|
4570
4757
|
throw error;
|
|
4571
4758
|
}
|
|
4572
4759
|
const delayMs = this.rateLimitBackoff.nextDelayMs();
|
|
4573
|
-
const
|
|
4760
|
+
const retryDeadlineTimeMs = Date.now() + delayMs;
|
|
4761
|
+
const retryAt = new Date(retryDeadlineTimeMs).toISOString();
|
|
4574
4762
|
const retryIndex = this.rateLimitBackoff.retryCount;
|
|
4575
4763
|
const summary = extractFailureSummary(details);
|
|
4576
4764
|
if ((_b = options.shouldPrintLiveOutput) !== null && _b !== void 0 ? _b : true) {
|
|
4577
4765
|
console.warn(colors__default["default"].yellow(`[codex] Rate limit/quota detected (${summary}). Retry #${retryIndex} in ${formatDelay(delayMs)} at ${retryAt}.`));
|
|
4578
4766
|
}
|
|
4579
|
-
await waitForRetryDelay(
|
|
4767
|
+
await waitForRetryDelay({
|
|
4768
|
+
delayMs,
|
|
4769
|
+
retryDeadlineTimeMs,
|
|
4770
|
+
promptRunOptions: options,
|
|
4771
|
+
});
|
|
4580
4772
|
}
|
|
4581
4773
|
}
|
|
4582
4774
|
}
|
|
@@ -4584,20 +4776,21 @@
|
|
|
4584
4776
|
/**
|
|
4585
4777
|
* Waits for the next Codex retry while polling for requested pause checkpoints.
|
|
4586
4778
|
*/
|
|
4587
|
-
async function waitForRetryDelay(
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
|
|
4779
|
+
async function waitForRetryDelay(options) {
|
|
4780
|
+
const { delayMs, retryDeadlineTimeMs, promptRunOptions } = options;
|
|
4781
|
+
await waitUntilWorldTimeDeadline({
|
|
4782
|
+
deadlineTimeMs: retryDeadlineTimeMs,
|
|
4783
|
+
pollIntervalMs: RATE_LIMIT_BACKOFF_POLL_MS,
|
|
4784
|
+
onTick: async (remainingDelayMs) => {
|
|
4785
|
+
var _a;
|
|
4786
|
+
const remainingDelayLabel = formatDelay(Math.min(remainingDelayMs, delayMs));
|
|
4787
|
+
await ((_a = promptRunOptions.waitForPauseCheckpoint) === null || _a === void 0 ? void 0 : _a.call(promptRunOptions, {
|
|
4788
|
+
checkpointLabel: 'the next OpenAI Codex retry after rate limit',
|
|
4789
|
+
phase: 'running',
|
|
4790
|
+
statusMessage: `Waiting ${remainingDelayLabel} before retrying OpenAI Codex`,
|
|
4791
|
+
}));
|
|
4792
|
+
},
|
|
4793
|
+
});
|
|
4601
4794
|
}
|
|
4602
4795
|
|
|
4603
4796
|
/**
|
|
@@ -4735,17 +4928,6 @@
|
|
|
4735
4928
|
* Constant for cline model.
|
|
4736
4929
|
*/
|
|
4737
4930
|
const CLINE_MODEL = 'gemini:gemini-3-flash-preview';
|
|
4738
|
-
/**
|
|
4739
|
-
* Map of runner labels.
|
|
4740
|
-
*/
|
|
4741
|
-
const RUNNER_LABELS = {
|
|
4742
|
-
'openai-codex': 'OpenAI Codex',
|
|
4743
|
-
'github-copilot': 'GitHub Copilot',
|
|
4744
|
-
cline: 'Cline',
|
|
4745
|
-
'claude-code': 'Claude Code',
|
|
4746
|
-
opencode: 'Opencode',
|
|
4747
|
-
gemini: 'Gemini CLI',
|
|
4748
|
-
};
|
|
4749
4931
|
/**
|
|
4750
4932
|
* Resolves the configured prompt runner together with status-line metadata.
|
|
4751
4933
|
*
|
|
@@ -4837,8 +5019,7 @@
|
|
|
4837
5019
|
* Resolves runner metadata for prompt status lines.
|
|
4838
5020
|
*/
|
|
4839
5021
|
function getRunnerMetadata(options, actualRunnerModel) {
|
|
4840
|
-
|
|
4841
|
-
const runnerName = options.agentName ? (_a = RUNNER_LABELS[options.agentName]) !== null && _a !== void 0 ? _a : 'unknown' : 'unknown';
|
|
5022
|
+
const runnerName = options.agentName ? getHarnessDefinition(options.agentName).label : 'unknown';
|
|
4842
5023
|
if (options.agentName === 'openai-codex' ||
|
|
4843
5024
|
options.agentName === 'github-copilot' ||
|
|
4844
5025
|
options.agentName === 'gemini') {
|
|
@@ -4884,16 +5065,87 @@
|
|
|
4884
5065
|
process.exit(1);
|
|
4885
5066
|
}
|
|
4886
5067
|
|
|
5068
|
+
/**
|
|
5069
|
+
* Builds the `## Projects` prompt section explaining the agent-owned projects convention.
|
|
5070
|
+
*
|
|
5071
|
+
* The section is part of the prompt of every harness, so each coding agent knows it has its
|
|
5072
|
+
* own isolated project folders it fully controls and how to reference them in the chat.
|
|
5073
|
+
*/
|
|
5074
|
+
function buildAgentProjectsPromptSection(options = {}) {
|
|
5075
|
+
const { projectsUrlPath } = options;
|
|
5076
|
+
return _spaceTrim.spaceTrim((block) => `
|
|
5077
|
+
## Projects
|
|
5078
|
+
|
|
5079
|
+
You have your own projects folder \`${AGENT_PROJECTS_DIRECTORY_PATH}/\` in the current working directory. Each direct subfolder of it is one project — your own isolated environment for persistent work.
|
|
5080
|
+
|
|
5081
|
+
- You have 100% control over every project folder: create, read, modify, and delete files there, run scripts and commands inside it, and keep any persistent data you need between conversations.
|
|
5082
|
+
- When the user asks you to build something (for example a website) or to do longer-term work, create a new project folder \`${AGENT_PROJECTS_DIRECTORY_PATH}/<project-name>/\` (use a short kebab-case name) and do the work inside it. Modify an existing project when the user refers to work you already did.
|
|
5083
|
+
- A project can be a git repository — you can run \`git init\` inside a project folder and commit your work there.
|
|
5084
|
+
- Do not touch anything outside the \`${AGENT_PROJECTS_DIRECTORY_PATH}/\` directory except the queued message file you are answering.
|
|
5085
|
+
|
|
5086
|
+
${block(buildProjectReferenceInstructions(projectsUrlPath))}
|
|
5087
|
+
${block(buildProjectRuntimeInstructions(options.projectRuntimeApi))}
|
|
5088
|
+
`);
|
|
5089
|
+
}
|
|
5090
|
+
/**
|
|
5091
|
+
* Builds the part of the section explaining how to reference projects in chat answers.
|
|
5092
|
+
*/
|
|
5093
|
+
function buildProjectReferenceInstructions(projectsUrlPath) {
|
|
5094
|
+
if (!projectsUrlPath) {
|
|
5095
|
+
return _spaceTrim.spaceTrim(`
|
|
5096
|
+
When you mention a project or its files in your answer, reference them by the project name and the file path inside the project, for example \`${AGENT_PROJECTS_DIRECTORY_PATH}/my-website/index.html\`.
|
|
5097
|
+
`);
|
|
5098
|
+
}
|
|
5099
|
+
return _spaceTrim.spaceTrim(`
|
|
5100
|
+
You can link any project or any file of any project into the chat answer as a markdown link:
|
|
5101
|
+
|
|
5102
|
+
- Link one file: \`[index.html](${projectsUrlPath}/<project-name>/files/<file-path>)\` — for example \`[Homepage](${projectsUrlPath}/my-website/files/index.html)\`
|
|
5103
|
+
- Link the projects dashboard listing all your projects: \`[My projects](${projectsUrlPath})\`
|
|
5104
|
+
|
|
5105
|
+
Use these links whenever you want to show the user a file you created or changed in a project.
|
|
5106
|
+
`);
|
|
5107
|
+
}
|
|
5108
|
+
/**
|
|
5109
|
+
* Builds instructions for running projects through the Agents Server runtime API.
|
|
5110
|
+
*/
|
|
5111
|
+
function buildProjectRuntimeInstructions(projectRuntimeApi) {
|
|
5112
|
+
if (!projectRuntimeApi) {
|
|
5113
|
+
return '';
|
|
5114
|
+
}
|
|
5115
|
+
return _spaceTrim.spaceTrim(`
|
|
5116
|
+
You can make a project runnable in the user's browser by asking the Agents Server to start it:
|
|
5117
|
+
|
|
5118
|
+
- The server automatically runs \`npm run dev\` for a project whose \`package.json\` declares a non-empty \`dev\` script.
|
|
5119
|
+
- Otherwise, the server starts a static file server for the project.
|
|
5120
|
+
- If you need to run your own long-lived dev process, ask only for \`assign_port\`, then start your process on the returned \`runtime.port\`.
|
|
5121
|
+
- Always include the returned \`runtime.url\` in your answer when the user should open the running project.
|
|
5122
|
+
|
|
5123
|
+
Examples:
|
|
5124
|
+
|
|
5125
|
+
\`\`\`bash
|
|
5126
|
+
curl -sS -X POST "$${projectRuntimeApi.serverUrlEnvironmentVariableName}/api/internal/agent-project-runtimes" \\
|
|
5127
|
+
-H "Content-Type: application/json" \\
|
|
5128
|
+
-H "x-user-chat-worker-token: $${projectRuntimeApi.tokenEnvironmentVariableName}" \\
|
|
5129
|
+
-d '{"action":"start","agentPermanentId":"${projectRuntimeApi.agentPermanentId}","projectName":"<project-name>"}'
|
|
5130
|
+
|
|
5131
|
+
curl -sS -X POST "$${projectRuntimeApi.serverUrlEnvironmentVariableName}/api/internal/agent-project-runtimes" \\
|
|
5132
|
+
-H "Content-Type: application/json" \\
|
|
5133
|
+
-H "x-user-chat-worker-token: $${projectRuntimeApi.tokenEnvironmentVariableName}" \\
|
|
5134
|
+
-d '{"action":"assign_port","agentPermanentId":"${projectRuntimeApi.agentPermanentId}","projectName":"<project-name>"}'
|
|
5135
|
+
\`\`\`
|
|
5136
|
+
`);
|
|
5137
|
+
}
|
|
5138
|
+
|
|
4887
5139
|
/**
|
|
4888
5140
|
* Builds the prompt sent to the selected coding runner for one queued user-thread book.
|
|
4889
5141
|
*/
|
|
4890
|
-
function buildAgentMessagePrompt(messageRelativePath, agentSystemMessage) {
|
|
5142
|
+
function buildAgentMessagePrompt(messageRelativePath, agentSystemMessage, options = {}) {
|
|
4891
5143
|
return _spaceTrim.spaceTrim((block) => `
|
|
4892
5144
|
# Answer 1 user question
|
|
4893
5145
|
|
|
4894
5146
|
- Read \`${messageRelativePath}\` and answer the most recent \`MESSAGE @User\`
|
|
4895
5147
|
- Only change the queued message file by appending one new \`MESSAGE @Agent\` block
|
|
4896
|
-
- Do not modify any other file in the repository
|
|
5148
|
+
- Do not modify any other file in the repository, except files inside your own \`${AGENT_PROJECTS_DIRECTORY_PATH}/\` directory
|
|
4897
5149
|
|
|
4898
5150
|
## Rules for the answering
|
|
4899
5151
|
|
|
@@ -4929,34 +5181,46 @@
|
|
|
4929
5181
|
|
|
4930
5182
|
- You can use \`message\` for message that will be sent immediately after clicking the button, or \`messageDraft\` for message that will be prefilled in the input field for editing before sending.
|
|
4931
5183
|
|
|
5184
|
+
${block(buildAgentProjectsPromptSection(options))}
|
|
5185
|
+
|
|
4932
5186
|
## This is how you should behave
|
|
4933
5187
|
|
|
4934
5188
|
${block(agentSystemMessage)}
|
|
4935
5189
|
`);
|
|
4936
5190
|
}
|
|
4937
5191
|
|
|
4938
|
-
/**
|
|
4939
|
-
* Builds a normalized temporary shell script path for prompt runners.
|
|
4940
|
-
*/
|
|
4941
|
-
function buildTemporaryPromptScriptPath(options) {
|
|
4942
|
-
const sourceFileName = path.basename(options.sourceFileName);
|
|
4943
|
-
const scriptFileName = `${sourceFileName.replace(/\.[^.]+$/u, '')}${options.suffix || ''}.sh`;
|
|
4944
|
-
return resolvePromptbookTemporaryPath(options.projectPath, options.scriptDirectoryName, scriptFileName);
|
|
4945
|
-
}
|
|
4946
|
-
|
|
4947
5192
|
/**
|
|
4948
5193
|
* Temporary subdirectory used for agent-message runner shell scripts.
|
|
5194
|
+
*
|
|
5195
|
+
* @private internal constant of agent-message runtime paths
|
|
4949
5196
|
*/
|
|
4950
5197
|
const AGENT_MESSAGE_SCRIPT_DIRECTORY_NAME = 'agent-messages';
|
|
5198
|
+
/**
|
|
5199
|
+
* File extension used for temporary prompt-runner shell scripts.
|
|
5200
|
+
*
|
|
5201
|
+
* @private internal constant of agent-message runtime paths
|
|
5202
|
+
*/
|
|
5203
|
+
const AGENT_MESSAGE_SCRIPT_EXTENSION = '.sh';
|
|
5204
|
+
/**
|
|
5205
|
+
* Builds the temporary shell script path used by one queued agent-message harness run.
|
|
5206
|
+
*
|
|
5207
|
+
* @param projectPath - Local agent project path containing the message queue.
|
|
5208
|
+
* @param sourceFileName - Queued message filename used to name the temporary shell script.
|
|
5209
|
+
* @returns Temporary shell script path.
|
|
5210
|
+
* @private internal utility of agent-message runners
|
|
5211
|
+
*/
|
|
5212
|
+
function buildAgentMessageScriptPathFromFileName(projectPath, sourceFileName) {
|
|
5213
|
+
const sourceFileBasename = path.basename(sourceFileName);
|
|
5214
|
+
const scriptFileName = `${sourceFileBasename.replace(/\.[^.]+$/u, '')}${AGENT_MESSAGE_SCRIPT_EXTENSION}`;
|
|
5215
|
+
return resolvePromptbookTemporaryPath(projectPath, AGENT_MESSAGE_SCRIPT_DIRECTORY_NAME, scriptFileName);
|
|
5216
|
+
}
|
|
5217
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
5218
|
+
|
|
4951
5219
|
/**
|
|
4952
5220
|
* Builds a temporary script path for one agent message runner invocation.
|
|
4953
5221
|
*/
|
|
4954
5222
|
function buildAgentMessageScriptPath(projectPath, messageFile) {
|
|
4955
|
-
return
|
|
4956
|
-
projectPath,
|
|
4957
|
-
scriptDirectoryName: AGENT_MESSAGE_SCRIPT_DIRECTORY_NAME,
|
|
4958
|
-
sourceFileName: messageFile.fileName,
|
|
4959
|
-
});
|
|
5223
|
+
return buildAgentMessageScriptPathFromFileName(projectPath, messageFile.fileName);
|
|
4960
5224
|
}
|
|
4961
5225
|
|
|
4962
5226
|
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book",formfactorName:"GENERIC",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",resultingParameterName:"knowledgePieces",dependentParameterNames:["knowledgeContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge from Markdown\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book`\n- INPUT PARAMETER `{knowledgeContent}` Markdown document content\n- OUTPUT PARAMETER `{knowledgePieces}` The knowledge JSON object\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}\n```\n\n`-> {knowledgePieces}`\n"}],sourceFile:"./books/prepare-knowledge-from-markdown.book"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",resultingParameterName:"keywords",dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Keywords\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-keywords.book`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{keywords}` Keywords separated by comma\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}\n```\n\n`-> {keywords}`\n"}],sourceFile:"./books/prepare-knowledge-keywords.book"},{title:"Prepare Knowledge-piece Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",resultingParameterName:"title",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge-piece Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-title.book`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{title}` The title of the document\n\n## Knowledge\n\n- EXPECT MIN 1 WORD\n- EXPECT MAX 8 WORDS\n\n```markdown\nYou are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-knowledge-title.book"},{title:"Prepare Persona",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book",formfactorName:"GENERIC",parameters:[{name:"availableModels",description:"List of available model names together with their descriptions as JSON",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelsRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-model-requirements",title:"Make modelRequirements",content:"You are an experienced AI engineer, you need to find the best models for virtual assistants:\n\n## Example\n\n```json\n[\n {\n \"modelName\": \"gpt-4o\",\n \"systemMessage\": \"You are experienced AI engineer and helpful assistant.\",\n \"temperature\": 0.7\n },\n {\n \"modelName\": \"claude-3-5-sonnet\",\n \"systemMessage\": \"You are a friendly and knowledgeable chatbot.\",\n \"temperature\": 0.5\n }\n]\n```\n\n## Instructions\n\n- Your output format is JSON array\n- Sort best-fitting models first\n- Omit any models that are not suitable\n- Write just the JSON, no other text should be present\n- Array contain items with following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nHere are the available models:\n\n```json\n{availableModels}\n```\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",resultingParameterName:"modelsRequirements",format:"JSON",dependentParameterNames:["availableModels","personaDescription"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Persona\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-persona.book`\n- INPUT PARAMETER `{availableModels}` List of available model names together with their descriptions as JSON\n- INPUT PARAMETER `{personaDescription}` Description of the persona\n- OUTPUT PARAMETER `{modelsRequirements}` Specific requirements for the model\n\n## Make modelRequirements\n\n- FORMAT JSON\n\n```markdown\nYou are an experienced AI engineer, you need to find the best models for virtual assistants:\n\n## Example\n\n\\`\\`\\`json\n[\n {\n \"modelName\": \"gpt-4o\",\n \"systemMessage\": \"You are experienced AI engineer and helpful assistant.\",\n \"temperature\": 0.7\n },\n {\n \"modelName\": \"claude-3-5-sonnet\",\n \"systemMessage\": \"You are a friendly and knowledgeable chatbot.\",\n \"temperature\": 0.5\n }\n]\n\\`\\`\\`\n\n## Instructions\n\n- Your output format is JSON array\n- Sort best-fitting models first\n- Omit any models that are not suitable\n- Write just the JSON, no other text should be present\n- Array contain items with following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nHere are the available models:\n\n\\`\\`\\`json\n{availableModels}\n\\`\\`\\`\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}\n```\n\n`-> {modelsRequirements}`\n"}],sourceFile:"./books/prepare-persona.book"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-title.book",formfactorName:"GENERIC",parameters:[{name:"book",description:"The book to prepare the title for",isInput:true,isOutput:false},{name:"title",description:"Best title for the book",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-title",title:"Make title",content:"Make best title for given text which describes the workflow:\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\n- Title starts with emoticon\n- Title should not mention the input and output of the workflow but the main purpose of the workflow\n _For example, not \"✍ Convert Knowledge-piece to title\" but \"✍ Title\"_\n\n## The workflow\n\n> {book}",resultingParameterName:"title",expectations:{words:{min:1,max:8},lines:{min:1,max:1}},dependentParameterNames:["book"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-title.book`\n- INPUT PARAMETER `{book}` The book to prepare the title for\n- OUTPUT PARAMETER `{title}` Best title for the book\n\n## Make title\n\n- EXPECT MIN 1 Word\n- EXPECT MAX 8 Words\n- EXPECT EXACTLY 1 Line\n\n```markdown\nMake best title for given text which describes the workflow:\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\n- Title starts with emoticon\n- Title should not mention the input and output of the workflow but the main purpose of the workflow\n _For example, not \"✍ Convert Knowledge-piece to title\" but \"✍ Title\"_\n\n## The workflow\n\n> {book}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-title.book"}];
|
|
@@ -14507,6 +14771,7 @@
|
|
|
14507
14771
|
* - META TITLE: Sets the agent's display title
|
|
14508
14772
|
* - META DESCRIPTION: Sets the agent's description
|
|
14509
14773
|
* - META INPUT PLACEHOLDER: Sets chat input placeholder text
|
|
14774
|
+
* - META THINKING MESSAGE: Adds custom thinking placeholder variants
|
|
14510
14775
|
* - META [ANYTHING]: Any other meta information in uppercase format
|
|
14511
14776
|
*
|
|
14512
14777
|
* These commitments are special because they don't affect the system message,
|
|
@@ -14522,6 +14787,7 @@
|
|
|
14522
14787
|
* META TITLE Professional Assistant
|
|
14523
14788
|
* META DESCRIPTION An AI assistant specialized in business tasks
|
|
14524
14789
|
* META INPUT PLACEHOLDER Write a message...
|
|
14790
|
+
* META THINKING MESSAGE Thinking...
|
|
14525
14791
|
* META AUTHOR John Doe
|
|
14526
14792
|
* META VERSION 1.0
|
|
14527
14793
|
* ```
|
|
@@ -14562,6 +14828,7 @@
|
|
|
14562
14828
|
- **META TITLE** - Sets the agent's display title
|
|
14563
14829
|
- **META DESCRIPTION** - Sets the agent's description
|
|
14564
14830
|
- **META INPUT PLACEHOLDER** - Sets chat input placeholder text
|
|
14831
|
+
- **META THINKING MESSAGE** - Adds custom thinking placeholder variants
|
|
14565
14832
|
- **META [ANYTHING]** - Any other meta information in uppercase format
|
|
14566
14833
|
|
|
14567
14834
|
## Key aspects
|
|
@@ -14570,6 +14837,7 @@
|
|
|
14570
14837
|
- Used for visual representation and attribution in user interfaces
|
|
14571
14838
|
- Multiple META commitments of different types can be used
|
|
14572
14839
|
- Multiple META LINK commitments can be used for different social profiles
|
|
14840
|
+
- Multiple META THINKING MESSAGE commitments can be used for different thinking placeholder variants
|
|
14573
14841
|
- If multiple META commitments of the same type are specified, the last one takes precedence (except for LINK)
|
|
14574
14842
|
|
|
14575
14843
|
## Examples
|
|
@@ -21368,6 +21636,68 @@
|
|
|
21368
21636
|
}
|
|
21369
21637
|
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
21370
21638
|
|
|
21639
|
+
/**
|
|
21640
|
+
* META THINKING MESSAGE commitment definition.
|
|
21641
|
+
*
|
|
21642
|
+
* The `META THINKING MESSAGE` commitment adds one custom thinking placeholder
|
|
21643
|
+
* variant used by chat UIs while an agent is composing a reply.
|
|
21644
|
+
*
|
|
21645
|
+
* @private Metadata-only commitment used by Agents Server chat UIs.
|
|
21646
|
+
*/
|
|
21647
|
+
class MetaThinkingMessageCommitmentDefinition extends BaseCommitmentDefinition {
|
|
21648
|
+
constructor() {
|
|
21649
|
+
super('META THINKING MESSAGE');
|
|
21650
|
+
}
|
|
21651
|
+
/**
|
|
21652
|
+
* Short one-line description of META THINKING MESSAGE.
|
|
21653
|
+
*/
|
|
21654
|
+
get description() {
|
|
21655
|
+
return 'Add a custom thinking placeholder shown while the agent replies.';
|
|
21656
|
+
}
|
|
21657
|
+
/**
|
|
21658
|
+
* Icon for this commitment.
|
|
21659
|
+
*/
|
|
21660
|
+
get icon() {
|
|
21661
|
+
return '💭';
|
|
21662
|
+
}
|
|
21663
|
+
/**
|
|
21664
|
+
* Markdown documentation for META THINKING MESSAGE commitment.
|
|
21665
|
+
*/
|
|
21666
|
+
get documentation() {
|
|
21667
|
+
return _spaceTrim.spaceTrim(`
|
|
21668
|
+
# META THINKING MESSAGE
|
|
21669
|
+
|
|
21670
|
+
Adds one custom placeholder variant shown while the agent is composing a reply.
|
|
21671
|
+
|
|
21672
|
+
## Key aspects
|
|
21673
|
+
|
|
21674
|
+
- Does not modify model behavior, system message, or tools.
|
|
21675
|
+
- Multiple \`META THINKING MESSAGE\` commitments define multiple variants.
|
|
21676
|
+
- Chat UIs randomly rotate between the configured variants while the reply is running.
|
|
21677
|
+
- When no non-empty variants are configured, the server-level \`THINKING_MESSAGES\` metadata is used.
|
|
21678
|
+
- Supports multiline markdown content.
|
|
21679
|
+
|
|
21680
|
+
## Example
|
|
21681
|
+
|
|
21682
|
+
\`\`\`book
|
|
21683
|
+
Helpful Assistant
|
|
21684
|
+
|
|
21685
|
+
META THINKING MESSAGE Thinking...
|
|
21686
|
+
META THINKING MESSAGE Processing...
|
|
21687
|
+
META THINKING MESSAGE
|
|
21688
|
+
|
|
21689
|
+
Doing
|
|
21690
|
+
extra **hard** work
|
|
21691
|
+
\`\`\`
|
|
21692
|
+
`);
|
|
21693
|
+
}
|
|
21694
|
+
applyToAgentModelRequirements(requirements, content) {
|
|
21695
|
+
// META THINKING MESSAGE is metadata only and does not alter model requirements.
|
|
21696
|
+
return requirements;
|
|
21697
|
+
}
|
|
21698
|
+
}
|
|
21699
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
21700
|
+
|
|
21371
21701
|
/**
|
|
21372
21702
|
* META VISIBILITY commitment definition.
|
|
21373
21703
|
*
|
|
@@ -23446,6 +23776,7 @@
|
|
|
23446
23776
|
1. **One-shot URL fetching**: Simple function to fetch and scrape URL content (active)
|
|
23447
23777
|
2. **Running browser**: For complex tasks like scrolling, clicking, form filling, etc. (runtime-dependent)
|
|
23448
23778
|
- The actual browser tool usage is handled by the agent runtime
|
|
23779
|
+
- On the Agents Server, every agent browses in its own persistent isolated browser profile, so cookies and logged-in sessions survive across chats (the profile is linked from the agent wallet)
|
|
23449
23780
|
- Allows the agent to fetch current information from websites and documents
|
|
23450
23781
|
- Useful for research tasks, fact-checking, and accessing dynamic content
|
|
23451
23782
|
- Supports various content types including HTML pages and PDF documents
|
|
@@ -29990,6 +30321,7 @@
|
|
|
29990
30321
|
new MetaDomainCommitmentDefinition(),
|
|
29991
30322
|
new MetaDisclaimerCommitmentDefinition(),
|
|
29992
30323
|
new MetaInputPlaceholderCommitmentDefinition(),
|
|
30324
|
+
new MetaThinkingMessageCommitmentDefinition(),
|
|
29993
30325
|
new MetaVisibilityCommitmentDefinition(),
|
|
29994
30326
|
new MetaCommitmentDefinition(),
|
|
29995
30327
|
new MetaVoiceCommitmentDefinition(),
|
|
@@ -31341,6 +31673,7 @@
|
|
|
31341
31673
|
'META DESCRIPTION': applyMetaDescriptionContent,
|
|
31342
31674
|
'META DISCLAIMER': applyMetaDisclaimerContent,
|
|
31343
31675
|
'META INPUT PLACEHOLDER': applyMetaInputPlaceholderContent,
|
|
31676
|
+
'META THINKING MESSAGE': applyMetaThinkingMessageContent,
|
|
31344
31677
|
'MESSAGE SUFFIX': applyMessageSuffixContent,
|
|
31345
31678
|
'META COLOR': applyMetaColorContent,
|
|
31346
31679
|
'META FONT': applyMetaFontContent,
|
|
@@ -31431,6 +31764,16 @@
|
|
|
31431
31764
|
function applyMetaInputPlaceholderContent(state, content) {
|
|
31432
31765
|
state.meta.inputPlaceholder = _spaceTrim.spaceTrim(content);
|
|
31433
31766
|
}
|
|
31767
|
+
/**
|
|
31768
|
+
* Applies one META THINKING MESSAGE content block into the custom thinking-message variants.
|
|
31769
|
+
*/
|
|
31770
|
+
function applyMetaThinkingMessageContent(state, content) {
|
|
31771
|
+
const thinkingMessage = _spaceTrim.spaceTrim(content);
|
|
31772
|
+
if (!thinkingMessage) {
|
|
31773
|
+
return;
|
|
31774
|
+
}
|
|
31775
|
+
state.thinkingMessages = [...(state.thinkingMessages || []), thinkingMessage];
|
|
31776
|
+
}
|
|
31434
31777
|
/**
|
|
31435
31778
|
* Applies MESSAGE SUFFIX content into the canonical `meta.messageSuffix` field.
|
|
31436
31779
|
*/
|
|
@@ -31799,6 +32142,7 @@
|
|
|
31799
32142
|
capabilities: [],
|
|
31800
32143
|
samples: [],
|
|
31801
32144
|
knowledgeSources: [],
|
|
32145
|
+
thinkingMessages: [],
|
|
31802
32146
|
pendingUserMessage: null,
|
|
31803
32147
|
knownKnowledgeSourceUrls: new Set(),
|
|
31804
32148
|
};
|
|
@@ -31811,6 +32155,7 @@
|
|
|
31811
32155
|
capabilities: state.capabilities,
|
|
31812
32156
|
samples: state.samples,
|
|
31813
32157
|
knowledgeSources: state.knowledgeSources,
|
|
32158
|
+
thinkingMessages: state.thinkingMessages,
|
|
31814
32159
|
};
|
|
31815
32160
|
}
|
|
31816
32161
|
/**
|
|
@@ -31850,6 +32195,7 @@
|
|
|
31850
32195
|
permanentId: parsedProfile.meta.id,
|
|
31851
32196
|
personaDescription,
|
|
31852
32197
|
initialMessage,
|
|
32198
|
+
thinkingMessages: parsedProfile.thinkingMessages,
|
|
31853
32199
|
meta: parsedProfile.meta,
|
|
31854
32200
|
links: parsedProfile.links,
|
|
31855
32201
|
parameters: parseParameters(agentSource),
|
|
@@ -43286,7 +43632,7 @@
|
|
|
43286
43632
|
*
|
|
43287
43633
|
* @private within the repository
|
|
43288
43634
|
*/
|
|
43289
|
-
function locateApp(options) {
|
|
43635
|
+
async function locateApp(options) {
|
|
43290
43636
|
if (!$isRunningInNode()) {
|
|
43291
43637
|
throw new EnvironmentMismatchError('Locating apps works only in Node.js environment');
|
|
43292
43638
|
}
|