@promptbook/cli 0.114.0-5 → 0.114.0-8
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 +866 -686
- 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
|
@@ -9,7 +9,10 @@ import { AgentChatPageLayout } from './AgentChatPageLayout';
|
|
|
9
9
|
import { AgentChatSidebar } from './AgentChatSidebar';
|
|
10
10
|
import { CanonicalAgentChatPanel } from './CanonicalAgentChatPanel';
|
|
11
11
|
import { ExternalUserChatAdminActions } from './ExternalUserChatAdminActions';
|
|
12
|
+
import { TeamMemberFrozenChatPrimaryAgentLink } from './TeamMemberFrozenChatPrimaryAgentLink';
|
|
12
13
|
import { type AgentChatHistoryClientProps, useAgentChatHistoryClientState } from './useAgentChatHistoryClientState';
|
|
14
|
+
import { getTeamMemberUserChatContext } from '../../../../utils/userChat/teamMemberUserChatContext';
|
|
15
|
+
import { USER_CHAT_SOURCES } from '../../../../utils/userChat/UserChatSource';
|
|
13
16
|
|
|
14
17
|
/**
|
|
15
18
|
* One user-authored chat turn submitted from the canonical chat panel.
|
|
@@ -343,15 +346,29 @@ function AgentChatHistoryReadyView(props: AgentChatHistoryReadyViewProps) {
|
|
|
343
346
|
onAutoExecuteMessageConsumed,
|
|
344
347
|
} = props;
|
|
345
348
|
const isActiveExternalUserChat = activeChatSummary?.isExternalUserChat === true;
|
|
349
|
+
const teamMemberUserChatContext =
|
|
350
|
+
activeChatSummary?.source === USER_CHAT_SOURCES.TEAM_MEMBER
|
|
351
|
+
? getTeamMemberUserChatContext(renderedActiveMessages)
|
|
352
|
+
: null;
|
|
346
353
|
const externalUserChatAdminActions =
|
|
347
354
|
isCurrentUserSuperAdmin === true && isActiveExternalUserChat ? (
|
|
348
355
|
<ExternalUserChatAdminActions
|
|
349
356
|
agentName={agentName}
|
|
350
357
|
chatId={activeChatId}
|
|
358
|
+
userId={activeChatSummary?.userId}
|
|
351
359
|
chatTitle={activeChatSummary?.title || 'Recorded chat'}
|
|
352
360
|
messages={renderedActiveMessages}
|
|
353
361
|
/>
|
|
354
362
|
) : undefined;
|
|
363
|
+
const readOnlyExtraActions =
|
|
364
|
+
teamMemberUserChatContext || externalUserChatAdminActions ? (
|
|
365
|
+
<>
|
|
366
|
+
{teamMemberUserChatContext && (
|
|
367
|
+
<TeamMemberFrozenChatPrimaryAgentLink context={teamMemberUserChatContext} />
|
|
368
|
+
)}
|
|
369
|
+
{externalUserChatAdminActions}
|
|
370
|
+
</>
|
|
371
|
+
) : undefined;
|
|
355
372
|
const chatSurface = (
|
|
356
373
|
<div className="relative flex min-h-0 flex-1 overflow-hidden">
|
|
357
374
|
{isActiveChatLoading ? (
|
|
@@ -372,7 +389,8 @@ function AgentChatHistoryReadyView(props: AgentChatHistoryReadyViewProps) {
|
|
|
372
389
|
isReadOnly={isActiveChatReadOnly}
|
|
373
390
|
readOnlySource={activeChatSummary?.source}
|
|
374
391
|
isExternalUserChat={isActiveExternalUserChat}
|
|
375
|
-
|
|
392
|
+
isAgentGoalChat={activeChatSummary?.isAgentGoalChat === true}
|
|
393
|
+
readOnlyExtraActions={readOnlyExtraActions}
|
|
376
394
|
projectReferences={projectReferences}
|
|
377
395
|
messages={renderedActiveMessages}
|
|
378
396
|
draftMessage={isActiveChatReadOnly ? '' : activeChatDraftMessage}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EyeIcon, EyeOffIcon, MessageSquarePlusIcon, Trash2Icon, XIcon } from 'lucide-react';
|
|
1
|
+
import { EyeIcon, EyeOffIcon, MessageSquarePlusIcon, TargetIcon, Trash2Icon, XIcon } from 'lucide-react';
|
|
2
2
|
import { SolidArrowButton } from '../../../../../../../src/book-components/icons/SolidArrowButton';
|
|
3
3
|
import { ChatListLoadingSkeleton } from '../../../../components/Skeleton/ChatListLoadingSkeleton';
|
|
4
4
|
import { AgentChatSidebarActivityIndicator } from './AgentChatSidebarActivityIndicator';
|
|
@@ -189,10 +189,16 @@ function AgentChatSidebarDefaultCollapsedRow({ item, onChatSelect }: AgentChatSi
|
|
|
189
189
|
<span className="absolute left-1.5 top-1.5 z-[5]">
|
|
190
190
|
<AgentChatSidebarActivityIndicator indicator={item.content.activityIndicator} />
|
|
191
191
|
</span>
|
|
192
|
-
{item.
|
|
193
|
-
<span className="absolute left-1.5 bottom-1.5 z-[5] inline-flex items-center rounded-full bg-
|
|
194
|
-
|
|
192
|
+
{item.isAgentGoalChat ? (
|
|
193
|
+
<span className="absolute left-1.5 bottom-1.5 z-[5] inline-flex items-center justify-center rounded-full bg-indigo-600 p-1 text-white shadow-sm">
|
|
194
|
+
<TargetIcon className="h-2.5 w-2.5" aria-hidden />
|
|
195
195
|
</span>
|
|
196
|
+
) : (
|
|
197
|
+
item.content.sourceChipLabel && (
|
|
198
|
+
<span className="absolute left-1.5 bottom-1.5 z-[5] inline-flex items-center rounded-full bg-slate-900/85 px-1.5 py-0.5 text-[8px] font-bold uppercase tracking-[0.18em] text-white shadow-sm">
|
|
199
|
+
{item.content.sourceChipLabel}
|
|
200
|
+
</span>
|
|
201
|
+
)
|
|
196
202
|
)}
|
|
197
203
|
<span
|
|
198
204
|
className={`absolute right-0.5 top-0.5 z-[5] inline-flex h-4 min-w-4 items-center justify-center rounded-full px-1 text-[9px] font-bold leading-none shadow-sm ${
|
|
@@ -255,10 +261,16 @@ function AgentChatSidebarDefaultExpandedRow({
|
|
|
255
261
|
title={item.content.accessibilityLabel}
|
|
256
262
|
>
|
|
257
263
|
<div className="flex items-center gap-2">
|
|
264
|
+
{item.isAgentGoalChat && (
|
|
265
|
+
<TargetIcon
|
|
266
|
+
className="h-4 w-4 flex-shrink-0 text-indigo-600 dark:text-indigo-300"
|
|
267
|
+
aria-hidden
|
|
268
|
+
/>
|
|
269
|
+
)}
|
|
258
270
|
<div className="agent-chat-sidebar-item-title min-w-0 flex-1 truncate text-sm font-medium text-slate-800 dark:text-slate-100">
|
|
259
271
|
{item.content.title}
|
|
260
272
|
</div>
|
|
261
|
-
{item.content.sourceChipLabel && (
|
|
273
|
+
{!item.isAgentGoalChat && item.content.sourceChipLabel && (
|
|
262
274
|
<span className="inline-flex flex-shrink-0 items-center rounded-full bg-slate-900 px-2 py-1 text-[10px] font-bold uppercase tracking-[0.18em] text-white">
|
|
263
275
|
{item.content.sourceChipLabel}
|
|
264
276
|
</span>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { TargetIcon } from 'lucide-react';
|
|
4
|
+
import { useServerLanguage } from '../../../../components/ServerLanguage/ServerLanguageProvider';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Explains what makes the agent goal chat different from a normal conversation.
|
|
8
|
+
*
|
|
9
|
+
* @private Agents Server presentation logic for the agent goal chat.
|
|
10
|
+
*/
|
|
11
|
+
export function AgentGoalChatNotice() {
|
|
12
|
+
const { t: translateText } = useServerLanguage();
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<div className="mx-4 mt-4 flex items-start gap-3 rounded-2xl border border-indigo-200 bg-indigo-50/95 px-4 py-3 text-sm text-indigo-900 shadow-sm dark:border-indigo-500/30 dark:bg-indigo-500/10 dark:text-indigo-100">
|
|
16
|
+
<TargetIcon className="mt-0.5 h-4 w-4 flex-shrink-0" aria-hidden />
|
|
17
|
+
<div>
|
|
18
|
+
<div className="font-semibold">{translateText('goalChat.noticeTitle')}</div>
|
|
19
|
+
<p className="mt-1">{translateText('goalChat.noticeDescription')}</p>
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Clock3Icon } from 'lucide-react';
|
|
4
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
5
|
+
import { useServerLanguage } from '../../../../components/ServerLanguage/ServerLanguageProvider';
|
|
6
|
+
import { cancelAgentUserTimeout, fetchAgentUserTimeouts, type UserChatTimeout } from '../../../../utils/userChatClient';
|
|
7
|
+
import { formatChatTimeoutRemainingTime } from './formatChatTimeoutRemainingTime';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Timeout statuses that still represent a planned wake-up of the agent.
|
|
11
|
+
*
|
|
12
|
+
* @private function of AgentGoalChatPlannedMessages
|
|
13
|
+
*/
|
|
14
|
+
const PLANNED_MESSAGE_STATUSES = new Set(['QUEUED', 'RUNNING']);
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Props consumed by the goal-chat planned-message list.
|
|
18
|
+
*
|
|
19
|
+
* @private function of AgentGoalChatPlannedMessages
|
|
20
|
+
*/
|
|
21
|
+
type AgentGoalChatPlannedMessagesProps = {
|
|
22
|
+
/**
|
|
23
|
+
* Agent whose planned messages are listed.
|
|
24
|
+
*/
|
|
25
|
+
readonly agentName: string;
|
|
26
|
+
/**
|
|
27
|
+
* Current timestamp used for live countdowns, shared with the surrounding chat surface.
|
|
28
|
+
*/
|
|
29
|
+
readonly currentTimestamp: number;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Keeps only the planned messages that can still wake the agent up.
|
|
34
|
+
*
|
|
35
|
+
* @private function of AgentGoalChatPlannedMessages
|
|
36
|
+
*/
|
|
37
|
+
function selectPlannedMessages(timeouts: ReadonlyArray<UserChatTimeout>): Array<UserChatTimeout> {
|
|
38
|
+
return timeouts
|
|
39
|
+
.filter((timeout) => PLANNED_MESSAGE_STATUSES.has(timeout.status) && !timeout.cancelRequestedAt)
|
|
40
|
+
.sort((leftTimeout, rightTimeout) => leftTimeout.dueAt.localeCompare(rightTimeout.dueAt));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Lists the planned messages of one agent inside its goal chat, with their due time and cancellation.
|
|
45
|
+
*
|
|
46
|
+
* This replaces the former standalone timeout manager page: the agent's own thread is now the single
|
|
47
|
+
* place where its future wake-ups are visible.
|
|
48
|
+
*
|
|
49
|
+
* @private Agents Server presentation logic for the agent goal chat.
|
|
50
|
+
*/
|
|
51
|
+
export function AgentGoalChatPlannedMessages({ agentName, currentTimestamp }: AgentGoalChatPlannedMessagesProps) {
|
|
52
|
+
const { t: translateText } = useServerLanguage();
|
|
53
|
+
const [plannedMessages, setPlannedMessages] = useState<ReadonlyArray<UserChatTimeout> | null>(null);
|
|
54
|
+
const [hasLoadFailed, setHasLoadFailed] = useState(false);
|
|
55
|
+
const [cancellingTimeoutIds, setCancellingTimeoutIds] = useState<ReadonlyArray<string>>([]);
|
|
56
|
+
|
|
57
|
+
const reloadPlannedMessages = useCallback(async () => {
|
|
58
|
+
try {
|
|
59
|
+
const payload = await fetchAgentUserTimeouts(agentName);
|
|
60
|
+
setPlannedMessages(selectPlannedMessages(payload.items));
|
|
61
|
+
setHasLoadFailed(false);
|
|
62
|
+
} catch {
|
|
63
|
+
setHasLoadFailed(true);
|
|
64
|
+
}
|
|
65
|
+
}, [agentName]);
|
|
66
|
+
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
void reloadPlannedMessages();
|
|
69
|
+
}, [reloadPlannedMessages]);
|
|
70
|
+
|
|
71
|
+
const handleCancelPlannedMessage = useCallback(
|
|
72
|
+
async (timeoutId: string) => {
|
|
73
|
+
setCancellingTimeoutIds((currentIds) => [...currentIds, timeoutId]);
|
|
74
|
+
|
|
75
|
+
try {
|
|
76
|
+
await cancelAgentUserTimeout(agentName, timeoutId);
|
|
77
|
+
await reloadPlannedMessages();
|
|
78
|
+
} catch {
|
|
79
|
+
setHasLoadFailed(true);
|
|
80
|
+
} finally {
|
|
81
|
+
setCancellingTimeoutIds((currentIds) => currentIds.filter((currentId) => currentId !== timeoutId));
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
[agentName, reloadPlannedMessages],
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
if (plannedMessages === null && !hasLoadFailed) {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<section className="mx-4 mt-4 rounded-2xl border border-slate-200 bg-white/90 px-4 py-3 shadow-sm dark:border-slate-700 dark:bg-slate-950/80">
|
|
93
|
+
<h2 className="text-[11px] font-semibold uppercase tracking-[0.18em] text-slate-500 dark:text-slate-400">
|
|
94
|
+
{translateText('goalChat.plannedMessagesTitle')}
|
|
95
|
+
</h2>
|
|
96
|
+
|
|
97
|
+
{hasLoadFailed && (
|
|
98
|
+
<p className="mt-2 text-sm text-red-700 dark:text-red-300">
|
|
99
|
+
{translateText('goalChat.plannedMessagesLoadErrorLabel')}
|
|
100
|
+
</p>
|
|
101
|
+
)}
|
|
102
|
+
|
|
103
|
+
{!hasLoadFailed && plannedMessages !== null && plannedMessages.length === 0 && (
|
|
104
|
+
<p className="mt-2 text-sm text-slate-500 dark:text-slate-400">
|
|
105
|
+
{translateText('goalChat.plannedMessagesEmptyLabel')}
|
|
106
|
+
</p>
|
|
107
|
+
)}
|
|
108
|
+
|
|
109
|
+
{plannedMessages !== null && plannedMessages.length > 0 && (
|
|
110
|
+
<ul className="mt-3 space-y-2">
|
|
111
|
+
{plannedMessages.map((plannedMessage) => {
|
|
112
|
+
const isCancelling = cancellingTimeoutIds.includes(plannedMessage.timeoutId);
|
|
113
|
+
|
|
114
|
+
return (
|
|
115
|
+
<li
|
|
116
|
+
key={plannedMessage.timeoutId}
|
|
117
|
+
className="flex items-start justify-between gap-4 rounded-xl border border-slate-200 bg-slate-50/80 px-3 py-2 dark:border-slate-700 dark:bg-slate-900/60"
|
|
118
|
+
>
|
|
119
|
+
<div className="min-w-0 flex-1">
|
|
120
|
+
<div className="truncate text-sm font-medium text-slate-800 dark:text-slate-100">
|
|
121
|
+
{plannedMessage.message ||
|
|
122
|
+
translateText('goalChat.plannedMessageDefaultLabel')}
|
|
123
|
+
</div>
|
|
124
|
+
<div className="mt-1 inline-flex items-center gap-1.5 text-xs font-medium text-amber-700 dark:text-amber-300">
|
|
125
|
+
<Clock3Icon className="h-3.5 w-3.5" />
|
|
126
|
+
<span>
|
|
127
|
+
{formatChatTimeoutRemainingTime(plannedMessage.dueAt, currentTimestamp)}
|
|
128
|
+
</span>
|
|
129
|
+
<span className="text-slate-400 dark:text-slate-500">
|
|
130
|
+
{new Date(plannedMessage.dueAt).toLocaleString()}
|
|
131
|
+
</span>
|
|
132
|
+
</div>
|
|
133
|
+
</div>
|
|
134
|
+
<button
|
|
135
|
+
type="button"
|
|
136
|
+
className="rounded-full border border-slate-300/80 bg-white px-3 py-1.5 text-[11px] font-semibold uppercase tracking-[0.15em] text-slate-700 transition hover:border-slate-400 hover:text-slate-900 disabled:cursor-default disabled:opacity-50 dark:border-slate-600 dark:bg-slate-950 dark:text-slate-200"
|
|
137
|
+
onClick={() => {
|
|
138
|
+
void handleCancelPlannedMessage(plannedMessage.timeoutId);
|
|
139
|
+
}}
|
|
140
|
+
disabled={isCancelling}
|
|
141
|
+
>
|
|
142
|
+
{isCancelling
|
|
143
|
+
? translateText('goalChat.plannedMessageCancellingLabel')
|
|
144
|
+
: translateText('goalChat.plannedMessageCancelLabel')}
|
|
145
|
+
</button>
|
|
146
|
+
</li>
|
|
147
|
+
);
|
|
148
|
+
})}
|
|
149
|
+
</ul>
|
|
150
|
+
)}
|
|
151
|
+
</section>
|
|
152
|
+
);
|
|
153
|
+
}
|
|
@@ -31,6 +31,10 @@ type CanonicalAgentChatPanelProps = {
|
|
|
31
31
|
* True when the viewed chat belongs to a different user than the current viewer.
|
|
32
32
|
*/
|
|
33
33
|
isExternalUserChat?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* True when the viewed chat is the singleton thread the agent keeps with itself.
|
|
36
|
+
*/
|
|
37
|
+
isAgentGoalChat?: boolean;
|
|
34
38
|
/**
|
|
35
39
|
* Optional actions rendered inside the read-only banner (for example super-admin shortcuts).
|
|
36
40
|
*/
|
|
@@ -88,6 +92,7 @@ export function CanonicalAgentChatPanel(props: CanonicalAgentChatPanelProps) {
|
|
|
88
92
|
isReadOnly = false,
|
|
89
93
|
readOnlySource,
|
|
90
94
|
isExternalUserChat = false,
|
|
95
|
+
isAgentGoalChat = false,
|
|
91
96
|
readOnlyExtraActions,
|
|
92
97
|
projectReferences = [],
|
|
93
98
|
messages,
|
|
@@ -142,6 +147,7 @@ export function CanonicalAgentChatPanel(props: CanonicalAgentChatPanelProps) {
|
|
|
142
147
|
isReadOnly={isReadOnly}
|
|
143
148
|
readOnlySource={readOnlySource}
|
|
144
149
|
isExternalUserChat={isExternalUserChat}
|
|
150
|
+
isAgentGoalChat={isAgentGoalChat}
|
|
145
151
|
readOnlyExtraActions={readOnlyExtraActions}
|
|
146
152
|
projectReferences={projectReferences}
|
|
147
153
|
onDraftMessageChange={onDraftMessageChange}
|
|
@@ -28,6 +28,8 @@ import { createAgentProjectMarkdownReferences } from '../../../../utils/agentPro
|
|
|
28
28
|
import { createDefaultSpeechRecognition } from '../../../../utils/speech-to-text/createDefaultSpeechRecognition';
|
|
29
29
|
import { chatFileUploadHandler } from '../../../../utils/upload/createBookEditorUploadHandler';
|
|
30
30
|
import { getUserChatSourceBannerLabel, type UserChatSource } from '../../../../utils/userChat/UserChatSource';
|
|
31
|
+
import { AgentGoalChatNotice } from './AgentGoalChatNotice';
|
|
32
|
+
import { AgentGoalChatPlannedMessages } from './AgentGoalChatPlannedMessages';
|
|
31
33
|
import type { UserChatJob, UserChatTimeout } from '../../../../utils/userChatClient';
|
|
32
34
|
import { ChatTimeoutButton } from './ChatTimeoutButton';
|
|
33
35
|
import { isReplyableCanonicalChatMessage } from './chatReplies';
|
|
@@ -78,6 +80,10 @@ type CanonicalAgentChatSurfaceProps = {
|
|
|
78
80
|
* True when the viewed chat belongs to a different user than the current viewer.
|
|
79
81
|
*/
|
|
80
82
|
readonly isExternalUserChat?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* True when the viewed chat is the singleton thread the agent keeps with itself.
|
|
85
|
+
*/
|
|
86
|
+
readonly isAgentGoalChat?: boolean;
|
|
81
87
|
/**
|
|
82
88
|
* Optional actions rendered inside the read-only banner (for example super-admin shortcuts).
|
|
83
89
|
*/
|
|
@@ -121,6 +127,7 @@ export function CanonicalAgentChatSurface({
|
|
|
121
127
|
isReadOnly,
|
|
122
128
|
readOnlySource,
|
|
123
129
|
isExternalUserChat = false,
|
|
130
|
+
isAgentGoalChat = false,
|
|
124
131
|
readOnlyExtraActions,
|
|
125
132
|
projectReferences = [],
|
|
126
133
|
onDraftMessageChange,
|
|
@@ -319,6 +326,12 @@ export function CanonicalAgentChatSurface({
|
|
|
319
326
|
{readOnlyExtraActions}
|
|
320
327
|
</div>
|
|
321
328
|
)}
|
|
329
|
+
{isAgentGoalChat && (
|
|
330
|
+
<>
|
|
331
|
+
<AgentGoalChatNotice />
|
|
332
|
+
<AgentGoalChatPlannedMessages agentName={agentName} currentTimestamp={currentTimestamp} />
|
|
333
|
+
</>
|
|
334
|
+
)}
|
|
322
335
|
</Chat>
|
|
323
336
|
);
|
|
324
337
|
|
|
@@ -15,6 +15,13 @@ import {
|
|
|
15
15
|
*/
|
|
16
16
|
const ADMIN_CHAT_HISTORY_ROUTE = '/admin/chat-history';
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Route of one admin user detail page linked from the external-chat view.
|
|
20
|
+
*
|
|
21
|
+
* @private constant of <ExternalUserChatAdminActions/>
|
|
22
|
+
*/
|
|
23
|
+
const ADMIN_USERS_ROUTE = '/admin/users';
|
|
24
|
+
|
|
18
25
|
/**
|
|
19
26
|
* Builds the admin chat-history link pointing at the most detailed view of one chat.
|
|
20
27
|
*
|
|
@@ -23,13 +30,17 @@ const ADMIN_CHAT_HISTORY_ROUTE = '/admin/chat-history';
|
|
|
23
30
|
*
|
|
24
31
|
* @private utility of <ExternalUserChatAdminActions/>
|
|
25
32
|
*/
|
|
26
|
-
function buildAdminChatHistoryHref(agentName: string, chatId: string): string {
|
|
33
|
+
function buildAdminChatHistoryHref(agentName: string, chatId: string, userId: number | undefined): string {
|
|
27
34
|
const params = new URLSearchParams();
|
|
28
35
|
|
|
29
36
|
if (agentName) {
|
|
30
37
|
params.set('agentName', agentName);
|
|
31
38
|
}
|
|
32
39
|
|
|
40
|
+
if (isValidUserId(userId)) {
|
|
41
|
+
params.set('userId', String(userId));
|
|
42
|
+
}
|
|
43
|
+
|
|
33
44
|
if (chatId) {
|
|
34
45
|
params.set('chatId', chatId);
|
|
35
46
|
params.set('view', 'chat');
|
|
@@ -39,6 +50,28 @@ function buildAdminChatHistoryHref(agentName: string, chatId: string): string {
|
|
|
39
50
|
return qs ? `${ADMIN_CHAT_HISTORY_ROUTE}?${qs}` : ADMIN_CHAT_HISTORY_ROUTE;
|
|
40
51
|
}
|
|
41
52
|
|
|
53
|
+
/**
|
|
54
|
+
* Builds the user detail link for a valid chat owner id.
|
|
55
|
+
*
|
|
56
|
+
* @private utility of <ExternalUserChatAdminActions/>
|
|
57
|
+
*/
|
|
58
|
+
function buildAdminUserHref(userId: number | undefined): string | null {
|
|
59
|
+
if (!isValidUserId(userId)) {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return `${ADMIN_USERS_ROUTE}/${encodeURIComponent(String(userId))}`;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Returns whether a value can identify one persisted user.
|
|
68
|
+
*
|
|
69
|
+
* @private utility of <ExternalUserChatAdminActions/>
|
|
70
|
+
*/
|
|
71
|
+
function isValidUserId(userId: number | undefined): userId is number {
|
|
72
|
+
return typeof userId === 'number' && Number.isSafeInteger(userId) && userId > 0;
|
|
73
|
+
}
|
|
74
|
+
|
|
42
75
|
/**
|
|
43
76
|
* Props for the super-admin actions shown on external users' chats.
|
|
44
77
|
*
|
|
@@ -53,6 +86,10 @@ type ExternalUserChatAdminActionsProps = {
|
|
|
53
86
|
* Canonical id of the viewed chat, used to deep-link the recorded conversation.
|
|
54
87
|
*/
|
|
55
88
|
readonly chatId: string;
|
|
89
|
+
/**
|
|
90
|
+
* Database user id of the person who owns the viewed chat.
|
|
91
|
+
*/
|
|
92
|
+
readonly userId?: number;
|
|
56
93
|
/**
|
|
57
94
|
* Title of the viewed chat used as the mocked-chat preset name.
|
|
58
95
|
*/
|
|
@@ -65,18 +102,20 @@ type ExternalUserChatAdminActionsProps = {
|
|
|
65
102
|
|
|
66
103
|
/**
|
|
67
104
|
* Super-admin quick actions rendered inside the frozen banner of external users' chats:
|
|
68
|
-
* create a mocked chat from the conversation and jump to the admin chat history.
|
|
105
|
+
* create a mocked chat from the conversation, open its owner profile, and jump to the admin chat history.
|
|
69
106
|
*
|
|
70
107
|
* @private component of <AgentChatHistoryClient/>
|
|
71
108
|
*/
|
|
72
109
|
export function ExternalUserChatAdminActions({
|
|
73
110
|
agentName,
|
|
74
111
|
chatId,
|
|
112
|
+
userId,
|
|
75
113
|
chatTitle,
|
|
76
114
|
messages,
|
|
77
115
|
}: ExternalUserChatAdminActionsProps) {
|
|
78
116
|
const [isCreatingMock, setIsCreatingMock] = useState(false);
|
|
79
|
-
const adminChatHistoryHref = buildAdminChatHistoryHref(agentName, chatId);
|
|
117
|
+
const adminChatHistoryHref = buildAdminChatHistoryHref(agentName, chatId, userId);
|
|
118
|
+
const adminUserHref = buildAdminUserHref(userId);
|
|
80
119
|
|
|
81
120
|
const handleCreateMock = useCallback(async () => {
|
|
82
121
|
if (isCreatingMock) {
|
|
@@ -113,6 +152,15 @@ export function ExternalUserChatAdminActions({
|
|
|
113
152
|
>
|
|
114
153
|
{isCreatingMock ? 'Creating mock…' : 'Create mock'}
|
|
115
154
|
</button>
|
|
155
|
+
{adminUserHref && (
|
|
156
|
+
<a
|
|
157
|
+
href={adminUserHref}
|
|
158
|
+
className="rounded-full border border-amber-300 bg-white/80 px-3 py-1 text-xs font-semibold text-amber-900 hover:bg-white dark:border-amber-500/40 dark:bg-transparent dark:text-amber-100"
|
|
159
|
+
title="Open the profile of the user who created this chat"
|
|
160
|
+
>
|
|
161
|
+
User #{userId}
|
|
162
|
+
</a>
|
|
163
|
+
)}
|
|
116
164
|
<a
|
|
117
165
|
href={adminChatHistoryHref}
|
|
118
166
|
className="rounded-full border border-amber-300 bg-white/80 px-3 py-1 text-xs font-semibold text-amber-900 hover:bg-white dark:border-amber-500/40 dark:bg-transparent dark:text-amber-100"
|
package/apps/agents-server/src/app/agents/[agentName]/chat/TeamMemberFrozenChatPrimaryAgentLink.tsx
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import type { TeamMemberUserChatContext } from '../../../../utils/userChat/teamMemberUserChatContext';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Link shown in a frozen teammate chat back to the primary agent chat that requested the consultation.
|
|
7
|
+
*/
|
|
8
|
+
export function TeamMemberFrozenChatPrimaryAgentLink({ context }: { readonly context: TeamMemberUserChatContext }) {
|
|
9
|
+
const primaryChatHref = buildPrimaryChatHref(context);
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<span className="ml-2 inline-flex items-center align-middle">
|
|
13
|
+
<a
|
|
14
|
+
href={primaryChatHref}
|
|
15
|
+
className="rounded-full border border-amber-300 bg-white/80 px-3 py-1 text-xs font-semibold text-amber-900 hover:bg-white dark:border-amber-500/40 dark:bg-transparent dark:text-amber-100"
|
|
16
|
+
title={`Open the chat with ${context.primaryAgentName} that requested this consultation`}
|
|
17
|
+
>
|
|
18
|
+
Open {context.primaryAgentName} chat
|
|
19
|
+
</a>
|
|
20
|
+
</span>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Builds a canonical primary-agent chat route from a persisted teammate-chat relation.
|
|
26
|
+
*/
|
|
27
|
+
function buildPrimaryChatHref(context: TeamMemberUserChatContext): string {
|
|
28
|
+
return `/agents/${encodeURIComponent(context.primaryAgentPermanentId)}/chat?chat=${encodeURIComponent(
|
|
29
|
+
context.primaryChatId,
|
|
30
|
+
)}`;
|
|
31
|
+
}
|
|
@@ -70,6 +70,10 @@ export type AgentChatSidebarItem = {
|
|
|
70
70
|
readonly isActive: boolean;
|
|
71
71
|
readonly isEmpty: boolean;
|
|
72
72
|
readonly isReadOnly: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* True for the pinned goal chat the agent keeps with itself.
|
|
75
|
+
*/
|
|
76
|
+
readonly isAgentGoalChat: boolean;
|
|
73
77
|
readonly content: AgentChatSidebarItemContent;
|
|
74
78
|
};
|
|
75
79
|
|
|
@@ -225,6 +229,22 @@ function resolveAgentChatSidebarItemContent(
|
|
|
225
229
|
};
|
|
226
230
|
}
|
|
227
231
|
|
|
232
|
+
/**
|
|
233
|
+
* Keeps the pinned goal chat above every regular conversation while preserving their order.
|
|
234
|
+
*
|
|
235
|
+
* @private function of AgentChatSidebar
|
|
236
|
+
*/
|
|
237
|
+
function compareAgentChatSidebarItemsByPinning(
|
|
238
|
+
leftItem: AgentChatSidebarItem,
|
|
239
|
+
rightItem: AgentChatSidebarItem,
|
|
240
|
+
): number {
|
|
241
|
+
if (leftItem.isAgentGoalChat === rightItem.isAgentGoalChat) {
|
|
242
|
+
return 0;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
return leftItem.isAgentGoalChat ? -1 : 1;
|
|
246
|
+
}
|
|
247
|
+
|
|
228
248
|
/**
|
|
229
249
|
* Closes the mobile sidebar after an action that should dismiss the overlay.
|
|
230
250
|
*
|
|
@@ -262,10 +282,14 @@ export function useAgentChatSidebarState({
|
|
|
262
282
|
isActive: chat.id === activeChatId,
|
|
263
283
|
isEmpty: chat.messagesCount <= EMPTY_CHAT_MAX_MESSAGES,
|
|
264
284
|
isReadOnly: chat.isReadOnly,
|
|
285
|
+
isAgentGoalChat: chat.isAgentGoalChat === true,
|
|
265
286
|
content: resolveAgentChatSidebarItemContent(chat, formatText, formatChatTimestamp, currentTimestamp),
|
|
266
287
|
}));
|
|
267
|
-
|
|
268
|
-
const
|
|
288
|
+
// Note: The goal chat is a singleton pinned above every conversation and is never hidden as empty
|
|
289
|
+
const emptyChatCount = allSidebarItems.filter((item) => item.isEmpty && !item.isAgentGoalChat).length;
|
|
290
|
+
const sidebarItems = allSidebarItems
|
|
291
|
+
.filter((item) => item.isAgentGoalChat || isShowingEmptyChats || !item.isEmpty || item.isActive)
|
|
292
|
+
.sort(compareAgentChatSidebarItemsByPinning);
|
|
269
293
|
const shouldRenderFilters = emptyChatCount > 0 || isAdmin;
|
|
270
294
|
|
|
271
295
|
const handleChatSelection = (chatId: string) => {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use server';
|
|
2
|
+
|
|
3
|
+
import { ForbiddenPage } from '@/src/components/ForbiddenPage/ForbiddenPage';
|
|
4
|
+
import { buildAgentGoalChatId, canAccessAgentGoalChat, ensureAgentGoalChat } from '@/src/utils/agentGoalChat';
|
|
5
|
+
import { resolveAgentAccess } from '@/src/utils/agentAccess';
|
|
6
|
+
import { buildExistingAgentChatHref } from '@/src/utils/agentRouting/agentRouteHrefs';
|
|
7
|
+
import { redirect } from 'next/navigation';
|
|
8
|
+
import { enforceCanonicalLocalAgentId, getAgentName } from '../_utils';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Builds canonical goal-chat entry path for one local agent id.
|
|
12
|
+
*/
|
|
13
|
+
function buildCanonicalAgentGoalPath(canonicalAgentId: string): string {
|
|
14
|
+
return `/agents/${encodeURIComponent(canonicalAgentId)}/goal`;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Opens the singleton goal chat of one agent inside the regular chat surface.
|
|
19
|
+
*
|
|
20
|
+
* The goal chat is one of the agent's chats, so this route only resolves its deterministic id and
|
|
21
|
+
* hands over to the shared chat page instead of duplicating the chat UI.
|
|
22
|
+
*/
|
|
23
|
+
export default async function AgentGoalChatPage({ params }: { params: Promise<{ agentName: string }> }) {
|
|
24
|
+
const agentName = await getAgentName(params);
|
|
25
|
+
const canonicalAgentId = await enforceCanonicalLocalAgentId(agentName, buildCanonicalAgentGoalPath);
|
|
26
|
+
|
|
27
|
+
const access = await resolveAgentAccess(canonicalAgentId);
|
|
28
|
+
if (!access.isAllowed || !(await canAccessAgentGoalChat())) {
|
|
29
|
+
return <ForbiddenPage />;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
await ensureAgentGoalChat(canonicalAgentId);
|
|
33
|
+
|
|
34
|
+
redirect(buildExistingAgentChatHref(canonicalAgentId, buildAgentGoalChatId(canonicalAgentId)));
|
|
35
|
+
}
|
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
ExternalLinkIcon,
|
|
10
10
|
FileIcon,
|
|
11
11
|
FolderIcon,
|
|
12
|
-
FolderKanbanIcon,
|
|
13
12
|
GitBranchIcon,
|
|
14
13
|
PlayIcon,
|
|
15
14
|
PlugZapIcon,
|
|
@@ -19,6 +18,7 @@ import {
|
|
|
19
18
|
import Link from 'next/link';
|
|
20
19
|
import { notFound } from 'next/navigation';
|
|
21
20
|
import { AgentProjectDnsWarning } from '@/src/components/AgentProjects/AgentProjectDnsWarning';
|
|
21
|
+
import { AgentProjectIcon } from '@/src/components/AgentProjects/AgentProjectIcon';
|
|
22
22
|
import { AgentProjectRuntimeStatusBadge } from '@/src/components/AgentProjects/AgentProjectRuntimeStatusBadge';
|
|
23
23
|
import { ForbiddenPage } from '@/src/components/ForbiddenPage/ForbiddenPage';
|
|
24
24
|
import { isAgentsServerSqliteMode } from '@/src/database/agentsServerDatabaseMode';
|
|
@@ -467,7 +467,7 @@ function ProjectProfileHeader({
|
|
|
467
467
|
<div className="min-w-0">
|
|
468
468
|
<p className="text-xs font-semibold uppercase tracking-[0.22em] text-gray-400">Project</p>
|
|
469
469
|
<h1 className="mt-1 flex min-w-0 items-center gap-2 text-3xl font-light text-gray-900">
|
|
470
|
-
<
|
|
470
|
+
<AgentProjectIcon agentPermanentId={agentPermanentId} project={project} size="header" />
|
|
471
471
|
<span className="truncate">{project.displayName}</span>
|
|
472
472
|
</h1>
|
|
473
473
|
{project.displayName !== project.projectName && (
|