@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,180 +0,0 @@
|
|
|
1
|
-
import type { TODO_any } from '../../utils/organization/TODO_any';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Tool arguments for retrieving memory.
|
|
5
|
-
*
|
|
6
|
-
* @private type of MemoryCommitmentDefinition
|
|
7
|
-
*/
|
|
8
|
-
export type RetrieveMemoryToolArgs = {
|
|
9
|
-
query?: string;
|
|
10
|
-
limit?: number;
|
|
11
|
-
[key: string]: TODO_any;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Tool arguments for storing memory.
|
|
16
|
-
*
|
|
17
|
-
* @private type of MemoryCommitmentDefinition
|
|
18
|
-
*/
|
|
19
|
-
export type StoreMemoryToolArgs = {
|
|
20
|
-
content?: string;
|
|
21
|
-
isGlobal?: boolean;
|
|
22
|
-
[key: string]: TODO_any;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Tool arguments for updating memory.
|
|
27
|
-
*
|
|
28
|
-
* @private type of MemoryCommitmentDefinition
|
|
29
|
-
*/
|
|
30
|
-
export type UpdateMemoryToolArgs = {
|
|
31
|
-
memoryId?: string;
|
|
32
|
-
content?: string;
|
|
33
|
-
isGlobal?: boolean;
|
|
34
|
-
[key: string]: TODO_any;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Tool arguments for deleting memory.
|
|
39
|
-
*
|
|
40
|
-
* @private type of MemoryCommitmentDefinition
|
|
41
|
-
*/
|
|
42
|
-
export type DeleteMemoryToolArgs = {
|
|
43
|
-
memoryId?: string;
|
|
44
|
-
[key: string]: TODO_any;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Memory record returned by runtime adapters.
|
|
49
|
-
*
|
|
50
|
-
* @private type of MemoryCommitmentDefinition
|
|
51
|
-
*/
|
|
52
|
-
export type MemoryToolRecord = {
|
|
53
|
-
id?: string;
|
|
54
|
-
content: string;
|
|
55
|
-
isGlobal: boolean;
|
|
56
|
-
createdAt?: string;
|
|
57
|
-
updatedAt?: string;
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Runtime context for MEMORY tools resolved from hidden tool arguments.
|
|
62
|
-
*
|
|
63
|
-
* @private type of MemoryCommitmentDefinition
|
|
64
|
-
*/
|
|
65
|
-
export type MemoryToolRuntimeContext = {
|
|
66
|
-
readonly enabled: boolean;
|
|
67
|
-
readonly userId?: number;
|
|
68
|
-
readonly username?: string;
|
|
69
|
-
readonly agentId?: string;
|
|
70
|
-
readonly agentName?: string;
|
|
71
|
-
readonly isTeamConversation: boolean;
|
|
72
|
-
readonly isPrivateMode: boolean;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Result payload returned by retrieve memory tool.
|
|
77
|
-
*
|
|
78
|
-
* @private type of MemoryCommitmentDefinition
|
|
79
|
-
*/
|
|
80
|
-
export type RetrieveMemoryToolResult = {
|
|
81
|
-
action: 'retrieve';
|
|
82
|
-
status: 'ok' | 'disabled' | 'error';
|
|
83
|
-
query?: string;
|
|
84
|
-
memories: MemoryToolRecord[];
|
|
85
|
-
message?: string;
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Result payload returned by store memory tool.
|
|
90
|
-
*
|
|
91
|
-
* @private type of MemoryCommitmentDefinition
|
|
92
|
-
*/
|
|
93
|
-
export type StoreMemoryToolResult = {
|
|
94
|
-
action: 'store';
|
|
95
|
-
status: 'stored' | 'disabled' | 'error';
|
|
96
|
-
memory?: MemoryToolRecord;
|
|
97
|
-
message?: string;
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Result payload returned by update memory tool.
|
|
102
|
-
*
|
|
103
|
-
* @private type of MemoryCommitmentDefinition
|
|
104
|
-
*/
|
|
105
|
-
export type UpdateMemoryToolResult = {
|
|
106
|
-
action: 'update';
|
|
107
|
-
status: 'updated' | 'disabled' | 'error';
|
|
108
|
-
memory?: MemoryToolRecord;
|
|
109
|
-
message?: string;
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Result payload returned by delete memory tool.
|
|
114
|
-
*
|
|
115
|
-
* @private type of MemoryCommitmentDefinition
|
|
116
|
-
*/
|
|
117
|
-
export type DeleteMemoryToolResult = {
|
|
118
|
-
action: 'delete';
|
|
119
|
-
status: 'deleted' | 'disabled' | 'error';
|
|
120
|
-
memoryId?: string;
|
|
121
|
-
message?: string;
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Union of all MEMORY tool actions.
|
|
126
|
-
*
|
|
127
|
-
* @private type of MemoryCommitmentDefinition
|
|
128
|
-
*/
|
|
129
|
-
export type MemoryToolAction =
|
|
130
|
-
| RetrieveMemoryToolResult['action']
|
|
131
|
-
| StoreMemoryToolResult['action']
|
|
132
|
-
| UpdateMemoryToolResult['action']
|
|
133
|
-
| DeleteMemoryToolResult['action'];
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Union of all MEMORY tool result payloads.
|
|
137
|
-
*
|
|
138
|
-
* @private type of MemoryCommitmentDefinition
|
|
139
|
-
*/
|
|
140
|
-
export type MemoryToolResult =
|
|
141
|
-
| RetrieveMemoryToolResult
|
|
142
|
-
| StoreMemoryToolResult
|
|
143
|
-
| UpdateMemoryToolResult
|
|
144
|
-
| DeleteMemoryToolResult;
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Runtime adapter interface used by MEMORY tools.
|
|
148
|
-
*
|
|
149
|
-
* @private type of MemoryCommitmentDefinition
|
|
150
|
-
*/
|
|
151
|
-
export type MemoryToolRuntimeAdapter = {
|
|
152
|
-
retrieveMemories(
|
|
153
|
-
args: {
|
|
154
|
-
query?: string;
|
|
155
|
-
limit?: number;
|
|
156
|
-
},
|
|
157
|
-
runtimeContext: MemoryToolRuntimeContext,
|
|
158
|
-
): Promise<MemoryToolRecord[]>;
|
|
159
|
-
storeMemory(
|
|
160
|
-
args: {
|
|
161
|
-
content: string;
|
|
162
|
-
isGlobal: boolean;
|
|
163
|
-
},
|
|
164
|
-
runtimeContext: MemoryToolRuntimeContext,
|
|
165
|
-
): Promise<MemoryToolRecord>;
|
|
166
|
-
updateMemory(
|
|
167
|
-
args: {
|
|
168
|
-
memoryId: string;
|
|
169
|
-
content: string;
|
|
170
|
-
isGlobal?: boolean;
|
|
171
|
-
},
|
|
172
|
-
runtimeContext: MemoryToolRuntimeContext,
|
|
173
|
-
): Promise<MemoryToolRecord>;
|
|
174
|
-
deleteMemory(
|
|
175
|
-
args: {
|
|
176
|
-
memoryId: string;
|
|
177
|
-
},
|
|
178
|
-
runtimeContext: MemoryToolRuntimeContext,
|
|
179
|
-
): Promise<{ id?: string }>;
|
|
180
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { spaceTrim } from 'spacetrim';
|
|
2
|
-
import { MemoryToolNames } from './MemoryToolNames';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Builds the MEMORY instruction block appended to the system message.
|
|
6
|
-
*
|
|
7
|
-
* @private function of MemoryCommitmentDefinition
|
|
8
|
-
*/
|
|
9
|
-
export function createMemorySystemMessage(extraInstructions: string): string {
|
|
10
|
-
return spaceTrim(
|
|
11
|
-
(block) => `
|
|
12
|
-
## Memory
|
|
13
|
-
|
|
14
|
-
- Prefer storing agent-scoped memories; only make them global when the fact should apply across all your agents.
|
|
15
|
-
- You can use persistent user memory tools.
|
|
16
|
-
- Use \`${MemoryToolNames.retrieve}\` to load relevant memory before answering.
|
|
17
|
-
- Use \`${MemoryToolNames.store}\` to save stable user-specific facts that improve future help.
|
|
18
|
-
- Use \`${MemoryToolNames.update}\` to refresh an existing memory when the content changes.
|
|
19
|
-
- Use \`${
|
|
20
|
-
MemoryToolNames.delete
|
|
21
|
-
}\` to delete memories that are no longer accurate (deletions are soft and hidden from future queries).
|
|
22
|
-
- Store concise memory items and avoid duplicates.
|
|
23
|
-
- Never claim memory was saved or loaded unless the tool confirms it.
|
|
24
|
-
${block(extraInstructions)}
|
|
25
|
-
`,
|
|
26
|
-
);
|
|
27
|
-
}
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import type { ToolFunction } from '../../scripting/javascript/JavascriptExecutionToolsOptions';
|
|
2
|
-
import type { string_javascript_name } from '../../types/string_person_fullname';
|
|
3
|
-
import { getMemoryToolRuntimeAdapterOrDisabledResult } from './getMemoryToolRuntimeAdapterOrDisabledResult';
|
|
4
|
-
import { MemoryToolNames } from './MemoryToolNames';
|
|
5
|
-
import type {
|
|
6
|
-
DeleteMemoryToolArgs,
|
|
7
|
-
DeleteMemoryToolResult,
|
|
8
|
-
RetrieveMemoryToolArgs,
|
|
9
|
-
RetrieveMemoryToolResult,
|
|
10
|
-
StoreMemoryToolArgs,
|
|
11
|
-
StoreMemoryToolResult,
|
|
12
|
-
UpdateMemoryToolArgs,
|
|
13
|
-
UpdateMemoryToolResult,
|
|
14
|
-
} from './MemoryToolRuntimeAdapter';
|
|
15
|
-
import { parseMemoryToolArgs } from './parseMemoryToolArgs';
|
|
16
|
-
import { resolveMemoryRuntimeContext } from './resolveMemoryRuntimeContext';
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Gets MEMORY tool function implementations.
|
|
20
|
-
*
|
|
21
|
-
* @private function of MemoryCommitmentDefinition
|
|
22
|
-
*/
|
|
23
|
-
export function createMemoryToolFunctions(): Record<string_javascript_name, ToolFunction> {
|
|
24
|
-
return {
|
|
25
|
-
async [MemoryToolNames.retrieve](args: RetrieveMemoryToolArgs): Promise<string> {
|
|
26
|
-
const runtimeContext = resolveMemoryRuntimeContext(args);
|
|
27
|
-
const { adapter, disabledResult } = getMemoryToolRuntimeAdapterOrDisabledResult('retrieve', runtimeContext);
|
|
28
|
-
|
|
29
|
-
if (!adapter || disabledResult) {
|
|
30
|
-
return JSON.stringify(disabledResult);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const parsedArgs = parseMemoryToolArgs.retrieve(args);
|
|
34
|
-
|
|
35
|
-
try {
|
|
36
|
-
const memories = await adapter.retrieveMemories(parsedArgs, runtimeContext);
|
|
37
|
-
const result: RetrieveMemoryToolResult = {
|
|
38
|
-
action: 'retrieve',
|
|
39
|
-
status: 'ok',
|
|
40
|
-
query: parsedArgs.query,
|
|
41
|
-
memories,
|
|
42
|
-
};
|
|
43
|
-
return JSON.stringify(result);
|
|
44
|
-
} catch (error) {
|
|
45
|
-
const result: RetrieveMemoryToolResult = {
|
|
46
|
-
action: 'retrieve',
|
|
47
|
-
status: 'error',
|
|
48
|
-
query: parsedArgs.query,
|
|
49
|
-
memories: [],
|
|
50
|
-
message: error instanceof Error ? error.message : String(error),
|
|
51
|
-
};
|
|
52
|
-
return JSON.stringify(result);
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
async [MemoryToolNames.store](args: StoreMemoryToolArgs): Promise<string> {
|
|
56
|
-
const runtimeContext = resolveMemoryRuntimeContext(args);
|
|
57
|
-
const { adapter, disabledResult } = getMemoryToolRuntimeAdapterOrDisabledResult('store', runtimeContext);
|
|
58
|
-
|
|
59
|
-
if (!adapter || disabledResult) {
|
|
60
|
-
return JSON.stringify(disabledResult);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
try {
|
|
64
|
-
const parsedArgs = parseMemoryToolArgs.store(args);
|
|
65
|
-
const memory = await adapter.storeMemory(parsedArgs, runtimeContext);
|
|
66
|
-
const result: StoreMemoryToolResult = {
|
|
67
|
-
action: 'store',
|
|
68
|
-
status: 'stored',
|
|
69
|
-
memory,
|
|
70
|
-
};
|
|
71
|
-
return JSON.stringify(result);
|
|
72
|
-
} catch (error) {
|
|
73
|
-
const result: StoreMemoryToolResult = {
|
|
74
|
-
action: 'store',
|
|
75
|
-
status: 'error',
|
|
76
|
-
message: error instanceof Error ? error.message : String(error),
|
|
77
|
-
};
|
|
78
|
-
return JSON.stringify(result);
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
async [MemoryToolNames.update](args: UpdateMemoryToolArgs): Promise<string> {
|
|
82
|
-
const runtimeContext = resolveMemoryRuntimeContext(args);
|
|
83
|
-
const { adapter, disabledResult } = getMemoryToolRuntimeAdapterOrDisabledResult('update', runtimeContext);
|
|
84
|
-
|
|
85
|
-
if (!adapter || disabledResult) {
|
|
86
|
-
return JSON.stringify(disabledResult);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
try {
|
|
90
|
-
const parsedArgs = parseMemoryToolArgs.update(args);
|
|
91
|
-
const memory = await adapter.updateMemory(parsedArgs, runtimeContext);
|
|
92
|
-
const result: UpdateMemoryToolResult = {
|
|
93
|
-
action: 'update',
|
|
94
|
-
status: 'updated',
|
|
95
|
-
memory,
|
|
96
|
-
};
|
|
97
|
-
return JSON.stringify(result);
|
|
98
|
-
} catch (error) {
|
|
99
|
-
const result: UpdateMemoryToolResult = {
|
|
100
|
-
action: 'update',
|
|
101
|
-
status: 'error',
|
|
102
|
-
message: error instanceof Error ? error.message : String(error),
|
|
103
|
-
};
|
|
104
|
-
return JSON.stringify(result);
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
|
-
async [MemoryToolNames.delete](args: DeleteMemoryToolArgs): Promise<string> {
|
|
108
|
-
const runtimeContext = resolveMemoryRuntimeContext(args);
|
|
109
|
-
const { adapter, disabledResult } = getMemoryToolRuntimeAdapterOrDisabledResult('delete', runtimeContext);
|
|
110
|
-
|
|
111
|
-
if (!adapter || disabledResult) {
|
|
112
|
-
return JSON.stringify(disabledResult);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
try {
|
|
116
|
-
const parsedArgs = parseMemoryToolArgs.delete(args);
|
|
117
|
-
const deleted = await adapter.deleteMemory(parsedArgs, runtimeContext);
|
|
118
|
-
const result: DeleteMemoryToolResult = {
|
|
119
|
-
action: 'delete',
|
|
120
|
-
status: 'deleted',
|
|
121
|
-
memoryId: deleted.id,
|
|
122
|
-
};
|
|
123
|
-
return JSON.stringify(result);
|
|
124
|
-
} catch (error) {
|
|
125
|
-
const result: DeleteMemoryToolResult = {
|
|
126
|
-
action: 'delete',
|
|
127
|
-
status: 'error',
|
|
128
|
-
message: error instanceof Error ? error.message : String(error),
|
|
129
|
-
};
|
|
130
|
-
return JSON.stringify(result);
|
|
131
|
-
}
|
|
132
|
-
},
|
|
133
|
-
};
|
|
134
|
-
}
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { spaceTrim } from 'spacetrim';
|
|
2
|
-
import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
|
|
3
|
-
import { MemoryToolNames } from './MemoryToolNames';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Concrete type of tool definitions in `AgentModelRequirements`.
|
|
7
|
-
*
|
|
8
|
-
* @private type of MemoryCommitmentDefinition
|
|
9
|
-
*/
|
|
10
|
-
type AgentModelTools = NonNullable<AgentModelRequirements['tools']>;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Creates MEMORY tool definitions while preserving already-registered tools.
|
|
14
|
-
*
|
|
15
|
-
* @private function of MemoryCommitmentDefinition
|
|
16
|
-
*/
|
|
17
|
-
export function createMemoryTools(existingTools: AgentModelRequirements['tools']): AgentModelTools {
|
|
18
|
-
const tools = [...(existingTools || [])];
|
|
19
|
-
|
|
20
|
-
if (!tools.some((tool) => tool.name === MemoryToolNames.retrieve)) {
|
|
21
|
-
tools.push({
|
|
22
|
-
name: MemoryToolNames.retrieve,
|
|
23
|
-
description: spaceTrim(`
|
|
24
|
-
Retrieve previously stored user memories relevant to the current conversation.
|
|
25
|
-
Use this before responding when user context can improve the answer.
|
|
26
|
-
`),
|
|
27
|
-
parameters: {
|
|
28
|
-
type: 'object',
|
|
29
|
-
properties: {
|
|
30
|
-
query: {
|
|
31
|
-
type: 'string',
|
|
32
|
-
description: 'Optional query used to filter relevant memories.',
|
|
33
|
-
},
|
|
34
|
-
limit: {
|
|
35
|
-
type: 'integer',
|
|
36
|
-
description: 'Optional maximum number of memories to return (default 5, max 20).',
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if (!tools.some((tool) => tool.name === MemoryToolNames.store)) {
|
|
44
|
-
tools.push({
|
|
45
|
-
name: MemoryToolNames.store,
|
|
46
|
-
description: spaceTrim(`
|
|
47
|
-
Store a durable user memory that should be remembered in future conversations.
|
|
48
|
-
Store only stable and useful user-specific facts or preferences.
|
|
49
|
-
`),
|
|
50
|
-
parameters: {
|
|
51
|
-
type: 'object',
|
|
52
|
-
properties: {
|
|
53
|
-
content: {
|
|
54
|
-
type: 'string',
|
|
55
|
-
description: 'Memory text to store.',
|
|
56
|
-
},
|
|
57
|
-
isGlobal: {
|
|
58
|
-
type: 'boolean',
|
|
59
|
-
description: 'Set true to make this memory global across all user agents.',
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
required: ['content'],
|
|
63
|
-
},
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
if (!tools.some((tool) => tool.name === MemoryToolNames.update)) {
|
|
68
|
-
tools.push({
|
|
69
|
-
name: MemoryToolNames.update,
|
|
70
|
-
description: spaceTrim(`
|
|
71
|
-
Update an existing user memory after retrieving it, so the stored fact stays accurate.
|
|
72
|
-
Always pass the memory id you retrieved along with the new content.
|
|
73
|
-
`),
|
|
74
|
-
parameters: {
|
|
75
|
-
type: 'object',
|
|
76
|
-
properties: {
|
|
77
|
-
memoryId: {
|
|
78
|
-
type: 'string',
|
|
79
|
-
description: 'Unique identifier of the memory entry to update.',
|
|
80
|
-
},
|
|
81
|
-
content: {
|
|
82
|
-
type: 'string',
|
|
83
|
-
description: 'Updated memory text.',
|
|
84
|
-
},
|
|
85
|
-
isGlobal: {
|
|
86
|
-
type: 'boolean',
|
|
87
|
-
description: 'Set true to keep the fact global; omit or false to keep it agent-scoped.',
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
required: ['memoryId', 'content'],
|
|
91
|
-
},
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
if (!tools.some((tool) => tool.name === MemoryToolNames.delete)) {
|
|
96
|
-
tools.push({
|
|
97
|
-
name: MemoryToolNames.delete,
|
|
98
|
-
description: spaceTrim(`
|
|
99
|
-
Delete a user memory that is no longer relevant. Deletions are soft so the record is hidden from future queries.
|
|
100
|
-
`),
|
|
101
|
-
parameters: {
|
|
102
|
-
type: 'object',
|
|
103
|
-
properties: {
|
|
104
|
-
memoryId: {
|
|
105
|
-
type: 'string',
|
|
106
|
-
description: 'Unique identifier of the memory entry to delete.',
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
required: ['memoryId'],
|
|
110
|
-
},
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
return tools;
|
|
115
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { spaceTrim } from 'spacetrim';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Markdown documentation for MEMORY commitment.
|
|
5
|
-
*
|
|
6
|
-
* @private function of MemoryCommitmentDefinition
|
|
7
|
-
*/
|
|
8
|
-
export function getMemoryCommitmentDocumentation(type: 'MEMORY' | 'MEMORIES'): string {
|
|
9
|
-
return spaceTrim(`
|
|
10
|
-
# ${type}
|
|
11
|
-
|
|
12
|
-
Enables persistent user memory for the current agent. The memory is stored by the runtime and can be retrieved in future conversations.
|
|
13
|
-
|
|
14
|
-
## Key aspects
|
|
15
|
-
|
|
16
|
-
- Both \`MEMORY\` and \`MEMORIES\` work identically.
|
|
17
|
-
- Stores user-specific details through runtime tools.
|
|
18
|
-
- Retrieves relevant memories for personalized responses.
|
|
19
|
-
- Supports optional extra instructions in the commitment content.
|
|
20
|
-
|
|
21
|
-
## Examples
|
|
22
|
-
|
|
23
|
-
\`\`\`book
|
|
24
|
-
Personal Assistant
|
|
25
|
-
|
|
26
|
-
PERSONA You are a personal productivity assistant
|
|
27
|
-
MEMORY Remember user projects and long-term preferences.
|
|
28
|
-
GOAL Help optimize daily productivity and workflow
|
|
29
|
-
\`\`\`
|
|
30
|
-
|
|
31
|
-
\`\`\`book
|
|
32
|
-
Learning Companion
|
|
33
|
-
|
|
34
|
-
PERSONA You are an educational companion for programming students
|
|
35
|
-
MEMORY Remember only the student's learning progress and preferred study style.
|
|
36
|
-
GOAL Provide progressive learning experiences tailored to student's pace
|
|
37
|
-
\`\`\`
|
|
38
|
-
|
|
39
|
-
\`\`\`book
|
|
40
|
-
Customer Support Agent
|
|
41
|
-
|
|
42
|
-
PERSONA You are a customer support representative
|
|
43
|
-
MEMORY Remember only important support history and communication preferences.
|
|
44
|
-
GOAL Provide personalized support based on customer history
|
|
45
|
-
\`\`\`
|
|
46
|
-
`);
|
|
47
|
-
}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
DeleteMemoryToolResult,
|
|
3
|
-
MemoryToolAction,
|
|
4
|
-
MemoryToolResult,
|
|
5
|
-
MemoryToolRuntimeAdapter,
|
|
6
|
-
MemoryToolRuntimeContext,
|
|
7
|
-
RetrieveMemoryToolResult,
|
|
8
|
-
StoreMemoryToolResult,
|
|
9
|
-
UpdateMemoryToolResult,
|
|
10
|
-
} from './MemoryToolRuntimeAdapter';
|
|
11
|
-
import { getMemoryToolRuntimeAdapter } from './setMemoryToolRuntimeAdapter';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Builds a disabled memory-tool response payload.
|
|
15
|
-
*
|
|
16
|
-
* @private function of MemoryCommitmentDefinition
|
|
17
|
-
*/
|
|
18
|
-
function createDisabledMemoryResult(action: MemoryToolAction, message: string): MemoryToolResult {
|
|
19
|
-
if (action === 'retrieve') {
|
|
20
|
-
return {
|
|
21
|
-
action,
|
|
22
|
-
status: 'disabled',
|
|
23
|
-
memories: [],
|
|
24
|
-
message,
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
if (action === 'store') {
|
|
29
|
-
return {
|
|
30
|
-
action,
|
|
31
|
-
status: 'disabled',
|
|
32
|
-
message,
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if (action === 'update') {
|
|
37
|
-
return {
|
|
38
|
-
action,
|
|
39
|
-
status: 'disabled',
|
|
40
|
-
message,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (action === 'delete') {
|
|
45
|
-
return {
|
|
46
|
-
action,
|
|
47
|
-
status: 'disabled',
|
|
48
|
-
message,
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
throw new Error(`Unsupported memory tool action: ${action}`);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Return type of MEMORY adapter resolution helper.
|
|
57
|
-
*
|
|
58
|
-
* @private type of MemoryCommitmentDefinition
|
|
59
|
-
*/
|
|
60
|
-
type MemoryToolRuntimeAdapterResolution = {
|
|
61
|
-
adapter: MemoryToolRuntimeAdapter | null;
|
|
62
|
-
disabledResult:
|
|
63
|
-
| RetrieveMemoryToolResult
|
|
64
|
-
| StoreMemoryToolResult
|
|
65
|
-
| UpdateMemoryToolResult
|
|
66
|
-
| DeleteMemoryToolResult
|
|
67
|
-
| null;
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Gets the runtime adapter and returns a disabled result when unavailable.
|
|
72
|
-
*
|
|
73
|
-
* @private function of MemoryCommitmentDefinition
|
|
74
|
-
*/
|
|
75
|
-
export function getMemoryToolRuntimeAdapterOrDisabledResult(
|
|
76
|
-
action: MemoryToolAction,
|
|
77
|
-
runtimeContext: MemoryToolRuntimeContext,
|
|
78
|
-
): MemoryToolRuntimeAdapterResolution {
|
|
79
|
-
if (!runtimeContext.enabled || runtimeContext.isTeamConversation || runtimeContext.isPrivateMode) {
|
|
80
|
-
const message = runtimeContext.isPrivateMode
|
|
81
|
-
? 'Memory is disabled because private mode is active.'
|
|
82
|
-
: runtimeContext.isTeamConversation
|
|
83
|
-
? 'Memory is disabled for TEAM conversations.'
|
|
84
|
-
: 'Memory is disabled for unauthenticated users.';
|
|
85
|
-
|
|
86
|
-
return {
|
|
87
|
-
adapter: null,
|
|
88
|
-
disabledResult: createDisabledMemoryResult(action, message),
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const memoryToolRuntimeAdapter = getMemoryToolRuntimeAdapter();
|
|
93
|
-
if (!memoryToolRuntimeAdapter) {
|
|
94
|
-
return {
|
|
95
|
-
adapter: null,
|
|
96
|
-
disabledResult: createDisabledMemoryResult(action, 'Memory runtime is not available in this environment.'),
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
return {
|
|
101
|
-
adapter: memoryToolRuntimeAdapter,
|
|
102
|
-
disabledResult: null,
|
|
103
|
-
};
|
|
104
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { string_javascript_name } from '../../types/string_person_fullname';
|
|
2
|
-
import { MemoryToolNames } from './MemoryToolNames';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Gets human-readable titles for MEMORY tool functions.
|
|
6
|
-
*
|
|
7
|
-
* @private function of MemoryCommitmentDefinition
|
|
8
|
-
*/
|
|
9
|
-
export function getMemoryToolTitles(): Record<string_javascript_name, string> {
|
|
10
|
-
return {
|
|
11
|
-
[MemoryToolNames.retrieve]: 'User memory',
|
|
12
|
-
[MemoryToolNames.store]: 'Store user memory',
|
|
13
|
-
[MemoryToolNames.update]: 'Update user memory',
|
|
14
|
-
[MemoryToolNames.delete]: 'Delete user memory',
|
|
15
|
-
};
|
|
16
|
-
}
|