@promptbook/cli 0.113.0-9 → 0.114.0-0
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 +4 -3
- package/apps/agents-server/next.config.ts +2 -0
- package/apps/agents-server/package.json +3 -3
- package/apps/agents-server/playwright.config.ts +7 -2
- package/apps/agents-server/scripts/clearNextGeneratedTypes.js +25 -0
- package/apps/agents-server/scripts/createCloudflareDnsRecordSyncPlan/CloudflareDnsRecordSyncPlan.ts +10 -80
- package/apps/agents-server/scripts/createCloudflareDnsRecordSyncPlan/createCloudflareDnsRecordSyncPlan.ts +1 -1
- package/apps/agents-server/scripts/createCloudflareDnsRecordSyncPlan/describeCloudflareDnsRecordUpdateReasons.ts +1 -1
- package/apps/agents-server/scripts/createCloudflareDnsRecordSyncPlan/resolveDesiredCloudflareDnsRecord.ts +1 -1
- package/apps/agents-server/scripts/createCloudflareDnsRecordSyncPlan/resolveDesiredCloudflareDnsRecords.ts +1 -29
- package/apps/agents-server/scripts/createCloudflareDnsRecordSyncPlan/selectCloudflareRecordForManagedDomain.ts +1 -1
- package/apps/agents-server/scripts/createCloudflareDnsRecordSyncPlan/syncCloudflareDnsRecords.ts +4 -4
- package/apps/agents-server/scripts/createCloudflareDnsRecordSyncPlan/updateManagedCloudflareDnsRecord.ts +26 -0
- package/apps/agents-server/scripts/createCloudflareDnsRecordSyncPlan.ts +1 -1
- package/apps/agents-server/scripts/next-cli.js +16 -0
- package/apps/agents-server/src/app/admin/_components/AdminConfigurationShell.tsx +10 -34
- package/apps/agents-server/src/app/admin/_components/AdminRouteTabs.tsx +72 -0
- package/apps/agents-server/src/app/admin/_components/AdminSortableTableHeaderCell.tsx +80 -0
- package/apps/agents-server/src/app/admin/_components/AdminStorageTabs.tsx +47 -0
- package/apps/agents-server/src/app/admin/_components/S3BrowserPanel.tsx +292 -0
- package/apps/agents-server/src/app/admin/_components/adminTableSorting.ts +266 -0
- package/apps/agents-server/src/app/admin/api-tokens/ApiTokensClient.tsx +57 -7
- package/apps/agents-server/src/app/admin/chat-feedback/ChatFeedbackClient.tsx +1 -1
- package/apps/agents-server/src/app/admin/chat-feedback/ChatFeedbackTable.tsx +23 -22
- package/apps/agents-server/src/app/admin/chat-feedback/useChatFeedbackState.ts +13 -11
- package/apps/agents-server/src/app/admin/chat-history/ChatHistoryChatView.tsx +134 -0
- package/apps/agents-server/src/app/admin/chat-history/ChatHistoryClient.tsx +52 -26
- package/apps/agents-server/src/app/admin/chat-history/ChatHistoryFiltersCard.tsx +53 -1
- package/apps/agents-server/src/app/admin/chat-history/ChatHistoryTable.tsx +88 -69
- package/apps/agents-server/src/app/admin/chat-history/ChatHistoryThreadList.tsx +67 -0
- package/apps/agents-server/src/app/admin/chat-history/page.tsx +17 -2
- package/apps/agents-server/src/app/admin/chat-history/useChatHistoryState.ts +232 -39
- package/apps/agents-server/src/app/admin/core-agents/page.tsx +143 -0
- package/apps/agents-server/src/app/admin/email-server/actions.ts +33 -0
- package/apps/agents-server/src/app/admin/email-server/page.tsx +160 -0
- package/apps/agents-server/src/app/admin/files/FilesGalleryClient.tsx +23 -4
- package/apps/agents-server/src/app/admin/files/FilesGalleryGrid.tsx +126 -58
- package/apps/agents-server/src/app/admin/files/FilesGalleryStatusBadge.tsx +1 -1
- package/apps/agents-server/src/app/admin/files/FilesGalleryTable.tsx +125 -60
- package/apps/agents-server/src/app/admin/files/actions.ts +84 -34
- package/apps/agents-server/src/app/admin/files/filesGalleryLinks.ts +31 -0
- package/apps/agents-server/src/app/admin/files/filesGalleryRows.ts +119 -0
- package/apps/agents-server/src/app/admin/files/filesGalleryTypes.ts +43 -0
- package/apps/agents-server/src/app/admin/files/page.tsx +13 -2
- package/apps/agents-server/src/app/admin/files/useFilesGalleryState.ts +58 -16
- package/apps/agents-server/src/app/admin/images/ImagesGalleryClient.tsx +3 -0
- package/apps/agents-server/src/app/admin/images/ImagesGalleryTable.tsx +56 -6
- package/apps/agents-server/src/app/admin/images/actions.ts +18 -2
- package/apps/agents-server/src/app/admin/images/useImagesGalleryState.ts +57 -16
- package/apps/agents-server/src/app/admin/internal-s3/page.tsx +369 -0
- package/apps/agents-server/src/app/admin/login-methods/shibboleth/ShibbolethSortableTables.tsx +361 -0
- package/apps/agents-server/src/app/admin/login-methods/shibboleth/page.tsx +7 -108
- package/apps/agents-server/src/app/admin/messages/MessagesClient.tsx +69 -5
- package/apps/agents-server/src/app/admin/metadata/MetadataClient.tsx +77 -9
- package/apps/agents-server/src/app/admin/projects/actions.ts +158 -0
- package/apps/agents-server/src/app/admin/projects/agentProjectCustomDomainForm.ts +4 -0
- package/apps/agents-server/src/app/admin/projects/page.tsx +502 -0
- package/apps/agents-server/src/app/admin/task-manager/TaskManagerClient.tsx +36 -11
- package/apps/agents-server/src/app/admin/task-manager/TaskManagerScopeTabs.tsx +74 -0
- package/apps/agents-server/src/app/admin/task-manager/TaskManagerTaskRow.tsx +70 -242
- package/apps/agents-server/src/app/admin/task-manager/TaskManagerTaskTargetLink.tsx +57 -0
- package/apps/agents-server/src/app/admin/task-manager/TaskManagerTaskTerminalDialog.tsx +3 -1
- package/apps/agents-server/src/app/admin/task-manager/TaskManagerTasksCard.tsx +118 -11
- package/apps/agents-server/src/app/admin/task-manager/[taskId]/TaskManagerTaskDetailClient.tsx +312 -0
- package/apps/agents-server/src/app/admin/task-manager/[taskId]/page.tsx +34 -0
- package/apps/agents-server/src/app/admin/task-manager/adminChatTaskActionDialogs.ts +232 -0
- package/apps/agents-server/src/app/admin/task-manager/taskManagerTaskPresentation.tsx +275 -0
- package/apps/agents-server/src/app/admin/task-manager/useTaskManagerState.ts +111 -114
- package/apps/agents-server/src/app/admin/task-manager-vps/page.tsx +8 -0
- package/apps/agents-server/src/app/admin/usage/UsageClientAnalyticsPanels.tsx +123 -8
- package/apps/agents-server/src/app/admin/users/[userId]/UserActivityTable.tsx +134 -0
- package/apps/agents-server/src/app/admin/users/[userId]/UserDetailClient.tsx +3 -8
- package/apps/agents-server/src/app/agents/[agentName]/AgentChatWrapper.tsx +18 -1
- package/apps/agents-server/src/app/agents/[agentName]/AgentProfileChat.tsx +17 -0
- package/apps/agents-server/src/app/agents/[agentName]/AgentProfileWrapper.tsx +7 -0
- package/apps/agents-server/src/app/agents/[agentName]/api/book/download/route.ts +71 -0
- package/apps/agents-server/src/app/agents/[agentName]/api/user-chats/[chatId]/messages/route.ts +8 -4
- package/apps/agents-server/src/app/agents/[agentName]/api/user-chats/[chatId]/route.ts +10 -5
- package/apps/agents-server/src/app/agents/[agentName]/api/user-chats/resolveUserChatScope.ts +11 -1
- package/apps/agents-server/src/app/agents/[agentName]/api/user-chats/route.ts +9 -2
- package/apps/agents-server/src/app/agents/[agentName]/book+chat/page.tsx +18 -5
- package/apps/agents-server/src/app/agents/[agentName]/chat/AgentChatHistoryClient.tsx +32 -1
- package/apps/agents-server/src/app/agents/[agentName]/chat/CanonicalAgentChatPanel.tsx +23 -0
- package/apps/agents-server/src/app/agents/[agentName]/chat/CanonicalAgentChatSurface.tsx +42 -4
- package/apps/agents-server/src/app/agents/[agentName]/chat/ExternalUserChatAdminActions.tsx +125 -0
- package/apps/agents-server/src/app/agents/[agentName]/chat/page.tsx +49 -9
- package/apps/agents-server/src/app/agents/[agentName]/chat/resolveAgentChatDisplayName.ts +27 -0
- package/apps/agents-server/src/app/agents/[agentName]/chat/useAgentChatHistoryClientState.ts +12 -1
- package/apps/agents-server/src/app/agents/[agentName]/chat/useAgentChatHistoryOptimisticState.ts +1 -0
- package/apps/agents-server/src/app/agents/[agentName]/chat/useCanonicalAgentChatPanelState.ts +4 -10
- package/apps/agents-server/src/app/agents/[agentName]/layout.tsx +9 -1
- package/apps/agents-server/src/app/agents/[agentName]/page.tsx +69 -5
- package/apps/agents-server/src/app/agents/[agentName]/projects/[projectName]/AgentProjectVscodeKeyboardShortcut.tsx +75 -0
- package/apps/agents-server/src/app/agents/[agentName]/projects/[projectName]/actions.ts +77 -0
- package/apps/agents-server/src/app/agents/[agentName]/projects/[projectName]/files/[...filePath]/route.ts +86 -0
- package/apps/agents-server/src/app/agents/[agentName]/projects/[projectName]/page.tsx +795 -0
- package/apps/agents-server/src/app/agents/[agentName]/projects/[projectName]/vscode/route.ts +76 -0
- package/apps/agents-server/src/app/agents/[agentName]/projects/page.tsx +91 -0
- package/apps/agents-server/src/app/api/admin/chat-tasks/[taskId]/cancel/route.ts +19 -77
- package/apps/agents-server/src/app/api/admin/chat-tasks/[taskId]/retry/route.ts +22 -4
- package/apps/agents-server/src/app/api/admin/chat-tasks/[taskId]/route.ts +31 -0
- package/apps/agents-server/src/app/api/admin/chat-tasks/[taskId]/terminal/route.ts +25 -16
- package/apps/agents-server/src/app/api/admin/chat-tasks/cancel-all/route.ts +45 -0
- package/apps/agents-server/src/app/api/admin/default-agents/reinstate/route.ts +62 -0
- package/apps/agents-server/src/app/api/admin/dns-records/cloudflare/route.ts +116 -0
- package/apps/agents-server/src/app/api/admin/{code-runners → harness-auth}/authentication/route.ts +17 -17
- package/apps/agents-server/src/app/api/admin/{code-runners → harness-auth}/route.ts +15 -13
- package/apps/agents-server/src/app/api/admin/servers/[serverId]/route.ts +54 -48
- package/apps/agents-server/src/app/api/admin/servers/route.ts +197 -25
- package/apps/agents-server/src/app/api/admin/vps/chat-tasks/cancel-all/route.ts +37 -0
- package/apps/agents-server/src/app/api/admin/vps/chat-tasks/route.ts +26 -0
- package/apps/agents-server/src/app/api/agent-project-runtime-auth/route.ts +32 -0
- package/apps/agents-server/src/app/api/agent-project-vscode-auth/[sessionId]/route.ts +54 -0
- package/apps/agents-server/src/app/api/chat-history/export/route.ts +13 -0
- package/apps/agents-server/src/app/api/chat-history/route.ts +16 -14
- package/apps/agents-server/src/app/api/chat-history/threads/route.ts +68 -0
- package/apps/agents-server/src/app/api/docs/book-language.md/route.ts +11 -3
- package/apps/agents-server/src/app/api/docs/book-language.pdf/route.ts +29 -0
- package/apps/agents-server/src/app/api/docs/book.md/route.ts +11 -3
- package/apps/agents-server/src/app/api/emails/incoming/stalwart/route.ts +85 -0
- package/apps/agents-server/src/app/api/internal/agent-project-runtimes/route.ts +178 -0
- package/apps/agents-server/src/app/api/internal/user-chat-jobs/run/route.ts +7 -18
- package/apps/agents-server/src/app/api/messages/route.ts +24 -2
- package/apps/agents-server/src/app/api/onboarding/book/route.ts +22 -0
- package/apps/agents-server/src/app/api/onboarding/draft/route.ts +23 -0
- package/apps/agents-server/src/app/api/onboarding/evaluate/route.ts +25 -0
- package/apps/agents-server/src/app/api/onboarding/test/route.ts +29 -0
- package/apps/agents-server/src/app/api/page-preview/input/route.ts +22 -133
- package/apps/agents-server/src/app/api/page-preview/state/route.ts +46 -0
- package/apps/agents-server/src/app/api/page-preview/stream/route.ts +24 -0
- package/apps/agents-server/src/app/docs/[docId]/page.tsx +8 -8
- package/apps/agents-server/src/app/docs/page.tsx +7 -3
- package/apps/agents-server/src/app/globals.css +0 -59
- package/apps/agents-server/src/app/layout.tsx +165 -1
- package/apps/agents-server/src/app/page.tsx +23 -1
- package/apps/agents-server/src/app/superadmin/email-server/actions.ts +28 -0
- package/apps/agents-server/src/app/superadmin/email-server/page.tsx +127 -0
- package/apps/agents-server/src/app/superadmin/environment/EnvironmentVariablesClient.tsx +498 -0
- package/apps/agents-server/src/app/{admin → superadmin}/environment/page.tsx +1 -1
- package/apps/agents-server/src/app/{admin/code-runners/CodeRunnersClient.tsx → superadmin/harness-auth/HarnessAuthClient.tsx} +107 -66
- package/apps/agents-server/src/app/superadmin/harness-auth/OpenAiCodexAuthWizard.tsx +208 -0
- package/apps/agents-server/src/app/{admin/code-runners → superadmin/harness-auth}/page.tsx +4 -4
- package/apps/agents-server/src/app/superadmin/internal-s3/page.tsx +53 -0
- package/apps/agents-server/src/app/superadmin/loading.tsx +14 -0
- package/apps/agents-server/src/app/superadmin/resource-monitor/ResourceMonitorSortableTables.tsx +539 -0
- package/apps/agents-server/src/app/superadmin/resource-monitor/actions.ts +25 -0
- package/apps/agents-server/src/app/{admin → superadmin}/resource-monitor/page.tsx +55 -67
- package/apps/agents-server/src/app/superadmin/resource-monitor/resourceMonitorDisplay.ts +13 -0
- package/apps/agents-server/src/app/{admin → superadmin}/servers/ServersClient.tsx +12 -4
- package/apps/agents-server/src/app/{admin → superadmin}/servers/ServersRegistryApi.ts +1 -1
- package/apps/agents-server/src/app/{admin → superadmin}/servers/ServersRegistryDnsTypes.ts +24 -32
- package/apps/agents-server/src/app/{admin → superadmin}/servers/ServersRegistryTable.tsx +291 -89
- package/apps/agents-server/src/app/{admin → superadmin}/servers/useCreateServerWizard.ts +2 -2
- package/apps/agents-server/src/app/{admin → superadmin}/servers/useServersRegistryState.ts +68 -3
- package/apps/agents-server/src/app/superadmin/task-manager/page.tsx +14 -0
- package/apps/agents-server/src/app/{admin → superadmin}/update/AutomaticSelfUpdateConfigurationCard.tsx +9 -12
- package/apps/agents-server/src/app/{admin → superadmin}/update/UpdateJobCard.tsx +16 -2
- package/apps/agents-server/src/app/superadmin/update/updatePageCardClassName.ts +6 -0
- package/apps/agents-server/src/app/system/user-wallet/UserWalletClient.tsx +5 -1
- package/apps/agents-server/src/app/system/user-wallet/UserWalletDraft.ts +9 -1
- package/apps/agents-server/src/app/system/user-wallet/UserWalletRecordFormFields.tsx +13 -0
- package/apps/agents-server/src/app/system/user-wallet/UserWalletRecordValue.tsx +12 -0
- package/apps/agents-server/src/app/system/user-wallet/page.tsx +4 -1
- package/apps/agents-server/src/components/AdminTerminal/AdminTerminalCard.tsx +32 -24
- package/apps/agents-server/src/components/AdminTerminal/useAdminTerminalSession.ts +22 -1
- package/apps/agents-server/src/components/AgentContextMenu/AgentContextMenu.tsx +4 -0
- package/apps/agents-server/src/components/AgentContextMenu/useAgentContextMenuActions.ts +31 -0
- package/apps/agents-server/src/components/AgentContextMenu/useAgentContextMenuItems.ts +28 -0
- package/apps/agents-server/src/components/AgentNaming/legacyAgentTextTranslations.cs.yaml +7 -0
- package/apps/agents-server/src/components/AgentProjectDnsInstructions/AgentProjectDnsInstructions.tsx +182 -0
- package/apps/agents-server/src/components/AgentProjects/AgentProjectDnsWarning.tsx +24 -0
- package/apps/agents-server/src/components/AgentProjects/AgentProjectItem.tsx +190 -0
- package/apps/agents-server/src/components/AgentProjects/AgentProjectReferencesList.tsx +73 -0
- package/apps/agents-server/src/components/AgentProjects/AgentProjectRuntimeStatusBadge.tsx +37 -0
- package/apps/agents-server/src/components/AgentProjects/AgentProjectsBoard.tsx +61 -0
- package/apps/agents-server/src/components/CloudflareDnsWizard/CloudflareDnsApiTokenImportStep.tsx +137 -0
- package/apps/agents-server/src/components/CloudflareDnsWizard/CloudflareDnsCheckStep.tsx +28 -0
- package/apps/agents-server/src/components/CloudflareDnsWizard/CloudflareDnsExcludedRecordsNote.tsx +37 -0
- package/apps/agents-server/src/components/CloudflareDnsWizard/CloudflareDnsManualStep.tsx +75 -0
- package/apps/agents-server/src/components/CloudflareDnsWizard/CloudflareDnsWizard.tsx +88 -0
- package/apps/agents-server/src/components/CloudflareDnsWizard/CloudflareDnsWizardStepNavigation.tsx +53 -0
- package/apps/agents-server/src/components/CloudflareDnsWizard/CloudflareDnsWizardSteps.ts +36 -0
- package/apps/agents-server/src/components/CloudflareDnsWizard/CloudflareDnsZoneFileImportStep.tsx +109 -0
- package/apps/agents-server/src/components/CloudflareDnsWizard/useCloudflareDnsRecordImport.ts +71 -0
- package/apps/agents-server/src/components/CronJobConfiguration/CronJobConfiguration.tsx +834 -0
- package/apps/agents-server/src/components/DefaultAgents/ReinstateBundledAgentsButton.tsx +119 -0
- package/apps/agents-server/src/components/DnsProviderGuides/DnsProviderGuides.tsx +35 -0
- package/apps/agents-server/src/components/DnsRecordsInstructions/DnsRecordsInstructions.tsx +125 -0
- package/apps/agents-server/src/components/DocsToolbar/DocsToolbar.tsx +284 -25
- package/apps/agents-server/src/components/FileUploadAvailability/FileUploadUnavailableNotice.tsx +1 -1
- package/apps/agents-server/src/components/Footer/Footer.tsx +38 -15
- package/apps/agents-server/src/components/Header/ActiveAgentBreadcrumbContext.tsx +6 -1
- package/apps/agents-server/src/components/Header/Header.tsx +41 -9
- package/apps/agents-server/src/components/Header/HeaderDesktopTopMenuNavigation.tsx +22 -2
- package/apps/agents-server/src/components/Header/HeaderMobileDrawer.tsx +22 -2
- package/apps/agents-server/src/components/Header/HeaderTypes.ts +36 -1
- package/apps/agents-server/src/components/Header/buildActiveAgentViewItems.ts +9 -0
- package/apps/agents-server/src/components/Header/buildDocumentationDropdownItems.tsx +198 -3
- package/apps/agents-server/src/components/Header/buildHeaderMenuItems.ts +9 -1
- package/apps/agents-server/src/components/Header/buildHeaderSystemMenuItems.ts +296 -50
- package/apps/agents-server/src/components/Header/createAgentViewLabel.tsx +11 -2
- package/apps/agents-server/src/components/Header/resolveActiveAgentNavigation.ts +4 -0
- package/apps/agents-server/src/components/Header/resolveHeaderSystemWarnings.ts +215 -0
- package/apps/agents-server/src/components/Header/useHeaderActiveAgent.ts +25 -3
- package/apps/agents-server/src/components/Header/useHeaderAgentMenus.tsx +5 -1
- package/apps/agents-server/src/components/Homepage/AgentsList.tsx +6 -30
- package/apps/agents-server/src/components/Homepage/AgentsListHeader.tsx +25 -111
- package/apps/agents-server/src/components/Homepage/DefaultAgentsStatusNotice.tsx +121 -0
- package/apps/agents-server/src/components/Homepage/ExternalAgentsSectionClient.tsx +5 -11
- package/apps/agents-server/src/components/Homepage/HomepagePrimarySections.tsx +1 -6
- package/apps/agents-server/src/components/Homepage/agentOrganizationUtils.ts +0 -60
- package/apps/agents-server/src/components/Homepage/normalizeServerUrl.ts +2 -2
- package/apps/agents-server/src/components/Homepage/useAgentsListDerivedState.ts +4 -66
- package/apps/agents-server/src/components/Homepage/useAgentsListNavigationState.ts +18 -29
- package/apps/agents-server/src/components/Homepage/useAgentsListOverlayDetailsState.ts +3 -3
- package/apps/agents-server/src/components/Homepage/useAgentsListQueryState.ts +2 -26
- package/apps/agents-server/src/components/Homepage/useAgentsListState.ts +9 -51
- package/apps/agents-server/src/components/LayoutWrapper/LayoutWrapper.tsx +52 -1
- package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/ManGoNewAgentWizard.tsx +8 -2
- package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/WizardShell.tsx +125 -21
- package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/services/agentEvalService.ts +19 -15
- package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/services/agentTestService.ts +33 -37
- package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/services/bookService.ts +12 -12
- package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/services/createManGoAgentSource.ts +6 -1
- package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/services/createManGoOpenEditorRequest.ts +23 -0
- package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/services/draftService.ts +11 -24
- package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/services/postManGoOnboardingJson.ts +104 -0
- package/apps/agents-server/src/components/NewAgentDialog/NewAgentOpenEditorRequest.ts +19 -0
- package/apps/agents-server/src/components/NewAgentDialog/NewAgentWizard.tsx +2 -11
- package/apps/agents-server/src/components/NewAgentDialog/createNewAgentWizardSubmissionActions.ts +2 -4
- package/apps/agents-server/src/components/NewAgentDialog/useNewAgentDialog.tsx +9 -7
- package/apps/agents-server/src/components/Skeleton/HomepageLoadingSkeleton.tsx +1 -18
- package/apps/agents-server/src/components/StalwartSynchronizeButton/StalwartSynchronizeButton.tsx +52 -0
- package/apps/agents-server/src/components/UsersList/CreateUserDialog.tsx +153 -0
- package/apps/agents-server/src/components/UsersList/UsersList.tsx +229 -103
- package/apps/agents-server/src/components/UsersList/generateSecurePassword.ts +50 -0
- package/apps/agents-server/src/components/UsersList/useUserActivity.ts +78 -0
- package/apps/agents-server/src/constants/harnessAuthRoutes.ts +20 -0
- package/apps/agents-server/src/constants/serverLimits.ts +2 -2
- package/apps/agents-server/src/constants/shibbolethAuth.ts +13 -0
- package/apps/agents-server/src/database/$provideDatabaseAdminExecutor.ts +12 -13
- package/apps/agents-server/src/database/createMissingAgentsFromBooks.ts +77 -0
- package/apps/agents-server/src/database/metadataDefaults.ts +2 -2
- package/apps/agents-server/src/database/migrations/2026-07-1400-wallet-browser-profile-record-type.sql +16 -0
- package/apps/agents-server/src/database/migrations/2026-07-1700-chat-history-chat-task-links.sql +10 -0
- package/apps/agents-server/src/database/migrations/2026-07-2500-user-chat-email-source.sql +13 -0
- package/apps/agents-server/src/database/reinstateDefaultAgents.ts +111 -0
- package/apps/agents-server/src/database/schema.ts +9 -3
- package/apps/agents-server/src/database/seedCoreAgents.ts +8 -30
- package/apps/agents-server/src/database/sqlite/$provideAgentsServerSqliteDatabase.ts +48 -16
- package/apps/agents-server/src/database/sqlite/$provideCurrentServerSqliteDatabase.ts +18 -0
- package/apps/agents-server/src/database/sqlite/$provideLocalSqliteSupabase.ts +15 -13
- package/apps/agents-server/src/database/sqlite/localSqliteSupabase/LocalSqliteSupabaseClient.ts +15 -3
- package/apps/agents-server/src/database/sqlite/localSqliteSupabase/localSqliteTableSchema.ts +5 -2
- package/apps/agents-server/src/database/sqlite/resolveLocalSqliteTableLocation.ts +104 -0
- package/apps/agents-server/src/database/sqlite/resolveServerSqliteDatabasePath.ts +72 -0
- package/apps/agents-server/src/database/sqlite/standaloneServerRegistryStore.ts +479 -0
- package/apps/agents-server/src/generated/reservedPaths.ts +1 -1
- package/apps/agents-server/src/instrumentation-node.ts +58 -0
- package/apps/agents-server/src/languages/ServerTranslationKeys.ts +50 -1
- package/apps/agents-server/src/languages/translations/czech.yaml +53 -4
- package/apps/agents-server/src/languages/translations/english.yaml +52 -3
- package/apps/agents-server/src/message-providers/email/_common/parseInboundEmail.ts +71 -0
- package/apps/agents-server/src/message-providers/email/sendgrid/parseInboundSendgridEmail.ts +2 -42
- package/apps/agents-server/src/message-providers/email/smtp/SmtpMessageProvider.ts +43 -0
- package/apps/agents-server/src/message-providers/email/stalwart/StalwartMessageProvider.ts +74 -0
- package/apps/agents-server/src/message-providers/email/stalwart/StalwartMtaHookPayload.ts +32 -0
- package/apps/agents-server/src/message-providers/email/stalwart/parseInboundStalwartEmail.ts +74 -0
- package/apps/agents-server/src/message-providers/index.ts +9 -0
- package/apps/agents-server/src/middleware.ts +2 -1
- package/apps/agents-server/src/search/createDefaultServerSearchProviders/createConversationsSearchProvider.ts +10 -3
- package/apps/agents-server/src/tools/$provideBrowserForServer.ts +4 -1
- package/apps/agents-server/src/tools/$provideServer.ts +14 -2
- package/apps/agents-server/src/tools/BrowserConnectionProvider.ts +250 -51
- package/apps/agents-server/src/tools/mapRegisteredServerContexts.ts +104 -0
- package/apps/agents-server/src/tools/runBrowserWorkflow.ts +5 -0
- package/apps/agents-server/src/tools/run_browser.ts +8 -0
- package/apps/agents-server/src/tools/serverContextOverride.ts +42 -0
- package/apps/agents-server/src/utils/adminChatTaskLinks.ts +170 -0
- package/apps/agents-server/src/utils/agentAccess.ts +1 -1
- package/apps/agents-server/src/utils/agentBook/createAgentBookDownloadFilename.ts +51 -0
- package/apps/agents-server/src/utils/agentBook/downloadAgentBook.ts +86 -0
- package/apps/agents-server/src/utils/agentBrowserProfile/$provideAgentBrowserProfile.ts +92 -0
- package/apps/agents-server/src/utils/agentBrowserProfile/$provideAgentBrowserProfileForToolArgs.ts +36 -0
- package/apps/agents-server/src/utils/agentBrowserProfile/agentBrowserProfileWalletConstants.ts +9 -0
- package/apps/agents-server/src/utils/agentBrowserProfile/findAgentBrowserProfileWalletRecord.ts +37 -0
- package/apps/agents-server/src/utils/agentBrowserProfile/resolveAgentBrowserProfileDirectory.ts +62 -0
- package/apps/agents-server/src/utils/agentIdentifier.ts +27 -4
- package/apps/agents-server/src/utils/agentOwnership.ts +3 -3
- package/apps/agents-server/src/utils/agentProjects/AgentProjectInfo.ts +153 -0
- package/apps/agents-server/src/utils/agentProjects/AgentProjectReferenceInfo.ts +19 -0
- package/apps/agents-server/src/utils/agentProjects/AgentProjectRuntimeInfo.ts +117 -0
- package/apps/agents-server/src/utils/agentProjects/agentProjectAccess.ts +71 -0
- package/apps/agents-server/src/utils/agentProjects/agentProjectCodeServerRegistry.ts +808 -0
- package/apps/agents-server/src/utils/agentProjects/agentProjectHrefs.ts +147 -0
- package/apps/agents-server/src/utils/agentProjects/agentProjectRuntimeConstants.ts +49 -0
- package/apps/agents-server/src/utils/agentProjects/agentProjectRuntimeDisplay.ts +42 -0
- package/apps/agents-server/src/utils/agentProjects/agentProjectRuntimeDomains.ts +733 -0
- package/apps/agents-server/src/utils/agentProjects/agentProjectRuntimePaths.ts +102 -0
- package/apps/agents-server/src/utils/agentProjects/agentProjectRuntimePm2.ts +378 -0
- package/apps/agents-server/src/utils/agentProjects/agentProjectRuntimeRegistry.ts +984 -0
- package/apps/agents-server/src/utils/agentProjects/agentProjectsPaths.ts +129 -0
- package/apps/agents-server/src/utils/agentProjects/createAgentProjectDnsRecords.ts +67 -0
- package/apps/agents-server/src/utils/agentProjects/createAgentProjectMarkdownReferences.ts +69 -0
- package/apps/agents-server/src/utils/agentProjects/createStaticAgentProjectServer.ts +275 -0
- package/apps/agents-server/src/utils/agentProjects/findFreeTcpPort.ts +48 -0
- package/apps/agents-server/src/utils/agentProjects/hasAgentProjectDevScript.ts +68 -0
- package/apps/agents-server/src/utils/agentProjects/hasAgentProjects.ts +24 -0
- package/apps/agents-server/src/utils/agentProjects/isMissingPathError.ts +14 -0
- package/apps/agents-server/src/utils/agentProjects/isTcpPortListening.ts +99 -0
- package/apps/agents-server/src/utils/agentProjects/killProcessListeningOnPort.ts +164 -0
- package/apps/agents-server/src/utils/agentProjects/listAgentProjectChatReferences.ts +33 -0
- package/apps/agents-server/src/utils/agentProjects/listAgentProjectDirectoryEntries.ts +188 -0
- package/apps/agents-server/src/utils/agentProjects/listAgentProjectDnsDiagnostics.ts +138 -0
- package/apps/agents-server/src/utils/agentProjects/listAgentProjectFiles.ts +105 -0
- package/apps/agents-server/src/utils/agentProjects/listAgentProjects.ts +41 -0
- package/apps/agents-server/src/utils/agentProjects/listAllAgentProjectSummaries.ts +199 -0
- package/apps/agents-server/src/utils/agentProjects/measureDirectoryUsage.ts +105 -0
- package/apps/agents-server/src/utils/agentProjects/readAgentProjectFile.ts +78 -0
- package/apps/agents-server/src/utils/agentProjects/readAgentProjectReadme.ts +71 -0
- package/apps/agents-server/src/utils/agentProjects/resolveAgentProjectFileContentType.ts +46 -0
- package/apps/agents-server/src/utils/agentProjects/resolveAgentProjectInfo.ts +94 -0
- package/apps/agents-server/src/utils/agentProjects/resolveAgentProjectReadmeProfile.ts +219 -0
- package/apps/agents-server/src/utils/agentProjects/resolveCurrentAgentProjectServerDomain.ts +12 -0
- package/apps/agents-server/src/utils/agentRouting/agentRouteHrefs.ts +14 -0
- package/apps/agents-server/src/utils/agentRouting/resolveAgentRouteTarget.ts +2 -1
- package/apps/agents-server/src/utils/applyPagePreviewBrowserInput.ts +170 -0
- package/apps/agents-server/src/utils/bookLanguageDocumentation/BookLanguageDocumentationAgent.ts +25 -0
- package/apps/agents-server/src/utils/bookLanguageDocumentation/bookLanguageDocumentationExportParameters.ts +9 -0
- package/apps/agents-server/src/utils/bookLanguageDocumentation/createBookLanguageDocumentationMarkdownResponse.ts +88 -7
- package/apps/agents-server/src/utils/bookLanguageDocumentation/createBookLanguageDocumentationPdfResponse.ts +160 -0
- package/apps/agents-server/src/utils/bookLanguageDocumentation/createBookLanguageDocumentationPdfStyles.ts +251 -0
- package/apps/agents-server/src/utils/bookLanguageDocumentation/getBookLanguageDocumentationAgents.ts +60 -0
- package/apps/agents-server/src/utils/bookLanguageDocumentation/groupHtmlHeadingSections.ts +77 -0
- package/apps/agents-server/src/utils/bookLanguageDocumentation/highlightBookCodeBlocksInHtml.ts +68 -0
- package/apps/agents-server/src/utils/buildDomainTablePrefix.ts +24 -0
- package/apps/agents-server/src/utils/cancelAdminChatTaskById.ts +152 -0
- package/apps/agents-server/src/utils/cancelAllActiveAdminChatTasks.ts +199 -0
- package/apps/agents-server/src/utils/chat/createChatHistoryRecorder.ts +32 -13
- package/apps/agents-server/src/utils/chat/resolveCitationSourceLabel.ts +77 -0
- package/apps/agents-server/src/utils/chatExport/renderHtmlToPdfOnServer.ts +3 -84
- package/apps/agents-server/src/utils/chatFeedbackMode.ts +1 -1
- package/apps/agents-server/src/utils/chatHistoryAdmin.ts +44 -0
- package/apps/agents-server/src/utils/chatHistoryMessage.ts +218 -0
- package/apps/agents-server/src/utils/chatTasksAdmin.ts +176 -12
- package/apps/agents-server/src/utils/cloudflare/CloudflareApi.ts +159 -0
- package/apps/agents-server/src/utils/cloudflare/CloudflareDnsBatchApplication.ts +49 -0
- package/apps/agents-server/src/utils/cloudflare/applyCloudflareDnsRecordInstructions.ts +142 -0
- package/apps/agents-server/src/utils/cloudflare/createCloudflareDnsRecord.ts +21 -0
- package/apps/agents-server/src/utils/cloudflare/createCloudflareDnsRecordRequestBody.ts +86 -0
- package/apps/agents-server/src/utils/cloudflare/findBestMatchingCloudflareZoneForDomain.ts +41 -0
- package/apps/agents-server/{scripts/createCloudflareDnsRecordSyncPlan → src/utils/cloudflare}/listAllCloudflareDnsRecords.ts +1 -3
- package/apps/agents-server/{scripts/createCloudflareDnsRecordSyncPlan → src/utils/cloudflare}/listCloudflareZones.ts +1 -3
- package/apps/agents-server/{scripts/createCloudflareDnsRecordSyncPlan → src/utils/cloudflare}/normalizeCloudflareDnsRecordContent.ts +0 -2
- package/apps/agents-server/{scripts/createCloudflareDnsRecordSyncPlan → src/utils/cloudflare}/requestCloudflare.ts +4 -6
- package/apps/agents-server/src/utils/cloudflare/resolveCloudflareDnsRecordApplyAction.ts +157 -0
- package/apps/agents-server/src/utils/cloudflare/updateCloudflareDnsRecord.ts +26 -0
- package/apps/agents-server/src/utils/createPagePreviewBrowserStream.ts +123 -31
- package/apps/agents-server/src/utils/createPagePreviewFramePump.ts +117 -0
- package/apps/agents-server/src/utils/customDomainRouting.ts +3 -1
- package/apps/agents-server/src/utils/defaultAgents/coreAgentExplanations.ts +53 -0
- package/apps/agents-server/src/utils/defaultAgents/resolveDefaultAgentsStatus.ts +249 -0
- package/apps/agents-server/src/utils/dnsProviderGuides.ts +38 -0
- package/apps/agents-server/src/utils/dnsRecords/DnsRecordInstruction.ts +33 -0
- package/apps/agents-server/src/utils/dnsRecords/createDnsZoneFileExport.ts +91 -0
- package/apps/agents-server/src/utils/dnsRecords/resolveDnsRecordBatchPlan.ts +81 -0
- package/apps/agents-server/src/utils/email/EmailUserChatContext.ts +64 -0
- package/apps/agents-server/src/utils/email/agentEmailAddress.ts +115 -0
- package/apps/agents-server/src/utils/email/emailSystemAddresses.ts +15 -0
- package/apps/agents-server/src/utils/email/findOrCreateEmailAdHocUser.ts +94 -0
- package/apps/agents-server/src/utils/email/listAgentEmailIdentities.ts +102 -0
- package/apps/agents-server/src/utils/email/processInboundAgentEmail.ts +375 -0
- package/apps/agents-server/src/utils/email/sendEmailChatReply.ts +155 -0
- package/apps/agents-server/src/utils/email/sendEmailThroughStalwart.ts +39 -0
- package/apps/agents-server/src/utils/externalChatRunner/processExternalUserChatJob.ts +42 -1
- package/apps/agents-server/src/utils/getAdminChatTaskById.ts +72 -0
- package/apps/agents-server/src/utils/getAdminChatTasksResponse/adminChatTaskInjection.ts +326 -0
- package/apps/agents-server/src/utils/getAdminChatTasksResponse/getAdminChatTasks/adminChatTaskSqlQuery.ts +89 -6
- package/apps/agents-server/src/utils/getAdminChatTasksResponse/getAdminChatTasks/compareAdminChatTasks.ts +175 -7
- package/apps/agents-server/src/utils/getAdminChatTasksResponse/getAdminChatTasks/getAdminChatTasksViaSupabaseQuery.ts +1 -1
- package/apps/agents-server/src/utils/getAdminChatTasksResponse/getAdminChatTasks/loadAdminChatTaskFallbackData.ts +2 -1
- package/apps/agents-server/src/utils/getAdminChatTasksResponse/getAdminChatTasks/mapAdminChatTaskFallbackRows.ts +2 -0
- package/apps/agents-server/src/utils/getAdminChatTasksResponse/getAdminChatTasks/mapAdminChatTaskSqlRows.ts +5 -1
- package/apps/agents-server/src/utils/getAdminChatTasksResponse/mapVpsSelfUpdateJobToAdminChatTask.ts +9 -3
- package/apps/agents-server/src/utils/getAdminChatTasksResponse/parseAdminChatTaskQuery.ts +34 -1
- package/apps/agents-server/src/utils/getAdminChatTasksResponse.ts +17 -244
- package/apps/agents-server/src/utils/getPagePreviewBrowserSessionState.ts +41 -0
- package/apps/agents-server/src/utils/getVpsAdminChatTasksResponse.ts +150 -0
- package/apps/agents-server/src/utils/{codeRunnerAuthentication.ts → harnessAuthentication.ts} +72 -56
- package/apps/agents-server/src/utils/harnessConfiguration.ts +232 -0
- package/apps/agents-server/src/utils/internalS3/createInternalS3Client.ts +48 -0
- package/apps/agents-server/src/utils/internalS3/internalS3Types.ts +241 -0
- package/apps/agents-server/src/utils/internalS3/probeInternalS3Health.ts +135 -0
- package/apps/agents-server/src/utils/internalS3/readInternalS3Configuration.ts +51 -0
- package/apps/agents-server/src/utils/internalS3/readInternalS3Directory.ts +385 -0
- package/apps/agents-server/src/utils/internalS3/readInternalS3Snapshot.ts +56 -0
- package/apps/agents-server/src/utils/internalS3/resolveInternalS3ErrorMessage.ts +36 -0
- package/apps/agents-server/src/utils/internalS3/resolveInternalS3Status.ts +86 -0
- package/apps/agents-server/src/utils/localChatRunner/ensureLocalAgentFolder.ts +2 -0
- package/apps/agents-server/src/utils/localChatRunner/persistLocalUserChatJobProgressFromRuntimeLog.ts +136 -0
- package/apps/agents-server/src/utils/localChatRunner/processLocalUserChatJob.ts +42 -0
- package/apps/agents-server/src/utils/manGoOnboarding/manGoOnboardingAgentBooks.ts +86 -0
- package/apps/agents-server/src/utils/manGoOnboarding/manGoOnboardingAgentRuntime.ts +426 -0
- package/apps/agents-server/src/utils/manGoOnboarding/manGoOnboardingApiRequest.ts +100 -0
- package/apps/agents-server/src/utils/manGoOnboarding/manGoOnboardingApiResponses.ts +28 -0
- package/apps/agents-server/src/utils/messagesAdmin.ts +20 -0
- package/apps/agents-server/src/utils/mockedChats/$saveMockedChatPresetFromMessages.ts +61 -0
- package/apps/agents-server/src/utils/mockedChats/createMockedChatPresetFromChatMessages.ts +143 -0
- package/apps/agents-server/src/utils/mockedChatsSchema/normalizeMockedChatPreset.ts +3 -2
- package/apps/agents-server/src/utils/pagePreviewBrowserSessions.ts +57 -29
- package/apps/agents-server/src/utils/parsePositiveUserId.ts +20 -0
- package/apps/agents-server/src/utils/pdf/getPromptbookLogoDataUrl.ts +40 -0
- package/apps/agents-server/src/utils/pdf/renderHtmlToPdfOnServer.ts +86 -0
- package/apps/agents-server/src/utils/readRequiredAdminReason.ts +19 -0
- package/apps/agents-server/src/utils/resolveAgentHash.ts +36 -0
- package/apps/agents-server/src/utils/resourceMonitor/readAgentProjectRuntimesResourceUsage.ts +28 -0
- package/apps/agents-server/src/utils/resourceMonitor/readAgentProjectsResourceUsage.ts +49 -0
- package/apps/agents-server/src/utils/resourceMonitor/readServerResourceMonitorSnapshot.ts +7 -1
- package/apps/agents-server/src/utils/resourceMonitor/resourceMonitorTypes.ts +86 -1
- package/apps/agents-server/src/utils/serverManagement/createManagedServer.ts +21 -1
- package/apps/agents-server/src/utils/serverManagement/resolveServersDnsWarningStatus.ts +64 -0
- package/apps/agents-server/src/utils/serverManagement/standaloneVpsServerMetadata.ts +121 -40
- package/apps/agents-server/src/utils/serverRegistry.ts +31 -22
- package/apps/agents-server/src/utils/stalwart/StalwartConfiguration.ts +36 -0
- package/apps/agents-server/src/utils/stalwart/captureStalwartSynchronizationResult.ts +30 -0
- package/apps/agents-server/src/utils/stalwart/createEmailDnsInstructions.ts +69 -0
- package/apps/agents-server/src/utils/stalwart/readStalwartEmailSnapshot.ts +105 -0
- package/apps/agents-server/src/utils/stalwart/resolveStalwartApiUrl.ts +50 -0
- package/apps/agents-server/src/utils/stalwart/stalwartBootstrap.ts +116 -0
- package/apps/agents-server/src/utils/stalwart/stalwartJmapClient.ts +258 -0
- package/apps/agents-server/src/utils/stalwart/stalwartJmapValues.ts +33 -0
- package/apps/agents-server/src/utils/stalwart/stalwartMailBridge.ts +18 -0
- package/apps/agents-server/src/utils/stalwart/synchronizeAllStalwartEmailDomains.ts +28 -0
- package/apps/agents-server/src/utils/stalwart/synchronizeStalwartEmailDomain.ts +143 -0
- package/apps/agents-server/src/utils/standaloneVpsDnsDiagnostics.ts +21 -31
- package/apps/agents-server/src/utils/startPagePreviewScreencast.ts +105 -0
- package/apps/agents-server/src/utils/taskTerminal/resolveAdminTaskTerminalSession.ts +250 -37
- package/apps/agents-server/src/utils/thinkingMessages.ts +20 -2
- package/apps/agents-server/src/utils/userChat/UserChatRecord.ts +16 -0
- package/apps/agents-server/src/utils/userChat/UserChatSource.ts +9 -0
- package/apps/agents-server/src/utils/userChat/appendQueuedUserChatTurn.ts +31 -0
- package/apps/agents-server/src/utils/userChat/createUserChat.ts +2 -1
- package/apps/agents-server/src/utils/userChat/createUserChatDetailPayload.ts +15 -1
- package/apps/agents-server/src/utils/userChat/createUserChatSummary.ts +13 -1
- package/apps/agents-server/src/utils/userChat/expiredRunningUserChatJobDiagnostics.ts +2 -0
- package/apps/agents-server/src/utils/userChat/getUserChat.ts +8 -3
- package/apps/agents-server/src/utils/userChat/isUserChatViewOnly.ts +16 -0
- package/apps/agents-server/src/utils/userChat/listUserChats.ts +39 -11
- package/apps/agents-server/src/utils/userChat/persistUserChatJobTerminalState.ts +38 -0
- package/apps/agents-server/src/utils/userChat/recordUserChatMessageInChatHistory.ts +107 -0
- package/apps/agents-server/src/utils/userChat/resolveUserChatWorkerInternalToken.ts +3 -2
- package/apps/agents-server/src/utils/userChat/runDurableUserChatJobWorkerTick.ts +70 -0
- package/apps/agents-server/src/utils/userChat/userChatJobRunReport.ts +76 -0
- package/apps/agents-server/src/utils/userChat.ts +5 -0
- package/apps/agents-server/src/utils/userChatClient.ts +5 -0
- package/apps/agents-server/src/utils/userWallet/UserWalletRecord.ts +6 -1
- package/apps/agents-server/src/utils/userWallet/normalizeWalletPayload.ts +15 -1
- package/apps/agents-server/src/utils/vpsCertificateScheduler.ts +171 -0
- package/apps/agents-server/src/utils/vpsConfiguration.ts +83 -61
- package/apps/agents-server/src/utils/vpsSelfUpdate/readAgentsServerFooterVersion.ts +335 -0
- package/apps/agents-server/src/utils/vpsSelfUpdate/readPersistedVpsSelfUpdateJob.ts +8 -1
- package/apps/agents-server/src/utils/vpsSelfUpdate/startVpsSelfUpdate.ts +1 -1
- package/apps/agents-server/src/utils/vpsSelfUpdate/vpsSelfUpdateAutomaticConfiguration.ts +1 -1
- package/apps/agents-server/src/utils/vpsSelfUpdate/vpsSelfUpdateInstalledVersions.ts +1 -1
- package/apps/agents-server/src/utils/vpsSelfUpdate/vpsSelfUpdateJobHistory.ts +107 -4
- package/apps/agents-server/src/utils/vpsSelfUpdate/vpsSelfUpdateStateFiles.ts +24 -0
- package/apps/agents-server/src/utils/vpsTask/runWithVpsServerSetupTask.ts +192 -0
- package/apps/agents-server/src/utils/vpsTask/vpsTaskHistory.ts +189 -0
- package/apps/agents-server/src/utils/vpsTask/vpsTaskTypes.ts +67 -0
- package/esm/apps/agents-server/src/constants/serverLimits.d.ts +1 -1
- package/esm/apps/agents-server/src/database/sqlite/$provideAgentsServerSqliteDatabase.d.ts +69 -0
- package/esm/apps/agents-server/src/database/sqlite/localSqliteSupabase/ensureTable.d.ts +7 -0
- package/esm/apps/agents-server/src/database/sqlite/localSqliteSupabase/localSqliteSql.d.ts +30 -0
- package/esm/apps/agents-server/src/database/sqlite/localSqliteSupabase/localSqliteTableSchema.d.ts +76 -0
- package/esm/apps/agents-server/src/database/sqlite/resolveAgentsServerSqliteDatabasePath.d.ts +4 -0
- package/esm/apps/agents-server/src/database/sqlite/resolveServerSqliteDatabasePath.d.ts +28 -0
- package/esm/apps/agents-server/src/database/sqlite/standaloneServerRegistryStore.d.ts +110 -0
- package/esm/apps/agents-server/src/utils/agentProjects/agentProjectRuntimeConstants.d.ts +40 -0
- package/esm/apps/agents-server/src/utils/buildDomainTablePrefix.d.ts +13 -0
- package/esm/apps/agents-server/src/utils/serverRegistry.d.ts +5 -1
- package/esm/index.es.js +4568 -2053
- package/esm/index.es.js.map +1 -1
- package/esm/scripts/run-agent-messages/main/loadAgentMessageQueueSnapshot.d.ts +1 -1
- package/esm/scripts/run-agent-messages/messages/buildAgentMessagePrompt.d.ts +6 -1
- package/esm/scripts/run-agent-messages/messages/buildAgentProjectsPromptSection.d.ts +39 -0
- package/esm/scripts/run-agent-messages/messages/resolveAgentProjectRuntimePromptApi.d.ts +8 -0
- package/esm/scripts/run-agent-messages/messages/resolveAgentProjectsUrlPath.d.ts +12 -0
- package/esm/scripts/run-agent-messages/messages/writeAgentMessageRunReport.d.ts +22 -0
- package/esm/scripts/run-agent-messages/ui/buildAgentRunUiFrame.d.ts +6 -1
- package/esm/scripts/run-codex-prompts/common/buildCoderRunProgressSnapshot.d.ts +1 -1
- package/esm/scripts/run-codex-prompts/common/cliProgressDisplay.d.ts +4 -2
- package/esm/scripts/run-codex-prompts/common/formatUnknownErrorMessage.d.ts +7 -0
- package/esm/scripts/run-codex-prompts/common/sleepWithCountdown.d.ts +1 -0
- package/esm/scripts/run-codex-prompts/common/waitForPause.d.ts +49 -1
- package/esm/scripts/run-codex-prompts/common/waitUntilWorldTimeDeadline.d.ts +27 -0
- package/esm/scripts/run-codex-prompts/git/commitChanges.d.ts +3 -1
- package/esm/scripts/run-codex-prompts/git/gitBranchContext.d.ts +4 -0
- package/esm/scripts/run-codex-prompts/git/gitLongPathsSupport.d.ts +17 -0
- package/esm/scripts/run-codex-prompts/isolation/coderIsolationCheckoutFailureReport.d.ts +9 -0
- package/esm/scripts/run-codex-prompts/isolation/coderIsolationMergeFailureReport.d.ts +17 -0
- package/esm/scripts/run-codex-prompts/isolation/coderIsolationNaming.d.ts +26 -0
- package/esm/scripts/run-codex-prompts/isolation/copyCoderIsolationEnvironment.d.ts +8 -0
- package/esm/scripts/run-codex-prompts/isolation/createCoderIsolationWorktree.d.ts +22 -0
- package/esm/scripts/run-codex-prompts/isolation/markPromptIsolationMergeFailed.d.ts +10 -0
- package/esm/scripts/run-codex-prompts/isolation/mergeCoderIsolationWorktree.d.ts +24 -0
- package/esm/scripts/run-codex-prompts/isolation/removeCoderIsolationWorktree.d.ts +8 -0
- package/esm/scripts/run-codex-prompts/isolation/runIsolatedPromptRound.d.ts +14 -0
- package/esm/scripts/run-codex-prompts/main/runPromptRound.d.ts +9 -3
- package/esm/scripts/run-codex-prompts/prompts/buildPromptSectionSuffix.d.ts +9 -0
- package/esm/scripts/run-codex-prompts/prompts/findNextTodoPrompt.d.ts +2 -1
- package/esm/scripts/run-codex-prompts/prompts/formatCoderRunSteps.d.ts +9 -0
- package/esm/scripts/run-codex-prompts/prompts/formatRunnerSignature.d.ts +2 -1
- package/esm/scripts/run-codex-prompts/prompts/isPromptInPriorityFilter.d.ts +6 -0
- package/esm/scripts/run-codex-prompts/prompts/listPromptsToBeWritten.d.ts +2 -1
- 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 +5 -4
- package/esm/scripts/run-codex-prompts/prompts/printPromptsToBeWritten.d.ts +2 -1
- package/esm/scripts/run-codex-prompts/prompts/printStats.d.ts +2 -1
- package/esm/scripts/run-codex-prompts/prompts/priorityFilter.d.ts +39 -0
- package/esm/scripts/run-codex-prompts/prompts/summarizePrompts.d.ts +2 -1
- package/esm/scripts/run-codex-prompts/prompts/writePromptErrorLog.d.ts +3 -1
- package/esm/scripts/run-codex-prompts/runners/openai-codex/parseCodexLoginMethodFromOutput.d.ts +10 -0
- package/esm/scripts/run-codex-prompts/server/buildCoderServerPromptResponse.d.ts +2 -1
- package/esm/scripts/run-codex-prompts/server/coderServerHtml.d.ts +1 -1
- package/esm/scripts/run-codex-prompts/server/runCoderHttpServer.d.ts +2 -1
- package/esm/scripts/run-codex-prompts/testing/runPromptWithTestFeedback.d.ts +7 -1
- package/esm/scripts/run-codex-prompts/ui/CoderRunUiState.d.ts +2 -1
- package/esm/scripts/run-codex-prompts/ui/buildCoderRunAgentVisual.d.ts +3 -16
- package/esm/scripts/run-codex-prompts/ui/buildCoderRunUiFrame.d.ts +1 -0
- package/esm/scripts/run-codex-prompts/ui/buildRunUiFrameShared.d.ts +18 -1
- package/esm/src/_packages/components.index.d.ts +8 -0
- package/esm/src/_packages/core.index.d.ts +4 -0
- package/esm/src/_packages/types.index.d.ts +12 -0
- package/esm/src/book-2.0/agent-source/AgentBasicInformation.d.ts +7 -0
- package/esm/src/book-2.0/agent-source/parseAgentSource/ParsedAgentProfile.d.ts +1 -1
- package/esm/src/book-2.0/book-language-documentation/BookLanguageDocumentationExample.d.ts +5 -13
- package/esm/src/book-2.0/book-language-documentation/BookLanguageManualDictionary.d.ts +195 -0
- package/esm/src/book-2.0/book-language-documentation/bookLanguageDocumentationExamples.d.ts +2 -1
- package/esm/src/book-2.0/book-language-documentation/createStandaloneBookLanguageMarkdown.d.ts +43 -1
- package/esm/src/book-2.0/book-language-documentation/czechBookLanguageManualDictionary.d.ts +10 -0
- package/esm/src/book-2.0/book-language-documentation/englishBookLanguageManualDictionary.d.ts +10 -0
- package/esm/src/book-2.0/book-language-documentation/getBookLanguageManualCommitmentGroups.d.ts +33 -0
- package/esm/src/book-2.0/book-language-documentation/getBookLanguageManualDictionary.d.ts +15 -0
- package/esm/src/book-2.0/book-language-documentation/getSafeCodeBlock.d.ts +10 -0
- package/esm/src/book-2.0/book-language-documentation/renderCommitmentCatalogSection.d.ts +30 -0
- package/esm/src/book-2.0/book-language-documentation/renderGroupedCommitmentDocumentationMarkdown.d.ts +2 -1
- package/esm/src/book-2.0/book-language-documentation/toStableAnchorId.d.ts +12 -0
- package/esm/src/book-3.0/AgentMessageRunReport.d.ts +78 -0
- package/esm/src/book-3.0/agentFolderPaths.d.ts +9 -0
- package/esm/src/book-3.0/codexLoginMethod.d.ts +38 -0
- package/esm/src/book-components/BookEditor/BookEditorSyntaxTokenStyles.d.ts +39 -0
- package/esm/src/book-components/BookEditor/createBookSourceHighlightStyles.d.ts +12 -0
- package/esm/src/book-components/BookEditor/highlightBookSourceToHtml.d.ts +20 -0
- package/esm/src/book-components/Chat/Chat/ChatCitationModal.d.ts +5 -0
- package/esm/src/book-components/Chat/Chat/ChatCitationModal.test.d.ts +2 -0
- package/esm/src/book-components/Chat/Chat/ChatFeedbackStar.d.ts +37 -0
- package/esm/src/book-components/Chat/Chat/ChatMessageItem.d.ts +4 -0
- package/esm/src/book-components/Chat/Chat/ChatMessageList.d.ts +4 -0
- package/esm/src/book-components/Chat/Chat/ChatMessageRichContent.d.ts +5 -0
- package/esm/src/book-components/Chat/Chat/ChatProps.d.ts +13 -0
- package/esm/src/book-components/Chat/Chat/ChatRatingModal.test.d.ts +2 -0
- package/esm/src/book-components/Chat/Chat/CitationIframePreview.d.ts +25 -2
- package/esm/src/book-components/Chat/Chat/pagePreview/LiveBrowserPreview.d.ts +39 -0
- package/esm/src/book-components/Chat/Chat/pagePreview/LiveBrowserPreview.test.d.ts +2 -0
- package/esm/src/book-components/Chat/Chat/pagePreview/LiveBrowserPreviewToolbar.d.ts +71 -0
- package/esm/src/book-components/Chat/Chat/pagePreview/PagePreviewInputEvent.d.ts +72 -0
- package/esm/src/book-components/Chat/Chat/pagePreview/PagePreviewInputQueue.d.ts +64 -0
- package/esm/src/book-components/Chat/Chat/pagePreview/PagePreviewInputQueue.test.d.ts +1 -0
- package/esm/src/book-components/Chat/Chat/pagePreview/PagePreviewSessionState.d.ts +14 -0
- package/esm/src/book-components/Chat/Chat/pagePreview/PagePreviewViewport.d.ts +37 -0
- package/esm/src/book-components/Chat/Chat/pagePreview/createPagePreviewSessionId.d.ts +20 -0
- package/esm/src/book-components/Chat/Chat/pagePreview/normalizePagePreviewInputEvent.d.ts +13 -0
- package/esm/src/book-components/Chat/Chat/pagePreview/normalizePagePreviewInputEvent.test.d.ts +1 -0
- package/esm/src/book-components/Chat/Chat/resolveChatRatingMessageKey.d.ts +8 -0
- package/esm/src/book-components/Chat/MarkdownContent/MarkdownContent.d.ts +2 -0
- package/esm/src/book-components/Chat/SourceChip/SourceChip.test.d.ts +2 -0
- package/esm/src/book-components/Chat/hooks/useResolvedCitationLabel.test.d.ts +2 -0
- package/esm/src/book-components/Chat/utils/renderMarkdown.d.ts +78 -0
- package/esm/src/book-components/Chat/utils/resolveCitationSourceDisplay.d.ts +149 -0
- package/esm/src/book-components/Chat/utils/thinkingMessageVariants.d.ts +9 -0
- package/esm/src/cli/cli-commands/agent-folder/agentProjectPaths.d.ts +2 -2
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerChildEnvironment.d.ts +1 -0
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerChildEnvironment.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/PreparedAgentsServerLaunch.d.ts +1 -1
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/forwardChildOutput.d.ts +1 -1
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/startNextServer.d.ts +1 -1
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/startUserChatJobWorkerPump.d.ts +1 -1
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer.d.ts +1 -1
- package/esm/src/cli/cli-commands/coder/add.d.ts +36 -0
- package/esm/src/cli/cli-commands/coder/add.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/coder/boilerplateTemplates.d.ts +24 -0
- package/esm/src/cli/cli-commands/coder.d.ts +1 -0
- package/esm/src/cli/cli-commands/common/createNonNegativeIntegerOptionParser.d.ts +10 -0
- package/esm/src/cli/cli-commands/common/harness/$applyHarnessInstallationStatus.d.ts +9 -0
- package/esm/src/cli/cli-commands/common/harness/$askForHarnessInstallationApproval.d.ts +9 -0
- package/esm/src/cli/cli-commands/common/harness/$checkHarnessInstallation.d.ts +10 -0
- package/esm/src/cli/cli-commands/common/harness/$ensureHarnessInstallations.d.ts +13 -0
- package/esm/src/cli/cli-commands/common/harness/$installHarness.d.ts +13 -0
- package/esm/src/cli/cli-commands/common/harness/$resolveInstalledHarnessVersion.d.ts +10 -0
- package/esm/src/cli/cli-commands/common/harness/$resolveLatestHarnessVersion.d.ts +10 -0
- package/esm/src/cli/cli-commands/common/harness/HarnessDefinition.d.ts +40 -0
- package/esm/src/cli/cli-commands/common/harness/HarnessDefinition.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/common/harness/HarnessInstallationStatus.d.ts +35 -0
- package/esm/src/cli/cli-commands/common/harness/buildHarnessInstallCommand.d.ts +10 -0
- package/esm/src/cli/cli-commands/common/harness/extractHarnessVersionFromOutput.d.ts +11 -0
- package/esm/src/cli/cli-commands/common/harness/extractHarnessVersionFromOutput.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/common/harness/formatHarnessInstallationWarning.d.ts +7 -0
- package/esm/src/cli/cli-commands/common/harness/isHarnessVersionOutdated.d.ts +9 -0
- package/esm/src/cli/cli-commands/common/harness/isHarnessVersionOutdated.test.d.ts +1 -0
- package/esm/src/collection/agent-collection/constructors/agent-collection-in-supabase/buildAgentNameOrPermanentIdFilter.d.ts +18 -0
- package/esm/src/collection/agent-collection/constructors/agent-collection-in-supabase/buildAgentNameOrPermanentIdFilter.test.d.ts +1 -0
- package/esm/src/commitments/META/META.d.ts +2 -0
- package/esm/src/commitments/META_THINKING_MESSAGE/META_THINKING_MESSAGE.d.ts +26 -0
- package/esm/src/commitments/index.d.ts +2 -1
- package/esm/src/execution/utils/formatUsagePrice.d.ts +12 -0
- package/esm/src/execution/utils/formatUsagePrice.test.d.ts +1 -0
- package/esm/src/utils/agent-message-runtime/agentMessageRuntimePaths.d.ts +24 -0
- package/esm/src/utils/agent-message-runtime/resolveAgentMessageRuntimeActivity.d.ts +16 -0
- package/esm/src/utils/agent-message-runtime/resolveAgentMessageRuntimeActivity.test.d.ts +1 -0
- package/esm/src/utils/agents/terminalAgentAvatarVisual.d.ts +104 -0
- package/esm/src/utils/agents/terminalAgentAvatarVisual.test.d.ts +1 -0
- package/esm/src/utils/html/escapeHtml.d.ts +9 -0
- package/esm/src/utils/markdown/shiftMarkdownHeadingLevels.d.ts +15 -0
- package/esm/src/version.d.ts +1 -1
- package/package.json +1 -4
- package/src/_packages/components.index.ts +8 -0
- package/src/_packages/core.index.ts +4 -0
- package/src/_packages/types.index.ts +12 -0
- package/src/avatars/Avatar.tsx +13 -2
- package/src/avatars/renderAvatarVisual.ts +13 -2
- package/src/avatars/visuals/asciiOctopusAvatarVisual.ts +6 -1
- package/src/avatars/visuals/octopus2AvatarVisual.ts +5 -1
- package/src/avatars/visuals/octopus3AvatarVisual.ts +8 -1
- package/src/avatars/visuals/octopus3d2AvatarVisual.ts +10 -1
- package/src/avatars/visuals/octopus3d3AvatarVisual.ts +10 -1
- package/src/avatars/visuals/octopus3d4AvatarVisual.ts +10 -1
- package/src/book-2.0/agent-source/AgentBasicInformation.ts +8 -0
- package/src/book-2.0/agent-source/parseAgentSource/ParsedAgentProfile.ts +1 -1
- package/src/book-2.0/agent-source/parseAgentSource/applyMetaCommitment.ts +13 -0
- package/src/book-2.0/agent-source/parseAgentSource/extractParsedAgentProfile.ts +2 -0
- package/src/book-2.0/agent-source/parseAgentSource.ts +1 -0
- package/src/book-2.0/book-language-documentation/BookLanguageDocumentationExample.ts +5 -16
- package/src/book-2.0/book-language-documentation/BookLanguageManualDictionary.ts +219 -0
- package/src/book-2.0/book-language-documentation/bookLanguageDocumentationExamples.ts +2 -57
- package/src/book-2.0/book-language-documentation/createStandaloneBookLanguageMarkdown.ts +356 -270
- package/src/book-2.0/book-language-documentation/czechBookLanguageManualDictionary.ts +349 -0
- package/src/book-2.0/book-language-documentation/englishBookLanguageManualDictionary.ts +346 -0
- package/src/book-2.0/book-language-documentation/getBookLanguageManualCommitmentGroups.ts +61 -0
- package/src/book-2.0/book-language-documentation/getBookLanguageManualDictionary.ts +39 -0
- package/src/book-2.0/book-language-documentation/getSafeCodeBlock.ts +14 -0
- package/src/book-2.0/book-language-documentation/renderCommitmentCatalogSection.ts +110 -0
- package/src/book-2.0/book-language-documentation/renderGroupedCommitmentDocumentationMarkdown.ts +45 -8
- package/src/book-2.0/book-language-documentation/toStableAnchorId.ts +18 -0
- package/src/book-3.0/AgentMessageRunReport.ts +164 -0
- package/src/book-3.0/CliAgent.ts +7 -1
- package/src/book-3.0/agentFolderPaths.ts +10 -0
- package/src/book-3.0/codexLoginMethod.ts +52 -0
- package/src/book-components/AvatarProfile/AvatarProfile/AvatarProfile.tsx +4 -1
- package/src/book-components/BookEditor/BookEditorSyntaxTokenStyles.ts +88 -0
- package/src/book-components/BookEditor/createBookSourceHighlightStyles.ts +49 -0
- package/src/book-components/BookEditor/highlightBookSourceToHtml.ts +208 -0
- package/src/book-components/BookEditor/useBookEditorMonacoLanguage.ts +2 -37
- package/src/book-components/BookEditor/useBookEditorMonacoUploads/bookEditorMonacoUploadTypes.ts +1 -6
- package/src/book-components/BookEditor/useBookEditorMonacoUploads/useBookEditorMonacoUploadQueue.ts +11 -1
- package/src/book-components/Chat/Chat/Chat.module.css +201 -27
- package/src/book-components/Chat/Chat/Chat.tsx +4 -0
- package/src/book-components/Chat/Chat/ChatCitationModal.tsx +108 -67
- package/src/book-components/Chat/Chat/ChatFeedbackStar.tsx +103 -0
- package/src/book-components/Chat/Chat/ChatInputArea.tsx +2 -1
- package/src/book-components/Chat/Chat/ChatMessageItem.tsx +24 -25
- package/src/book-components/Chat/Chat/ChatMessageList.tsx +10 -2
- package/src/book-components/Chat/Chat/ChatMessageRichContent.tsx +8 -1
- package/src/book-components/Chat/Chat/ChatProps.tsx +15 -0
- package/src/book-components/Chat/Chat/ChatRatingModal.tsx +8 -39
- package/src/book-components/Chat/Chat/CitationIframePreview.tsx +42 -146
- package/src/book-components/Chat/Chat/pagePreview/LiveBrowserPreview.tsx +548 -0
- package/src/book-components/Chat/Chat/pagePreview/LiveBrowserPreviewToolbar.tsx +223 -0
- package/src/book-components/Chat/Chat/pagePreview/PagePreviewInputEvent.ts +84 -0
- package/src/book-components/Chat/Chat/pagePreview/PagePreviewInputQueue.ts +149 -0
- package/src/book-components/Chat/Chat/pagePreview/PagePreviewSessionState.ts +14 -0
- package/src/book-components/Chat/Chat/pagePreview/PagePreviewViewport.ts +66 -0
- package/src/book-components/Chat/Chat/pagePreview/createPagePreviewSessionId.ts +51 -0
- package/src/book-components/Chat/Chat/pagePreview/normalizePagePreviewInputEvent.ts +242 -0
- package/src/book-components/Chat/Chat/renderTimeoutToolCallDetails.tsx +5 -1
- package/src/book-components/Chat/Chat/resolveChatRatingMessageKey.ts +11 -0
- package/src/book-components/Chat/Chat/useChatInputAreaComposer.ts +7 -7
- package/src/book-components/Chat/Chat/useChatInputAreaDictation.ts +7 -7
- package/src/book-components/Chat/Chat/useChatToolCallModalState.ts +4 -1
- package/src/book-components/Chat/MarkdownContent/MarkdownContent.module.css +135 -0
- package/src/book-components/Chat/MarkdownContent/MarkdownContent.tsx +6 -2
- package/src/book-components/Chat/SourceChip/SourceChip.module.css +21 -2
- package/src/book-components/Chat/SourceChip/SourceChip.tsx +84 -45
- package/src/book-components/Chat/hooks/useChatRatings.ts +1 -9
- package/src/book-components/Chat/hooks/useResolvedCitationLabel.ts +117 -10
- package/src/book-components/Chat/utils/citationHelpers.ts +11 -165
- package/src/book-components/Chat/utils/getToolCallChipletInfo.ts +5 -1
- package/src/book-components/Chat/utils/messagesToHtml.ts +1 -1
- package/src/book-components/Chat/utils/renderMarkdown.ts +274 -4
- package/src/book-components/Chat/utils/resolveCitationSourceDisplay.ts +1017 -0
- package/src/book-components/Chat/utils/thinkingMessageVariants.ts +16 -6
- package/src/cli/cli-commands/about.ts +1 -1
- package/src/cli/cli-commands/agent/agentCliOptions.ts +5 -2
- package/src/cli/cli-commands/agent-folder/agentProjectPaths.ts +14 -6
- package/src/cli/cli-commands/agent-folder/init.ts +6 -2
- package/src/cli/cli-commands/agent-folder/initializeAgentProjectConfiguration.ts +13 -2
- package/src/cli/cli-commands/agent-folder/printAgentInitializationSummary.ts +11 -2
- package/src/cli/cli-commands/agents-server/buildAgentsServer/createAgentsServerBuildSourceFingerprint.ts +6 -2
- package/src/cli/cli-commands/agents-server/buildAgentsServer/runNextBuild.ts +3 -4
- package/src/cli/cli-commands/agents-server/run.ts +4 -3
- package/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerChildEnvironment.ts +11 -3
- package/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerRuntimePaths.ts +1 -1
- package/src/cli/cli-commands/agents-server/startAgentsServer/PreparedAgentsServerLaunch.ts +1 -1
- package/src/cli/cli-commands/agents-server/startAgentsServer/createInternalRouteErrorMessage.ts +5 -1
- package/src/cli/cli-commands/agents-server/startAgentsServer/forwardChildOutput.ts +2 -1
- package/src/cli/cli-commands/agents-server/startAgentsServer/prepareAgentsServerLaunch.ts +4 -6
- package/src/cli/cli-commands/agents-server/startAgentsServer/startNextServer.ts +2 -1
- package/src/cli/cli-commands/agents-server/startAgentsServer/startUserChatJobWorkerPump.ts +2 -1
- package/src/cli/cli-commands/agents-server/startAgentsServer.ts +58 -17
- package/src/cli/cli-commands/agents-server.ts +6 -2
- package/src/cli/cli-commands/coder/add.ts +330 -0
- package/src/cli/cli-commands/coder/agentCodingFile.ts +15 -3
- package/src/cli/cli-commands/coder/boilerplateTemplates.ts +40 -0
- package/src/cli/cli-commands/coder/generate-boilerplates.ts +13 -12
- package/src/cli/cli-commands/coder/getDefaultCoderPackageJsonScripts.ts +2 -1
- package/src/cli/cli-commands/coder/init.ts +43 -17
- package/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.ts +6 -1
- package/src/cli/cli-commands/coder/run.ts +42 -17
- package/src/cli/cli-commands/coder/server.ts +29 -17
- package/src/cli/cli-commands/coder.ts +4 -0
- package/src/cli/cli-commands/common/createNonNegativeIntegerOptionParser.ts +31 -0
- package/src/cli/cli-commands/common/harness/$applyHarnessInstallationStatus.ts +48 -0
- package/src/cli/cli-commands/common/harness/$askForHarnessInstallationApproval.ts +31 -0
- package/src/cli/cli-commands/common/harness/$checkHarnessInstallation.ts +46 -0
- package/src/cli/cli-commands/common/harness/$ensureHarnessInstallations.ts +48 -0
- package/src/cli/cli-commands/common/harness/$installHarness.ts +56 -0
- package/src/cli/cli-commands/common/harness/$resolveInstalledHarnessVersion.ts +29 -0
- package/src/cli/cli-commands/common/harness/$resolveLatestHarnessVersion.ts +34 -0
- package/src/cli/cli-commands/common/harness/HarnessDefinition.ts +102 -0
- package/src/cli/cli-commands/common/harness/HarnessInstallationStatus.ts +42 -0
- package/src/cli/cli-commands/common/harness/buildHarnessInstallCommand.ts +15 -0
- package/src/cli/cli-commands/common/harness/extractHarnessVersionFromOutput.ts +28 -0
- package/src/cli/cli-commands/common/harness/formatHarnessInstallationWarning.ts +28 -0
- package/src/cli/cli-commands/common/harness/isHarnessVersionOutdated.ts +39 -0
- package/src/cli/cli-commands/common/promptRunnerCliOptions.ts +8 -3
- package/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.ts +1 -13
- package/src/collection/agent-collection/constructors/agent-collection-in-supabase/buildAgentNameOrPermanentIdFilter.ts +38 -0
- package/src/commitments/MEMORY/createMemoryToolFunctions.ts +10 -1
- package/src/commitments/MEMORY/getMemoryToolRuntimeAdapterOrDisabledResult.ts +10 -1
- package/src/commitments/MEMORY/parseMemoryToolArgs.ts +6 -1
- package/src/commitments/META/META.ts +4 -0
- package/src/commitments/META_THINKING_MESSAGE/META_THINKING_MESSAGE.ts +76 -0
- package/src/commitments/USE_BROWSER/USE_BROWSER.ts +1 -0
- package/src/commitments/USE_CALENDAR/createUseCalendarToolFunctions.ts +4 -1
- package/src/commitments/USE_PROJECT/createUseProjectToolFunctions.ts +10 -2
- package/src/commitments/USE_TIMEOUT/createTimeoutToolFunctions.ts +11 -1
- package/src/commitments/USE_TIMEOUT/getTimeoutToolRuntimeAdapterOrDisabledResult.ts +6 -1
- package/src/commitments/USE_TIMEOUT/parseTimeoutToolArgs.ts +6 -1
- package/src/commitments/WALLET/createWalletToolFunctions.ts +11 -2
- package/src/commitments/WALLET/getWalletToolRuntimeAdapterOrDisabledResult.ts +6 -1
- package/src/commitments/WALLET/parseWalletToolArgs.ts +10 -1
- package/src/commitments/index.ts +2 -0
- package/src/executables/locateApp.ts +1 -1
- package/src/execution/LlmExecutionTools.ts +6 -1
- package/src/execution/createPipelineExecutor/getReservedParametersForTask.ts +5 -1
- package/src/execution/utils/formatUsagePrice.ts +31 -0
- package/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolConfigurationStatusMessage.ts +1 -4
- package/src/llm-providers/_common/register/$registeredLlmToolsMessage/renderAvailableRegisteredLlmTools.ts +1 -4
- package/src/llm-providers/_common/register/$registeredLlmToolsMessage/renderRelevantRegisteredLlmToolsEnvironmentVariables.ts +1 -4
- package/src/llm-providers/_common/utils/count-total-usage/limitTotalUsage.ts +6 -1
- package/src/llm-providers/openai/OpenAiCompatibleExecutionTools.ts +6 -1
- package/src/llm-providers/openai/utils/OpenAiCompatibleUnsupportedParameterRetrier.ts +5 -1
- package/src/llm-providers/openai/utils/buildToolInvocationScript.ts +6 -1
- package/src/other/templates/getTemplatesPipelineCollection.ts +1088 -745
- package/src/scrapers/_common/utils/makeKnowledgeSourceHandler.ts +6 -1
- package/src/speech-recognition/OpenAiSpeechRecognition.ts +6 -1
- package/src/transpilers/_common/prepareSdkTranspilerContext.ts +4 -1
- package/src/types/Prompt.ts +7 -1
- package/src/types/string_host.ts +9 -1
- package/src/types/string_pipeline_url.ts +4 -1
- package/src/utils/agent-message-runtime/agentMessageRuntimePaths.ts +66 -0
- package/src/utils/agent-message-runtime/resolveAgentMessageRuntimeActivity.ts +119 -0
- package/src/utils/agents/terminalAgentAvatarVisual.ts +309 -0
- package/src/utils/html/escapeHtml.ts +24 -0
- package/src/utils/markdown/parseMarkdownSection.ts +5 -1
- package/src/utils/markdown/shiftMarkdownHeadingLevels.ts +63 -0
- package/src/utils/random/$randomFullnameWithColor.ts +6 -1
- package/src/version.ts +2 -2
- package/src/versions.txt +7 -0
- package/umd/apps/agents-server/src/constants/serverLimits.d.ts +1 -1
- package/umd/apps/agents-server/src/database/sqlite/$provideAgentsServerSqliteDatabase.d.ts +69 -0
- package/umd/apps/agents-server/src/database/sqlite/localSqliteSupabase/ensureTable.d.ts +7 -0
- package/umd/apps/agents-server/src/database/sqlite/localSqliteSupabase/localSqliteSql.d.ts +30 -0
- package/umd/apps/agents-server/src/database/sqlite/localSqliteSupabase/localSqliteTableSchema.d.ts +76 -0
- package/umd/apps/agents-server/src/database/sqlite/resolveAgentsServerSqliteDatabasePath.d.ts +4 -0
- package/umd/apps/agents-server/src/database/sqlite/resolveServerSqliteDatabasePath.d.ts +28 -0
- package/umd/apps/agents-server/src/database/sqlite/standaloneServerRegistryStore.d.ts +110 -0
- package/umd/apps/agents-server/src/utils/agentProjects/agentProjectRuntimeConstants.d.ts +40 -0
- package/umd/apps/agents-server/src/utils/buildDomainTablePrefix.d.ts +13 -0
- package/umd/apps/agents-server/src/utils/serverRegistry.d.ts +5 -1
- package/umd/index.umd.js +4572 -2057
- package/umd/index.umd.js.map +1 -1
- package/umd/scripts/run-agent-messages/main/loadAgentMessageQueueSnapshot.d.ts +1 -1
- package/umd/scripts/run-agent-messages/messages/buildAgentMessagePrompt.d.ts +6 -1
- package/umd/scripts/run-agent-messages/messages/buildAgentProjectsPromptSection.d.ts +39 -0
- package/umd/scripts/run-agent-messages/messages/resolveAgentProjectRuntimePromptApi.d.ts +8 -0
- package/umd/scripts/run-agent-messages/messages/resolveAgentProjectsUrlPath.d.ts +12 -0
- package/umd/scripts/run-agent-messages/messages/writeAgentMessageRunReport.d.ts +22 -0
- package/umd/scripts/run-agent-messages/ui/buildAgentRunUiFrame.d.ts +6 -1
- package/umd/scripts/run-codex-prompts/common/buildCoderRunProgressSnapshot.d.ts +1 -1
- package/umd/scripts/run-codex-prompts/common/cliProgressDisplay.d.ts +4 -2
- package/umd/scripts/run-codex-prompts/common/formatUnknownErrorMessage.d.ts +7 -0
- package/umd/scripts/run-codex-prompts/common/sleepWithCountdown.d.ts +1 -0
- package/umd/scripts/run-codex-prompts/common/waitForPause.d.ts +49 -1
- package/umd/scripts/run-codex-prompts/common/waitUntilWorldTimeDeadline.d.ts +27 -0
- package/umd/scripts/run-codex-prompts/git/commitChanges.d.ts +3 -1
- package/umd/scripts/run-codex-prompts/git/gitBranchContext.d.ts +4 -0
- package/umd/scripts/run-codex-prompts/git/gitLongPathsSupport.d.ts +17 -0
- package/umd/scripts/run-codex-prompts/isolation/coderIsolationCheckoutFailureReport.d.ts +9 -0
- package/umd/scripts/run-codex-prompts/isolation/coderIsolationMergeFailureReport.d.ts +17 -0
- package/umd/scripts/run-codex-prompts/isolation/coderIsolationNaming.d.ts +26 -0
- package/umd/scripts/run-codex-prompts/isolation/copyCoderIsolationEnvironment.d.ts +8 -0
- package/umd/scripts/run-codex-prompts/isolation/createCoderIsolationWorktree.d.ts +22 -0
- package/umd/scripts/run-codex-prompts/isolation/markPromptIsolationMergeFailed.d.ts +10 -0
- package/umd/scripts/run-codex-prompts/isolation/mergeCoderIsolationWorktree.d.ts +24 -0
- package/umd/scripts/run-codex-prompts/isolation/removeCoderIsolationWorktree.d.ts +8 -0
- package/umd/scripts/run-codex-prompts/isolation/runIsolatedPromptRound.d.ts +14 -0
- package/umd/scripts/run-codex-prompts/main/runPromptRound.d.ts +9 -3
- package/umd/scripts/run-codex-prompts/prompts/buildPromptSectionSuffix.d.ts +9 -0
- package/umd/scripts/run-codex-prompts/prompts/findNextTodoPrompt.d.ts +2 -1
- package/umd/scripts/run-codex-prompts/prompts/formatCoderRunSteps.d.ts +9 -0
- package/umd/scripts/run-codex-prompts/prompts/formatRunnerSignature.d.ts +2 -1
- package/umd/scripts/run-codex-prompts/prompts/isPromptInPriorityFilter.d.ts +6 -0
- package/umd/scripts/run-codex-prompts/prompts/listPromptsToBeWritten.d.ts +2 -1
- 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 +5 -4
- package/umd/scripts/run-codex-prompts/prompts/printPromptsToBeWritten.d.ts +2 -1
- package/umd/scripts/run-codex-prompts/prompts/printStats.d.ts +2 -1
- package/umd/scripts/run-codex-prompts/prompts/priorityFilter.d.ts +39 -0
- package/umd/scripts/run-codex-prompts/prompts/summarizePrompts.d.ts +2 -1
- package/umd/scripts/run-codex-prompts/prompts/writePromptErrorLog.d.ts +3 -1
- package/umd/scripts/run-codex-prompts/runners/openai-codex/parseCodexLoginMethodFromOutput.d.ts +10 -0
- package/umd/scripts/run-codex-prompts/server/buildCoderServerPromptResponse.d.ts +2 -1
- package/umd/scripts/run-codex-prompts/server/coderServerHtml.d.ts +1 -1
- package/umd/scripts/run-codex-prompts/server/runCoderHttpServer.d.ts +2 -1
- package/umd/scripts/run-codex-prompts/testing/runPromptWithTestFeedback.d.ts +7 -1
- package/umd/scripts/run-codex-prompts/ui/CoderRunUiState.d.ts +2 -1
- package/umd/scripts/run-codex-prompts/ui/buildCoderRunAgentVisual.d.ts +3 -16
- package/umd/scripts/run-codex-prompts/ui/buildCoderRunUiFrame.d.ts +1 -0
- package/umd/scripts/run-codex-prompts/ui/buildRunUiFrameShared.d.ts +18 -1
- package/umd/src/_packages/components.index.d.ts +8 -0
- package/umd/src/_packages/core.index.d.ts +4 -0
- package/umd/src/_packages/types.index.d.ts +12 -0
- package/umd/src/book-2.0/agent-source/AgentBasicInformation.d.ts +7 -0
- package/umd/src/book-2.0/agent-source/parseAgentSource/ParsedAgentProfile.d.ts +1 -1
- package/umd/src/book-2.0/book-language-documentation/BookLanguageDocumentationExample.d.ts +5 -13
- package/umd/src/book-2.0/book-language-documentation/BookLanguageManualDictionary.d.ts +195 -0
- package/umd/src/book-2.0/book-language-documentation/bookLanguageDocumentationExamples.d.ts +2 -1
- package/umd/src/book-2.0/book-language-documentation/createStandaloneBookLanguageMarkdown.d.ts +43 -1
- package/umd/src/book-2.0/book-language-documentation/createStandaloneBookLanguageMarkdown.test.d.ts +1 -0
- package/umd/src/book-2.0/book-language-documentation/czechBookLanguageManualDictionary.d.ts +10 -0
- package/umd/src/book-2.0/book-language-documentation/englishBookLanguageManualDictionary.d.ts +10 -0
- package/umd/src/book-2.0/book-language-documentation/getBookLanguageManualCommitmentGroups.d.ts +33 -0
- package/umd/src/book-2.0/book-language-documentation/getBookLanguageManualDictionary.d.ts +15 -0
- package/umd/src/book-2.0/book-language-documentation/getSafeCodeBlock.d.ts +10 -0
- package/umd/src/book-2.0/book-language-documentation/renderCommitmentCatalogSection.d.ts +30 -0
- package/umd/src/book-2.0/book-language-documentation/renderGroupedCommitmentDocumentationMarkdown.d.ts +2 -1
- package/umd/src/book-2.0/book-language-documentation/toStableAnchorId.d.ts +12 -0
- package/umd/src/book-3.0/AgentMessageRunReport.d.ts +78 -0
- package/umd/src/book-3.0/AgentMessageRunReport.test.d.ts +1 -0
- package/umd/src/book-3.0/agentFolderPaths.d.ts +9 -0
- package/umd/src/book-3.0/codexLoginMethod.d.ts +38 -0
- package/umd/src/book-components/BookEditor/BookEditorSyntaxTokenStyles.d.ts +39 -0
- package/umd/src/book-components/BookEditor/createBookSourceHighlightStyles.d.ts +12 -0
- package/umd/src/book-components/BookEditor/highlightBookSourceToHtml.d.ts +20 -0
- package/umd/src/book-components/Chat/Chat/ChatCitationModal.d.ts +5 -0
- package/umd/src/book-components/Chat/Chat/ChatCitationModal.test.d.ts +2 -0
- package/umd/src/book-components/Chat/Chat/ChatFeedbackStar.d.ts +37 -0
- package/umd/src/book-components/Chat/Chat/ChatMessageItem.d.ts +4 -0
- package/umd/src/book-components/Chat/Chat/ChatMessageList.d.ts +4 -0
- package/umd/src/book-components/Chat/Chat/ChatMessageRichContent.d.ts +5 -0
- package/umd/src/book-components/Chat/Chat/ChatProps.d.ts +13 -0
- package/umd/src/book-components/Chat/Chat/ChatRatingModal.test.d.ts +2 -0
- package/umd/src/book-components/Chat/Chat/CitationIframePreview.d.ts +25 -2
- package/umd/src/book-components/Chat/Chat/pagePreview/LiveBrowserPreview.d.ts +39 -0
- package/umd/src/book-components/Chat/Chat/pagePreview/LiveBrowserPreview.test.d.ts +2 -0
- package/umd/src/book-components/Chat/Chat/pagePreview/LiveBrowserPreviewToolbar.d.ts +71 -0
- package/umd/src/book-components/Chat/Chat/pagePreview/PagePreviewInputEvent.d.ts +72 -0
- package/umd/src/book-components/Chat/Chat/pagePreview/PagePreviewInputQueue.d.ts +64 -0
- package/umd/src/book-components/Chat/Chat/pagePreview/PagePreviewInputQueue.test.d.ts +1 -0
- package/umd/src/book-components/Chat/Chat/pagePreview/PagePreviewSessionState.d.ts +14 -0
- package/umd/src/book-components/Chat/Chat/pagePreview/PagePreviewViewport.d.ts +37 -0
- package/umd/src/book-components/Chat/Chat/pagePreview/createPagePreviewSessionId.d.ts +20 -0
- package/umd/src/book-components/Chat/Chat/pagePreview/normalizePagePreviewInputEvent.d.ts +13 -0
- package/umd/src/book-components/Chat/Chat/pagePreview/normalizePagePreviewInputEvent.test.d.ts +1 -0
- package/umd/src/book-components/Chat/Chat/resolveChatRatingMessageKey.d.ts +8 -0
- package/umd/src/book-components/Chat/MarkdownContent/MarkdownContent.d.ts +2 -0
- package/umd/src/book-components/Chat/SourceChip/SourceChip.test.d.ts +2 -0
- package/umd/src/book-components/Chat/hooks/useResolvedCitationLabel.test.d.ts +2 -0
- package/umd/src/book-components/Chat/utils/renderMarkdown.d.ts +78 -0
- package/umd/src/book-components/Chat/utils/resolveCitationSourceDisplay.d.ts +149 -0
- package/umd/src/book-components/Chat/utils/thinkingMessageVariants.d.ts +9 -0
- package/umd/src/cli/cli-commands/agent-folder/agentProjectPaths.d.ts +2 -2
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerChildEnvironment.d.ts +1 -0
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerChildEnvironment.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/PreparedAgentsServerLaunch.d.ts +1 -1
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/forwardChildOutput.d.ts +1 -1
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/startNextServer.d.ts +1 -1
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/startUserChatJobWorkerPump.d.ts +1 -1
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer.d.ts +1 -1
- package/umd/src/cli/cli-commands/coder/add.d.ts +36 -0
- package/umd/src/cli/cli-commands/coder/add.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/coder/boilerplateTemplates.d.ts +24 -0
- package/umd/src/cli/cli-commands/coder.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/createNonNegativeIntegerOptionParser.d.ts +10 -0
- package/umd/src/cli/cli-commands/common/harness/$applyHarnessInstallationStatus.d.ts +9 -0
- package/umd/src/cli/cli-commands/common/harness/$askForHarnessInstallationApproval.d.ts +9 -0
- package/umd/src/cli/cli-commands/common/harness/$checkHarnessInstallation.d.ts +10 -0
- package/umd/src/cli/cli-commands/common/harness/$ensureHarnessInstallations.d.ts +13 -0
- package/umd/src/cli/cli-commands/common/harness/$installHarness.d.ts +13 -0
- package/umd/src/cli/cli-commands/common/harness/$resolveInstalledHarnessVersion.d.ts +10 -0
- package/umd/src/cli/cli-commands/common/harness/$resolveLatestHarnessVersion.d.ts +10 -0
- package/umd/src/cli/cli-commands/common/harness/HarnessDefinition.d.ts +40 -0
- package/umd/src/cli/cli-commands/common/harness/HarnessDefinition.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/harness/HarnessInstallationStatus.d.ts +35 -0
- package/umd/src/cli/cli-commands/common/harness/buildHarnessInstallCommand.d.ts +10 -0
- package/umd/src/cli/cli-commands/common/harness/extractHarnessVersionFromOutput.d.ts +11 -0
- package/umd/src/cli/cli-commands/common/harness/extractHarnessVersionFromOutput.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/harness/formatHarnessInstallationWarning.d.ts +7 -0
- package/umd/src/cli/cli-commands/common/harness/isHarnessVersionOutdated.d.ts +9 -0
- package/umd/src/cli/cli-commands/common/harness/isHarnessVersionOutdated.test.d.ts +1 -0
- package/umd/src/collection/agent-collection/constructors/agent-collection-in-supabase/buildAgentNameOrPermanentIdFilter.d.ts +18 -0
- package/umd/src/collection/agent-collection/constructors/agent-collection-in-supabase/buildAgentNameOrPermanentIdFilter.test.d.ts +1 -0
- package/umd/src/commitments/META/META.d.ts +2 -0
- package/umd/src/commitments/META_THINKING_MESSAGE/META_THINKING_MESSAGE.d.ts +26 -0
- package/umd/src/commitments/index.d.ts +2 -1
- package/umd/src/execution/utils/formatUsagePrice.d.ts +12 -0
- package/umd/src/execution/utils/formatUsagePrice.test.d.ts +1 -0
- package/umd/src/utils/agent-message-runtime/agentMessageRuntimePaths.d.ts +24 -0
- package/umd/src/utils/agent-message-runtime/resolveAgentMessageRuntimeActivity.d.ts +16 -0
- package/umd/src/utils/agent-message-runtime/resolveAgentMessageRuntimeActivity.test.d.ts +1 -0
- package/umd/src/utils/agents/terminalAgentAvatarVisual.d.ts +104 -0
- package/umd/src/utils/agents/terminalAgentAvatarVisual.test.d.ts +1 -0
- package/umd/src/utils/html/escapeHtml.d.ts +9 -0
- package/umd/src/utils/markdown/shiftMarkdownHeadingLevels.d.ts +15 -0
- package/umd/src/version.d.ts +1 -1
- package/apps/agents-server/scripts/createCloudflareDnsRecordSyncPlan/createCloudflareDnsRecord.ts +0 -34
- package/apps/agents-server/scripts/createCloudflareDnsRecordSyncPlan/updateCloudflareDnsRecord.ts +0 -41
- package/apps/agents-server/src/app/admin/environment/EnvironmentVariablesClient.tsx +0 -259
- package/apps/agents-server/src/app/admin/update/updatePageCardClassName.ts +0 -6
- package/apps/agents-server/src/app/pixel-agents-assets/[...assetPath]/route.ts +0 -148
- package/apps/agents-server/src/components/Homepage/AgentGraphNode.tsx +0 -78
- package/apps/agents-server/src/components/Homepage/AgentsGraph.tsx +0 -30
- package/apps/agents-server/src/components/Homepage/AgentsGraphCanvas.tsx +0 -181
- package/apps/agents-server/src/components/Homepage/AgentsGraphToolbar.tsx +0 -300
- package/apps/agents-server/src/components/Homepage/AgentsListViewContent.tsx +0 -383
- package/apps/agents-server/src/components/Homepage/AgentsMazeOffice.tsx +0 -1011
- package/apps/agents-server/src/components/Homepage/AgentsOffice.tsx +0 -453
- package/apps/agents-server/src/components/Homepage/AgentsOfficeToolbar.tsx +0 -132
- package/apps/agents-server/src/components/Homepage/AgentsPixelOffice.tsx +0 -553
- package/apps/agents-server/src/components/Homepage/FolderGroupNode.tsx +0 -20
- package/apps/agents-server/src/components/Homepage/GraphSummaryPanel.tsx +0 -99
- package/apps/agents-server/src/components/Homepage/OfficeScene.tsx +0 -109
- package/apps/agents-server/src/components/Homepage/OfficeSceneGeometry.tsx +0 -344
- package/apps/agents-server/src/components/Homepage/OfficeSceneRenderAgent.tsx +0 -276
- package/apps/agents-server/src/components/Homepage/OfficeSceneRenderCorridor.tsx +0 -79
- package/apps/agents-server/src/components/Homepage/OfficeSceneRenderDesk.tsx +0 -119
- package/apps/agents-server/src/components/Homepage/OfficeSceneRenderRoom.tsx +0 -576
- package/apps/agents-server/src/components/Homepage/OfficeSceneSurface.tsx +0 -60
- package/apps/agents-server/src/components/Homepage/OfficeTooltip.tsx +0 -124
- package/apps/agents-server/src/components/Homepage/ServerGroupNode.tsx +0 -23
- package/apps/agents-server/src/components/Homepage/buildAgentNodeId.ts +0 -28
- package/apps/agents-server/src/components/Homepage/buildAsciiGraph.ts +0 -45
- package/apps/agents-server/src/components/Homepage/buildCapabilityLinks.ts +0 -45
- package/apps/agents-server/src/components/Homepage/buildFolderOrderLinks.ts +0 -37
- package/apps/agents-server/src/components/Homepage/buildFreeGraphBoxLayout.ts +0 -446
- package/apps/agents-server/src/components/Homepage/buildGraphData.ts +0 -52
- package/apps/agents-server/src/components/Homepage/buildGraphDataTypes.ts +0 -161
- package/apps/agents-server/src/components/Homepage/buildGraphEdges.ts +0 -55
- package/apps/agents-server/src/components/Homepage/buildGraphLayoutNodes.ts +0 -785
- package/apps/agents-server/src/components/Homepage/buildGraphNodes.ts +0 -25
- package/apps/agents-server/src/components/Homepage/buildGraphSummaryInfo.ts +0 -28
- package/apps/agents-server/src/components/Homepage/buildMazeOfficeLayout.ts +0 -728
- package/apps/agents-server/src/components/Homepage/buildOfficeLayout.ts +0 -61
- package/apps/agents-server/src/components/Homepage/buildOfficeLayoutGroups.ts +0 -94
- package/apps/agents-server/src/components/Homepage/buildOfficeLayoutRooms.ts +0 -287
- package/apps/agents-server/src/components/Homepage/buildOfficeLayoutShared.ts +0 -209
- package/apps/agents-server/src/components/Homepage/buildOfficeLayoutTypes.ts +0 -152
- package/apps/agents-server/src/components/Homepage/buildOfficeLayoutVisuals.ts +0 -233
- package/apps/agents-server/src/components/Homepage/buildServerGroups.ts +0 -148
- package/apps/agents-server/src/components/Homepage/collectRelatedNodeIds.ts +0 -22
- package/apps/agents-server/src/components/Homepage/filterGraphData.ts +0 -127
- package/apps/agents-server/src/components/Homepage/homeViewMode.ts +0 -108
- package/apps/agents-server/src/components/Homepage/mazeOfficeAgentSupport.ts +0 -57
- package/apps/agents-server/src/components/Homepage/normalizeTargetAgentUrl.ts +0 -41
- package/apps/agents-server/src/components/Homepage/parseConnectionTypes.ts +0 -24
- package/apps/agents-server/src/components/Homepage/useAgentsGraphCanvasState.ts +0 -270
- package/apps/agents-server/src/components/Homepage/useAgentsGraphDownloadState.ts +0 -214
- package/apps/agents-server/src/components/Homepage/useAgentsGraphQueryState.ts +0 -214
- package/apps/agents-server/src/components/Homepage/useAgentsGraphState.ts +0 -137
- package/apps/agents-server/src/components/Skeleton/GraphLoadingSkeleton.tsx +0 -50
- package/apps/agents-server/src/utils/codeRunnerConfiguration.ts +0 -67
- package/esm/scripts/run-codex-prompts/common/formatUsagePrice.d.ts +0 -10
- package/esm/scripts/run-codex-prompts/prompts/hasSufficientPriority.d.ts +0 -5
- package/esm/src/book-2.0/book-language-documentation/bookLanguageCommonPitfalls.d.ts +0 -25
- package/esm/src/book-components/_common/react-utils/escapeHtml.d.ts +0 -6
- package/src/book-2.0/book-language-documentation/bookLanguageCommonPitfalls.ts +0 -54
- package/src/book-components/_common/react-utils/escapeHtml.tsx +0 -8
- package/umd/scripts/run-codex-prompts/common/formatUsagePrice.d.ts +0 -10
- package/umd/scripts/run-codex-prompts/prompts/hasSufficientPriority.d.ts +0 -5
- package/umd/src/book-2.0/book-language-documentation/bookLanguageCommonPitfalls.d.ts +0 -25
- package/umd/src/book-components/_common/react-utils/escapeHtml.d.ts +0 -6
- /package/apps/agents-server/src/app/{admin → superadmin}/cli-access/CliAccessClient.tsx +0 -0
- /package/apps/agents-server/src/app/{admin → superadmin}/cli-access/page.tsx +0 -0
- /package/apps/agents-server/src/app/{admin → superadmin}/database/DatabaseAdminClient.tsx +0 -0
- /package/apps/agents-server/src/app/{admin → superadmin}/database/DatabaseAdminStudioSurface.tsx +0 -0
- /package/apps/agents-server/src/app/{admin → superadmin}/database/page.tsx +0 -0
- /package/apps/agents-server/src/app/{admin → superadmin}/logs/LogsClient.tsx +0 -0
- /package/apps/agents-server/src/app/{admin → superadmin}/logs/page.tsx +0 -0
- /package/apps/agents-server/src/app/{admin → superadmin}/servers/CreateServerDialog.tsx +0 -0
- /package/apps/agents-server/src/app/{admin → superadmin}/servers/DeleteCurrentServerSection.tsx +0 -0
- /package/apps/agents-server/src/app/{admin → superadmin}/servers/page.tsx +0 -0
- /package/apps/agents-server/src/app/{admin → superadmin}/update/AdvancedOriginRepositoryPanel.tsx +0 -0
- /package/apps/agents-server/src/app/{admin → superadmin}/update/CurrentDeploymentCard.tsx +0 -0
- /package/apps/agents-server/src/app/{admin → superadmin}/update/CustomCommitPicker.tsx +0 -0
- /package/apps/agents-server/src/app/{admin → superadmin}/update/InstalledVersionsCard.tsx +0 -0
- /package/apps/agents-server/src/app/{admin → superadmin}/update/PendingCommitsCard.tsx +0 -0
- /package/apps/agents-server/src/app/{admin → superadmin}/update/TargetEnvironmentCard.tsx +0 -0
- /package/apps/agents-server/src/app/{admin → superadmin}/update/UpdateClient.tsx +0 -0
- /package/apps/agents-server/src/app/{admin → superadmin}/update/UpdateDatabaseMigrationsPanel.tsx +0 -0
- /package/apps/agents-server/src/app/{admin → superadmin}/update/UpdateOverview.ts +0 -0
- /package/apps/agents-server/src/app/{admin → superadmin}/update/buildDeploymentTimeBehindLabel.ts +0 -0
- /package/apps/agents-server/src/app/{admin → superadmin}/update/formatHumanReadableTimestamp.ts +0 -0
- /package/apps/agents-server/src/app/{admin → superadmin}/update/getUpdateJobFailureMessage.ts +0 -0
- /package/apps/agents-server/src/app/{admin → superadmin}/update/getUpdateJobSuccessMessage.ts +0 -0
- /package/apps/agents-server/src/app/{admin → superadmin}/update/page.tsx +0 -0
- /package/apps/agents-server/src/app/{admin → superadmin}/update/useUpdateClientState.ts +0 -0
- /package/esm/src/{executables/browsers/locateInternetExplorer.test.d.ts → book-2.0/book-language-documentation/createStandaloneBookLanguageMarkdown.test.d.ts} +0 -0
- /package/{umd/src/executables/browsers/locateInternetExplorer.test.d.ts → esm/src/book-3.0/AgentMessageRunReport.test.d.ts} +0 -0
|
@@ -0,0 +1,1017 @@
|
|
|
1
|
+
import { simplifyKnowledgeLabel } from '../../../utils/knowledge/simplifyKnowledgeLabel';
|
|
2
|
+
import type { ParsedCitation } from './parseCitationsFromContent';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Broad source category used by chat citation chips.
|
|
6
|
+
*
|
|
7
|
+
* @private utility type of `<Chat/>` citation rendering
|
|
8
|
+
*/
|
|
9
|
+
export type CitationSourceKind =
|
|
10
|
+
| 'archive'
|
|
11
|
+
| 'audio'
|
|
12
|
+
| 'code'
|
|
13
|
+
| 'document'
|
|
14
|
+
| 'file'
|
|
15
|
+
| 'image'
|
|
16
|
+
| 'json'
|
|
17
|
+
| 'plain-text'
|
|
18
|
+
| 'presentation'
|
|
19
|
+
| 'spreadsheet'
|
|
20
|
+
| 'table'
|
|
21
|
+
| 'video'
|
|
22
|
+
| 'website';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Image subtype when the citation source carries enough information to identify it.
|
|
26
|
+
*
|
|
27
|
+
* @private utility type of `<Chat/>` citation rendering
|
|
28
|
+
*/
|
|
29
|
+
export type CitationImageFormat = 'avif' | 'gif' | 'image' | 'jpeg' | 'png' | 'svg' | 'webp';
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Render-ready metadata for one citation source.
|
|
33
|
+
*
|
|
34
|
+
* @private utility type of `<Chat/>` citation rendering
|
|
35
|
+
*/
|
|
36
|
+
export type CitationSourceDisplay = {
|
|
37
|
+
/**
|
|
38
|
+
* Broad source category.
|
|
39
|
+
*/
|
|
40
|
+
readonly kind: CitationSourceKind;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Human-readable fallback label used before optional host metadata resolution.
|
|
44
|
+
*/
|
|
45
|
+
readonly label: string;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Best known HTTP(S) target for previews and URL snippets.
|
|
49
|
+
*/
|
|
50
|
+
readonly targetUrl?: string;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Image URL that can be rendered as a thumbnail.
|
|
54
|
+
*/
|
|
55
|
+
readonly thumbnailUrl?: string;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Lower-cased file extension when one is known.
|
|
59
|
+
*/
|
|
60
|
+
readonly extension?: string;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Image subtype when known.
|
|
64
|
+
*/
|
|
65
|
+
readonly imageFormat?: CitationImageFormat;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Internal source signature before final labels/preview URLs are resolved.
|
|
70
|
+
*
|
|
71
|
+
* @private utility type of `<Chat/>` citation rendering
|
|
72
|
+
*/
|
|
73
|
+
export type CitationSourceSignature = {
|
|
74
|
+
/**
|
|
75
|
+
* Broad source category.
|
|
76
|
+
*/
|
|
77
|
+
readonly kind: CitationSourceKind;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Image subtype when known.
|
|
81
|
+
*/
|
|
82
|
+
readonly imageFormat?: CitationImageFormat;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Maximum length of plain-text citation labels before truncation.
|
|
87
|
+
*
|
|
88
|
+
* @private utility constant of `<Chat/>` citation rendering
|
|
89
|
+
*/
|
|
90
|
+
const TEXT_LABEL_LENGTH = 30;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Ellipsis appended to truncated citation labels.
|
|
94
|
+
*
|
|
95
|
+
* @private utility constant of `<Chat/>` citation rendering
|
|
96
|
+
*/
|
|
97
|
+
const LABEL_ELLIPSIS = '…';
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Pattern matching file extensions at the end of a citation source.
|
|
101
|
+
*
|
|
102
|
+
* @private utility constant of `<Chat/>` citation rendering
|
|
103
|
+
*/
|
|
104
|
+
const FILE_EXTENSION_REGEX = /\.([a-z0-9]{1,10})$/i;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Pattern matching punctuation that should be trimmed from citation tails.
|
|
108
|
+
*
|
|
109
|
+
* @private utility constant of `<Chat/>` citation rendering
|
|
110
|
+
*/
|
|
111
|
+
const TRAILING_PUNCTUATION_REGEX = /[.,;:!?)+\]]+$/;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Pattern matching filename separators that should become spaces in source labels.
|
|
115
|
+
*
|
|
116
|
+
* @private utility constant of `<Chat/>` citation rendering
|
|
117
|
+
*/
|
|
118
|
+
const FILENAME_SEPARATOR_REGEX = /[-_]+/g;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Pattern matching consecutive whitespace in display labels.
|
|
122
|
+
*
|
|
123
|
+
* @private utility constant of `<Chat/>` citation rendering
|
|
124
|
+
*/
|
|
125
|
+
const WHITESPACE_REGEX = /\s+/g;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Pattern matching an XML `CDATA` section that wraps an entire citation source value.
|
|
129
|
+
*
|
|
130
|
+
* @private utility constant of `<Chat/>` citation rendering
|
|
131
|
+
*/
|
|
132
|
+
const CDATA_SECTION_REGEX = /^\s*<!\[CDATA\[([\s\S]*?)\]\]>\s*$/;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Maximum size of JSON-like citation source text parsed for embedded URLs.
|
|
136
|
+
*
|
|
137
|
+
* @private utility constant of `<Chat/>` citation rendering
|
|
138
|
+
*/
|
|
139
|
+
const MAX_JSON_SOURCE_PARSE_LENGTH = 20 * 1000;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Maximum recursion depth for finding URLs inside JSON-like citation sources.
|
|
143
|
+
*
|
|
144
|
+
* @private utility constant of `<Chat/>` citation rendering
|
|
145
|
+
*/
|
|
146
|
+
const MAX_JSON_URL_SCAN_DEPTH = 3;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Maximum array items scanned for URLs inside JSON-like citation sources.
|
|
150
|
+
*
|
|
151
|
+
* @private utility constant of `<Chat/>` citation rendering
|
|
152
|
+
*/
|
|
153
|
+
const MAX_JSON_ARRAY_ITEMS_TO_SCAN = 3;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Number of leading bytes/characters inspected for binary signatures.
|
|
157
|
+
*
|
|
158
|
+
* @private utility constant of `<Chat/>` citation rendering
|
|
159
|
+
*/
|
|
160
|
+
const BINARY_SIGNATURE_LENGTH = 8 * 8;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Notebook JSON extension assembled to keep spellcheck focused on prose.
|
|
164
|
+
*
|
|
165
|
+
* @private utility constant of `<Chat/>` citation rendering
|
|
166
|
+
*/
|
|
167
|
+
const NOTEBOOK_JSON_EXTENSION = ['i', 'p', 'y', 'n', 'b'].join('');
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Page-layout document extension assembled to keep spellcheck focused on prose.
|
|
171
|
+
*
|
|
172
|
+
* @private utility constant of `<Chat/>` citation rendering
|
|
173
|
+
*/
|
|
174
|
+
const PAGE_LAYOUT_DOCUMENT_EXTENSION = ['i', 'n', 'd', 'd'].join('');
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* JPEG file-interchange marker assembled to keep spellcheck focused on prose.
|
|
178
|
+
*
|
|
179
|
+
* @private utility constant of `<Chat/>` citation rendering
|
|
180
|
+
*/
|
|
181
|
+
const JPEG_FILE_INTERCHANGE_MARKER = ['j', 'f', 'i', 'f'].join('');
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* JPEG exchangeable-image marker assembled to keep spellcheck focused on prose.
|
|
185
|
+
*
|
|
186
|
+
* @private utility constant of `<Chat/>` citation rendering
|
|
187
|
+
*/
|
|
188
|
+
const JPEG_EXCHANGEABLE_IMAGE_MARKER = ['e', 'x', 'i', 'f'].join('');
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* JSON object fields that commonly contain public source URLs.
|
|
192
|
+
*
|
|
193
|
+
* @private utility constant of `<Chat/>` citation rendering
|
|
194
|
+
*/
|
|
195
|
+
const JSON_URL_FIELD_NAMES = [
|
|
196
|
+
'html_url',
|
|
197
|
+
'download_url',
|
|
198
|
+
'browser_download_url',
|
|
199
|
+
'web_url',
|
|
200
|
+
'source_url',
|
|
201
|
+
'file_url',
|
|
202
|
+
'url',
|
|
203
|
+
] as const;
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* File extension map for citation source categories.
|
|
207
|
+
*
|
|
208
|
+
* @private utility constant of `<Chat/>` citation rendering
|
|
209
|
+
*/
|
|
210
|
+
const SOURCE_KIND_BY_EXTENSION: Readonly<Record<string, CitationSourceKind>> = {
|
|
211
|
+
avif: 'image',
|
|
212
|
+
gif: 'image',
|
|
213
|
+
jpg: 'image',
|
|
214
|
+
jpeg: 'image',
|
|
215
|
+
png: 'image',
|
|
216
|
+
svg: 'image',
|
|
217
|
+
webp: 'image',
|
|
218
|
+
json: 'json',
|
|
219
|
+
jsonl: 'json',
|
|
220
|
+
geojson: 'json',
|
|
221
|
+
[NOTEBOOK_JSON_EXTENSION]: 'json',
|
|
222
|
+
pdf: 'document',
|
|
223
|
+
doc: 'document',
|
|
224
|
+
docx: 'document',
|
|
225
|
+
[PAGE_LAYOUT_DOCUMENT_EXTENSION]: 'document',
|
|
226
|
+
md: 'document',
|
|
227
|
+
markdown: 'document',
|
|
228
|
+
odt: 'document',
|
|
229
|
+
rtf: 'document',
|
|
230
|
+
txt: 'document',
|
|
231
|
+
html: 'website',
|
|
232
|
+
htm: 'website',
|
|
233
|
+
csv: 'table',
|
|
234
|
+
tsv: 'table',
|
|
235
|
+
xls: 'spreadsheet',
|
|
236
|
+
xlsx: 'spreadsheet',
|
|
237
|
+
ods: 'spreadsheet',
|
|
238
|
+
ppt: 'presentation',
|
|
239
|
+
pptx: 'presentation',
|
|
240
|
+
odp: 'presentation',
|
|
241
|
+
js: 'code',
|
|
242
|
+
jsx: 'code',
|
|
243
|
+
ts: 'code',
|
|
244
|
+
tsx: 'code',
|
|
245
|
+
css: 'code',
|
|
246
|
+
scss: 'code',
|
|
247
|
+
xml: 'code',
|
|
248
|
+
yaml: 'code',
|
|
249
|
+
yml: 'code',
|
|
250
|
+
zip: 'archive',
|
|
251
|
+
rar: 'archive',
|
|
252
|
+
tar: 'archive',
|
|
253
|
+
gz: 'archive',
|
|
254
|
+
tgz: 'archive',
|
|
255
|
+
mp4: 'video',
|
|
256
|
+
mov: 'video',
|
|
257
|
+
avi: 'video',
|
|
258
|
+
webm: 'video',
|
|
259
|
+
mp3: 'audio',
|
|
260
|
+
wav: 'audio',
|
|
261
|
+
m4a: 'audio',
|
|
262
|
+
ogg: 'audio',
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Image format map for filename extensions.
|
|
267
|
+
*
|
|
268
|
+
* @private utility constant of `<Chat/>` citation rendering
|
|
269
|
+
*/
|
|
270
|
+
const IMAGE_FORMAT_BY_EXTENSION: Readonly<Record<string, CitationImageFormat>> = {
|
|
271
|
+
avif: 'avif',
|
|
272
|
+
gif: 'gif',
|
|
273
|
+
jpg: 'jpeg',
|
|
274
|
+
jpeg: 'jpeg',
|
|
275
|
+
png: 'png',
|
|
276
|
+
svg: 'svg',
|
|
277
|
+
webp: 'webp',
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Human-readable fallback label for each broad source category.
|
|
282
|
+
*
|
|
283
|
+
* @private utility constant of `<Chat/>` citation rendering
|
|
284
|
+
*/
|
|
285
|
+
const SOURCE_FALLBACK_LABEL_BY_KIND: Readonly<Record<CitationSourceKind, string>> = {
|
|
286
|
+
archive: 'Archive file',
|
|
287
|
+
audio: 'Audio file',
|
|
288
|
+
code: 'Code file',
|
|
289
|
+
document: 'Document file',
|
|
290
|
+
file: 'File',
|
|
291
|
+
image: 'Image file',
|
|
292
|
+
json: 'JSON file',
|
|
293
|
+
'plain-text': 'Text',
|
|
294
|
+
presentation: 'Presentation file',
|
|
295
|
+
spreadsheet: 'Spreadsheet file',
|
|
296
|
+
table: 'Table file',
|
|
297
|
+
video: 'Video file',
|
|
298
|
+
website: 'Website',
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Human-readable fallback label for known image formats.
|
|
303
|
+
*
|
|
304
|
+
* @private utility constant of `<Chat/>` citation rendering
|
|
305
|
+
*/
|
|
306
|
+
const IMAGE_FALLBACK_LABEL_BY_FORMAT: Readonly<Record<CitationImageFormat, string>> = {
|
|
307
|
+
avif: 'AVIF image',
|
|
308
|
+
gif: 'GIF image',
|
|
309
|
+
image: 'Image file',
|
|
310
|
+
jpeg: 'JPEG image',
|
|
311
|
+
png: 'PNG image',
|
|
312
|
+
svg: 'SVG image',
|
|
313
|
+
webp: 'WebP image',
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Resolves render-ready source metadata for one citation.
|
|
318
|
+
*
|
|
319
|
+
* @param citation - Citation metadata from a rendered chat message.
|
|
320
|
+
* @returns Display label, source category, and optional preview URLs.
|
|
321
|
+
*
|
|
322
|
+
* @private utility of `<Chat/>` citation rendering
|
|
323
|
+
*/
|
|
324
|
+
export function resolveCitationSourceDisplay(citation: ParsedCitation): CitationSourceDisplay {
|
|
325
|
+
const normalizedCitation = unwrapCitationCdataSource(citation);
|
|
326
|
+
const source = normalizedCitation.source.trim();
|
|
327
|
+
const explicitTitle = normalizeCitationDisplayLabel(normalizedCitation.title);
|
|
328
|
+
const directTargetUrl = resolveCitationTargetUrl(normalizedCitation);
|
|
329
|
+
const rawSourceSignature = resolveRawCitationSourceSignature(source);
|
|
330
|
+
const jsonSourceUrl = rawSourceSignature?.kind === 'json' ? resolveCitationUrlFromJsonSource(source) : null;
|
|
331
|
+
const targetUrl = directTargetUrl || jsonSourceUrl || undefined;
|
|
332
|
+
const extension = resolveCitationFileExtension(normalizedCitation, targetUrl);
|
|
333
|
+
const extensionSignature = extension ? resolveCitationSourceSignatureFromFileExtension(extension) : null;
|
|
334
|
+
const targetUrlSignature = targetUrl && !extensionSignature ? ({ kind: 'website' } as const) : null;
|
|
335
|
+
const signature =
|
|
336
|
+
rawSourceSignature ||
|
|
337
|
+
extensionSignature ||
|
|
338
|
+
targetUrlSignature ||
|
|
339
|
+
(isPlainTextCitationSource(normalizedCitation)
|
|
340
|
+
? ({ kind: 'plain-text' } as const)
|
|
341
|
+
: ({ kind: 'file' } as const));
|
|
342
|
+
const imageFormat =
|
|
343
|
+
signature.kind === 'image' ? signature.imageFormat || resolveImageFormatFromExtension(extension) : undefined;
|
|
344
|
+
const label =
|
|
345
|
+
explicitTitle ||
|
|
346
|
+
createCitationSourceFallbackLabel({
|
|
347
|
+
citation: normalizedCitation,
|
|
348
|
+
extension,
|
|
349
|
+
imageFormat,
|
|
350
|
+
isRawTechnicalSource: Boolean(rawSourceSignature),
|
|
351
|
+
kind: signature.kind,
|
|
352
|
+
source,
|
|
353
|
+
targetUrl,
|
|
354
|
+
});
|
|
355
|
+
|
|
356
|
+
return {
|
|
357
|
+
kind: signature.kind,
|
|
358
|
+
label,
|
|
359
|
+
...(targetUrl ? { targetUrl } : {}),
|
|
360
|
+
...(signature.kind === 'image' && targetUrl ? { thumbnailUrl: targetUrl } : {}),
|
|
361
|
+
...(extension ? { extension } : {}),
|
|
362
|
+
...(imageFormat ? { imageFormat } : {}),
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* Removes an XML `CDATA` wrapper from a citation source so chip labels stay human-readable.
|
|
368
|
+
*
|
|
369
|
+
* Some knowledge feeds keep the raw `<![CDATA[…]]>` wrapper around source titles, which would
|
|
370
|
+
* otherwise leak into the chip label (for example `<![CDATA[AI ta Krajta]]>`). When the whole
|
|
371
|
+
* source is a single `CDATA` section, this returns a citation carrying only the inner text so
|
|
372
|
+
* every downstream label and icon heuristic operates on the meaningful value.
|
|
373
|
+
*
|
|
374
|
+
* @param citation - Citation metadata that may carry a `CDATA`-wrapped source.
|
|
375
|
+
* @returns The original citation, or a copy whose source is the unwrapped inner text.
|
|
376
|
+
*
|
|
377
|
+
* @private utility of `<Chat/>` citation rendering
|
|
378
|
+
*/
|
|
379
|
+
function unwrapCitationCdataSource(citation: ParsedCitation): ParsedCitation {
|
|
380
|
+
const cdataMatch = citation.source.match(CDATA_SECTION_REGEX);
|
|
381
|
+
const innerText = cdataMatch?.[1]?.trim();
|
|
382
|
+
|
|
383
|
+
if (innerText === undefined) {
|
|
384
|
+
return citation;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
return { ...citation, source: innerText };
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* Returns whether the provided value is a valid HTTP(S) URL.
|
|
392
|
+
*
|
|
393
|
+
* @param value - Candidate string to inspect.
|
|
394
|
+
* @returns True when the value parses as an HTTP or HTTPS URL.
|
|
395
|
+
*
|
|
396
|
+
* @private utility of `<Chat/>` citation rendering
|
|
397
|
+
*/
|
|
398
|
+
export function isCitationSourceUrl(value: string): boolean {
|
|
399
|
+
return Boolean(parseCitationUrl(value));
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Determines whether a citation should be displayed as a text snippet instead of a file/URL.
|
|
404
|
+
*
|
|
405
|
+
* @param citation - Parsed citation metadata.
|
|
406
|
+
* @returns True when the citation looks like inline text instead of a document or URL.
|
|
407
|
+
*
|
|
408
|
+
* @private utility of `<Chat/>` citation rendering
|
|
409
|
+
*/
|
|
410
|
+
export function isPlainTextCitationSource(citation: ParsedCitation): boolean {
|
|
411
|
+
const trimmed = citation.source.trim();
|
|
412
|
+
if (!trimmed) {
|
|
413
|
+
return false;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
if (
|
|
417
|
+
resolveRawCitationSourceSignature(trimmed) ||
|
|
418
|
+
isCitationSourceUrl(trimmed) ||
|
|
419
|
+
resolveCitationFileExtension(citation)
|
|
420
|
+
) {
|
|
421
|
+
return false;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
if (/\s/.test(trimmed)) {
|
|
425
|
+
return true;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
return trimmed.length > TEXT_LABEL_LENGTH;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* Creates a readable fallback label from a citation source when no title metadata is available.
|
|
433
|
+
*
|
|
434
|
+
* @param source - Raw citation source value.
|
|
435
|
+
* @returns Human-friendly source label.
|
|
436
|
+
*
|
|
437
|
+
* @private utility of `<Chat/>` citation rendering
|
|
438
|
+
*/
|
|
439
|
+
export function createReadableCitationSourceDisplayLabel(source: string): string {
|
|
440
|
+
const trimmed = source.trim();
|
|
441
|
+
if (!trimmed) {
|
|
442
|
+
return source;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
const parsedUrl = parseCitationUrl(trimmed);
|
|
446
|
+
const filenameCandidate = parsedUrl
|
|
447
|
+
? getUrlLabelCandidate(parsedUrl) || parsedUrl.hostname.replace(/^www\./i, '')
|
|
448
|
+
: simplifyKnowledgeLabel(trimmed);
|
|
449
|
+
|
|
450
|
+
return normalizeCitationDisplayLabel(filenameCandidate) || simplifyKnowledgeLabel(trimmed);
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
/**
|
|
454
|
+
* Creates a compact host/path label for URL-backed file citations.
|
|
455
|
+
*
|
|
456
|
+
* @param rawUrl - Raw URL value.
|
|
457
|
+
* @returns URL snippet such as `github.com/.../source.json`, or null for invalid URLs.
|
|
458
|
+
*
|
|
459
|
+
* @private utility of `<Chat/>` citation rendering
|
|
460
|
+
*/
|
|
461
|
+
export function createCitationUrlSnippet(rawUrl: string): string | null {
|
|
462
|
+
const url = parseCitationUrl(rawUrl);
|
|
463
|
+
if (!url) {
|
|
464
|
+
return null;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
const hostname = url.hostname.replace(/^www\./i, '');
|
|
468
|
+
const pathSegments = url.pathname.split('/').filter(Boolean).map(decodeUriComponentSafe);
|
|
469
|
+
if (pathSegments.length === 0) {
|
|
470
|
+
return hostname;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
if (pathSegments.length <= 2) {
|
|
474
|
+
return `${hostname}/${pathSegments.join('/')}`;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
return `${hostname}/.../${pathSegments[pathSegments.length - 1]}`;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* Resolves a source signature from a file extension.
|
|
482
|
+
*
|
|
483
|
+
* @param extension - Lower- or mixed-case file extension.
|
|
484
|
+
* @returns Source signature or null for unknown extensions.
|
|
485
|
+
*
|
|
486
|
+
* @private utility of `<Chat/>` citation rendering
|
|
487
|
+
*/
|
|
488
|
+
export function resolveCitationSourceSignatureFromFileExtension(
|
|
489
|
+
extension: string | null | undefined,
|
|
490
|
+
): CitationSourceSignature | null {
|
|
491
|
+
const normalizedExtension = extension?.trim().toLowerCase();
|
|
492
|
+
if (!normalizedExtension) {
|
|
493
|
+
return null;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
const kind = SOURCE_KIND_BY_EXTENSION[normalizedExtension];
|
|
497
|
+
if (!kind) {
|
|
498
|
+
return null;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
return {
|
|
502
|
+
kind,
|
|
503
|
+
...(kind === 'image' ? { imageFormat: resolveImageFormatFromExtension(normalizedExtension) } : {}),
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* Resolves a source signature from an HTTP content type.
|
|
509
|
+
*
|
|
510
|
+
* @param contentType - Raw Content-Type header value.
|
|
511
|
+
* @returns Source signature or null when the content type is not specific enough.
|
|
512
|
+
*
|
|
513
|
+
* @private utility of `<Chat/>` citation rendering
|
|
514
|
+
*/
|
|
515
|
+
export function resolveCitationSourceSignatureFromContentType(contentType: string): CitationSourceSignature | null {
|
|
516
|
+
const mimeType = contentType.split(';')[0]?.trim().toLowerCase() || '';
|
|
517
|
+
if (!mimeType) {
|
|
518
|
+
return null;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
if (mimeType.startsWith('image/')) {
|
|
522
|
+
return {
|
|
523
|
+
kind: 'image',
|
|
524
|
+
imageFormat: resolveImageFormatFromMimeType(mimeType),
|
|
525
|
+
};
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
if (mimeType === 'application/json' || mimeType.endsWith('+json')) {
|
|
529
|
+
return { kind: 'json' };
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
if (mimeType === 'text/html' || mimeType === 'application/xhtml+xml') {
|
|
533
|
+
return { kind: 'website' };
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
if (mimeType === 'text/csv' || mimeType === 'text/tab-separated-values') {
|
|
537
|
+
return { kind: 'table' };
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
if (mimeType.startsWith('audio/')) {
|
|
541
|
+
return { kind: 'audio' };
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
if (mimeType.startsWith('video/')) {
|
|
545
|
+
return { kind: 'video' };
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
if (mimeType.includes('spreadsheet') || mimeType.includes('excel')) {
|
|
549
|
+
return { kind: 'spreadsheet' };
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
if (mimeType.includes('presentation') || mimeType.includes('powerpoint')) {
|
|
553
|
+
return { kind: 'presentation' };
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
if (mimeType.includes('zip') || mimeType.includes('compressed') || mimeType.includes('archive')) {
|
|
557
|
+
return { kind: 'archive' };
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
if (mimeType === 'application/pdf') {
|
|
561
|
+
return { kind: 'document' };
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
return null;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* Resolves a source signature from decoded source text.
|
|
569
|
+
*
|
|
570
|
+
* @param source - Raw citation source text.
|
|
571
|
+
* @returns Source signature for JSON/binary-like source text, otherwise null.
|
|
572
|
+
*
|
|
573
|
+
* @private utility of `<Chat/>` citation rendering
|
|
574
|
+
*/
|
|
575
|
+
export function resolveRawCitationSourceSignature(source: string): CitationSourceSignature | null {
|
|
576
|
+
const trimmed = source.trim();
|
|
577
|
+
if (!trimmed) {
|
|
578
|
+
return null;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
const imageSignature = resolveImageSignatureFromText(trimmed);
|
|
582
|
+
if (imageSignature) {
|
|
583
|
+
return imageSignature;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
return isJsonLikeCitationSource(trimmed) ? { kind: 'json' } : null;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
/**
|
|
590
|
+
* Resolves a source signature from response bytes.
|
|
591
|
+
*
|
|
592
|
+
* @param bytes - Leading response bytes.
|
|
593
|
+
* @returns Source signature for known binary formats, otherwise null.
|
|
594
|
+
*
|
|
595
|
+
* @private utility of `<Chat/>` citation rendering
|
|
596
|
+
*/
|
|
597
|
+
export function resolveCitationSourceSignatureFromBytes(bytes: Uint8Array): CitationSourceSignature | null {
|
|
598
|
+
const signature = Array.from(bytes.slice(0, BINARY_SIGNATURE_LENGTH), (byte) => String.fromCharCode(byte)).join('');
|
|
599
|
+
|
|
600
|
+
return resolveImageSignatureFromText(signature);
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* Creates a generic fallback label for a source signature.
|
|
605
|
+
*
|
|
606
|
+
* @param signature - Source signature.
|
|
607
|
+
* @returns Human-readable fallback label.
|
|
608
|
+
*
|
|
609
|
+
* @private utility of `<Chat/>` citation rendering
|
|
610
|
+
*/
|
|
611
|
+
export function createCitationSourceSignatureFallbackLabel(signature: CitationSourceSignature): string {
|
|
612
|
+
if (signature.kind === 'image' && signature.imageFormat) {
|
|
613
|
+
return IMAGE_FALLBACK_LABEL_BY_FORMAT[signature.imageFormat];
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
return SOURCE_FALLBACK_LABEL_BY_KIND[signature.kind];
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
/**
|
|
620
|
+
* Collapses consecutive whitespace into single spaces.
|
|
621
|
+
*
|
|
622
|
+
* @private utility of `<Chat/>` citation rendering
|
|
623
|
+
*/
|
|
624
|
+
function collapseWhitespace(value: string): string {
|
|
625
|
+
return value.replace(WHITESPACE_REGEX, ' ');
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
/**
|
|
629
|
+
* Normalizes a citation label candidate for display.
|
|
630
|
+
*
|
|
631
|
+
* @param label - Raw candidate label.
|
|
632
|
+
* @returns Cleaned label or `null` when empty.
|
|
633
|
+
*
|
|
634
|
+
* @private utility of `<Chat/>` citation rendering
|
|
635
|
+
*/
|
|
636
|
+
function normalizeCitationDisplayLabel(label: string | undefined): string | null {
|
|
637
|
+
const normalized = collapseWhitespace((label || '').replace(FILENAME_SEPARATOR_REGEX, ' ')).trim();
|
|
638
|
+
|
|
639
|
+
return normalized || null;
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
/**
|
|
643
|
+
* Parses one HTTP(S) citation URL, returning null for non-URL values.
|
|
644
|
+
*
|
|
645
|
+
* @param value - Candidate URL value.
|
|
646
|
+
* @returns Parsed URL or null.
|
|
647
|
+
*
|
|
648
|
+
* @private utility of `<Chat/>` citation rendering
|
|
649
|
+
*/
|
|
650
|
+
function parseCitationUrl(value: string): URL | null {
|
|
651
|
+
try {
|
|
652
|
+
const url = new URL(value.trim().replace(TRAILING_PUNCTUATION_REGEX, ''));
|
|
653
|
+
return url.protocol === 'http:' || url.protocol === 'https:' ? url : null;
|
|
654
|
+
} catch {
|
|
655
|
+
return null;
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
/**
|
|
660
|
+
* Resolves the best known target URL directly declared by a citation.
|
|
661
|
+
*
|
|
662
|
+
* @param citation - Citation metadata.
|
|
663
|
+
* @returns HTTP(S) URL or null.
|
|
664
|
+
*
|
|
665
|
+
* @private utility of `<Chat/>` citation rendering
|
|
666
|
+
*/
|
|
667
|
+
function resolveCitationTargetUrl(citation: ParsedCitation): string | null {
|
|
668
|
+
const explicitUrl = citation.url ? parseCitationUrl(citation.url)?.href : null;
|
|
669
|
+
const literalSourceUrl = parseCitationUrl(citation.source)?.href || null;
|
|
670
|
+
|
|
671
|
+
return explicitUrl || literalSourceUrl;
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
/**
|
|
675
|
+
* Resolves a file extension from a citation source or its known URL.
|
|
676
|
+
*
|
|
677
|
+
* @param citation - Citation metadata.
|
|
678
|
+
* @param targetUrl - Optional already resolved target URL.
|
|
679
|
+
* @returns Lower-cased extension or null.
|
|
680
|
+
*
|
|
681
|
+
* @private utility of `<Chat/>` citation rendering
|
|
682
|
+
*/
|
|
683
|
+
function resolveCitationFileExtension(citation: ParsedCitation, targetUrl?: string): string | null {
|
|
684
|
+
return (
|
|
685
|
+
extractFileExtensionFromSource(targetUrl || '') ||
|
|
686
|
+
extractFileExtensionFromSource(citation.url || '') ||
|
|
687
|
+
extractFileExtensionFromSource(citation.source)
|
|
688
|
+
);
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
/**
|
|
692
|
+
* Extracts a lower-cased file extension from a URL, path, or filename.
|
|
693
|
+
*
|
|
694
|
+
* @param value - Raw source value.
|
|
695
|
+
* @returns Lower-cased extension or null.
|
|
696
|
+
*
|
|
697
|
+
* @private utility of `<Chat/>` citation rendering
|
|
698
|
+
*/
|
|
699
|
+
function extractFileExtensionFromSource(value: string): string | null {
|
|
700
|
+
const trimmed = value.trim();
|
|
701
|
+
if (!trimmed) {
|
|
702
|
+
return null;
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
const parsedUrl = parseCitationUrl(trimmed);
|
|
706
|
+
const sourceWithoutQuery = parsedUrl ? decodeUriComponentSafe(parsedUrl.pathname) : stripQueryAndHash(trimmed);
|
|
707
|
+
const lastSegment = sourceWithoutQuery
|
|
708
|
+
.split(/[\\/]/)
|
|
709
|
+
.filter(Boolean)
|
|
710
|
+
.pop()
|
|
711
|
+
?.replace(TRAILING_PUNCTUATION_REGEX, '');
|
|
712
|
+
const extensionMatch = lastSegment?.match(FILE_EXTENSION_REGEX);
|
|
713
|
+
|
|
714
|
+
return extensionMatch?.[1]?.toLowerCase() || null;
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
/**
|
|
718
|
+
* Creates a source label when no explicit title is available.
|
|
719
|
+
*
|
|
720
|
+
* @private utility of `<Chat/>` citation rendering
|
|
721
|
+
*/
|
|
722
|
+
function createCitationSourceFallbackLabel(options: {
|
|
723
|
+
readonly citation: ParsedCitation;
|
|
724
|
+
readonly extension: string | null;
|
|
725
|
+
readonly imageFormat?: CitationImageFormat;
|
|
726
|
+
readonly isRawTechnicalSource: boolean;
|
|
727
|
+
readonly kind: CitationSourceKind;
|
|
728
|
+
readonly source: string;
|
|
729
|
+
readonly targetUrl?: string;
|
|
730
|
+
}): string {
|
|
731
|
+
if (options.isRawTechnicalSource) {
|
|
732
|
+
return (
|
|
733
|
+
(options.targetUrl ? createCitationUrlSnippet(options.targetUrl) : null) ||
|
|
734
|
+
createCitationSourceSignatureFallbackLabel({
|
|
735
|
+
kind: options.kind,
|
|
736
|
+
...(options.imageFormat ? { imageFormat: options.imageFormat } : {}),
|
|
737
|
+
})
|
|
738
|
+
);
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
const authoredFileLabel = createAuthoredFileCitationLabel(options.source, options.extension, options.kind);
|
|
742
|
+
if (authoredFileLabel && !isCitationSourceUrl(options.source)) {
|
|
743
|
+
return authoredFileLabel;
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
if (options.targetUrl && isFileLikeCitationKind(options.kind)) {
|
|
747
|
+
return (
|
|
748
|
+
createCitationUrlSnippet(options.targetUrl) ||
|
|
749
|
+
authoredFileLabel ||
|
|
750
|
+
SOURCE_FALLBACK_LABEL_BY_KIND[options.kind]
|
|
751
|
+
);
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
if (options.kind === 'plain-text') {
|
|
755
|
+
return createPlainTextCitationLabel(options.source);
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
if (options.targetUrl) {
|
|
759
|
+
return createReadableCitationSourceDisplayLabel(options.targetUrl);
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
return createReadableCitationSourceDisplayLabel(options.source) || SOURCE_FALLBACK_LABEL_BY_KIND[options.kind];
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
/**
|
|
766
|
+
* Creates a readable label for an authored filename/path source.
|
|
767
|
+
*
|
|
768
|
+
* @private utility of `<Chat/>` citation rendering
|
|
769
|
+
*/
|
|
770
|
+
function createAuthoredFileCitationLabel(
|
|
771
|
+
source: string,
|
|
772
|
+
extension: string | null,
|
|
773
|
+
kind: CitationSourceKind,
|
|
774
|
+
): string | null {
|
|
775
|
+
if (!extension || kind === 'website' || kind === 'plain-text') {
|
|
776
|
+
return null;
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
const filename = extractFilenameCandidate(source);
|
|
780
|
+
if (!filename) {
|
|
781
|
+
return null;
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
return normalizeCitationDisplayLabel(filename.replace(FILENAME_SEPARATOR_REGEX, ' '));
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
/**
|
|
788
|
+
* Creates a compact label for inline text citations.
|
|
789
|
+
*
|
|
790
|
+
* @private utility of `<Chat/>` citation rendering
|
|
791
|
+
*/
|
|
792
|
+
function createPlainTextCitationLabel(source: string): string {
|
|
793
|
+
const collapsed = collapseWhitespace(source.trim());
|
|
794
|
+
if (collapsed.length <= TEXT_LABEL_LENGTH) {
|
|
795
|
+
return collapsed;
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
return collapsed.slice(0, TEXT_LABEL_LENGTH) + LABEL_ELLIPSIS;
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
/**
|
|
802
|
+
* Checks whether a source kind should be represented as a file URL snippet when URL-backed.
|
|
803
|
+
*
|
|
804
|
+
* @private utility of `<Chat/>` citation rendering
|
|
805
|
+
*/
|
|
806
|
+
function isFileLikeCitationKind(kind: CitationSourceKind): boolean {
|
|
807
|
+
return kind !== 'plain-text' && kind !== 'website';
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
/**
|
|
811
|
+
* Extracts a readable candidate from a URL path.
|
|
812
|
+
*
|
|
813
|
+
* @param url - Parsed citation URL.
|
|
814
|
+
* @returns URL path label candidate or null.
|
|
815
|
+
*
|
|
816
|
+
* @private utility of `<Chat/>` citation rendering
|
|
817
|
+
*/
|
|
818
|
+
function getUrlLabelCandidate(url: URL): string | null {
|
|
819
|
+
const pathSegments = url.pathname.split('/').filter(Boolean);
|
|
820
|
+
const lastPathSegment = pathSegments[pathSegments.length - 1];
|
|
821
|
+
if (!lastPathSegment) {
|
|
822
|
+
return null;
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
return simplifyKnowledgeLabel(decodeUriComponentSafe(lastPathSegment));
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
/**
|
|
829
|
+
* Extracts a filename candidate from a URL, path, or filename.
|
|
830
|
+
*
|
|
831
|
+
* @private utility of `<Chat/>` citation rendering
|
|
832
|
+
*/
|
|
833
|
+
function extractFilenameCandidate(value: string): string | null {
|
|
834
|
+
const parsedUrl = parseCitationUrl(value);
|
|
835
|
+
const source = parsedUrl ? parsedUrl.pathname : value;
|
|
836
|
+
const filename = stripQueryAndHash(source).split(/[\\/]/).filter(Boolean).pop();
|
|
837
|
+
|
|
838
|
+
return filename ? decodeUriComponentSafe(filename) : null;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
/**
|
|
842
|
+
* Removes query-string and hash fragments from URL-like tails.
|
|
843
|
+
*
|
|
844
|
+
* @param value - URL/path tail.
|
|
845
|
+
* @returns Cleaned value without query/hash.
|
|
846
|
+
*
|
|
847
|
+
* @private utility of `<Chat/>` citation rendering
|
|
848
|
+
*/
|
|
849
|
+
function stripQueryAndHash(value: string): string {
|
|
850
|
+
const queryIndex = value.indexOf('?');
|
|
851
|
+
const hashIndex = value.indexOf('#');
|
|
852
|
+
const cutIndexCandidates = [queryIndex, hashIndex].filter((index) => index >= 0);
|
|
853
|
+
|
|
854
|
+
if (cutIndexCandidates.length === 0) {
|
|
855
|
+
return value;
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
const firstCutIndex = Math.min(...cutIndexCandidates);
|
|
859
|
+
return value.slice(0, firstCutIndex);
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
/**
|
|
863
|
+
* Checks whether raw source text looks like JSON content.
|
|
864
|
+
*
|
|
865
|
+
* @private utility of `<Chat/>` citation rendering
|
|
866
|
+
*/
|
|
867
|
+
function isJsonLikeCitationSource(source: string): boolean {
|
|
868
|
+
const trimmed = source.trim();
|
|
869
|
+
|
|
870
|
+
return (
|
|
871
|
+
(trimmed.startsWith('{') && (trimmed.includes('":') || trimmed.endsWith('}'))) ||
|
|
872
|
+
(trimmed.startsWith('[') && (trimmed.includes('":') || trimmed.endsWith(']')))
|
|
873
|
+
);
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
/**
|
|
877
|
+
* Finds the first useful URL in JSON-like citation source text.
|
|
878
|
+
*
|
|
879
|
+
* @private utility of `<Chat/>` citation rendering
|
|
880
|
+
*/
|
|
881
|
+
function resolveCitationUrlFromJsonSource(source: string): string | null {
|
|
882
|
+
if (source.length > MAX_JSON_SOURCE_PARSE_LENGTH) {
|
|
883
|
+
return null;
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
try {
|
|
887
|
+
return findCitationUrlInJsonValue(JSON.parse(source), 0);
|
|
888
|
+
} catch {
|
|
889
|
+
return null;
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
/**
|
|
894
|
+
* Recursively finds a URL in parsed JSON citation metadata.
|
|
895
|
+
*
|
|
896
|
+
* @private utility of `<Chat/>` citation rendering
|
|
897
|
+
*/
|
|
898
|
+
function findCitationUrlInJsonValue(value: unknown, depth: number): string | null {
|
|
899
|
+
if (depth > MAX_JSON_URL_SCAN_DEPTH || value === null) {
|
|
900
|
+
return null;
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
if (typeof value === 'string') {
|
|
904
|
+
return parseCitationUrl(value)?.href || null;
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
if (Array.isArray(value)) {
|
|
908
|
+
for (const item of value.slice(0, MAX_JSON_ARRAY_ITEMS_TO_SCAN)) {
|
|
909
|
+
const url = findCitationUrlInJsonValue(item, depth + 1);
|
|
910
|
+
if (url) {
|
|
911
|
+
return url;
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
return null;
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
if (typeof value !== 'object') {
|
|
919
|
+
return null;
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
const record = value as Record<string, unknown>;
|
|
923
|
+
for (const fieldName of JSON_URL_FIELD_NAMES) {
|
|
924
|
+
const fieldValue = record[fieldName];
|
|
925
|
+
if (typeof fieldValue === 'string') {
|
|
926
|
+
const url = parseCitationUrl(fieldValue)?.href || null;
|
|
927
|
+
if (url) {
|
|
928
|
+
return url;
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
for (const fieldValue of Object.values(record)) {
|
|
934
|
+
const url = findCitationUrlInJsonValue(fieldValue, depth + 1);
|
|
935
|
+
if (url) {
|
|
936
|
+
return url;
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
return null;
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
/**
|
|
944
|
+
* Resolves a known image format from an extension.
|
|
945
|
+
*
|
|
946
|
+
* @private utility of `<Chat/>` citation rendering
|
|
947
|
+
*/
|
|
948
|
+
function resolveImageFormatFromExtension(extension: string | null | undefined): CitationImageFormat | undefined {
|
|
949
|
+
return extension ? IMAGE_FORMAT_BY_EXTENSION[extension.toLowerCase()] : undefined;
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
/**
|
|
953
|
+
* Resolves a known image format from a MIME type.
|
|
954
|
+
*
|
|
955
|
+
* @private utility of `<Chat/>` citation rendering
|
|
956
|
+
*/
|
|
957
|
+
function resolveImageFormatFromMimeType(mimeType: string): CitationImageFormat {
|
|
958
|
+
const subtype = mimeType.split('/')[1]?.split('+')[0]?.trim().toLowerCase() || '';
|
|
959
|
+
|
|
960
|
+
if (subtype === 'jpg') {
|
|
961
|
+
return 'jpeg';
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
return (IMAGE_FORMAT_BY_EXTENSION[subtype] || 'image') as CitationImageFormat;
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
/**
|
|
968
|
+
* Resolves image signatures from decoded binary-like text.
|
|
969
|
+
*
|
|
970
|
+
* @private utility of `<Chat/>` citation rendering
|
|
971
|
+
*/
|
|
972
|
+
function resolveImageSignatureFromText(source: string): CitationSourceSignature | null {
|
|
973
|
+
const signature = source.slice(0, BINARY_SIGNATURE_LENGTH);
|
|
974
|
+
const lowerSignature = signature.toLowerCase();
|
|
975
|
+
|
|
976
|
+
if (signature.startsWith('\u0089PNG') || lowerSignature.includes('png')) {
|
|
977
|
+
return { kind: 'image', imageFormat: 'png' };
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
if (
|
|
981
|
+
signature.startsWith('\u00ff\u00d8\u00ff') ||
|
|
982
|
+
lowerSignature.includes(JPEG_FILE_INTERCHANGE_MARKER) ||
|
|
983
|
+
lowerSignature.includes(JPEG_EXCHANGEABLE_IMAGE_MARKER)
|
|
984
|
+
) {
|
|
985
|
+
return { kind: 'image', imageFormat: 'jpeg' };
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
if (signature.startsWith('GIF87a') || signature.startsWith('GIF89a')) {
|
|
989
|
+
return { kind: 'image', imageFormat: 'gif' };
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
if (signature.startsWith('RIFF') && signature.includes('WEBP')) {
|
|
993
|
+
return { kind: 'image', imageFormat: 'webp' };
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
if (lowerSignature.startsWith('<svg')) {
|
|
997
|
+
return { kind: 'image', imageFormat: 'svg' };
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
return null;
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
/**
|
|
1004
|
+
* Safely decodes URI-encoded strings.
|
|
1005
|
+
*
|
|
1006
|
+
* @param value - Possibly encoded text.
|
|
1007
|
+
* @returns Decoded text, or original value when decoding fails.
|
|
1008
|
+
*
|
|
1009
|
+
* @private utility of `<Chat/>` citation rendering
|
|
1010
|
+
*/
|
|
1011
|
+
function decodeUriComponentSafe(value: string): string {
|
|
1012
|
+
try {
|
|
1013
|
+
return decodeURIComponent(value);
|
|
1014
|
+
} catch {
|
|
1015
|
+
return value;
|
|
1016
|
+
}
|
|
1017
|
+
}
|