@promptbook/cli 0.114.0-0 → 0.114.0-10
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 +20 -27
- package/agents/default/developer.book +1 -0
- package/apps/agents-server/README.md +1 -1
- package/apps/agents-server/{USE_TIMEOUT_CHIP_QA.md → TIMEOUT_CHIP_QA.md} +1 -1
- package/apps/agents-server/next.config.ts +33 -0
- package/apps/agents-server/package.json +11 -9
- package/apps/agents-server/playwright.config.ts +28 -38
- package/apps/agents-server/scripts/build-agents-server.js +98 -0
- package/apps/agents-server/scripts/build-e2e.js +48 -0
- package/apps/agents-server/scripts/ensure-root-dependencies.js +86 -0
- 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/prerender-homepage.js +1 -1
- package/apps/agents-server/scripts/run-e2e-tests.js +47 -0
- package/apps/agents-server/scripts/run-npm.js +118 -0
- package/apps/agents-server/src/app/admin/email-server/page.tsx +17 -10
- package/apps/agents-server/src/app/admin/messages/MessageParticipants.tsx +84 -0
- package/apps/agents-server/src/app/admin/messages/MessageStatus.tsx +96 -0
- package/apps/agents-server/src/app/admin/messages/MessagesClient.tsx +21 -32
- package/apps/agents-server/src/app/admin/messages/messageAdminPresentation.ts +289 -0
- 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]/AgentChatWrapper.tsx +5 -9
- package/apps/agents-server/src/app/agents/[agentName]/AgentProfileChat.tsx +5 -9
- package/apps/agents-server/src/app/agents/[agentName]/api/book/route.ts +8 -0
- package/apps/agents-server/src/app/agents/[agentName]/api/chat/resolveAgentChatRouteContext.ts +8 -16
- 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]/api/voice/route.ts +4 -9
- 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 +168 -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 +18 -9
- 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]/projectRuntimeActions.ts +97 -0
- package/apps/agents-server/src/app/agents/[agentName]/projects/[projectName]/actions.ts +5 -50
- 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/elevenlabs/tts/route.ts +3 -3
- package/apps/agents-server/src/app/api/emails/incoming/stalwart/route.ts +9 -2
- package/apps/agents-server/src/app/api/internal/agent-goal-chat-planned-messages/route.ts +146 -0
- package/apps/agents-server/src/app/api/onboarding/book/route.ts +7 -6
- package/apps/agents-server/src/app/api/scrape/route.ts +1 -1
- package/apps/agents-server/src/app/layout.tsx +31 -0
- package/apps/agents-server/src/app/superadmin/servers/ServersRegistryTable.tsx +124 -129
- package/apps/agents-server/src/app/superadmin/servers/useServersRegistryState.ts +15 -7
- package/apps/agents-server/src/app/system/user-wallet/UserWalletDraft.ts +2 -2
- package/apps/agents-server/src/components/AgentNaming/legacyAgentTextTranslations.cs.yaml +7 -0
- package/apps/agents-server/src/components/AgentProfile/AgentCapabilityChips.tsx +1 -24
- 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/AgentProjects/useAgentProjectMarkdownReferences.ts +184 -0
- 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/Header.tsx +8 -0
- package/apps/agents-server/src/components/Header/HeaderTypes.ts +5 -0
- package/apps/agents-server/src/components/Header/buildActiveAgentViewItems.ts +5 -4
- package/apps/agents-server/src/components/Header/buildHeaderSystemMenuItems.ts +118 -30
- 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/Header/resolveHeaderSystemActivities.ts +86 -0
- package/apps/agents-server/src/components/Homepage/AgentCard.tsx +0 -3
- package/apps/agents-server/src/components/Homepage/useAgentsListImportExportState.ts +22 -10
- package/apps/agents-server/src/components/LayoutWrapper/LayoutWrapper.tsx +8 -0
- package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/ManGoBookEditor.tsx +82 -0
- package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/WizardShell.tsx +2 -2
- package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/steps/BookStep.tsx +13 -16
- package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/steps/ZadaniStep.tsx +4 -4
- package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/config/bookSections.ts +23 -16
- package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/lib/bookSource.ts +54 -0
- package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/services/bookService.ts +15 -8
- package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/services/createManGoAgentSource.ts +3 -37
- package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/services/createManGoOpenEditorRequest.ts +1 -1
- package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/state/OnboardingProvider.tsx +2 -2
- package/apps/agents-server/src/components/NewAgentDialog/NewAgentWizardState.ts +0 -12
- package/apps/agents-server/src/components/NewAgentDialog/NewAgentWizardUseSetupStep.tsx +0 -58
- package/apps/agents-server/src/components/NewAgentDialog/newAgentWizardPresets.ts +0 -56
- package/apps/agents-server/src/components/UsersList/CreateUserDialog.tsx +13 -22
- package/apps/agents-server/src/components/UsersList/PasswordGeneratorDialog.tsx +216 -0
- package/apps/agents-server/src/components/UsersList/UsersList.tsx +16 -11
- package/apps/agents-server/src/components/UsersList/generateSecurePassword.ts +112 -24
- package/apps/agents-server/src/components/UsersList/userDialogClassNames.ts +11 -0
- package/apps/agents-server/src/components/WalletRecordDialog/useWalletRecordDialogState.ts +1 -1
- 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 +20 -11
- package/apps/agents-server/src/languages/translations/czech.yaml +20 -11
- package/apps/agents-server/src/languages/translations/english.yaml +20 -11
- package/apps/agents-server/src/message-providers/email/smtp/SmtpMessageProvider.ts +1 -1
- package/apps/agents-server/src/message-providers/email/stalwart/StalwartMessageProvider.ts +57 -18
- package/apps/agents-server/src/message-providers/email/stalwart/parseInboundStalwartEmail.ts +17 -2
- package/apps/agents-server/src/tools/$provideOpenAiAgentKitExecutionToolsForServer.ts +0 -191
- package/apps/agents-server/src/tools/$provideOpenAiAssistantExecutionToolsForServer.ts +0 -3
- package/apps/agents-server/src/tools/agentGoalChatTimeoutToolFunctions.ts +180 -0
- package/apps/agents-server/src/tools/agentGoalChatTimeoutTools.ts +92 -0
- package/apps/agents-server/src/tools/createServerChatRuntimeTools.ts +20 -0
- package/apps/agents-server/src/tools/getAllToolFunctionsForServer.ts +2 -0
- package/apps/agents-server/src/tools/run_browser.ts +1 -1
- package/apps/agents-server/src/tools/send_email.ts +3 -3
- package/apps/agents-server/src/utils/agentGoalChat/agentGoalChatConstants.ts +14 -0
- package/apps/agents-server/src/utils/agentGoalChat/agentGoalChatIdentity.ts +28 -0
- package/apps/agents-server/src/utils/agentGoalChat/agentGoalChatPlannedMessageActions.ts +307 -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 +92 -0
- package/apps/agents-server/src/utils/agentGoalChat/enqueueAgentGoalChatTurn.ts +167 -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 +53 -0
- package/apps/agents-server/src/utils/agentGoalChat/resolveAgentGoalChatOwnerUserId.ts +104 -0
- package/apps/agents-server/src/utils/agentGoalChat/resolveEffectiveAgentGoal.ts +29 -0
- package/apps/agents-server/src/utils/agentGoalChat/scheduleAgentGoalChatModifiedNote.ts +85 -0
- package/apps/agents-server/src/utils/agentGoalChat.ts +24 -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/AgentProjectRuntimeActionResult.ts +14 -0
- package/apps/agents-server/src/utils/agentProjects/agentProjectFileNames.ts +21 -0
- package/apps/agents-server/src/utils/agentProjects/agentProjectHrefs.ts +20 -0
- package/apps/agents-server/src/utils/agentProjects/agentProjectsPaths.ts +15 -5
- package/apps/agents-server/src/utils/agentProjects/createAgentProjectDnsRecords.ts +53 -7
- package/apps/agents-server/src/utils/agentProjects/createAgentProjectInitials.ts +36 -0
- package/apps/agents-server/src/utils/agentProjects/createAgentProjectMarkdownReferences.ts +143 -28
- 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/createAgentWithDefaultVisibility.ts +8 -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/handleChatCompletion/createHandleChatCompletionPromptContext.ts +3 -2
- package/apps/agents-server/src/utils/handleChatCompletion/resolveHandleChatCompletionRuntime.ts +4 -12
- 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/manGoOnboarding/manGoOnboardingAgentBooks.ts +2 -14
- package/apps/agents-server/src/utils/manGoOnboarding/manGoOnboardingAgentRuntime.ts +21 -73
- package/apps/agents-server/src/utils/messages/parseUseEmailSmtpCredential.ts +1 -1
- package/apps/agents-server/src/utils/resolveUseEmailSmtpCredential.ts +1 -1
- 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/createEmailDnsInstructions.ts +9 -5
- package/apps/agents-server/src/utils/stalwart/createEmailDnsRecordsSection.ts +53 -0
- package/apps/agents-server/src/utils/stalwart/readStalwartEmailSnapshot.ts +23 -5
- package/apps/agents-server/src/utils/stalwart/stalwartBootstrap.ts +2 -1
- package/apps/agents-server/src/utils/stalwart/stalwartMailBridge.ts +7 -0
- package/apps/agents-server/src/utils/useEmailSmtpWalletConstants.ts +5 -5
- 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/appendQueuedUserChatTurn.ts +9 -2
- package/apps/agents-server/src/utils/userChat/createRunUserChatJobExecutionContext.ts +7 -17
- 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/resolveUserChatWorkerInternalToken.ts +5 -4
- 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/userChatMessageLifecycle.ts +6 -1
- 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 +55 -0
- package/apps/agents-server/src/utils/userWallet/UserWalletRecord.ts +1 -1
- package/apps/agents-server/src/utils/userWallet/resolveUseEmailSmtpCredentialFromWallet.ts +1 -1
- package/apps/agents-server/src/utils/vpsSelfUpdate/deleteVpsSelfUpdateInstalledVersion.ts +2 -1
- package/apps/agents-server/src/utils/vpsSelfUpdate/isVpsSelfUpdateJobRunning.ts +16 -0
- package/apps/agents-server/src/utils/vpsSelfUpdate/startVpsSelfUpdate.ts +2 -1
- package/apps/agents-server/src/utils/vpsSelfUpdate.ts +1 -0
- package/apps/agents-server/tests/e2e/e2eEnvironment.cjs +49 -0
- package/esm/apps/agents-server/src/utils/agentGoalChat/agentGoalChatConstants.d.ts +12 -0
- package/esm/index.es.js +5260 -6573
- package/esm/index.es.js.map +1 -1
- package/esm/scripts/run-agent-messages/messages/buildAgentGoalChatPromptSection.d.ts +8 -0
- package/esm/scripts/run-agent-messages/messages/buildAgentMessagePrompt.d.ts +12 -1
- package/esm/scripts/run-agent-messages/messages/buildAgentProjectsPromptSection.d.ts +2 -14
- 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/common/runGoScript/scriptExecutionLog.d.ts +7 -0
- package/esm/scripts/run-codex-prompts/git/coderCommitScope.d.ts +31 -0
- package/esm/scripts/run-codex-prompts/git/coderGitSync.d.ts +56 -0
- package/esm/scripts/run-codex-prompts/git/commitChanges.d.ts +12 -3
- package/esm/scripts/run-codex-prompts/git/workingTreeChanges.d.ts +40 -0
- package/esm/scripts/run-codex-prompts/main/resolvePromptRunner.d.ts +8 -1
- package/esm/scripts/run-codex-prompts/ping/buildCoderPingPrompt.d.ts +20 -0
- package/esm/scripts/run-codex-prompts/ping/extractCoderPingAnswer.d.ts +9 -0
- package/esm/scripts/run-codex-prompts/ping/pingCoderHarness.d.ts +23 -0
- package/esm/scripts/run-codex-prompts/ping/printCoderPingResult.d.ts +5 -0
- package/esm/scripts/run-codex-prompts/prompts/buildPromptStatusDetails.d.ts +43 -0
- package/esm/scripts/run-codex-prompts/prompts/findNextTodoPrompt.d.ts +2 -1
- package/esm/scripts/run-codex-prompts/prompts/formatCoderRunSteps.d.ts +6 -3
- package/esm/scripts/run-codex-prompts/prompts/isPromptCompatibleWithRunner.d.ts +27 -0
- package/esm/scripts/run-codex-prompts/prompts/isPromptSectionUnfinished.d.ts +8 -0
- package/esm/scripts/run-codex-prompts/prompts/listRunnablePrompts.d.ts +2 -1
- package/esm/scripts/run-codex-prompts/prompts/listUpcomingTasks.d.ts +2 -1
- 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/TestBeforeMode.d.ts +16 -0
- package/esm/scripts/run-codex-prompts/testing/createTestBeforeRepairPrompt.d.ts +9 -0
- package/esm/scripts/run-codex-prompts/testing/limitTestOutput.d.ts +4 -0
- package/esm/scripts/run-codex-prompts/testing/runPromptTestCommand.d.ts +1 -2
- package/esm/scripts/run-codex-prompts/testing/runPromptWithTestFeedback.d.ts +6 -0
- package/esm/scripts/run-codex-prompts/testing/runTestBefore.d.ts +24 -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/run-codex-prompts/ui/buildRunUiFrameShared.d.ts +1 -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 +8 -2
- package/esm/src/_packages/components.index.d.ts +4 -0
- package/esm/src/_packages/types.index.d.ts +4 -0
- package/esm/src/avatars/renderAvatarVisualTerminalText.d.ts +80 -0
- package/esm/src/avatars/types/AvatarVisualDefinition.d.ts +54 -0
- package/esm/src/book-2.0/agent-source/AgentBasicInformation.d.ts +3 -3
- package/esm/src/book-2.0/book-language-documentation/BookLanguageManualDictionary.d.ts +1 -15
- package/esm/src/book-2.0/book-language-documentation/getBookLanguageManualCommitmentGroups.d.ts +1 -1
- package/esm/src/book-2.0/book-language-documentation/renderCommitmentCatalogSection.d.ts +0 -4
- 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/$provideServerDomWindow.d.ts +11 -0
- package/esm/src/book-components/Chat/utils/renderMarkdown.d.ts +72 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/createAgentsServerRuntimeEnvironment.d.ts +7 -0
- package/esm/src/cli/cli-commands/coder/agentCodingFile.d.ts +2 -3
- package/esm/src/cli/cli-commands/coder/boilerplateCount.d.ts +52 -0
- package/esm/src/cli/cli-commands/coder/generate-boilerplates.d.ts +4 -3
- package/esm/src/cli/cli-commands/coder/ping.d.ts +10 -0
- package/esm/src/cli/cli-commands/coder/verify.d.ts +1 -1
- package/esm/src/cli/cli-commands/coder.d.ts +1 -0
- package/esm/src/cli/cli-commands/common/coderGitSyncCliOptions.d.ts +34 -0
- 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/buildNpmPackageInstallCommand.d.ts +12 -0
- package/esm/src/cli/cli-commands/common/npm/extractNpmPackageVersionFromOutput.d.ts +12 -0
- package/esm/src/cli/cli-commands/common/npm/isNpmPackageVersionOutdated.d.ts +12 -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/$resolvePromptbookCliInstallations.d.ts +12 -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 +66 -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/formatPromptbookCliInstallationWarning.d.ts +7 -0
- package/esm/src/cli/common/loadPromptsModule.d.ts +16 -0
- package/esm/src/commitments/{COMPONENT/COMPONENT.d.ts → META_FULLNAME/META_FULLNAME.d.ts} +8 -5
- package/esm/src/commitments/META_ID/META_ID.d.ts +32 -0
- package/esm/src/commitments/index.d.ts +4 -12
- package/esm/src/llm-providers/agent/Agent.d.ts +1 -1
- package/esm/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +1 -1
- package/esm/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +1 -1
- package/esm/src/llm-providers/openai/OpenAiAgentKitExecutionTools.d.ts +1 -1
- package/esm/src/llm-providers/openai/OpenAiAgentKitExecutionToolsToolBuilder.d.ts +2 -2
- package/esm/src/llm-providers/openai/OpenAiAssistantExecutionToolsStreamRunner.d.ts +1 -1
- package/esm/src/llm-providers/openai/OpenAiAssistantExecutionToolsToolRunner.d.ts +1 -1
- package/esm/src/llm-providers/openai/OpenAiCompatibleNonChatPromptCaller.d.ts +1 -1
- package/esm/src/llm-providers/openai/OpenAiCompatibleRequestManager.d.ts +1 -1
- package/esm/src/llm-providers/openai/utils/callOpenAiCompatibleChatModel.d.ts +1 -1
- package/esm/src/llm-providers/openai/utils/loadOpenAiAgentsModule.d.ts +203 -0
- package/esm/src/llm-providers/openai/utils/uploadFilesToOpenAi.d.ts +1 -1
- package/esm/src/{commitments/USE_BROWSER → scrapers/_common/utils}/fetchUrlContent.d.ts +2 -3
- 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/createLazyModuleLoader.d.ts +14 -0
- package/esm/src/utils/misc/debounce.d.ts +4 -2
- package/esm/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/_packages/components.index.ts +4 -0
- package/src/_packages/components.readme.md +1 -1
- package/src/_packages/types.index.ts +4 -0
- 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/agent-source/AgentBasicInformation.ts +3 -9
- package/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments/filterCommitmentsForAgentModelRequirements.ts +0 -23
- package/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.ts +0 -2
- package/src/book-2.0/agent-source/parseAgentSource/applyMetaCommitment.ts +16 -31
- package/src/book-2.0/agent-source/parseAgentSource/createCapabilitiesFromCommitment.ts +0 -35
- package/src/book-2.0/book-language-documentation/BookLanguageManualDictionary.ts +1 -15
- package/src/book-2.0/book-language-documentation/bookLanguageDocumentationExamples.ts +1 -27
- package/src/book-2.0/book-language-documentation/createStandaloneBookLanguageMarkdown.ts +96 -44
- package/src/book-2.0/book-language-documentation/czechBookLanguageManualDictionary.ts +23 -71
- package/src/book-2.0/book-language-documentation/englishBookLanguageManualDictionary.ts +22 -67
- package/src/book-2.0/book-language-documentation/getBookLanguageManualCommitmentGroups.ts +9 -1
- package/src/book-2.0/book-language-documentation/renderCommitmentCatalogSection.ts +5 -55
- package/src/book-2.0/book-language-documentation/renderGroupedCommitmentDocumentationMarkdown.ts +278 -4
- package/src/book-3.0/AgentTeamConversationWorkspace.ts +172 -0
- package/src/book-3.0/LiteAgent.ts +11 -9
- package/src/book-components/BookEditor/useBookEditorMonacoLanguage.ts +1 -1
- 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 +85 -17
- package/src/book-components/Chat/MarkdownContent/MarkdownContent.tsx +116 -2
- package/src/book-components/Chat/save/react/exports/chat-preview-2025-10-13 (1).jsx +95 -5
- package/src/book-components/Chat/utils/$provideServerDomWindow.ts +77 -0
- package/src/book-components/Chat/utils/renderMarkdown.ts +716 -44
- package/src/cli/cli-commands/agents-server/buildAgentsServer/createAgentsServerRuntimeEnvironment.ts +14 -0
- package/src/cli/cli-commands/agents-server/buildAgentsServer/ensureAgentsServerBuild.ts +1 -0
- package/src/cli/cli-commands/agents-server/startAgentsServer/createLocalAgentRunOptions.ts +1 -0
- package/src/cli/cli-commands/coder/add.ts +40 -12
- package/src/cli/cli-commands/coder/agentCodingFile.ts +6 -129
- package/src/cli/cli-commands/coder/boilerplateCount.ts +139 -0
- package/src/cli/cli-commands/coder/generate-boilerplates.ts +81 -47
- package/src/cli/cli-commands/coder/getDefaultCoderPackageJsonScripts.ts +7 -4
- package/src/cli/cli-commands/coder/init.ts +29 -2
- package/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.ts +1 -4
- package/src/cli/cli-commands/coder/ping.ts +72 -0
- package/src/cli/cli-commands/coder/run.ts +35 -4
- package/src/cli/cli-commands/coder/verify.ts +55 -16
- package/src/cli/cli-commands/coder.ts +4 -0
- package/src/cli/cli-commands/common/coderGitSyncCliOptions.ts +82 -0
- package/src/cli/cli-commands/common/harness/$applyHarnessInstallationStatus.ts +2 -2
- package/src/cli/cli-commands/common/harness/$checkHarnessInstallation.ts +6 -4
- package/src/cli/cli-commands/common/harness/$resolveInstalledHarnessVersion.ts +2 -2
- package/src/cli/cli-commands/common/harness/buildHarnessInstallCommand.ts +2 -1
- 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/buildNpmPackageInstallCommand.ts +28 -0
- package/src/cli/cli-commands/common/npm/extractNpmPackageVersionFromOutput.ts +25 -0
- package/src/cli/cli-commands/common/npm/isNpmPackageVersionOutdated.ts +165 -0
- package/src/cli/cli-commands/common/projectInitialization.ts +10 -1
- package/src/cli/cli-commands/common/promptbook-cli/$checkPromptbookCliInstallations.ts +69 -0
- package/src/cli/cli-commands/common/promptbook-cli/$ensurePromptbookCliInstallations.ts +117 -0
- package/src/cli/cli-commands/common/promptbook-cli/$resolvePromptbookCliInstallations.ts +259 -0
- package/src/cli/cli-commands/common/promptbook-cli/$updatePromptbookCliInstallation.ts +55 -0
- package/src/cli/cli-commands/common/promptbook-cli/PromptbookCliInstallation.ts +76 -0
- package/src/cli/cli-commands/common/promptbook-cli/PromptbookCliInstallationStatus.ts +32 -0
- package/src/cli/cli-commands/common/promptbook-cli/buildPromptbookCliInstallCommand.ts +13 -0
- package/src/cli/cli-commands/common/promptbook-cli/formatPromptbookCliInstallationWarning.ts +45 -0
- package/src/cli/cli-commands/run/prepareRunCommandResources.ts +2 -1
- package/src/cli/cli-commands/run/resolveRunInputParameters.ts +2 -1
- package/src/cli/cli-commands/runInteractiveChatbot.ts +2 -1
- package/src/cli/common/$provideLlmToolsForCli.ts +2 -1
- package/src/cli/common/loadPromptsModule.ts +13 -0
- package/src/commands/FORMAT/formatCommandParser.ts +2 -2
- package/src/commitments/ACTION/ACTION.ts +3 -3
- package/src/commitments/{META → META_DESCRIPTION}/META_DESCRIPTION.ts +1 -1
- package/src/commitments/META_FULLNAME/META_FULLNAME.ts +70 -0
- package/src/commitments/META_ID/META_ID.ts +78 -0
- package/src/commitments/_common/getAllCommitmentsToolFunctionsForNode.ts +1 -49
- package/src/commitments/index.ts +6 -24
- package/src/conversion/archive/loadArchive.ts +2 -1
- package/src/conversion/archive/loadJsZipModule.ts +10 -0
- package/src/conversion/archive/saveArchive.ts +2 -1
- package/src/llm-providers/agent/Agent.ts +1 -1
- package/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.ts +13 -1
- package/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.ts +13 -1
- package/src/llm-providers/openai/OpenAiAgentKitExecutionTools.ts +6 -2
- package/src/llm-providers/openai/OpenAiAgentKitExecutionToolsToolBuilder.ts +9 -7
- package/src/llm-providers/openai/OpenAiAssistantExecutionTools.ts +1 -1
- package/src/llm-providers/openai/OpenAiAssistantExecutionToolsStreamRunner.ts +1 -1
- package/src/llm-providers/openai/OpenAiAssistantExecutionToolsToolRunner.ts +1 -1
- package/src/llm-providers/openai/OpenAiCompatibleNonChatPromptCaller.ts +1 -1
- package/src/llm-providers/openai/OpenAiCompatibleRequestManager.ts +12 -1
- package/src/llm-providers/openai/utils/buildToolInvocationScript.ts +21 -18
- package/src/llm-providers/openai/utils/callOpenAiCompatibleChatModel.ts +1 -1
- package/src/llm-providers/openai/utils/loadOpenAiAgentsModule.ts +11 -0
- package/src/llm-providers/openai/utils/uploadFilesToOpenAi.ts +1 -1
- package/src/other/templates/getTemplatesPipelineCollection.ts +786 -1141
- package/src/remote-server/createRemoteClient.ts +12 -1
- package/src/{commitments/USE_BROWSER → scrapers/_common/utils}/fetchUrlContent.ts +8 -9
- package/src/scrapers/website/WebsiteScraper.ts +22 -2
- package/src/utils/agent-message-runtime/resolveAgentMessageRuntimeActivity.ts +157 -3
- 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/createLazyModuleLoader.ts +27 -0
- package/src/utils/misc/debounce.ts +26 -5
- package/src/version.ts +2 -2
- package/src/versions.txt +8 -1
- package/umd/apps/agents-server/src/utils/agentGoalChat/agentGoalChatConstants.d.ts +12 -0
- package/umd/index.umd.js +5718 -7025
- package/umd/index.umd.js.map +1 -1
- package/umd/scripts/run-agent-messages/messages/buildAgentGoalChatPromptSection.d.ts +8 -0
- package/umd/scripts/run-agent-messages/messages/buildAgentMessagePrompt.d.ts +12 -1
- package/umd/scripts/run-agent-messages/messages/buildAgentProjectsPromptSection.d.ts +2 -14
- 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/common/runGoScript/scriptExecutionLog.d.ts +7 -0
- package/umd/scripts/run-codex-prompts/git/coderCommitScope.d.ts +31 -0
- package/umd/scripts/run-codex-prompts/git/coderGitSync.d.ts +56 -0
- package/umd/scripts/run-codex-prompts/git/commitChanges.d.ts +12 -3
- package/umd/scripts/run-codex-prompts/git/workingTreeChanges.d.ts +40 -0
- package/umd/scripts/run-codex-prompts/main/resolvePromptRunner.d.ts +8 -1
- package/umd/scripts/run-codex-prompts/ping/buildCoderPingPrompt.d.ts +20 -0
- package/umd/scripts/run-codex-prompts/ping/extractCoderPingAnswer.d.ts +9 -0
- package/umd/scripts/run-codex-prompts/ping/pingCoderHarness.d.ts +23 -0
- package/umd/scripts/run-codex-prompts/ping/printCoderPingResult.d.ts +5 -0
- package/umd/scripts/run-codex-prompts/prompts/buildPromptStatusDetails.d.ts +43 -0
- package/umd/scripts/run-codex-prompts/prompts/findNextTodoPrompt.d.ts +2 -1
- package/umd/scripts/run-codex-prompts/prompts/formatCoderRunSteps.d.ts +6 -3
- package/umd/scripts/run-codex-prompts/prompts/isPromptCompatibleWithRunner.d.ts +27 -0
- package/umd/scripts/run-codex-prompts/prompts/isPromptSectionUnfinished.d.ts +8 -0
- package/umd/scripts/run-codex-prompts/prompts/listRunnablePrompts.d.ts +2 -1
- package/umd/scripts/run-codex-prompts/prompts/listUpcomingTasks.d.ts +2 -1
- 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/TestBeforeMode.d.ts +16 -0
- package/umd/scripts/run-codex-prompts/testing/createTestBeforeRepairPrompt.d.ts +9 -0
- package/umd/scripts/run-codex-prompts/testing/limitTestOutput.d.ts +4 -0
- package/umd/scripts/run-codex-prompts/testing/runPromptTestCommand.d.ts +1 -2
- package/umd/scripts/run-codex-prompts/testing/runPromptWithTestFeedback.d.ts +6 -0
- package/umd/scripts/run-codex-prompts/testing/runTestBefore.d.ts +24 -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/run-codex-prompts/ui/buildRunUiFrameShared.d.ts +1 -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 +8 -2
- package/umd/src/_packages/components.index.d.ts +4 -0
- package/umd/src/_packages/types.index.d.ts +4 -0
- package/umd/src/avatars/renderAvatarVisualTerminalText.d.ts +80 -0
- package/umd/src/avatars/types/AvatarVisualDefinition.d.ts +54 -0
- package/umd/src/book-2.0/agent-source/AgentBasicInformation.d.ts +3 -3
- package/umd/src/book-2.0/book-language-documentation/BookLanguageManualDictionary.d.ts +1 -15
- package/umd/src/book-2.0/book-language-documentation/getBookLanguageManualCommitmentGroups.d.ts +1 -1
- package/umd/src/book-2.0/book-language-documentation/renderCommitmentCatalogSection.d.ts +0 -4
- 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/$provideServerDomWindow.d.ts +11 -0
- package/umd/src/book-components/Chat/utils/renderMarkdown.d.ts +72 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/createAgentsServerRuntimeEnvironment.d.ts +7 -0
- package/umd/src/cli/cli-commands/coder/agentCodingFile.d.ts +2 -3
- package/umd/src/cli/cli-commands/coder/boilerplateCount.d.ts +52 -0
- package/umd/src/cli/cli-commands/coder/generate-boilerplates.d.ts +4 -3
- package/umd/src/cli/cli-commands/coder/ping.d.ts +10 -0
- package/umd/src/cli/cli-commands/coder/verify.d.ts +1 -1
- package/umd/src/cli/cli-commands/coder.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/coderGitSyncCliOptions.d.ts +34 -0
- 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/buildNpmPackageInstallCommand.d.ts +12 -0
- package/umd/src/cli/cli-commands/common/npm/extractNpmPackageVersionFromOutput.d.ts +12 -0
- package/umd/src/cli/cli-commands/common/npm/isNpmPackageVersionOutdated.d.ts +12 -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/$resolvePromptbookCliInstallations.d.ts +12 -0
- package/umd/src/cli/cli-commands/common/promptbook-cli/$updatePromptbookCliInstallation.d.ts +10 -0
- package/umd/src/cli/cli-commands/common/promptbook-cli/$updatePromptbookCliInstallation.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/promptbook-cli/PromptbookCliInstallation.d.ts +66 -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/formatPromptbookCliInstallationWarning.d.ts +7 -0
- package/umd/src/cli/common/loadPromptsModule.d.ts +16 -0
- package/umd/src/commitments/{COMPONENT/COMPONENT.d.ts → META_FULLNAME/META_FULLNAME.d.ts} +8 -5
- package/umd/src/commitments/META_ID/META_ID.d.ts +32 -0
- package/umd/src/commitments/index.d.ts +4 -12
- package/umd/src/llm-providers/agent/Agent.d.ts +1 -1
- package/umd/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +1 -1
- package/umd/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +1 -1
- package/umd/src/llm-providers/openai/OpenAiAgentKitExecutionTools.d.ts +1 -1
- package/umd/src/llm-providers/openai/OpenAiAgentKitExecutionToolsToolBuilder.d.ts +2 -2
- package/umd/src/llm-providers/openai/OpenAiAssistantExecutionToolsStreamRunner.d.ts +1 -1
- package/umd/src/llm-providers/openai/OpenAiAssistantExecutionToolsToolRunner.d.ts +1 -1
- package/umd/src/llm-providers/openai/OpenAiCompatibleNonChatPromptCaller.d.ts +1 -1
- package/umd/src/llm-providers/openai/OpenAiCompatibleRequestManager.d.ts +1 -1
- package/umd/src/llm-providers/openai/utils/callOpenAiCompatibleChatModel.d.ts +1 -1
- package/umd/src/llm-providers/openai/utils/loadOpenAiAgentsModule.d.ts +203 -0
- package/umd/src/llm-providers/openai/utils/uploadFilesToOpenAi.d.ts +1 -1
- package/umd/src/{commitments/USE_BROWSER → scrapers/_common/utils}/fetchUrlContent.d.ts +2 -3
- 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/createLazyModuleLoader.d.ts +14 -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/app/api/onboarding/draft/route.ts +0 -23
- package/apps/agents-server/src/components/AgentProjectDnsInstructions/AgentProjectDnsInstructions.tsx +0 -182
- package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/BookLanguagePanel.tsx +0 -125
- package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/MarkdownBookEditor.tsx +0 -154
- package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/MarkdownPreview.tsx +0 -188
- package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/services/draftService.ts +0 -32
- package/apps/agents-server/src/tools/configureTimeoutToolRuntimeAdapterForServer.ts +0 -381
- package/apps/agents-server/src/utils/emails/extractUseEmailConfigurationFromAgentSource.ts +0 -42
- 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/esm/src/commitments/MEMORY/MEMORY.d.ts +0 -48
- package/esm/src/commitments/MEMORY/MemoryToolNames.d.ts +0 -11
- package/esm/src/commitments/MEMORY/MemoryToolRuntimeAdapter.d.ts +0 -149
- package/esm/src/commitments/MEMORY/createMemorySystemMessage.d.ts +0 -6
- package/esm/src/commitments/MEMORY/createMemoryToolFunctions.d.ts +0 -8
- package/esm/src/commitments/MEMORY/createMemoryTools.d.ts +0 -14
- package/esm/src/commitments/MEMORY/getMemoryCommitmentDocumentation.d.ts +0 -6
- package/esm/src/commitments/MEMORY/getMemoryToolRuntimeAdapterOrDisabledResult.d.ts +0 -17
- package/esm/src/commitments/MEMORY/getMemoryToolTitles.d.ts +0 -7
- package/esm/src/commitments/MEMORY/parseMemoryToolArgs.d.ts +0 -61
- package/esm/src/commitments/MEMORY/resolveMemoryRuntimeContext.d.ts +0 -8
- package/esm/src/commitments/MEMORY/setMemoryToolRuntimeAdapter.d.ts +0 -13
- package/esm/src/commitments/META/META.d.ts +0 -65
- package/esm/src/commitments/USE/aggregateUseCommitmentSystemMessages.d.ts +0 -32
- package/esm/src/commitments/USE_BROWSER/USE_BROWSER.d.ts +0 -58
- package/esm/src/commitments/USE_BROWSER/fetchUrlContentViaBrowser.d.ts +0 -13
- package/esm/src/commitments/USE_BROWSER/resolveRunBrowserToolForNode.d.ts +0 -10
- package/esm/src/commitments/USE_DEEPSEARCH/USE_DEEPSEARCH.d.ts +0 -47
- package/esm/src/commitments/USE_EMAIL/USE_EMAIL.d.ts +0 -38
- package/esm/src/commitments/USE_EMAIL/parseUseEmailCommitmentContent.d.ts +0 -21
- package/esm/src/commitments/USE_EMAIL/resolveSendEmailToolForNode.d.ts +0 -11
- package/esm/src/commitments/USE_EMAIL/sendEmailViaBrowser.d.ts +0 -13
- package/esm/src/commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.d.ts +0 -46
- package/esm/src/commitments/USE_SPAWN/USE_SPAWN.d.ts +0 -38
- package/esm/src/commitments/USE_SPAWN/resolveSpawnAgentToolForNode.d.ts +0 -9
- package/esm/src/commitments/USE_SPAWN/spawnAgentViaBrowser.d.ts +0 -12
- package/esm/src/commitments/USE_TIME/USE_TIME.d.ts +0 -43
- package/esm/src/commitments/USE_TIMEOUT/TimeoutToolNames.d.ts +0 -11
- package/esm/src/commitments/USE_TIMEOUT/TimeoutToolRuntimeAdapter.d.ts +0 -212
- package/esm/src/commitments/USE_TIMEOUT/USE_TIMEOUT.d.ts +0 -38
- package/esm/src/commitments/USE_TIMEOUT/createTimeoutSystemMessage.d.ts +0 -6
- package/esm/src/commitments/USE_TIMEOUT/createTimeoutToolFunctions.d.ts +0 -8
- package/esm/src/commitments/USE_TIMEOUT/createTimeoutTools.d.ts +0 -7
- package/esm/src/commitments/USE_TIMEOUT/getTimeoutToolRuntimeAdapterOrDisabledResult.d.ts +0 -17
- package/esm/src/commitments/USE_TIMEOUT/parseTimeoutToolArgs.d.ts +0 -78
- package/esm/src/commitments/USE_TIMEOUT/resolveTimeoutRuntimeContext.d.ts +0 -8
- package/esm/src/commitments/USE_TIMEOUT/setTimeoutToolRuntimeAdapter.d.ts +0 -13
- package/esm/src/commitments/WALLET/WALLET.d.ts +0 -21
- package/esm/src/commitments/WALLET/WalletToolNames.d.ts +0 -12
- package/esm/src/commitments/WALLET/WalletToolRuntimeAdapter.d.ts +0 -163
- package/esm/src/commitments/WALLET/createWalletSystemMessage.d.ts +0 -6
- package/esm/src/commitments/WALLET/createWalletToolFunctions.d.ts +0 -8
- package/esm/src/commitments/WALLET/createWalletTools.d.ts +0 -7
- package/esm/src/commitments/WALLET/getWalletCommitmentDocumentation.d.ts +0 -6
- package/esm/src/commitments/WALLET/getWalletToolRuntimeAdapterOrDisabledResult.d.ts +0 -16
- package/esm/src/commitments/WALLET/getWalletToolTitles.d.ts +0 -7
- package/esm/src/commitments/WALLET/parseWalletToolArgs.d.ts +0 -51
- package/esm/src/commitments/WALLET/resolveWalletRuntimeContext.d.ts +0 -8
- package/esm/src/commitments/WALLET/setWalletToolRuntimeAdapter.d.ts +0 -13
- package/esm/src/commitments/_common/createSerpSearchToolFunction.d.ts +0 -12
- package/src/cli/cli-commands/common/harness/$resolveLatestHarnessVersion.ts +0 -34
- package/src/cli/cli-commands/common/harness/extractHarnessVersionFromOutput.ts +0 -28
- package/src/cli/cli-commands/common/harness/isHarnessVersionOutdated.ts +0 -39
- package/src/commitments/COMPONENT/COMPONENT.ts +0 -70
- package/src/commitments/MEMORY/MEMORY.ts +0 -94
- package/src/commitments/MEMORY/MemoryToolNames.ts +0 -13
- package/src/commitments/MEMORY/MemoryToolRuntimeAdapter.ts +0 -180
- package/src/commitments/MEMORY/createMemorySystemMessage.ts +0 -27
- package/src/commitments/MEMORY/createMemoryToolFunctions.ts +0 -134
- package/src/commitments/MEMORY/createMemoryTools.ts +0 -115
- package/src/commitments/MEMORY/getMemoryCommitmentDocumentation.ts +0 -47
- package/src/commitments/MEMORY/getMemoryToolRuntimeAdapterOrDisabledResult.ts +0 -104
- package/src/commitments/MEMORY/getMemoryToolTitles.ts +0 -16
- package/src/commitments/MEMORY/parseMemoryToolArgs.ts +0 -126
- package/src/commitments/MEMORY/resolveMemoryRuntimeContext.ts +0 -23
- package/src/commitments/MEMORY/setMemoryToolRuntimeAdapter.ts +0 -26
- package/src/commitments/META/META.ts +0 -168
- package/src/commitments/USE/TODO.txt +0 -1
- package/src/commitments/USE/aggregateUseCommitmentSystemMessages.ts +0 -219
- package/src/commitments/USE_BROWSER/TODO.txt +0 -1
- package/src/commitments/USE_BROWSER/USE_BROWSER.ts +0 -257
- package/src/commitments/USE_BROWSER/fetchUrlContentViaBrowser.ts +0 -45
- package/src/commitments/USE_BROWSER/resolveRunBrowserToolForNode.ts +0 -83
- package/src/commitments/USE_DEEPSEARCH/USE_DEEPSEARCH.ts +0 -146
- package/src/commitments/USE_EMAIL/USE_EMAIL.ts +0 -201
- package/src/commitments/USE_EMAIL/parseUseEmailCommitmentContent.ts +0 -75
- package/src/commitments/USE_EMAIL/resolveSendEmailToolForNode.ts +0 -44
- package/src/commitments/USE_EMAIL/sendEmailViaBrowser.ts +0 -47
- package/src/commitments/USE_SEARCH_ENGINE/TODO.txt +0 -1
- package/src/commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.ts +0 -171
- package/src/commitments/USE_SPAWN/USE_SPAWN.ts +0 -150
- package/src/commitments/USE_SPAWN/resolveSpawnAgentToolForNode.ts +0 -42
- package/src/commitments/USE_SPAWN/spawnAgentViaBrowser.ts +0 -50
- package/src/commitments/USE_TIME/USE_TIME.ts +0 -177
- package/src/commitments/USE_TIMEOUT/TimeoutToolNames.ts +0 -13
- package/src/commitments/USE_TIMEOUT/TimeoutToolRuntimeAdapter.ts +0 -255
- package/src/commitments/USE_TIMEOUT/USE_TIMEOUT.ts +0 -117
- package/src/commitments/USE_TIMEOUT/createTimeoutSystemMessage.ts +0 -22
- package/src/commitments/USE_TIMEOUT/createTimeoutToolFunctions.ts +0 -361
- package/src/commitments/USE_TIMEOUT/createTimeoutTools.ts +0 -127
- package/src/commitments/USE_TIMEOUT/getTimeoutToolRuntimeAdapterOrDisabledResult.ts +0 -67
- package/src/commitments/USE_TIMEOUT/parseTimeoutToolArgs.ts +0 -460
- package/src/commitments/USE_TIMEOUT/resolveTimeoutRuntimeContext.ts +0 -36
- package/src/commitments/USE_TIMEOUT/setTimeoutToolRuntimeAdapter.ts +0 -26
- package/src/commitments/WALLET/WALLET.ts +0 -71
- package/src/commitments/WALLET/WalletToolNames.ts +0 -14
- package/src/commitments/WALLET/WalletToolRuntimeAdapter.ts +0 -180
- package/src/commitments/WALLET/createWalletSystemMessage.ts +0 -22
- package/src/commitments/WALLET/createWalletToolFunctions.ts +0 -145
- package/src/commitments/WALLET/createWalletTools.ts +0 -129
- package/src/commitments/WALLET/getWalletCommitmentDocumentation.ts +0 -14
- package/src/commitments/WALLET/getWalletToolRuntimeAdapterOrDisabledResult.ts +0 -64
- package/src/commitments/WALLET/getWalletToolTitles.ts +0 -17
- package/src/commitments/WALLET/parseWalletToolArgs.ts +0 -231
- package/src/commitments/WALLET/resolveWalletRuntimeContext.ts +0 -23
- package/src/commitments/WALLET/setWalletToolRuntimeAdapter.ts +0 -26
- package/src/commitments/_common/createSerpSearchToolFunction.ts +0 -46
- 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/umd/src/commitments/MEMORY/MEMORY.d.ts +0 -48
- package/umd/src/commitments/MEMORY/MemoryToolNames.d.ts +0 -11
- package/umd/src/commitments/MEMORY/MemoryToolRuntimeAdapter.d.ts +0 -149
- package/umd/src/commitments/MEMORY/createMemorySystemMessage.d.ts +0 -6
- package/umd/src/commitments/MEMORY/createMemoryToolFunctions.d.ts +0 -8
- package/umd/src/commitments/MEMORY/createMemoryTools.d.ts +0 -14
- package/umd/src/commitments/MEMORY/getMemoryCommitmentDocumentation.d.ts +0 -6
- package/umd/src/commitments/MEMORY/getMemoryToolRuntimeAdapterOrDisabledResult.d.ts +0 -17
- package/umd/src/commitments/MEMORY/getMemoryToolTitles.d.ts +0 -7
- package/umd/src/commitments/MEMORY/parseMemoryToolArgs.d.ts +0 -61
- package/umd/src/commitments/MEMORY/resolveMemoryRuntimeContext.d.ts +0 -8
- package/umd/src/commitments/MEMORY/setMemoryToolRuntimeAdapter.d.ts +0 -13
- package/umd/src/commitments/META/META.d.ts +0 -65
- package/umd/src/commitments/USE/aggregateUseCommitmentSystemMessages.d.ts +0 -32
- package/umd/src/commitments/USE_BROWSER/USE_BROWSER.d.ts +0 -58
- package/umd/src/commitments/USE_BROWSER/fetchUrlContentViaBrowser.d.ts +0 -13
- package/umd/src/commitments/USE_BROWSER/resolveRunBrowserToolForNode.d.ts +0 -10
- package/umd/src/commitments/USE_DEEPSEARCH/USE_DEEPSEARCH.d.ts +0 -47
- package/umd/src/commitments/USE_EMAIL/USE_EMAIL.d.ts +0 -38
- package/umd/src/commitments/USE_EMAIL/parseUseEmailCommitmentContent.d.ts +0 -21
- package/umd/src/commitments/USE_EMAIL/resolveSendEmailToolForNode.d.ts +0 -11
- package/umd/src/commitments/USE_EMAIL/sendEmailViaBrowser.d.ts +0 -13
- package/umd/src/commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.d.ts +0 -46
- package/umd/src/commitments/USE_SPAWN/USE_SPAWN.d.ts +0 -38
- package/umd/src/commitments/USE_SPAWN/resolveSpawnAgentToolForNode.d.ts +0 -9
- package/umd/src/commitments/USE_SPAWN/spawnAgentViaBrowser.d.ts +0 -12
- package/umd/src/commitments/USE_TIME/USE_TIME.d.ts +0 -43
- package/umd/src/commitments/USE_TIMEOUT/TimeoutToolNames.d.ts +0 -11
- package/umd/src/commitments/USE_TIMEOUT/TimeoutToolRuntimeAdapter.d.ts +0 -212
- package/umd/src/commitments/USE_TIMEOUT/USE_TIMEOUT.d.ts +0 -38
- package/umd/src/commitments/USE_TIMEOUT/createTimeoutSystemMessage.d.ts +0 -6
- package/umd/src/commitments/USE_TIMEOUT/createTimeoutToolFunctions.d.ts +0 -8
- package/umd/src/commitments/USE_TIMEOUT/createTimeoutTools.d.ts +0 -7
- package/umd/src/commitments/USE_TIMEOUT/getTimeoutToolRuntimeAdapterOrDisabledResult.d.ts +0 -17
- package/umd/src/commitments/USE_TIMEOUT/parseTimeoutToolArgs.d.ts +0 -78
- package/umd/src/commitments/USE_TIMEOUT/resolveTimeoutRuntimeContext.d.ts +0 -8
- package/umd/src/commitments/USE_TIMEOUT/setTimeoutToolRuntimeAdapter.d.ts +0 -13
- package/umd/src/commitments/WALLET/WALLET.d.ts +0 -21
- package/umd/src/commitments/WALLET/WalletToolNames.d.ts +0 -12
- package/umd/src/commitments/WALLET/WalletToolRuntimeAdapter.d.ts +0 -163
- package/umd/src/commitments/WALLET/createWalletSystemMessage.d.ts +0 -6
- package/umd/src/commitments/WALLET/createWalletToolFunctions.d.ts +0 -8
- package/umd/src/commitments/WALLET/createWalletTools.d.ts +0 -7
- package/umd/src/commitments/WALLET/getWalletCommitmentDocumentation.d.ts +0 -6
- package/umd/src/commitments/WALLET/getWalletToolRuntimeAdapterOrDisabledResult.d.ts +0 -16
- package/umd/src/commitments/WALLET/getWalletToolTitles.d.ts +0 -7
- package/umd/src/commitments/WALLET/parseWalletToolArgs.d.ts +0 -51
- package/umd/src/commitments/WALLET/resolveWalletRuntimeContext.d.ts +0 -8
- package/umd/src/commitments/WALLET/setWalletToolRuntimeAdapter.d.ts +0 -13
- package/umd/src/commitments/_common/createSerpSearchToolFunction.d.ts +0 -12
- /package/esm/src/{book-2.0/agent-source/createAgentModelRequirements.useCommitmentAggregation.test.d.ts → avatars/renderAvatarVisualTerminalText.test.d.ts} +0 -0
- /package/esm/src/{cli/cli-commands/common/harness/extractHarnessVersionFromOutput.test.d.ts → book-2.0/agent-source/createAgentModelRequirements.commitmentAggregation.test.d.ts} +0 -0
- /package/esm/src/cli/cli-commands/{common/harness/isHarnessVersionOutdated.test.d.ts → coder/boilerplateCount.test.d.ts} +0 -0
- /package/esm/src/{commitments/MEMORY/MEMORY.test.d.ts → cli/cli-commands/coder/generate-boilerplates.test.d.ts} +0 -0
- /package/esm/src/{commitments/USE_BROWSER/USE_BROWSER.test.d.ts → cli/cli-commands/coder/ping.test.d.ts} +0 -0
- /package/esm/src/{commitments/USE_BROWSER/resolveRunBrowserToolForNode.test.d.ts → cli/cli-commands/common/coderGitSyncCliOptions.test.d.ts} +0 -0
- /package/esm/src/{commitments/USE_DEEPSEARCH/USE_DEEPSEARCH.test.d.ts → cli/cli-commands/common/npm/$resolveLatestNpmPackageVersion.test.d.ts} +0 -0
- /package/esm/src/{commitments/USE_EMAIL/USE_EMAIL.test.d.ts → cli/cli-commands/common/npm/buildNpmPackageInstallCommand.test.d.ts} +0 -0
- /package/esm/src/{commitments/USE_EMAIL/parseUseEmailCommitmentContent.test.d.ts → cli/cli-commands/common/npm/extractNpmPackageVersionFromOutput.test.d.ts} +0 -0
- /package/esm/src/{commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.test.d.ts → cli/cli-commands/common/npm/isNpmPackageVersionOutdated.test.d.ts} +0 -0
- /package/esm/src/{commitments/USE_SPAWN/USE_SPAWN.test.d.ts → cli/cli-commands/common/promptbook-cli/$checkPromptbookCliInstallations.test.d.ts} +0 -0
- /package/esm/src/{commitments/USE_TIME/USE_TIME.test.d.ts → cli/cli-commands/common/promptbook-cli/$ensurePromptbookCliInstallations.test.d.ts} +0 -0
- /package/esm/src/{commitments/USE_TIMEOUT/USE_TIMEOUT.test.d.ts → cli/cli-commands/common/promptbook-cli/$resolvePromptbookCliInstallations.test.d.ts} +0 -0
- /package/esm/src/{commitments/WALLET/WALLET.test.d.ts → cli/cli-commands/common/promptbook-cli/$updatePromptbookCliInstallation.test.d.ts} +0 -0
- /package/esm/src/commitments/{META → META_DESCRIPTION}/META_DESCRIPTION.d.ts +0 -0
- /package/{umd/src/book-2.0/agent-source/createAgentModelRequirements.useCommitmentAggregation.test.d.ts → esm/src/utils/misc/debounce.test.d.ts} +0 -0
- /package/umd/src/{cli/cli-commands/common/harness/extractHarnessVersionFromOutput.test.d.ts → avatars/renderAvatarVisualTerminalText.test.d.ts} +0 -0
- /package/umd/src/{cli/cli-commands/common/harness/isHarnessVersionOutdated.test.d.ts → book-2.0/agent-source/createAgentModelRequirements.commitmentAggregation.test.d.ts} +0 -0
- /package/umd/src/{commitments/MEMORY/MEMORY.test.d.ts → cli/cli-commands/coder/boilerplateCount.test.d.ts} +0 -0
- /package/umd/src/{commitments/USE_BROWSER/USE_BROWSER.test.d.ts → cli/cli-commands/coder/generate-boilerplates.test.d.ts} +0 -0
- /package/umd/src/{commitments/USE_BROWSER/resolveRunBrowserToolForNode.test.d.ts → cli/cli-commands/coder/ping.test.d.ts} +0 -0
- /package/umd/src/{commitments/USE_DEEPSEARCH/USE_DEEPSEARCH.test.d.ts → cli/cli-commands/common/coderGitSyncCliOptions.test.d.ts} +0 -0
- /package/umd/src/{commitments/USE_EMAIL/USE_EMAIL.test.d.ts → cli/cli-commands/common/npm/$resolveLatestNpmPackageVersion.test.d.ts} +0 -0
- /package/umd/src/{commitments/USE_EMAIL/parseUseEmailCommitmentContent.test.d.ts → cli/cli-commands/common/npm/buildNpmPackageInstallCommand.test.d.ts} +0 -0
- /package/umd/src/{commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.test.d.ts → cli/cli-commands/common/npm/extractNpmPackageVersionFromOutput.test.d.ts} +0 -0
- /package/umd/src/{commitments/USE_SPAWN/USE_SPAWN.test.d.ts → cli/cli-commands/common/npm/isNpmPackageVersionOutdated.test.d.ts} +0 -0
- /package/umd/src/{commitments/USE_TIME/USE_TIME.test.d.ts → cli/cli-commands/common/promptbook-cli/$checkPromptbookCliInstallations.test.d.ts} +0 -0
- /package/umd/src/{commitments/USE_TIMEOUT/USE_TIMEOUT.test.d.ts → cli/cli-commands/common/promptbook-cli/$ensurePromptbookCliInstallations.test.d.ts} +0 -0
- /package/umd/src/{commitments/WALLET/WALLET.test.d.ts → cli/cli-commands/common/promptbook-cli/$resolvePromptbookCliInstallations.test.d.ts} +0 -0
- /package/umd/src/commitments/{META → META_DESCRIPTION}/META_DESCRIPTION.d.ts +0 -0
|
@@ -9,6 +9,7 @@ import type { Converter as ShowdownConverter } from 'showdown';
|
|
|
9
9
|
import showdown from 'showdown';
|
|
10
10
|
import type { string_html, string_markdown } from '../../../types/string_markdown';
|
|
11
11
|
import { TODO_USE } from '../../../utils/organization/TODO_USE';
|
|
12
|
+
import { $provideServerDomWindow } from './$provideServerDomWindow';
|
|
12
13
|
import { createCitationMarkerRegex, parseCitationMarker } from './parseCitationMarker';
|
|
13
14
|
|
|
14
15
|
/**
|
|
@@ -42,6 +43,7 @@ const MARKDOWN_SANITIZER_ALLOWED_TAGS = [
|
|
|
42
43
|
'b',
|
|
43
44
|
'blockquote',
|
|
44
45
|
'br',
|
|
46
|
+
'button',
|
|
45
47
|
'code',
|
|
46
48
|
'del',
|
|
47
49
|
'details',
|
|
@@ -155,6 +157,29 @@ const MARKDOWN_SANITIZER_ALLOWED_PROTOCOLS = new Set(['http', 'https', 'mailto',
|
|
|
155
157
|
*/
|
|
156
158
|
const INLINE_REFERENCE_MENU_OPTION_MARKER_ATTRIBUTE = 'data-promptbook-inline-reference-menu-option';
|
|
157
159
|
|
|
160
|
+
/**
|
|
161
|
+
* Attribute marking a client action generated for an inline-reference menu.
|
|
162
|
+
*
|
|
163
|
+
* @private utility shared with `MarkdownContent`
|
|
164
|
+
*/
|
|
165
|
+
export const MARKDOWN_INLINE_REFERENCE_MENU_ACTION_ATTRIBUTE =
|
|
166
|
+
'data-promptbook-inline-reference-menu-action';
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Attribute identifying the inline reference which owns a client menu action.
|
|
170
|
+
*
|
|
171
|
+
* @private utility shared with `MarkdownContent`
|
|
172
|
+
*/
|
|
173
|
+
export const MARKDOWN_INLINE_REFERENCE_MENU_ACTION_REFERENCE_ATTRIBUTE =
|
|
174
|
+
'data-promptbook-inline-reference-menu-action-reference';
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Attribute marking a favicon rendered inside an inline-reference chip.
|
|
178
|
+
*
|
|
179
|
+
* @private utility shared with `MarkdownContent`
|
|
180
|
+
*/
|
|
181
|
+
export const MARKDOWN_INLINE_REFERENCE_ICON_ATTRIBUTE = 'data-promptbook-inline-reference-icon';
|
|
182
|
+
|
|
158
183
|
/**
|
|
159
184
|
* Internal `data-*` attributes that Promptbook injects into rendered markdown and must survive sanitization.
|
|
160
185
|
*
|
|
@@ -164,6 +189,9 @@ const MARKDOWN_SANITIZER_ALLOWED_DATA_ATTRIBUTES = new Set([
|
|
|
164
189
|
'data-citation-footnote',
|
|
165
190
|
'data-chat-progress-marker',
|
|
166
191
|
INLINE_REFERENCE_MENU_OPTION_MARKER_ATTRIBUTE,
|
|
192
|
+
MARKDOWN_INLINE_REFERENCE_MENU_ACTION_ATTRIBUTE,
|
|
193
|
+
MARKDOWN_INLINE_REFERENCE_MENU_ACTION_REFERENCE_ATTRIBUTE,
|
|
194
|
+
MARKDOWN_INLINE_REFERENCE_ICON_ATTRIBUTE,
|
|
167
195
|
]);
|
|
168
196
|
|
|
169
197
|
/**
|
|
@@ -218,13 +246,6 @@ let browserMarkdownSanitizer: DomPurifyInstance | null = null;
|
|
|
218
246
|
*/
|
|
219
247
|
let serverMarkdownSanitizer: DomPurifyInstance | null = null;
|
|
220
248
|
|
|
221
|
-
/**
|
|
222
|
-
* Shared JSDOM window backing the server-side DOMPurify instance.
|
|
223
|
-
*
|
|
224
|
-
* @private utility of `renderMarkdown`
|
|
225
|
-
*/
|
|
226
|
-
let serverMarkdownSanitizerWindow: DomPurifyWindowLike | null = null;
|
|
227
|
-
|
|
228
249
|
/**
|
|
229
250
|
* Pattern matching CODE FENCE.
|
|
230
251
|
*/
|
|
@@ -272,6 +293,65 @@ const DETAILS_PLACEHOLDER_WRAPPED_REGEX = new RegExp(`<p>\\s*(${DETAILS_PLACEHOL
|
|
|
272
293
|
*/
|
|
273
294
|
const INLINE_REFERENCE_REGEX = /\[\[([^\]\r\n]+?)\]\]/g;
|
|
274
295
|
|
|
296
|
+
/**
|
|
297
|
+
* Prefix for INLINE REFERENCE PLACEHOLDER.
|
|
298
|
+
*
|
|
299
|
+
* @private utility of `renderMarkdown`
|
|
300
|
+
*/
|
|
301
|
+
const INLINE_REFERENCE_PLACEHOLDER_PREFIX = '@@PROMPTBOOK_INLINE_REFERENCE_PLACEHOLDER__';
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Pattern matching INLINE REFERENCE PLACEHOLDER.
|
|
305
|
+
*
|
|
306
|
+
* @private utility of `renderMarkdown`
|
|
307
|
+
*/
|
|
308
|
+
const INLINE_REFERENCE_PLACEHOLDER_REGEX = new RegExp(`${INLINE_REFERENCE_PLACEHOLDER_PREFIX}(\\d+)__`, 'g');
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Prefix for markdown text-segment placeholders used while resolving plain-text inline-reference aliases.
|
|
312
|
+
*
|
|
313
|
+
* @private utility of `renderMarkdown`
|
|
314
|
+
*/
|
|
315
|
+
const MARKDOWN_REFERENCE_TEXT_MASK_PLACEHOLDER_PREFIX = '@@PROMPTBOOK_MARKDOWN_REFERENCE_TEXT_MASK_PLACEHOLDER__';
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* Pattern matching markdown text-segment placeholders.
|
|
319
|
+
*
|
|
320
|
+
* @private utility of `renderMarkdown`
|
|
321
|
+
*/
|
|
322
|
+
const MARKDOWN_REFERENCE_TEXT_MASK_PLACEHOLDER_REGEX = new RegExp(
|
|
323
|
+
`${MARKDOWN_REFERENCE_TEXT_MASK_PLACEHOLDER_PREFIX}(\\d+)__`,
|
|
324
|
+
'g',
|
|
325
|
+
);
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Pattern matching markdown links and images together with their raw target.
|
|
329
|
+
*
|
|
330
|
+
* @private utility of `renderMarkdown`
|
|
331
|
+
*/
|
|
332
|
+
const MARKDOWN_LINK_REGEX = /(!?)\[([^\]\r\n]*)\]\(\s*(<[^>\r\n]*>|[^()\s]+)(?:\s+(?:"[^"]*"|'[^']*'))?\s*\)/g;
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Pattern matching bare `http(s)` URLs written directly into markdown text.
|
|
336
|
+
*
|
|
337
|
+
* @private utility of `renderMarkdown`
|
|
338
|
+
*/
|
|
339
|
+
const BARE_URL_REGEX = /(^|\s)(https?:\/\/[^\s<>()[\]"']+)/g;
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Sentence punctuation which trails a bare URL instead of belonging to it.
|
|
343
|
+
*
|
|
344
|
+
* @private utility of `renderMarkdown`
|
|
345
|
+
*/
|
|
346
|
+
const BARE_URL_TRAILING_PUNCTUATION_REGEX = /[.,;:!?]+$/;
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* Pattern splitting one URL into its scheme, host and remaining part.
|
|
350
|
+
*
|
|
351
|
+
* @private utility of `renderMarkdown`
|
|
352
|
+
*/
|
|
353
|
+
const ABSOLUTE_URL_REGEX = /^[a-z][a-z0-9+.-]*:\/\/([^/?#]*)(.*)$/i;
|
|
354
|
+
|
|
275
355
|
/**
|
|
276
356
|
* Markdown patterns that are strong enough to identify content as markdown.
|
|
277
357
|
*/
|
|
@@ -329,6 +409,14 @@ export type MarkdownInlineReference = {
|
|
|
329
409
|
*/
|
|
330
410
|
readonly reference: string;
|
|
331
411
|
|
|
412
|
+
/**
|
|
413
|
+
* Optional text aliases which should render as this reference when an agent mentions them in markdown.
|
|
414
|
+
*
|
|
415
|
+
* They are also accepted inside a `[[reference]]` token. This lets application code use a stable
|
|
416
|
+
* technical reference while recognizing a human-facing name in older messages.
|
|
417
|
+
*/
|
|
418
|
+
readonly sourceTextAliases?: ReadonlyArray<string>;
|
|
419
|
+
|
|
332
420
|
/**
|
|
333
421
|
* Human-readable label rendered inside the link chip.
|
|
334
422
|
*/
|
|
@@ -339,17 +427,49 @@ export type MarkdownInlineReference = {
|
|
|
339
427
|
*/
|
|
340
428
|
readonly href: string;
|
|
341
429
|
|
|
430
|
+
/**
|
|
431
|
+
* Optional URL prefixes which also identify this reference in the authored markdown.
|
|
432
|
+
*
|
|
433
|
+
* A markdown link or a bare URL pointing to one of these prefixes is rendered as the same chip
|
|
434
|
+
* as the `[[reference]]` token. Both absolute URLs (for example `https://project.example.com`)
|
|
435
|
+
* and application paths (for example `/agents/agent/projects/website`) are supported; a path
|
|
436
|
+
* prefix matches on any host so that both relative and absolute links are recognized.
|
|
437
|
+
*/
|
|
438
|
+
readonly sourceHrefPrefixes?: ReadonlyArray<string>;
|
|
439
|
+
|
|
342
440
|
/**
|
|
343
441
|
* Optional hover title for the rendered reference.
|
|
344
442
|
*/
|
|
345
443
|
readonly title?: string;
|
|
346
444
|
|
|
445
|
+
/**
|
|
446
|
+
* Optional favicon and text fallback rendered before the reference label.
|
|
447
|
+
*/
|
|
448
|
+
readonly icon?: MarkdownInlineReferenceIcon;
|
|
449
|
+
|
|
347
450
|
/**
|
|
348
451
|
* Optional expandable menu shown when the reference chip is clicked.
|
|
349
452
|
*/
|
|
350
453
|
readonly menu?: MarkdownInlineReferenceMenu;
|
|
351
454
|
};
|
|
352
455
|
|
|
456
|
+
/**
|
|
457
|
+
* Visual identity rendered inside one markdown inline-reference chip.
|
|
458
|
+
*
|
|
459
|
+
* @public exported from `@promptbook/components`
|
|
460
|
+
*/
|
|
461
|
+
export type MarkdownInlineReferenceIcon = {
|
|
462
|
+
/**
|
|
463
|
+
* Optional image URL. The fallback remains visible when the image is unavailable.
|
|
464
|
+
*/
|
|
465
|
+
readonly src?: string | null;
|
|
466
|
+
|
|
467
|
+
/**
|
|
468
|
+
* Short text rendered when the image is missing or broken.
|
|
469
|
+
*/
|
|
470
|
+
readonly fallbackText: string;
|
|
471
|
+
};
|
|
472
|
+
|
|
353
473
|
/**
|
|
354
474
|
* Status displayed alongside an expandable markdown inline reference.
|
|
355
475
|
*
|
|
@@ -387,6 +507,28 @@ export type MarkdownInlineReferenceMenuOption = {
|
|
|
387
507
|
* Optional hover text for the option.
|
|
388
508
|
*/
|
|
389
509
|
readonly title?: string;
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
|
+
* Optional client action rendered as a button instead of a link.
|
|
513
|
+
*/
|
|
514
|
+
readonly action?: MarkdownInlineReferenceMenuAction;
|
|
515
|
+
};
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* Client-side action exposed by an expandable markdown inline-reference menu.
|
|
519
|
+
*
|
|
520
|
+
* @public exported from `@promptbook/components`
|
|
521
|
+
*/
|
|
522
|
+
export type MarkdownInlineReferenceMenuAction = {
|
|
523
|
+
/**
|
|
524
|
+
* Stable identifier unique within the owning reference menu.
|
|
525
|
+
*/
|
|
526
|
+
readonly id: string;
|
|
527
|
+
|
|
528
|
+
/**
|
|
529
|
+
* Callback invoked when the menu button is selected.
|
|
530
|
+
*/
|
|
531
|
+
readonly onSelect: () => void | Promise<void>;
|
|
390
532
|
};
|
|
391
533
|
|
|
392
534
|
/**
|
|
@@ -414,6 +556,14 @@ type MaskedCodeSegmentsResult = {
|
|
|
414
556
|
restore: (value: string_markdown) => string_markdown;
|
|
415
557
|
};
|
|
416
558
|
|
|
559
|
+
/**
|
|
560
|
+
* Result of temporarily masked markdown links, images and bare URLs.
|
|
561
|
+
*/
|
|
562
|
+
type MaskedMarkdownLinkAndUrlSegmentsResult = {
|
|
563
|
+
masked: string_markdown;
|
|
564
|
+
restore: (value: string_markdown) => string_markdown;
|
|
565
|
+
};
|
|
566
|
+
|
|
417
567
|
/**
|
|
418
568
|
* Result of masked details blocks.
|
|
419
569
|
*/
|
|
@@ -528,21 +678,6 @@ function createMarkdownSanitizer(sanitizerWindow: DomPurifyWindowLike): DomPurif
|
|
|
528
678
|
return markdownSanitizer;
|
|
529
679
|
}
|
|
530
680
|
|
|
531
|
-
/**
|
|
532
|
-
* Lazily creates the JSDOM window used by server-side markdown sanitization.
|
|
533
|
-
*
|
|
534
|
-
* @private utility of `renderMarkdown`
|
|
535
|
-
*/
|
|
536
|
-
function getServerMarkdownSanitizerWindow(): DomPurifyWindowLike {
|
|
537
|
-
if (!serverMarkdownSanitizerWindow) {
|
|
538
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
539
|
-
const { JSDOM } = require('jsdom') as typeof import('jsdom');
|
|
540
|
-
serverMarkdownSanitizerWindow = new JSDOM('').window as unknown as DomPurifyWindowLike;
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
return serverMarkdownSanitizerWindow;
|
|
544
|
-
}
|
|
545
|
-
|
|
546
681
|
/**
|
|
547
682
|
* Returns the shared DOMPurify instance appropriate for the current runtime.
|
|
548
683
|
*
|
|
@@ -555,7 +690,7 @@ function getMarkdownSanitizer(): DomPurifyInstance {
|
|
|
555
690
|
return browserMarkdownSanitizer;
|
|
556
691
|
}
|
|
557
692
|
|
|
558
|
-
serverMarkdownSanitizer ??= createMarkdownSanitizer(
|
|
693
|
+
serverMarkdownSanitizer ??= createMarkdownSanitizer($provideServerDomWindow());
|
|
559
694
|
|
|
560
695
|
return serverMarkdownSanitizer;
|
|
561
696
|
}
|
|
@@ -756,6 +891,44 @@ function maskMarkdownCodeSegments(markdown: string_markdown): MaskedCodeSegments
|
|
|
756
891
|
};
|
|
757
892
|
}
|
|
758
893
|
|
|
894
|
+
/**
|
|
895
|
+
* Masks markdown links, images and bare URLs while plain-text reference aliases are resolved.
|
|
896
|
+
*
|
|
897
|
+
* A matching display name inside an unrelated link label must keep that original link instead of
|
|
898
|
+
* producing a nested chip inside its anchor.
|
|
899
|
+
*
|
|
900
|
+
* @param markdown - Markdown without code segments.
|
|
901
|
+
* @returns Masked markdown and a restore helper.
|
|
902
|
+
*
|
|
903
|
+
* @private utility of `renderMarkdown`
|
|
904
|
+
*/
|
|
905
|
+
function maskMarkdownLinksAndBareUrls(markdown: string_markdown): MaskedMarkdownLinkAndUrlSegmentsResult {
|
|
906
|
+
const segments: string[] = [];
|
|
907
|
+
const addPlaceholder = (segment: string): string => {
|
|
908
|
+
const placeholder = `${MARKDOWN_REFERENCE_TEXT_MASK_PLACEHOLDER_PREFIX}${segments.length}__`;
|
|
909
|
+
segments.push(segment);
|
|
910
|
+
return placeholder;
|
|
911
|
+
};
|
|
912
|
+
|
|
913
|
+
MARKDOWN_LINK_REGEX.lastIndex = 0;
|
|
914
|
+
let masked = markdown.replace(MARKDOWN_LINK_REGEX, (match) => addPlaceholder(match)) as string_markdown;
|
|
915
|
+
|
|
916
|
+
BARE_URL_REGEX.lastIndex = 0;
|
|
917
|
+
masked = masked.replace(BARE_URL_REGEX, (_match, leadingWhitespace: string, rawUrl: string) => {
|
|
918
|
+
return `${leadingWhitespace}${addPlaceholder(rawUrl)}`;
|
|
919
|
+
}) as string_markdown;
|
|
920
|
+
|
|
921
|
+
return {
|
|
922
|
+
masked,
|
|
923
|
+
restore(value: string_markdown): string_markdown {
|
|
924
|
+
return value.replace(
|
|
925
|
+
MARKDOWN_REFERENCE_TEXT_MASK_PLACEHOLDER_REGEX,
|
|
926
|
+
(_match, index) => segments[Number(index)] ?? '',
|
|
927
|
+
);
|
|
928
|
+
},
|
|
929
|
+
};
|
|
930
|
+
}
|
|
931
|
+
|
|
759
932
|
/**
|
|
760
933
|
* Masks `<details>...</details>` blocks in the markdown source so that Showdown never
|
|
761
934
|
* processes their content.
|
|
@@ -860,6 +1033,18 @@ function normalizeMarkdownInlineReferenceKey(value: string): string {
|
|
|
860
1033
|
return value.trim().toLowerCase();
|
|
861
1034
|
}
|
|
862
1035
|
|
|
1036
|
+
/**
|
|
1037
|
+
* Lists all token keys which can identify one inline reference.
|
|
1038
|
+
*
|
|
1039
|
+
* @param reference - Inline reference with its stable key and optional display-name aliases.
|
|
1040
|
+
* @returns Keys recognized inside `[[...]]` tokens.
|
|
1041
|
+
*
|
|
1042
|
+
* @private utility of `renderMarkdown`
|
|
1043
|
+
*/
|
|
1044
|
+
function listMarkdownInlineReferenceKeys(reference: MarkdownInlineReference): ReadonlyArray<string> {
|
|
1045
|
+
return [reference.reference, ...(reference.sourceTextAliases || [])];
|
|
1046
|
+
}
|
|
1047
|
+
|
|
863
1048
|
/**
|
|
864
1049
|
* Builds a lookup of inline markdown references keyed by the authored `[[reference]]` text.
|
|
865
1050
|
*
|
|
@@ -874,17 +1059,326 @@ function createMarkdownInlineReferenceByKey(
|
|
|
874
1059
|
const referenceByKey = new Map<string, MarkdownInlineReference>();
|
|
875
1060
|
|
|
876
1061
|
for (const reference of references) {
|
|
877
|
-
const
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
1062
|
+
for (const referenceKey of listMarkdownInlineReferenceKeys(reference)) {
|
|
1063
|
+
const normalizedReference = normalizeMarkdownInlineReferenceKey(referenceKey);
|
|
1064
|
+
if (!normalizedReference || referenceByKey.has(normalizedReference)) {
|
|
1065
|
+
continue;
|
|
1066
|
+
}
|
|
881
1067
|
|
|
882
|
-
|
|
1068
|
+
referenceByKey.set(normalizedReference, reference);
|
|
1069
|
+
}
|
|
883
1070
|
}
|
|
884
1071
|
|
|
885
1072
|
return referenceByKey;
|
|
886
1073
|
}
|
|
887
1074
|
|
|
1075
|
+
/**
|
|
1076
|
+
* One display-name alias and the inline reference it renders.
|
|
1077
|
+
*
|
|
1078
|
+
* @private utility of `renderMarkdown`
|
|
1079
|
+
*/
|
|
1080
|
+
type MarkdownInlineReferenceTextMatcher = {
|
|
1081
|
+
/**
|
|
1082
|
+
* Reference rendered for the alias.
|
|
1083
|
+
*/
|
|
1084
|
+
readonly reference: MarkdownInlineReference;
|
|
1085
|
+
|
|
1086
|
+
/**
|
|
1087
|
+
* Human-readable source text recognized in markdown.
|
|
1088
|
+
*/
|
|
1089
|
+
readonly sourceTextAlias: string;
|
|
1090
|
+
};
|
|
1091
|
+
|
|
1092
|
+
/**
|
|
1093
|
+
* Escapes text before embedding it into a regular expression.
|
|
1094
|
+
*
|
|
1095
|
+
* @param value - Literal text to match.
|
|
1096
|
+
* @returns Regular-expression-safe text.
|
|
1097
|
+
*
|
|
1098
|
+
* @private utility of `renderMarkdown`
|
|
1099
|
+
*/
|
|
1100
|
+
function escapeRegularExpression(value: string): string {
|
|
1101
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
/**
|
|
1105
|
+
* Creates non-ambiguous display-name matchers for inline references.
|
|
1106
|
+
*
|
|
1107
|
+
* Longer aliases are matched first so a project named `Prague Map` wins over a project named `Map`.
|
|
1108
|
+
* An alias shared by more than one reference is deliberately ignored instead of linking to an arbitrary project.
|
|
1109
|
+
*
|
|
1110
|
+
* @param references - References available to this markdown render.
|
|
1111
|
+
* @returns Plain-text matchers ordered from longest to shortest alias.
|
|
1112
|
+
*
|
|
1113
|
+
* @private utility of `renderMarkdown`
|
|
1114
|
+
*/
|
|
1115
|
+
function createMarkdownInlineReferenceTextMatchers(
|
|
1116
|
+
references: ReadonlyArray<MarkdownInlineReference>,
|
|
1117
|
+
): ReadonlyArray<MarkdownInlineReferenceTextMatcher> {
|
|
1118
|
+
const matcherByNormalizedAlias = new Map<string, MarkdownInlineReferenceTextMatcher | null>();
|
|
1119
|
+
|
|
1120
|
+
for (const reference of references) {
|
|
1121
|
+
for (const sourceTextAliasCandidate of reference.sourceTextAliases || []) {
|
|
1122
|
+
const sourceTextAlias = sourceTextAliasCandidate.trim();
|
|
1123
|
+
const normalizedAlias = normalizeMarkdownInlineReferenceKey(sourceTextAlias);
|
|
1124
|
+
if (!normalizedAlias) {
|
|
1125
|
+
continue;
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
const existingMatcher = matcherByNormalizedAlias.get(normalizedAlias);
|
|
1129
|
+
if (existingMatcher === undefined) {
|
|
1130
|
+
matcherByNormalizedAlias.set(normalizedAlias, { reference, sourceTextAlias });
|
|
1131
|
+
} else if (existingMatcher !== null && existingMatcher.reference !== reference) {
|
|
1132
|
+
matcherByNormalizedAlias.set(normalizedAlias, null);
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
return Array.from(matcherByNormalizedAlias.values())
|
|
1138
|
+
.filter((matcher): matcher is MarkdownInlineReferenceTextMatcher => matcher !== null)
|
|
1139
|
+
.sort(
|
|
1140
|
+
(firstMatcher, secondMatcher) =>
|
|
1141
|
+
secondMatcher.sourceTextAlias.length - firstMatcher.sourceTextAlias.length ||
|
|
1142
|
+
firstMatcher.sourceTextAlias.localeCompare(secondMatcher.sourceTextAlias),
|
|
1143
|
+
);
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
/**
|
|
1147
|
+
* Creates a regular expression matching one plain-text alias with optional bold markdown around it.
|
|
1148
|
+
*
|
|
1149
|
+
* @param sourceTextAlias - Literal display name to match.
|
|
1150
|
+
* @param isMarkdownFormattingMatched - Whether matching `**alias**` and `__alias__` form.
|
|
1151
|
+
* @returns Unicode-aware whole-text regular expression.
|
|
1152
|
+
*
|
|
1153
|
+
* @private utility of `renderMarkdown`
|
|
1154
|
+
*/
|
|
1155
|
+
function createMarkdownInlineReferenceTextAliasRegex(
|
|
1156
|
+
sourceTextAlias: string,
|
|
1157
|
+
isMarkdownFormattingMatched: boolean,
|
|
1158
|
+
): RegExp {
|
|
1159
|
+
const escapedAlias = escapeRegularExpression(sourceTextAlias);
|
|
1160
|
+
const boundaryCharacterClass = '\\p{L}\\p{N}_-';
|
|
1161
|
+
const boundaryPattern = `[^${boundaryCharacterClass}]`;
|
|
1162
|
+
const aliasPattern = isMarkdownFormattingMatched
|
|
1163
|
+
? `(?:\\*\\*|__)${escapedAlias}(?:\\*\\*|__)`
|
|
1164
|
+
: escapedAlias;
|
|
1165
|
+
|
|
1166
|
+
return new RegExp(`(^|${boundaryPattern})${aliasPattern}(?=$|${boundaryPattern})`, 'giu');
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
/**
|
|
1170
|
+
* Replaces known project display names in agent markdown with inline-reference placeholders.
|
|
1171
|
+
*
|
|
1172
|
+
* Bold aliases are replaced first so an older message such as `**Prague Murders Map**` becomes one
|
|
1173
|
+
* chip rather than a chip nested inside formatting markup.
|
|
1174
|
+
*
|
|
1175
|
+
* @param markdown - Markdown with code and links already masked.
|
|
1176
|
+
* @param matchers - Non-ambiguous display-name aliases available to this render.
|
|
1177
|
+
* @param createPlaceholder - Renders a matched reference into a placeholder.
|
|
1178
|
+
* @returns Markdown containing inline-reference placeholders.
|
|
1179
|
+
*
|
|
1180
|
+
* @private utility of `renderMarkdown`
|
|
1181
|
+
*/
|
|
1182
|
+
function replaceMarkdownInlineReferenceTextAliases(
|
|
1183
|
+
markdown: string_markdown,
|
|
1184
|
+
matchers: ReadonlyArray<MarkdownInlineReferenceTextMatcher>,
|
|
1185
|
+
createPlaceholder: CreateMarkdownInlineReferencePlaceholder,
|
|
1186
|
+
): string_markdown {
|
|
1187
|
+
let referencedMarkdown = markdown;
|
|
1188
|
+
|
|
1189
|
+
for (const matcher of matchers) {
|
|
1190
|
+
for (const isMarkdownFormattingMatched of [true, false]) {
|
|
1191
|
+
const aliasRegex = createMarkdownInlineReferenceTextAliasRegex(
|
|
1192
|
+
matcher.sourceTextAlias,
|
|
1193
|
+
isMarkdownFormattingMatched,
|
|
1194
|
+
);
|
|
1195
|
+
referencedMarkdown = referencedMarkdown.replace(aliasRegex, (_match, leadingBoundary: string) => {
|
|
1196
|
+
return `${leadingBoundary || ''}${createPlaceholder(matcher.reference)}`;
|
|
1197
|
+
}) as string_markdown;
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
return referencedMarkdown;
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
/**
|
|
1205
|
+
* Comparable parts of one URL used to recognize inline references written as links or bare URLs.
|
|
1206
|
+
*
|
|
1207
|
+
* @private utility of `renderMarkdown`
|
|
1208
|
+
*/
|
|
1209
|
+
type ComparableUrlParts = {
|
|
1210
|
+
/**
|
|
1211
|
+
* Lowercase host of an absolute URL, or an empty string for a host-independent application path.
|
|
1212
|
+
*/
|
|
1213
|
+
readonly host: string;
|
|
1214
|
+
|
|
1215
|
+
/**
|
|
1216
|
+
* Lowercase decoded path without query, hash and trailing slashes.
|
|
1217
|
+
*/
|
|
1218
|
+
readonly path: string;
|
|
1219
|
+
};
|
|
1220
|
+
|
|
1221
|
+
/**
|
|
1222
|
+
* One inline reference together with its comparable source URL prefixes.
|
|
1223
|
+
*
|
|
1224
|
+
* @private utility of `renderMarkdown`
|
|
1225
|
+
*/
|
|
1226
|
+
type MarkdownInlineReferenceHrefMatcher = {
|
|
1227
|
+
/**
|
|
1228
|
+
* Reference rendered when one of its source prefixes matches.
|
|
1229
|
+
*/
|
|
1230
|
+
readonly reference: MarkdownInlineReference;
|
|
1231
|
+
|
|
1232
|
+
/**
|
|
1233
|
+
* Comparable form of the reference source URL prefixes.
|
|
1234
|
+
*/
|
|
1235
|
+
readonly sourceHrefPrefixes: ReadonlyArray<ComparableUrlParts>;
|
|
1236
|
+
};
|
|
1237
|
+
|
|
1238
|
+
/**
|
|
1239
|
+
* Renders one matched reference and returns the placeholder standing for it.
|
|
1240
|
+
*
|
|
1241
|
+
* @private utility of `renderMarkdown`
|
|
1242
|
+
*/
|
|
1243
|
+
type CreateMarkdownInlineReferencePlaceholder = (reference: MarkdownInlineReference) => string;
|
|
1244
|
+
|
|
1245
|
+
/**
|
|
1246
|
+
* Decodes percent-encoded characters without failing on malformed input.
|
|
1247
|
+
*
|
|
1248
|
+
* @param value - Raw URL part.
|
|
1249
|
+
* @returns Decoded value, or the original value when it cannot be decoded.
|
|
1250
|
+
*
|
|
1251
|
+
* @private utility of `renderMarkdown`
|
|
1252
|
+
*/
|
|
1253
|
+
function decodeUrlPartSafely(value: string): string {
|
|
1254
|
+
try {
|
|
1255
|
+
return decodeURIComponent(value);
|
|
1256
|
+
} catch {
|
|
1257
|
+
return value;
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
/**
|
|
1262
|
+
* Normalizes one URL path so that encoding, casing and trailing slashes do not break matching.
|
|
1263
|
+
*
|
|
1264
|
+
* @param path - Raw path including an optional query and hash.
|
|
1265
|
+
* @returns Comparable path.
|
|
1266
|
+
*
|
|
1267
|
+
* @private utility of `renderMarkdown`
|
|
1268
|
+
*/
|
|
1269
|
+
function normalizeUrlPathForComparison(path: string): string {
|
|
1270
|
+
const pathWithoutQuery = path.split(/[?#]/, 1)[0] || '';
|
|
1271
|
+
|
|
1272
|
+
return decodeUrlPartSafely(pathWithoutQuery).toLowerCase().replace(/\/+$/, '');
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
/**
|
|
1276
|
+
* Splits one absolute URL or application path into its comparable parts.
|
|
1277
|
+
*
|
|
1278
|
+
* @param url - Raw link target written in markdown.
|
|
1279
|
+
* @returns Comparable URL parts, or `null` when the value cannot address a reference.
|
|
1280
|
+
*
|
|
1281
|
+
* @private utility of `renderMarkdown`
|
|
1282
|
+
*/
|
|
1283
|
+
function createComparableUrlParts(url: string): ComparableUrlParts | null {
|
|
1284
|
+
const trimmedUrl = url
|
|
1285
|
+
.trim()
|
|
1286
|
+
.replace(/^<([\s\S]*)>$/, '$1')
|
|
1287
|
+
.trim();
|
|
1288
|
+
|
|
1289
|
+
if (trimmedUrl === '') {
|
|
1290
|
+
return null;
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1293
|
+
const absoluteUrlMatch = trimmedUrl.match(ABSOLUTE_URL_REGEX);
|
|
1294
|
+
if (absoluteUrlMatch) {
|
|
1295
|
+
return {
|
|
1296
|
+
host: absoluteUrlMatch[1]!.toLowerCase(),
|
|
1297
|
+
path: normalizeUrlPathForComparison(absoluteUrlMatch[2] || ''),
|
|
1298
|
+
};
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
if (!trimmedUrl.startsWith('/')) {
|
|
1302
|
+
return null;
|
|
1303
|
+
}
|
|
1304
|
+
|
|
1305
|
+
return {
|
|
1306
|
+
host: '',
|
|
1307
|
+
path: normalizeUrlPathForComparison(trimmedUrl),
|
|
1308
|
+
};
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1311
|
+
/**
|
|
1312
|
+
* Returns whether one URL points into one reference source prefix.
|
|
1313
|
+
*
|
|
1314
|
+
* @param url - Comparable parts of the link target written in markdown.
|
|
1315
|
+
* @param prefix - Comparable parts of one reference source prefix.
|
|
1316
|
+
* @returns `true` when the URL belongs to the reference.
|
|
1317
|
+
*
|
|
1318
|
+
* @private utility of `renderMarkdown`
|
|
1319
|
+
*/
|
|
1320
|
+
function isUrlWithinReferencePrefix(url: ComparableUrlParts, prefix: ComparableUrlParts): boolean {
|
|
1321
|
+
if (prefix.host !== '' && prefix.host !== url.host) {
|
|
1322
|
+
return false;
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
if (prefix.path === '') {
|
|
1326
|
+
// Note: A prefix without a path covers the whole host, a prefix without both would cover everything
|
|
1327
|
+
return prefix.host !== '';
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
return url.path === prefix.path || url.path.startsWith(`${prefix.path}/`);
|
|
1331
|
+
}
|
|
1332
|
+
|
|
1333
|
+
/**
|
|
1334
|
+
* Builds matchers for references which can also be written as a markdown link or a bare URL.
|
|
1335
|
+
*
|
|
1336
|
+
* @param references - References available to this markdown render.
|
|
1337
|
+
* @returns Matchers of references declaring at least one usable source prefix.
|
|
1338
|
+
*
|
|
1339
|
+
* @private utility of `renderMarkdown`
|
|
1340
|
+
*/
|
|
1341
|
+
function createMarkdownInlineReferenceHrefMatchers(
|
|
1342
|
+
references: ReadonlyArray<MarkdownInlineReference>,
|
|
1343
|
+
): ReadonlyArray<MarkdownInlineReferenceHrefMatcher> {
|
|
1344
|
+
return references
|
|
1345
|
+
.map((reference) => ({
|
|
1346
|
+
reference,
|
|
1347
|
+
sourceHrefPrefixes: (reference.sourceHrefPrefixes || [])
|
|
1348
|
+
.map((sourceHrefPrefix) => createComparableUrlParts(sourceHrefPrefix))
|
|
1349
|
+
.filter((sourceHrefPrefix): sourceHrefPrefix is ComparableUrlParts => sourceHrefPrefix !== null),
|
|
1350
|
+
}))
|
|
1351
|
+
.filter((matcher) => matcher.sourceHrefPrefixes.length !== 0);
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
/**
|
|
1355
|
+
* Finds the reference which owns one link target.
|
|
1356
|
+
*
|
|
1357
|
+
* @param href - Raw link target written in markdown.
|
|
1358
|
+
* @param matchers - Reference matchers of this markdown render.
|
|
1359
|
+
* @returns Matching reference or `null`.
|
|
1360
|
+
*
|
|
1361
|
+
* @private utility of `renderMarkdown`
|
|
1362
|
+
*/
|
|
1363
|
+
function findMarkdownInlineReferenceForHref(
|
|
1364
|
+
href: string,
|
|
1365
|
+
matchers: ReadonlyArray<MarkdownInlineReferenceHrefMatcher>,
|
|
1366
|
+
): MarkdownInlineReference | null {
|
|
1367
|
+
const urlParts = createComparableUrlParts(href);
|
|
1368
|
+
|
|
1369
|
+
if (urlParts === null) {
|
|
1370
|
+
return null;
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
const matcher = matchers.find((candidateMatcher) =>
|
|
1374
|
+
candidateMatcher.sourceHrefPrefixes.some((sourceHrefPrefix) =>
|
|
1375
|
+
isUrlWithinReferencePrefix(urlParts, sourceHrefPrefix),
|
|
1376
|
+
),
|
|
1377
|
+
);
|
|
1378
|
+
|
|
1379
|
+
return matcher?.reference || null;
|
|
1380
|
+
}
|
|
1381
|
+
|
|
888
1382
|
/**
|
|
889
1383
|
* Renders one inline reference as raw HTML that is sanitized by the shared markdown sanitizer.
|
|
890
1384
|
*
|
|
@@ -899,12 +1393,50 @@ function renderMarkdownInlineReferenceHtml(reference: MarkdownInlineReference, c
|
|
|
899
1393
|
return renderMarkdownInlineReferenceMenuHtml(reference, className);
|
|
900
1394
|
}
|
|
901
1395
|
|
|
902
|
-
const escapedClassName = escapeHtml(className);
|
|
1396
|
+
const escapedClassName = escapeHtml(createMarkdownInlineReferenceClassName(reference, className));
|
|
903
1397
|
const escapedHref = escapeHtml(reference.href);
|
|
904
1398
|
const escapedLabel = escapeHtml(reference.label);
|
|
905
1399
|
const escapedTitle = escapeHtml(reference.title || reference.label);
|
|
1400
|
+
const iconHtml = renderMarkdownInlineReferenceIconHtml(reference.icon);
|
|
1401
|
+
|
|
1402
|
+
return `<a class="${escapedClassName}" href="${escapedHref}" title="${escapedTitle}">${iconHtml}<span>${escapedLabel}</span></a>`;
|
|
1403
|
+
}
|
|
1404
|
+
|
|
1405
|
+
/**
|
|
1406
|
+
* Adds the icon marker class only to references which provide icon metadata.
|
|
1407
|
+
*
|
|
1408
|
+
* @param reference - Inline reference being rendered.
|
|
1409
|
+
* @param className - Base chip class name.
|
|
1410
|
+
* @returns Complete class name for the rendered chip.
|
|
1411
|
+
*
|
|
1412
|
+
* @private utility of `renderMarkdown`
|
|
1413
|
+
*/
|
|
1414
|
+
function createMarkdownInlineReferenceClassName(reference: MarkdownInlineReference, className: string): string {
|
|
1415
|
+
return reference.icon ? `${className} inlineReferenceChip--with-icon` : className;
|
|
1416
|
+
}
|
|
1417
|
+
|
|
1418
|
+
/**
|
|
1419
|
+
* Renders one inline-reference favicon with a text fallback.
|
|
1420
|
+
*
|
|
1421
|
+
* @param icon - Optional icon metadata.
|
|
1422
|
+
* @returns Safe icon markup, or an empty string when no icon is configured.
|
|
1423
|
+
*
|
|
1424
|
+
* @private utility of `renderMarkdown`
|
|
1425
|
+
*/
|
|
1426
|
+
function renderMarkdownInlineReferenceIconHtml(icon: MarkdownInlineReferenceIcon | undefined): string {
|
|
1427
|
+
if (!icon) {
|
|
1428
|
+
return '';
|
|
1429
|
+
}
|
|
906
1430
|
|
|
907
|
-
|
|
1431
|
+
const escapedFallbackText = escapeHtml(icon.fallbackText);
|
|
1432
|
+
const fallbackHtml = `<span class="inlineReferenceIconFallback">${escapedFallbackText}</span>`;
|
|
1433
|
+
|
|
1434
|
+
if (!icon.src) {
|
|
1435
|
+
return `<span class="inlineReferenceIcon" aria-hidden="true">${fallbackHtml}</span>`;
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1438
|
+
const escapedSrc = escapeHtml(icon.src);
|
|
1439
|
+
return `<span class="inlineReferenceIcon" aria-hidden="true">${fallbackHtml}<img ${MARKDOWN_INLINE_REFERENCE_ICON_ATTRIBUTE} src="${escapedSrc}" alt=""></span>`;
|
|
908
1440
|
}
|
|
909
1441
|
|
|
910
1442
|
/**
|
|
@@ -923,30 +1455,44 @@ function renderMarkdownInlineReferenceMenuHtml(reference: MarkdownInlineReferenc
|
|
|
923
1455
|
return renderMarkdownInlineReferenceHtml({ ...reference, menu: undefined }, className);
|
|
924
1456
|
}
|
|
925
1457
|
|
|
926
|
-
const escapedClassName = escapeHtml(className);
|
|
1458
|
+
const escapedClassName = escapeHtml(createMarkdownInlineReferenceClassName(reference, className));
|
|
927
1459
|
const escapedLabel = escapeHtml(reference.label);
|
|
928
1460
|
const escapedTitle = escapeHtml(reference.title || reference.label);
|
|
929
1461
|
const escapedStatusLabel = escapeHtml(menu.status.label);
|
|
930
1462
|
const statusClassName = menu.status.isActive
|
|
931
1463
|
? 'inlineReferenceMenuStatus inlineReferenceMenuStatus--active'
|
|
932
|
-
: 'inlineReferenceMenuStatus';
|
|
933
|
-
const
|
|
1464
|
+
: 'inlineReferenceMenuStatus inlineReferenceMenuStatus--inactive';
|
|
1465
|
+
const iconHtml = renderMarkdownInlineReferenceIconHtml(reference.icon);
|
|
1466
|
+
const optionsHtml = menu.options
|
|
1467
|
+
.map((option) => renderMarkdownInlineReferenceMenuOptionHtml(reference, option))
|
|
1468
|
+
.join('');
|
|
934
1469
|
|
|
935
|
-
return `<details class="${escapedClassName}" title="${escapedTitle}"><summary
|
|
1470
|
+
return `<details class="${escapedClassName}" title="${escapedTitle}"><summary>${iconHtml}<span>${escapedLabel}</span><span class="${statusClassName}" title="${escapedStatusLabel}"></span></summary><div><span class="${statusClassName}">${escapedStatusLabel}</span>${optionsHtml}</div></details>`;
|
|
936
1471
|
}
|
|
937
1472
|
|
|
938
1473
|
/**
|
|
939
1474
|
* Renders one option in an expandable markdown inline reference menu.
|
|
940
1475
|
*
|
|
1476
|
+
* @param reference - Inline reference which owns the option.
|
|
941
1477
|
* @param option - Menu option definition.
|
|
942
1478
|
* @returns HTML anchor or disabled label markup.
|
|
943
1479
|
*
|
|
944
1480
|
* @private utility of `renderMarkdown`
|
|
945
1481
|
*/
|
|
946
|
-
function renderMarkdownInlineReferenceMenuOptionHtml(
|
|
1482
|
+
function renderMarkdownInlineReferenceMenuOptionHtml(
|
|
1483
|
+
reference: MarkdownInlineReference,
|
|
1484
|
+
option: MarkdownInlineReferenceMenuOption,
|
|
1485
|
+
): string {
|
|
947
1486
|
const escapedLabel = escapeHtml(option.label);
|
|
948
1487
|
const escapedTitle = escapeHtml(option.title || option.label);
|
|
949
1488
|
|
|
1489
|
+
if (option.action) {
|
|
1490
|
+
const escapedActionId = escapeHtml(option.action.id);
|
|
1491
|
+
const escapedReference = escapeHtml(reference.reference);
|
|
1492
|
+
|
|
1493
|
+
return `<button type="button" ${MARKDOWN_INLINE_REFERENCE_MENU_ACTION_ATTRIBUTE}="${escapedActionId}" ${MARKDOWN_INLINE_REFERENCE_MENU_ACTION_REFERENCE_ATTRIBUTE}="${escapedReference}" class="inlineReferenceMenuOption" title="${escapedTitle}">${escapedLabel}</button>`;
|
|
1494
|
+
}
|
|
1495
|
+
|
|
950
1496
|
if (option.href === null) {
|
|
951
1497
|
return `<span class="inlineReferenceMenuOption inlineReferenceMenuOption--disabled" title="${escapedTitle}">${escapedLabel}</span>`;
|
|
952
1498
|
}
|
|
@@ -956,11 +1502,113 @@ function renderMarkdownInlineReferenceMenuOptionHtml(option: MarkdownInlineRefer
|
|
|
956
1502
|
}
|
|
957
1503
|
|
|
958
1504
|
/**
|
|
959
|
-
* Replaces known `[[reference]]` tokens with
|
|
1505
|
+
* Replaces known `[[reference]]` tokens with chip placeholders while leaving unknown tokens unchanged.
|
|
1506
|
+
*
|
|
1507
|
+
* @param markdown - Markdown content after code masking.
|
|
1508
|
+
* @param references - References available to this markdown render.
|
|
1509
|
+
* @param createPlaceholder - Renders one matched reference into a placeholder.
|
|
1510
|
+
* @returns Markdown with known reference tokens replaced by placeholders.
|
|
1511
|
+
*
|
|
1512
|
+
* @private utility of `renderMarkdown`
|
|
1513
|
+
*/
|
|
1514
|
+
function replaceMarkdownInlineReferenceTokens(
|
|
1515
|
+
markdown: string_markdown,
|
|
1516
|
+
references: ReadonlyArray<MarkdownInlineReference>,
|
|
1517
|
+
createPlaceholder: CreateMarkdownInlineReferencePlaceholder,
|
|
1518
|
+
): string_markdown {
|
|
1519
|
+
const referenceByKey = createMarkdownInlineReferenceByKey(references);
|
|
1520
|
+
|
|
1521
|
+
if (referenceByKey.size === 0) {
|
|
1522
|
+
return markdown;
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1525
|
+
return markdown.replace(INLINE_REFERENCE_REGEX, (match, rawReference: string) => {
|
|
1526
|
+
const reference = referenceByKey.get(normalizeMarkdownInlineReferenceKey(rawReference));
|
|
1527
|
+
|
|
1528
|
+
return reference ? createPlaceholder(reference) : match;
|
|
1529
|
+
}) as string_markdown;
|
|
1530
|
+
}
|
|
1531
|
+
|
|
1532
|
+
/**
|
|
1533
|
+
* Replaces markdown links pointing to a known reference with chip placeholders.
|
|
1534
|
+
*
|
|
1535
|
+
* Images keep their original markdown so that pictures served by a reference stay visible.
|
|
1536
|
+
*
|
|
1537
|
+
* @param markdown - Markdown content after code masking.
|
|
1538
|
+
* @param matchers - Reference matchers of this markdown render.
|
|
1539
|
+
* @param createPlaceholder - Renders one matched reference into a placeholder.
|
|
1540
|
+
* @returns Markdown with known reference links replaced by placeholders.
|
|
1541
|
+
*
|
|
1542
|
+
* @private utility of `renderMarkdown`
|
|
1543
|
+
*/
|
|
1544
|
+
function replaceMarkdownInlineReferenceLinks(
|
|
1545
|
+
markdown: string_markdown,
|
|
1546
|
+
matchers: ReadonlyArray<MarkdownInlineReferenceHrefMatcher>,
|
|
1547
|
+
createPlaceholder: CreateMarkdownInlineReferencePlaceholder,
|
|
1548
|
+
): string_markdown {
|
|
1549
|
+
return markdown.replace(MARKDOWN_LINK_REGEX, (match, imageMarker: string, _label: string, rawHref: string) => {
|
|
1550
|
+
if (imageMarker !== '') {
|
|
1551
|
+
return match;
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1554
|
+
const reference = findMarkdownInlineReferenceForHref(rawHref, matchers);
|
|
1555
|
+
|
|
1556
|
+
return reference ? createPlaceholder(reference) : match;
|
|
1557
|
+
}) as string_markdown;
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1560
|
+
/**
|
|
1561
|
+
* Replaces bare URLs of known references with chip placeholders.
|
|
1562
|
+
*
|
|
1563
|
+
* @param markdown - Markdown content after reference links were replaced.
|
|
1564
|
+
* @param matchers - Reference matchers of this markdown render.
|
|
1565
|
+
* @param createPlaceholder - Renders one matched reference into a placeholder.
|
|
1566
|
+
* @returns Markdown with known reference URLs replaced by placeholders.
|
|
1567
|
+
*
|
|
1568
|
+
* @private utility of `renderMarkdown`
|
|
1569
|
+
*/
|
|
1570
|
+
function replaceMarkdownInlineReferenceBareUrls(
|
|
1571
|
+
markdown: string_markdown,
|
|
1572
|
+
matchers: ReadonlyArray<MarkdownInlineReferenceHrefMatcher>,
|
|
1573
|
+
createPlaceholder: CreateMarkdownInlineReferencePlaceholder,
|
|
1574
|
+
): string_markdown {
|
|
1575
|
+
return markdown.replace(BARE_URL_REGEX, (match, leadingWhitespace: string, rawUrl: string) => {
|
|
1576
|
+
const trailingPunctuation = rawUrl.match(BARE_URL_TRAILING_PUNCTUATION_REGEX)?.[0] || '';
|
|
1577
|
+
const url = rawUrl.slice(0, rawUrl.length - trailingPunctuation.length);
|
|
1578
|
+
const reference = findMarkdownInlineReferenceForHref(url, matchers);
|
|
1579
|
+
|
|
1580
|
+
return reference ? `${leadingWhitespace}${createPlaceholder(reference)}${trailingPunctuation}` : match;
|
|
1581
|
+
}) as string_markdown;
|
|
1582
|
+
}
|
|
1583
|
+
|
|
1584
|
+
/**
|
|
1585
|
+
* Restores chips which replaced references during the reference passes.
|
|
1586
|
+
*
|
|
1587
|
+
* @param markdown - Markdown containing reference placeholders.
|
|
1588
|
+
* @param renderedChips - Chip HTML indexed by placeholder number.
|
|
1589
|
+
* @returns Markdown with inline references rendered as HTML chips.
|
|
1590
|
+
*
|
|
1591
|
+
* @private utility of `renderMarkdown`
|
|
1592
|
+
*/
|
|
1593
|
+
function restoreMarkdownInlineReferenceChips(
|
|
1594
|
+
markdown: string_markdown,
|
|
1595
|
+
renderedChips: ReadonlyArray<string>,
|
|
1596
|
+
): string_markdown {
|
|
1597
|
+
return markdown.replace(
|
|
1598
|
+
INLINE_REFERENCE_PLACEHOLDER_REGEX,
|
|
1599
|
+
(_match, index) => renderedChips[Number(index)] ?? '',
|
|
1600
|
+
) as string_markdown;
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1603
|
+
/**
|
|
1604
|
+
* Replaces known `[[reference]]` tokens, reference links and bare reference URLs with link chips.
|
|
1605
|
+
*
|
|
1606
|
+
* Every matched reference is first replaced by a placeholder so that the rendered chip HTML is
|
|
1607
|
+
* never processed again by a later pass.
|
|
960
1608
|
*
|
|
961
1609
|
* @param markdown - Markdown content after code masking.
|
|
962
1610
|
* @param options - Markdown render options.
|
|
963
|
-
* @returns Markdown with known inline references rendered as HTML
|
|
1611
|
+
* @returns Markdown with known inline references rendered as HTML chips.
|
|
964
1612
|
*
|
|
965
1613
|
* @private utility of `renderMarkdown`
|
|
966
1614
|
*/
|
|
@@ -972,16 +1620,40 @@ function applyMarkdownInlineReferences(markdown: string_markdown, options?: Rend
|
|
|
972
1620
|
return markdown;
|
|
973
1621
|
}
|
|
974
1622
|
|
|
975
|
-
const
|
|
976
|
-
|
|
977
|
-
|
|
1623
|
+
const renderedChips: Array<string> = [];
|
|
1624
|
+
const createPlaceholder: CreateMarkdownInlineReferencePlaceholder = (reference) => {
|
|
1625
|
+
const placeholder = `${INLINE_REFERENCE_PLACEHOLDER_PREFIX}${renderedChips.length}__`;
|
|
1626
|
+
renderedChips.push(renderMarkdownInlineReferenceHtml(reference, className));
|
|
1627
|
+
|
|
1628
|
+
return placeholder;
|
|
1629
|
+
};
|
|
1630
|
+
|
|
1631
|
+
const hrefMatchers = createMarkdownInlineReferenceHrefMatchers(references);
|
|
1632
|
+
let referencedMarkdown = replaceMarkdownInlineReferenceTokens(markdown, references, createPlaceholder);
|
|
1633
|
+
|
|
1634
|
+
if (hrefMatchers.length !== 0) {
|
|
1635
|
+
referencedMarkdown = replaceMarkdownInlineReferenceLinks(referencedMarkdown, hrefMatchers, createPlaceholder);
|
|
1636
|
+
referencedMarkdown = replaceMarkdownInlineReferenceBareUrls(
|
|
1637
|
+
referencedMarkdown,
|
|
1638
|
+
hrefMatchers,
|
|
1639
|
+
createPlaceholder,
|
|
1640
|
+
);
|
|
978
1641
|
}
|
|
979
1642
|
|
|
980
|
-
|
|
981
|
-
|
|
1643
|
+
const textMatchers = createMarkdownInlineReferenceTextMatchers(references);
|
|
1644
|
+
if (textMatchers.length !== 0) {
|
|
1645
|
+
const { masked: markdownWithMaskedLinksAndUrls, restore: restoreLinksAndUrls } =
|
|
1646
|
+
maskMarkdownLinksAndBareUrls(referencedMarkdown);
|
|
1647
|
+
referencedMarkdown = restoreLinksAndUrls(
|
|
1648
|
+
replaceMarkdownInlineReferenceTextAliases(
|
|
1649
|
+
markdownWithMaskedLinksAndUrls,
|
|
1650
|
+
textMatchers,
|
|
1651
|
+
createPlaceholder,
|
|
1652
|
+
),
|
|
1653
|
+
);
|
|
1654
|
+
}
|
|
982
1655
|
|
|
983
|
-
|
|
984
|
-
}) as string_markdown;
|
|
1656
|
+
return restoreMarkdownInlineReferenceChips(referencedMarkdown, renderedChips);
|
|
985
1657
|
}
|
|
986
1658
|
|
|
987
1659
|
/**
|