@promptbook/cli 0.114.0-3 → 0.114.0-5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -12
- package/apps/agents-server/{USE_TIMEOUT_CHIP_QA.md → TIMEOUT_CHIP_QA.md} +1 -1
- 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 +25 -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 +2885 -6344
- package/esm/index.es.js.map +1 -1
- package/esm/scripts/run-codex-prompts/common/createCoderRunStepTracker.d.ts +48 -0
- package/esm/scripts/run-codex-prompts/prompts/buildPromptStatusDetails.d.ts +43 -0
- package/esm/scripts/run-codex-prompts/prompts/formatCoderRunSteps.d.ts +6 -3
- package/esm/scripts/run-codex-prompts/prompts/isPromptSectionUnfinished.d.ts +8 -0
- package/esm/scripts/run-codex-prompts/prompts/markPromptDone.d.ts +1 -1
- package/esm/scripts/run-codex-prompts/prompts/markPromptInProgress.d.ts +27 -0
- package/esm/scripts/run-codex-prompts/prompts/resolvePromptStatusLine.d.ts +19 -0
- package/esm/scripts/run-codex-prompts/prompts/writePromptStatusLine.d.ts +9 -0
- package/esm/scripts/run-codex-prompts/server/buildCoderServerPromptResponse.d.ts +1 -1
- package/esm/scripts/run-codex-prompts/server/coderServerHtml.d.ts +1 -1
- package/esm/scripts/run-codex-prompts/server/updatePromptSection.d.ts +1 -1
- package/esm/scripts/run-codex-prompts/testing/runPromptWithTestFeedback.d.ts +6 -0
- package/esm/scripts/verify-prompts/$orderPromptFiles.d.ts +9 -0
- package/esm/scripts/verify-prompts/VerifyPromptsOrder.d.ts +26 -0
- package/esm/scripts/verify-prompts/verify-prompts.d.ts +3 -2
- package/esm/src/book-2.0/agent-source/AgentBasicInformation.d.ts +3 -3
- 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/verify.d.ts +1 -1
- 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/openai/OpenAiAgentKitExecutionToolsToolBuilder.d.ts +1 -1
- package/esm/src/{commitments/USE_BROWSER → scrapers/_common/utils}/fetchUrlContent.d.ts +2 -3
- 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-components/BookEditor/useBookEditorMonacoLanguage.ts +1 -1
- package/src/cli/cli-commands/coder/boilerplateCount.ts +139 -0
- package/src/cli/cli-commands/coder/generate-boilerplates.ts +52 -44
- package/src/cli/cli-commands/coder/getDefaultCoderPackageJsonScripts.ts +3 -1
- package/src/cli/cli-commands/coder/init.ts +2 -1
- package/src/cli/cli-commands/coder/verify.ts +29 -5
- 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/llm-providers/agent/Agent.ts +1 -1
- package/src/llm-providers/openai/OpenAiAgentKitExecutionToolsToolBuilder.ts +2 -2
- package/src/other/templates/getTemplatesPipelineCollection.ts +735 -693
- package/src/{commitments/USE_BROWSER → scrapers/_common/utils}/fetchUrlContent.ts +8 -9
- package/src/version.ts +2 -2
- package/src/versions.txt +2 -0
- package/umd/index.umd.js +2888 -6347
- package/umd/index.umd.js.map +1 -1
- package/umd/scripts/run-codex-prompts/common/createCoderRunStepTracker.d.ts +48 -0
- package/umd/scripts/run-codex-prompts/prompts/buildPromptStatusDetails.d.ts +43 -0
- package/umd/scripts/run-codex-prompts/prompts/formatCoderRunSteps.d.ts +6 -3
- package/umd/scripts/run-codex-prompts/prompts/isPromptSectionUnfinished.d.ts +8 -0
- package/umd/scripts/run-codex-prompts/prompts/markPromptDone.d.ts +1 -1
- package/umd/scripts/run-codex-prompts/prompts/markPromptInProgress.d.ts +27 -0
- package/umd/scripts/run-codex-prompts/prompts/resolvePromptStatusLine.d.ts +19 -0
- package/umd/scripts/run-codex-prompts/prompts/writePromptStatusLine.d.ts +9 -0
- package/umd/scripts/run-codex-prompts/server/buildCoderServerPromptResponse.d.ts +1 -1
- package/umd/scripts/run-codex-prompts/server/coderServerHtml.d.ts +1 -1
- package/umd/scripts/run-codex-prompts/server/updatePromptSection.d.ts +1 -1
- package/umd/scripts/run-codex-prompts/testing/runPromptWithTestFeedback.d.ts +6 -0
- package/umd/scripts/verify-prompts/$orderPromptFiles.d.ts +9 -0
- package/umd/scripts/verify-prompts/VerifyPromptsOrder.d.ts +26 -0
- package/umd/scripts/verify-prompts/verify-prompts.d.ts +3 -2
- package/umd/src/book-2.0/agent-source/AgentBasicInformation.d.ts +3 -3
- 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/verify.d.ts +1 -1
- 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/openai/OpenAiAgentKitExecutionToolsToolBuilder.d.ts +1 -1
- package/umd/src/{commitments/USE_BROWSER → scrapers/_common/utils}/fetchUrlContent.d.ts +2 -3
- 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-codex-prompts/prompts/replacePromptTodoStatusLine.d.ts +0 -7
- 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/parseUseEmailCommitmentContent.test.d.ts +0 -1
- 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_SEARCH_ENGINE/USE_SEARCH_ENGINE.test.d.ts +0 -1
- 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-codex-prompts/prompts/replacePromptTodoStatusLine.d.ts +0 -7
- 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/{META → META_DESCRIPTION}/META_DESCRIPTION.d.ts +0 -0
- /package/{esm/src/commitments/USE_BROWSER/resolveRunBrowserToolForNode.test.d.ts → umd/src/book-2.0/agent-source/createAgentModelRequirements.commitmentAggregation.test.d.ts} +0 -0
- /package/{esm/src/commitments/USE_DEEPSEARCH/USE_DEEPSEARCH.test.d.ts → umd/src/cli/cli-commands/coder/boilerplateCount.test.d.ts} +0 -0
- /package/{esm/src/commitments/USE_EMAIL/USE_EMAIL.test.d.ts → umd/src/cli/cli-commands/coder/generate-boilerplates.test.d.ts} +0 -0
- /package/umd/src/commitments/{META → META_DESCRIPTION}/META_DESCRIPTION.d.ts +0 -0
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Client-side safe wrapper for fetching URL content
|
|
3
|
-
*
|
|
4
|
-
* This function proxies requests to the Agents Server API endpoint for scraping,
|
|
5
|
-
* making it safe to use in browser environments.
|
|
6
|
-
*
|
|
7
|
-
* @param url The URL to fetch and scrape
|
|
8
|
-
* @param agentsServerUrl The base URL of the agents server (defaults to current origin)
|
|
9
|
-
* @returns Markdown content from the URL
|
|
10
|
-
*
|
|
11
|
-
* @private internal utility for USE BROWSER commitment
|
|
12
|
-
*/
|
|
13
|
-
export async function fetchUrlContentViaBrowser(url: string, agentsServerUrl?: string): Promise<string> {
|
|
14
|
-
try {
|
|
15
|
-
// Determine the agents server URL
|
|
16
|
-
const baseUrl = agentsServerUrl || (typeof window !== 'undefined' ? window.location.origin : '');
|
|
17
|
-
|
|
18
|
-
if (!baseUrl) {
|
|
19
|
-
throw new Error('Agents server URL is required in non-browser environments');
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// Build the API endpoint URL
|
|
23
|
-
const apiUrl = new URL('/api/scrape', baseUrl);
|
|
24
|
-
apiUrl.searchParams.set('url', url);
|
|
25
|
-
|
|
26
|
-
// Fetch from the API endpoint
|
|
27
|
-
const response = await fetch(apiUrl.toString());
|
|
28
|
-
|
|
29
|
-
if (!response.ok) {
|
|
30
|
-
const errorData = await response.json().catch(() => ({ error: 'Unknown error' }));
|
|
31
|
-
throw new Error(`Failed to scrape URL: ${errorData.error || response.statusText}`);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const data = await response.json();
|
|
35
|
-
|
|
36
|
-
if (!data.success || !data.content) {
|
|
37
|
-
throw new Error(`Scraping failed: ${data.error || 'No content returned'}`);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return data.content;
|
|
41
|
-
} catch (error) {
|
|
42
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
43
|
-
throw new Error(`Error fetching URL content via browser: ${errorMessage}`);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { spaceTrim } from 'spacetrim';
|
|
2
|
-
import { assertsError } from '../../errors/assertsError';
|
|
3
|
-
import { EnvironmentMismatchError } from '../../errors/EnvironmentMismatchError';
|
|
4
|
-
import type { ToolFunction } from '../../scripting/javascript/JavascriptExecutionToolsOptions';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Cached implementation of `run_browser` when it can be resolved.
|
|
8
|
-
*
|
|
9
|
-
* @private internal utility for USE BROWSER commitment
|
|
10
|
-
*/
|
|
11
|
-
let cachedRunBrowserTool: ToolFunction | null = null;
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Cached loading error to avoid repeating expensive resolution attempts.
|
|
15
|
-
*
|
|
16
|
-
* @private internal utility for USE BROWSER commitment
|
|
17
|
-
*/
|
|
18
|
-
let cachedRunBrowserToolError: Error | null = null;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Attempts to load the server-side `run_browser` tool lazily.
|
|
22
|
-
*
|
|
23
|
-
* @returns Loaded `run_browser` implementation
|
|
24
|
-
*
|
|
25
|
-
* @private internal utility for USE BROWSER commitment
|
|
26
|
-
*/
|
|
27
|
-
function loadRunBrowserToolForNode(): ToolFunction {
|
|
28
|
-
if (cachedRunBrowserTool !== null) {
|
|
29
|
-
return cachedRunBrowserTool;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (cachedRunBrowserToolError !== null) {
|
|
33
|
-
throw cachedRunBrowserToolError;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
try {
|
|
37
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
38
|
-
const runBrowserModule = require('../../../apps/agents-server/src/tools/run_browser') as {
|
|
39
|
-
run_browser?: unknown;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
if (typeof runBrowserModule.run_browser !== 'function') {
|
|
43
|
-
throw new Error('run_browser value is not a function but ' + typeof runBrowserModule.run_browser);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
cachedRunBrowserTool = runBrowserModule.run_browser as ToolFunction;
|
|
47
|
-
return cachedRunBrowserTool;
|
|
48
|
-
} catch (error) {
|
|
49
|
-
assertsError(error);
|
|
50
|
-
cachedRunBrowserToolError = error;
|
|
51
|
-
throw error;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Resolves the server-side implementation of the `run_browser` tool for Node.js environments.
|
|
57
|
-
*
|
|
58
|
-
* This uses fully lazy resolution to keep CLI startup independent from optional browser tooling.
|
|
59
|
-
* When the server tool cannot be resolved, the fallback implementation throws a helpful error.
|
|
60
|
-
*
|
|
61
|
-
* @private internal utility for USE BROWSER commitment
|
|
62
|
-
*/
|
|
63
|
-
export function resolveRunBrowserToolForNode(): ToolFunction {
|
|
64
|
-
return async (args) => {
|
|
65
|
-
try {
|
|
66
|
-
const runBrowserTool = loadRunBrowserToolForNode();
|
|
67
|
-
return await runBrowserTool(args);
|
|
68
|
-
} catch (error) {
|
|
69
|
-
assertsError(error);
|
|
70
|
-
throw new EnvironmentMismatchError(
|
|
71
|
-
spaceTrim(
|
|
72
|
-
(block) => `
|
|
73
|
-
\`run_browser\` tool is not available in this environment.
|
|
74
|
-
This commitment requires the Agents Server browser runtime with Playwright CLI.
|
|
75
|
-
|
|
76
|
-
${(error as Error).name}:
|
|
77
|
-
${block((error as Error).message)}
|
|
78
|
-
`,
|
|
79
|
-
),
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
}
|
|
@@ -1,146 +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
|
-
import { createSerpSearchToolFunction } from '../_common/createSerpSearchToolFunction';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* USE DEEPSEARCH commitment definition
|
|
12
|
-
*
|
|
13
|
-
* The `USE DEEPSEARCH` commitment indicates that the agent should use a deeper research-oriented
|
|
14
|
-
* search workflow instead of lightweight web search when it needs fresh information from the internet.
|
|
15
|
-
*
|
|
16
|
-
* The content following `USE DEEPSEARCH` is an arbitrary text that the agent should know
|
|
17
|
-
* (e.g. search scope or research instructions).
|
|
18
|
-
*
|
|
19
|
-
* Example usage in agent source:
|
|
20
|
-
*
|
|
21
|
-
* ```book
|
|
22
|
-
* USE DEEPSEARCH
|
|
23
|
-
* USE DEEPSEARCH Compare official vendor documentation with independent benchmarks.
|
|
24
|
-
* ```
|
|
25
|
-
*
|
|
26
|
-
* @private [🪔] Maybe export the commitments through some package
|
|
27
|
-
*/
|
|
28
|
-
export class UseDeepSearchCommitmentDefinition extends BaseCommitmentDefinition<'USE DEEPSEARCH'> {
|
|
29
|
-
public constructor() {
|
|
30
|
-
super('USE DEEPSEARCH');
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
override get requiresContent(): boolean {
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Short one-line description of USE DEEPSEARCH.
|
|
39
|
-
*/
|
|
40
|
-
get description(): string {
|
|
41
|
-
return 'Enable the agent to use DeepSearch for more thorough internet research.';
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Icon for this commitment.
|
|
46
|
-
*/
|
|
47
|
-
get icon(): string {
|
|
48
|
-
return '🔬';
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Markdown documentation for USE DEEPSEARCH commitment.
|
|
53
|
-
*/
|
|
54
|
-
get documentation(): string {
|
|
55
|
-
return spaceTrim(`
|
|
56
|
-
# USE DEEPSEARCH
|
|
57
|
-
|
|
58
|
-
Enables the agent to use DeepSearch for broader, more thorough internet research than lightweight web search.
|
|
59
|
-
|
|
60
|
-
## Key aspects
|
|
61
|
-
|
|
62
|
-
- The content following \`USE DEEPSEARCH\` is arbitrary guidance for the research workflow.
|
|
63
|
-
- In Agents Server, the OpenAI Agents SDK runtime uses a nested deep-research agent for this tool.
|
|
64
|
-
- Use this for investigations, comparisons, market scans, or other tasks that benefit from deeper synthesis.
|
|
65
|
-
- Prefer regular \`USE SEARCH ENGINE\` when a quick factual lookup is enough.
|
|
66
|
-
|
|
67
|
-
## Examples
|
|
68
|
-
|
|
69
|
-
\`\`\`book
|
|
70
|
-
Due Diligence Researcher
|
|
71
|
-
|
|
72
|
-
GOAL Investigate vendors thoroughly before making recommendations.
|
|
73
|
-
USE DEEPSEARCH Compare official sources with credible third-party analysis.
|
|
74
|
-
RULE Cite the strongest supporting sources in the final answer.
|
|
75
|
-
\`\`\`
|
|
76
|
-
|
|
77
|
-
\`\`\`book
|
|
78
|
-
Market Analyst
|
|
79
|
-
|
|
80
|
-
GOAL Build concise but well-grounded research briefs.
|
|
81
|
-
USE DEEPSEARCH Focus on recent public information and competing viewpoints.
|
|
82
|
-
CLOSED
|
|
83
|
-
\`\`\`
|
|
84
|
-
`);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements {
|
|
88
|
-
const existingTools = requirements.tools || [];
|
|
89
|
-
|
|
90
|
-
const updatedTools = existingTools.some((tool) => tool.name === 'deep_search')
|
|
91
|
-
? existingTools
|
|
92
|
-
: [
|
|
93
|
-
...existingTools,
|
|
94
|
-
{
|
|
95
|
-
name: 'deep_search',
|
|
96
|
-
description: spaceTrim(`
|
|
97
|
-
Research the internet deeply and synthesize a grounded answer.
|
|
98
|
-
Use this tool for broader investigations, comparisons, and requests that need more than a quick search.
|
|
99
|
-
`),
|
|
100
|
-
parameters: {
|
|
101
|
-
type: 'object',
|
|
102
|
-
properties: {
|
|
103
|
-
query: {
|
|
104
|
-
type: 'string',
|
|
105
|
-
description: 'The research question or investigation request.',
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
required: ['query'],
|
|
109
|
-
additionalProperties: false,
|
|
110
|
-
},
|
|
111
|
-
} as TODO_any,
|
|
112
|
-
];
|
|
113
|
-
|
|
114
|
-
return appendAggregatedUseCommitmentPlaceholder(
|
|
115
|
-
{
|
|
116
|
-
...requirements,
|
|
117
|
-
tools: updatedTools,
|
|
118
|
-
_metadata: {
|
|
119
|
-
...requirements._metadata,
|
|
120
|
-
useDeepSearch: content || true,
|
|
121
|
-
},
|
|
122
|
-
},
|
|
123
|
-
this.type,
|
|
124
|
-
);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Gets human-readable titles for tool functions provided by this commitment.
|
|
129
|
-
*/
|
|
130
|
-
getToolTitles(): Record<string_javascript_name, string> {
|
|
131
|
-
return {
|
|
132
|
-
deep_search: 'DeepSearch',
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Gets the local fallback implementation for the `deep_search` tool.
|
|
138
|
-
*/
|
|
139
|
-
getToolFunctions(): Record<string_javascript_name, ToolFunction> {
|
|
140
|
-
return {
|
|
141
|
-
deep_search: createSerpSearchToolFunction('deep_search', 'DeepSearch'),
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -1,201 +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 { LlmToolDefinition } from '../../types/LlmToolDefinition';
|
|
5
|
-
import type { string_javascript_name } from '../../types/string_person_fullname';
|
|
6
|
-
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
7
|
-
import { formatOptionalInstructionBlock } from '../_base/formatOptionalInstructionBlock';
|
|
8
|
-
import { parseUseEmailCommitmentContent } from './parseUseEmailCommitmentContent';
|
|
9
|
-
import { sendEmailViaBrowser } from './sendEmailViaBrowser';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Tool name used by USE EMAIL.
|
|
13
|
-
*
|
|
14
|
-
* @private internal USE EMAIL constant
|
|
15
|
-
*/
|
|
16
|
-
const SEND_EMAIL_TOOL_NAME = 'send_email' as string_javascript_name;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* USE EMAIL commitment definition.
|
|
20
|
-
*
|
|
21
|
-
* The `USE EMAIL` commitment enables outbound email sending through the `send_email` tool.
|
|
22
|
-
*
|
|
23
|
-
* @private [🪔] Maybe export the commitments through some package
|
|
24
|
-
*/
|
|
25
|
-
export class UseEmailCommitmentDefinition extends BaseCommitmentDefinition<'USE EMAIL'> {
|
|
26
|
-
public constructor() {
|
|
27
|
-
super('USE EMAIL', ['EMAIL', 'MAIL']);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
override get requiresContent(): boolean {
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Short one-line description of USE EMAIL.
|
|
36
|
-
*/
|
|
37
|
-
get description(): string {
|
|
38
|
-
return 'Enable outbound email sending through a wallet-backed SMTP configuration.';
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Icon for this commitment.
|
|
43
|
-
*/
|
|
44
|
-
get icon(): string {
|
|
45
|
-
return '📧';
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Markdown documentation for USE EMAIL commitment.
|
|
50
|
-
*/
|
|
51
|
-
get documentation(): string {
|
|
52
|
-
return spaceTrim(`
|
|
53
|
-
# USE EMAIL
|
|
54
|
-
|
|
55
|
-
Enables the agent to send outbound emails through SMTP.
|
|
56
|
-
|
|
57
|
-
## Key aspects
|
|
58
|
-
|
|
59
|
-
- The agent sends email via the \`send_email\` tool.
|
|
60
|
-
- SMTP credentials are expected from wallet records (\`ACCESS_TOKEN\`, service \`smtp\`, key \`use-email-smtp-credentials\`).
|
|
61
|
-
- Commitment content can optionally begin with a default sender email address:
|
|
62
|
-
- \`USE EMAIL agent@example.com\`
|
|
63
|
-
- Remaining commitment content is treated as optional email-writing instructions.
|
|
64
|
-
|
|
65
|
-
## Examples
|
|
66
|
-
|
|
67
|
-
\`\`\`book
|
|
68
|
-
Writing Agent
|
|
69
|
-
USE EMAIL agent@example.com
|
|
70
|
-
RULE Write emails to customers according to the instructions from user.
|
|
71
|
-
\`\`\`
|
|
72
|
-
|
|
73
|
-
\`\`\`book
|
|
74
|
-
Formal Email Assistant
|
|
75
|
-
USE EMAIL agent@example.com Keep emails concise and formal.
|
|
76
|
-
\`\`\`
|
|
77
|
-
`);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements {
|
|
81
|
-
const parsedCommitment = parseUseEmailCommitmentContent(content);
|
|
82
|
-
const updatedTools = addUseEmailTools(requirements.tools || []);
|
|
83
|
-
|
|
84
|
-
// Collect all configured sender emails across multiple USE EMAIL commitments
|
|
85
|
-
const existingSenders: string[] = Array.isArray(requirements._metadata?.useEmailSenders)
|
|
86
|
-
? [...(requirements._metadata!.useEmailSenders as string[])]
|
|
87
|
-
: [];
|
|
88
|
-
if (parsedCommitment.senderEmail && !existingSenders.includes(parsedCommitment.senderEmail)) {
|
|
89
|
-
existingSenders.push(parsedCommitment.senderEmail);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const senderBullets =
|
|
93
|
-
existingSenders.length > 0
|
|
94
|
-
? existingSenders
|
|
95
|
-
.map((email, index) =>
|
|
96
|
-
index === 0
|
|
97
|
-
? `- Default sender address: "${email}".`
|
|
98
|
-
: `- Additional sender address: "${email}".`,
|
|
99
|
-
)
|
|
100
|
-
.join('\n')
|
|
101
|
-
: '';
|
|
102
|
-
|
|
103
|
-
const extraInstructions = formatOptionalInstructionBlock('Email instructions', parsedCommitment.instructions);
|
|
104
|
-
|
|
105
|
-
const emailSectionContent = spaceTrim(
|
|
106
|
-
(block) => `
|
|
107
|
-
## Emails
|
|
108
|
-
|
|
109
|
-
- Use \`${SEND_EMAIL_TOOL_NAME}\` to send outbound emails.
|
|
110
|
-
${block(senderBullets)}
|
|
111
|
-
${block(extraInstructions)}
|
|
112
|
-
`,
|
|
113
|
-
);
|
|
114
|
-
|
|
115
|
-
return this.replaceOrCreateSection(
|
|
116
|
-
{
|
|
117
|
-
...requirements,
|
|
118
|
-
tools: updatedTools,
|
|
119
|
-
_metadata: {
|
|
120
|
-
...requirements._metadata,
|
|
121
|
-
useEmail: true,
|
|
122
|
-
...(parsedCommitment.senderEmail ? { useEmailSender: parsedCommitment.senderEmail } : {}),
|
|
123
|
-
useEmailSenders: existingSenders,
|
|
124
|
-
},
|
|
125
|
-
},
|
|
126
|
-
'Emails',
|
|
127
|
-
emailSectionContent,
|
|
128
|
-
);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Gets human-readable titles for tool functions provided by this commitment.
|
|
133
|
-
*/
|
|
134
|
-
getToolTitles(): Record<string_javascript_name, string> {
|
|
135
|
-
return {
|
|
136
|
-
[SEND_EMAIL_TOOL_NAME]: 'Send email',
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Gets the browser-safe `send_email` implementation.
|
|
142
|
-
*
|
|
143
|
-
* Node.js runtime overrides this via `getAllCommitmentsToolFunctionsForNode`.
|
|
144
|
-
*/
|
|
145
|
-
getToolFunctions(): Record<string_javascript_name, ToolFunction> {
|
|
146
|
-
return {
|
|
147
|
-
async [SEND_EMAIL_TOOL_NAME](args: unknown): Promise<string> {
|
|
148
|
-
return sendEmailViaBrowser(args as Record<string, unknown>);
|
|
149
|
-
},
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Adds USE EMAIL tool definition while keeping already registered tools untouched.
|
|
156
|
-
*
|
|
157
|
-
* @private utility of USE EMAIL commitment
|
|
158
|
-
*/
|
|
159
|
-
function addUseEmailTools(existingTools: ReadonlyArray<LlmToolDefinition>): Array<LlmToolDefinition> {
|
|
160
|
-
if (existingTools.some((tool) => tool.name === SEND_EMAIL_TOOL_NAME)) {
|
|
161
|
-
return [...existingTools];
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
return [
|
|
165
|
-
...existingTools,
|
|
166
|
-
{
|
|
167
|
-
name: SEND_EMAIL_TOOL_NAME,
|
|
168
|
-
description: 'Send an outbound email.',
|
|
169
|
-
parameters: {
|
|
170
|
-
type: 'object',
|
|
171
|
-
properties: {
|
|
172
|
-
message: {
|
|
173
|
-
type: 'object',
|
|
174
|
-
description: 'Email payload. Use metadata.subject for the subject line.',
|
|
175
|
-
},
|
|
176
|
-
to: {
|
|
177
|
-
type: 'string',
|
|
178
|
-
description:
|
|
179
|
-
'Legacy alias for recipients (use comma-separated emails or JSON array encoded as string).',
|
|
180
|
-
},
|
|
181
|
-
cc: {
|
|
182
|
-
type: 'string',
|
|
183
|
-
description:
|
|
184
|
-
'Optional CC recipients (use comma-separated emails or JSON array encoded as string).',
|
|
185
|
-
},
|
|
186
|
-
subject: {
|
|
187
|
-
type: 'string',
|
|
188
|
-
description: 'Legacy alias for subject.',
|
|
189
|
-
},
|
|
190
|
-
body: {
|
|
191
|
-
type: 'string',
|
|
192
|
-
description: 'Legacy alias for markdown body content.',
|
|
193
|
-
},
|
|
194
|
-
},
|
|
195
|
-
required: [],
|
|
196
|
-
},
|
|
197
|
-
},
|
|
198
|
-
];
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { spaceTrim } from 'spacetrim';
|
|
2
|
-
import { isValidEmail } from '../../utils/validators/email/isValidEmail';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Lightweight email token matcher used for `USE EMAIL` first-line parsing.
|
|
6
|
-
*
|
|
7
|
-
* @private internal USE EMAIL constant
|
|
8
|
-
*/
|
|
9
|
-
const EMAIL_TOKEN_PATTERN = /[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Parsed payload of one `USE EMAIL` commitment.
|
|
13
|
-
*
|
|
14
|
-
* @private internal USE EMAIL type
|
|
15
|
-
*/
|
|
16
|
-
export type ParsedUseEmailCommitmentContent = {
|
|
17
|
-
senderEmail: string | null;
|
|
18
|
-
senderEmailRaw: string | null;
|
|
19
|
-
instructions: string;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Parses `USE EMAIL` commitment content into optional sender email + additional instructions.
|
|
24
|
-
*
|
|
25
|
-
* Examples:
|
|
26
|
-
* - `agent@example.com`
|
|
27
|
-
* - `agent@example.com Keep emails concise`
|
|
28
|
-
* - `Keep emails concise`
|
|
29
|
-
*
|
|
30
|
-
* @private internal utility of USE EMAIL commitment
|
|
31
|
-
*/
|
|
32
|
-
export function parseUseEmailCommitmentContent(content: string): ParsedUseEmailCommitmentContent {
|
|
33
|
-
const trimmedContent = spaceTrim(content);
|
|
34
|
-
if (!trimmedContent) {
|
|
35
|
-
return {
|
|
36
|
-
senderEmail: null,
|
|
37
|
-
senderEmailRaw: null,
|
|
38
|
-
instructions: '',
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const lines = trimmedContent
|
|
43
|
-
.split(/\r?\n/)
|
|
44
|
-
.map((line) => line.trim())
|
|
45
|
-
.filter(Boolean);
|
|
46
|
-
if (lines.length === 0) {
|
|
47
|
-
return {
|
|
48
|
-
senderEmail: null,
|
|
49
|
-
senderEmailRaw: null,
|
|
50
|
-
instructions: '',
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const firstLine = lines[0] || '';
|
|
55
|
-
const senderMatch = firstLine.match(EMAIL_TOKEN_PATTERN);
|
|
56
|
-
const senderEmailRaw = senderMatch?.[0] || null;
|
|
57
|
-
const senderEmail = senderEmailRaw && isValidEmail(senderEmailRaw) ? senderEmailRaw : null;
|
|
58
|
-
|
|
59
|
-
let firstLineWithoutSender = firstLine;
|
|
60
|
-
if (senderEmailRaw) {
|
|
61
|
-
const matchIndex = firstLine.indexOf(senderEmailRaw);
|
|
62
|
-
const prefix = firstLine.slice(0, matchIndex).trim();
|
|
63
|
-
const suffix = firstLine.slice(matchIndex + senderEmailRaw.length).trim();
|
|
64
|
-
firstLineWithoutSender = [prefix, suffix].filter(Boolean).join(' ').trim();
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const instructionLines = [firstLineWithoutSender, ...lines.slice(1)].filter(Boolean);
|
|
68
|
-
const instructions = instructionLines.join('\n').trim();
|
|
69
|
-
|
|
70
|
-
return {
|
|
71
|
-
senderEmail,
|
|
72
|
-
senderEmailRaw,
|
|
73
|
-
instructions,
|
|
74
|
-
};
|
|
75
|
-
}
|
|
@@ -1,44 +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 implementation of the send_email tool for Node.js environments.
|
|
7
|
-
*
|
|
8
|
-
* This uses a lazy require so the core package can still load even if the Agents Server
|
|
9
|
-
* module is unavailable. When the server tool cannot be resolved, a fallback implementation
|
|
10
|
-
* throws a helpful error message.
|
|
11
|
-
*
|
|
12
|
-
* @private internal utility for USE EMAIL commitment
|
|
13
|
-
*/
|
|
14
|
-
export function resolveSendEmailToolForNode(): ToolFunction {
|
|
15
|
-
try {
|
|
16
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
17
|
-
const { send_email } = require('../../../apps/agents-server/src/tools/send_email');
|
|
18
|
-
|
|
19
|
-
if (typeof send_email !== 'function') {
|
|
20
|
-
throw new Error('send_email value is not a function but ' + typeof send_email);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return send_email as ToolFunction;
|
|
24
|
-
} catch (error) {
|
|
25
|
-
const normalizedError =
|
|
26
|
-
error instanceof Error
|
|
27
|
-
? error
|
|
28
|
-
: new Error(typeof error === 'string' ? error : JSON.stringify(error ?? 'Unknown error'));
|
|
29
|
-
|
|
30
|
-
return async () => {
|
|
31
|
-
throw new EnvironmentMismatchError(
|
|
32
|
-
spaceTrim(
|
|
33
|
-
(block) => `
|
|
34
|
-
\`send_email\` tool is not available in this environment.
|
|
35
|
-
This commitment requires Agents Server runtime with wallet-backed SMTP sending.
|
|
36
|
-
|
|
37
|
-
${normalizedError.name}:
|
|
38
|
-
${block(normalizedError.message)}
|
|
39
|
-
`,
|
|
40
|
-
),
|
|
41
|
-
);
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Client-side safe wrapper for sending emails.
|
|
3
|
-
*
|
|
4
|
-
* This function proxies requests to the Agents Server API endpoint for email queuing,
|
|
5
|
-
* making it safe to use in browser environments.
|
|
6
|
-
*
|
|
7
|
-
* @param args Email payload forwarded to the server-side `send_email` tool
|
|
8
|
-
* @param agentsServerUrl The base URL of the agents server (defaults to current origin)
|
|
9
|
-
* @returns Result string from the server-side send_email tool
|
|
10
|
-
*
|
|
11
|
-
* @private internal utility for USE EMAIL commitment
|
|
12
|
-
*/
|
|
13
|
-
export async function sendEmailViaBrowser(args: Record<string, unknown>, agentsServerUrl?: string): Promise<string> {
|
|
14
|
-
try {
|
|
15
|
-
const baseUrl = agentsServerUrl || (typeof window !== 'undefined' ? window.location.origin : '');
|
|
16
|
-
|
|
17
|
-
if (!baseUrl) {
|
|
18
|
-
throw new Error('Agents server URL is required in non-browser environments');
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const apiUrl = new URL('/api/send-email', baseUrl);
|
|
22
|
-
|
|
23
|
-
const response = await fetch(apiUrl.toString(), {
|
|
24
|
-
method: 'POST',
|
|
25
|
-
headers: {
|
|
26
|
-
'Content-Type': 'application/json',
|
|
27
|
-
},
|
|
28
|
-
body: JSON.stringify(args),
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
if (!response.ok) {
|
|
32
|
-
const errorData = await response.json().catch(() => ({ error: 'Unknown error' }));
|
|
33
|
-
throw new Error(`Failed to send email: ${errorData.error || response.statusText}`);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const data = await response.json();
|
|
37
|
-
|
|
38
|
-
if (!data.success) {
|
|
39
|
-
throw new Error(`Email sending failed: ${data.error || 'Unknown error'}`);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return typeof data.result === 'string' ? data.result : JSON.stringify(data.result);
|
|
43
|
-
} catch (error) {
|
|
44
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
45
|
-
throw new Error(`Error sending email via browser: ${errorMessage}`);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
TODO: [🔰] USE SEARCH is working only in demo mode only. Need to implement full functionality via MCP server and Search engines
|