@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
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { spaceTrim } from 'spacetrim';
|
|
2
|
-
import { EnvironmentMismatchError } from '../../errors/EnvironmentMismatchError';
|
|
3
|
-
import type { ToolFunction } from '../../scripting/javascript/JavascriptExecutionToolsOptions';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Resolves the server-side `spawn_agent` tool for Node.js runtimes.
|
|
7
|
-
*
|
|
8
|
-
* Uses lazy require so core package can load outside Agents Server.
|
|
9
|
-
*
|
|
10
|
-
* @private internal utility for USE SPAWN commitment
|
|
11
|
-
*/
|
|
12
|
-
export function resolveSpawnAgentToolForNode(): ToolFunction {
|
|
13
|
-
try {
|
|
14
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
15
|
-
const { spawn_agent } = require('../../../apps/agents-server/src/tools/spawn_agent');
|
|
16
|
-
|
|
17
|
-
if (typeof spawn_agent !== 'function') {
|
|
18
|
-
throw new Error('spawn_agent value is not a function but ' + typeof spawn_agent);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return spawn_agent as ToolFunction;
|
|
22
|
-
} catch (error) {
|
|
23
|
-
const normalizedError =
|
|
24
|
-
error instanceof Error
|
|
25
|
-
? error
|
|
26
|
-
: new Error(typeof error === 'string' ? error : JSON.stringify(error ?? 'Unknown error'));
|
|
27
|
-
|
|
28
|
-
return async () => {
|
|
29
|
-
throw new EnvironmentMismatchError(
|
|
30
|
-
spaceTrim(
|
|
31
|
-
(block) => `
|
|
32
|
-
\`spawn_agent\` tool is not available in this environment.
|
|
33
|
-
This commitment requires Agents Server runtime with agent persistence enabled.
|
|
34
|
-
|
|
35
|
-
${normalizedError.name}:
|
|
36
|
-
${block(normalizedError.message)}
|
|
37
|
-
`,
|
|
38
|
-
),
|
|
39
|
-
);
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Browser-safe wrapper for spawning one persisted Agents Server agent.
|
|
3
|
-
*
|
|
4
|
-
* This function proxies requests to the Agents Server `/api/spawn-agent` endpoint.
|
|
5
|
-
*
|
|
6
|
-
* @param args Tool payload forwarded to server-side `spawn_agent` tool.
|
|
7
|
-
* @param agentsServerUrl Optional explicit agents server base URL.
|
|
8
|
-
* @returns JSON string with structured spawn result.
|
|
9
|
-
*
|
|
10
|
-
* @private internal utility for USE SPAWN commitment
|
|
11
|
-
*/
|
|
12
|
-
export async function spawnAgentViaBrowser(args: Record<string, unknown>, agentsServerUrl?: string): Promise<string> {
|
|
13
|
-
try {
|
|
14
|
-
const baseUrl = agentsServerUrl || (typeof window !== 'undefined' ? window.location.origin : '');
|
|
15
|
-
|
|
16
|
-
if (!baseUrl) {
|
|
17
|
-
throw new Error('Agents server URL is required in non-browser environments');
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const apiUrl = new URL('/api/spawn-agent', baseUrl);
|
|
21
|
-
|
|
22
|
-
const response = await fetch(apiUrl.toString(), {
|
|
23
|
-
method: 'POST',
|
|
24
|
-
headers: {
|
|
25
|
-
'Content-Type': 'application/json',
|
|
26
|
-
},
|
|
27
|
-
body: JSON.stringify(args),
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
const payload = (await response.json().catch(() => ({}))) as {
|
|
31
|
-
success?: boolean;
|
|
32
|
-
result?: unknown;
|
|
33
|
-
error?: unknown;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
if (payload.result !== undefined) {
|
|
37
|
-
return typeof payload.result === 'string' ? payload.result : JSON.stringify(payload.result);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if (!response.ok || payload.success === false) {
|
|
41
|
-
throw new Error(
|
|
42
|
-
`Failed to spawn agent: ${typeof payload.error === 'string' ? payload.error : response.statusText}`,
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
return JSON.stringify(payload);
|
|
46
|
-
} catch (error) {
|
|
47
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
48
|
-
throw new Error(`Error spawning agent via browser: ${errorMessage}`);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import { spaceTrim } from 'spacetrim';
|
|
2
|
-
import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
|
|
3
|
-
import type { ToolFunction } from '../../scripting/javascript/JavascriptExecutionToolsOptions';
|
|
4
|
-
import type { string_javascript_name } from '../../types/string_person_fullname';
|
|
5
|
-
import type { TODO_any } from '../../utils/organization/TODO_any';
|
|
6
|
-
import { appendAggregatedUseCommitmentPlaceholder } from '../USE/aggregateUseCommitmentSystemMessages';
|
|
7
|
-
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* USE TIME commitment definition
|
|
11
|
-
*
|
|
12
|
-
* The `USE TIME` commitment indicates that the agent should be able to determine the current date and time.
|
|
13
|
-
*
|
|
14
|
-
* Example usage in agent source:
|
|
15
|
-
*
|
|
16
|
-
* ```book
|
|
17
|
-
* USE TIME
|
|
18
|
-
* USE TIME Prefer the user's local timezone.
|
|
19
|
-
* ```
|
|
20
|
-
*
|
|
21
|
-
* @private [🪔] Maybe export the commitments through some package
|
|
22
|
-
*/
|
|
23
|
-
export class UseTimeCommitmentDefinition extends BaseCommitmentDefinition<'USE TIME'> {
|
|
24
|
-
public constructor() {
|
|
25
|
-
super('USE TIME', ['CURRENT TIME', 'TIME', 'DATE']);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
override get requiresContent(): boolean {
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Short one-line description of USE TIME.
|
|
34
|
-
*/
|
|
35
|
-
public get description(): string {
|
|
36
|
-
return 'Enable the agent to determine the current date and time.';
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Icon for this commitment.
|
|
41
|
-
*/
|
|
42
|
-
get icon(): string {
|
|
43
|
-
return '🕒';
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Markdown documentation for USE TIME commitment.
|
|
48
|
-
*/
|
|
49
|
-
get documentation(): string {
|
|
50
|
-
return spaceTrim(`
|
|
51
|
-
# USE TIME
|
|
52
|
-
|
|
53
|
-
Enables the agent to determine the current date and time.
|
|
54
|
-
|
|
55
|
-
## Key aspects
|
|
56
|
-
|
|
57
|
-
- This tool won't receive any input.
|
|
58
|
-
- It outputs the current date and time as an ISO 8601 string.
|
|
59
|
-
- Allows the agent to answer questions about the current time or date.
|
|
60
|
-
- The content following \`USE TIME\` is an arbitrary text that the agent should know (e.g. timezone preference).
|
|
61
|
-
|
|
62
|
-
## Examples
|
|
63
|
-
|
|
64
|
-
\`\`\`book
|
|
65
|
-
Time-aware Assistant
|
|
66
|
-
|
|
67
|
-
PERSONA You are a helpful assistant who knows the current time.
|
|
68
|
-
USE TIME
|
|
69
|
-
\`\`\`
|
|
70
|
-
|
|
71
|
-
\`\`\`book
|
|
72
|
-
Travel Assistant
|
|
73
|
-
|
|
74
|
-
PERSONA You help travelers with planning.
|
|
75
|
-
USE TIME Prefer the user's local timezone.
|
|
76
|
-
\`\`\`
|
|
77
|
-
`);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements {
|
|
81
|
-
// Additional instructions are aggregated later in the final USE system-message pass.
|
|
82
|
-
void content;
|
|
83
|
-
|
|
84
|
-
// Get existing tools array or create new one
|
|
85
|
-
const existingTools = requirements.tools || [];
|
|
86
|
-
|
|
87
|
-
// Add 'get_current_time' to tools if not already present
|
|
88
|
-
const updatedTools = existingTools.some((tool) => tool.name === 'get_current_time')
|
|
89
|
-
? existingTools
|
|
90
|
-
: [
|
|
91
|
-
...existingTools,
|
|
92
|
-
{
|
|
93
|
-
name: 'get_current_time',
|
|
94
|
-
description: 'Get the current date and time in ISO 8601 format.',
|
|
95
|
-
parameters: {
|
|
96
|
-
type: 'object',
|
|
97
|
-
properties: {
|
|
98
|
-
timezone: {
|
|
99
|
-
type: 'string',
|
|
100
|
-
description:
|
|
101
|
-
'Optional timezone name (e.g. "Europe/Prague", "UTC", "America/New_York").',
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
required: [],
|
|
105
|
-
},
|
|
106
|
-
} as TODO_any, // <- TODO: !!!! Remove any
|
|
107
|
-
// <- TODO: !!!! define the function in LLM tools
|
|
108
|
-
];
|
|
109
|
-
|
|
110
|
-
return appendAggregatedUseCommitmentPlaceholder(
|
|
111
|
-
{
|
|
112
|
-
...requirements,
|
|
113
|
-
tools: updatedTools,
|
|
114
|
-
_metadata: {
|
|
115
|
-
...requirements._metadata,
|
|
116
|
-
},
|
|
117
|
-
},
|
|
118
|
-
this.type,
|
|
119
|
-
);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Gets human-readable titles for tool functions provided by this commitment.
|
|
124
|
-
*/
|
|
125
|
-
getToolTitles(): Record<string_javascript_name, string> {
|
|
126
|
-
return {
|
|
127
|
-
get_current_time: 'Get current time',
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Gets the `get_current_time` tool function implementation.
|
|
133
|
-
*/
|
|
134
|
-
getToolFunctions(): Record<string_javascript_name, ToolFunction> {
|
|
135
|
-
return {
|
|
136
|
-
async get_current_time(args: { timezone?: string }): Promise<string> {
|
|
137
|
-
console.log('!!!! [Tool] get_current_time called', { args });
|
|
138
|
-
|
|
139
|
-
const { timezone } = args;
|
|
140
|
-
|
|
141
|
-
if (!timezone) {
|
|
142
|
-
return new Date().toISOString();
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
try {
|
|
146
|
-
// Note: Returning ISO 8601 string but in the requested timezone
|
|
147
|
-
const formatter = new Intl.DateTimeFormat('en-CA', {
|
|
148
|
-
timeZone: timezone,
|
|
149
|
-
year: 'numeric',
|
|
150
|
-
month: '2-digit',
|
|
151
|
-
day: '2-digit',
|
|
152
|
-
hour: '2-digit',
|
|
153
|
-
minute: '2-digit',
|
|
154
|
-
second: '2-digit',
|
|
155
|
-
hour12: false,
|
|
156
|
-
timeZoneName: 'shortOffset',
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
const parts = formatter.formatToParts(new Date());
|
|
160
|
-
const part = (type: string) => parts.find((p) => p.type === type)?.value;
|
|
161
|
-
|
|
162
|
-
// en-CA format is YYYY-MM-DD
|
|
163
|
-
const isoString = `${part('year')}-${part('month')}-${part('day')}T${part('hour')}:${part(
|
|
164
|
-
'minute',
|
|
165
|
-
)}:${part('second')}${part('timeZoneName')?.replace('GMT', '')}`;
|
|
166
|
-
|
|
167
|
-
return isoString;
|
|
168
|
-
} catch (error) {
|
|
169
|
-
// Fallback to UTC if timezone is invalid
|
|
170
|
-
return new Date().toISOString();
|
|
171
|
-
}
|
|
172
|
-
},
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { string_javascript_name } from '../../types/string_person_fullname';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Tool names provided by the `USE TIMEOUT` commitment.
|
|
5
|
-
*
|
|
6
|
-
* @private internal USE TIMEOUT constant
|
|
7
|
-
*/
|
|
8
|
-
export const TimeoutToolNames = {
|
|
9
|
-
set: 'set_timeout' as string_javascript_name,
|
|
10
|
-
cancel: 'cancel_timeout' as string_javascript_name,
|
|
11
|
-
list: 'list_timeouts' as string_javascript_name,
|
|
12
|
-
update: 'update_timeout' as string_javascript_name,
|
|
13
|
-
} as const;
|
|
@@ -1,255 +0,0 @@
|
|
|
1
|
-
import type { TODO_any } from '../../utils/organization/TODO_any';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Tool arguments for scheduling one timeout.
|
|
5
|
-
*
|
|
6
|
-
* @private type of UseTimeoutCommitmentDefinition
|
|
7
|
-
*/
|
|
8
|
-
export type SetTimeoutToolArgs = {
|
|
9
|
-
milliseconds?: number;
|
|
10
|
-
message?: string;
|
|
11
|
-
[key: string]: TODO_any;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Tool arguments for cancelling one timeout.
|
|
16
|
-
*
|
|
17
|
-
* @private type of UseTimeoutCommitmentDefinition
|
|
18
|
-
*/
|
|
19
|
-
export type CancelTimeoutToolArgs = {
|
|
20
|
-
timeoutId?: string;
|
|
21
|
-
allActive?: boolean;
|
|
22
|
-
[key: string]: TODO_any;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Tool arguments for updating one timeout or pausing/resuming all active queued timeouts.
|
|
27
|
-
*
|
|
28
|
-
* @private type of UseTimeoutCommitmentDefinition
|
|
29
|
-
*/
|
|
30
|
-
export type UpdateTimeoutToolArgs = {
|
|
31
|
-
timeoutId?: string;
|
|
32
|
-
allActive?: boolean;
|
|
33
|
-
dueAt?: string;
|
|
34
|
-
extendByMs?: number;
|
|
35
|
-
recurrenceIntervalMs?: number | null;
|
|
36
|
-
message?: string | null;
|
|
37
|
-
parameters?: Record<string, unknown>;
|
|
38
|
-
paused?: boolean;
|
|
39
|
-
[key: string]: TODO_any;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Tool arguments for listing scoped timeouts.
|
|
44
|
-
*
|
|
45
|
-
* @private type of UseTimeoutCommitmentDefinition
|
|
46
|
-
*/
|
|
47
|
-
export type ListTimeoutsToolArgs = {
|
|
48
|
-
includeFinished?: boolean;
|
|
49
|
-
limit?: number;
|
|
50
|
-
[key: string]: TODO_any;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Runtime context available to `USE TIMEOUT` tools.
|
|
55
|
-
*
|
|
56
|
-
* @private type of UseTimeoutCommitmentDefinition
|
|
57
|
-
*/
|
|
58
|
-
export type TimeoutToolRuntimeContext = {
|
|
59
|
-
readonly enabled: boolean;
|
|
60
|
-
readonly chatId?: string;
|
|
61
|
-
readonly userId?: number;
|
|
62
|
-
readonly agentId?: string;
|
|
63
|
-
readonly agentName?: string;
|
|
64
|
-
readonly promptParameters: Record<string, string>;
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Lifecycle status exposed by `list_timeouts`.
|
|
69
|
-
*
|
|
70
|
-
* @private type of UseTimeoutCommitmentDefinition
|
|
71
|
-
*/
|
|
72
|
-
export type TimeoutToolListItemStatus = 'QUEUED' | 'RUNNING' | 'COMPLETED' | 'FAILED' | 'CANCELLED';
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* One timeout row exposed by `list_timeouts`.
|
|
76
|
-
*
|
|
77
|
-
* @private type of UseTimeoutCommitmentDefinition
|
|
78
|
-
*/
|
|
79
|
-
export type TimeoutToolListItem = {
|
|
80
|
-
timeoutId: string;
|
|
81
|
-
chatId: string;
|
|
82
|
-
status: TimeoutToolListItemStatus;
|
|
83
|
-
dueAt: string;
|
|
84
|
-
paused: boolean;
|
|
85
|
-
message?: string | null;
|
|
86
|
-
recurrenceIntervalMs?: number | null;
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Result payload returned by `set_timeout`.
|
|
91
|
-
*
|
|
92
|
-
* @private type of UseTimeoutCommitmentDefinition
|
|
93
|
-
*/
|
|
94
|
-
export type SetTimeoutToolResult = {
|
|
95
|
-
action: 'set';
|
|
96
|
-
status: 'set' | 'disabled' | 'error';
|
|
97
|
-
timeoutId?: string;
|
|
98
|
-
dueAt?: string;
|
|
99
|
-
message?: string;
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Result payload returned by `cancel_timeout`.
|
|
104
|
-
*
|
|
105
|
-
* @private type of UseTimeoutCommitmentDefinition
|
|
106
|
-
*/
|
|
107
|
-
export type CancelTimeoutToolResult = {
|
|
108
|
-
action: 'cancel';
|
|
109
|
-
status: 'cancelled' | 'cancelled_all' | 'not_found' | 'disabled' | 'error';
|
|
110
|
-
timeoutId?: string;
|
|
111
|
-
dueAt?: string;
|
|
112
|
-
cancelledCount?: number;
|
|
113
|
-
cancelledTimeoutIds?: Array<string>;
|
|
114
|
-
hasMore?: boolean;
|
|
115
|
-
message?: string;
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Result payload returned by `update_timeout`.
|
|
120
|
-
*
|
|
121
|
-
* @private type of UseTimeoutCommitmentDefinition
|
|
122
|
-
*/
|
|
123
|
-
export type UpdateTimeoutToolResult = {
|
|
124
|
-
action: 'update';
|
|
125
|
-
status: 'updated' | 'updated_all' | 'not_found' | 'conflict' | 'disabled' | 'error';
|
|
126
|
-
timeoutId?: string;
|
|
127
|
-
dueAt?: string;
|
|
128
|
-
paused?: boolean;
|
|
129
|
-
recurrenceIntervalMs?: number | null;
|
|
130
|
-
updatedCount?: number;
|
|
131
|
-
matchedCount?: number;
|
|
132
|
-
updatedTimeoutIds?: Array<string>;
|
|
133
|
-
hasMore?: boolean;
|
|
134
|
-
message?: string;
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Result payload returned by `list_timeouts`.
|
|
139
|
-
*
|
|
140
|
-
* @private type of UseTimeoutCommitmentDefinition
|
|
141
|
-
*/
|
|
142
|
-
export type ListTimeoutsToolResult = {
|
|
143
|
-
action: 'list';
|
|
144
|
-
status: 'listed' | 'disabled' | 'error';
|
|
145
|
-
items?: Array<TimeoutToolListItem>;
|
|
146
|
-
total?: number;
|
|
147
|
-
message?: string;
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Union of all `USE TIMEOUT` tool actions.
|
|
152
|
-
*
|
|
153
|
-
* @private type of UseTimeoutCommitmentDefinition
|
|
154
|
-
*/
|
|
155
|
-
export type TimeoutToolAction =
|
|
156
|
-
| SetTimeoutToolResult['action']
|
|
157
|
-
| CancelTimeoutToolResult['action']
|
|
158
|
-
| ListTimeoutsToolResult['action']
|
|
159
|
-
| UpdateTimeoutToolResult['action'];
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Union of all `USE TIMEOUT` tool results.
|
|
163
|
-
*
|
|
164
|
-
* @private type of UseTimeoutCommitmentDefinition
|
|
165
|
-
*/
|
|
166
|
-
export type TimeoutToolResult =
|
|
167
|
-
| SetTimeoutToolResult
|
|
168
|
-
| CancelTimeoutToolResult
|
|
169
|
-
| ListTimeoutsToolResult
|
|
170
|
-
| UpdateTimeoutToolResult;
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* Runtime adapter used by `USE TIMEOUT` tools.
|
|
174
|
-
*
|
|
175
|
-
* @private type of UseTimeoutCommitmentDefinition
|
|
176
|
-
*/
|
|
177
|
-
export type TimeoutToolRuntimeAdapter = {
|
|
178
|
-
scheduleTimeout(
|
|
179
|
-
args: {
|
|
180
|
-
milliseconds: number;
|
|
181
|
-
message?: string;
|
|
182
|
-
},
|
|
183
|
-
runtimeContext: TimeoutToolRuntimeContext,
|
|
184
|
-
): Promise<{
|
|
185
|
-
timeoutId: string;
|
|
186
|
-
dueAt: string;
|
|
187
|
-
}>;
|
|
188
|
-
cancelTimeout(
|
|
189
|
-
args:
|
|
190
|
-
| {
|
|
191
|
-
timeoutId: string;
|
|
192
|
-
}
|
|
193
|
-
| {
|
|
194
|
-
allActive: true;
|
|
195
|
-
},
|
|
196
|
-
runtimeContext: TimeoutToolRuntimeContext,
|
|
197
|
-
): Promise<{
|
|
198
|
-
status: 'cancelled' | 'cancelled_all' | 'not_found';
|
|
199
|
-
timeoutId?: string;
|
|
200
|
-
dueAt?: string;
|
|
201
|
-
cancelledCount?: number;
|
|
202
|
-
cancelledTimeoutIds?: Array<string>;
|
|
203
|
-
hasMore?: boolean;
|
|
204
|
-
}>;
|
|
205
|
-
listTimeouts(
|
|
206
|
-
args: {
|
|
207
|
-
includeFinished: boolean;
|
|
208
|
-
limit: number;
|
|
209
|
-
},
|
|
210
|
-
runtimeContext: TimeoutToolRuntimeContext,
|
|
211
|
-
): Promise<{
|
|
212
|
-
items: Array<TimeoutToolListItem>;
|
|
213
|
-
total: number;
|
|
214
|
-
}>;
|
|
215
|
-
updateTimeout(
|
|
216
|
-
args:
|
|
217
|
-
| {
|
|
218
|
-
timeoutId: string;
|
|
219
|
-
patch: {
|
|
220
|
-
dueAt?: string;
|
|
221
|
-
extendByMs?: number;
|
|
222
|
-
recurrenceIntervalMs?: number | null;
|
|
223
|
-
message?: string | null;
|
|
224
|
-
parameters?: Record<string, unknown>;
|
|
225
|
-
paused?: boolean;
|
|
226
|
-
};
|
|
227
|
-
}
|
|
228
|
-
| {
|
|
229
|
-
allActive: true;
|
|
230
|
-
paused: boolean;
|
|
231
|
-
},
|
|
232
|
-
runtimeContext: TimeoutToolRuntimeContext,
|
|
233
|
-
): Promise<
|
|
234
|
-
| {
|
|
235
|
-
status: 'updated';
|
|
236
|
-
timeout: TimeoutToolListItem;
|
|
237
|
-
}
|
|
238
|
-
| {
|
|
239
|
-
status: 'not_found';
|
|
240
|
-
timeoutId: string;
|
|
241
|
-
}
|
|
242
|
-
| {
|
|
243
|
-
status: 'conflict';
|
|
244
|
-
timeoutId: string;
|
|
245
|
-
reason: 'finished' | 'running';
|
|
246
|
-
}
|
|
247
|
-
| {
|
|
248
|
-
status: 'updated_all';
|
|
249
|
-
updatedCount: number;
|
|
250
|
-
matchedCount: number;
|
|
251
|
-
updatedTimeoutIds: Array<string>;
|
|
252
|
-
hasMore?: boolean;
|
|
253
|
-
}
|
|
254
|
-
>;
|
|
255
|
-
};
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { spaceTrim } from 'spacetrim';
|
|
2
|
-
import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
|
|
3
|
-
import type { ToolFunction } from '../../scripting/javascript/JavascriptExecutionToolsOptions';
|
|
4
|
-
import type { string_javascript_name } from '../../types/string_person_fullname';
|
|
5
|
-
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
6
|
-
import { formatOptionalInstructionBlock } from '../_base/formatOptionalInstructionBlock';
|
|
7
|
-
import { createTimeoutSystemMessage } from './createTimeoutSystemMessage';
|
|
8
|
-
import { createTimeoutToolFunctions } from './createTimeoutToolFunctions';
|
|
9
|
-
import { createTimeoutTools } from './createTimeoutTools';
|
|
10
|
-
import { TimeoutToolNames } from './TimeoutToolNames';
|
|
11
|
-
|
|
12
|
-
export { setTimeoutToolRuntimeAdapter } from './setTimeoutToolRuntimeAdapter';
|
|
13
|
-
export type {
|
|
14
|
-
CancelTimeoutToolResult,
|
|
15
|
-
ListTimeoutsToolResult,
|
|
16
|
-
SetTimeoutToolResult,
|
|
17
|
-
TimeoutToolListItem,
|
|
18
|
-
TimeoutToolRuntimeAdapter,
|
|
19
|
-
TimeoutToolRuntimeContext,
|
|
20
|
-
UpdateTimeoutToolResult,
|
|
21
|
-
} from './TimeoutToolRuntimeAdapter';
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* `USE TIMEOUT` commitment definition.
|
|
25
|
-
*
|
|
26
|
-
* The `USE TIMEOUT` commitment enables timeout wake-ups and scoped timeout management.
|
|
27
|
-
*
|
|
28
|
-
* @private [🪔] Maybe export the commitments through some package
|
|
29
|
-
*/
|
|
30
|
-
export class UseTimeoutCommitmentDefinition extends BaseCommitmentDefinition<'USE TIMEOUT'> {
|
|
31
|
-
public constructor() {
|
|
32
|
-
super('USE TIMEOUT');
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
override get requiresContent(): boolean {
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Short one-line description of `USE TIMEOUT`.
|
|
41
|
-
*/
|
|
42
|
-
get description(): string {
|
|
43
|
-
return 'Enable timeout wake-ups plus scoped timeout listing, updates, and cancellation across chats.';
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Icon for this commitment.
|
|
48
|
-
*/
|
|
49
|
-
get icon(): string {
|
|
50
|
-
return '⏱️';
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Markdown documentation for `USE TIMEOUT`.
|
|
55
|
-
*/
|
|
56
|
-
get documentation(): string {
|
|
57
|
-
return spaceTrim(`
|
|
58
|
-
# USE TIMEOUT
|
|
59
|
-
|
|
60
|
-
Enables timeout wake-ups and timeout management for the same user+agent scope.
|
|
61
|
-
|
|
62
|
-
## Key aspects
|
|
63
|
-
|
|
64
|
-
- The agent uses \`set_timeout\` to schedule a future wake-up in the same chat thread.
|
|
65
|
-
- The tool returns immediately while the timeout is stored and executed by the runtime later.
|
|
66
|
-
- The wake-up arrives as a new user-like timeout message in the same conversation.
|
|
67
|
-
- The agent can inspect known timeout details via \`list_timeouts\`.
|
|
68
|
-
- The agent can cancel one timeout by \`timeoutId\` or cancel all active timeouts via \`cancel_timeout\`.
|
|
69
|
-
- The agent can pause/resume and edit timeout details via \`update_timeout\`.
|
|
70
|
-
- Commitment content is treated as optional timeout policy instructions.
|
|
71
|
-
|
|
72
|
-
## Examples
|
|
73
|
-
|
|
74
|
-
\`\`\`book
|
|
75
|
-
Follow-up Agent
|
|
76
|
-
USE TIMEOUT Remind yourself only when follow-up work is explicitly requested.
|
|
77
|
-
\`\`\`
|
|
78
|
-
`);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements {
|
|
82
|
-
const extraInstructions = formatOptionalInstructionBlock('Timeout instructions', content);
|
|
83
|
-
|
|
84
|
-
return this.appendToSystemMessage(
|
|
85
|
-
{
|
|
86
|
-
...requirements,
|
|
87
|
-
tools: createTimeoutTools(requirements.tools || []),
|
|
88
|
-
_metadata: {
|
|
89
|
-
...requirements._metadata,
|
|
90
|
-
useTimeout: content || true,
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
createTimeoutSystemMessage(extraInstructions),
|
|
94
|
-
);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Gets human-readable titles for tool functions provided by this commitment.
|
|
99
|
-
*/
|
|
100
|
-
getToolTitles(): Record<string_javascript_name, string> {
|
|
101
|
-
return {
|
|
102
|
-
[TimeoutToolNames.set]: 'Set timer',
|
|
103
|
-
[TimeoutToolNames.cancel]: 'Cancel timer',
|
|
104
|
-
[TimeoutToolNames.list]: 'List timers',
|
|
105
|
-
[TimeoutToolNames.update]: 'Update timer',
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Gets `USE TIMEOUT` tool function implementations.
|
|
111
|
-
*/
|
|
112
|
-
getToolFunctions(): Record<string_javascript_name, ToolFunction> {
|
|
113
|
-
return createTimeoutToolFunctions();
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { spaceTrim } from 'spacetrim';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Creates system-message instructions for `USE TIMEOUT`.
|
|
5
|
-
*
|
|
6
|
-
* @private internal utility of USE TIMEOUT
|
|
7
|
-
*/
|
|
8
|
-
export function createTimeoutSystemMessage(extraInstructions: string): string {
|
|
9
|
-
return spaceTrim(
|
|
10
|
-
(block) => `
|
|
11
|
-
## Timeout scheduling
|
|
12
|
-
|
|
13
|
-
- Use \`set_timeout\` to wake this same chat thread in the future.
|
|
14
|
-
- Use \`list_timeouts\` to review timeout ids/details across all chats for the same user+agent scope.
|
|
15
|
-
- \`cancel_timeout\` accepts either one timeout id or \`allActive: true\` to cancel all active timeouts in this same user+agent scope.
|
|
16
|
-
- Use \`update_timeout\` to pause/resume, edit next run, edit recurrence, or update timeout payload details.
|
|
17
|
-
- When one timeout elapses, you will receive a new user-like message that explicitly says it is a timeout wake-up and includes the \`timeoutId\`.
|
|
18
|
-
- Do not claim a timer was set or cancelled unless the tool confirms it.
|
|
19
|
-
${block(extraInstructions)}
|
|
20
|
-
`,
|
|
21
|
-
);
|
|
22
|
-
}
|