@promptbook/cli 0.114.0-5 → 0.114.0-7
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/agents/default/developer.book +1 -0
- package/apps/agents-server/next.config.ts +22 -0
- package/apps/agents-server/package.json +6 -6
- package/apps/agents-server/scripts/build-agents-server.js +43 -7
- package/apps/agents-server/scripts/build-e2e.js +12 -2
- package/apps/agents-server/scripts/generate-reserved-paths/generate-reserved-paths.ts +30 -16
- package/apps/agents-server/scripts/kill-port.js +163 -0
- package/apps/agents-server/scripts/run-e2e-tests.js +21 -8
- package/apps/agents-server/scripts/run-npm.js +81 -5
- package/apps/agents-server/src/app/actions.ts +3 -0
- package/apps/agents-server/src/app/admin/email-server/page.tsx +17 -18
- package/apps/agents-server/src/app/admin/task-manager/TaskManagerTaskRow.tsx +2 -0
- package/apps/agents-server/src/app/admin/task-manager/[taskId]/TaskManagerTaskDetailClient.tsx +2 -0
- package/apps/agents-server/src/app/admin/task-manager/taskManagerTaskPresentation.tsx +23 -0
- package/apps/agents-server/src/app/agents/[agentName]/api/book/route.ts +7 -0
- package/apps/agents-server/src/app/agents/[agentName]/api/timeouts/[timeoutId]/route.ts +10 -153
- package/apps/agents-server/src/app/agents/[agentName]/api/timeouts/route.ts +9 -4
- package/apps/agents-server/src/app/agents/[agentName]/api/user-chats/[chatId]/route.ts +3 -0
- package/apps/agents-server/src/app/agents/[agentName]/api/user-chats/[chatId]/stream/route.ts +2 -0
- package/apps/agents-server/src/app/agents/[agentName]/api/user-chats/resolveUserChatScope.ts +8 -1
- package/apps/agents-server/src/app/agents/[agentName]/api/user-chats/route.ts +15 -7
- package/apps/agents-server/src/app/agents/[agentName]/book/useBookEditorSaving.ts +18 -28
- package/apps/agents-server/src/app/agents/[agentName]/chat/AgentChatHistoryClient.tsx +19 -1
- package/apps/agents-server/src/app/agents/[agentName]/chat/AgentChatSidebarDefault.tsx +17 -5
- package/apps/agents-server/src/app/agents/[agentName]/chat/AgentGoalChatNotice.tsx +23 -0
- package/apps/agents-server/src/app/agents/[agentName]/chat/AgentGoalChatPlannedMessages.tsx +153 -0
- package/apps/agents-server/src/app/agents/[agentName]/chat/CanonicalAgentChatPanel.tsx +6 -0
- package/apps/agents-server/src/app/agents/[agentName]/chat/CanonicalAgentChatSurface.tsx +13 -0
- package/apps/agents-server/src/app/agents/[agentName]/chat/ExternalUserChatAdminActions.tsx +51 -3
- package/apps/agents-server/src/app/agents/[agentName]/chat/TeamMemberFrozenChatPrimaryAgentLink.tsx +31 -0
- package/apps/agents-server/src/app/agents/[agentName]/chat/useAgentChatSidebarState.ts +26 -2
- package/apps/agents-server/src/app/agents/[agentName]/goal/page.tsx +35 -0
- package/apps/agents-server/src/app/agents/[agentName]/projects/[projectName]/page.tsx +2 -2
- package/apps/agents-server/src/app/api/admin/dns-records/cloudflare/route.ts +26 -16
- package/apps/agents-server/src/app/api/emails/incoming/stalwart/route.ts +9 -2
- package/apps/agents-server/src/app/superadmin/servers/ServersRegistryTable.tsx +31 -39
- package/apps/agents-server/src/components/AgentProfile/AgentProfile.tsx +10 -3
- package/apps/agents-server/src/components/AgentProjects/AgentProjectIcon.tsx +137 -0
- package/apps/agents-server/src/components/AgentProjects/AgentProjectItem.tsx +26 -10
- package/apps/agents-server/src/components/CloudflareDnsWizard/CloudflareDnsApiTokenImportStep.tsx +5 -6
- package/apps/agents-server/src/components/CloudflareDnsWizard/CloudflareDnsCheckStep.tsx +6 -5
- package/apps/agents-server/src/components/CloudflareDnsWizard/CloudflareDnsManualStep.tsx +10 -14
- package/apps/agents-server/src/components/CloudflareDnsWizard/CloudflareDnsWizard.tsx +11 -20
- package/apps/agents-server/src/components/CloudflareDnsWizard/useCloudflareDnsRecordImport.ts +5 -6
- package/apps/agents-server/src/components/DnsRecordsInstructions/DnsRecordsInstructions.tsx +91 -57
- package/apps/agents-server/src/components/DnsRecordsInstructions/DnsRecordsSectionPanel.tsx +63 -0
- package/apps/agents-server/src/components/DnsRecordsInstructions/DnsRecordsSectionVariantTabs.tsx +67 -0
- package/apps/agents-server/src/components/DnsRecordsInstructions/DnsRecordsTable.tsx +40 -0
- package/apps/agents-server/src/components/Header/buildActiveAgentViewItems.ts +5 -4
- package/apps/agents-server/src/components/Header/createAgentViewLabel.tsx +4 -4
- package/apps/agents-server/src/components/Header/resolveActiveAgentNavigation.ts +2 -2
- package/apps/agents-server/src/components/Homepage/useAgentsListImportExportState.ts +22 -10
- package/apps/agents-server/src/components/_utils/generateMetaTxt.ts +1 -1
- package/apps/agents-server/src/database/migratePrefix.ts +13 -12
- package/apps/agents-server/src/database/migrations/2026-08-0100-agent-goal-chat-source.sql +10 -0
- package/apps/agents-server/src/generated/reservedPaths.ts +42 -42
- package/apps/agents-server/src/languages/ServerTranslationKeys.ts +9 -1
- package/apps/agents-server/src/languages/translations/czech.yaml +9 -1
- package/apps/agents-server/src/languages/translations/english.yaml +9 -1
- package/apps/agents-server/src/message-providers/email/stalwart/parseInboundStalwartEmail.ts +17 -2
- package/apps/agents-server/src/utils/agentGoalChat/agentGoalChatConstants.ts +9 -0
- package/apps/agents-server/src/utils/agentGoalChat/agentGoalChatIdentity.ts +28 -0
- package/apps/agents-server/src/utils/agentGoalChat/appendAgentGoalChatNote.ts +43 -0
- package/apps/agents-server/src/utils/agentGoalChat/canAccessAgentGoalChat.ts +14 -0
- package/apps/agents-server/src/utils/agentGoalChat/createAgentGoalChatNoteContent.ts +69 -0
- package/apps/agents-server/src/utils/agentGoalChat/ensureAgentGoalChat.ts +66 -0
- package/apps/agents-server/src/utils/agentGoalChat/prependAgentGoalChatSummarySeed.ts +40 -0
- package/apps/agents-server/src/utils/agentGoalChat/recordAgentGoalChatLifecycleNote.ts +36 -0
- package/apps/agents-server/src/utils/agentGoalChat/resolveAgentGoalChatOwnerUserId.ts +104 -0
- package/apps/agents-server/src/utils/agentGoalChat/scheduleAgentGoalChatModifiedNote.ts +82 -0
- package/apps/agents-server/src/utils/agentGoalChat.ts +19 -0
- package/apps/agents-server/src/utils/agentProjects/AgentProjectInfo.ts +10 -1
- package/apps/agents-server/src/utils/agentProjects/AgentProjectReferenceInfo.ts +5 -2
- package/apps/agents-server/src/utils/agentProjects/agentProjectFileNames.ts +21 -0
- package/apps/agents-server/src/utils/agentProjects/agentProjectHrefs.ts +20 -11
- package/apps/agents-server/src/utils/agentProjects/agentProjectsPaths.ts +15 -5
- package/apps/agents-server/src/utils/agentProjects/createAgentProjectInitials.ts +36 -0
- package/apps/agents-server/src/utils/agentProjects/createAgentProjectMarkdownReferences.ts +11 -9
- package/apps/agents-server/src/utils/agentProjects/createAgentProjectsDnsRecordsSection.ts +113 -0
- package/apps/agents-server/src/utils/agentProjects/createStaticAgentProjectServer.ts +2 -6
- package/apps/agents-server/src/utils/agentProjects/humanizeAgentProjectName.ts +25 -0
- package/apps/agents-server/src/utils/agentProjects/listAgentProjectChatReferences.ts +10 -3
- package/apps/agents-server/src/utils/agentProjects/parseAgentProjectIndexHtml.ts +167 -0
- package/apps/agents-server/src/utils/agentProjects/readAgentProjectIndexHtmlProfile.ts +24 -0
- package/apps/agents-server/src/utils/agentProjects/readAgentProjectReadme.ts +3 -53
- package/apps/agents-server/src/utils/agentProjects/readAgentProjectRootTextFile.ts +73 -0
- package/apps/agents-server/src/utils/agentProjects/resolveAgentProjectFaviconRelativePath.ts +108 -0
- package/apps/agents-server/src/utils/agentProjects/resolveAgentProjectInfo.ts +12 -3
- package/apps/agents-server/src/utils/agentProjects/{resolveAgentProjectReadmeProfile.ts → resolveAgentProjectProfile.ts} +33 -33
- package/apps/agents-server/src/utils/agentProjects/resolveAgentProjectPublicUrls.ts +34 -0
- package/apps/agents-server/src/utils/bookLanguageDocumentation/createBookLanguageDocumentationPdfResponse.ts +19 -17
- package/apps/agents-server/src/utils/chatTasksAdmin.ts +9 -0
- package/apps/agents-server/src/utils/dnsRecords/DnsRecordInstruction.ts +20 -0
- package/apps/agents-server/src/utils/dnsRecords/DnsRecordsSection.ts +77 -0
- package/apps/agents-server/src/utils/dnsRecords/createServerDnsRecordsSections.ts +58 -0
- package/apps/agents-server/src/utils/dnsRecords/createServerDomainDnsRecordsSection.ts +48 -0
- package/apps/agents-server/src/utils/dnsRecords/dnsRecordGroups.ts +52 -0
- package/apps/agents-server/src/utils/dnsRecords/resolveDnsRecordBatchPlan.ts +47 -1
- package/apps/agents-server/src/utils/getAdminChatTasksResponse/getAdminChatTasks/adminChatTaskSqlQuery.ts +41 -36
- package/apps/agents-server/src/utils/getAdminChatTasksResponse/getAdminChatTasks/mapAdminChatTaskFallbackRows.ts +3 -0
- package/apps/agents-server/src/utils/getAdminChatTasksResponse/getAdminChatTasks/mapAdminChatTaskSqlRows.ts +2 -0
- package/apps/agents-server/src/utils/localChatRunner/parseLocalTeamConversations.ts +281 -0
- package/apps/agents-server/src/utils/localChatRunner/persistLocalTeamConversations.ts +71 -0
- package/apps/agents-server/src/utils/localChatRunner/prepareLocalTeamConversationWorkspace.ts +233 -0
- package/apps/agents-server/src/utils/localChatRunner/processLocalUserChatJob.ts +37 -6
- package/apps/agents-server/src/utils/serverManagement/createManagedServer/insertManagedServerRegistryRow.ts +2 -2
- package/apps/agents-server/src/utils/serverManagement/createManagedServer/seedServerCoreAgents.ts +7 -6
- package/apps/agents-server/src/utils/serverManagement/createManagedServer/seedServerDefaultAgents.ts +5 -4
- package/apps/agents-server/src/utils/serverManagement/createManagedServer/seedServerMetadata.ts +3 -2
- package/apps/agents-server/src/utils/serverManagement/createManagedServer/seedServerUsers.ts +3 -2
- package/apps/agents-server/src/utils/serverManagement/deleteManagedServer.ts +2 -2
- package/apps/agents-server/src/utils/stalwart/createEmailDnsRecordsSection.ts +53 -0
- package/apps/agents-server/src/utils/userChat/UserChatRecord.ts +13 -0
- package/apps/agents-server/src/utils/userChat/UserChatSource.ts +14 -0
- package/apps/agents-server/src/utils/userChat/createUserChatSummary.ts +10 -2
- package/apps/agents-server/src/utils/userChat/finalizeUserChatJob.ts +3 -2
- package/apps/agents-server/src/utils/userChat/getUserChat.ts +16 -1
- package/apps/agents-server/src/utils/userChat/getUserChatForJobRunner.ts +31 -0
- package/apps/agents-server/src/utils/userChat/listUserChats.ts +113 -110
- package/apps/agents-server/src/utils/userChat/persistFrozenUserChat.ts +21 -6
- package/apps/agents-server/src/utils/userChat/runImmediateUserChatAnswer.ts +2 -6
- package/apps/agents-server/src/utils/userChat/runUserChatJob.ts +2 -6
- package/apps/agents-server/src/utils/userChat/teamMemberUserChatContext.ts +63 -0
- package/apps/agents-server/src/utils/userChat.ts +5 -1
- package/apps/agents-server/src/utils/userChatClient/cancelAgentUserTimeout.ts +2 -2
- package/apps/agents-server/src/utils/userChatClient/fetchAgentUserTimeouts.ts +2 -2
- package/apps/agents-server/src/utils/userChatClient.ts +9 -31
- package/apps/agents-server/src/utils/userChatTimeout/UserChatTimeoutRecord.ts +10 -2
- package/apps/agents-server/src/utils/userChatTimeout/userChatTimeoutStore/claimNextDueUserChatTimeout.ts +28 -25
- package/apps/agents-server/src/utils/userChatTimeout/userChatTimeoutStore/getAgentScopedUserChatTimeout.ts +8 -4
- package/apps/agents-server/src/utils/userChatTimeout/userChatTimeoutStore/listAgentUserChatTimeouts.ts +4 -1
- package/apps/agents-server/src/utils/userChatTimeout/userChatTimeoutStore/recoverExpiredRunningUserChatTimeouts.ts +3 -2
- package/apps/agents-server/src/utils/userChatTimeout/userChatTimeoutWorker.ts +53 -0
- package/esm/index.es.js +1534 -401
- package/esm/index.es.js.map +1 -1
- package/esm/scripts/run-agent-messages/messages/buildAgentMessagePrompt.d.ts +7 -1
- package/esm/scripts/run-agent-messages/messages/buildAgentTeamPromptSection.d.ts +12 -0
- package/esm/scripts/run-agent-messages/messages/finalizeAgentTeamConversationWorkspace.d.ts +16 -0
- package/esm/scripts/run-agent-messages/messages/loadAgentTeamConversationWorkspace.d.ts +6 -0
- package/esm/scripts/run-codex-prompts/common/normalizeLineEndingsInChangedFiles.d.ts +2 -3
- package/esm/scripts/run-codex-prompts/git/coderCommitScope.d.ts +31 -0
- package/esm/scripts/run-codex-prompts/git/coderGitSync.d.ts +15 -2
- package/esm/scripts/run-codex-prompts/git/commitChanges.d.ts +9 -3
- package/esm/scripts/run-codex-prompts/git/workingTreeChanges.d.ts +40 -0
- package/esm/scripts/run-codex-prompts/server/coderServerHtml.d.ts +1 -1
- package/esm/scripts/run-codex-prompts/ui/buildCoderRunAgentVisual.d.ts +5 -5
- package/esm/scripts/run-codex-prompts/ui/buildCoderRunUiTerminalFrameUpdate.d.ts +27 -0
- package/esm/src/avatars/renderAvatarVisualTerminalText.d.ts +80 -0
- package/esm/src/avatars/types/AvatarVisualDefinition.d.ts +54 -0
- package/esm/src/book-3.0/AgentTeamConversationWorkspace.d.ts +85 -0
- package/esm/src/book-components/Chat/Chat/ChatProps.d.ts +3 -2
- package/esm/src/book-components/Chat/utils/renderMarkdown.d.ts +12 -3
- package/esm/src/cli/cli-commands/coder/boilerplateCount.d.ts +1 -1
- package/esm/src/cli/cli-commands/coder/generate-boilerplates.d.ts +1 -1
- package/esm/src/cli/cli-commands/common/{harness/$askForHarnessInstallationApproval.d.ts → npm/$askForNpmPackageInstallationApproval.d.ts} +2 -2
- package/{umd/src/cli/cli-commands/common/harness/$resolveLatestHarnessVersion.d.ts → esm/src/cli/cli-commands/common/npm/$resolveLatestNpmPackageVersion.d.ts} +2 -3
- package/esm/src/cli/cli-commands/common/npm/extractNpmPackageVersionFromOutput.d.ts +12 -0
- package/esm/src/cli/cli-commands/common/npm/isNpmPackageVersionOutdated.d.ts +9 -0
- package/esm/src/cli/cli-commands/common/promptbook-cli/$checkPromptbookCliInstallations.d.ts +9 -0
- package/esm/src/cli/cli-commands/common/promptbook-cli/$ensurePromptbookCliInstallations.d.ts +14 -0
- package/esm/src/cli/cli-commands/common/promptbook-cli/$ensurePromptbookCliInstallations.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/common/promptbook-cli/$resolvePromptbookCliInstallations.d.ts +12 -0
- package/esm/src/cli/cli-commands/common/promptbook-cli/$resolvePromptbookCliInstallations.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/common/promptbook-cli/$updatePromptbookCliInstallation.d.ts +10 -0
- package/esm/src/cli/cli-commands/common/promptbook-cli/PromptbookCliInstallation.d.ts +39 -0
- package/esm/src/cli/cli-commands/common/promptbook-cli/PromptbookCliInstallationStatus.d.ts +26 -0
- package/esm/src/cli/cli-commands/common/promptbook-cli/buildPromptbookCliInstallCommand.d.ts +7 -0
- package/esm/src/cli/cli-commands/common/promptbook-cli/buildPromptbookCliInstallCommand.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/common/promptbook-cli/formatPromptbookCliInstallationWarning.d.ts +7 -0
- package/esm/src/utils/agent-message-runtime/resolveAgentMessageRuntimeActivity.d.ts +3 -3
- package/esm/src/utils/agents/terminalAgentAvatarVisual.d.ts +5 -2
- package/esm/src/utils/ascii-art/convertImageDataToAsciiArt.d.ts +6 -0
- package/esm/src/utils/ascii-art/createAnsiColorCode.d.ts +46 -0
- package/esm/src/utils/misc/debounce.d.ts +4 -2
- package/esm/src/utils/misc/debounce.test.d.ts +1 -0
- package/esm/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/avatars/renderAvatarVisualTerminalText.ts +249 -0
- package/src/avatars/types/AvatarVisualDefinition.ts +60 -0
- package/src/avatars/visuals/asciiOctopusAvatarVisual.ts +144 -22
- package/src/book-2.0/book-language-documentation/createStandaloneBookLanguageMarkdown.ts +4 -4
- package/src/book-2.0/book-language-documentation/renderCommitmentCatalogSection.ts +1 -4
- package/src/book-2.0/book-language-documentation/renderGroupedCommitmentDocumentationMarkdown.ts +4 -17
- package/src/book-3.0/AgentTeamConversationWorkspace.ts +172 -0
- package/src/book-components/BookEditor/useBookEditorMonacoStyles.ts +56 -55
- package/src/book-components/Chat/Chat/Chat.module.css +1 -8
- package/src/book-components/Chat/Chat/ChatMessageMap.tsx +8 -4
- package/src/book-components/Chat/Chat/ChatProps.tsx +3 -2
- package/src/book-components/Chat/MarkdownContent/MarkdownContent.module.css +14 -14
- package/src/book-components/Chat/save/react/exports/chat-preview-2025-10-13 (1).jsx +95 -5
- package/src/book-components/Chat/utils/renderMarkdown.ts +535 -89
- package/src/cli/cli-commands/coder/add.ts +3 -3
- package/src/cli/cli-commands/coder/boilerplateCount.ts +1 -1
- package/src/cli/cli-commands/coder/generate-boilerplates.ts +27 -27
- package/src/cli/cli-commands/coder/getDefaultCoderPackageJsonScripts.ts +5 -4
- package/src/cli/cli-commands/coder/init.ts +3 -3
- package/src/cli/cli-commands/coder/run.ts +10 -2
- package/src/cli/cli-commands/common/coderGitSyncCliOptions.ts +6 -2
- package/src/cli/cli-commands/common/harness/$applyHarnessInstallationStatus.ts +2 -2
- package/src/cli/cli-commands/common/harness/$checkHarnessInstallation.ts +4 -4
- package/src/cli/cli-commands/common/harness/$resolveInstalledHarnessVersion.ts +2 -2
- package/src/cli/cli-commands/common/{harness/$askForHarnessInstallationApproval.ts → npm/$askForNpmPackageInstallationApproval.ts} +3 -3
- package/src/cli/cli-commands/common/npm/$resolveLatestNpmPackageVersion.ts +49 -0
- package/src/cli/cli-commands/common/npm/extractNpmPackageVersionFromOutput.ts +25 -0
- package/src/cli/cli-commands/common/{harness/isHarnessVersionOutdated.ts → npm/isNpmPackageVersionOutdated.ts} +6 -4
- package/src/cli/cli-commands/common/projectInitialization.ts +10 -1
- package/src/cli/cli-commands/common/promptbook-cli/$checkPromptbookCliInstallations.ts +73 -0
- package/src/cli/cli-commands/common/promptbook-cli/$ensurePromptbookCliInstallations.ts +94 -0
- package/src/cli/cli-commands/common/promptbook-cli/$resolvePromptbookCliInstallations.ts +223 -0
- package/src/cli/cli-commands/common/promptbook-cli/$updatePromptbookCliInstallation.ts +53 -0
- package/src/cli/cli-commands/common/promptbook-cli/PromptbookCliInstallation.ts +46 -0
- package/src/cli/cli-commands/common/promptbook-cli/PromptbookCliInstallationStatus.ts +32 -0
- package/src/cli/cli-commands/common/promptbook-cli/buildPromptbookCliInstallCommand.ts +22 -0
- package/src/cli/cli-commands/common/promptbook-cli/formatPromptbookCliInstallationWarning.ts +47 -0
- package/src/commands/FORMAT/formatCommandParser.ts +2 -2
- package/src/llm-providers/openai/utils/buildToolInvocationScript.ts +21 -18
- package/src/other/templates/getTemplatesPipelineCollection.ts +976 -668
- package/src/utils/agent-message-runtime/resolveAgentMessageRuntimeActivity.ts +80 -27
- package/src/utils/agents/terminalAgentAvatarVisual.ts +31 -3
- package/src/utils/ascii-art/convertImageDataToAsciiArt.ts +9 -109
- package/src/utils/ascii-art/createAnsiColorCode.ts +132 -0
- package/src/utils/misc/debounce.ts +26 -5
- package/src/version.ts +2 -2
- package/src/versions.txt +2 -0
- package/umd/index.umd.js +1533 -400
- package/umd/index.umd.js.map +1 -1
- package/umd/scripts/run-agent-messages/messages/buildAgentMessagePrompt.d.ts +7 -1
- package/umd/scripts/run-agent-messages/messages/buildAgentTeamPromptSection.d.ts +12 -0
- package/umd/scripts/run-agent-messages/messages/finalizeAgentTeamConversationWorkspace.d.ts +16 -0
- package/umd/scripts/run-agent-messages/messages/loadAgentTeamConversationWorkspace.d.ts +6 -0
- package/umd/scripts/run-codex-prompts/common/normalizeLineEndingsInChangedFiles.d.ts +2 -3
- package/umd/scripts/run-codex-prompts/git/coderCommitScope.d.ts +31 -0
- package/umd/scripts/run-codex-prompts/git/coderGitSync.d.ts +15 -2
- package/umd/scripts/run-codex-prompts/git/commitChanges.d.ts +9 -3
- package/umd/scripts/run-codex-prompts/git/workingTreeChanges.d.ts +40 -0
- package/umd/scripts/run-codex-prompts/server/coderServerHtml.d.ts +1 -1
- package/umd/scripts/run-codex-prompts/ui/buildCoderRunAgentVisual.d.ts +5 -5
- package/umd/scripts/run-codex-prompts/ui/buildCoderRunUiTerminalFrameUpdate.d.ts +27 -0
- package/umd/src/avatars/renderAvatarVisualTerminalText.d.ts +80 -0
- package/umd/src/avatars/renderAvatarVisualTerminalText.test.d.ts +1 -0
- package/umd/src/avatars/types/AvatarVisualDefinition.d.ts +54 -0
- package/umd/src/book-3.0/AgentTeamConversationWorkspace.d.ts +85 -0
- package/umd/src/book-components/Chat/Chat/ChatProps.d.ts +3 -2
- package/umd/src/book-components/Chat/utils/renderMarkdown.d.ts +12 -3
- package/umd/src/cli/cli-commands/coder/boilerplateCount.d.ts +1 -1
- package/umd/src/cli/cli-commands/coder/generate-boilerplates.d.ts +1 -1
- package/umd/src/cli/cli-commands/common/{harness/$askForHarnessInstallationApproval.d.ts → npm/$askForNpmPackageInstallationApproval.d.ts} +2 -2
- package/{esm/src/cli/cli-commands/common/harness/$resolveLatestHarnessVersion.d.ts → umd/src/cli/cli-commands/common/npm/$resolveLatestNpmPackageVersion.d.ts} +2 -3
- package/umd/src/cli/cli-commands/common/npm/$resolveLatestNpmPackageVersion.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/npm/extractNpmPackageVersionFromOutput.d.ts +12 -0
- package/umd/src/cli/cli-commands/common/npm/extractNpmPackageVersionFromOutput.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/npm/isNpmPackageVersionOutdated.d.ts +9 -0
- package/umd/src/cli/cli-commands/common/npm/isNpmPackageVersionOutdated.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/promptbook-cli/$checkPromptbookCliInstallations.d.ts +9 -0
- package/umd/src/cli/cli-commands/common/promptbook-cli/$ensurePromptbookCliInstallations.d.ts +14 -0
- package/umd/src/cli/cli-commands/common/promptbook-cli/$ensurePromptbookCliInstallations.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/promptbook-cli/$resolvePromptbookCliInstallations.d.ts +12 -0
- package/umd/src/cli/cli-commands/common/promptbook-cli/$resolvePromptbookCliInstallations.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/promptbook-cli/$updatePromptbookCliInstallation.d.ts +10 -0
- package/umd/src/cli/cli-commands/common/promptbook-cli/PromptbookCliInstallation.d.ts +39 -0
- package/umd/src/cli/cli-commands/common/promptbook-cli/PromptbookCliInstallationStatus.d.ts +26 -0
- package/umd/src/cli/cli-commands/common/promptbook-cli/buildPromptbookCliInstallCommand.d.ts +7 -0
- package/umd/src/cli/cli-commands/common/promptbook-cli/buildPromptbookCliInstallCommand.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/promptbook-cli/formatPromptbookCliInstallationWarning.d.ts +7 -0
- package/umd/src/utils/agent-message-runtime/resolveAgentMessageRuntimeActivity.d.ts +3 -3
- package/umd/src/utils/agents/terminalAgentAvatarVisual.d.ts +5 -2
- package/umd/src/utils/ascii-art/convertImageDataToAsciiArt.d.ts +6 -0
- package/umd/src/utils/ascii-art/createAnsiColorCode.d.ts +46 -0
- package/umd/src/utils/misc/debounce.d.ts +4 -2
- package/umd/src/utils/misc/debounce.test.d.ts +1 -0
- package/umd/src/version.d.ts +1 -1
- package/apps/agents-server/scripts/ignore-kill-eperm.js +0 -31
- package/apps/agents-server/src/app/agents/[agentName]/api/timeouts/actions/route.ts +0 -103
- package/apps/agents-server/src/app/agents/[agentName]/timeouts/AgentTimeoutsClient.tsx +0 -43
- package/apps/agents-server/src/app/agents/[agentName]/timeouts/AgentTimeoutsEditDialog.tsx +0 -98
- package/apps/agents-server/src/app/agents/[agentName]/timeouts/AgentTimeoutsFiltersCard.tsx +0 -75
- package/apps/agents-server/src/app/agents/[agentName]/timeouts/AgentTimeoutsHeader.tsx +0 -53
- package/apps/agents-server/src/app/agents/[agentName]/timeouts/AgentTimeoutsSummaryMetrics.tsx +0 -70
- package/apps/agents-server/src/app/agents/[agentName]/timeouts/AgentTimeoutsTableCard.tsx +0 -58
- package/apps/agents-server/src/app/agents/[agentName]/timeouts/AgentTimeoutsTableRow.tsx +0 -242
- package/apps/agents-server/src/app/agents/[agentName]/timeouts/loading.tsx +0 -15
- package/apps/agents-server/src/app/agents/[agentName]/timeouts/page.tsx +0 -28
- package/apps/agents-server/src/app/agents/[agentName]/timeouts/useAgentTimeoutsClientState.ts +0 -769
- package/apps/agents-server/src/components/AgentProjectDnsInstructions/AgentProjectDnsInstructions.tsx +0 -182
- package/apps/agents-server/src/utils/userChatClient/runAgentUserTimeoutBulkAction.ts +0 -24
- package/apps/agents-server/src/utils/userChatClient/updateAgentUserTimeout.ts +0 -25
- package/esm/src/cli/cli-commands/common/harness/extractHarnessVersionFromOutput.d.ts +0 -11
- package/esm/src/cli/cli-commands/common/harness/isHarnessVersionOutdated.d.ts +0 -9
- package/src/cli/cli-commands/common/harness/$resolveLatestHarnessVersion.ts +0 -34
- package/src/cli/cli-commands/common/harness/extractHarnessVersionFromOutput.ts +0 -28
- package/umd/src/cli/cli-commands/common/harness/extractHarnessVersionFromOutput.d.ts +0 -11
- package/umd/src/cli/cli-commands/common/harness/isHarnessVersionOutdated.d.ts +0 -9
- /package/esm/src/{cli/cli-commands/common/harness/extractHarnessVersionFromOutput.test.d.ts → avatars/renderAvatarVisualTerminalText.test.d.ts} +0 -0
- /package/esm/src/cli/cli-commands/common/{harness/isHarnessVersionOutdated.test.d.ts → npm/$resolveLatestNpmPackageVersion.test.d.ts} +0 -0
- /package/{umd/src/cli/cli-commands/common/harness/extractHarnessVersionFromOutput.test.d.ts → esm/src/cli/cli-commands/common/npm/extractNpmPackageVersionFromOutput.test.d.ts} +0 -0
- /package/{umd/src/cli/cli-commands/common/harness/isHarnessVersionOutdated.test.d.ts → esm/src/cli/cli-commands/common/npm/isNpmPackageVersionOutdated.test.d.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extracts an npm package version from raw command output.
|
|
3
|
+
*
|
|
4
|
+
* Both npm and CLI commands may emit unrelated warnings before the version. CLI commands use the first matching token;
|
|
5
|
+
* npm registry commands can opt into the last matching token because npm warnings commonly precede their JSON output.
|
|
6
|
+
*
|
|
7
|
+
* @returns The parsed version or `null` when the output contains no version
|
|
8
|
+
* @private internal utility of `promptbookCli`
|
|
9
|
+
*/
|
|
10
|
+
export declare function extractNpmPackageVersionFromOutput(output: string, { isLastMatchPreferred }?: {
|
|
11
|
+
readonly isLastMatchPreferred?: boolean;
|
|
12
|
+
}): string | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compares an installed npm package version with the newest published version.
|
|
3
|
+
*
|
|
4
|
+
* Only the numeric `major.minor.patch` segments are compared and pre-release suffixes are ignored,
|
|
5
|
+
* so a package installed from a pre-release build of the newest version is not reported as outdated.
|
|
6
|
+
*
|
|
7
|
+
* @private internal utility of `promptbookCli`
|
|
8
|
+
*/
|
|
9
|
+
export declare function isNpmPackageVersionOutdated(installedVersion: string, latestVersion: string): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PromptbookCliInstallationStatus } from './PromptbookCliInstallationStatus';
|
|
2
|
+
/**
|
|
3
|
+
* Checks every local and global Promptbook CLI installation against the newest npm version.
|
|
4
|
+
*
|
|
5
|
+
* Note: `$` is used to indicate that this function is not a pure function - it reads installed packages and queries npm
|
|
6
|
+
*
|
|
7
|
+
* @private internal utility of `promptbookCli`
|
|
8
|
+
*/
|
|
9
|
+
export declare function $checkPromptbookCliInstallations(): Promise<ReadonlyArray<PromptbookCliInstallationStatus>>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks local and global Promptbook CLI installations before an interactive coder run and offers to update them.
|
|
3
|
+
*
|
|
4
|
+
* Once an update is approved, the caller must stop the current run and let the user start a fresh process. A local
|
|
5
|
+
* npm update can modify `package.json` and a lockfile, which would make the coder's working-tree preflight fail;
|
|
6
|
+
* more importantly, this Node.js process has already loaded the old CLI implementation.
|
|
7
|
+
*
|
|
8
|
+
* Note: `$` is used to indicate that this function is not a pure function - it reads package manifests, queries npm,
|
|
9
|
+
* asks the user, and may install npm packages
|
|
10
|
+
*
|
|
11
|
+
* @returns `true` when an update was approved and the current coder run should stop
|
|
12
|
+
* @private internal utility of `promptbookCli`
|
|
13
|
+
*/
|
|
14
|
+
export declare function $ensurePromptbookCliInstallations(): Promise<boolean>;
|
package/umd/src/cli/cli-commands/common/promptbook-cli/$ensurePromptbookCliInstallations.test.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/umd/src/cli/cli-commands/common/promptbook-cli/$resolvePromptbookCliInstallations.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type PromptbookCliInstallation } from './PromptbookCliInstallation';
|
|
2
|
+
/**
|
|
3
|
+
* Finds every locally or globally installed Promptbook CLI package which can be updated.
|
|
4
|
+
*
|
|
5
|
+
* A local package must be declared directly in the current project's `package.json`; transitive packages are not
|
|
6
|
+
* updated because this command must not change dependencies chosen by another package.
|
|
7
|
+
*
|
|
8
|
+
* Note: `$` is used to indicate that this function is not a pure function - it reads package manifests and runs npm
|
|
9
|
+
*
|
|
10
|
+
* @private internal utility of `promptbookCli`
|
|
11
|
+
*/
|
|
12
|
+
export declare function $resolvePromptbookCliInstallations(): Promise<ReadonlyArray<PromptbookCliInstallation>>;
|
package/umd/src/cli/cli-commands/common/promptbook-cli/$resolvePromptbookCliInstallations.test.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PromptbookCliInstallationStatus } from './PromptbookCliInstallationStatus';
|
|
2
|
+
/**
|
|
3
|
+
* Updates one Promptbook CLI package in its existing local or global location.
|
|
4
|
+
*
|
|
5
|
+
* Note: `$` is used to indicate that this function is not a pure function - it installs an npm package
|
|
6
|
+
*
|
|
7
|
+
* @returns `true` when the package update succeeds, `false` when it fails
|
|
8
|
+
* @private internal utility of `promptbookCli`
|
|
9
|
+
*/
|
|
10
|
+
export declare function $updatePromptbookCliInstallation(status: PromptbookCliInstallationStatus): Promise<boolean>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Npm packages which provide an executable Promptbook CLI.
|
|
3
|
+
*
|
|
4
|
+
* `ptbk` is the preferred package and forwards to `@promptbook/cli`; the latter can also be installed directly.
|
|
5
|
+
*
|
|
6
|
+
* @private internal utility of `promptbookCli`
|
|
7
|
+
*/
|
|
8
|
+
export declare const PROMPTBOOK_CLI_NPM_PACKAGE_NAMES: readonly ["ptbk", "@promptbook/cli"];
|
|
9
|
+
/**
|
|
10
|
+
* Npm package which provides an executable Promptbook CLI.
|
|
11
|
+
*
|
|
12
|
+
* @private internal utility of `promptbookCli`
|
|
13
|
+
*/
|
|
14
|
+
export type PromptbookCliNpmPackageName = (typeof PROMPTBOOK_CLI_NPM_PACKAGE_NAMES)[number];
|
|
15
|
+
/**
|
|
16
|
+
* Place where one Promptbook CLI package is installed.
|
|
17
|
+
*
|
|
18
|
+
* @private internal utility of `promptbookCli`
|
|
19
|
+
*/
|
|
20
|
+
export type PromptbookCliInstallationLocation = 'local-dependency' | 'local-development-dependency' | 'global';
|
|
21
|
+
/**
|
|
22
|
+
* One installed Promptbook CLI package that can be updated.
|
|
23
|
+
*
|
|
24
|
+
* @private internal utility of `promptbookCli`
|
|
25
|
+
*/
|
|
26
|
+
export type PromptbookCliInstallation = {
|
|
27
|
+
/**
|
|
28
|
+
* Npm package that provides the CLI.
|
|
29
|
+
*/
|
|
30
|
+
readonly npmPackageName: PromptbookCliNpmPackageName;
|
|
31
|
+
/**
|
|
32
|
+
* Version from the package's installed `package.json`.
|
|
33
|
+
*/
|
|
34
|
+
readonly installedVersion: string;
|
|
35
|
+
/**
|
|
36
|
+
* Local manifest section or global npm installation containing the package.
|
|
37
|
+
*/
|
|
38
|
+
readonly installationLocation: PromptbookCliInstallationLocation;
|
|
39
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { PromptbookCliInstallation } from './PromptbookCliInstallation';
|
|
2
|
+
/**
|
|
3
|
+
* Result of comparing one installed Promptbook CLI package with the newest published version.
|
|
4
|
+
*
|
|
5
|
+
* @private internal utility of `promptbookCli`
|
|
6
|
+
*/
|
|
7
|
+
export type PromptbookCliInstallationState = 'up-to-date' | 'outdated' | 'unknown';
|
|
8
|
+
/**
|
|
9
|
+
* Version status of one Promptbook CLI installation.
|
|
10
|
+
*
|
|
11
|
+
* @private internal utility of `promptbookCli`
|
|
12
|
+
*/
|
|
13
|
+
export type PromptbookCliInstallationStatus = {
|
|
14
|
+
/**
|
|
15
|
+
* Installed CLI package being checked.
|
|
16
|
+
*/
|
|
17
|
+
readonly installation: PromptbookCliInstallation;
|
|
18
|
+
/**
|
|
19
|
+
* Result of comparing the installed version with the newest published version.
|
|
20
|
+
*/
|
|
21
|
+
readonly installationState: PromptbookCliInstallationState;
|
|
22
|
+
/**
|
|
23
|
+
* Newest published package version, or `null` when npm could not be reached.
|
|
24
|
+
*/
|
|
25
|
+
readonly latestVersion: string | null;
|
|
26
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PromptbookCliInstallation } from './PromptbookCliInstallation';
|
|
2
|
+
/**
|
|
3
|
+
* Builds the npm command that updates one existing Promptbook CLI installation.
|
|
4
|
+
*
|
|
5
|
+
* @private internal utility of `promptbookCli`
|
|
6
|
+
*/
|
|
7
|
+
export declare function buildPromptbookCliInstallCommand(installation: PromptbookCliInstallation): string;
|
package/umd/src/cli/cli-commands/common/promptbook-cli/buildPromptbookCliInstallCommand.test.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/umd/src/cli/cli-commands/common/promptbook-cli/formatPromptbookCliInstallationWarning.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PromptbookCliInstallationStatus } from './PromptbookCliInstallationStatus';
|
|
2
|
+
/**
|
|
3
|
+
* Formats the warning shown when one or more Promptbook CLI installations are outdated.
|
|
4
|
+
*
|
|
5
|
+
* @private internal utility of `promptbookCli`
|
|
6
|
+
*/
|
|
7
|
+
export declare function formatPromptbookCliInstallationWarning(statuses: ReadonlyArray<PromptbookCliInstallationStatus>): string;
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* Claude Code `--output-format stream-json`) into a live runtime log file next to the queued
|
|
6
6
|
* message. This helper extracts the most recent natural-language assistant narration so the
|
|
7
7
|
* durable chat can show what the agent is doing right now instead of a generic thinking
|
|
8
|
-
* placeholder. Only
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* placeholder. Only concrete, safe activity is surfaced; raw tool payloads, JSON envelopes,
|
|
9
|
+
* and private reasoning are intentionally ignored. When no concrete activity is known, this
|
|
10
|
+
* resolves to `null` so the caller keeps the browser's rotating generic thinking state.
|
|
11
11
|
*
|
|
12
12
|
* @param logText - Raw runtime log content.
|
|
13
13
|
* @returns Latest human-readable activity snippet, or `null` when none can be resolved.
|
|
@@ -75,9 +75,12 @@ export type CreateTerminalAgentAvatarVisualOptions = {
|
|
|
75
75
|
*/
|
|
76
76
|
readonly colorDepth?: AsciiArtColorDepth;
|
|
77
77
|
/**
|
|
78
|
-
* Platform-specific canvas factory used to rasterize
|
|
78
|
+
* Platform-specific canvas factory used to rasterize pixel-based visuals.
|
|
79
|
+
*
|
|
80
|
+
* Character-based visuals such as `AsciiOctopus` paint the terminal grid directly, so they
|
|
81
|
+
* render without any canvas; a pixel-based visual renders an empty frame when it is missing.
|
|
79
82
|
*/
|
|
80
|
-
readonly createCanvas
|
|
83
|
+
readonly createCanvas?: CreateCanvasForAsciiArt;
|
|
81
84
|
};
|
|
82
85
|
/**
|
|
83
86
|
* Resolves the built-in avatar visual selected for terminal rendering of one agent source.
|
|
@@ -62,6 +62,12 @@ export type ConvertImageDataToAsciiArtOptions = {
|
|
|
62
62
|
*/
|
|
63
63
|
readonly alphaThreshold?: number;
|
|
64
64
|
};
|
|
65
|
+
/**
|
|
66
|
+
* Default alpha channel value below which a cell is rendered as terminal background.
|
|
67
|
+
*
|
|
68
|
+
* @private within the repository
|
|
69
|
+
*/
|
|
70
|
+
export declare const DEFAULT_ALPHA_THRESHOLD = 32;
|
|
65
71
|
/**
|
|
66
72
|
* Converts raw RGBA image pixels into colored ASCII art for ANSI terminals.
|
|
67
73
|
*
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { AsciiArtColorDepth } from './convertImageDataToAsciiArt';
|
|
2
|
+
/**
|
|
3
|
+
* ANSI escape sequence that resets all colors and attributes.
|
|
4
|
+
*
|
|
5
|
+
* @private within the repository
|
|
6
|
+
*/
|
|
7
|
+
export declare const ANSI_RESET = "\u001B[0m";
|
|
8
|
+
/**
|
|
9
|
+
* One opaque 24-bit color which should be written into an ANSI escape sequence.
|
|
10
|
+
*
|
|
11
|
+
* @private within the repository
|
|
12
|
+
*/
|
|
13
|
+
export type AnsiRgbColor = {
|
|
14
|
+
/**
|
|
15
|
+
* Red channel in the range `[0, 255]`.
|
|
16
|
+
*/
|
|
17
|
+
readonly red: number;
|
|
18
|
+
/**
|
|
19
|
+
* Green channel in the range `[0, 255]`.
|
|
20
|
+
*/
|
|
21
|
+
readonly green: number;
|
|
22
|
+
/**
|
|
23
|
+
* Blue channel in the range `[0, 255]`.
|
|
24
|
+
*/
|
|
25
|
+
readonly blue: number;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Creates the ANSI escape code that sets the foreground color of following characters.
|
|
29
|
+
*
|
|
30
|
+
* @param color Color painted onto the characters.
|
|
31
|
+
* @param colorDepth Color depth supported by the target terminal.
|
|
32
|
+
* @returns ANSI escape sequence.
|
|
33
|
+
*
|
|
34
|
+
* @private within the repository
|
|
35
|
+
*/
|
|
36
|
+
export declare function createAnsiForegroundColorCode(color: AnsiRgbColor, colorDepth: AsciiArtColorDepth): string;
|
|
37
|
+
/**
|
|
38
|
+
* Creates the ANSI escape code that sets the background color of following characters.
|
|
39
|
+
*
|
|
40
|
+
* @param color Color painted behind the characters.
|
|
41
|
+
* @param colorDepth Color depth supported by the target terminal.
|
|
42
|
+
* @returns ANSI escape sequence.
|
|
43
|
+
*
|
|
44
|
+
* @private within the repository
|
|
45
|
+
*/
|
|
46
|
+
export declare function createAnsiBackgroundColorCode(color: AnsiRgbColor, colorDepth: AsciiArtColorDepth): string;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { TODO_any } from '../organization/TODO_any';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Creates a debounced function that runs after calls have been quiet for the given delay.
|
|
4
4
|
*
|
|
5
5
|
* @public exported from `@promptbook/utils`
|
|
6
6
|
*/
|
|
7
|
-
export declare function debounce<T extends (...args: TODO_any[]) => void>(fn: T, delay: number): (...args: Parameters<T>) => void
|
|
7
|
+
export declare function debounce<T extends (...args: TODO_any[]) => void>(fn: T, delay: number): ((...args: Parameters<T>) => void) & {
|
|
8
|
+
cancel: () => void;
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/umd/src/version.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
|
|
|
15
15
|
export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
|
|
16
16
|
/**
|
|
17
17
|
* Represents the version string of the Promptbook engine.
|
|
18
|
-
* It follows semantic versioning (e.g., `0.114.0-
|
|
18
|
+
* It follows semantic versioning (e.g., `0.114.0-6`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Best-effort Windows guard for child-process shutdown races during `next build`.
|
|
5
|
-
*
|
|
6
|
-
* Next.js and `jest-worker` can attempt to kill helper processes that are already
|
|
7
|
-
* exiting, which intermittently throws `EPERM` on Windows. Treat those cleanup-only
|
|
8
|
-
* failures as non-fatal so the build can finish normally.
|
|
9
|
-
*/
|
|
10
|
-
const { ChildProcess } = require('node:child_process');
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Original `ChildProcess.kill` implementation restored only when the process exits.
|
|
14
|
-
*/
|
|
15
|
-
const originalKill = ChildProcess.prototype.kill;
|
|
16
|
-
|
|
17
|
-
ChildProcess.prototype.kill = function patchedKill(signal) {
|
|
18
|
-
try {
|
|
19
|
-
return originalKill.call(this, signal);
|
|
20
|
-
} catch (error) {
|
|
21
|
-
if (
|
|
22
|
-
error instanceof Error &&
|
|
23
|
-
'code' in error &&
|
|
24
|
-
(error.code === 'EPERM' || error.code === 'ESRCH')
|
|
25
|
-
) {
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
throw error;
|
|
30
|
-
}
|
|
31
|
-
};
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { NextResponse } from 'next/server';
|
|
2
|
-
import { isPrivateModeEnabledFromRequest } from '@/src/utils/privateMode';
|
|
3
|
-
import {
|
|
4
|
-
cancelAllActiveAgentScopedUserChatTimeouts,
|
|
5
|
-
pauseAllActiveAgentScopedUserChatTimeouts,
|
|
6
|
-
resumeAllPausedAgentScopedUserChatTimeouts,
|
|
7
|
-
} from '@/src/utils/userChatTimeout';
|
|
8
|
-
import { resolveUserChatScope } from '../../user-chats/resolveUserChatScope';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Supported bulk actions for one agent-scoped timeout manager request.
|
|
12
|
-
*/
|
|
13
|
-
type AgentTimeoutBulkAction = 'cancel_all_active' | 'pause_all_active' | 'resume_all_paused';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Request payload accepted by timeout bulk-actions endpoint.
|
|
17
|
-
*/
|
|
18
|
-
type AgentTimeoutBulkActionPayload = {
|
|
19
|
-
action?: unknown;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Parses and validates one timeout bulk action payload.
|
|
24
|
-
*/
|
|
25
|
-
function parseTimeoutBulkActionPayload(payload: AgentTimeoutBulkActionPayload): AgentTimeoutBulkAction | null {
|
|
26
|
-
if (payload.action === 'cancel_all_active') {
|
|
27
|
-
return payload.action;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (payload.action === 'pause_all_active') {
|
|
31
|
-
return payload.action;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
if (payload.action === 'resume_all_paused') {
|
|
35
|
-
return payload.action;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Executes one bulk timeout action for current user+agent scope.
|
|
43
|
-
*/
|
|
44
|
-
export async function POST(request: Request, { params }: { params: Promise<{ agentName: string }> }) {
|
|
45
|
-
if (isPrivateModeEnabledFromRequest(request)) {
|
|
46
|
-
return NextResponse.json({ error: 'Private mode is enabled.' }, { status: 403 });
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const { agentName: rawAgentName } = await params;
|
|
50
|
-
const agentName = decodeURIComponent(rawAgentName);
|
|
51
|
-
const scopeResult = await resolveUserChatScope(agentName);
|
|
52
|
-
|
|
53
|
-
if (!scopeResult.ok) {
|
|
54
|
-
if (scopeResult.error === 'UNAUTHORIZED') {
|
|
55
|
-
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if (scopeResult.error === 'FORBIDDEN') {
|
|
59
|
-
return NextResponse.json({ error: 'Forbidden' }, { status: 403 });
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return NextResponse.json({ error: 'Agent not found.' }, { status: 404 });
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
try {
|
|
66
|
-
const payload = (await request.json().catch(() => ({}))) as AgentTimeoutBulkActionPayload;
|
|
67
|
-
const action = parseTimeoutBulkActionPayload(payload);
|
|
68
|
-
if (!action) {
|
|
69
|
-
return NextResponse.json({ error: 'Invalid timeout bulk action.' }, { status: 400 });
|
|
70
|
-
}
|
|
71
|
-
const scope = scopeResult.scope;
|
|
72
|
-
|
|
73
|
-
const summary =
|
|
74
|
-
action === 'cancel_all_active'
|
|
75
|
-
? await cancelAllActiveAgentScopedUserChatTimeouts({
|
|
76
|
-
userId: scope.userId,
|
|
77
|
-
agentPermanentId: scope.agentPermanentId,
|
|
78
|
-
})
|
|
79
|
-
: action === 'pause_all_active'
|
|
80
|
-
? await pauseAllActiveAgentScopedUserChatTimeouts({
|
|
81
|
-
userId: scope.userId,
|
|
82
|
-
agentPermanentId: scope.agentPermanentId,
|
|
83
|
-
})
|
|
84
|
-
: await resumeAllPausedAgentScopedUserChatTimeouts({
|
|
85
|
-
userId: scope.userId,
|
|
86
|
-
agentPermanentId: scope.agentPermanentId,
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
return NextResponse.json({
|
|
90
|
-
action,
|
|
91
|
-
matchedCount: summary.matchedCount,
|
|
92
|
-
updatedCount: summary.updatedCount,
|
|
93
|
-
timeoutIds: summary.timeoutIds,
|
|
94
|
-
hasMore: summary.hasMore,
|
|
95
|
-
generatedAt: new Date().toISOString(),
|
|
96
|
-
});
|
|
97
|
-
} catch (error) {
|
|
98
|
-
return NextResponse.json(
|
|
99
|
-
{ error: error instanceof Error ? error.message : 'Failed to execute timeout bulk action.' },
|
|
100
|
-
{ status: 400 },
|
|
101
|
-
);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { useServerLanguage } from '@/src/components/ServerLanguage/ServerLanguageProvider';
|
|
4
|
-
import { AgentTimeoutsEditDialog } from './AgentTimeoutsEditDialog';
|
|
5
|
-
import { AgentTimeoutsFiltersCard } from './AgentTimeoutsFiltersCard';
|
|
6
|
-
import { AgentTimeoutsHeader } from './AgentTimeoutsHeader';
|
|
7
|
-
import { AgentTimeoutsSummaryMetrics } from './AgentTimeoutsSummaryMetrics';
|
|
8
|
-
import { AgentTimeoutsTableCard } from './AgentTimeoutsTableCard';
|
|
9
|
-
import { useAgentTimeoutsClientState } from './useAgentTimeoutsClientState';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Props for the agent timeout manager page.
|
|
13
|
-
*/
|
|
14
|
-
type AgentTimeoutsClientProps = {
|
|
15
|
-
agentName: string;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Displays all timeouts for one user+agent across chats and supports timeout edits.
|
|
20
|
-
*
|
|
21
|
-
* @private route component of AgentTimeoutsPage
|
|
22
|
-
*/
|
|
23
|
-
export function AgentTimeoutsClient({ agentName }: AgentTimeoutsClientProps) {
|
|
24
|
-
const { language } = useServerLanguage();
|
|
25
|
-
const state = useAgentTimeoutsClientState({ agentName });
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<div className="container mx-auto mt-20 space-y-6 px-4 py-8">
|
|
29
|
-
<AgentTimeoutsHeader state={state} />
|
|
30
|
-
<AgentTimeoutsSummaryMetrics state={state} />
|
|
31
|
-
<AgentTimeoutsFiltersCard language={language} state={state} />
|
|
32
|
-
|
|
33
|
-
{state.errorMessage ? (
|
|
34
|
-
<div className="rounded-2xl border border-red-200 bg-red-50 p-4 text-sm text-red-700">
|
|
35
|
-
{state.errorMessage}
|
|
36
|
-
</div>
|
|
37
|
-
) : null}
|
|
38
|
-
|
|
39
|
-
<AgentTimeoutsTableCard agentName={agentName} language={language} state={state} />
|
|
40
|
-
<AgentTimeoutsEditDialog state={state} />
|
|
41
|
-
</div>
|
|
42
|
-
);
|
|
43
|
-
}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { Dialog } from '@/src/components/Portal/Dialog';
|
|
2
|
-
import type { useAgentTimeoutsClientState } from './useAgentTimeoutsClientState';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Props for the timeout edit dialog.
|
|
6
|
-
*
|
|
7
|
-
* @private function of AgentTimeoutsClient
|
|
8
|
-
*/
|
|
9
|
-
type AgentTimeoutsEditDialogProps = {
|
|
10
|
-
state: ReturnType<typeof useAgentTimeoutsClientState>;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Renders the advanced timeout edit dialog.
|
|
15
|
-
*
|
|
16
|
-
* @private function of AgentTimeoutsClient
|
|
17
|
-
*/
|
|
18
|
-
export function AgentTimeoutsEditDialog({ state }: AgentTimeoutsEditDialogProps) {
|
|
19
|
-
const editingTimeout = state.editingTimeout;
|
|
20
|
-
|
|
21
|
-
if (!editingTimeout) {
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const isSaving = state.busyTimeoutId === editingTimeout.timeoutId && state.busyAction === 'save';
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<Dialog onClose={state.requestCloseEditDialog} className="w-full max-w-2xl p-5 sm:p-6">
|
|
29
|
-
<div className="space-y-4">
|
|
30
|
-
<div>
|
|
31
|
-
<h2 className="text-lg font-semibold text-slate-900">Edit timeout</h2>
|
|
32
|
-
<p className="text-sm text-slate-500">{editingTimeout.timeoutId}</p>
|
|
33
|
-
</div>
|
|
34
|
-
|
|
35
|
-
<label className="flex flex-col gap-1 text-sm">
|
|
36
|
-
<span className="font-medium text-slate-700">Next run</span>
|
|
37
|
-
<input
|
|
38
|
-
type="datetime-local"
|
|
39
|
-
value={state.editDraft.dueAtLocalValue}
|
|
40
|
-
onChange={(event) => state.updateEditDueAtLocalValue(event.target.value)}
|
|
41
|
-
className="rounded-md border border-gray-300 px-3 py-2"
|
|
42
|
-
/>
|
|
43
|
-
</label>
|
|
44
|
-
|
|
45
|
-
<label className="flex flex-col gap-1 text-sm">
|
|
46
|
-
<span className="font-medium text-slate-700">Recurrence (minutes, leave empty for one-shot)</span>
|
|
47
|
-
<input
|
|
48
|
-
type="number"
|
|
49
|
-
min="0"
|
|
50
|
-
step="1"
|
|
51
|
-
value={state.editDraft.recurrenceMinutesValue}
|
|
52
|
-
onChange={(event) => state.updateEditRecurrenceMinutesValue(event.target.value)}
|
|
53
|
-
className="rounded-md border border-gray-300 px-3 py-2"
|
|
54
|
-
/>
|
|
55
|
-
</label>
|
|
56
|
-
|
|
57
|
-
<label className="flex flex-col gap-1 text-sm">
|
|
58
|
-
<span className="font-medium text-slate-700">Wake-up message</span>
|
|
59
|
-
<input
|
|
60
|
-
type="text"
|
|
61
|
-
value={state.editDraft.messageValue}
|
|
62
|
-
onChange={(event) => state.updateEditMessageValue(event.target.value)}
|
|
63
|
-
className="rounded-md border border-gray-300 px-3 py-2"
|
|
64
|
-
/>
|
|
65
|
-
</label>
|
|
66
|
-
|
|
67
|
-
<label className="flex flex-col gap-1 text-sm">
|
|
68
|
-
<span className="font-medium text-slate-700">Payload parameters (JSON object)</span>
|
|
69
|
-
<textarea
|
|
70
|
-
value={state.editDraft.parametersValue}
|
|
71
|
-
onChange={(event) => state.updateEditParametersValue(event.target.value)}
|
|
72
|
-
className="min-h-40 rounded-md border border-gray-300 px-3 py-2 font-mono text-xs"
|
|
73
|
-
/>
|
|
74
|
-
</label>
|
|
75
|
-
|
|
76
|
-
<div className="flex justify-end gap-2">
|
|
77
|
-
<button
|
|
78
|
-
type="button"
|
|
79
|
-
onClick={state.requestCloseEditDialog}
|
|
80
|
-
className="rounded-md border border-gray-300 px-3 py-2 text-sm font-semibold text-gray-700"
|
|
81
|
-
>
|
|
82
|
-
Close
|
|
83
|
-
</button>
|
|
84
|
-
<button
|
|
85
|
-
type="button"
|
|
86
|
-
onClick={() => {
|
|
87
|
-
void state.saveEdits();
|
|
88
|
-
}}
|
|
89
|
-
disabled={isSaving}
|
|
90
|
-
className="rounded-md border border-blue-200 bg-blue-50 px-3 py-2 text-sm font-semibold text-blue-700 disabled:opacity-60"
|
|
91
|
-
>
|
|
92
|
-
{isSaving ? 'Saving...' : 'Save'}
|
|
93
|
-
</button>
|
|
94
|
-
</div>
|
|
95
|
-
</div>
|
|
96
|
-
</Dialog>
|
|
97
|
-
);
|
|
98
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import type { ServerLanguageCode } from '@/src/languages/ServerLanguageRegistry';
|
|
2
|
-
import { formatServerLanguageHumanReadableDate } from '@/src/utils/localization/formatServerLanguageHumanReadableDate';
|
|
3
|
-
import type { useAgentTimeoutsClientState } from './useAgentTimeoutsClientState';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Props for the timeout filter card.
|
|
7
|
-
*
|
|
8
|
-
* @private function of AgentTimeoutsClient
|
|
9
|
-
*/
|
|
10
|
-
type AgentTimeoutsFiltersCardProps = {
|
|
11
|
-
language: ServerLanguageCode;
|
|
12
|
-
state: ReturnType<typeof useAgentTimeoutsClientState>;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* One filter tab shown in the timeout-manager view switcher.
|
|
17
|
-
*
|
|
18
|
-
* @private function of AgentTimeoutsFiltersCard
|
|
19
|
-
*/
|
|
20
|
-
type TimeoutManagerFilterOption = {
|
|
21
|
-
id: ReturnType<typeof useAgentTimeoutsClientState>['filter'];
|
|
22
|
-
label: string;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Available timeout-manager filter tabs.
|
|
27
|
-
*
|
|
28
|
-
* @private function of AgentTimeoutsFiltersCard
|
|
29
|
-
*/
|
|
30
|
-
const TIMEOUT_MANAGER_FILTER_OPTIONS: ReadonlyArray<TimeoutManagerFilterOption> = [
|
|
31
|
-
{ id: 'active', label: 'Active' },
|
|
32
|
-
{ id: 'paused', label: 'Paused' },
|
|
33
|
-
{ id: 'history', label: 'History' },
|
|
34
|
-
{ id: 'all', label: 'All' },
|
|
35
|
-
];
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Formats the refresh metadata shown below the filter tabs.
|
|
39
|
-
*
|
|
40
|
-
* @private function of AgentTimeoutsFiltersCard
|
|
41
|
-
*/
|
|
42
|
-
function resolveLastRefreshedLabel(generatedAt: string | null, language: ServerLanguageCode): string {
|
|
43
|
-
return generatedAt
|
|
44
|
-
? `Last refreshed ${formatServerLanguageHumanReadableDate(generatedAt, language)}`
|
|
45
|
-
: 'Waiting for first refresh...';
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Renders the timeout-manager filter tabs and refresh metadata.
|
|
50
|
-
*
|
|
51
|
-
* @private function of AgentTimeoutsClient
|
|
52
|
-
*/
|
|
53
|
-
export function AgentTimeoutsFiltersCard({ language, state }: AgentTimeoutsFiltersCardProps) {
|
|
54
|
-
return (
|
|
55
|
-
<div className="rounded-2xl border border-gray-200 bg-white p-4 shadow-sm">
|
|
56
|
-
<div className="flex flex-wrap gap-2">
|
|
57
|
-
{TIMEOUT_MANAGER_FILTER_OPTIONS.map((filterOption) => (
|
|
58
|
-
<button
|
|
59
|
-
key={filterOption.id}
|
|
60
|
-
type="button"
|
|
61
|
-
onClick={() => state.selectFilter(filterOption.id)}
|
|
62
|
-
className={`rounded-xl border px-3 py-1.5 text-sm font-semibold ${
|
|
63
|
-
state.filter === filterOption.id
|
|
64
|
-
? 'border-blue-500 bg-blue-50 text-blue-700'
|
|
65
|
-
: 'border-gray-200 bg-white text-gray-700 hover:border-gray-300 hover:bg-gray-50'
|
|
66
|
-
}`}
|
|
67
|
-
>
|
|
68
|
-
{filterOption.label}
|
|
69
|
-
</button>
|
|
70
|
-
))}
|
|
71
|
-
</div>
|
|
72
|
-
<div className="mt-3 text-xs text-gray-500">{resolveLastRefreshedLabel(state.generatedAt, language)}</div>
|
|
73
|
-
</div>
|
|
74
|
-
);
|
|
75
|
-
}
|