@promptbook/cli 0.113.0-9 → 0.114.0-1
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 +908 -699
- 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,984 @@
|
|
|
1
|
+
import { spawn, type ChildProcess } from 'child_process';
|
|
2
|
+
import { randomUUID } from 'crypto';
|
|
3
|
+
import { mkdir, readFile, writeFile } from 'fs/promises';
|
|
4
|
+
import type { Server } from 'http';
|
|
5
|
+
import { dirname } from 'path';
|
|
6
|
+
import { NotAllowed } from '../../../../../src/errors/NotAllowed';
|
|
7
|
+
import { NotFoundError } from '../../../../../src/errors/NotFoundError';
|
|
8
|
+
import { UnexpectedError } from '../../../../../src/errors/UnexpectedError';
|
|
9
|
+
import { spaceTrim } from '../../../../../src/utils/organization/spaceTrim';
|
|
10
|
+
import { applyVpsRuntimeConfiguration } from '../vpsConfiguration';
|
|
11
|
+
import type {
|
|
12
|
+
AgentProjectRuntimeInfo,
|
|
13
|
+
AgentProjectRuntimeMode,
|
|
14
|
+
AgentProjectRuntimeStatus,
|
|
15
|
+
} from './AgentProjectRuntimeInfo';
|
|
16
|
+
import {
|
|
17
|
+
AGENT_PROJECT_RUNTIME_DEFAULT_DEV_COMMAND,
|
|
18
|
+
AGENT_PROJECT_RUNTIME_HOST,
|
|
19
|
+
AGENT_PROJECT_RUNTIME_START_POLL_INTERVAL_MS,
|
|
20
|
+
AGENT_PROJECT_RUNTIME_START_TIMEOUT_MS,
|
|
21
|
+
AGENT_PROJECT_RUNTIME_STOP_POLL_INTERVAL_MS,
|
|
22
|
+
AGENT_PROJECT_RUNTIME_STOP_TIMEOUT_MS,
|
|
23
|
+
} from './agentProjectRuntimeConstants';
|
|
24
|
+
import {
|
|
25
|
+
assignAgentProjectDomain,
|
|
26
|
+
resolveAgentProjectDomainRecord,
|
|
27
|
+
resolveAgentProjectDomainRecordByHost,
|
|
28
|
+
type AgentProjectDomainAssignment,
|
|
29
|
+
} from './agentProjectRuntimeDomains';
|
|
30
|
+
import { buildAgentProjectProfileHref } from './agentProjectHrefs';
|
|
31
|
+
import {
|
|
32
|
+
isAgentProjectRuntimePm2Enabled,
|
|
33
|
+
resolveAgentProjectRuntimePm2Status,
|
|
34
|
+
startAgentProjectRuntimePm2Process,
|
|
35
|
+
stopAgentProjectRuntimePm2Process,
|
|
36
|
+
} from './agentProjectRuntimePm2';
|
|
37
|
+
import { resolveAgentProjectRuntimeRegistryFilePath } from './agentProjectRuntimePaths';
|
|
38
|
+
import { createStaticAgentProjectServer } from './createStaticAgentProjectServer';
|
|
39
|
+
import { findFreeTcpPort } from './findFreeTcpPort';
|
|
40
|
+
import { hasAgentProjectDevScript } from './hasAgentProjectDevScript';
|
|
41
|
+
import { isTcpPortListening, waitForTcpPortListening, waitForTcpPortToStopListening } from './isTcpPortListening';
|
|
42
|
+
import { killProcessListeningOnPort } from './killProcessListeningOnPort';
|
|
43
|
+
import { resolveAgentProjectInfo } from './resolveAgentProjectInfo';
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Global key used to keep project runtimes alive across module reloads.
|
|
47
|
+
*/
|
|
48
|
+
const AGENT_PROJECT_RUNTIME_REGISTRY_GLOBAL_KEY = '__PROMPTBOOK_AGENT_PROJECT_RUNTIME_REGISTRY__';
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Current persisted runtime registry schema version.
|
|
52
|
+
*/
|
|
53
|
+
const AGENT_PROJECT_RUNTIME_REGISTRY_VERSION = 1;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Project runtime registry stored on `globalThis`.
|
|
57
|
+
*/
|
|
58
|
+
type AgentProjectRuntimeRegistryState = {
|
|
59
|
+
/**
|
|
60
|
+
* Runtime records keyed by runtime id.
|
|
61
|
+
*/
|
|
62
|
+
runtimesById: Map<string, MutableAgentProjectRuntimeRecord>;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Whether the persisted registry has already been loaded into memory.
|
|
66
|
+
*/
|
|
67
|
+
isLoaded: boolean;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Global object shape used for process-wide runtime state.
|
|
72
|
+
*/
|
|
73
|
+
type AgentProjectRuntimeRegistryGlobal = typeof globalThis & {
|
|
74
|
+
[AGENT_PROJECT_RUNTIME_REGISTRY_GLOBAL_KEY]?: AgentProjectRuntimeRegistryState;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Mutable internal runtime record.
|
|
79
|
+
*/
|
|
80
|
+
type MutableAgentProjectRuntimeRecord = {
|
|
81
|
+
id: string;
|
|
82
|
+
agentPermanentId: string;
|
|
83
|
+
projectName: string;
|
|
84
|
+
projectPath: string;
|
|
85
|
+
mode: AgentProjectRuntimeMode;
|
|
86
|
+
port: number;
|
|
87
|
+
url: string;
|
|
88
|
+
localUrl: string;
|
|
89
|
+
publicUrl: string;
|
|
90
|
+
domain: string | null;
|
|
91
|
+
projectHref: string;
|
|
92
|
+
command: string | null;
|
|
93
|
+
processId: number | null;
|
|
94
|
+
pm2ProcessName: string | null;
|
|
95
|
+
status: AgentProjectRuntimeStatus;
|
|
96
|
+
isRunning: boolean;
|
|
97
|
+
startedAt: string;
|
|
98
|
+
updatedAt: string;
|
|
99
|
+
staticServer?: Server;
|
|
100
|
+
childProcess?: ChildProcess;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Persisted runtime registry shape.
|
|
105
|
+
*/
|
|
106
|
+
type PersistedAgentProjectRuntimeRegistry = {
|
|
107
|
+
readonly version: number;
|
|
108
|
+
readonly runtimes: ReadonlyArray<PersistedAgentProjectRuntimeRecord>;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Persisted subset of a mutable runtime record.
|
|
113
|
+
*/
|
|
114
|
+
type PersistedAgentProjectRuntimeRecord = Omit<MutableAgentProjectRuntimeRecord, 'staticServer' | 'childProcess'>;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Options identifying one agent project.
|
|
118
|
+
*/
|
|
119
|
+
type AgentProjectRuntimeProjectOptions = {
|
|
120
|
+
/**
|
|
121
|
+
* Permanent id of the agent owning the project.
|
|
122
|
+
*/
|
|
123
|
+
readonly agentPermanentId: string;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Directory name of the project.
|
|
127
|
+
*/
|
|
128
|
+
readonly projectName: string;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Optional base server domain selected by the request that triggered the runtime.
|
|
132
|
+
*/
|
|
133
|
+
readonly serverDomain?: string | null;
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Runtime start preparation shared by dev and static runtimes.
|
|
138
|
+
*/
|
|
139
|
+
type PreparedAgentProjectRuntimeStart = {
|
|
140
|
+
readonly project: NonNullable<Awaited<ReturnType<typeof resolveAgentProjectInfo>>>;
|
|
141
|
+
readonly port: number;
|
|
142
|
+
readonly localUrl: string;
|
|
143
|
+
readonly publicUrl: string;
|
|
144
|
+
readonly domain: string | null;
|
|
145
|
+
readonly domainAssignment: AgentProjectDomainAssignment;
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Assigns a free local port to one project without starting a server-owned process.
|
|
150
|
+
*
|
|
151
|
+
* Agents use this when they need to run their own dev command but still want the Agents
|
|
152
|
+
* Server to track and later terminate the port.
|
|
153
|
+
*
|
|
154
|
+
* @param options - Agent and project identification.
|
|
155
|
+
* @returns Runtime info for the assigned port.
|
|
156
|
+
*/
|
|
157
|
+
export async function assignAgentProjectPort(
|
|
158
|
+
options: AgentProjectRuntimeProjectOptions,
|
|
159
|
+
): Promise<AgentProjectRuntimeInfo> {
|
|
160
|
+
await hydrateAgentProjectRuntimeRegistryState();
|
|
161
|
+
|
|
162
|
+
const existingRuntimeRecord = findAgentProjectRuntimeRecord(options.agentPermanentId, options.projectName);
|
|
163
|
+
|
|
164
|
+
if (existingRuntimeRecord) {
|
|
165
|
+
await refreshAgentProjectRuntimeRecord(existingRuntimeRecord);
|
|
166
|
+
await persistAgentProjectRuntimeRegistryState();
|
|
167
|
+
return toAgentProjectRuntimeInfo(existingRuntimeRecord);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const project = await resolveExistingAgentProject(options);
|
|
171
|
+
const port = await findFreeTcpPort();
|
|
172
|
+
const localUrl = createAgentProjectRuntimeLocalUrl(port);
|
|
173
|
+
const domainAssignment = await assignAgentProjectDomain({
|
|
174
|
+
agentPermanentId: options.agentPermanentId,
|
|
175
|
+
projectName: project.projectName,
|
|
176
|
+
serverDomain: options.serverDomain,
|
|
177
|
+
});
|
|
178
|
+
const publicUrl = domainAssignment.record?.publicUrl ?? localUrl;
|
|
179
|
+
const now = new Date().toISOString();
|
|
180
|
+
const runtimeRecord: MutableAgentProjectRuntimeRecord = {
|
|
181
|
+
id: createAgentProjectRuntimeId(),
|
|
182
|
+
agentPermanentId: options.agentPermanentId,
|
|
183
|
+
projectName: project.projectName,
|
|
184
|
+
projectPath: project.absolutePath,
|
|
185
|
+
mode: 'assigned-port',
|
|
186
|
+
port,
|
|
187
|
+
url: publicUrl,
|
|
188
|
+
localUrl,
|
|
189
|
+
publicUrl,
|
|
190
|
+
domain: domainAssignment.record?.domain ?? null,
|
|
191
|
+
projectHref: buildAgentProjectProfileHref(options.agentPermanentId, project.projectName),
|
|
192
|
+
command: null,
|
|
193
|
+
processId: null,
|
|
194
|
+
pm2ProcessName: null,
|
|
195
|
+
status: 'assigned',
|
|
196
|
+
isRunning: false,
|
|
197
|
+
startedAt: now,
|
|
198
|
+
updatedAt: now,
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
getAgentProjectRuntimeRegistryState().runtimesById.set(runtimeRecord.id, runtimeRecord);
|
|
202
|
+
await persistAgentProjectRuntimeRegistryState();
|
|
203
|
+
await applyAgentProjectRuntimePublicConfiguration(domainAssignment);
|
|
204
|
+
return toAgentProjectRuntimeInfo(runtimeRecord);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Starts one project using its npm `dev` script when available, otherwise a static file server.
|
|
209
|
+
*
|
|
210
|
+
* @param options - Agent and project identification.
|
|
211
|
+
* @returns Runtime info for the started project.
|
|
212
|
+
*/
|
|
213
|
+
export async function startAgentProjectRuntime(
|
|
214
|
+
options: AgentProjectRuntimeProjectOptions,
|
|
215
|
+
): Promise<AgentProjectRuntimeInfo> {
|
|
216
|
+
await hydrateAgentProjectRuntimeRegistryState();
|
|
217
|
+
|
|
218
|
+
const project = await resolveExistingAgentProject(options);
|
|
219
|
+
const isDevRuntime = await hasAgentProjectDevScript(project.absolutePath);
|
|
220
|
+
const preparedStart = await prepareAgentProjectRuntimeStart(options, project);
|
|
221
|
+
|
|
222
|
+
return await startPreparedAgentProjectRuntime({
|
|
223
|
+
preparedStart,
|
|
224
|
+
agentPermanentId: options.agentPermanentId,
|
|
225
|
+
mode: isDevRuntime ? 'dev-server' : 'static-server',
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Starts one project after its runtime mode and shared start metadata have been resolved.
|
|
231
|
+
*/
|
|
232
|
+
async function startPreparedAgentProjectRuntime(options: {
|
|
233
|
+
readonly preparedStart: PreparedAgentProjectRuntimeStart;
|
|
234
|
+
readonly agentPermanentId: string;
|
|
235
|
+
readonly mode: Extract<AgentProjectRuntimeMode, 'dev-server' | 'static-server'>;
|
|
236
|
+
}): Promise<AgentProjectRuntimeInfo> {
|
|
237
|
+
const now = new Date().toISOString();
|
|
238
|
+
const runtimeRecord = createMutableAgentProjectRuntimeRecord({
|
|
239
|
+
agentPermanentId: options.agentPermanentId,
|
|
240
|
+
command: options.mode === 'dev-server' ? AGENT_PROJECT_RUNTIME_DEFAULT_DEV_COMMAND : null,
|
|
241
|
+
domain: options.preparedStart.domain,
|
|
242
|
+
localUrl: options.preparedStart.localUrl,
|
|
243
|
+
mode: options.mode,
|
|
244
|
+
port: options.preparedStart.port,
|
|
245
|
+
projectName: options.preparedStart.project.projectName,
|
|
246
|
+
projectPath: options.preparedStart.project.absolutePath,
|
|
247
|
+
publicUrl: options.preparedStart.publicUrl,
|
|
248
|
+
startedAt: now,
|
|
249
|
+
status: 'starting',
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
if (isAgentProjectRuntimePm2Enabled()) {
|
|
253
|
+
await startPm2ManagedAgentProjectRuntime(runtimeRecord);
|
|
254
|
+
} else if (runtimeRecord.mode === 'dev-server') {
|
|
255
|
+
startChildProcessAgentProjectDevRuntime(runtimeRecord);
|
|
256
|
+
} else {
|
|
257
|
+
await startInProcessStaticAgentProjectRuntime(runtimeRecord);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
getAgentProjectRuntimeRegistryState().runtimesById.set(runtimeRecord.id, runtimeRecord);
|
|
261
|
+
|
|
262
|
+
if (runtimeRecord.mode === 'dev-server') {
|
|
263
|
+
const isListening = await waitForTcpPortListening({
|
|
264
|
+
port: runtimeRecord.port,
|
|
265
|
+
host: AGENT_PROJECT_RUNTIME_HOST,
|
|
266
|
+
timeoutMs: AGENT_PROJECT_RUNTIME_START_TIMEOUT_MS,
|
|
267
|
+
pollIntervalMs: AGENT_PROJECT_RUNTIME_START_POLL_INTERVAL_MS,
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
if (isListening) {
|
|
271
|
+
runtimeRecord.status = 'running';
|
|
272
|
+
runtimeRecord.isRunning = true;
|
|
273
|
+
runtimeRecord.updatedAt = new Date().toISOString();
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
await refreshAgentProjectRuntimeRecord(runtimeRecord);
|
|
278
|
+
await persistAgentProjectRuntimeRegistryState();
|
|
279
|
+
await applyAgentProjectRuntimePublicConfiguration(options.preparedStart.domainAssignment);
|
|
280
|
+
return toAgentProjectRuntimeInfo(runtimeRecord);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Resolves one project runtime by agent and project.
|
|
285
|
+
*
|
|
286
|
+
* @param agentPermanentId - Permanent id of the agent owning the project.
|
|
287
|
+
* @param projectName - Project directory name.
|
|
288
|
+
* @returns Runtime info or `null`.
|
|
289
|
+
*/
|
|
290
|
+
export async function resolveAgentProjectRuntime(
|
|
291
|
+
agentPermanentId: string,
|
|
292
|
+
projectName: string,
|
|
293
|
+
): Promise<AgentProjectRuntimeInfo | null> {
|
|
294
|
+
await hydrateAgentProjectRuntimeRegistryState();
|
|
295
|
+
|
|
296
|
+
const runtimeRecord = findAgentProjectRuntimeRecord(agentPermanentId, projectName);
|
|
297
|
+
|
|
298
|
+
if (!runtimeRecord) {
|
|
299
|
+
return null;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
await refreshAgentProjectRuntimeRecord(runtimeRecord);
|
|
303
|
+
await persistAgentProjectRuntimeRegistryState();
|
|
304
|
+
return toAgentProjectRuntimeInfo(runtimeRecord);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Refreshes the public URL/domain fields of an existing runtime after a project-domain assignment changes.
|
|
309
|
+
*
|
|
310
|
+
* @param options - Project identity and server domain whose assignment should be reflected.
|
|
311
|
+
* @returns Updated runtime info or `null` when the project has no runtime.
|
|
312
|
+
*/
|
|
313
|
+
export async function refreshAgentProjectRuntimePublicDomain(
|
|
314
|
+
options: AgentProjectRuntimeProjectOptions,
|
|
315
|
+
): Promise<AgentProjectRuntimeInfo | null> {
|
|
316
|
+
await hydrateAgentProjectRuntimeRegistryState();
|
|
317
|
+
|
|
318
|
+
const runtimeRecord = findAgentProjectRuntimeRecord(options.agentPermanentId, options.projectName);
|
|
319
|
+
|
|
320
|
+
if (!runtimeRecord) {
|
|
321
|
+
return null;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
const domainRecord = await resolveAgentProjectDomainRecord({
|
|
325
|
+
agentPermanentId: options.agentPermanentId,
|
|
326
|
+
projectName: runtimeRecord.projectName,
|
|
327
|
+
serverDomain: options.serverDomain,
|
|
328
|
+
});
|
|
329
|
+
const publicUrl = domainRecord?.publicUrl ?? runtimeRecord.localUrl;
|
|
330
|
+
|
|
331
|
+
runtimeRecord.domain = domainRecord?.domain ?? null;
|
|
332
|
+
runtimeRecord.publicUrl = publicUrl;
|
|
333
|
+
runtimeRecord.url = publicUrl;
|
|
334
|
+
runtimeRecord.updatedAt = new Date().toISOString();
|
|
335
|
+
|
|
336
|
+
await refreshAgentProjectRuntimeRecord(runtimeRecord);
|
|
337
|
+
await persistAgentProjectRuntimeRegistryState();
|
|
338
|
+
return toAgentProjectRuntimeInfo(runtimeRecord);
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Resolves one running project runtime by public project-domain host.
|
|
343
|
+
*
|
|
344
|
+
* @param host - Raw request host.
|
|
345
|
+
* @returns Runtime info or `null`.
|
|
346
|
+
*/
|
|
347
|
+
export async function resolveAgentProjectRuntimeByDomain(
|
|
348
|
+
host: string | null | undefined,
|
|
349
|
+
): Promise<AgentProjectRuntimeInfo | null> {
|
|
350
|
+
const domainRecord = await resolveAgentProjectDomainRecordByHost(host);
|
|
351
|
+
|
|
352
|
+
if (!domainRecord) {
|
|
353
|
+
return null;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
return await resolveAgentProjectRuntime(domainRecord.agentPermanentId, domainRecord.projectName);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* Lists all assigned project runtimes.
|
|
361
|
+
*
|
|
362
|
+
* @returns Runtime infos ordered by start time.
|
|
363
|
+
*/
|
|
364
|
+
export async function listAgentProjectRuntimes(): Promise<ReadonlyArray<AgentProjectRuntimeInfo>> {
|
|
365
|
+
await hydrateAgentProjectRuntimeRegistryState();
|
|
366
|
+
|
|
367
|
+
const runtimeRecords = [...getAgentProjectRuntimeRegistryState().runtimesById.values()];
|
|
368
|
+
|
|
369
|
+
await Promise.all(runtimeRecords.map((runtimeRecord) => refreshAgentProjectRuntimeRecord(runtimeRecord)));
|
|
370
|
+
await persistAgentProjectRuntimeRegistryState();
|
|
371
|
+
|
|
372
|
+
return runtimeRecords
|
|
373
|
+
.map((runtimeRecord) => toAgentProjectRuntimeInfo(runtimeRecord))
|
|
374
|
+
.sort((firstRuntime, secondRuntime) => firstRuntime.startedAt.localeCompare(secondRuntime.startedAt));
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* Terminates one runtime by runtime id.
|
|
379
|
+
*
|
|
380
|
+
* @param runtimeId - Runtime id.
|
|
381
|
+
* @returns Terminated runtime info or `null` when it no longer exists.
|
|
382
|
+
*/
|
|
383
|
+
export async function terminateAgentProjectRuntimeById(runtimeId: string): Promise<AgentProjectRuntimeInfo | null> {
|
|
384
|
+
await hydrateAgentProjectRuntimeRegistryState();
|
|
385
|
+
|
|
386
|
+
const runtimeRecord = getAgentProjectRuntimeRegistryState().runtimesById.get(runtimeId);
|
|
387
|
+
|
|
388
|
+
if (!runtimeRecord) {
|
|
389
|
+
return null;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
await terminateAgentProjectRuntimeRecord(runtimeRecord);
|
|
393
|
+
getAgentProjectRuntimeRegistryState().runtimesById.delete(runtimeId);
|
|
394
|
+
await persistAgentProjectRuntimeRegistryState();
|
|
395
|
+
return toAgentProjectRuntimeInfo(runtimeRecord);
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* Terminates any runtime assigned to one project.
|
|
400
|
+
*
|
|
401
|
+
* @param options - Agent and project identification.
|
|
402
|
+
* @returns Terminated runtime info or `null` when no runtime exists.
|
|
403
|
+
*/
|
|
404
|
+
export async function terminateAgentProjectRuntimeForProject(
|
|
405
|
+
options: AgentProjectRuntimeProjectOptions,
|
|
406
|
+
): Promise<AgentProjectRuntimeInfo | null> {
|
|
407
|
+
await hydrateAgentProjectRuntimeRegistryState();
|
|
408
|
+
|
|
409
|
+
const runtimeRecord = findAgentProjectRuntimeRecord(options.agentPermanentId, options.projectName);
|
|
410
|
+
|
|
411
|
+
if (!runtimeRecord) {
|
|
412
|
+
return null;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
await terminateAgentProjectRuntimeRecord(runtimeRecord);
|
|
416
|
+
getAgentProjectRuntimeRegistryState().runtimesById.delete(runtimeRecord.id);
|
|
417
|
+
await persistAgentProjectRuntimeRegistryState();
|
|
418
|
+
return toAgentProjectRuntimeInfo(runtimeRecord);
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* Terminates all project runtimes in the current process.
|
|
423
|
+
*
|
|
424
|
+
* This is used by tests and process-level cleanup.
|
|
425
|
+
*/
|
|
426
|
+
export async function terminateAllAgentProjectRuntimes(): Promise<void> {
|
|
427
|
+
await hydrateAgentProjectRuntimeRegistryState();
|
|
428
|
+
|
|
429
|
+
const runtimeIds = [...getAgentProjectRuntimeRegistryState().runtimesById.keys()];
|
|
430
|
+
|
|
431
|
+
await Promise.all(runtimeIds.map((runtimeId) => terminateAgentProjectRuntimeById(runtimeId)));
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* Prepares common runtime start metadata and terminates any previous runtime.
|
|
436
|
+
*/
|
|
437
|
+
async function prepareAgentProjectRuntimeStart(
|
|
438
|
+
options: AgentProjectRuntimeProjectOptions,
|
|
439
|
+
project: NonNullable<Awaited<ReturnType<typeof resolveAgentProjectInfo>>>,
|
|
440
|
+
): Promise<PreparedAgentProjectRuntimeStart> {
|
|
441
|
+
await terminateAgentProjectRuntimeForProject({
|
|
442
|
+
agentPermanentId: options.agentPermanentId,
|
|
443
|
+
projectName: project.projectName,
|
|
444
|
+
});
|
|
445
|
+
|
|
446
|
+
const port = await findFreeTcpPort();
|
|
447
|
+
const localUrl = createAgentProjectRuntimeLocalUrl(port);
|
|
448
|
+
const domainAssignment = await assignAgentProjectDomain({
|
|
449
|
+
agentPermanentId: options.agentPermanentId,
|
|
450
|
+
projectName: project.projectName,
|
|
451
|
+
serverDomain: options.serverDomain,
|
|
452
|
+
});
|
|
453
|
+
const publicUrl = domainAssignment.record?.publicUrl ?? localUrl;
|
|
454
|
+
|
|
455
|
+
return {
|
|
456
|
+
project,
|
|
457
|
+
port,
|
|
458
|
+
localUrl,
|
|
459
|
+
publicUrl,
|
|
460
|
+
domain: domainAssignment.record?.domain ?? null,
|
|
461
|
+
domainAssignment,
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* Creates an initial mutable runtime record.
|
|
467
|
+
*/
|
|
468
|
+
function createMutableAgentProjectRuntimeRecord(options: {
|
|
469
|
+
readonly agentPermanentId: string;
|
|
470
|
+
readonly command: string | null;
|
|
471
|
+
readonly domain: string | null;
|
|
472
|
+
readonly localUrl: string;
|
|
473
|
+
readonly mode: AgentProjectRuntimeMode;
|
|
474
|
+
readonly port: number;
|
|
475
|
+
readonly projectName: string;
|
|
476
|
+
readonly projectPath: string;
|
|
477
|
+
readonly publicUrl: string;
|
|
478
|
+
readonly startedAt: string;
|
|
479
|
+
readonly status: AgentProjectRuntimeStatus;
|
|
480
|
+
}): MutableAgentProjectRuntimeRecord {
|
|
481
|
+
return {
|
|
482
|
+
id: createAgentProjectRuntimeId(),
|
|
483
|
+
agentPermanentId: options.agentPermanentId,
|
|
484
|
+
projectName: options.projectName,
|
|
485
|
+
projectPath: options.projectPath,
|
|
486
|
+
mode: options.mode,
|
|
487
|
+
port: options.port,
|
|
488
|
+
url: options.publicUrl,
|
|
489
|
+
localUrl: options.localUrl,
|
|
490
|
+
publicUrl: options.publicUrl,
|
|
491
|
+
domain: options.domain,
|
|
492
|
+
projectHref: buildAgentProjectProfileHref(options.agentPermanentId, options.projectName),
|
|
493
|
+
command: options.command,
|
|
494
|
+
processId: null,
|
|
495
|
+
pm2ProcessName: null,
|
|
496
|
+
status: options.status,
|
|
497
|
+
isRunning: false,
|
|
498
|
+
startedAt: options.startedAt,
|
|
499
|
+
updatedAt: options.startedAt,
|
|
500
|
+
};
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
/**
|
|
504
|
+
* Starts a pm2-managed project runtime.
|
|
505
|
+
*/
|
|
506
|
+
async function startPm2ManagedAgentProjectRuntime(runtimeRecord: MutableAgentProjectRuntimeRecord): Promise<void> {
|
|
507
|
+
if (runtimeRecord.mode !== 'dev-server' && runtimeRecord.mode !== 'static-server') {
|
|
508
|
+
return;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
try {
|
|
512
|
+
const processResult = await startAgentProjectRuntimePm2Process({
|
|
513
|
+
agentPermanentId: runtimeRecord.agentPermanentId,
|
|
514
|
+
projectName: runtimeRecord.projectName,
|
|
515
|
+
projectPath: runtimeRecord.projectPath,
|
|
516
|
+
mode: runtimeRecord.mode,
|
|
517
|
+
port: runtimeRecord.port,
|
|
518
|
+
command: runtimeRecord.command,
|
|
519
|
+
publicUrl: runtimeRecord.publicUrl,
|
|
520
|
+
localUrl: runtimeRecord.localUrl,
|
|
521
|
+
});
|
|
522
|
+
|
|
523
|
+
runtimeRecord.pm2ProcessName = processResult.processName;
|
|
524
|
+
runtimeRecord.processId = processResult.processId;
|
|
525
|
+
runtimeRecord.updatedAt = new Date().toISOString();
|
|
526
|
+
} catch (error) {
|
|
527
|
+
throw new NotAllowed(
|
|
528
|
+
spaceTrim(`
|
|
529
|
+
Failed to start project \`${runtimeRecord.projectName}\` as a pm2 process.
|
|
530
|
+
|
|
531
|
+
**Project path:** \`${runtimeRecord.projectPath}\`
|
|
532
|
+
**Cause:** \`${error instanceof Error ? error.message : String(error)}\`
|
|
533
|
+
`),
|
|
534
|
+
);
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
/**
|
|
539
|
+
* Starts the local in-process static server used outside production pm2.
|
|
540
|
+
*/
|
|
541
|
+
async function startInProcessStaticAgentProjectRuntime(runtimeRecord: MutableAgentProjectRuntimeRecord): Promise<void> {
|
|
542
|
+
const staticServer = createStaticAgentProjectServer(runtimeRecord.projectPath);
|
|
543
|
+
|
|
544
|
+
await listenOnPort(staticServer, runtimeRecord.port);
|
|
545
|
+
|
|
546
|
+
runtimeRecord.staticServer = staticServer;
|
|
547
|
+
runtimeRecord.status = 'running';
|
|
548
|
+
runtimeRecord.isRunning = true;
|
|
549
|
+
runtimeRecord.updatedAt = new Date().toISOString();
|
|
550
|
+
|
|
551
|
+
staticServer.once('close', () => {
|
|
552
|
+
runtimeRecord.status = 'stopped';
|
|
553
|
+
runtimeRecord.isRunning = false;
|
|
554
|
+
runtimeRecord.updatedAt = new Date().toISOString();
|
|
555
|
+
void persistAgentProjectRuntimeRegistryState();
|
|
556
|
+
});
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
/**
|
|
560
|
+
* Starts the local child-process dev runtime used outside production pm2.
|
|
561
|
+
*/
|
|
562
|
+
function startChildProcessAgentProjectDevRuntime(runtimeRecord: MutableAgentProjectRuntimeRecord): void {
|
|
563
|
+
const childProcess = spawn(runtimeRecord.command || AGENT_PROJECT_RUNTIME_DEFAULT_DEV_COMMAND, {
|
|
564
|
+
cwd: runtimeRecord.projectPath,
|
|
565
|
+
detached: false,
|
|
566
|
+
env: {
|
|
567
|
+
...process.env,
|
|
568
|
+
HOST: AGENT_PROJECT_RUNTIME_HOST,
|
|
569
|
+
HOSTNAME: AGENT_PROJECT_RUNTIME_HOST,
|
|
570
|
+
PORT: String(runtimeRecord.port),
|
|
571
|
+
PTBK_AGENT_PROJECT_LOCAL_URL: runtimeRecord.localUrl,
|
|
572
|
+
PTBK_AGENT_PROJECT_PUBLIC_URL: runtimeRecord.publicUrl,
|
|
573
|
+
},
|
|
574
|
+
shell: true,
|
|
575
|
+
stdio: 'ignore',
|
|
576
|
+
windowsHide: true,
|
|
577
|
+
});
|
|
578
|
+
|
|
579
|
+
runtimeRecord.childProcess = childProcess;
|
|
580
|
+
runtimeRecord.processId = childProcess.pid ?? null;
|
|
581
|
+
|
|
582
|
+
childProcess.once('exit', () => {
|
|
583
|
+
runtimeRecord.status = 'stopped';
|
|
584
|
+
runtimeRecord.isRunning = false;
|
|
585
|
+
runtimeRecord.updatedAt = new Date().toISOString();
|
|
586
|
+
void persistAgentProjectRuntimeRegistryState();
|
|
587
|
+
});
|
|
588
|
+
childProcess.once('error', () => {
|
|
589
|
+
runtimeRecord.status = 'stopped';
|
|
590
|
+
runtimeRecord.isRunning = false;
|
|
591
|
+
runtimeRecord.updatedAt = new Date().toISOString();
|
|
592
|
+
void persistAgentProjectRuntimeRegistryState();
|
|
593
|
+
});
|
|
594
|
+
childProcess.unref();
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
/**
|
|
598
|
+
* Applies installer-managed nginx and SSL configuration when a public domain exists.
|
|
599
|
+
*/
|
|
600
|
+
async function applyAgentProjectRuntimePublicConfiguration(
|
|
601
|
+
domainAssignment: AgentProjectDomainAssignment,
|
|
602
|
+
): Promise<void> {
|
|
603
|
+
if (!domainAssignment.record) {
|
|
604
|
+
return;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
try {
|
|
608
|
+
await applyVpsRuntimeConfiguration({ isProcessRestartEnabled: false });
|
|
609
|
+
} catch (error) {
|
|
610
|
+
throw new UnexpectedError(
|
|
611
|
+
spaceTrim(`
|
|
612
|
+
Failed to expose project \`${domainAssignment.record.projectName}\` on its public domain.
|
|
613
|
+
|
|
614
|
+
**Project domain:** \`${domainAssignment.record.domain}\`
|
|
615
|
+
**Cause:** \`${error instanceof Error ? error.message : String(error)}\`
|
|
616
|
+
`),
|
|
617
|
+
);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
/**
|
|
622
|
+
* Resolves one existing project or throws a branded not-found error.
|
|
623
|
+
*/
|
|
624
|
+
async function resolveExistingAgentProject(options: AgentProjectRuntimeProjectOptions) {
|
|
625
|
+
const project = await resolveAgentProjectInfo(options.agentPermanentId, options.projectName);
|
|
626
|
+
|
|
627
|
+
if (!project) {
|
|
628
|
+
throw new NotFoundError(
|
|
629
|
+
spaceTrim(`
|
|
630
|
+
Project \`${options.projectName}\` was not found for agent \`${options.agentPermanentId}\`.
|
|
631
|
+
`),
|
|
632
|
+
);
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
return project;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
/**
|
|
639
|
+
* Finds a runtime record by agent and project.
|
|
640
|
+
*/
|
|
641
|
+
function findAgentProjectRuntimeRecord(
|
|
642
|
+
agentPermanentId: string,
|
|
643
|
+
projectName: string,
|
|
644
|
+
): MutableAgentProjectRuntimeRecord | null {
|
|
645
|
+
const normalizedAgentPermanentId = agentPermanentId.toLowerCase();
|
|
646
|
+
const normalizedProjectName = projectName.toLowerCase();
|
|
647
|
+
|
|
648
|
+
for (const runtimeRecord of getAgentProjectRuntimeRegistryState().runtimesById.values()) {
|
|
649
|
+
if (
|
|
650
|
+
runtimeRecord.agentPermanentId.toLowerCase() === normalizedAgentPermanentId &&
|
|
651
|
+
runtimeRecord.projectName.toLowerCase() === normalizedProjectName
|
|
652
|
+
) {
|
|
653
|
+
return runtimeRecord;
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
return null;
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
/**
|
|
661
|
+
* Refreshes one mutable runtime record from process and TCP state.
|
|
662
|
+
*/
|
|
663
|
+
async function refreshAgentProjectRuntimeRecord(runtimeRecord: MutableAgentProjectRuntimeRecord): Promise<void> {
|
|
664
|
+
if (runtimeRecord.staticServer) {
|
|
665
|
+
runtimeRecord.isRunning = runtimeRecord.staticServer.listening;
|
|
666
|
+
runtimeRecord.status = runtimeRecord.staticServer.listening ? 'running' : 'stopped';
|
|
667
|
+
runtimeRecord.updatedAt = new Date().toISOString();
|
|
668
|
+
return;
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
const isListening = await isTcpPortListening(runtimeRecord.port, AGENT_PROJECT_RUNTIME_HOST);
|
|
672
|
+
const pm2Status = await resolveAgentProjectRuntimePm2Status(runtimeRecord.pm2ProcessName);
|
|
673
|
+
|
|
674
|
+
runtimeRecord.processId = pm2Status.processId ?? runtimeRecord.processId;
|
|
675
|
+
runtimeRecord.isRunning = isListening;
|
|
676
|
+
|
|
677
|
+
if (isListening) {
|
|
678
|
+
runtimeRecord.status = 'running';
|
|
679
|
+
} else if (runtimeRecord.mode === 'assigned-port') {
|
|
680
|
+
runtimeRecord.status = 'assigned';
|
|
681
|
+
} else if (pm2Status.isKnown && pm2Status.isRunning) {
|
|
682
|
+
runtimeRecord.status = 'starting';
|
|
683
|
+
} else if (runtimeRecord.childProcess && runtimeRecord.childProcess.exitCode === null) {
|
|
684
|
+
runtimeRecord.status = 'starting';
|
|
685
|
+
} else {
|
|
686
|
+
runtimeRecord.status = 'stopped';
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
runtimeRecord.updatedAt = new Date().toISOString();
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
/**
|
|
693
|
+
* Terminates one mutable runtime record.
|
|
694
|
+
*/
|
|
695
|
+
async function terminateAgentProjectRuntimeRecord(runtimeRecord: MutableAgentProjectRuntimeRecord): Promise<void> {
|
|
696
|
+
if (runtimeRecord.staticServer?.listening) {
|
|
697
|
+
await closeStaticServer(runtimeRecord.staticServer);
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
if (runtimeRecord.childProcess && runtimeRecord.childProcess.exitCode === null) {
|
|
701
|
+
runtimeRecord.childProcess.kill();
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
await stopAgentProjectRuntimePm2Process(runtimeRecord.pm2ProcessName);
|
|
705
|
+
await killProcessListeningOnPort(runtimeRecord.port);
|
|
706
|
+
await waitForTcpPortToStopListening({
|
|
707
|
+
port: runtimeRecord.port,
|
|
708
|
+
host: AGENT_PROJECT_RUNTIME_HOST,
|
|
709
|
+
timeoutMs: AGENT_PROJECT_RUNTIME_STOP_TIMEOUT_MS,
|
|
710
|
+
pollIntervalMs: AGENT_PROJECT_RUNTIME_STOP_POLL_INTERVAL_MS,
|
|
711
|
+
});
|
|
712
|
+
|
|
713
|
+
runtimeRecord.status = 'stopped';
|
|
714
|
+
runtimeRecord.isRunning = false;
|
|
715
|
+
runtimeRecord.updatedAt = new Date().toISOString();
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
/**
|
|
719
|
+
* Starts listening with the static server.
|
|
720
|
+
*/
|
|
721
|
+
async function listenOnPort(staticServer: Server, port: number): Promise<void> {
|
|
722
|
+
return await new Promise<void>((resolve, reject) => {
|
|
723
|
+
staticServer.once('error', reject);
|
|
724
|
+
staticServer.listen(port, AGENT_PROJECT_RUNTIME_HOST, () => resolve());
|
|
725
|
+
});
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
/**
|
|
729
|
+
* Closes a static server.
|
|
730
|
+
*/
|
|
731
|
+
async function closeStaticServer(staticServer: Server): Promise<void> {
|
|
732
|
+
return await new Promise<void>((resolve, reject) => {
|
|
733
|
+
staticServer.close((error) => {
|
|
734
|
+
if (error) {
|
|
735
|
+
reject(error);
|
|
736
|
+
return;
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
resolve();
|
|
740
|
+
});
|
|
741
|
+
});
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
/**
|
|
745
|
+
* Creates the local runtime URL for one port.
|
|
746
|
+
*/
|
|
747
|
+
function createAgentProjectRuntimeLocalUrl(port: number): string {
|
|
748
|
+
return `http://${AGENT_PROJECT_RUNTIME_HOST}:${port}`;
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
/**
|
|
752
|
+
* Creates a process-local runtime id.
|
|
753
|
+
*/
|
|
754
|
+
function createAgentProjectRuntimeId(): string {
|
|
755
|
+
return randomUUID();
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
/**
|
|
759
|
+
* Converts a mutable runtime record to a serializable runtime info object.
|
|
760
|
+
*/
|
|
761
|
+
function toAgentProjectRuntimeInfo(runtimeRecord: MutableAgentProjectRuntimeRecord): AgentProjectRuntimeInfo {
|
|
762
|
+
return {
|
|
763
|
+
id: runtimeRecord.id,
|
|
764
|
+
agentPermanentId: runtimeRecord.agentPermanentId,
|
|
765
|
+
projectName: runtimeRecord.projectName,
|
|
766
|
+
projectPath: runtimeRecord.projectPath,
|
|
767
|
+
mode: runtimeRecord.mode,
|
|
768
|
+
port: runtimeRecord.port,
|
|
769
|
+
url: runtimeRecord.url,
|
|
770
|
+
localUrl: runtimeRecord.localUrl,
|
|
771
|
+
publicUrl: runtimeRecord.publicUrl,
|
|
772
|
+
domain: runtimeRecord.domain,
|
|
773
|
+
projectHref: runtimeRecord.projectHref,
|
|
774
|
+
command: runtimeRecord.command,
|
|
775
|
+
processId: runtimeRecord.processId,
|
|
776
|
+
pm2ProcessName: runtimeRecord.pm2ProcessName,
|
|
777
|
+
status: runtimeRecord.status,
|
|
778
|
+
isRunning: runtimeRecord.isRunning,
|
|
779
|
+
startedAt: runtimeRecord.startedAt,
|
|
780
|
+
updatedAt: runtimeRecord.updatedAt,
|
|
781
|
+
};
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
/**
|
|
785
|
+
* Converts a mutable runtime record to persisted JSON data.
|
|
786
|
+
*/
|
|
787
|
+
function toPersistedAgentProjectRuntimeRecord(
|
|
788
|
+
runtimeRecord: MutableAgentProjectRuntimeRecord,
|
|
789
|
+
): PersistedAgentProjectRuntimeRecord {
|
|
790
|
+
return {
|
|
791
|
+
id: runtimeRecord.id,
|
|
792
|
+
agentPermanentId: runtimeRecord.agentPermanentId,
|
|
793
|
+
projectName: runtimeRecord.projectName,
|
|
794
|
+
projectPath: runtimeRecord.projectPath,
|
|
795
|
+
mode: runtimeRecord.mode,
|
|
796
|
+
port: runtimeRecord.port,
|
|
797
|
+
url: runtimeRecord.url,
|
|
798
|
+
localUrl: runtimeRecord.localUrl,
|
|
799
|
+
publicUrl: runtimeRecord.publicUrl,
|
|
800
|
+
domain: runtimeRecord.domain,
|
|
801
|
+
projectHref: runtimeRecord.projectHref,
|
|
802
|
+
command: runtimeRecord.command,
|
|
803
|
+
processId: runtimeRecord.processId,
|
|
804
|
+
pm2ProcessName: runtimeRecord.pm2ProcessName,
|
|
805
|
+
status: runtimeRecord.status,
|
|
806
|
+
isRunning: runtimeRecord.isRunning,
|
|
807
|
+
startedAt: runtimeRecord.startedAt,
|
|
808
|
+
updatedAt: runtimeRecord.updatedAt,
|
|
809
|
+
};
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
/**
|
|
813
|
+
* Hydrates the in-memory registry from the persisted runtime registry once per process.
|
|
814
|
+
*/
|
|
815
|
+
async function hydrateAgentProjectRuntimeRegistryState(): Promise<void> {
|
|
816
|
+
const registryState = getAgentProjectRuntimeRegistryState();
|
|
817
|
+
|
|
818
|
+
if (registryState.isLoaded) {
|
|
819
|
+
return;
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
const runtimeRecords = await readPersistedAgentProjectRuntimeRecords();
|
|
823
|
+
registryState.runtimesById = new Map(
|
|
824
|
+
runtimeRecords.map((runtimeRecord) => [runtimeRecord.id, { ...runtimeRecord }]),
|
|
825
|
+
);
|
|
826
|
+
registryState.isLoaded = true;
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
/**
|
|
830
|
+
* Persists the in-memory runtime registry.
|
|
831
|
+
*/
|
|
832
|
+
async function persistAgentProjectRuntimeRegistryState(): Promise<void> {
|
|
833
|
+
const registryState = getAgentProjectRuntimeRegistryState();
|
|
834
|
+
const registryFilePath = resolveAgentProjectRuntimeRegistryFilePath();
|
|
835
|
+
const payload: PersistedAgentProjectRuntimeRegistry = {
|
|
836
|
+
version: AGENT_PROJECT_RUNTIME_REGISTRY_VERSION,
|
|
837
|
+
runtimes: [...registryState.runtimesById.values()].map(toPersistedAgentProjectRuntimeRecord),
|
|
838
|
+
};
|
|
839
|
+
|
|
840
|
+
try {
|
|
841
|
+
await mkdir(dirname(registryFilePath), { recursive: true });
|
|
842
|
+
await writeFile(registryFilePath, `${JSON.stringify(payload, null, 4)}\n`, 'utf-8');
|
|
843
|
+
} catch (error) {
|
|
844
|
+
throw new UnexpectedError(
|
|
845
|
+
spaceTrim(`
|
|
846
|
+
Failed to persist agent project runtime registry.
|
|
847
|
+
|
|
848
|
+
**Registry file:** \`${registryFilePath}\`
|
|
849
|
+
**Cause:** \`${error instanceof Error ? error.message : String(error)}\`
|
|
850
|
+
`),
|
|
851
|
+
);
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
/**
|
|
856
|
+
* Reads persisted project runtime records.
|
|
857
|
+
*/
|
|
858
|
+
async function readPersistedAgentProjectRuntimeRecords(): Promise<ReadonlyArray<PersistedAgentProjectRuntimeRecord>> {
|
|
859
|
+
const registryFilePath = resolveAgentProjectRuntimeRegistryFilePath();
|
|
860
|
+
let rawContent: string;
|
|
861
|
+
|
|
862
|
+
try {
|
|
863
|
+
rawContent = await readFile(registryFilePath, 'utf-8');
|
|
864
|
+
} catch (error) {
|
|
865
|
+
if ((error as NodeJS.ErrnoException).code === 'ENOENT') {
|
|
866
|
+
return [];
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
throw new UnexpectedError(
|
|
870
|
+
spaceTrim(`
|
|
871
|
+
Failed to read agent project runtime registry.
|
|
872
|
+
|
|
873
|
+
**Registry file:** \`${registryFilePath}\`
|
|
874
|
+
**Cause:** \`${error instanceof Error ? error.message : String(error)}\`
|
|
875
|
+
`),
|
|
876
|
+
);
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
try {
|
|
880
|
+
return parsePersistedAgentProjectRuntimeRegistry(JSON.parse(rawContent));
|
|
881
|
+
} catch (error) {
|
|
882
|
+
throw new UnexpectedError(
|
|
883
|
+
spaceTrim(`
|
|
884
|
+
Failed to parse agent project runtime registry.
|
|
885
|
+
|
|
886
|
+
**Registry file:** \`${registryFilePath}\`
|
|
887
|
+
**Cause:** \`${error instanceof Error ? error.message : String(error)}\`
|
|
888
|
+
`),
|
|
889
|
+
);
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
/**
|
|
894
|
+
* Parses persisted runtime records and ignores invalid legacy rows.
|
|
895
|
+
*/
|
|
896
|
+
function parsePersistedAgentProjectRuntimeRegistry(
|
|
897
|
+
rawValue: unknown,
|
|
898
|
+
): ReadonlyArray<PersistedAgentProjectRuntimeRecord> {
|
|
899
|
+
if (!rawValue || typeof rawValue !== 'object') {
|
|
900
|
+
return [];
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
const registry = rawValue as Partial<PersistedAgentProjectRuntimeRegistry>;
|
|
904
|
+
|
|
905
|
+
if (!Array.isArray(registry.runtimes)) {
|
|
906
|
+
return [];
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
return registry.runtimes
|
|
910
|
+
.map((rawRecord): PersistedAgentProjectRuntimeRecord | null => {
|
|
911
|
+
if (!rawRecord || typeof rawRecord !== 'object') {
|
|
912
|
+
return null;
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
const record = rawRecord as Partial<PersistedAgentProjectRuntimeRecord>;
|
|
916
|
+
|
|
917
|
+
if (
|
|
918
|
+
typeof record.id !== 'string' ||
|
|
919
|
+
typeof record.agentPermanentId !== 'string' ||
|
|
920
|
+
typeof record.projectName !== 'string' ||
|
|
921
|
+
typeof record.projectPath !== 'string' ||
|
|
922
|
+
!isAgentProjectRuntimeMode(record.mode) ||
|
|
923
|
+
typeof record.port !== 'number' ||
|
|
924
|
+
typeof record.projectHref !== 'string' ||
|
|
925
|
+
typeof record.startedAt !== 'string' ||
|
|
926
|
+
typeof record.updatedAt !== 'string'
|
|
927
|
+
) {
|
|
928
|
+
return null;
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
const localUrl =
|
|
932
|
+
typeof record.localUrl === 'string' ? record.localUrl : createAgentProjectRuntimeLocalUrl(record.port);
|
|
933
|
+
const publicUrl = typeof record.publicUrl === 'string' ? record.publicUrl : record.url || localUrl;
|
|
934
|
+
|
|
935
|
+
return {
|
|
936
|
+
id: record.id,
|
|
937
|
+
agentPermanentId: record.agentPermanentId,
|
|
938
|
+
projectName: record.projectName,
|
|
939
|
+
projectPath: record.projectPath,
|
|
940
|
+
mode: record.mode,
|
|
941
|
+
port: record.port,
|
|
942
|
+
url: typeof record.url === 'string' ? record.url : publicUrl,
|
|
943
|
+
localUrl,
|
|
944
|
+
publicUrl,
|
|
945
|
+
domain: typeof record.domain === 'string' ? record.domain : null,
|
|
946
|
+
projectHref: record.projectHref,
|
|
947
|
+
command: typeof record.command === 'string' ? record.command : null,
|
|
948
|
+
processId: typeof record.processId === 'number' ? record.processId : null,
|
|
949
|
+
pm2ProcessName: typeof record.pm2ProcessName === 'string' ? record.pm2ProcessName : null,
|
|
950
|
+
status: isAgentProjectRuntimeStatus(record.status) ? record.status : 'stopped',
|
|
951
|
+
isRunning: record.isRunning === true,
|
|
952
|
+
startedAt: record.startedAt,
|
|
953
|
+
updatedAt: record.updatedAt,
|
|
954
|
+
};
|
|
955
|
+
})
|
|
956
|
+
.filter((record): record is PersistedAgentProjectRuntimeRecord => record !== null);
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
/**
|
|
960
|
+
* Checks whether a raw value is a known runtime status.
|
|
961
|
+
*/
|
|
962
|
+
function isAgentProjectRuntimeStatus(value: unknown): value is AgentProjectRuntimeStatus {
|
|
963
|
+
return value === 'assigned' || value === 'starting' || value === 'running' || value === 'stopped';
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
/**
|
|
967
|
+
* Checks whether a raw value is a known runtime mode.
|
|
968
|
+
*/
|
|
969
|
+
function isAgentProjectRuntimeMode(value: unknown): value is AgentProjectRuntimeMode {
|
|
970
|
+
return value === 'assigned-port' || value === 'static-server' || value === 'dev-server';
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
/**
|
|
974
|
+
* Returns the process-wide runtime registry.
|
|
975
|
+
*/
|
|
976
|
+
function getAgentProjectRuntimeRegistryState(): AgentProjectRuntimeRegistryState {
|
|
977
|
+
const registryGlobal = globalThis as AgentProjectRuntimeRegistryGlobal;
|
|
978
|
+
registryGlobal[AGENT_PROJECT_RUNTIME_REGISTRY_GLOBAL_KEY] ??= {
|
|
979
|
+
runtimesById: new Map(),
|
|
980
|
+
isLoaded: false,
|
|
981
|
+
};
|
|
982
|
+
|
|
983
|
+
return registryGlobal[AGENT_PROJECT_RUNTIME_REGISTRY_GLOBAL_KEY]!;
|
|
984
|
+
}
|