@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
|
@@ -102,11 +102,11 @@ export function $initializeCoderAddCommand(program: Program): $side_effect {
|
|
|
102
102
|
const description = await resolveCoderPromptDescription(descriptionArgument);
|
|
103
103
|
|
|
104
104
|
// Note: Import the git synchronization dynamically to keep the CLI fast for runs without `--commit`
|
|
105
|
-
const { $commitCoderChanges, $
|
|
105
|
+
const { $commitCoderChanges, $startCoderGitSync } = await import(
|
|
106
106
|
'../../../../scripts/run-codex-prompts/git/coderGitSync'
|
|
107
107
|
);
|
|
108
108
|
|
|
109
|
-
await $
|
|
109
|
+
const commitScope = await $startCoderGitSync({ gitSync, projectPath });
|
|
110
110
|
|
|
111
111
|
const { /* filePath,*/ emojiTag } = await addCoderPrompt({
|
|
112
112
|
projectPath,
|
|
@@ -117,7 +117,7 @@ export function $initializeCoderAddCommand(program: Program): $side_effect {
|
|
|
117
117
|
|
|
118
118
|
await $commitCoderChanges({
|
|
119
119
|
gitSync,
|
|
120
|
-
|
|
120
|
+
commitScope,
|
|
121
121
|
commitMessage: `${emojiTag} Add prompt`,
|
|
122
122
|
});
|
|
123
123
|
}),
|
|
@@ -29,7 +29,7 @@ export type BoilerplateCount = {
|
|
|
29
29
|
* Number of prompts written into each generated file.
|
|
30
30
|
*
|
|
31
31
|
* Note: More than one prompt per file is an advanced option - each prompt is one separate
|
|
32
|
-
* coding task separated by
|
|
32
|
+
* coding task separated by `---`, with all prompts in the file sharing its fresh emoji tag.
|
|
33
33
|
*/
|
|
34
34
|
readonly promptsPerFileCount: number;
|
|
35
35
|
};
|
|
@@ -39,7 +39,7 @@ export function $initializeCoderGenerateBoilerplatesCommand(program: Program): $
|
|
|
39
39
|
command.description(
|
|
40
40
|
spaceTrim(
|
|
41
41
|
(block) => `
|
|
42
|
-
Generate prompt boilerplate files with unique emoji
|
|
42
|
+
Generate prompt boilerplate files with one unique emoji tag per file
|
|
43
43
|
|
|
44
44
|
${block(CODER_GIT_SYNC_DESCRIPTION)}
|
|
45
45
|
`,
|
|
@@ -71,11 +71,11 @@ export function $initializeCoderGenerateBoilerplatesCommand(program: Program): $
|
|
|
71
71
|
const projectPath = process.cwd();
|
|
72
72
|
|
|
73
73
|
// Note: Import the git synchronization dynamically to keep the CLI fast for runs without `--commit`
|
|
74
|
-
const { $commitCoderChanges, $
|
|
74
|
+
const { $commitCoderChanges, $startCoderGitSync } = await import(
|
|
75
75
|
'../../../../scripts/run-codex-prompts/git/coderGitSync'
|
|
76
76
|
);
|
|
77
77
|
|
|
78
|
-
await $
|
|
78
|
+
const commitScope = await $startCoderGitSync({ gitSync, projectPath });
|
|
79
79
|
|
|
80
80
|
await generatePromptBoilerplate({
|
|
81
81
|
projectPath,
|
|
@@ -85,7 +85,7 @@ export function $initializeCoderGenerateBoilerplatesCommand(program: Program): $
|
|
|
85
85
|
|
|
86
86
|
await $commitCoderChanges({
|
|
87
87
|
gitSync,
|
|
88
|
-
|
|
88
|
+
commitScope,
|
|
89
89
|
commitMessage: `Prompts ${formatBoilerplateCount(boilerplateCount)}`,
|
|
90
90
|
});
|
|
91
91
|
|
|
@@ -95,7 +95,7 @@ export function $initializeCoderGenerateBoilerplatesCommand(program: Program): $
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
/**
|
|
98
|
-
* Generates boilerplate prompt files with unique emoji
|
|
98
|
+
* Generates boilerplate prompt files with one unique emoji tag per file.
|
|
99
99
|
*
|
|
100
100
|
* @private internal function of `generatePromptBoilerplate` command
|
|
101
101
|
*/
|
|
@@ -134,10 +134,10 @@ export async function generatePromptBoilerplate({
|
|
|
134
134
|
colors.blue(`Highest existing number for ${promptNumbering.datePrefix} found: ${highestNumberFormatted}`),
|
|
135
135
|
);
|
|
136
136
|
|
|
137
|
-
// Note: Every single generated prompt is one separate coding task, so each of them reserves its own fresh emoji tag
|
|
138
137
|
const promptsCount = filesCount * promptsPerFileCount;
|
|
139
138
|
const { availableCount, selectedEmojis } = await getFreshPromptEmojiTags({
|
|
140
|
-
|
|
139
|
+
// Note: Each generated file reserves one fresh emoji tag shared by all of its prompt sections
|
|
140
|
+
count: filesCount,
|
|
141
141
|
rootDir: projectPath,
|
|
142
142
|
});
|
|
143
143
|
|
|
@@ -154,9 +154,7 @@ export async function generatePromptBoilerplate({
|
|
|
154
154
|
for (let i = 0; i < filesCount; i++) {
|
|
155
155
|
const number = promptNumbering.startNumber + i * promptNumbering.step;
|
|
156
156
|
const title = titles[i % titles.length]!;
|
|
157
|
-
const
|
|
158
|
-
.slice(i * promptsPerFileCount, (i + 1) * promptsPerFileCount)
|
|
159
|
-
.map((emoji) => formatPromptEmojiTag(emoji));
|
|
157
|
+
const emojiTag = formatPromptEmojiTag(selectedEmojis[i]!);
|
|
160
158
|
const filename = buildPromptFilename(
|
|
161
159
|
promptNumbering.datePrefix,
|
|
162
160
|
number,
|
|
@@ -165,7 +163,8 @@ export async function generatePromptBoilerplate({
|
|
|
165
163
|
const filepath = join(PROMPTS_DIRECTORY_PATH, filename);
|
|
166
164
|
const absoluteFilepath = join(projectPath, filepath);
|
|
167
165
|
const content = buildBoilerplatePromptFileContent({
|
|
168
|
-
|
|
166
|
+
emojiTag,
|
|
167
|
+
promptsPerFileCount,
|
|
169
168
|
title,
|
|
170
169
|
body: promptTemplate.content,
|
|
171
170
|
});
|
|
@@ -175,7 +174,7 @@ export async function generatePromptBoilerplate({
|
|
|
175
174
|
absoluteFilepath,
|
|
176
175
|
filename,
|
|
177
176
|
content,
|
|
178
|
-
|
|
177
|
+
emojiTag,
|
|
179
178
|
number,
|
|
180
179
|
});
|
|
181
180
|
}
|
|
@@ -185,7 +184,7 @@ export async function generatePromptBoilerplate({
|
|
|
185
184
|
|
|
186
185
|
for (const file of filesToCreate) {
|
|
187
186
|
writeFileSync(file.absoluteFilepath, file.content, 'utf-8');
|
|
188
|
-
console.info(colors.green(`✓ Created: ${file.filename} with ${file.
|
|
187
|
+
console.info(colors.green(`✓ Created: ${file.filename} with ${file.emojiTag}`));
|
|
189
188
|
}
|
|
190
189
|
|
|
191
190
|
console.info(
|
|
@@ -196,31 +195,32 @@ export async function generatePromptBoilerplate({
|
|
|
196
195
|
}
|
|
197
196
|
|
|
198
197
|
/**
|
|
199
|
-
* Builds the markdown content of one generated prompt file with one prompt section per
|
|
198
|
+
* Builds the markdown content of one generated prompt file with one prompt section per prompt.
|
|
200
199
|
*
|
|
201
|
-
* Multiple prompts in one file are separated by the `---` separator,
|
|
200
|
+
* Multiple prompts in one file share the file emoji tag and are separated by the `---` separator,
|
|
201
|
+
* exactly like the prompt runner expects them.
|
|
202
202
|
*
|
|
203
203
|
* @private internal utility of `generatePromptBoilerplate` command
|
|
204
204
|
*/
|
|
205
205
|
function buildBoilerplatePromptFileContent({
|
|
206
|
-
|
|
206
|
+
emojiTag,
|
|
207
|
+
promptsPerFileCount,
|
|
207
208
|
title,
|
|
208
209
|
body,
|
|
209
210
|
}: {
|
|
210
|
-
readonly
|
|
211
|
+
readonly emojiTag: string;
|
|
212
|
+
readonly promptsPerFileCount: number;
|
|
211
213
|
readonly title: string;
|
|
212
214
|
readonly body: string;
|
|
213
215
|
}): string {
|
|
214
|
-
return
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
)
|
|
223
|
-
.join('\n\n---\n\n');
|
|
216
|
+
return Array.from({ length: promptsPerFileCount }, () =>
|
|
217
|
+
buildCoderPromptSection({
|
|
218
|
+
statusLine: '[-]',
|
|
219
|
+
emojiTag,
|
|
220
|
+
title,
|
|
221
|
+
body,
|
|
222
|
+
}),
|
|
223
|
+
).join('\n\n---\n\n');
|
|
224
224
|
}
|
|
225
225
|
|
|
226
226
|
/**
|
|
@@ -4,12 +4,13 @@ import { DEFAULT_BOILERPLATE_COUNT_OPTION_VALUE } from './boilerplateCount';
|
|
|
4
4
|
* Default npm scripts initialized by `ptbk coder init`.
|
|
5
5
|
*/
|
|
6
6
|
const DEFAULT_CODER_PACKAGE_JSON_SCRIPTS = {
|
|
7
|
-
|
|
8
|
-
'coder:
|
|
7
|
+
// Note: Using NPX because `ptbk` can be installed globally or locally, and NPX will resolve it correctly in either case.
|
|
8
|
+
'coder:generate-boilerplates': `npx ptbk coder generate-boilerplates --count ${DEFAULT_BOILERPLATE_COUNT_OPTION_VALUE} --template ./prompts/templates/common.md`,
|
|
9
|
+
'coder:add': 'npx ptbk coder add --template ./prompts/templates/common.md',
|
|
9
10
|
'coder:run':
|
|
10
|
-
'ptbk coder run --harness openai-codex --model gpt-5.6-terra --thinking-level max --agent agents/developer.book --context AGENTS.md --test-before yes-and-fix',
|
|
11
|
+
'npx ptbk coder run --harness openai-codex --model gpt-5.6-terra --thinking-level max --agent agents/developer.book --context AGENTS.md --test-before yes-and-fix',
|
|
11
12
|
// 'coder:find-refactor-candidates': 'npx ptbk coder find-refactor-candidates',
|
|
12
|
-
'coder:verify': 'ptbk coder verify',
|
|
13
|
+
'coder:verify': 'npx ptbk coder verify',
|
|
13
14
|
} as const satisfies Readonly<Record<string, string>>;
|
|
14
15
|
|
|
15
16
|
/**
|
|
@@ -82,11 +82,11 @@ export function $initializeCoderInitCommand(program: Program): $side_effect {
|
|
|
82
82
|
const projectPath = process.cwd();
|
|
83
83
|
|
|
84
84
|
// Note: Import the git synchronization dynamically to keep the CLI fast for runs without `--commit`
|
|
85
|
-
const { $commitCoderChanges, $
|
|
85
|
+
const { $commitCoderChanges, $startCoderGitSync } = await import(
|
|
86
86
|
'../../../../scripts/run-codex-prompts/git/coderGitSync'
|
|
87
87
|
);
|
|
88
88
|
|
|
89
|
-
await $
|
|
89
|
+
const commitScope = await $startCoderGitSync({ gitSync, projectPath });
|
|
90
90
|
|
|
91
91
|
const summary = await initializeCoderProjectConfiguration(projectPath);
|
|
92
92
|
printInitializationSummary(summary);
|
|
@@ -94,7 +94,7 @@ export function $initializeCoderInitCommand(program: Program): $side_effect {
|
|
|
94
94
|
|
|
95
95
|
await $commitCoderChanges({
|
|
96
96
|
gitSync,
|
|
97
|
-
|
|
97
|
+
commitScope,
|
|
98
98
|
commitMessage: 'Initialize Promptbook Coder',
|
|
99
99
|
});
|
|
100
100
|
|
|
@@ -10,6 +10,7 @@ import { createNonNegativeIntegerOptionParser } from '../common/createNonNegativ
|
|
|
10
10
|
import { createPositiveIntegerOptionParser } from '../common/createPositiveIntegerOptionParser';
|
|
11
11
|
import { handleActionErrors } from '../common/handleActionErrors';
|
|
12
12
|
import { $ensureHarnessInstallations } from '../common/harness/$ensureHarnessInstallations';
|
|
13
|
+
import { $ensurePromptbookCliInstallations } from '../common/promptbook-cli/$ensurePromptbookCliInstallations';
|
|
13
14
|
import type { PromptRunnerCliOptions } from '../common/promptRunnerCliOptions';
|
|
14
15
|
import {
|
|
15
16
|
addPromptRunnerExecutionOptions,
|
|
@@ -41,12 +42,14 @@ export function $initializeCoderRunCommand(program: Program): $side_effect {
|
|
|
41
42
|
|
|
42
43
|
Features:
|
|
43
44
|
- Automatically stages and commits changes with agent identity unless --no-commit is used
|
|
45
|
+
- Commits only the prompt file and the files the coding agent has changed, leaving unrelated changes alone
|
|
44
46
|
- Optional post-commit git push with explicit --auto-push opt-in
|
|
45
47
|
- Optional pre-prompt git pull with explicit --auto-pull opt-in
|
|
46
48
|
- Optional --isolate runs every prompt in its own temporary git worktree and merges it back when verified
|
|
47
49
|
- Optional --preserve-logs keeps temp prompt/log artifacts after successful rounds
|
|
48
50
|
- Optional --no-ui keeps plain streaming console output for logging and debugging
|
|
49
51
|
- Checks that the selected harness is installed globally and up to date before the first prompt
|
|
52
|
+
- In interactive mode, checks local and global Promptbook CLI installations and offers to update them
|
|
50
53
|
- Supports GPG signing of commits
|
|
51
54
|
- Optional pre-coding test run that can stop or repair pre-existing failures
|
|
52
55
|
- Optional post-prompt verification with test-feedback retries
|
|
@@ -196,8 +199,6 @@ export function $initializeCoderRunCommand(program: Program): $side_effect {
|
|
|
196
199
|
isAgentRequired: !dryRun,
|
|
197
200
|
});
|
|
198
201
|
|
|
199
|
-
await $ensureHarnessInstallations([runnerOptions.agentName]);
|
|
200
|
-
|
|
201
202
|
// [1] Parse the wait options and --no-auto:
|
|
202
203
|
// default: run automatically through the queue (no waiting between prompts)
|
|
203
204
|
// --no-auto: wait for user confirmation before each prompt (interactive mode)
|
|
@@ -205,6 +206,13 @@ export function $initializeCoderRunCommand(program: Program): $side_effect {
|
|
|
205
206
|
// --wait-between-prompts: pace from start of one prompt to start of next
|
|
206
207
|
// --wait-after-error: wait before retrying after an error (default 10m)
|
|
207
208
|
const waitForUser = !auto;
|
|
209
|
+
|
|
210
|
+
if (waitForUser && (await $ensurePromptbookCliInstallations())) {
|
|
211
|
+
return process.exit(0);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
await $ensureHarnessInstallations([runnerOptions.agentName]);
|
|
215
|
+
|
|
208
216
|
const waitAfterPrompt = parseOptionalWaitDuration(waitAfterPromptValue, 0);
|
|
209
217
|
const waitBetweenPrompts = parseOptionalWaitDuration(waitBetweenPromptsValue, 0);
|
|
210
218
|
const waitAfterError = parseOptionalWaitDuration(waitAfterErrorValue, DEFAULT_WAIT_AFTER_ERROR_MS);
|
|
@@ -26,7 +26,7 @@ export type CoderGitSyncCliOptions = {
|
|
|
26
26
|
export const CODER_GIT_SYNC_DESCRIPTION = spaceTrim(`
|
|
27
27
|
Git synchronization:
|
|
28
28
|
- --auto-pull pulls the latest changes before this command changes anything
|
|
29
|
-
- --commit commits the changes
|
|
29
|
+
- --commit commits only the files this command has changed, unrelated changes stay in the working tree
|
|
30
30
|
- --auto-push pushes the created commit to the remote repository
|
|
31
31
|
`);
|
|
32
32
|
|
|
@@ -39,7 +39,11 @@ export const CODER_GIT_SYNC_DESCRIPTION = spaceTrim(`
|
|
|
39
39
|
* @private internal utility of `promptbookCli`
|
|
40
40
|
*/
|
|
41
41
|
export function addCoderGitSyncOptions(command: Program): void {
|
|
42
|
-
command.option(
|
|
42
|
+
command.option(
|
|
43
|
+
'--commit',
|
|
44
|
+
'Commit the files changed by this command with the coding-agent git identity, leaving unrelated changes uncommitted',
|
|
45
|
+
false,
|
|
46
|
+
);
|
|
43
47
|
command.option('--auto-push', 'Automatically git push the created commit, requires --commit', false);
|
|
44
48
|
command.option(
|
|
45
49
|
'--auto-pull',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import colors from 'colors';
|
|
2
|
-
import { $
|
|
2
|
+
import { $askForNpmPackageInstallationApproval } from '../npm/$askForNpmPackageInstallationApproval';
|
|
3
3
|
import { $installHarness } from './$installHarness';
|
|
4
4
|
import { buildHarnessInstallCommand } from './buildHarnessInstallCommand';
|
|
5
5
|
import type { HarnessInstallationStatus } from './HarnessInstallationStatus';
|
|
@@ -31,7 +31,7 @@ export async function $applyHarnessInstallationStatus(status: HarnessInstallatio
|
|
|
31
31
|
|
|
32
32
|
console.warn(colors.yellow(formatHarnessInstallationWarning(status)));
|
|
33
33
|
|
|
34
|
-
const isInstallationApproved = await $
|
|
34
|
+
const isInstallationApproved = await $askForNpmPackageInstallationApproval(
|
|
35
35
|
installationState === 'not-installed'
|
|
36
36
|
? `Install ${definition.label} globally now?`
|
|
37
37
|
: `Update ${definition.label} to ${latestVersion} now?`,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { $resolveInstalledHarnessVersion } from './$resolveInstalledHarnessVersion';
|
|
2
|
-
import { $
|
|
2
|
+
import { $resolveLatestNpmPackageVersion } from '../npm/$resolveLatestNpmPackageVersion';
|
|
3
3
|
import type { HarnessDefinition } from './HarnessDefinition';
|
|
4
4
|
import type { HarnessInstallationState, HarnessInstallationStatus } from './HarnessInstallationStatus';
|
|
5
|
-
import {
|
|
5
|
+
import { isNpmPackageVersionOutdated } from '../npm/isNpmPackageVersionOutdated';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Detects whether one CLI coding harness is installed globally and whether it is up to date.
|
|
@@ -14,7 +14,7 @@ import { isHarnessVersionOutdated } from './isHarnessVersionOutdated';
|
|
|
14
14
|
export async function $checkHarnessInstallation(definition: HarnessDefinition): Promise<HarnessInstallationStatus> {
|
|
15
15
|
const [installedVersion, latestVersion] = await Promise.all([
|
|
16
16
|
$resolveInstalledHarnessVersion(definition),
|
|
17
|
-
$
|
|
17
|
+
$resolveLatestNpmPackageVersion(definition.npmPackageName),
|
|
18
18
|
]);
|
|
19
19
|
|
|
20
20
|
return {
|
|
@@ -40,7 +40,7 @@ function resolveHarnessInstallationState(
|
|
|
40
40
|
return 'unknown';
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
return
|
|
43
|
+
return isNpmPackageVersionOutdated(installedVersion, latestVersion) ? 'outdated' : 'up-to-date';
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
// Note: [🟡] Code for CLI harness installation check [$checkHarnessInstallation](src/cli/cli-commands/common/harness/$checkHarnessInstallation.ts) should never be published outside of `@promptbook/cli`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { $execCommand } from '../../../../utils/execCommand/$execCommand';
|
|
2
|
-
import {
|
|
2
|
+
import { extractNpmPackageVersionFromOutput } from '../npm/extractNpmPackageVersionFromOutput';
|
|
3
3
|
import type { HarnessDefinition } from './HarnessDefinition';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -23,7 +23,7 @@ export async function $resolveInstalledHarnessVersion(definition: HarnessDefinit
|
|
|
23
23
|
isVerbose: false,
|
|
24
24
|
}).catch(() => '');
|
|
25
25
|
|
|
26
|
-
return
|
|
26
|
+
return extractNpmPackageVersionFromOutput(output);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
// Note: [🟡] Code for CLI harness version detection [$resolveInstalledHarnessVersion](src/cli/cli-commands/common/harness/$resolveInstalledHarnessVersion.ts) should never be published outside of `@promptbook/cli`
|
|
@@ -2,14 +2,14 @@ import colors from 'colors';
|
|
|
2
2
|
import { createInterface } from 'readline';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Asks the user in the terminal whether
|
|
5
|
+
* Asks the user in the terminal whether an npm package should be installed or updated now.
|
|
6
6
|
*
|
|
7
7
|
* Note: `$` is used to indicate that this function is not a pure function - it reads the answer from stdin
|
|
8
8
|
*
|
|
9
9
|
* @returns `true` when the user confirms, `false` when the user declines or the terminal is not interactive
|
|
10
10
|
* @private internal utility of `promptbookCli`
|
|
11
11
|
*/
|
|
12
|
-
export async function $
|
|
12
|
+
export async function $askForNpmPackageInstallationApproval(question: string): Promise<boolean> {
|
|
13
13
|
if (!process.stdin.isTTY) {
|
|
14
14
|
// Note: In non-interactive environments like CI there is nobody who could confirm the installation
|
|
15
15
|
return false;
|
|
@@ -28,4 +28,4 @@ export async function $askForHarnessInstallationApproval(question: string): Prom
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
// Note: [🟡] Code for CLI
|
|
31
|
+
// Note: [🟡] Code for CLI npm package installation approval [$askForNpmPackageInstallationApproval](src/cli/cli-commands/common/npm/$askForNpmPackageInstallationApproval.ts) should never be published outside of `@promptbook/cli`
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { $execCommand } from '../../../../utils/execCommand/$execCommand';
|
|
2
|
+
import { extractNpmPackageVersionFromOutput } from './extractNpmPackageVersionFromOutput';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Time limit for the whole `npm view` lookup of the newest published package version.
|
|
6
|
+
*/
|
|
7
|
+
const NPM_PACKAGE_LATEST_VERSION_COMMAND_TIMEOUT_MS = 60 * 1000;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Time limit for one npm registry request, so an unreachable registry never blocks the command.
|
|
11
|
+
*/
|
|
12
|
+
const NPM_REGISTRY_FETCH_TIMEOUT_MS = 20 * 1000;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Pattern matching npm's JSON-encoded package version result.
|
|
16
|
+
*/
|
|
17
|
+
const NPM_VIEW_JSON_VERSION_PATTERN = /"(\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?)/u;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Reads the newest version of one npm package.
|
|
21
|
+
*
|
|
22
|
+
* Note: `$` is used to indicate that this function is not a pure function - it queries the npm registry
|
|
23
|
+
*
|
|
24
|
+
* @returns The newest published version or `null` when the registry could not be reached
|
|
25
|
+
* @private internal utility of `promptbookCli`
|
|
26
|
+
*/
|
|
27
|
+
export async function $resolveLatestNpmPackageVersion(npmPackageName: string): Promise<string | null> {
|
|
28
|
+
const output = await $execCommand({
|
|
29
|
+
command: `npm view ${npmPackageName} version --json --loglevel=error --fetch-timeout=${NPM_REGISTRY_FETCH_TIMEOUT_MS} --fetch-retries=1`,
|
|
30
|
+
crashOnError: true,
|
|
31
|
+
timeout: NPM_PACKAGE_LATEST_VERSION_COMMAND_TIMEOUT_MS,
|
|
32
|
+
isVerbose: false,
|
|
33
|
+
}).catch(() => '');
|
|
34
|
+
|
|
35
|
+
return extractLatestNpmPackageVersionFromNpmViewOutput(output);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Extracts the version from npm's JSON result while tolerating warnings emitted before or after that result.
|
|
40
|
+
*
|
|
41
|
+
* @private internal utility of `$resolveLatestNpmPackageVersion`
|
|
42
|
+
*/
|
|
43
|
+
function extractLatestNpmPackageVersionFromNpmViewOutput(output: string): string | null {
|
|
44
|
+
const jsonVersionMatch = NPM_VIEW_JSON_VERSION_PATTERN.exec(output);
|
|
45
|
+
|
|
46
|
+
return jsonVersionMatch?.[1] ?? extractNpmPackageVersionFromOutput(output, { isLastMatchPreferred: true });
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Note: [🟡] Code for CLI npm package registry lookup [$resolveLatestNpmPackageVersion](src/cli/cli-commands/common/npm/$resolveLatestNpmPackageVersion.ts) should never be published outside of `@promptbook/cli`
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pattern matching one `major.minor.patch` version anywhere in npm or CLI command output.
|
|
3
|
+
*/
|
|
4
|
+
const NPM_PACKAGE_VERSION_PATTERN = /\b(\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?)/gu;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Extracts an npm package version from raw command output.
|
|
8
|
+
*
|
|
9
|
+
* Both npm and CLI commands may emit unrelated warnings before the version. CLI commands use the first matching token;
|
|
10
|
+
* npm registry commands can opt into the last matching token because npm warnings commonly precede their JSON output.
|
|
11
|
+
*
|
|
12
|
+
* @returns The parsed version or `null` when the output contains no version
|
|
13
|
+
* @private internal utility of `promptbookCli`
|
|
14
|
+
*/
|
|
15
|
+
export function extractNpmPackageVersionFromOutput(
|
|
16
|
+
output: string,
|
|
17
|
+
{ isLastMatchPreferred = false }: { readonly isLastMatchPreferred?: boolean } = {},
|
|
18
|
+
): string | null {
|
|
19
|
+
const versionMatches = Array.from(output.matchAll(NPM_PACKAGE_VERSION_PATTERN));
|
|
20
|
+
const versionMatch = isLastMatchPreferred ? versionMatches[versionMatches.length - 1] : versionMatches[0];
|
|
21
|
+
|
|
22
|
+
return versionMatch?.[1] ?? null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Note: [🟡] Code for CLI npm package version parsing [extractNpmPackageVersionFromOutput](src/cli/cli-commands/common/npm/extractNpmPackageVersionFromOutput.ts) should never be published outside of `@promptbook/cli`
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Compares
|
|
2
|
+
* Compares an installed npm package version with the newest published version.
|
|
3
3
|
*
|
|
4
4
|
* Only the numeric `major.minor.patch` segments are compared and pre-release suffixes are ignored,
|
|
5
|
-
* so a
|
|
5
|
+
* so a package installed from a pre-release build of the newest version is not reported as outdated.
|
|
6
6
|
*
|
|
7
7
|
* @private internal utility of `promptbookCli`
|
|
8
8
|
*/
|
|
9
|
-
export function
|
|
9
|
+
export function isNpmPackageVersionOutdated(installedVersion: string, latestVersion: string): boolean {
|
|
10
10
|
const installedSegments = parseVersionSegments(installedVersion);
|
|
11
11
|
const latestSegments = parseVersionSegments(latestVersion);
|
|
12
12
|
const segmentCount = Math.max(installedSegments.length, latestSegments.length);
|
|
@@ -25,6 +25,8 @@ export function isHarnessVersionOutdated(installedVersion: string, latestVersion
|
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* Splits one version into its numeric segments, dropping the pre-release and build suffix.
|
|
28
|
+
*
|
|
29
|
+
* @private internal utility of `isNpmPackageVersionOutdated`
|
|
28
30
|
*/
|
|
29
31
|
function parseVersionSegments(version: string): ReadonlyArray<number> {
|
|
30
32
|
const [numericVersion = ''] = version.trim().split(/[-+]/u);
|
|
@@ -36,4 +38,4 @@ function parseVersionSegments(version: string): ReadonlyArray<number> {
|
|
|
36
38
|
});
|
|
37
39
|
}
|
|
38
40
|
|
|
39
|
-
// Note: [🟡] Code for CLI
|
|
41
|
+
// Note: [🟡] Code for CLI npm package version comparison [isNpmPackageVersionOutdated](src/cli/cli-commands/common/npm/isNpmPackageVersionOutdated.ts) should never be published outside of `@promptbook/cli`
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { readFile, stat, writeFile } from 'fs/promises';
|
|
2
2
|
import { join } from 'path';
|
|
3
|
+
import { spaceTrim } from 'spacetrim';
|
|
3
4
|
import { escapeRegExp } from '../../../utils/chat/escapeRegExp';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -118,7 +119,15 @@ export async function ensureProjectGitignoreFile({
|
|
|
118
119
|
return 'unchanged';
|
|
119
120
|
}
|
|
120
121
|
|
|
121
|
-
const nextGitignoreContent = appendBlock(
|
|
122
|
+
const nextGitignoreContent = appendBlock(
|
|
123
|
+
currentGitignoreContent || '',
|
|
124
|
+
spaceTrim(
|
|
125
|
+
(block) => `
|
|
126
|
+
${block(blockHeader)}
|
|
127
|
+
${block(missingRules.join('\n'))}
|
|
128
|
+
`,
|
|
129
|
+
),
|
|
130
|
+
);
|
|
122
131
|
await writeFile(gitignorePath, nextGitignoreContent, 'utf-8');
|
|
123
132
|
return currentGitignoreContent === undefined ? 'created' : 'updated';
|
|
124
133
|
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { $resolveLatestNpmPackageVersion } from '../npm/$resolveLatestNpmPackageVersion';
|
|
2
|
+
import { isNpmPackageVersionOutdated } from '../npm/isNpmPackageVersionOutdated';
|
|
3
|
+
import type { PromptbookCliInstallation } from './PromptbookCliInstallation';
|
|
4
|
+
import type {
|
|
5
|
+
PromptbookCliInstallationState,
|
|
6
|
+
PromptbookCliInstallationStatus,
|
|
7
|
+
} from './PromptbookCliInstallationStatus';
|
|
8
|
+
import { $resolvePromptbookCliInstallations } from './$resolvePromptbookCliInstallations';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Checks every local and global Promptbook CLI installation against the newest npm version.
|
|
12
|
+
*
|
|
13
|
+
* Note: `$` is used to indicate that this function is not a pure function - it reads installed packages and queries npm
|
|
14
|
+
*
|
|
15
|
+
* @private internal utility of `promptbookCli`
|
|
16
|
+
*/
|
|
17
|
+
export async function $checkPromptbookCliInstallations(): Promise<ReadonlyArray<PromptbookCliInstallationStatus>> {
|
|
18
|
+
const installations = await $resolvePromptbookCliInstallations();
|
|
19
|
+
|
|
20
|
+
if (installations.length === 0) {
|
|
21
|
+
return [];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const latestVersionsByNpmPackageName = await $resolveLatestVersionsByNpmPackageName(installations);
|
|
25
|
+
|
|
26
|
+
return installations.map((installation) => {
|
|
27
|
+
const latestVersion = latestVersionsByNpmPackageName.get(installation.npmPackageName) ?? null;
|
|
28
|
+
|
|
29
|
+
return {
|
|
30
|
+
installation,
|
|
31
|
+
installationState: resolvePromptbookCliInstallationState(installation.installedVersion, latestVersion),
|
|
32
|
+
latestVersion,
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Resolves each package's newest version once, even when it is installed locally and globally.
|
|
39
|
+
*
|
|
40
|
+
* @private internal utility of `$checkPromptbookCliInstallations`
|
|
41
|
+
*/
|
|
42
|
+
async function $resolveLatestVersionsByNpmPackageName(
|
|
43
|
+
installations: ReadonlyArray<PromptbookCliInstallation>,
|
|
44
|
+
): Promise<ReadonlyMap<PromptbookCliInstallation['npmPackageName'], string | null>> {
|
|
45
|
+
const npmPackageNames = Array.from(new Set(installations.map(({ npmPackageName }) => npmPackageName)));
|
|
46
|
+
const latestVersionEntries = await Promise.all(
|
|
47
|
+
npmPackageNames.map(async (npmPackageName) => {
|
|
48
|
+
const latestVersion = await $resolveLatestNpmPackageVersion(npmPackageName);
|
|
49
|
+
|
|
50
|
+
return [npmPackageName, latestVersion] as const;
|
|
51
|
+
}),
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
return new Map(latestVersionEntries);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Derives the update state of one installed Promptbook CLI package.
|
|
59
|
+
*
|
|
60
|
+
* @private internal utility of `$checkPromptbookCliInstallations`
|
|
61
|
+
*/
|
|
62
|
+
function resolvePromptbookCliInstallationState(
|
|
63
|
+
installedVersion: string,
|
|
64
|
+
latestVersion: string | null,
|
|
65
|
+
): PromptbookCliInstallationState {
|
|
66
|
+
if (latestVersion === null) {
|
|
67
|
+
return 'unknown';
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return isNpmPackageVersionOutdated(installedVersion, latestVersion) ? 'outdated' : 'up-to-date';
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Note: [🟡] Code for Promptbook CLI installation check [$checkPromptbookCliInstallations](src/cli/cli-commands/common/promptbook-cli/$checkPromptbookCliInstallations.ts) should never be published outside of `@promptbook/cli`
|