@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,82 @@
|
|
|
1
|
+
import { debounce } from '@promptbook-local/utils';
|
|
2
|
+
import type { ProvidedServer } from '@/src/tools/$provideServer';
|
|
3
|
+
import { runWithServerContextOverride } from '@/src/tools/serverContextOverride';
|
|
4
|
+
import { recordAgentGoalChatLifecycleNote } from './recordAgentGoalChatLifecycleNote';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Delay after the final persisted book update before the goal chat receives one modification note.
|
|
8
|
+
*/
|
|
9
|
+
export const AGENT_GOAL_CHAT_MODIFIED_NOTE_DEBOUNCE_DELAY_MS = 60_000;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Agent identity used to write one delayed book-modification note.
|
|
13
|
+
*
|
|
14
|
+
* @private function of scheduleAgentGoalChatModifiedNote
|
|
15
|
+
*/
|
|
16
|
+
type AgentGoalChatModifiedNote = {
|
|
17
|
+
readonly agentPermanentId: string;
|
|
18
|
+
readonly agentName: string;
|
|
19
|
+
readonly server: ProvidedServer;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Runs delayed work under the server that owned the source update.
|
|
24
|
+
*
|
|
25
|
+
* @private function of scheduleAgentGoalChatModifiedNote
|
|
26
|
+
*/
|
|
27
|
+
type RunWithServerContext = (
|
|
28
|
+
server: ProvidedServer,
|
|
29
|
+
callback: () => Promise<void>,
|
|
30
|
+
) => Promise<void>;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Creates an independent one-minute debounce for each agent's goal-chat modification note.
|
|
34
|
+
*
|
|
35
|
+
* @private function of scheduleAgentGoalChatModifiedNote
|
|
36
|
+
*/
|
|
37
|
+
export function createAgentGoalChatModifiedNoteScheduler(options?: {
|
|
38
|
+
readonly recordAgentGoalChatLifecycleNote?: typeof recordAgentGoalChatLifecycleNote;
|
|
39
|
+
readonly runWithServerContextOverride?: RunWithServerContext;
|
|
40
|
+
}): (agentGoalChatModifiedNote: AgentGoalChatModifiedNote) => void {
|
|
41
|
+
const debouncedNoteRecordersByServerAndAgent = new Map<
|
|
42
|
+
string,
|
|
43
|
+
((agentGoalChatModifiedNote: AgentGoalChatModifiedNote) => void) & { cancel: () => void }
|
|
44
|
+
>();
|
|
45
|
+
const recordLifecycleNote = options?.recordAgentGoalChatLifecycleNote || recordAgentGoalChatLifecycleNote;
|
|
46
|
+
const runWithServerContext = options?.runWithServerContextOverride || runWithServerContextOverride;
|
|
47
|
+
|
|
48
|
+
return (agentGoalChatModifiedNote: AgentGoalChatModifiedNote) => {
|
|
49
|
+
const agentGoalChatModifiedNoteKey = createAgentGoalChatModifiedNoteKey(agentGoalChatModifiedNote);
|
|
50
|
+
let debouncedNoteRecorder = debouncedNoteRecordersByServerAndAgent.get(agentGoalChatModifiedNoteKey);
|
|
51
|
+
|
|
52
|
+
if (!debouncedNoteRecorder) {
|
|
53
|
+
debouncedNoteRecorder = debounce((latestAgentGoalChatModifiedNote: AgentGoalChatModifiedNote) => {
|
|
54
|
+
debouncedNoteRecordersByServerAndAgent.delete(agentGoalChatModifiedNoteKey);
|
|
55
|
+
void runWithServerContext(latestAgentGoalChatModifiedNote.server, () =>
|
|
56
|
+
recordLifecycleNote({
|
|
57
|
+
event: 'MODIFIED',
|
|
58
|
+
agentPermanentId: latestAgentGoalChatModifiedNote.agentPermanentId,
|
|
59
|
+
agentName: latestAgentGoalChatModifiedNote.agentName,
|
|
60
|
+
}),
|
|
61
|
+
);
|
|
62
|
+
}, AGENT_GOAL_CHAT_MODIFIED_NOTE_DEBOUNCE_DELAY_MS);
|
|
63
|
+
debouncedNoteRecordersByServerAndAgent.set(agentGoalChatModifiedNoteKey, debouncedNoteRecorder);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
debouncedNoteRecorder(agentGoalChatModifiedNote);
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Schedules one best-effort goal-chat note after the latest book update of each agent.
|
|
72
|
+
*/
|
|
73
|
+
export const scheduleAgentGoalChatModifiedNote = createAgentGoalChatModifiedNoteScheduler();
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Creates the per-server, per-agent key used to keep independent note debounces separate.
|
|
77
|
+
*
|
|
78
|
+
* @private function of scheduleAgentGoalChatModifiedNote
|
|
79
|
+
*/
|
|
80
|
+
function createAgentGoalChatModifiedNoteKey(agentGoalChatModifiedNote: AgentGoalChatModifiedNote): string {
|
|
81
|
+
return JSON.stringify([agentGoalChatModifiedNote.server.tablePrefix, agentGoalChatModifiedNote.agentPermanentId]);
|
|
82
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export { AGENT_GOAL_CHAT_TITLE } from './agentGoalChat/agentGoalChatConstants';
|
|
2
|
+
export {
|
|
3
|
+
AGENT_GOAL_CHAT_ID_PREFIX,
|
|
4
|
+
buildAgentGoalChatId,
|
|
5
|
+
isAgentGoalChatId,
|
|
6
|
+
} from './agentGoalChat/agentGoalChatIdentity';
|
|
7
|
+
export { appendAgentGoalChatNote } from './agentGoalChat/appendAgentGoalChatNote';
|
|
8
|
+
export { canAccessAgentGoalChat } from './agentGoalChat/canAccessAgentGoalChat';
|
|
9
|
+
export {
|
|
10
|
+
createAgentGoalChatCancelledPlannedMessageNoteContent,
|
|
11
|
+
createAgentGoalChatLifecycleNoteContent,
|
|
12
|
+
createAgentGoalChatPlannedMessageNoteContent,
|
|
13
|
+
} from './agentGoalChat/createAgentGoalChatNoteContent';
|
|
14
|
+
export { ensureAgentGoalChat } from './agentGoalChat/ensureAgentGoalChat';
|
|
15
|
+
export { prependAgentGoalChatSummarySeed } from './agentGoalChat/prependAgentGoalChatSummarySeed';
|
|
16
|
+
export { recordAgentGoalChatLifecycleNote } from './agentGoalChat/recordAgentGoalChatLifecycleNote';
|
|
17
|
+
export { resolveAgentGoalChatOwnerUserId } from './agentGoalChat/resolveAgentGoalChatOwnerUserId';
|
|
18
|
+
export { scheduleAgentGoalChatModifiedNote } from './agentGoalChat/scheduleAgentGoalChatModifiedNote';
|
|
19
|
+
export type { AgentGoalChatLifecycleEvent } from './agentGoalChat/createAgentGoalChatNoteContent';
|
|
@@ -12,7 +12,8 @@ export type AgentProjectInfo = {
|
|
|
12
12
|
readonly projectName: string;
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
* User-facing name of the project, resolved from the README heading
|
|
15
|
+
* User-facing name of the project, resolved from the README heading, the `index.html` title
|
|
16
|
+
* or the humanized project directory name.
|
|
16
17
|
*/
|
|
17
18
|
readonly displayName: string;
|
|
18
19
|
|
|
@@ -26,6 +27,14 @@ export type AgentProjectInfo = {
|
|
|
26
27
|
*/
|
|
27
28
|
readonly readmeFileName: string | null;
|
|
28
29
|
|
|
30
|
+
/**
|
|
31
|
+
* Path of the project icon relative to the project root, or `null` when the project has no icon.
|
|
32
|
+
*
|
|
33
|
+
* The icon is the favicon linked by the project `index.html` or a favicon found in one of the
|
|
34
|
+
* conventional locations; a project without one is shown with an icon made of its initials.
|
|
35
|
+
*/
|
|
36
|
+
readonly faviconRelativePath: string | null;
|
|
37
|
+
|
|
29
38
|
/**
|
|
30
39
|
* Path of the project relative to the agent folder root, for example `projects/my-website`.
|
|
31
40
|
*/
|
|
@@ -5,7 +5,7 @@ import type { AgentProjectInfo } from './AgentProjectInfo';
|
|
|
5
5
|
*/
|
|
6
6
|
export type AgentProjectReferenceInfo = Pick<
|
|
7
7
|
AgentProjectInfo,
|
|
8
|
-
'projectName' | 'displayName' | 'description' | 'sizeBytes'
|
|
8
|
+
'projectName' | 'displayName' | 'description' | 'sizeBytes' | 'faviconRelativePath'
|
|
9
9
|
> & {
|
|
10
10
|
/**
|
|
11
11
|
* Whether the project currently accepts requests on its assigned runtime port.
|
|
@@ -13,7 +13,10 @@ export type AgentProjectReferenceInfo = Pick<
|
|
|
13
13
|
readonly isRunning?: boolean;
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* Stable public project URL when the project has an assigned runtime or domain, otherwise `null`.
|
|
17
|
+
*
|
|
18
|
+
* The URL stays the same while the project is stopped so that the project stays recognizable
|
|
19
|
+
* wherever it is referenced.
|
|
17
20
|
*/
|
|
18
21
|
readonly projectUrl?: string | null;
|
|
19
22
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTML entrypoint filenames recognized at the root of one agent project, ordered by priority.
|
|
3
|
+
*
|
|
4
|
+
* The static project server serves the first existing one of them for a directory request, so the
|
|
5
|
+
* same list decides which file describes the project — its `<title>` and its favicon.
|
|
6
|
+
*/
|
|
7
|
+
export const AGENT_PROJECT_INDEX_HTML_FILE_NAMES = ['index.html', 'index.htm'] as const;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Conventional favicon locations searched inside one agent project, ordered by priority.
|
|
11
|
+
*
|
|
12
|
+
* They are used only when the project `index.html` does not link its icon explicitly.
|
|
13
|
+
*/
|
|
14
|
+
export const AGENT_PROJECT_CONVENTIONAL_FAVICON_RELATIVE_PATHS = [
|
|
15
|
+
'favicon.ico',
|
|
16
|
+
'favicon.svg',
|
|
17
|
+
'favicon.png',
|
|
18
|
+
'public/favicon.ico',
|
|
19
|
+
'public/favicon.svg',
|
|
20
|
+
'public/favicon.png',
|
|
21
|
+
] as const;
|
|
@@ -43,17 +43,6 @@ export function buildAgentProjectProfileHref(agentPermanentId: string, projectNa
|
|
|
43
43
|
return `${buildAgentProjectsDashboardHref(agentPermanentId)}/${encodeURIComponent(projectName)}`;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
/**
|
|
47
|
-
* Builds the href prefix serving files from one agent project.
|
|
48
|
-
*
|
|
49
|
-
* @param agentPermanentId - Permanent id of the agent.
|
|
50
|
-
* @param projectName - Project directory name.
|
|
51
|
-
* @returns Project file href prefix.
|
|
52
|
-
*/
|
|
53
|
-
export function buildAgentProjectFilesHrefPrefix(agentPermanentId: string, projectName: string): string {
|
|
54
|
-
return `${buildAgentProjectProfileHref(agentPermanentId, projectName)}/files/`;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
46
|
/**
|
|
58
47
|
* Builds the href of one project on its owning server.
|
|
59
48
|
*
|
|
@@ -118,6 +107,26 @@ export function buildAgentProjectFileHref(
|
|
|
118
107
|
return `${buildAgentProjectProfileHref(agentPermanentId, projectName)}/files/${encodedFilePath}`;
|
|
119
108
|
}
|
|
120
109
|
|
|
110
|
+
/**
|
|
111
|
+
* Builds the href serving one raw file of one agent project on its owning server.
|
|
112
|
+
*
|
|
113
|
+
* @param options - Project file and server identity.
|
|
114
|
+
* @returns Server-scoped raw project file href.
|
|
115
|
+
*/
|
|
116
|
+
export function buildAgentProjectFileHrefForServer(options: {
|
|
117
|
+
readonly agentPermanentId: string;
|
|
118
|
+
readonly projectName: string;
|
|
119
|
+
readonly fileRelativePath: string;
|
|
120
|
+
readonly serverDomain: string | null;
|
|
121
|
+
readonly currentServerDomain: string | null;
|
|
122
|
+
}): string {
|
|
123
|
+
return buildAgentProjectHrefForServer(
|
|
124
|
+
buildAgentProjectFileHref(options.agentPermanentId, options.projectName, options.fileRelativePath),
|
|
125
|
+
options.serverDomain,
|
|
126
|
+
options.currentServerDomain,
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
|
|
121
130
|
/**
|
|
122
131
|
* Builds the href opening one project in browser VS Code.
|
|
123
132
|
*
|
|
@@ -61,18 +61,28 @@ export function parseAgentPermanentIdFromDirectoryName(agentDirectoryName: strin
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
/**
|
|
64
|
-
*
|
|
64
|
+
* Returns whether one path segment stays inside its parent directory.
|
|
65
65
|
*
|
|
66
66
|
* @param pathSegment - Single decoded path segment (project name or one file path part).
|
|
67
|
-
* @
|
|
68
|
-
* @throws {NotAllowed} When the segment is empty or attempts path traversal.
|
|
67
|
+
* @returns `true` when the segment is non-empty and cannot escape its parent directory.
|
|
69
68
|
*/
|
|
70
|
-
export function
|
|
69
|
+
export function isSafeAgentProjectPathSegment(pathSegment: string): boolean {
|
|
71
70
|
const isTraversalSegment = pathSegment === '.' || pathSegment === '..';
|
|
72
71
|
const hasPathSeparator = pathSegment.includes('/') || pathSegment.includes('\\');
|
|
73
72
|
const hasNullByte = pathSegment.includes('\0');
|
|
74
73
|
|
|
75
|
-
|
|
74
|
+
return pathSegment.length > 0 && !isTraversalSegment && !hasPathSeparator && !hasNullByte;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Asserts that one path segment coming from a URL cannot escape its parent directory.
|
|
79
|
+
*
|
|
80
|
+
* @param pathSegment - Single decoded path segment (project name or one file path part).
|
|
81
|
+
* @param segmentPurpose - Human-readable description used in the error message.
|
|
82
|
+
* @throws {NotAllowed} When the segment is empty or attempts path traversal.
|
|
83
|
+
*/
|
|
84
|
+
export function assertSafeAgentProjectPathSegment(pathSegment: string, segmentPurpose: string): void {
|
|
85
|
+
if (!isSafeAgentProjectPathSegment(pathSegment)) {
|
|
76
86
|
throw new NotAllowed(
|
|
77
87
|
spaceTrim(`
|
|
78
88
|
Invalid ${segmentPurpose} \`${pathSegment}\`.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { humanizeAgentProjectName } from './humanizeAgentProjectName';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Maximum count of letters shown in one project initials icon.
|
|
5
|
+
*/
|
|
6
|
+
const AGENT_PROJECT_INITIALS_MAX_LENGTH = 3;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Matches the first letter or digit of one word of a project name.
|
|
10
|
+
*/
|
|
11
|
+
const PROJECT_NAME_WORD_INITIAL_REGEX = /[\p{L}\p{N}]/u;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Initials used for a project whose name has no letters and no digits at all.
|
|
15
|
+
*/
|
|
16
|
+
const AGENT_PROJECT_FALLBACK_INITIALS = '#';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Creates the initials shown for one project which has no favicon.
|
|
20
|
+
*
|
|
21
|
+
* For example `prague-murders-map` becomes `PMM`.
|
|
22
|
+
*
|
|
23
|
+
* @param projectName - Project directory name.
|
|
24
|
+
* @returns Up to three uppercase initials of the project name.
|
|
25
|
+
*/
|
|
26
|
+
export function createAgentProjectInitials(projectName: string): string {
|
|
27
|
+
const projectInitials = humanizeAgentProjectName(projectName)
|
|
28
|
+
.split(/\s+/u)
|
|
29
|
+
.map((projectNameWord) => PROJECT_NAME_WORD_INITIAL_REGEX.exec(projectNameWord)?.[0] || '')
|
|
30
|
+
.filter((projectNameInitial) => projectNameInitial !== '')
|
|
31
|
+
.slice(0, AGENT_PROJECT_INITIALS_MAX_LENGTH)
|
|
32
|
+
.join('')
|
|
33
|
+
.toUpperCase();
|
|
34
|
+
|
|
35
|
+
return projectInitials || AGENT_PROJECT_FALLBACK_INITIALS;
|
|
36
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { MarkdownInlineReference } from '@promptbook-local/types';
|
|
2
2
|
import type { AgentProjectReferenceInfo } from './AgentProjectReferenceInfo';
|
|
3
|
-
import {
|
|
3
|
+
import { buildAgentProjectProfileHref } from './agentProjectHrefs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Markdown inline reference data consumed by chat markdown rendering.
|
|
@@ -31,7 +31,11 @@ type AgentProjectMarkdownReferenceInfo = Pick<
|
|
|
31
31
|
>;
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
* Creates markdown references
|
|
34
|
+
* Creates markdown references rendering every mention of one project as a project chip.
|
|
35
|
+
*
|
|
36
|
+
* One project is mentioned either by its display name in chat prose, its `[[project-name]]` token,
|
|
37
|
+
* a link into its project page or files, or its public project URL. All of them render the same chip
|
|
38
|
+
* showing the project name together with its running state.
|
|
35
39
|
*
|
|
36
40
|
* @param options - Agent and project metadata.
|
|
37
41
|
* @returns Inline markdown references for the shared chat renderer.
|
|
@@ -42,17 +46,15 @@ export function createAgentProjectMarkdownReferences(
|
|
|
42
46
|
return options.projects.map((project) => {
|
|
43
47
|
const projectProfileHref = buildAgentProjectProfileHref(options.agentPermanentId, project.projectName);
|
|
44
48
|
const projectUrl = project.projectUrl || null;
|
|
49
|
+
const label = project.displayName || project.projectName;
|
|
45
50
|
|
|
46
51
|
return {
|
|
47
52
|
reference: project.projectName,
|
|
48
|
-
|
|
53
|
+
sourceTextAliases: [label],
|
|
54
|
+
label,
|
|
49
55
|
href: projectProfileHref,
|
|
50
|
-
sourceHrefPrefixes: [
|
|
51
|
-
|
|
52
|
-
buildAgentProjectFilesHrefPrefix(options.agentPermanentId, project.projectName),
|
|
53
|
-
...(projectUrl ? [projectUrl] : []),
|
|
54
|
-
],
|
|
55
|
-
title: project.description || project.displayName || project.projectName,
|
|
56
|
+
sourceHrefPrefixes: [projectProfileHref, ...(projectUrl ? [projectUrl] : [])],
|
|
57
|
+
title: project.description || label,
|
|
56
58
|
menu: {
|
|
57
59
|
status: {
|
|
58
60
|
label: project.isRunning ? 'Project is running' : 'Project is not running',
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import type { DnsRecordsSection, DnsRecordsSectionVariant } from '../dnsRecords/DnsRecordsSection';
|
|
2
|
+
import { createAgentProjectDnsRecord } from './createAgentProjectDnsRecords';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Inputs of the generated project domain DNS section.
|
|
6
|
+
*
|
|
7
|
+
* @private helper for the Agents Server project DNS instructions
|
|
8
|
+
*/
|
|
9
|
+
type CreateAgentProjectsDnsRecordsSectionOptions = {
|
|
10
|
+
/**
|
|
11
|
+
* Whether at least one generated project domain currently fails DNS verification.
|
|
12
|
+
*/
|
|
13
|
+
readonly isDnsIssue?: boolean;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Example generated project domain used by the single-project variants, when one already exists.
|
|
17
|
+
*/
|
|
18
|
+
readonly projectDomain?: string | null;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Public VPS IP address, when known by the server.
|
|
22
|
+
*/
|
|
23
|
+
readonly publicIpAddress: string | null | undefined;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Base server domain used by generated project domains.
|
|
27
|
+
*/
|
|
28
|
+
readonly serverDomain: string;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Creates the DNS section which publishes the generated agent project domains.
|
|
33
|
+
*
|
|
34
|
+
* Exactly one of the variants has to be configured, because the wildcard and the single-project records as well as
|
|
35
|
+
* the A and the CNAME records would collide on the same hostname.
|
|
36
|
+
*
|
|
37
|
+
* @param options - Server domain, example project domain, and the public VPS IP address.
|
|
38
|
+
* @returns Generated project domain section.
|
|
39
|
+
*
|
|
40
|
+
* @private shared by the Agents Server DNS instruction views
|
|
41
|
+
*/
|
|
42
|
+
export function createAgentProjectsDnsRecordsSection(
|
|
43
|
+
options: CreateAgentProjectsDnsRecordsSectionOptions,
|
|
44
|
+
): DnsRecordsSection {
|
|
45
|
+
return {
|
|
46
|
+
id: 'agent-projects',
|
|
47
|
+
title: `Project domains under ${options.serverDomain}`,
|
|
48
|
+
description: `Project URLs use a subdomain of ${options.serverDomain}. Configure exactly one of the following setups; do not add both the single-project and the wildcard records, or both the A and the CNAME record for the same hostname.`,
|
|
49
|
+
variantsLabel: 'Project domain setup',
|
|
50
|
+
variants: [
|
|
51
|
+
createAgentProjectsDnsRecordsSectionVariant(options, { isWildcardDomain: true, isCnameRecord: true }),
|
|
52
|
+
createAgentProjectsDnsRecordsSectionVariant(options, { isWildcardDomain: true, isCnameRecord: false }),
|
|
53
|
+
createAgentProjectsDnsRecordsSectionVariant(options, { isWildcardDomain: false, isCnameRecord: true }),
|
|
54
|
+
createAgentProjectsDnsRecordsSectionVariant(options, { isWildcardDomain: false, isCnameRecord: false }),
|
|
55
|
+
],
|
|
56
|
+
statusSummary: options.isDnsIssue
|
|
57
|
+
? 'One or more generated project domains do not resolve to this VPS yet. The recommended wildcard CNAME setup is selected below.'
|
|
58
|
+
: null,
|
|
59
|
+
isDnsIssue: options.isDnsIssue,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Creates one selectable generated project domain setup.
|
|
65
|
+
*
|
|
66
|
+
* @param options - Inputs of the whole section.
|
|
67
|
+
* @param variant - Selected domain coverage and record type.
|
|
68
|
+
* @returns One section variant with its single DNS record.
|
|
69
|
+
*
|
|
70
|
+
* @private function of `createAgentProjectsDnsRecordsSection`
|
|
71
|
+
*/
|
|
72
|
+
function createAgentProjectsDnsRecordsSectionVariant(
|
|
73
|
+
options: CreateAgentProjectsDnsRecordsSectionOptions,
|
|
74
|
+
variant: {
|
|
75
|
+
/**
|
|
76
|
+
* Whether the variant covers every generated project domain.
|
|
77
|
+
*/
|
|
78
|
+
readonly isWildcardDomain: boolean;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Whether the variant uses a CNAME instead of an A record.
|
|
82
|
+
*/
|
|
83
|
+
readonly isCnameRecord: boolean;
|
|
84
|
+
},
|
|
85
|
+
): DnsRecordsSectionVariant {
|
|
86
|
+
const { isCnameRecord, isWildcardDomain } = variant;
|
|
87
|
+
|
|
88
|
+
return {
|
|
89
|
+
id: `${isWildcardDomain ? 'wildcard' : 'single-project'}-${isCnameRecord ? 'cname' : 'a'}`,
|
|
90
|
+
label: isWildcardDomain
|
|
91
|
+
? isCnameRecord
|
|
92
|
+
? 'Wildcard CNAME (all projects, recommended)'
|
|
93
|
+
: 'Wildcard A record (all projects)'
|
|
94
|
+
: isCnameRecord
|
|
95
|
+
? 'Single project CNAME'
|
|
96
|
+
: 'Single project A record',
|
|
97
|
+
description: isWildcardDomain
|
|
98
|
+
? `This covers all generated project domains under ${options.serverDomain}.`
|
|
99
|
+
: options.projectDomain
|
|
100
|
+
? `This covers one project, for example ${options.projectDomain}. Repeat it for each project that needs a public URL.`
|
|
101
|
+
: 'This covers one generated project. Replace the project name placeholder above with its full hostname.',
|
|
102
|
+
recordSelection: 'one',
|
|
103
|
+
records: [
|
|
104
|
+
createAgentProjectDnsRecord({
|
|
105
|
+
isCnameRecord,
|
|
106
|
+
isWildcardDomain,
|
|
107
|
+
projectDomain: options.projectDomain,
|
|
108
|
+
publicIpAddress: options.publicIpAddress,
|
|
109
|
+
serverDomain: options.serverDomain,
|
|
110
|
+
}),
|
|
111
|
+
],
|
|
112
|
+
};
|
|
113
|
+
}
|
|
@@ -3,15 +3,11 @@ import { readdir, readFile, stat } from 'fs/promises';
|
|
|
3
3
|
import { basename, isAbsolute, join, relative, resolve } from 'path';
|
|
4
4
|
import { NotAllowed } from '../../../../../src/errors/NotAllowed';
|
|
5
5
|
import { spaceTrim } from '../../../../../src/utils/organization/spaceTrim';
|
|
6
|
+
import { AGENT_PROJECT_INDEX_HTML_FILE_NAMES } from './agentProjectFileNames';
|
|
6
7
|
import { assertSafeAgentProjectPathSegment } from './agentProjectsPaths';
|
|
7
8
|
import { isMissingPathError } from './isMissingPathError';
|
|
8
9
|
import { resolveAgentProjectFileContentType } from './resolveAgentProjectFileContentType';
|
|
9
10
|
|
|
10
|
-
/**
|
|
11
|
-
* Filenames served automatically when a request targets a project directory.
|
|
12
|
-
*/
|
|
13
|
-
const STATIC_DIRECTORY_INDEX_FILENAMES = ['index.html', 'index.htm'] as const;
|
|
14
|
-
|
|
15
11
|
/**
|
|
16
12
|
* HTML content type used for generated static directory listings.
|
|
17
13
|
*/
|
|
@@ -170,7 +166,7 @@ async function serveStaticProjectDirectory(options: {
|
|
|
170
166
|
readonly directoryPath: string;
|
|
171
167
|
readonly response: ServerResponse;
|
|
172
168
|
}): Promise<void> {
|
|
173
|
-
for (const indexFileName of
|
|
169
|
+
for (const indexFileName of AGENT_PROJECT_INDEX_HTML_FILE_NAMES) {
|
|
174
170
|
const indexFilePath = join(options.directoryPath, indexFileName);
|
|
175
171
|
const indexFileStats = await stat(indexFilePath).catch((error) => {
|
|
176
172
|
if (isMissingPathError(error)) {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { capitalize } from '@promptbook-local/utils';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Separators used between the words of one project directory name.
|
|
5
|
+
*/
|
|
6
|
+
const AGENT_PROJECT_NAME_WORD_SEPARATOR_REGEX = /[-_.\s]+/g;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Converts one project directory name into a human-readable project name.
|
|
10
|
+
*
|
|
11
|
+
* For example `prague-murders-map` becomes `Prague Murders Map`.
|
|
12
|
+
*
|
|
13
|
+
* @param projectName - Project directory name.
|
|
14
|
+
* @returns Human-readable project name, or the original name when it cannot be humanized.
|
|
15
|
+
*/
|
|
16
|
+
export function humanizeAgentProjectName(projectName: string): string {
|
|
17
|
+
const humanizedProjectName = projectName
|
|
18
|
+
.trim()
|
|
19
|
+
.split(AGENT_PROJECT_NAME_WORD_SEPARATOR_REGEX)
|
|
20
|
+
.filter((projectNameWord) => projectNameWord !== '')
|
|
21
|
+
.map((projectNameWord) => capitalize(projectNameWord))
|
|
22
|
+
.join(' ');
|
|
23
|
+
|
|
24
|
+
return humanizedProjectName || projectName;
|
|
25
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { AgentProjectReferenceInfo } from './AgentProjectReferenceInfo';
|
|
2
2
|
import { listAgentProjectRuntimes } from './agentProjectRuntimeRegistry';
|
|
3
3
|
import { listAgentProjects } from './listAgentProjects';
|
|
4
|
+
import { resolveAgentProjectPublicUrls } from './resolveAgentProjectPublicUrls';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Lists browser-safe project references enriched with their current runtime state for chat.
|
|
@@ -11,7 +12,11 @@ import { listAgentProjects } from './listAgentProjects';
|
|
|
11
12
|
export async function listAgentProjectChatReferences(
|
|
12
13
|
agentPermanentId: string,
|
|
13
14
|
): Promise<ReadonlyArray<AgentProjectReferenceInfo>> {
|
|
14
|
-
const [projects, runtimes] = await Promise.all([
|
|
15
|
+
const [projects, runtimes, publicUrlByProjectName] = await Promise.all([
|
|
16
|
+
listAgentProjects(agentPermanentId),
|
|
17
|
+
listAgentProjectRuntimes(),
|
|
18
|
+
resolveAgentProjectPublicUrls(agentPermanentId),
|
|
19
|
+
]);
|
|
15
20
|
const runtimeByProjectName = new Map(
|
|
16
21
|
runtimes
|
|
17
22
|
.filter((runtime) => runtime.agentPermanentId.toLowerCase() === agentPermanentId.toLowerCase())
|
|
@@ -19,15 +24,17 @@ export async function listAgentProjectChatReferences(
|
|
|
19
24
|
);
|
|
20
25
|
|
|
21
26
|
return projects.map((project) => {
|
|
22
|
-
const
|
|
27
|
+
const normalizedProjectName = project.projectName.toLowerCase();
|
|
28
|
+
const runtime = runtimeByProjectName.get(normalizedProjectName);
|
|
23
29
|
|
|
24
30
|
return {
|
|
25
31
|
projectName: project.projectName,
|
|
26
32
|
displayName: project.displayName,
|
|
27
33
|
description: project.description,
|
|
28
34
|
sizeBytes: project.sizeBytes,
|
|
35
|
+
faviconRelativePath: project.faviconRelativePath ?? null,
|
|
29
36
|
isRunning: runtime?.isRunning ?? false,
|
|
30
|
-
projectUrl: runtime?.publicUrl ?? null,
|
|
37
|
+
projectUrl: runtime?.publicUrl ?? publicUrlByProjectName.get(normalizedProjectName) ?? null,
|
|
31
38
|
};
|
|
32
39
|
});
|
|
33
40
|
}
|