@promptbook/cli 0.114.0-2 → 0.114.0-4
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 +1 -9
- package/apps/agents-server/{USE_TIMEOUT_CHIP_QA.md → TIMEOUT_CHIP_QA.md} +1 -1
- package/apps/agents-server/next.config.ts +11 -0
- package/apps/agents-server/src/app/agents/[agentName]/api/chat/resolveAgentChatRouteContext.ts +5 -12
- package/apps/agents-server/src/app/agents/[agentName]/api/voice/route.ts +4 -9
- package/apps/agents-server/src/app/api/scrape/route.ts +1 -1
- package/apps/agents-server/src/app/layout.tsx +31 -0
- package/apps/agents-server/src/app/system/user-wallet/UserWalletDraft.ts +2 -2
- package/apps/agents-server/src/components/AgentProfile/AgentCapabilityChips.tsx +1 -24
- package/apps/agents-server/src/components/Header/Header.tsx +8 -0
- package/apps/agents-server/src/components/Header/HeaderTypes.ts +5 -0
- package/apps/agents-server/src/components/Header/buildHeaderSystemMenuItems.ts +118 -30
- package/apps/agents-server/src/components/Header/resolveHeaderSystemActivities.ts +86 -0
- package/apps/agents-server/src/components/Homepage/AgentCard.tsx +0 -3
- package/apps/agents-server/src/components/LayoutWrapper/LayoutWrapper.tsx +8 -0
- package/apps/agents-server/src/components/NewAgentDialog/NewAgentWizardState.ts +0 -12
- package/apps/agents-server/src/components/NewAgentDialog/NewAgentWizardUseSetupStep.tsx +0 -58
- package/apps/agents-server/src/components/NewAgentDialog/newAgentWizardPresets.ts +0 -56
- package/apps/agents-server/src/components/WalletRecordDialog/useWalletRecordDialogState.ts +1 -1
- package/apps/agents-server/src/languages/ServerTranslationKeys.ts +0 -10
- package/apps/agents-server/src/languages/translations/czech.yaml +0 -10
- package/apps/agents-server/src/languages/translations/english.yaml +0 -10
- package/apps/agents-server/src/message-providers/email/smtp/SmtpMessageProvider.ts +1 -1
- package/apps/agents-server/src/tools/$provideOpenAiAgentKitExecutionToolsForServer.ts +0 -191
- package/apps/agents-server/src/tools/$provideOpenAiAssistantExecutionToolsForServer.ts +0 -3
- package/apps/agents-server/src/tools/run_browser.ts +1 -1
- package/apps/agents-server/src/tools/send_email.ts +3 -3
- package/apps/agents-server/src/utils/handleChatCompletion/createHandleChatCompletionPromptContext.ts +0 -1
- package/apps/agents-server/src/utils/handleChatCompletion/resolveHandleChatCompletionRuntime.ts +4 -12
- package/apps/agents-server/src/utils/manGoOnboarding/manGoOnboardingAgentBooks.ts +0 -1
- package/apps/agents-server/src/utils/messages/parseUseEmailSmtpCredential.ts +1 -1
- package/apps/agents-server/src/utils/resolveUseEmailSmtpCredential.ts +1 -1
- package/apps/agents-server/src/utils/useEmailSmtpWalletConstants.ts +5 -5
- package/apps/agents-server/src/utils/userChat/createRunUserChatJobExecutionContext.ts +5 -12
- package/apps/agents-server/src/utils/userWallet/UserWalletRecord.ts +1 -1
- package/apps/agents-server/src/utils/userWallet/resolveUseEmailSmtpCredentialFromWallet.ts +1 -1
- package/apps/agents-server/src/utils/vpsSelfUpdate/deleteVpsSelfUpdateInstalledVersion.ts +2 -1
- package/apps/agents-server/src/utils/vpsSelfUpdate/isVpsSelfUpdateJobRunning.ts +16 -0
- package/apps/agents-server/src/utils/vpsSelfUpdate/startVpsSelfUpdate.ts +2 -1
- package/apps/agents-server/src/utils/vpsSelfUpdate.ts +1 -0
- package/esm/index.es.js +1974 -5149
- package/esm/index.es.js.map +1 -1
- package/esm/scripts/run-codex-prompts/common/runGoScript/scriptExecutionLog.d.ts +7 -0
- package/esm/scripts/run-codex-prompts/git/coderGitSync.d.ts +43 -0
- package/esm/scripts/run-codex-prompts/git/commitChanges.d.ts +3 -0
- package/esm/scripts/run-codex-prompts/main/resolvePromptRunner.d.ts +8 -1
- package/esm/scripts/run-codex-prompts/ping/buildCoderPingPrompt.d.ts +20 -0
- package/esm/scripts/run-codex-prompts/ping/extractCoderPingAnswer.d.ts +9 -0
- package/esm/scripts/run-codex-prompts/ping/pingCoderHarness.d.ts +23 -0
- package/esm/scripts/run-codex-prompts/ping/printCoderPingResult.d.ts +5 -0
- package/esm/scripts/verify-prompts/verify-prompts.d.ts +5 -0
- package/esm/src/book-2.0/agent-source/AgentBasicInformation.d.ts +3 -3
- package/esm/src/book-components/Chat/utils/$provideServerDomWindow.d.ts +11 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/createAgentsServerRuntimeEnvironment.d.ts +7 -0
- package/esm/src/cli/cli-commands/coder/boilerplateCount.d.ts +52 -0
- package/esm/src/cli/cli-commands/coder/generate-boilerplates.d.ts +3 -2
- package/esm/src/cli/cli-commands/coder/ping.d.ts +2 -5
- package/esm/src/cli/cli-commands/coder.d.ts +1 -1
- package/esm/src/cli/cli-commands/common/coderGitSyncCliOptions.d.ts +34 -0
- package/esm/src/cli/common/loadPromptsModule.d.ts +16 -0
- package/esm/src/commitments/{COMPONENT/COMPONENT.d.ts → META_FULLNAME/META_FULLNAME.d.ts} +8 -5
- package/esm/src/commitments/META_ID/META_ID.d.ts +32 -0
- package/esm/src/commitments/index.d.ts +4 -12
- package/esm/src/llm-providers/agent/Agent.d.ts +1 -1
- package/esm/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +1 -1
- package/esm/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +1 -1
- package/esm/src/llm-providers/openai/OpenAiAgentKitExecutionTools.d.ts +1 -1
- package/esm/src/llm-providers/openai/OpenAiAgentKitExecutionToolsToolBuilder.d.ts +2 -2
- package/esm/src/llm-providers/openai/OpenAiAssistantExecutionToolsStreamRunner.d.ts +1 -1
- package/esm/src/llm-providers/openai/OpenAiAssistantExecutionToolsToolRunner.d.ts +1 -1
- package/esm/src/llm-providers/openai/OpenAiCompatibleNonChatPromptCaller.d.ts +1 -1
- package/esm/src/llm-providers/openai/OpenAiCompatibleRequestManager.d.ts +1 -1
- package/esm/src/llm-providers/openai/utils/callOpenAiCompatibleChatModel.d.ts +1 -1
- package/esm/src/llm-providers/openai/utils/loadOpenAiAgentsModule.d.ts +203 -0
- package/esm/src/llm-providers/openai/utils/uploadFilesToOpenAi.d.ts +1 -1
- package/esm/src/{commitments/USE_BROWSER → scrapers/_common/utils}/fetchUrlContent.d.ts +2 -3
- package/esm/src/utils/misc/createLazyModuleLoader.d.ts +14 -0
- package/esm/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/_packages/components.readme.md +1 -1
- package/src/book-2.0/agent-source/AgentBasicInformation.ts +3 -9
- package/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments/filterCommitmentsForAgentModelRequirements.ts +0 -23
- package/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.ts +0 -2
- package/src/book-2.0/agent-source/parseAgentSource/applyMetaCommitment.ts +16 -31
- package/src/book-2.0/agent-source/parseAgentSource/createCapabilitiesFromCommitment.ts +0 -35
- package/src/book-2.0/book-language-documentation/bookLanguageDocumentationExamples.ts +0 -25
- package/src/book-2.0/book-language-documentation/createStandaloneBookLanguageMarkdown.ts +2 -10
- package/src/book-2.0/book-language-documentation/czechBookLanguageManualDictionary.ts +7 -32
- package/src/book-2.0/book-language-documentation/englishBookLanguageManualDictionary.ts +6 -31
- package/src/book-3.0/LiteAgent.ts +11 -9
- package/src/book-components/BookEditor/useBookEditorMonacoLanguage.ts +1 -1
- package/src/book-components/Chat/utils/$provideServerDomWindow.ts +77 -0
- package/src/book-components/Chat/utils/renderMarkdown.ts +2 -23
- package/src/cli/cli-commands/agents-server/buildAgentsServer/createAgentsServerRuntimeEnvironment.ts +14 -0
- package/src/cli/cli-commands/agents-server/buildAgentsServer/ensureAgentsServerBuild.ts +1 -0
- package/src/cli/cli-commands/coder/add.ts +40 -12
- package/src/cli/cli-commands/coder/boilerplateCount.ts +139 -0
- package/src/cli/cli-commands/coder/generate-boilerplates.ts +82 -48
- package/src/cli/cli-commands/coder/getDefaultCoderPackageJsonScripts.ts +3 -1
- package/src/cli/cli-commands/coder/init.ts +29 -2
- package/src/cli/cli-commands/coder/ping.ts +23 -45
- package/src/cli/cli-commands/coder/verify.ts +27 -12
- package/src/cli/cli-commands/coder.ts +3 -3
- package/src/cli/cli-commands/common/coderGitSyncCliOptions.ts +78 -0
- package/src/cli/cli-commands/run/prepareRunCommandResources.ts +2 -1
- package/src/cli/cli-commands/run/resolveRunInputParameters.ts +2 -1
- package/src/cli/cli-commands/runInteractiveChatbot.ts +2 -1
- package/src/cli/common/$provideLlmToolsForCli.ts +2 -1
- package/src/cli/common/loadPromptsModule.ts +13 -0
- package/src/commitments/ACTION/ACTION.ts +3 -3
- package/src/commitments/{META → META_DESCRIPTION}/META_DESCRIPTION.ts +1 -1
- package/src/commitments/META_FULLNAME/META_FULLNAME.ts +70 -0
- package/src/commitments/META_ID/META_ID.ts +78 -0
- package/src/commitments/_common/getAllCommitmentsToolFunctionsForNode.ts +1 -49
- package/src/commitments/index.ts +6 -24
- package/src/conversion/archive/loadArchive.ts +2 -1
- package/src/conversion/archive/loadJsZipModule.ts +10 -0
- package/src/conversion/archive/saveArchive.ts +2 -1
- package/src/llm-providers/agent/Agent.ts +1 -1
- package/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.ts +13 -1
- package/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.ts +13 -1
- package/src/llm-providers/openai/OpenAiAgentKitExecutionTools.ts +6 -2
- package/src/llm-providers/openai/OpenAiAgentKitExecutionToolsToolBuilder.ts +9 -7
- package/src/llm-providers/openai/OpenAiAssistantExecutionTools.ts +1 -1
- package/src/llm-providers/openai/OpenAiAssistantExecutionToolsStreamRunner.ts +1 -1
- package/src/llm-providers/openai/OpenAiAssistantExecutionToolsToolRunner.ts +1 -1
- package/src/llm-providers/openai/OpenAiCompatibleNonChatPromptCaller.ts +1 -1
- package/src/llm-providers/openai/OpenAiCompatibleRequestManager.ts +12 -1
- package/src/llm-providers/openai/utils/callOpenAiCompatibleChatModel.ts +1 -1
- package/src/llm-providers/openai/utils/loadOpenAiAgentsModule.ts +11 -0
- package/src/llm-providers/openai/utils/uploadFilesToOpenAi.ts +1 -1
- package/src/other/templates/getTemplatesPipelineCollection.ts +715 -823
- package/src/remote-server/createRemoteClient.ts +12 -1
- package/src/{commitments/USE_BROWSER → scrapers/_common/utils}/fetchUrlContent.ts +8 -9
- package/src/scrapers/website/WebsiteScraper.ts +22 -2
- package/src/utils/misc/createLazyModuleLoader.ts +27 -0
- package/src/version.ts +2 -2
- package/src/versions.txt +2 -0
- package/umd/index.umd.js +2047 -5216
- package/umd/index.umd.js.map +1 -1
- package/umd/scripts/run-codex-prompts/common/runGoScript/scriptExecutionLog.d.ts +7 -0
- package/umd/scripts/run-codex-prompts/git/coderGitSync.d.ts +43 -0
- package/umd/scripts/run-codex-prompts/git/commitChanges.d.ts +3 -0
- package/umd/scripts/run-codex-prompts/main/resolvePromptRunner.d.ts +8 -1
- package/umd/scripts/run-codex-prompts/ping/buildCoderPingPrompt.d.ts +20 -0
- package/umd/scripts/run-codex-prompts/ping/extractCoderPingAnswer.d.ts +9 -0
- package/umd/scripts/run-codex-prompts/ping/pingCoderHarness.d.ts +23 -0
- package/umd/scripts/run-codex-prompts/ping/printCoderPingResult.d.ts +5 -0
- package/umd/scripts/verify-prompts/verify-prompts.d.ts +5 -0
- package/umd/src/book-2.0/agent-source/AgentBasicInformation.d.ts +3 -3
- package/umd/src/book-components/Chat/utils/$provideServerDomWindow.d.ts +11 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/createAgentsServerRuntimeEnvironment.d.ts +7 -0
- package/umd/src/cli/cli-commands/coder/boilerplateCount.d.ts +52 -0
- package/umd/src/cli/cli-commands/coder/generate-boilerplates.d.ts +3 -2
- package/umd/src/cli/cli-commands/coder/ping.d.ts +2 -5
- package/umd/src/cli/cli-commands/coder.d.ts +1 -1
- package/umd/src/cli/cli-commands/common/coderGitSyncCliOptions.d.ts +34 -0
- package/umd/src/cli/common/loadPromptsModule.d.ts +16 -0
- package/umd/src/commitments/{COMPONENT/COMPONENT.d.ts → META_FULLNAME/META_FULLNAME.d.ts} +8 -5
- package/umd/src/commitments/META_ID/META_ID.d.ts +32 -0
- package/umd/src/commitments/index.d.ts +4 -12
- package/umd/src/llm-providers/agent/Agent.d.ts +1 -1
- package/umd/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +1 -1
- package/umd/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +1 -1
- package/umd/src/llm-providers/openai/OpenAiAgentKitExecutionTools.d.ts +1 -1
- package/umd/src/llm-providers/openai/OpenAiAgentKitExecutionToolsToolBuilder.d.ts +2 -2
- package/umd/src/llm-providers/openai/OpenAiAssistantExecutionToolsStreamRunner.d.ts +1 -1
- package/umd/src/llm-providers/openai/OpenAiAssistantExecutionToolsToolRunner.d.ts +1 -1
- package/umd/src/llm-providers/openai/OpenAiCompatibleNonChatPromptCaller.d.ts +1 -1
- package/umd/src/llm-providers/openai/OpenAiCompatibleRequestManager.d.ts +1 -1
- package/umd/src/llm-providers/openai/utils/callOpenAiCompatibleChatModel.d.ts +1 -1
- package/umd/src/llm-providers/openai/utils/loadOpenAiAgentsModule.d.ts +203 -0
- package/umd/src/llm-providers/openai/utils/uploadFilesToOpenAi.d.ts +1 -1
- package/umd/src/{commitments/USE_BROWSER → scrapers/_common/utils}/fetchUrlContent.d.ts +2 -3
- package/umd/src/utils/misc/createLazyModuleLoader.d.ts +14 -0
- package/umd/src/version.d.ts +1 -1
- package/apps/agents-server/src/tools/configureTimeoutToolRuntimeAdapterForServer.ts +0 -381
- package/apps/agents-server/src/utils/emails/extractUseEmailConfigurationFromAgentSource.ts +0 -42
- package/esm/scripts/run-agent-chat/runCoderPing.d.ts +0 -48
- package/esm/src/commitments/MEMORY/MEMORY.d.ts +0 -48
- package/esm/src/commitments/MEMORY/MemoryToolNames.d.ts +0 -11
- package/esm/src/commitments/MEMORY/MemoryToolRuntimeAdapter.d.ts +0 -149
- package/esm/src/commitments/MEMORY/createMemorySystemMessage.d.ts +0 -6
- package/esm/src/commitments/MEMORY/createMemoryToolFunctions.d.ts +0 -8
- package/esm/src/commitments/MEMORY/createMemoryTools.d.ts +0 -14
- package/esm/src/commitments/MEMORY/getMemoryCommitmentDocumentation.d.ts +0 -6
- package/esm/src/commitments/MEMORY/getMemoryToolRuntimeAdapterOrDisabledResult.d.ts +0 -17
- package/esm/src/commitments/MEMORY/getMemoryToolTitles.d.ts +0 -7
- package/esm/src/commitments/MEMORY/parseMemoryToolArgs.d.ts +0 -61
- package/esm/src/commitments/MEMORY/resolveMemoryRuntimeContext.d.ts +0 -8
- package/esm/src/commitments/MEMORY/setMemoryToolRuntimeAdapter.d.ts +0 -13
- package/esm/src/commitments/META/META.d.ts +0 -65
- package/esm/src/commitments/USE/aggregateUseCommitmentSystemMessages.d.ts +0 -32
- package/esm/src/commitments/USE_BROWSER/USE_BROWSER.d.ts +0 -58
- package/esm/src/commitments/USE_BROWSER/fetchUrlContentViaBrowser.d.ts +0 -13
- package/esm/src/commitments/USE_BROWSER/resolveRunBrowserToolForNode.d.ts +0 -10
- package/esm/src/commitments/USE_DEEPSEARCH/USE_DEEPSEARCH.d.ts +0 -47
- package/esm/src/commitments/USE_EMAIL/USE_EMAIL.d.ts +0 -38
- package/esm/src/commitments/USE_EMAIL/parseUseEmailCommitmentContent.d.ts +0 -21
- package/esm/src/commitments/USE_EMAIL/resolveSendEmailToolForNode.d.ts +0 -11
- package/esm/src/commitments/USE_EMAIL/sendEmailViaBrowser.d.ts +0 -13
- package/esm/src/commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.d.ts +0 -46
- package/esm/src/commitments/USE_SPAWN/USE_SPAWN.d.ts +0 -38
- package/esm/src/commitments/USE_SPAWN/USE_SPAWN.test.d.ts +0 -1
- package/esm/src/commitments/USE_SPAWN/resolveSpawnAgentToolForNode.d.ts +0 -9
- package/esm/src/commitments/USE_SPAWN/spawnAgentViaBrowser.d.ts +0 -12
- package/esm/src/commitments/USE_TIME/USE_TIME.d.ts +0 -43
- package/esm/src/commitments/USE_TIME/USE_TIME.test.d.ts +0 -1
- package/esm/src/commitments/USE_TIMEOUT/TimeoutToolNames.d.ts +0 -11
- package/esm/src/commitments/USE_TIMEOUT/TimeoutToolRuntimeAdapter.d.ts +0 -212
- package/esm/src/commitments/USE_TIMEOUT/USE_TIMEOUT.d.ts +0 -38
- package/esm/src/commitments/USE_TIMEOUT/USE_TIMEOUT.test.d.ts +0 -1
- package/esm/src/commitments/USE_TIMEOUT/createTimeoutSystemMessage.d.ts +0 -6
- package/esm/src/commitments/USE_TIMEOUT/createTimeoutToolFunctions.d.ts +0 -8
- package/esm/src/commitments/USE_TIMEOUT/createTimeoutTools.d.ts +0 -7
- package/esm/src/commitments/USE_TIMEOUT/getTimeoutToolRuntimeAdapterOrDisabledResult.d.ts +0 -17
- package/esm/src/commitments/USE_TIMEOUT/parseTimeoutToolArgs.d.ts +0 -78
- package/esm/src/commitments/USE_TIMEOUT/resolveTimeoutRuntimeContext.d.ts +0 -8
- package/esm/src/commitments/USE_TIMEOUT/setTimeoutToolRuntimeAdapter.d.ts +0 -13
- package/esm/src/commitments/WALLET/WALLET.d.ts +0 -21
- package/esm/src/commitments/WALLET/WALLET.test.d.ts +0 -1
- package/esm/src/commitments/WALLET/WalletToolNames.d.ts +0 -12
- package/esm/src/commitments/WALLET/WalletToolRuntimeAdapter.d.ts +0 -163
- package/esm/src/commitments/WALLET/createWalletSystemMessage.d.ts +0 -6
- package/esm/src/commitments/WALLET/createWalletToolFunctions.d.ts +0 -8
- package/esm/src/commitments/WALLET/createWalletTools.d.ts +0 -7
- package/esm/src/commitments/WALLET/getWalletCommitmentDocumentation.d.ts +0 -6
- package/esm/src/commitments/WALLET/getWalletToolRuntimeAdapterOrDisabledResult.d.ts +0 -16
- package/esm/src/commitments/WALLET/getWalletToolTitles.d.ts +0 -7
- package/esm/src/commitments/WALLET/parseWalletToolArgs.d.ts +0 -51
- package/esm/src/commitments/WALLET/resolveWalletRuntimeContext.d.ts +0 -8
- package/esm/src/commitments/WALLET/setWalletToolRuntimeAdapter.d.ts +0 -13
- package/esm/src/commitments/_common/createSerpSearchToolFunction.d.ts +0 -12
- package/src/commitments/COMPONENT/COMPONENT.ts +0 -70
- package/src/commitments/MEMORY/MEMORY.ts +0 -94
- package/src/commitments/MEMORY/MemoryToolNames.ts +0 -13
- package/src/commitments/MEMORY/MemoryToolRuntimeAdapter.ts +0 -180
- package/src/commitments/MEMORY/createMemorySystemMessage.ts +0 -27
- package/src/commitments/MEMORY/createMemoryToolFunctions.ts +0 -134
- package/src/commitments/MEMORY/createMemoryTools.ts +0 -115
- package/src/commitments/MEMORY/getMemoryCommitmentDocumentation.ts +0 -47
- package/src/commitments/MEMORY/getMemoryToolRuntimeAdapterOrDisabledResult.ts +0 -104
- package/src/commitments/MEMORY/getMemoryToolTitles.ts +0 -16
- package/src/commitments/MEMORY/parseMemoryToolArgs.ts +0 -126
- package/src/commitments/MEMORY/resolveMemoryRuntimeContext.ts +0 -23
- package/src/commitments/MEMORY/setMemoryToolRuntimeAdapter.ts +0 -26
- package/src/commitments/META/META.ts +0 -168
- package/src/commitments/USE/TODO.txt +0 -1
- package/src/commitments/USE/aggregateUseCommitmentSystemMessages.ts +0 -219
- package/src/commitments/USE_BROWSER/TODO.txt +0 -1
- package/src/commitments/USE_BROWSER/USE_BROWSER.ts +0 -257
- package/src/commitments/USE_BROWSER/fetchUrlContentViaBrowser.ts +0 -45
- package/src/commitments/USE_BROWSER/resolveRunBrowserToolForNode.ts +0 -83
- package/src/commitments/USE_DEEPSEARCH/USE_DEEPSEARCH.ts +0 -146
- package/src/commitments/USE_EMAIL/USE_EMAIL.ts +0 -201
- package/src/commitments/USE_EMAIL/parseUseEmailCommitmentContent.ts +0 -75
- package/src/commitments/USE_EMAIL/resolveSendEmailToolForNode.ts +0 -44
- package/src/commitments/USE_EMAIL/sendEmailViaBrowser.ts +0 -47
- package/src/commitments/USE_SEARCH_ENGINE/TODO.txt +0 -1
- package/src/commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.ts +0 -171
- package/src/commitments/USE_SPAWN/USE_SPAWN.ts +0 -150
- package/src/commitments/USE_SPAWN/resolveSpawnAgentToolForNode.ts +0 -42
- package/src/commitments/USE_SPAWN/spawnAgentViaBrowser.ts +0 -50
- package/src/commitments/USE_TIME/USE_TIME.ts +0 -177
- package/src/commitments/USE_TIMEOUT/TimeoutToolNames.ts +0 -13
- package/src/commitments/USE_TIMEOUT/TimeoutToolRuntimeAdapter.ts +0 -255
- package/src/commitments/USE_TIMEOUT/USE_TIMEOUT.ts +0 -117
- package/src/commitments/USE_TIMEOUT/createTimeoutSystemMessage.ts +0 -22
- package/src/commitments/USE_TIMEOUT/createTimeoutToolFunctions.ts +0 -361
- package/src/commitments/USE_TIMEOUT/createTimeoutTools.ts +0 -127
- package/src/commitments/USE_TIMEOUT/getTimeoutToolRuntimeAdapterOrDisabledResult.ts +0 -67
- package/src/commitments/USE_TIMEOUT/parseTimeoutToolArgs.ts +0 -460
- package/src/commitments/USE_TIMEOUT/resolveTimeoutRuntimeContext.ts +0 -36
- package/src/commitments/USE_TIMEOUT/setTimeoutToolRuntimeAdapter.ts +0 -26
- package/src/commitments/WALLET/WALLET.ts +0 -71
- package/src/commitments/WALLET/WalletToolNames.ts +0 -14
- package/src/commitments/WALLET/WalletToolRuntimeAdapter.ts +0 -180
- package/src/commitments/WALLET/createWalletSystemMessage.ts +0 -22
- package/src/commitments/WALLET/createWalletToolFunctions.ts +0 -145
- package/src/commitments/WALLET/createWalletTools.ts +0 -129
- package/src/commitments/WALLET/getWalletCommitmentDocumentation.ts +0 -14
- package/src/commitments/WALLET/getWalletToolRuntimeAdapterOrDisabledResult.ts +0 -64
- package/src/commitments/WALLET/getWalletToolTitles.ts +0 -17
- package/src/commitments/WALLET/parseWalletToolArgs.ts +0 -231
- package/src/commitments/WALLET/resolveWalletRuntimeContext.ts +0 -23
- package/src/commitments/WALLET/setWalletToolRuntimeAdapter.ts +0 -26
- package/src/commitments/_common/createSerpSearchToolFunction.ts +0 -46
- package/umd/scripts/run-agent-chat/runCoderPing.d.ts +0 -48
- package/umd/src/book-2.0/agent-source/createAgentModelRequirements.useCommitmentAggregation.test.d.ts +0 -1
- package/umd/src/commitments/MEMORY/MEMORY.d.ts +0 -48
- package/umd/src/commitments/MEMORY/MEMORY.test.d.ts +0 -1
- package/umd/src/commitments/MEMORY/MemoryToolNames.d.ts +0 -11
- package/umd/src/commitments/MEMORY/MemoryToolRuntimeAdapter.d.ts +0 -149
- package/umd/src/commitments/MEMORY/createMemorySystemMessage.d.ts +0 -6
- package/umd/src/commitments/MEMORY/createMemoryToolFunctions.d.ts +0 -8
- package/umd/src/commitments/MEMORY/createMemoryTools.d.ts +0 -14
- package/umd/src/commitments/MEMORY/getMemoryCommitmentDocumentation.d.ts +0 -6
- package/umd/src/commitments/MEMORY/getMemoryToolRuntimeAdapterOrDisabledResult.d.ts +0 -17
- package/umd/src/commitments/MEMORY/getMemoryToolTitles.d.ts +0 -7
- package/umd/src/commitments/MEMORY/parseMemoryToolArgs.d.ts +0 -61
- package/umd/src/commitments/MEMORY/resolveMemoryRuntimeContext.d.ts +0 -8
- package/umd/src/commitments/MEMORY/setMemoryToolRuntimeAdapter.d.ts +0 -13
- package/umd/src/commitments/META/META.d.ts +0 -65
- package/umd/src/commitments/USE/aggregateUseCommitmentSystemMessages.d.ts +0 -32
- package/umd/src/commitments/USE_BROWSER/USE_BROWSER.d.ts +0 -58
- package/umd/src/commitments/USE_BROWSER/USE_BROWSER.test.d.ts +0 -1
- package/umd/src/commitments/USE_BROWSER/fetchUrlContentViaBrowser.d.ts +0 -13
- package/umd/src/commitments/USE_BROWSER/resolveRunBrowserToolForNode.d.ts +0 -10
- package/umd/src/commitments/USE_BROWSER/resolveRunBrowserToolForNode.test.d.ts +0 -1
- package/umd/src/commitments/USE_DEEPSEARCH/USE_DEEPSEARCH.d.ts +0 -47
- package/umd/src/commitments/USE_DEEPSEARCH/USE_DEEPSEARCH.test.d.ts +0 -1
- package/umd/src/commitments/USE_EMAIL/USE_EMAIL.d.ts +0 -38
- package/umd/src/commitments/USE_EMAIL/USE_EMAIL.test.d.ts +0 -1
- package/umd/src/commitments/USE_EMAIL/parseUseEmailCommitmentContent.d.ts +0 -21
- package/umd/src/commitments/USE_EMAIL/parseUseEmailCommitmentContent.test.d.ts +0 -1
- package/umd/src/commitments/USE_EMAIL/resolveSendEmailToolForNode.d.ts +0 -11
- package/umd/src/commitments/USE_EMAIL/sendEmailViaBrowser.d.ts +0 -13
- package/umd/src/commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.d.ts +0 -46
- package/umd/src/commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.test.d.ts +0 -1
- package/umd/src/commitments/USE_SPAWN/USE_SPAWN.d.ts +0 -38
- package/umd/src/commitments/USE_SPAWN/USE_SPAWN.test.d.ts +0 -1
- package/umd/src/commitments/USE_SPAWN/resolveSpawnAgentToolForNode.d.ts +0 -9
- package/umd/src/commitments/USE_SPAWN/spawnAgentViaBrowser.d.ts +0 -12
- package/umd/src/commitments/USE_TIME/USE_TIME.d.ts +0 -43
- package/umd/src/commitments/USE_TIME/USE_TIME.test.d.ts +0 -1
- package/umd/src/commitments/USE_TIMEOUT/TimeoutToolNames.d.ts +0 -11
- package/umd/src/commitments/USE_TIMEOUT/TimeoutToolRuntimeAdapter.d.ts +0 -212
- package/umd/src/commitments/USE_TIMEOUT/USE_TIMEOUT.d.ts +0 -38
- package/umd/src/commitments/USE_TIMEOUT/USE_TIMEOUT.test.d.ts +0 -1
- package/umd/src/commitments/USE_TIMEOUT/createTimeoutSystemMessage.d.ts +0 -6
- package/umd/src/commitments/USE_TIMEOUT/createTimeoutToolFunctions.d.ts +0 -8
- package/umd/src/commitments/USE_TIMEOUT/createTimeoutTools.d.ts +0 -7
- package/umd/src/commitments/USE_TIMEOUT/getTimeoutToolRuntimeAdapterOrDisabledResult.d.ts +0 -17
- package/umd/src/commitments/USE_TIMEOUT/parseTimeoutToolArgs.d.ts +0 -78
- package/umd/src/commitments/USE_TIMEOUT/resolveTimeoutRuntimeContext.d.ts +0 -8
- package/umd/src/commitments/USE_TIMEOUT/setTimeoutToolRuntimeAdapter.d.ts +0 -13
- package/umd/src/commitments/WALLET/WALLET.d.ts +0 -21
- package/umd/src/commitments/WALLET/WALLET.test.d.ts +0 -1
- package/umd/src/commitments/WALLET/WalletToolNames.d.ts +0 -12
- package/umd/src/commitments/WALLET/WalletToolRuntimeAdapter.d.ts +0 -163
- package/umd/src/commitments/WALLET/createWalletSystemMessage.d.ts +0 -6
- package/umd/src/commitments/WALLET/createWalletToolFunctions.d.ts +0 -8
- package/umd/src/commitments/WALLET/createWalletTools.d.ts +0 -7
- package/umd/src/commitments/WALLET/getWalletCommitmentDocumentation.d.ts +0 -6
- package/umd/src/commitments/WALLET/getWalletToolRuntimeAdapterOrDisabledResult.d.ts +0 -16
- package/umd/src/commitments/WALLET/getWalletToolTitles.d.ts +0 -7
- package/umd/src/commitments/WALLET/parseWalletToolArgs.d.ts +0 -51
- package/umd/src/commitments/WALLET/resolveWalletRuntimeContext.d.ts +0 -8
- package/umd/src/commitments/WALLET/setWalletToolRuntimeAdapter.d.ts +0 -13
- package/umd/src/commitments/_common/createSerpSearchToolFunction.d.ts +0 -12
- /package/esm/src/book-2.0/agent-source/{createAgentModelRequirements.useCommitmentAggregation.test.d.ts → createAgentModelRequirements.commitmentAggregation.test.d.ts} +0 -0
- /package/esm/src/{commitments/MEMORY/MEMORY.test.d.ts → cli/cli-commands/coder/boilerplateCount.test.d.ts} +0 -0
- /package/esm/src/{commitments/USE_BROWSER/USE_BROWSER.test.d.ts → cli/cli-commands/coder/generate-boilerplates.test.d.ts} +0 -0
- /package/esm/src/{commitments/USE_BROWSER/resolveRunBrowserToolForNode.test.d.ts → cli/cli-commands/common/coderGitSyncCliOptions.test.d.ts} +0 -0
- /package/esm/src/commitments/{META → META_DESCRIPTION}/META_DESCRIPTION.d.ts +0 -0
- /package/{esm/src/commitments/USE_DEEPSEARCH/USE_DEEPSEARCH.test.d.ts → umd/src/book-2.0/agent-source/createAgentModelRequirements.commitmentAggregation.test.d.ts} +0 -0
- /package/{esm/src/commitments/USE_EMAIL/USE_EMAIL.test.d.ts → umd/src/cli/cli-commands/coder/boilerplateCount.test.d.ts} +0 -0
- /package/{esm/src/commitments/USE_EMAIL/parseUseEmailCommitmentContent.test.d.ts → umd/src/cli/cli-commands/coder/generate-boilerplates.test.d.ts} +0 -0
- /package/{esm/src/commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.test.d.ts → umd/src/cli/cli-commands/common/coderGitSyncCliOptions.test.d.ts} +0 -0
- /package/umd/src/commitments/{META → META_DESCRIPTION}/META_DESCRIPTION.d.ts +0 -0
|
@@ -47,7 +47,7 @@ export const czechBookLanguageManualDictionary: BookLanguageManualDictionary = {
|
|
|
47
47
|
2. **Vrstva chování**:
|
|
48
48
|
\`RULE\`, \`KNOWLEDGE\`, \`WRITING SAMPLE\`, \`WRITING RULES\`, \`LANGUAGE\`, \`GOAL\` a příbuzné commitmenty.
|
|
49
49
|
3. **Vrstva schopností**:
|
|
50
|
-
\`USE
|
|
50
|
+
\`USE*\` a další nástrojové commitmenty, které agentovi otevírají běhové schopnosti.
|
|
51
51
|
4. **Vrstva skládání**:
|
|
52
52
|
Dědičnost přes \`FROM\`, znovupoužití přes \`IMPORT\` a delegování přes \`TEAM\`.
|
|
53
53
|
`),
|
|
@@ -69,9 +69,9 @@ export const czechBookLanguageManualDictionary: BookLanguageManualDictionary = {
|
|
|
69
69
|
4. **Skládání místo jednoho velkého agenta**:
|
|
70
70
|
Na specializované odpovědnosti použijte \`TEAM\` nebo \`IMPORT\`.
|
|
71
71
|
Kompromis: režie s koordinací, výrazně lepší modularita a znovupoužitelnost.
|
|
72
|
-
5. **Řízená
|
|
73
|
-
Pokud používáte \`
|
|
74
|
-
Kompromis: přísnější návrh pravidel, lepší soukromí i kvalita
|
|
72
|
+
5. **Řízená práce s daty**:
|
|
73
|
+
Pokud používáte \`USE PRIVACY\`, popište, co smí a co v žádném případě nesmí opustit konverzaci.
|
|
74
|
+
Kompromis: přísnější návrh pravidel, lepší soukromí i kvalita odpovědí.
|
|
75
75
|
`),
|
|
76
76
|
},
|
|
77
77
|
primitives: {
|
|
@@ -102,7 +102,7 @@ export const czechBookLanguageManualDictionary: BookLanguageManualDictionary = {
|
|
|
102
102
|
3. **Přidejte oporu ve znalostech**
|
|
103
103
|
Přidejte commitmenty \`KNOWLEDGE\` (přímý text, nebo lokální či importovatelné zdroje).
|
|
104
104
|
4. **Přidejte schopnosti**
|
|
105
|
-
Přidejte jen ty commitmenty \`USE
|
|
105
|
+
Přidejte jen ty commitmenty \`USE*\`, které agent opravdu potřebuje.
|
|
106
106
|
5. **Doplňte profilová metadata**
|
|
107
107
|
Přidejte \`META DESCRIPTION\`, \`META AVATAR\` / \`META VISUAL\` nebo \`META IMAGE\`, \`META INPUT PLACEHOLDER\`, \`META THINKING MESSAGE\` a případná upozornění.
|
|
108
108
|
6. **Připravte první interakci**
|
|
@@ -155,7 +155,7 @@ export const czechBookLanguageManualDictionary: BookLanguageManualDictionary = {
|
|
|
155
155
|
capabilities: {
|
|
156
156
|
title: 'Commitmenty USE',
|
|
157
157
|
body: spaceTrim(`
|
|
158
|
-
Commitmenty \`USE*\` zapínají schopnosti (
|
|
158
|
+
Commitmenty \`USE*\` zapínají schopnosti (napojení na projekt, kalendář, generování obrázků a další).
|
|
159
159
|
Zpřístupňují běhové nástroje a doplňují pokyny do systémové zprávy.
|
|
160
160
|
`),
|
|
161
161
|
},
|
|
@@ -209,16 +209,6 @@ export const czechBookLanguageManualDictionary: BookLanguageManualDictionary = {
|
|
|
209
209
|
'`CLOSED` brání tomu, aby se agent upravoval během konverzace.',
|
|
210
210
|
],
|
|
211
211
|
},
|
|
212
|
-
'tool-using-browser-search-agent': {
|
|
213
|
-
title: 'Agent s nástroji (prohlížeč a vyhledávač)',
|
|
214
|
-
goal: 'Umožnit rešerši na internetu s jasnou prací se zdroji.',
|
|
215
|
-
walkthrough: [
|
|
216
|
-
'`USE SEARCH ENGINE` zpřístupní vyhledávání na webu a volitelné pokyny k němu.',
|
|
217
|
-
'`USE BROWSER` zapne stahování adres a interaktivní procházení webu.',
|
|
218
|
-
'Commitmenty `RULE` dělají požadavky na spolehlivost výslovnými a opakovatelnými.',
|
|
219
|
-
'Tento vzor se hodí pro agenty na aktuální dění a ověřování faktů.',
|
|
220
|
-
],
|
|
221
|
-
},
|
|
222
212
|
'rule-and-knowledge-agent': {
|
|
223
213
|
title: 'Agent s RULE a KNOWLEDGE',
|
|
224
214
|
goal: 'Opřít odpovědi o výslovná omezení a připravené zdroje.',
|
|
@@ -229,16 +219,6 @@ export const czechBookLanguageManualDictionary: BookLanguageManualDictionary = {
|
|
|
229
219
|
'Tento vzor použijte pro compliance, podporu a interní postupy.',
|
|
230
220
|
],
|
|
231
221
|
},
|
|
232
|
-
'memory-agent-with-long-term-memory': {
|
|
233
|
-
title: 'Agent s dlouhodobou pamětí (MEMORY)',
|
|
234
|
-
goal: 'Uchovat preference uživatele napříč konverzacemi.',
|
|
235
|
-
walkthrough: [
|
|
236
|
-
'`MEMORY` přidá běhové nástroje paměti a příslušné pokyny do systémové zprávy.',
|
|
237
|
-
'Commitmenty `RULE` zúží, co se smí pamatovat, a snižují tak rizika pro soukromí.',
|
|
238
|
-
'V Agents Serveru je paměť vedená za běhu a je vázaná na konkrétního uživatele.',
|
|
239
|
-
'Hodí se pro asistenty, kteří si musí držet kontext v čase.',
|
|
240
|
-
],
|
|
241
|
-
},
|
|
242
222
|
'use-project-integration-agent': {
|
|
243
223
|
title: 'Napojení na projekt (USE PROJECT)',
|
|
244
224
|
goal: 'Pracovat s repozitářem na GitHubu přes připojení projektu.',
|
|
@@ -283,7 +263,7 @@ export const czechBookLanguageManualDictionary: BookLanguageManualDictionary = {
|
|
|
283
263
|
{
|
|
284
264
|
title: 'Neověřitelná tvrzení',
|
|
285
265
|
dont: 'Agent odpovídá na otázky závislé na internetu bez nástrojů nebo bez uvedení zdrojů.',
|
|
286
|
-
doInstead: 'Přidejte
|
|
266
|
+
doInstead: 'Přidejte zdroje `KNOWLEDGE` a `RULE` zaměřené na citování.',
|
|
287
267
|
},
|
|
288
268
|
{
|
|
289
269
|
title: 'Chybějící mantinely',
|
|
@@ -295,11 +275,6 @@ export const czechBookLanguageManualDictionary: BookLanguageManualDictionary = {
|
|
|
295
275
|
dont: 'Dlouhé řetězce `FROM` bez vysvětlení, proč je každý rodič potřeba.',
|
|
296
276
|
doInstead: 'Držte dědičnost mělkou a pro znovupoužití sáhněte po cíleném IMPORT nebo TEAM.',
|
|
297
277
|
},
|
|
298
|
-
{
|
|
299
|
-
title: 'Nebezpečné zacházení s pamětí',
|
|
300
|
-
dont: 'Ukládání každého detailu do paměti bez jakýchkoli hranic.',
|
|
301
|
-
doInstead: 'Doplňte `MEMORY` výslovnými pravidly, co se smí uchovávat.',
|
|
302
|
-
},
|
|
303
278
|
],
|
|
304
279
|
tutorialSections: {
|
|
305
280
|
serverAgentsHint:
|
|
@@ -47,7 +47,7 @@ export const englishBookLanguageManualDictionary: BookLanguageManualDictionary =
|
|
|
47
47
|
2. **Behavior layer**:
|
|
48
48
|
\`RULE\`, \`KNOWLEDGE\`, \`WRITING SAMPLE\`, \`WRITING RULES\`, \`LANGUAGE\`, \`GOAL\`, and related commitments.
|
|
49
49
|
3. **Capability layer**:
|
|
50
|
-
\`USE
|
|
50
|
+
\`USE*\` and other tooling commitments exposing runtime abilities.
|
|
51
51
|
4. **Composition layer**:
|
|
52
52
|
\`FROM\` inheritance, \`IMPORT\` reuse, and \`TEAM\` delegation.
|
|
53
53
|
`),
|
|
@@ -69,8 +69,8 @@ export const englishBookLanguageManualDictionary: BookLanguageManualDictionary =
|
|
|
69
69
|
4. **Composition over monoliths**:
|
|
70
70
|
Use \`TEAM\`/\`IMPORT\` for specialized responsibilities.
|
|
71
71
|
Tradeoff: orchestration overhead, stronger modularity and reuse.
|
|
72
|
-
5. **Controlled
|
|
73
|
-
If using \`
|
|
72
|
+
5. **Controlled data access**:
|
|
73
|
+
If using \`USE PRIVACY\`, define what must and must not leave the conversation.
|
|
74
74
|
Tradeoff: stricter policy design, better privacy and signal quality.
|
|
75
75
|
`),
|
|
76
76
|
},
|
|
@@ -102,7 +102,7 @@ export const englishBookLanguageManualDictionary: BookLanguageManualDictionary =
|
|
|
102
102
|
3. **Add grounding**
|
|
103
103
|
Add \`KNOWLEDGE\` commitments (inline text or local/importable sources).
|
|
104
104
|
4. **Add capabilities**
|
|
105
|
-
Add only necessary \`USE*\`
|
|
105
|
+
Add only necessary \`USE*\` commitments.
|
|
106
106
|
5. **Set profile metadata**
|
|
107
107
|
Add \`META DESCRIPTION\`, \`META AVATAR\` / \`META VISUAL\` or \`META IMAGE\`, \`META INPUT PLACEHOLDER\`, \`META THINKING MESSAGE\`, and disclaimers if needed.
|
|
108
108
|
6. **Add first interaction**
|
|
@@ -155,7 +155,7 @@ export const englishBookLanguageManualDictionary: BookLanguageManualDictionary =
|
|
|
155
155
|
capabilities: {
|
|
156
156
|
title: 'USE commitments',
|
|
157
157
|
body: spaceTrim(`
|
|
158
|
-
\`USE*\` commitments enable capabilities (
|
|
158
|
+
\`USE*\` commitments enable capabilities (project integration, calendar, image generation, etc.).
|
|
159
159
|
They expose runtime tools and system-message guidance used during execution.
|
|
160
160
|
`),
|
|
161
161
|
},
|
|
@@ -209,16 +209,6 @@ export const englishBookLanguageManualDictionary: BookLanguageManualDictionary =
|
|
|
209
209
|
'`CLOSED` prevents conversational self-modification.',
|
|
210
210
|
],
|
|
211
211
|
},
|
|
212
|
-
'tool-using-browser-search-agent': {
|
|
213
|
-
title: 'Tool-using agent (Browser + Search engine)',
|
|
214
|
-
goal: 'Enable internet research with clear sourcing behavior.',
|
|
215
|
-
walkthrough: [
|
|
216
|
-
'`USE SEARCH ENGINE` provides web search tooling and optional search instructions.',
|
|
217
|
-
'`USE BROWSER` enables URL fetching and interactive browsing tools.',
|
|
218
|
-
'`RULE` commitments make reliability behavior explicit and repeatable.',
|
|
219
|
-
'This pattern is ideal for current-events and fact-checking agents.',
|
|
220
|
-
],
|
|
221
|
-
},
|
|
222
212
|
'rule-and-knowledge-agent': {
|
|
223
213
|
title: 'Agent with RULE and KNOWLEDGE',
|
|
224
214
|
goal: 'Ground responses in explicit constraints and curated sources.',
|
|
@@ -229,16 +219,6 @@ export const englishBookLanguageManualDictionary: BookLanguageManualDictionary =
|
|
|
229
219
|
'Use this pattern for compliance, support, and internal procedures.',
|
|
230
220
|
],
|
|
231
221
|
},
|
|
232
|
-
'memory-agent-with-long-term-memory': {
|
|
233
|
-
title: 'MEMORY agent with long-term memory',
|
|
234
|
-
goal: 'Persist user preferences across conversations.',
|
|
235
|
-
walkthrough: [
|
|
236
|
-
'`MEMORY` adds runtime memory tools and memory-specific system guidance.',
|
|
237
|
-
'`RULE` commitments narrow what should be remembered to reduce privacy risks.',
|
|
238
|
-
'In Agents Server, memory is runtime-backed and user-scoped.',
|
|
239
|
-
'Use this for assistants that must preserve context over time.',
|
|
240
|
-
],
|
|
241
|
-
},
|
|
242
222
|
'use-project-integration-agent': {
|
|
243
223
|
title: 'USE PROJECT external integration',
|
|
244
224
|
goal: 'Work with a GitHub repository through a connected project integration.',
|
|
@@ -283,7 +263,7 @@ export const englishBookLanguageManualDictionary: BookLanguageManualDictionary =
|
|
|
283
263
|
{
|
|
284
264
|
title: 'Unverifiable claims',
|
|
285
265
|
dont: 'The agent answers internet-dependent questions without tools or without citing sources.',
|
|
286
|
-
doInstead: 'Add `
|
|
266
|
+
doInstead: 'Add `KNOWLEDGE` sources and a citation-oriented `RULE`.',
|
|
287
267
|
},
|
|
288
268
|
{
|
|
289
269
|
title: 'Missing guardrails',
|
|
@@ -295,11 +275,6 @@ export const englishBookLanguageManualDictionary: BookLanguageManualDictionary =
|
|
|
295
275
|
dont: 'Using deep `FROM` chains without documenting why each parent is needed.',
|
|
296
276
|
doInstead: 'Keep inheritance shallow and use focused IMPORT/TEAM composition for reuse.',
|
|
297
277
|
},
|
|
298
|
-
{
|
|
299
|
-
title: 'Unsafe memory usage',
|
|
300
|
-
dont: 'Storing every detail in memory without boundaries.',
|
|
301
|
-
doInstead: 'Pair `MEMORY` with explicit rules about what is allowed to persist.',
|
|
302
|
-
},
|
|
303
278
|
],
|
|
304
279
|
tutorialSections: {
|
|
305
280
|
serverAgentsHint:
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Agent as AgentFromKit,
|
|
3
|
-
fileSearchTool,
|
|
4
|
-
run,
|
|
5
|
-
setDefaultOpenAIClient,
|
|
6
|
-
setDefaultOpenAIKey,
|
|
7
|
-
} from '@openai/agents';
|
|
1
|
+
import type { Agent as AgentFromKit } from '@openai/agents';
|
|
8
2
|
import { readFile } from 'fs/promises';
|
|
9
3
|
import { basename, resolve } from 'path';
|
|
10
4
|
import { fileURLToPath } from 'url';
|
|
@@ -17,6 +11,7 @@ import { computeOpenAiUsage } from '../llm-providers/openai/computeOpenAiUsage';
|
|
|
17
11
|
import { OPENAI_MODELS } from '../llm-providers/openai/openai-models';
|
|
18
12
|
import { OpenAiAgentKitExecutionToolsToolBuilder } from '../llm-providers/openai/OpenAiAgentKitExecutionToolsToolBuilder';
|
|
19
13
|
import { OpenAiVectorStoreHandler } from '../llm-providers/openai/OpenAiVectorStoreHandler';
|
|
14
|
+
import { loadOpenAiAgentsModule } from '../llm-providers/openai/utils/loadOpenAiAgentsModule';
|
|
20
15
|
import { $provideScriptingForNode } from '../scrapers/_common/register/$provideScriptingForNode';
|
|
21
16
|
import type { string_knowledge_source_link } from '../types/string_knowledge_source_content';
|
|
22
17
|
import type { string_markdown, string_markdown_text } from '../types/string_markdown';
|
|
@@ -112,6 +107,7 @@ export class LiteAgent {
|
|
|
112
107
|
const preparedAgent = await this.prepareAgent();
|
|
113
108
|
preparedAgent.toolBuilder?.clearRunState();
|
|
114
109
|
|
|
110
|
+
const { run } = await loadOpenAiAgentsModule();
|
|
115
111
|
const result = await run(
|
|
116
112
|
preparedAgent.agent,
|
|
117
113
|
createLiteAgentPromptText(normalizedMessage, options.context, preparedAgent.modelRequirements.promptSuffix),
|
|
@@ -165,6 +161,12 @@ export class LiteAgent {
|
|
|
165
161
|
userId: this.options.userId,
|
|
166
162
|
});
|
|
167
163
|
const client = await runtime.getClient();
|
|
164
|
+
const {
|
|
165
|
+
Agent: AgentFromKit,
|
|
166
|
+
fileSearchTool,
|
|
167
|
+
setDefaultOpenAIClient,
|
|
168
|
+
setDefaultOpenAIKey,
|
|
169
|
+
} = await loadOpenAiAgentsModule();
|
|
168
170
|
|
|
169
171
|
setDefaultOpenAIClient(client as TODO_any);
|
|
170
172
|
|
|
@@ -190,9 +192,9 @@ export class LiteAgent {
|
|
|
190
192
|
})
|
|
191
193
|
: null;
|
|
192
194
|
const agentTools =
|
|
193
|
-
toolBuilder?.buildAgentKitTools({
|
|
195
|
+
(await toolBuilder?.buildAgentKitTools({
|
|
194
196
|
tools: modelRequirements.tools ? [...modelRequirements.tools] : undefined,
|
|
195
|
-
}) || [];
|
|
197
|
+
})) || [];
|
|
196
198
|
const normalizedKnowledgeSources = await normalizeLiteAgentKnowledgeSources(
|
|
197
199
|
modelRequirements.knowledgeSources || [],
|
|
198
200
|
resolvedSource.sourceDirectoryPath,
|
|
@@ -162,7 +162,7 @@ function createCommitmentRegex(commitmentTypes: ReadonlyArray<string>): RegExp {
|
|
|
162
162
|
|
|
163
163
|
const commitmentPatterns = [...commitmentTypes]
|
|
164
164
|
.sort((a: string, b: string) => b.length - a.length)
|
|
165
|
-
.map((type: string) =>
|
|
165
|
+
.map((type: string) => type.replace(/\s+/, '\\s+'))
|
|
166
166
|
.join('|');
|
|
167
167
|
|
|
168
168
|
return new RegExp(`^\\s*(${commitmentPatterns})(?=\\s|$)`);
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { WindowLike as DomWindowLike } from 'dompurify';
|
|
2
|
+
import { spaceTrim } from 'spacetrim';
|
|
3
|
+
import { assertsError } from '../../../errors/assertsError';
|
|
4
|
+
import { EnvironmentMismatchError } from '../../../errors/EnvironmentMismatchError';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Shared DOM window reused by every render which happens outside of a browser
|
|
8
|
+
*
|
|
9
|
+
* @private utility of `$provideServerDomWindow`
|
|
10
|
+
*/
|
|
11
|
+
let serverDomWindow: DomWindowLike | null = null;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Provides a DOM `window` for runtimes which do not have one, for example Node.js during server-side rendering
|
|
15
|
+
*
|
|
16
|
+
* Note: `$` is used to indicate that this function is not a pure function - it creates and caches one shared DOM window
|
|
17
|
+
*
|
|
18
|
+
* @returns DOM window which can back a DOM-dependent library like `DOMPurify`
|
|
19
|
+
* @throws {EnvironmentMismatchError} When the current runtime can not create a DOM window
|
|
20
|
+
* @private utility of `renderMarkdown`
|
|
21
|
+
*/
|
|
22
|
+
export function $provideServerDomWindow(): DomWindowLike {
|
|
23
|
+
if (serverDomWindow === null) {
|
|
24
|
+
const { JSDOM } = requireServerDomLibrary();
|
|
25
|
+
serverDomWindow = new JSDOM('').window as unknown as DomWindowLike;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return serverDomWindow;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Loads `jsdom` which backs the DOM window outside of a browser
|
|
33
|
+
*
|
|
34
|
+
* Note: [😷] `jsdom` reaches for Node.js built-ins like `fs`, `child_process` and `net`, so browser bundlers must
|
|
35
|
+
* never follow the `require` below - even though it is unreachable in a browser, bundlers resolve it statically.
|
|
36
|
+
* They are told to replace `jsdom` with an empty module by the `browser` field of the generated package
|
|
37
|
+
* manifests, which is written by `applyBrowserUnsupportedDependencyStubs` during the package generation.
|
|
38
|
+
*
|
|
39
|
+
* @returns The `jsdom` library
|
|
40
|
+
* @throws {EnvironmentMismatchError} When `jsdom` can not be loaded in the current runtime
|
|
41
|
+
* @private utility of `$provideServerDomWindow`
|
|
42
|
+
*/
|
|
43
|
+
function requireServerDomLibrary(): typeof import('jsdom') {
|
|
44
|
+
let serverDomLibrary: Partial<typeof import('jsdom')> | null = null;
|
|
45
|
+
let serverDomLibraryError: Error | null = null;
|
|
46
|
+
|
|
47
|
+
try {
|
|
48
|
+
// Note: [😷] Keep `'jsdom'` written as a literal, bundlers do not replace a computed module name
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
50
|
+
serverDomLibrary = require('jsdom') as typeof import('jsdom');
|
|
51
|
+
} catch (error) {
|
|
52
|
+
assertsError(error);
|
|
53
|
+
serverDomLibraryError = error;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (typeof serverDomLibrary?.JSDOM !== 'function') {
|
|
57
|
+
throw new EnvironmentMismatchError(
|
|
58
|
+
spaceTrim(
|
|
59
|
+
(block) => `
|
|
60
|
+
Markdown can not be rendered because there is no DOM in the current runtime.
|
|
61
|
+
|
|
62
|
+
Rendered markdown is sanitized through \`DOMPurify\`, which needs a DOM - the DOM of the browser
|
|
63
|
+
when the code runs in a browser and \`jsdom\` in every other runtime, for example during
|
|
64
|
+
server-side rendering in **Node.js**.
|
|
65
|
+
|
|
66
|
+
${block(
|
|
67
|
+
serverDomLibraryError === null
|
|
68
|
+
? 'The `jsdom` module was resolved but it does not export `JSDOM`, which happens when a bundler replaces `jsdom` with an empty module in a build which is neither a browser build nor a Node.js build.'
|
|
69
|
+
: `${serverDomLibraryError.name}: ${serverDomLibraryError.message}`,
|
|
70
|
+
)}
|
|
71
|
+
`,
|
|
72
|
+
),
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return serverDomLibrary as typeof import('jsdom');
|
|
77
|
+
}
|
|
@@ -9,6 +9,7 @@ import type { Converter as ShowdownConverter } from 'showdown';
|
|
|
9
9
|
import showdown from 'showdown';
|
|
10
10
|
import type { string_html, string_markdown } from '../../../types/string_markdown';
|
|
11
11
|
import { TODO_USE } from '../../../utils/organization/TODO_USE';
|
|
12
|
+
import { $provideServerDomWindow } from './$provideServerDomWindow';
|
|
12
13
|
import { createCitationMarkerRegex, parseCitationMarker } from './parseCitationMarker';
|
|
13
14
|
|
|
14
15
|
/**
|
|
@@ -218,13 +219,6 @@ let browserMarkdownSanitizer: DomPurifyInstance | null = null;
|
|
|
218
219
|
*/
|
|
219
220
|
let serverMarkdownSanitizer: DomPurifyInstance | null = null;
|
|
220
221
|
|
|
221
|
-
/**
|
|
222
|
-
* Shared JSDOM window backing the server-side DOMPurify instance.
|
|
223
|
-
*
|
|
224
|
-
* @private utility of `renderMarkdown`
|
|
225
|
-
*/
|
|
226
|
-
let serverMarkdownSanitizerWindow: DomPurifyWindowLike | null = null;
|
|
227
|
-
|
|
228
222
|
/**
|
|
229
223
|
* Pattern matching CODE FENCE.
|
|
230
224
|
*/
|
|
@@ -546,21 +540,6 @@ function createMarkdownSanitizer(sanitizerWindow: DomPurifyWindowLike): DomPurif
|
|
|
546
540
|
return markdownSanitizer;
|
|
547
541
|
}
|
|
548
542
|
|
|
549
|
-
/**
|
|
550
|
-
* Lazily creates the JSDOM window used by server-side markdown sanitization.
|
|
551
|
-
*
|
|
552
|
-
* @private utility of `renderMarkdown`
|
|
553
|
-
*/
|
|
554
|
-
function getServerMarkdownSanitizerWindow(): DomPurifyWindowLike {
|
|
555
|
-
if (!serverMarkdownSanitizerWindow) {
|
|
556
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
557
|
-
const { JSDOM } = require('jsdom') as typeof import('jsdom');
|
|
558
|
-
serverMarkdownSanitizerWindow = new JSDOM('').window as unknown as DomPurifyWindowLike;
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
return serverMarkdownSanitizerWindow;
|
|
562
|
-
}
|
|
563
|
-
|
|
564
543
|
/**
|
|
565
544
|
* Returns the shared DOMPurify instance appropriate for the current runtime.
|
|
566
545
|
*
|
|
@@ -573,7 +552,7 @@ function getMarkdownSanitizer(): DomPurifyInstance {
|
|
|
573
552
|
return browserMarkdownSanitizer;
|
|
574
553
|
}
|
|
575
554
|
|
|
576
|
-
serverMarkdownSanitizer ??= createMarkdownSanitizer(
|
|
555
|
+
serverMarkdownSanitizer ??= createMarkdownSanitizer($provideServerDomWindow());
|
|
577
556
|
|
|
578
557
|
return serverMarkdownSanitizer;
|
|
579
558
|
}
|
package/src/cli/cli-commands/agents-server/buildAgentsServer/createAgentsServerRuntimeEnvironment.ts
CHANGED
|
@@ -22,6 +22,14 @@ export const PTBK_AGENTS_SERVER_BUILD_WORKER_COUNT_ENV = 'PTBK_AGENTS_SERVER_BUI
|
|
|
22
22
|
*/
|
|
23
23
|
export const PTBK_AGENTS_SERVER_IGNORE_NEXT_VALIDATION_ENV = 'PTBK_AGENTS_SERVER_IGNORE_NEXT_VALIDATION';
|
|
24
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Environment variable that disables throwaway webpack filesystem caches for CLI-owned production builds.
|
|
27
|
+
*
|
|
28
|
+
* @private internal constant of `buildAgentsServer`
|
|
29
|
+
*/
|
|
30
|
+
export const PTBK_AGENTS_SERVER_DISABLE_WEBPACK_FILESYSTEM_CACHE_ENV =
|
|
31
|
+
'PTBK_AGENTS_SERVER_DISABLE_WEBPACK_FILESYSTEM_CACHE';
|
|
32
|
+
|
|
25
33
|
/**
|
|
26
34
|
* Conservative Next.js build worker count used by CLI-owned Agents Server production builds.
|
|
27
35
|
*
|
|
@@ -41,6 +49,7 @@ export function createAgentsServerRuntimeEnvironment(
|
|
|
41
49
|
nodeModulesPath: string,
|
|
42
50
|
options: {
|
|
43
51
|
readonly isNextValidationIgnored?: boolean;
|
|
52
|
+
readonly isWebpackFilesystemCacheDisabled?: boolean;
|
|
44
53
|
} = {},
|
|
45
54
|
): NodeJS.ProcessEnv {
|
|
46
55
|
return {
|
|
@@ -54,6 +63,11 @@ export function createAgentsServerRuntimeEnvironment(
|
|
|
54
63
|
[PTBK_AGENTS_SERVER_IGNORE_NEXT_VALIDATION_ENV]: 'true',
|
|
55
64
|
}
|
|
56
65
|
: {}),
|
|
66
|
+
...(options.isWebpackFilesystemCacheDisabled
|
|
67
|
+
? {
|
|
68
|
+
[PTBK_AGENTS_SERVER_DISABLE_WEBPACK_FILESYSTEM_CACHE_ENV]: 'true',
|
|
69
|
+
}
|
|
70
|
+
: {}),
|
|
57
71
|
};
|
|
58
72
|
}
|
|
59
73
|
|
|
@@ -30,6 +30,7 @@ export async function ensureAgentsServerBuild(
|
|
|
30
30
|
});
|
|
31
31
|
const buildEnvironment = createAgentsServerRuntimeEnvironment(environment, preparedRuntime.nodeModulesPath, {
|
|
32
32
|
isNextValidationIgnored: preparedRuntime.isAppPathMaterialized,
|
|
33
|
+
isWebpackFilesystemCacheDisabled: true,
|
|
33
34
|
});
|
|
34
35
|
|
|
35
36
|
if (
|
|
@@ -4,12 +4,18 @@ import type {
|
|
|
4
4
|
} from 'commander';
|
|
5
5
|
import { mkdirSync, writeFileSync } from 'fs';
|
|
6
6
|
import { join } from 'path';
|
|
7
|
-
import prompts from 'prompts';
|
|
8
7
|
import { spaceTrim } from 'spacetrim';
|
|
9
8
|
import { NotAllowed } from '../../../errors/NotAllowed';
|
|
10
9
|
import { ParseError } from '../../../errors/ParseError';
|
|
11
10
|
import { normalizeToKebabCase } from '../../../utils/normalization/normalize-to-kebab-case';
|
|
12
11
|
import type { $side_effect } from '../../../utils/organization/$side_effect';
|
|
12
|
+
import { loadPromptsModule } from '../../common/loadPromptsModule';
|
|
13
|
+
import type { CoderGitSyncCliOptions } from '../common/coderGitSyncCliOptions';
|
|
14
|
+
import {
|
|
15
|
+
addCoderGitSyncOptions,
|
|
16
|
+
CODER_GIT_SYNC_DESCRIPTION,
|
|
17
|
+
normalizeCoderGitSyncCliOptions,
|
|
18
|
+
} from '../common/coderGitSyncCliOptions';
|
|
13
19
|
import { handleActionErrors } from '../common/handleActionErrors';
|
|
14
20
|
import {
|
|
15
21
|
buildCoderPromptSection,
|
|
@@ -49,15 +55,19 @@ const FALLBACK_PROMPT_SLUG = 'prompt';
|
|
|
49
55
|
export function $initializeCoderAddCommand(program: Program): $side_effect {
|
|
50
56
|
const command = program.command('add');
|
|
51
57
|
command.description(
|
|
52
|
-
spaceTrim(
|
|
53
|
-
|
|
58
|
+
spaceTrim(
|
|
59
|
+
(block) => `
|
|
60
|
+
Add one ready-to-run prompt file to the queue
|
|
54
61
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
Provide the description as an argument, pipe it through stdin, or run without arguments to type it interactively:
|
|
63
|
+
- \`ptbk coder add "some new feature"\`
|
|
64
|
+
- \`ptbk coder add --priority 1 "some new feature"\`
|
|
65
|
+
- \`ptbk coder add <<EOF ... EOF\`
|
|
66
|
+
- \`ptbk coder add\`
|
|
67
|
+
|
|
68
|
+
${block(CODER_GIT_SYNC_DESCRIPTION)}
|
|
69
|
+
`,
|
|
70
|
+
),
|
|
61
71
|
);
|
|
62
72
|
|
|
63
73
|
command.argument('[description]', 'Plain-language description of the feature or task to implement');
|
|
@@ -77,22 +87,39 @@ export function $initializeCoderAddCommand(program: Program): $side_effect {
|
|
|
77
87
|
.join(', ')}) or a markdown file path relative to the current project root.
|
|
78
88
|
`),
|
|
79
89
|
);
|
|
90
|
+
addCoderGitSyncOptions(command);
|
|
80
91
|
|
|
81
92
|
command.action(
|
|
82
93
|
handleActionErrors(async (descriptionArgument: string | undefined, cliOptions) => {
|
|
83
94
|
const { priority, template: templateOption } = cliOptions as {
|
|
84
95
|
readonly priority: number;
|
|
85
96
|
readonly template?: string;
|
|
86
|
-
};
|
|
97
|
+
} & CoderGitSyncCliOptions;
|
|
98
|
+
|
|
99
|
+
const gitSync = normalizeCoderGitSyncCliOptions(cliOptions as CoderGitSyncCliOptions);
|
|
100
|
+
const projectPath = process.cwd();
|
|
87
101
|
|
|
88
102
|
const description = await resolveCoderPromptDescription(descriptionArgument);
|
|
89
103
|
|
|
90
|
-
|
|
91
|
-
|
|
104
|
+
// Note: Import the git synchronization dynamically to keep the CLI fast for runs without `--commit`
|
|
105
|
+
const { $commitCoderChanges, $pullCoderChanges } = await import(
|
|
106
|
+
'../../../../scripts/run-codex-prompts/git/coderGitSync'
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
await $pullCoderChanges({ gitSync, projectPath });
|
|
110
|
+
|
|
111
|
+
const { /* filePath,*/ emojiTag } = await addCoderPrompt({
|
|
112
|
+
projectPath,
|
|
92
113
|
description,
|
|
93
114
|
priority,
|
|
94
115
|
templateOption,
|
|
95
116
|
});
|
|
117
|
+
|
|
118
|
+
await $commitCoderChanges({
|
|
119
|
+
gitSync,
|
|
120
|
+
projectPath,
|
|
121
|
+
commitMessage: `${emojiTag} Add prompt`,
|
|
122
|
+
});
|
|
96
123
|
}),
|
|
97
124
|
);
|
|
98
125
|
}
|
|
@@ -216,6 +243,7 @@ async function resolveCoderPromptDescription(descriptionArgument: string | undef
|
|
|
216
243
|
return standardInputDescription;
|
|
217
244
|
}
|
|
218
245
|
|
|
246
|
+
const { default: prompts } = await loadPromptsModule();
|
|
219
247
|
const response = await prompts({
|
|
220
248
|
type: 'text',
|
|
221
249
|
name: 'description',
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { spaceTrim } from 'spacetrim';
|
|
2
|
+
import { NotAllowed } from '../../../errors/NotAllowed';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Separator between the number of generated files and the number of prompts in each of them,
|
|
6
|
+
* for example `10*7`.
|
|
7
|
+
*
|
|
8
|
+
* @private internal utility of `ptbk coder`
|
|
9
|
+
*/
|
|
10
|
+
const BOILERPLATE_COUNT_SEPARATOR = '*';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Pattern of the `--count` option value, either `N` or `N*M`.
|
|
14
|
+
*/
|
|
15
|
+
const BOILERPLATE_COUNT_PATTERN = /^(?<filesCount>\d+)(?:\s*\*\s*(?<promptsPerFileCount>\d+))?$/u;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* How many prompt boilerplate files are generated and how many prompts each of them contains.
|
|
19
|
+
*
|
|
20
|
+
* @private internal utility of `ptbk coder`
|
|
21
|
+
*/
|
|
22
|
+
export type BoilerplateCount = {
|
|
23
|
+
/**
|
|
24
|
+
* Number of generated prompt boilerplate files.
|
|
25
|
+
*/
|
|
26
|
+
readonly filesCount: number;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Number of prompts written into each generated file.
|
|
30
|
+
*
|
|
31
|
+
* Note: More than one prompt per file is an advanced option - each prompt is one separate
|
|
32
|
+
* coding task separated by `---` and tagged with its own fresh emoji tag.
|
|
33
|
+
*/
|
|
34
|
+
readonly promptsPerFileCount: number;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Number of prompt boilerplate files and prompts per file used when `--count` is not provided.
|
|
39
|
+
*
|
|
40
|
+
* @private internal utility of `ptbk coder`
|
|
41
|
+
*/
|
|
42
|
+
export const DEFAULT_BOILERPLATE_COUNT: BoilerplateCount = {
|
|
43
|
+
filesCount: 5,
|
|
44
|
+
promptsPerFileCount: 1,
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Formats one boilerplate count back into the `N*M` notation of the `--count` option.
|
|
49
|
+
*
|
|
50
|
+
* @private internal utility of `ptbk coder`
|
|
51
|
+
*/
|
|
52
|
+
export function formatBoilerplateCount({ filesCount, promptsPerFileCount }: BoilerplateCount): string {
|
|
53
|
+
return `${filesCount}${BOILERPLATE_COUNT_SEPARATOR}${promptsPerFileCount}`;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Default value of the `--count` option rendered in the `N*M` notation, for example `5*1`.
|
|
58
|
+
*
|
|
59
|
+
* @private internal utility of `ptbk coder`
|
|
60
|
+
*/
|
|
61
|
+
export const DEFAULT_BOILERPLATE_COUNT_OPTION_VALUE = formatBoilerplateCount(DEFAULT_BOILERPLATE_COUNT);
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Description of the `--count` option shared by all commands which generate prompt boilerplates.
|
|
65
|
+
*
|
|
66
|
+
* @private internal utility of `ptbk coder`
|
|
67
|
+
*/
|
|
68
|
+
export const BOILERPLATE_COUNT_OPTION_DESCRIPTION = spaceTrim(`
|
|
69
|
+
Number of generated prompt boilerplate files, optionally with the number of prompts in each of them.
|
|
70
|
+
|
|
71
|
+
Use \`N\` (or \`N*1\`) for N files with one prompt each,
|
|
72
|
+
or the advanced \`N*M\` notation for N files with M prompts each, for example \`10*7\`.
|
|
73
|
+
`);
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Parses the `--count` option value into the number of files and the number of prompts in each of them.
|
|
77
|
+
*
|
|
78
|
+
* Both notations are supported:
|
|
79
|
+
* - `N` and `N*1` => N files with one prompt each
|
|
80
|
+
* - `N*M` => N files with M prompts each
|
|
81
|
+
*
|
|
82
|
+
* @private internal utility of `ptbk coder`
|
|
83
|
+
*/
|
|
84
|
+
export function parseBoilerplateCount(countOption: string): BoilerplateCount {
|
|
85
|
+
const normalizedCountOption = countOption.trim();
|
|
86
|
+
const match = BOILERPLATE_COUNT_PATTERN.exec(normalizedCountOption);
|
|
87
|
+
|
|
88
|
+
if (match === null) {
|
|
89
|
+
throw new NotAllowed(
|
|
90
|
+
spaceTrim(`
|
|
91
|
+
Invalid value for \`--count\`: \`${countOption}\`.
|
|
92
|
+
|
|
93
|
+
Use either \`N\` for N files with one prompt each,
|
|
94
|
+
or the advanced \`N*M\` notation for N files with M prompts each:
|
|
95
|
+
|
|
96
|
+
- \`--count 5\`
|
|
97
|
+
- \`--count 5*1\`
|
|
98
|
+
- \`--count 10*7\`
|
|
99
|
+
`),
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const filesCount = Number(match.groups?.filesCount);
|
|
104
|
+
const promptsPerFileCount =
|
|
105
|
+
match.groups?.promptsPerFileCount === undefined
|
|
106
|
+
? DEFAULT_BOILERPLATE_COUNT.promptsPerFileCount
|
|
107
|
+
: Number(match.groups.promptsPerFileCount);
|
|
108
|
+
|
|
109
|
+
assertsPositiveBoilerplateCountPart(filesCount, countOption, 'number of generated files');
|
|
110
|
+
assertsPositiveBoilerplateCountPart(promptsPerFileCount, countOption, 'number of prompts in each file');
|
|
111
|
+
|
|
112
|
+
return { filesCount, promptsPerFileCount };
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Asserts that one part of the `--count` option value is a positive integer.
|
|
117
|
+
*
|
|
118
|
+
* @private internal utility of `parseBoilerplateCount`
|
|
119
|
+
*/
|
|
120
|
+
function assertsPositiveBoilerplateCountPart(
|
|
121
|
+
countPart: number,
|
|
122
|
+
countOption: string,
|
|
123
|
+
countPartDescription: string,
|
|
124
|
+
): void {
|
|
125
|
+
if (Number.isInteger(countPart) && countPart > 0) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
throw new NotAllowed(
|
|
130
|
+
spaceTrim(`
|
|
131
|
+
Invalid value for \`--count\`: \`${countOption}\`.
|
|
132
|
+
|
|
133
|
+
The ${countPartDescription} must be **a positive integer**, for example \`--count 10*7\`.
|
|
134
|
+
`),
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Note: [🟡] Code for coder boilerplate count [boilerplateCount](src/cli/cli-commands/coder/boilerplateCount.ts) should never be published outside of `@promptbook/cli`
|
|
139
|
+
// Note: [💞] Ignore a discrepancy between file name and exported helper names
|