@promptbook/cli 0.114.0-4 → 0.114.0-6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- 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 +10 -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 +1801 -474
- 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/createCoderRunStepTracker.d.ts +48 -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/prompts/buildPromptStatusDetails.d.ts +43 -0
- package/esm/scripts/run-codex-prompts/prompts/formatCoderRunSteps.d.ts +6 -3
- package/esm/scripts/run-codex-prompts/prompts/isPromptSectionUnfinished.d.ts +8 -0
- package/esm/scripts/run-codex-prompts/prompts/markPromptDone.d.ts +1 -1
- package/esm/scripts/run-codex-prompts/prompts/markPromptInProgress.d.ts +27 -0
- package/esm/scripts/run-codex-prompts/prompts/resolvePromptStatusLine.d.ts +19 -0
- package/esm/scripts/run-codex-prompts/prompts/writePromptStatusLine.d.ts +9 -0
- package/esm/scripts/run-codex-prompts/server/buildCoderServerPromptResponse.d.ts +1 -1
- package/esm/scripts/run-codex-prompts/server/coderServerHtml.d.ts +1 -1
- package/esm/scripts/run-codex-prompts/server/updatePromptSection.d.ts +1 -1
- package/esm/scripts/run-codex-prompts/testing/runPromptWithTestFeedback.d.ts +6 -0
- package/esm/scripts/run-codex-prompts/ui/buildCoderRunAgentVisual.d.ts +5 -5
- package/esm/scripts/run-codex-prompts/ui/buildCoderRunUiTerminalFrameUpdate.d.ts +27 -0
- package/esm/scripts/verify-prompts/$orderPromptFiles.d.ts +9 -0
- package/esm/scripts/verify-prompts/VerifyPromptsOrder.d.ts +26 -0
- package/esm/scripts/verify-prompts/verify-prompts.d.ts +3 -2
- package/esm/src/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 +5 -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/coder/verify.d.ts +1 -1
- package/{umd/src/cli/cli-commands/common/harness/$askForHarnessInstallationApproval.d.ts → esm/src/cli/cli-commands/common/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/save/react/exports/chat-preview-2025-10-13 (1).jsx +95 -5
- package/src/book-components/Chat/utils/renderMarkdown.ts +306 -87
- 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/coder/verify.ts +29 -5
- 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 +813 -768
- 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 +1800 -473
- 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/createCoderRunStepTracker.d.ts +48 -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/prompts/buildPromptStatusDetails.d.ts +43 -0
- package/umd/scripts/run-codex-prompts/prompts/formatCoderRunSteps.d.ts +6 -3
- package/umd/scripts/run-codex-prompts/prompts/isPromptSectionUnfinished.d.ts +8 -0
- package/umd/scripts/run-codex-prompts/prompts/markPromptDone.d.ts +1 -1
- package/umd/scripts/run-codex-prompts/prompts/markPromptInProgress.d.ts +27 -0
- package/umd/scripts/run-codex-prompts/prompts/resolvePromptStatusLine.d.ts +19 -0
- package/umd/scripts/run-codex-prompts/prompts/writePromptStatusLine.d.ts +9 -0
- package/umd/scripts/run-codex-prompts/server/buildCoderServerPromptResponse.d.ts +1 -1
- package/umd/scripts/run-codex-prompts/server/coderServerHtml.d.ts +1 -1
- package/umd/scripts/run-codex-prompts/server/updatePromptSection.d.ts +1 -1
- package/umd/scripts/run-codex-prompts/testing/runPromptWithTestFeedback.d.ts +6 -0
- package/umd/scripts/run-codex-prompts/ui/buildCoderRunAgentVisual.d.ts +5 -5
- package/umd/scripts/run-codex-prompts/ui/buildCoderRunUiTerminalFrameUpdate.d.ts +27 -0
- package/umd/scripts/verify-prompts/$orderPromptFiles.d.ts +9 -0
- package/umd/scripts/verify-prompts/VerifyPromptsOrder.d.ts +26 -0
- package/umd/scripts/verify-prompts/verify-prompts.d.ts +3 -2
- package/umd/src/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 +5 -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/coder/verify.d.ts +1 -1
- package/{esm/src/cli/cli-commands/common/harness/$askForHarnessInstallationApproval.d.ts → umd/src/cli/cli-commands/common/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/scripts/run-codex-prompts/prompts/replacePromptTodoStatusLine.d.ts +0 -7
- 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/scripts/run-codex-prompts/prompts/replacePromptTodoStatusLine.d.ts +0 -7
- 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
|
@@ -267,14 +267,46 @@ const DETAILS_PLACEHOLDER_WRAPPED_REGEX = new RegExp(`<p>\\s*(${DETAILS_PLACEHOL
|
|
|
267
267
|
const INLINE_REFERENCE_REGEX = /\[\[([^\]\r\n]+?)\]\]/g;
|
|
268
268
|
|
|
269
269
|
/**
|
|
270
|
-
*
|
|
270
|
+
* Prefix for INLINE REFERENCE PLACEHOLDER.
|
|
271
271
|
*
|
|
272
|
-
*
|
|
272
|
+
* @private utility of `renderMarkdown`
|
|
273
|
+
*/
|
|
274
|
+
const INLINE_REFERENCE_PLACEHOLDER_PREFIX = '@@PROMPTBOOK_INLINE_REFERENCE_PLACEHOLDER__';
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Pattern matching INLINE REFERENCE PLACEHOLDER.
|
|
278
|
+
*
|
|
279
|
+
* @private utility of `renderMarkdown`
|
|
280
|
+
*/
|
|
281
|
+
const INLINE_REFERENCE_PLACEHOLDER_REGEX = new RegExp(`${INLINE_REFERENCE_PLACEHOLDER_PREFIX}(\\d+)__`, 'g');
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Pattern matching markdown links and images together with their raw target.
|
|
285
|
+
*
|
|
286
|
+
* @private utility of `renderMarkdown`
|
|
287
|
+
*/
|
|
288
|
+
const MARKDOWN_LINK_REGEX = /(!?)\[([^\]\r\n]*)\]\(\s*(<[^>\r\n]*>|[^()\s]+)(?:\s+(?:"[^"]*"|'[^']*'))?\s*\)/g;
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Pattern matching bare `http(s)` URLs written directly into markdown text.
|
|
292
|
+
*
|
|
293
|
+
* @private utility of `renderMarkdown`
|
|
294
|
+
*/
|
|
295
|
+
const BARE_URL_REGEX = /(^|\s)(https?:\/\/[^\s<>()[\]"']+)/g;
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Sentence punctuation which trails a bare URL instead of belonging to it.
|
|
273
299
|
*
|
|
274
300
|
* @private utility of `renderMarkdown`
|
|
275
301
|
*/
|
|
276
|
-
const
|
|
277
|
-
|
|
302
|
+
const BARE_URL_TRAILING_PUNCTUATION_REGEX = /[.,;:!?]+$/;
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Pattern splitting one URL into its scheme, host and remaining part.
|
|
306
|
+
*
|
|
307
|
+
* @private utility of `renderMarkdown`
|
|
308
|
+
*/
|
|
309
|
+
const ABSOLUTE_URL_REGEX = /^[a-z][a-z0-9+.-]*:\/\/([^/?#]*)(.*)$/i;
|
|
278
310
|
|
|
279
311
|
/**
|
|
280
312
|
* Markdown patterns that are strong enough to identify content as markdown.
|
|
@@ -344,10 +376,12 @@ export type MarkdownInlineReference = {
|
|
|
344
376
|
readonly href: string;
|
|
345
377
|
|
|
346
378
|
/**
|
|
347
|
-
*
|
|
379
|
+
* Optional URL prefixes which also identify this reference in the authored markdown.
|
|
348
380
|
*
|
|
349
|
-
*
|
|
350
|
-
*
|
|
381
|
+
* A markdown link or a bare URL pointing to one of these prefixes is rendered as the same chip
|
|
382
|
+
* as the `[[reference]]` token. Both absolute URLs (for example `https://project.example.com`)
|
|
383
|
+
* and application paths (for example `/agents/agent/projects/website`) are supported; a path
|
|
384
|
+
* prefix matches on any host so that both relative and absolute links are recognized.
|
|
351
385
|
*/
|
|
352
386
|
readonly sourceHrefPrefixes?: ReadonlyArray<string>;
|
|
353
387
|
|
|
@@ -696,12 +730,11 @@ const CHAT_MARKDOWN_CONVERTER = createChatMarkdownConverter();
|
|
|
696
730
|
* outer `<details>` and optional `<summary>` markup untouched.
|
|
697
731
|
*
|
|
698
732
|
* @param detailsBlock - Raw `<details>...</details>` HTML captured from markdown.
|
|
699
|
-
* @param options - Markdown rendering options to reuse for the details body.
|
|
700
733
|
* @returns `<details>` HTML whose body has been converted from markdown to HTML.
|
|
701
734
|
*
|
|
702
735
|
* @private utility of `renderMarkdown`
|
|
703
736
|
*/
|
|
704
|
-
function renderDetailsBlock(detailsBlock: string
|
|
737
|
+
function renderDetailsBlock(detailsBlock: string): string_html {
|
|
705
738
|
const openTagMatch = detailsBlock.match(/^<details\b[^>]*>/i);
|
|
706
739
|
const closeTagMatch = detailsBlock.match(/<\/details\s*>$/i);
|
|
707
740
|
|
|
@@ -715,7 +748,7 @@ function renderDetailsBlock(detailsBlock: string, options?: RenderMarkdownOption
|
|
|
715
748
|
const summaryMatch = innerContent.match(/^(\s*<summary\b[^>]*>[\s\S]*?<\/summary\s*>)([\s\S]*)$/i);
|
|
716
749
|
const summaryHtml = summaryMatch?.[1] ?? '';
|
|
717
750
|
const bodyMarkdown = (summaryMatch?.[2] ?? innerContent) as string_markdown;
|
|
718
|
-
const renderedBody = renderMarkdown(bodyMarkdown
|
|
751
|
+
const renderedBody = renderMarkdown(bodyMarkdown);
|
|
719
752
|
|
|
720
753
|
return `${openTag}${summaryHtml}${renderedBody}${closeTag}` as string_html;
|
|
721
754
|
}
|
|
@@ -759,18 +792,17 @@ function maskMarkdownCodeSegments(markdown: string_markdown): MaskedCodeSegments
|
|
|
759
792
|
* processes their content.
|
|
760
793
|
*
|
|
761
794
|
* @param markdown - Markdown text that may contain raw HTML `<details>` blocks.
|
|
762
|
-
* @param options - Markdown rendering options to reuse for the details body.
|
|
763
795
|
* @returns Masked markdown and a restore helper that returns `string_html`.
|
|
764
796
|
*
|
|
765
797
|
* @private utility of `renderMarkdown`
|
|
766
798
|
*/
|
|
767
|
-
function maskDetailsBlocks(markdown: string_markdown
|
|
799
|
+
function maskDetailsBlocks(markdown: string_markdown): MaskedDetailsBlocksResult {
|
|
768
800
|
const blocks: string_html[] = [];
|
|
769
801
|
|
|
770
802
|
DETAILS_BLOCK_REGEX.lastIndex = 0;
|
|
771
803
|
const masked = markdown.replace(DETAILS_BLOCK_REGEX, (match) => {
|
|
772
804
|
const placeholder = `${DETAILS_PLACEHOLDER_PREFIX}${blocks.length}__`;
|
|
773
|
-
blocks.push(renderDetailsBlock(match
|
|
805
|
+
blocks.push(renderDetailsBlock(match));
|
|
774
806
|
return placeholder;
|
|
775
807
|
}) as string_markdown;
|
|
776
808
|
|
|
@@ -885,90 +917,181 @@ function createMarkdownInlineReferenceByKey(
|
|
|
885
917
|
}
|
|
886
918
|
|
|
887
919
|
/**
|
|
888
|
-
*
|
|
920
|
+
* Comparable parts of one URL used to recognize inline references written as links or bare URLs.
|
|
889
921
|
*
|
|
890
|
-
* @
|
|
891
|
-
|
|
892
|
-
|
|
922
|
+
* @private utility of `renderMarkdown`
|
|
923
|
+
*/
|
|
924
|
+
type ComparableUrlParts = {
|
|
925
|
+
/**
|
|
926
|
+
* Lowercase host of an absolute URL, or an empty string for a host-independent application path.
|
|
927
|
+
*/
|
|
928
|
+
readonly host: string;
|
|
929
|
+
|
|
930
|
+
/**
|
|
931
|
+
* Lowercase decoded path without query, hash and trailing slashes.
|
|
932
|
+
*/
|
|
933
|
+
readonly path: string;
|
|
934
|
+
};
|
|
935
|
+
|
|
936
|
+
/**
|
|
937
|
+
* One inline reference together with its comparable source URL prefixes.
|
|
893
938
|
*
|
|
894
939
|
* @private utility of `renderMarkdown`
|
|
895
940
|
*/
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
941
|
+
type MarkdownInlineReferenceHrefMatcher = {
|
|
942
|
+
/**
|
|
943
|
+
* Reference rendered when one of its source prefixes matches.
|
|
944
|
+
*/
|
|
945
|
+
readonly reference: MarkdownInlineReference;
|
|
900
946
|
|
|
901
|
-
|
|
947
|
+
/**
|
|
948
|
+
* Comparable form of the reference source URL prefixes.
|
|
949
|
+
*/
|
|
950
|
+
readonly sourceHrefPrefixes: ReadonlyArray<ComparableUrlParts>;
|
|
951
|
+
};
|
|
902
952
|
|
|
903
|
-
|
|
904
|
-
|
|
953
|
+
/**
|
|
954
|
+
* Renders one matched reference and returns the placeholder standing for it.
|
|
955
|
+
*
|
|
956
|
+
* @private utility of `renderMarkdown`
|
|
957
|
+
*/
|
|
958
|
+
type CreateMarkdownInlineReferencePlaceholder = (reference: MarkdownInlineReference) => string;
|
|
905
959
|
|
|
906
960
|
/**
|
|
907
|
-
*
|
|
961
|
+
* Decodes percent-encoded characters without failing on malformed input.
|
|
908
962
|
*
|
|
909
|
-
* @param
|
|
910
|
-
* @returns
|
|
963
|
+
* @param value - Raw URL part.
|
|
964
|
+
* @returns Decoded value, or the original value when it cannot be decoded.
|
|
911
965
|
*
|
|
912
966
|
* @private utility of `renderMarkdown`
|
|
913
967
|
*/
|
|
914
|
-
function
|
|
968
|
+
function decodeUrlPartSafely(value: string): string {
|
|
915
969
|
try {
|
|
916
|
-
return
|
|
970
|
+
return decodeURIComponent(value);
|
|
917
971
|
} catch {
|
|
918
|
-
return
|
|
972
|
+
return value;
|
|
919
973
|
}
|
|
920
974
|
}
|
|
921
975
|
|
|
922
976
|
/**
|
|
923
|
-
*
|
|
977
|
+
* Normalizes one URL path so that encoding, casing and trailing slashes do not break matching.
|
|
924
978
|
*
|
|
925
|
-
*
|
|
926
|
-
*
|
|
979
|
+
* @param path - Raw path including an optional query and hash.
|
|
980
|
+
* @returns Comparable path.
|
|
927
981
|
*
|
|
928
|
-
* @
|
|
929
|
-
|
|
930
|
-
|
|
982
|
+
* @private utility of `renderMarkdown`
|
|
983
|
+
*/
|
|
984
|
+
function normalizeUrlPathForComparison(path: string): string {
|
|
985
|
+
const pathWithoutQuery = path.split(/[?#]/, 1)[0] || '';
|
|
986
|
+
|
|
987
|
+
return decodeUrlPartSafely(pathWithoutQuery).toLowerCase().replace(/\/+$/, '');
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
/**
|
|
991
|
+
* Splits one absolute URL or application path into its comparable parts.
|
|
992
|
+
*
|
|
993
|
+
* @param url - Raw link target written in markdown.
|
|
994
|
+
* @returns Comparable URL parts, or `null` when the value cannot address a reference.
|
|
931
995
|
*
|
|
932
996
|
* @private utility of `renderMarkdown`
|
|
933
997
|
*/
|
|
934
|
-
function
|
|
935
|
-
const
|
|
998
|
+
function createComparableUrlParts(url: string): ComparableUrlParts | null {
|
|
999
|
+
const trimmedUrl = url
|
|
1000
|
+
.trim()
|
|
1001
|
+
.replace(/^<([\s\S]*)>$/, '$1')
|
|
1002
|
+
.trim();
|
|
936
1003
|
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
return false;
|
|
941
|
-
}
|
|
1004
|
+
if (trimmedUrl === '') {
|
|
1005
|
+
return null;
|
|
1006
|
+
}
|
|
942
1007
|
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
1008
|
+
const absoluteUrlMatch = trimmedUrl.match(ABSOLUTE_URL_REGEX);
|
|
1009
|
+
if (absoluteUrlMatch) {
|
|
1010
|
+
return {
|
|
1011
|
+
host: absoluteUrlMatch[1]!.toLowerCase(),
|
|
1012
|
+
path: normalizeUrlPathForComparison(absoluteUrlMatch[2] || ''),
|
|
1013
|
+
};
|
|
1014
|
+
}
|
|
946
1015
|
|
|
947
|
-
|
|
948
|
-
|
|
1016
|
+
if (!trimmedUrl.startsWith('/')) {
|
|
1017
|
+
return null;
|
|
1018
|
+
}
|
|
949
1019
|
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
);
|
|
955
|
-
});
|
|
1020
|
+
return {
|
|
1021
|
+
host: '',
|
|
1022
|
+
path: normalizeUrlPathForComparison(trimmedUrl),
|
|
1023
|
+
};
|
|
956
1024
|
}
|
|
957
1025
|
|
|
958
1026
|
/**
|
|
959
|
-
*
|
|
1027
|
+
* Returns whether one URL points into one reference source prefix.
|
|
1028
|
+
*
|
|
1029
|
+
* @param url - Comparable parts of the link target written in markdown.
|
|
1030
|
+
* @param prefix - Comparable parts of one reference source prefix.
|
|
1031
|
+
* @returns `true` when the URL belongs to the reference.
|
|
960
1032
|
*
|
|
961
|
-
* @
|
|
962
|
-
|
|
963
|
-
|
|
1033
|
+
* @private utility of `renderMarkdown`
|
|
1034
|
+
*/
|
|
1035
|
+
function isUrlWithinReferencePrefix(url: ComparableUrlParts, prefix: ComparableUrlParts): boolean {
|
|
1036
|
+
if (prefix.host !== '' && prefix.host !== url.host) {
|
|
1037
|
+
return false;
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
if (prefix.path === '') {
|
|
1041
|
+
// Note: A prefix without a path covers the whole host, a prefix without both would cover everything
|
|
1042
|
+
return prefix.host !== '';
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
return url.path === prefix.path || url.path.startsWith(`${prefix.path}/`);
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
/**
|
|
1049
|
+
* Builds matchers for references which can also be written as a markdown link or a bare URL.
|
|
1050
|
+
*
|
|
1051
|
+
* @param references - References available to this markdown render.
|
|
1052
|
+
* @returns Matchers of references declaring at least one usable source prefix.
|
|
964
1053
|
*
|
|
965
1054
|
* @private utility of `renderMarkdown`
|
|
966
1055
|
*/
|
|
967
|
-
function
|
|
1056
|
+
function createMarkdownInlineReferenceHrefMatchers(
|
|
968
1057
|
references: ReadonlyArray<MarkdownInlineReference>,
|
|
1058
|
+
): ReadonlyArray<MarkdownInlineReferenceHrefMatcher> {
|
|
1059
|
+
return references
|
|
1060
|
+
.map((reference) => ({
|
|
1061
|
+
reference,
|
|
1062
|
+
sourceHrefPrefixes: (reference.sourceHrefPrefixes || [])
|
|
1063
|
+
.map((sourceHrefPrefix) => createComparableUrlParts(sourceHrefPrefix))
|
|
1064
|
+
.filter((sourceHrefPrefix): sourceHrefPrefix is ComparableUrlParts => sourceHrefPrefix !== null),
|
|
1065
|
+
}))
|
|
1066
|
+
.filter((matcher) => matcher.sourceHrefPrefixes.length !== 0);
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
/**
|
|
1070
|
+
* Finds the reference which owns one link target.
|
|
1071
|
+
*
|
|
1072
|
+
* @param href - Raw link target written in markdown.
|
|
1073
|
+
* @param matchers - Reference matchers of this markdown render.
|
|
1074
|
+
* @returns Matching reference or `null`.
|
|
1075
|
+
*
|
|
1076
|
+
* @private utility of `renderMarkdown`
|
|
1077
|
+
*/
|
|
1078
|
+
function findMarkdownInlineReferenceForHref(
|
|
969
1079
|
href: string,
|
|
970
|
-
|
|
971
|
-
|
|
1080
|
+
matchers: ReadonlyArray<MarkdownInlineReferenceHrefMatcher>,
|
|
1081
|
+
): MarkdownInlineReference | null {
|
|
1082
|
+
const urlParts = createComparableUrlParts(href);
|
|
1083
|
+
|
|
1084
|
+
if (urlParts === null) {
|
|
1085
|
+
return null;
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
const matcher = matchers.find((candidateMatcher) =>
|
|
1089
|
+
candidateMatcher.sourceHrefPrefixes.some((sourceHrefPrefix) =>
|
|
1090
|
+
isUrlWithinReferencePrefix(urlParts, sourceHrefPrefix),
|
|
1091
|
+
),
|
|
1092
|
+
);
|
|
1093
|
+
|
|
1094
|
+
return matcher?.reference || null;
|
|
972
1095
|
}
|
|
973
1096
|
|
|
974
1097
|
/**
|
|
@@ -1042,11 +1165,113 @@ function renderMarkdownInlineReferenceMenuOptionHtml(option: MarkdownInlineRefer
|
|
|
1042
1165
|
}
|
|
1043
1166
|
|
|
1044
1167
|
/**
|
|
1045
|
-
* Replaces known `[[reference]]` tokens with
|
|
1168
|
+
* Replaces known `[[reference]]` tokens with chip placeholders while leaving unknown tokens unchanged.
|
|
1169
|
+
*
|
|
1170
|
+
* @param markdown - Markdown content after code masking.
|
|
1171
|
+
* @param references - References available to this markdown render.
|
|
1172
|
+
* @param createPlaceholder - Renders one matched reference into a placeholder.
|
|
1173
|
+
* @returns Markdown with known reference tokens replaced by placeholders.
|
|
1174
|
+
*
|
|
1175
|
+
* @private utility of `renderMarkdown`
|
|
1176
|
+
*/
|
|
1177
|
+
function replaceMarkdownInlineReferenceTokens(
|
|
1178
|
+
markdown: string_markdown,
|
|
1179
|
+
references: ReadonlyArray<MarkdownInlineReference>,
|
|
1180
|
+
createPlaceholder: CreateMarkdownInlineReferencePlaceholder,
|
|
1181
|
+
): string_markdown {
|
|
1182
|
+
const referenceByKey = createMarkdownInlineReferenceByKey(references);
|
|
1183
|
+
|
|
1184
|
+
if (referenceByKey.size === 0) {
|
|
1185
|
+
return markdown;
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
return markdown.replace(INLINE_REFERENCE_REGEX, (match, rawReference: string) => {
|
|
1189
|
+
const reference = referenceByKey.get(normalizeMarkdownInlineReferenceKey(rawReference));
|
|
1190
|
+
|
|
1191
|
+
return reference ? createPlaceholder(reference) : match;
|
|
1192
|
+
}) as string_markdown;
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
/**
|
|
1196
|
+
* Replaces markdown links pointing to a known reference with chip placeholders.
|
|
1197
|
+
*
|
|
1198
|
+
* Images keep their original markdown so that pictures served by a reference stay visible.
|
|
1199
|
+
*
|
|
1200
|
+
* @param markdown - Markdown content after code masking.
|
|
1201
|
+
* @param matchers - Reference matchers of this markdown render.
|
|
1202
|
+
* @param createPlaceholder - Renders one matched reference into a placeholder.
|
|
1203
|
+
* @returns Markdown with known reference links replaced by placeholders.
|
|
1204
|
+
*
|
|
1205
|
+
* @private utility of `renderMarkdown`
|
|
1206
|
+
*/
|
|
1207
|
+
function replaceMarkdownInlineReferenceLinks(
|
|
1208
|
+
markdown: string_markdown,
|
|
1209
|
+
matchers: ReadonlyArray<MarkdownInlineReferenceHrefMatcher>,
|
|
1210
|
+
createPlaceholder: CreateMarkdownInlineReferencePlaceholder,
|
|
1211
|
+
): string_markdown {
|
|
1212
|
+
return markdown.replace(MARKDOWN_LINK_REGEX, (match, imageMarker: string, _label: string, rawHref: string) => {
|
|
1213
|
+
if (imageMarker !== '') {
|
|
1214
|
+
return match;
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
const reference = findMarkdownInlineReferenceForHref(rawHref, matchers);
|
|
1218
|
+
|
|
1219
|
+
return reference ? createPlaceholder(reference) : match;
|
|
1220
|
+
}) as string_markdown;
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
/**
|
|
1224
|
+
* Replaces bare URLs of known references with chip placeholders.
|
|
1225
|
+
*
|
|
1226
|
+
* @param markdown - Markdown content after reference links were replaced.
|
|
1227
|
+
* @param matchers - Reference matchers of this markdown render.
|
|
1228
|
+
* @param createPlaceholder - Renders one matched reference into a placeholder.
|
|
1229
|
+
* @returns Markdown with known reference URLs replaced by placeholders.
|
|
1230
|
+
*
|
|
1231
|
+
* @private utility of `renderMarkdown`
|
|
1232
|
+
*/
|
|
1233
|
+
function replaceMarkdownInlineReferenceBareUrls(
|
|
1234
|
+
markdown: string_markdown,
|
|
1235
|
+
matchers: ReadonlyArray<MarkdownInlineReferenceHrefMatcher>,
|
|
1236
|
+
createPlaceholder: CreateMarkdownInlineReferencePlaceholder,
|
|
1237
|
+
): string_markdown {
|
|
1238
|
+
return markdown.replace(BARE_URL_REGEX, (match, leadingWhitespace: string, rawUrl: string) => {
|
|
1239
|
+
const trailingPunctuation = rawUrl.match(BARE_URL_TRAILING_PUNCTUATION_REGEX)?.[0] || '';
|
|
1240
|
+
const url = rawUrl.slice(0, rawUrl.length - trailingPunctuation.length);
|
|
1241
|
+
const reference = findMarkdownInlineReferenceForHref(url, matchers);
|
|
1242
|
+
|
|
1243
|
+
return reference ? `${leadingWhitespace}${createPlaceholder(reference)}${trailingPunctuation}` : match;
|
|
1244
|
+
}) as string_markdown;
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1247
|
+
/**
|
|
1248
|
+
* Restores chips which replaced references during the reference passes.
|
|
1249
|
+
*
|
|
1250
|
+
* @param markdown - Markdown containing reference placeholders.
|
|
1251
|
+
* @param renderedChips - Chip HTML indexed by placeholder number.
|
|
1252
|
+
* @returns Markdown with inline references rendered as HTML chips.
|
|
1253
|
+
*
|
|
1254
|
+
* @private utility of `renderMarkdown`
|
|
1255
|
+
*/
|
|
1256
|
+
function restoreMarkdownInlineReferenceChips(
|
|
1257
|
+
markdown: string_markdown,
|
|
1258
|
+
renderedChips: ReadonlyArray<string>,
|
|
1259
|
+
): string_markdown {
|
|
1260
|
+
return markdown.replace(
|
|
1261
|
+
INLINE_REFERENCE_PLACEHOLDER_REGEX,
|
|
1262
|
+
(_match, index) => renderedChips[Number(index)] ?? '',
|
|
1263
|
+
) as string_markdown;
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1266
|
+
/**
|
|
1267
|
+
* Replaces known `[[reference]]` tokens, reference links and bare reference URLs with link chips.
|
|
1268
|
+
*
|
|
1269
|
+
* Every matched reference is first replaced by a placeholder so that the rendered chip HTML is
|
|
1270
|
+
* never processed again by a later pass.
|
|
1046
1271
|
*
|
|
1047
1272
|
* @param markdown - Markdown content after code masking.
|
|
1048
1273
|
* @param options - Markdown render options.
|
|
1049
|
-
* @returns Markdown with known inline references rendered as HTML
|
|
1274
|
+
* @returns Markdown with known inline references rendered as HTML chips.
|
|
1050
1275
|
*
|
|
1051
1276
|
* @private utility of `renderMarkdown`
|
|
1052
1277
|
*/
|
|
@@ -1058,33 +1283,27 @@ function applyMarkdownInlineReferences(markdown: string_markdown, options?: Rend
|
|
|
1058
1283
|
return markdown;
|
|
1059
1284
|
}
|
|
1060
1285
|
|
|
1061
|
-
const
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
const markdownWithInlineReferenceTokens = markdown.replace(
|
|
1067
|
-
INLINE_REFERENCE_REGEX,
|
|
1068
|
-
(match, rawReference: string) => {
|
|
1069
|
-
const reference = referenceByKey.get(normalizeMarkdownInlineReferenceKey(rawReference));
|
|
1286
|
+
const renderedChips: Array<string> = [];
|
|
1287
|
+
const createPlaceholder: CreateMarkdownInlineReferencePlaceholder = (reference) => {
|
|
1288
|
+
const placeholder = `${INLINE_REFERENCE_PLACEHOLDER_PREFIX}${renderedChips.length}__`;
|
|
1289
|
+
renderedChips.push(renderMarkdownInlineReferenceHtml(reference, className));
|
|
1070
1290
|
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
);
|
|
1291
|
+
return placeholder;
|
|
1292
|
+
};
|
|
1074
1293
|
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
(match, imageMarker: string, _linkLabel: string, rawHref: string) => {
|
|
1078
|
-
if (imageMarker) {
|
|
1079
|
-
return match;
|
|
1080
|
-
}
|
|
1294
|
+
const hrefMatchers = createMarkdownInlineReferenceHrefMatchers(references);
|
|
1295
|
+
let referencedMarkdown = replaceMarkdownInlineReferenceTokens(markdown, references, createPlaceholder);
|
|
1081
1296
|
|
|
1082
|
-
|
|
1083
|
-
|
|
1297
|
+
if (hrefMatchers.length !== 0) {
|
|
1298
|
+
referencedMarkdown = replaceMarkdownInlineReferenceLinks(referencedMarkdown, hrefMatchers, createPlaceholder);
|
|
1299
|
+
referencedMarkdown = replaceMarkdownInlineReferenceBareUrls(
|
|
1300
|
+
referencedMarkdown,
|
|
1301
|
+
hrefMatchers,
|
|
1302
|
+
createPlaceholder,
|
|
1303
|
+
);
|
|
1304
|
+
}
|
|
1084
1305
|
|
|
1085
|
-
|
|
1086
|
-
},
|
|
1087
|
-
) as string_markdown;
|
|
1306
|
+
return restoreMarkdownInlineReferenceChips(referencedMarkdown, renderedChips);
|
|
1088
1307
|
}
|
|
1089
1308
|
|
|
1090
1309
|
/**
|
|
@@ -1129,7 +1348,7 @@ export function renderMarkdown(markdown: string_markdown, options?: RenderMarkdo
|
|
|
1129
1348
|
|
|
1130
1349
|
try {
|
|
1131
1350
|
const normalizedMarkdown = normalizeMarkdownSublists(markdown);
|
|
1132
|
-
const { masked: maskedMarkdown, restore: restoreDetails } = maskDetailsBlocks(normalizedMarkdown
|
|
1351
|
+
const { masked: maskedMarkdown, restore: restoreDetails } = maskDetailsBlocks(normalizedMarkdown);
|
|
1133
1352
|
const { masked: codeMaskedMarkdown, restore: restoreCode } = maskMarkdownCodeSegments(maskedMarkdown);
|
|
1134
1353
|
const referencedMarkdown = applyMarkdownInlineReferences(codeMaskedMarkdown, options);
|
|
1135
1354
|
const inlineReferenceMarkdown = restoreCode(referencedMarkdown);
|
|
@@ -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
|
};
|