@promptbook/cli 0.113.0-1 → 0.113.0-11
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 +1 -17
- package/agents/default/developer.book +3 -0
- package/apps/agents-server/next.config.ts +6 -3
- package/apps/agents-server/src/app/admin/{code-runners/CodeRunnersClient.tsx → harness-auth/HarnessAuthClient.tsx} +98 -65
- package/apps/agents-server/src/app/admin/{code-runners → harness-auth}/page.tsx +4 -4
- package/apps/agents-server/src/app/admin/resource-monitor/page.tsx +456 -0
- package/apps/agents-server/src/app/admin/task-manager/TaskManagerClient.tsx +17 -5
- package/apps/agents-server/src/app/admin/task-manager/TaskManagerTaskLogActions.tsx +150 -0
- package/apps/agents-server/src/app/admin/task-manager/TaskManagerTaskRow.tsx +62 -18
- package/apps/agents-server/src/app/admin/task-manager/TaskManagerTaskTerminalDialog.tsx +125 -0
- package/apps/agents-server/src/app/admin/task-manager/TaskManagerTasksCard.tsx +8 -6
- package/apps/agents-server/src/app/admin/task-manager/page.tsx +3 -2
- package/apps/agents-server/src/app/admin/update/AdvancedOriginRepositoryPanel.tsx +81 -0
- package/apps/agents-server/src/app/admin/update/AutomaticSelfUpdateConfigurationCard.tsx +90 -0
- package/apps/agents-server/src/app/admin/update/CurrentDeploymentCard.tsx +162 -0
- package/apps/agents-server/src/app/admin/update/CustomCommitPicker.tsx +10 -10
- package/apps/agents-server/src/app/admin/update/InstalledVersionsCard.tsx +112 -0
- package/apps/agents-server/src/app/admin/update/PendingCommitsCard.tsx +87 -0
- package/apps/agents-server/src/app/admin/update/TargetEnvironmentCard.tsx +331 -0
- package/apps/agents-server/src/app/admin/update/UpdateClient.tsx +35 -878
- package/apps/agents-server/src/app/admin/update/UpdateDatabaseMigrationsPanel.tsx +305 -0
- package/apps/agents-server/src/app/admin/update/UpdateJobCard.tsx +350 -0
- package/apps/agents-server/src/app/admin/update/UpdateOverview.ts +142 -0
- package/apps/agents-server/src/app/admin/update/buildDeploymentTimeBehindLabel.ts +29 -0
- package/apps/agents-server/src/app/admin/update/formatHumanReadableTimestamp.ts +18 -0
- package/apps/agents-server/src/app/admin/update/getUpdateJobFailureMessage.ts +13 -0
- package/apps/agents-server/src/app/admin/update/getUpdateJobSuccessMessage.ts +13 -0
- package/apps/agents-server/src/app/admin/update/updatePageCardClassName.ts +6 -0
- package/apps/agents-server/src/app/admin/update/useUpdateClientState.ts +675 -0
- package/apps/agents-server/src/app/agents/[agentName]/AgentChatWrapper.tsx +17 -3
- package/apps/agents-server/src/app/agents/[agentName]/api/book/route.ts +13 -1
- package/apps/agents-server/src/app/agents/[agentName]/chat/CanonicalAgentChatSurface.tsx +6 -2
- package/apps/agents-server/src/app/agents/[agentName]/export-as-transpiled-code/AgentCodePageClient.tsx +14 -559
- package/apps/agents-server/src/app/agents/[agentName]/export-as-transpiled-code/AgentCodePageHeader.tsx +84 -0
- package/apps/agents-server/src/app/agents/[agentName]/export-as-transpiled-code/AgentCodePageSection.tsx +52 -0
- package/apps/agents-server/src/app/agents/[agentName]/export-as-transpiled-code/GeneratedCodePreview.tsx +138 -0
- package/apps/agents-server/src/app/agents/[agentName]/export-as-transpiled-code/GeneratedHarnessSection.tsx +98 -0
- package/apps/agents-server/src/app/agents/[agentName]/export-as-transpiled-code/SourceBookSection.tsx +66 -0
- package/apps/agents-server/src/app/agents/[agentName]/export-as-transpiled-code/TranspiledCodeErrorBanner.tsx +30 -0
- package/apps/agents-server/src/app/agents/[agentName]/export-as-transpiled-code/TranspiledCodeExportWarningBanner.tsx +62 -0
- package/apps/agents-server/src/app/agents/[agentName]/export-as-transpiled-code/Transpiler.ts +9 -0
- package/apps/agents-server/src/app/agents/[agentName]/export-as-transpiled-code/useAgentCodeExportState.ts +478 -0
- package/apps/agents-server/src/app/api/admin/chat-tasks/[taskId]/terminal/route.ts +52 -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 +13 -13
- package/apps/agents-server/src/app/api/admin/update/route.ts +55 -8
- package/apps/agents-server/src/app/api/admin/update/versions/route.ts +34 -0
- package/apps/agents-server/src/app/api/auth/shibboleth/acs/route.ts +4 -2
- package/apps/agents-server/src/app/api/auth/shibboleth/login/route.ts +3 -1
- package/apps/agents-server/src/app/api/auth/shibboleth/metadata/route.ts +5 -2
- package/apps/agents-server/src/app/api/auth/shibboleth/status/route.ts +5 -2
- package/apps/agents-server/src/app/api/page-preview/check/route.ts +20 -5
- package/apps/agents-server/src/app/api/page-preview/input/route.ts +161 -0
- package/apps/agents-server/src/app/api/page-preview/screenshot/route.ts +21 -13
- package/apps/agents-server/src/app/api/page-preview/stream/route.ts +81 -0
- package/apps/agents-server/src/app/layout.tsx +55 -25
- package/apps/agents-server/src/app/system/utilities/mocked-chats/cloneMockedChatPreset.ts +17 -0
- package/apps/agents-server/src/app/system/utilities/mocked-chats/confirmDeleteMockedChat.ts +16 -0
- package/apps/agents-server/src/app/system/utilities/mocked-chats/createDraftWithUpdatedMessage.ts +81 -0
- package/apps/agents-server/src/app/system/utilities/mocked-chats/createDraftWithUpdatedParticipant.ts +146 -0
- package/apps/agents-server/src/app/system/utilities/mocked-chats/createDraftWithUpdatedSettings.ts +19 -0
- package/apps/agents-server/src/app/system/utilities/mocked-chats/createDuplicatedDraft.ts +66 -0
- package/apps/agents-server/src/app/system/utilities/mocked-chats/findMockedChatById.ts +51 -0
- package/apps/agents-server/src/app/system/utilities/mocked-chats/persistMockedChats.ts +51 -0
- package/apps/agents-server/src/app/system/utilities/mocked-chats/useMockedChatsEditorState.ts +16 -426
- package/apps/agents-server/src/components/AdminTerminal/AdminTerminalCard.tsx +32 -24
- package/apps/agents-server/src/components/AgentAvatar/AgentAvatar.tsx +1 -1
- package/apps/agents-server/src/components/AgentAvatar/DefaultAgentAvatarVisualProvider.tsx +1 -1
- package/apps/agents-server/src/components/CronJobConfiguration/CronJobConfiguration.tsx +834 -0
- package/apps/agents-server/src/components/Footer/Footer.tsx +38 -15
- package/apps/agents-server/src/components/Header/Header.tsx +16 -3
- package/apps/agents-server/src/components/Header/HeaderDesktopTopMenuNavigation.tsx +22 -2
- package/apps/agents-server/src/components/Header/HeaderHomepageLink.tsx +1 -1
- package/apps/agents-server/src/components/Header/HeaderMobileDrawer.tsx +22 -2
- package/apps/agents-server/src/components/Header/HeaderTypes.ts +12 -1
- package/apps/agents-server/src/components/Header/buildAgentMenuStructure.tsx +6 -4
- package/apps/agents-server/src/components/Header/buildDocumentationDropdownItems.tsx +198 -3
- package/apps/agents-server/src/components/Header/buildHeaderMenuItems.ts +6 -0
- package/apps/agents-server/src/components/Header/buildHeaderSystemMenuItems.ts +185 -18
- package/apps/agents-server/src/components/Homepage/buildFreeGraphBoxLayout.ts +446 -0
- package/apps/agents-server/src/components/Homepage/buildGraphLayoutNodes.ts +415 -157
- package/apps/agents-server/src/components/Homepage/useAgentsGraphCanvasState.ts +2 -1
- package/apps/agents-server/src/components/Homepage/useAgentsListState.ts +1 -1
- package/apps/agents-server/src/components/LayoutWrapper/LayoutWrapper.tsx +25 -6
- package/apps/agents-server/src/constants/defaultAgentAvatarVisual.ts +4 -3
- package/apps/agents-server/src/constants/harnessAuthRoutes.ts +20 -0
- package/apps/agents-server/src/database/metadataDefaults.ts +1 -1
- package/apps/agents-server/src/database/migrate.ts +25 -1
- package/apps/agents-server/src/database/migratePrefix.ts +24 -0
- package/apps/agents-server/src/database/runDatabaseMigrations.ts +9 -1
- package/apps/agents-server/src/database/sqlite/$provideLocalSqliteSupabase.ts +3 -1541
- package/apps/agents-server/src/database/sqlite/localSqliteSupabase/LocalSqliteQueryBuilder.ts +623 -0
- package/apps/agents-server/src/database/sqlite/localSqliteSupabase/LocalSqliteSupabaseClient.ts +64 -0
- package/apps/agents-server/src/database/sqlite/localSqliteSupabase/ensureTable.ts +93 -0
- package/apps/agents-server/src/database/sqlite/localSqliteSupabase/localSqliteFilters.ts +202 -0
- package/apps/agents-server/src/database/sqlite/localSqliteSupabase/localSqliteMutationPayload.ts +131 -0
- package/apps/agents-server/src/database/sqlite/localSqliteSupabase/localSqliteRowOperations.ts +102 -0
- package/apps/agents-server/src/database/sqlite/localSqliteSupabase/localSqliteSql.ts +59 -0
- package/apps/agents-server/src/database/sqlite/localSqliteSupabase/localSqliteTableSchema.ts +329 -0
- package/apps/agents-server/src/database/sqlite/localSqliteSupabase/localSqliteTypes.ts +84 -0
- package/apps/agents-server/src/database/sqlite/localSqliteSupabase/localSqliteValueCodec.ts +63 -0
- package/apps/agents-server/src/database/sqlite/localSqliteSupabase/normalizeSqliteError.ts +22 -0
- package/apps/agents-server/src/instrumentation-node.ts +15 -0
- package/apps/agents-server/src/languages/ServerTranslationKeys.ts +2 -1
- package/apps/agents-server/src/languages/translations/czech.yaml +3 -2
- package/apps/agents-server/src/languages/translations/english.yaml +2 -1
- package/apps/agents-server/src/search/createDefaultServerSearchProviders/loadLocalOrganizationSearchDataset.ts +12 -1
- package/apps/agents-server/src/tools/send_email.ts +1 -2
- package/apps/agents-server/src/{components/Homepage → utils/agentOrganization}/hiddenFolders.ts +49 -29
- package/apps/agents-server/src/utils/agentOrganization/loadAgentOrganizationState.ts +13 -1
- package/apps/agents-server/src/utils/backup/createServerBackupZipStream.ts +7 -1382
- package/apps/agents-server/src/utils/backup/serverBackup/appendAgentBackupEntriesToZip.ts +27 -0
- package/apps/agents-server/src/utils/backup/serverBackup/appendConversationBackupEntriesToZip.ts +140 -0
- package/apps/agents-server/src/utils/backup/serverBackup/appendFileBackupEntriesToZip.ts +147 -0
- package/apps/agents-server/src/utils/backup/serverBackup/appendMessageBackupEntriesToZip.ts +65 -0
- package/apps/agents-server/src/utils/backup/serverBackup/appendMetadataBackupEntriesToZip.ts +39 -0
- package/apps/agents-server/src/utils/backup/serverBackup/appendSectionEntriesToZip.ts +92 -0
- package/apps/agents-server/src/utils/backup/serverBackup/appendUserBackupEntriesToZip.ts +80 -0
- package/apps/agents-server/src/utils/backup/serverBackup/createRedactedWalletBackupRecord.ts +34 -0
- package/apps/agents-server/src/utils/backup/serverBackup/createServerBackupManifest.ts +82 -0
- package/apps/agents-server/src/utils/backup/serverBackup/downloadBackupBinaryContent.ts +39 -0
- package/apps/agents-server/src/utils/backup/serverBackup/resolveFeedbackThreadMessages.ts +53 -0
- package/apps/agents-server/src/utils/backup/serverBackup/serverBackupAttachments.ts +151 -0
- package/apps/agents-server/src/utils/backup/serverBackup/serverBackupContext.ts +167 -0
- package/apps/agents-server/src/utils/backup/serverBackup/serverBackupFilenames.ts +161 -0
- package/apps/agents-server/src/utils/backup/serverBackup/serverBackupPreviews.ts +97 -0
- package/apps/agents-server/src/utils/backup/serverBackup/serverBackupRowUtilities.ts +158 -0
- package/apps/agents-server/src/utils/backup/serverBackup/serverBackupTypes.ts +59 -0
- package/apps/agents-server/src/utils/chat/createAttachmentAwareCitationLabelResolver.ts +147 -0
- package/apps/agents-server/src/utils/chatTasksAdmin.ts +3 -2
- package/apps/agents-server/src/utils/createLocalAgentSourceImporter.ts +159 -0
- package/apps/agents-server/src/utils/createMissingImportedAgentFallback.ts +60 -0
- package/apps/agents-server/src/utils/createPagePreviewBrowserStream.ts +179 -0
- package/apps/agents-server/src/utils/customDomainRouting.ts +157 -12
- package/apps/agents-server/src/utils/externalChatRunner/processExternalUserChatJob.ts +12 -6
- package/apps/agents-server/src/utils/getAdminChatTasksResponse/getAdminChatTasks/GetAdminChatTasksData.ts +12 -0
- package/apps/agents-server/src/utils/getAdminChatTasksResponse/getAdminChatTasks/adminChatTaskSqlQuery.ts +264 -0
- package/apps/agents-server/src/utils/getAdminChatTasksResponse/getAdminChatTasks/adminChatTaskSqlValues.ts +35 -0
- package/apps/agents-server/src/utils/getAdminChatTasksResponse/getAdminChatTasks/adminChatTaskTimeUtilities.ts +30 -0
- package/apps/agents-server/src/utils/getAdminChatTasksResponse/getAdminChatTasks/compareAdminChatTasks.ts +135 -0
- package/apps/agents-server/src/utils/getAdminChatTasksResponse/getAdminChatTasks/createAdminChatTaskCounters.ts +29 -0
- package/apps/agents-server/src/utils/getAdminChatTasksResponse/getAdminChatTasks/filterAdminChatTasks.ts +78 -0
- package/apps/agents-server/src/utils/getAdminChatTasksResponse/getAdminChatTasks/getAdminChatTasksViaClientSql.ts +62 -0
- package/apps/agents-server/src/utils/getAdminChatTasksResponse/getAdminChatTasks/getAdminChatTasksViaSupabaseQuery.ts +29 -0
- package/apps/agents-server/src/utils/getAdminChatTasksResponse/getAdminChatTasks/loadAdminChatTaskFallbackData.ts +193 -0
- package/apps/agents-server/src/utils/getAdminChatTasksResponse/getAdminChatTasks/mapAdminChatTaskFallbackRows.ts +99 -0
- package/apps/agents-server/src/utils/getAdminChatTasksResponse/getAdminChatTasks/mapAdminChatTaskSqlRows.ts +94 -0
- package/apps/agents-server/src/utils/getAdminChatTasksResponse/getAdminChatTasks.ts +4 -947
- package/apps/agents-server/src/utils/getAdminChatTasksResponse/mapVpsSelfUpdateJobToAdminChatTask.ts +18 -5
- package/apps/agents-server/src/utils/getAdminChatTasksResponse.ts +103 -41
- package/apps/agents-server/src/utils/{codeRunnerAuthentication.ts → harnessAuthentication.ts} +72 -56
- package/apps/agents-server/src/utils/{codeRunnerConfiguration.ts → harnessConfiguration.ts} +18 -12
- package/apps/agents-server/src/utils/importAgentWithFallback.ts +1 -58
- package/apps/agents-server/src/utils/localAgentRouteReferences.ts +167 -0
- package/apps/agents-server/src/utils/localChatRunner/processLocalUserChatJob.ts +21 -6
- package/apps/agents-server/src/utils/managementApi/managementApiAgents.ts +17 -3
- package/apps/agents-server/src/utils/messages/sendMessage.ts +5 -3
- package/apps/agents-server/src/utils/pagePreviewBrowserSessions.ts +246 -0
- package/apps/agents-server/src/utils/resolveAgentStateFromSource.ts +7 -1
- package/apps/agents-server/src/utils/resolveInheritedAgentSource.ts +54 -5
- package/apps/agents-server/src/utils/resolveServerAgentContext.ts +12 -1
- package/apps/agents-server/src/utils/resolveStoredAgentState.ts +2 -1
- package/apps/agents-server/src/utils/resourceMonitor/formatResourceMonitorValue.ts +50 -0
- package/apps/agents-server/src/utils/resourceMonitor/readCpuResourceUsage.ts +75 -0
- package/apps/agents-server/src/utils/resourceMonitor/readDiskResourceUsage.ts +42 -0
- package/apps/agents-server/src/utils/resourceMonitor/readMemoryResourceUsage.ts +28 -0
- package/apps/agents-server/src/utils/resourceMonitor/readNetworkResourceUsage.ts +271 -0
- package/apps/agents-server/src/utils/resourceMonitor/readServerResourceMonitorSnapshot.ts +47 -0
- package/apps/agents-server/src/utils/resourceMonitor/resolveServerResourceWarningStatus.ts +72 -0
- package/apps/agents-server/src/utils/resourceMonitor/resourceMonitorConstants.ts +29 -0
- package/apps/agents-server/src/utils/resourceMonitor/resourceMonitorTypes.ts +155 -0
- package/apps/agents-server/src/utils/resourceMonitor/waitForResourceMonitorSample.ts +11 -0
- package/apps/agents-server/src/utils/shibbolethAuthentication/createShibbolethSamlClient.ts +35 -0
- package/apps/agents-server/src/utils/shibbolethAuthentication/createShibbolethServiceProviderMetadataXml.ts +25 -0
- package/apps/agents-server/src/utils/shibbolethAuthentication/extractShibbolethProfileAttributes.ts +173 -0
- package/apps/agents-server/src/utils/shibbolethAuthentication/fetchIdentityProviderMetadataXml.ts +21 -0
- package/apps/agents-server/src/utils/shibbolethAuthentication/findOrCreateShibbolethUser.ts +323 -0
- package/apps/agents-server/src/utils/shibbolethAuthentication/getShibbolethAuthenticationAttemptTableName.ts +13 -0
- package/apps/agents-server/src/utils/shibbolethAuthentication/getShibbolethRequestDetails.ts +19 -0
- package/apps/agents-server/src/utils/shibbolethAuthentication/getShibbolethUserIdentityTableName.ts +13 -0
- package/apps/agents-server/src/utils/shibbolethAuthentication/parseIdentityProviderMetadataXml.ts +110 -0
- package/apps/agents-server/src/utils/shibbolethAuthentication/recordShibbolethAuthenticationAttempt.ts +57 -0
- package/apps/agents-server/src/utils/shibbolethAuthentication/resolveShibbolethAuthenticationConfiguration.ts +78 -0
- package/apps/agents-server/src/utils/shibbolethAuthentication/resolveShibbolethPublicRequestUrl.ts +101 -0
- package/apps/agents-server/src/utils/shibbolethAuthentication/resolveShibbolethServiceProviderUrls.ts +63 -0
- package/apps/agents-server/src/utils/shibbolethAuthentication/sanitizeShibbolethRelayState.ts +17 -0
- package/apps/agents-server/src/utils/shibbolethAuthentication/shibbolethAuthenticationConstants.ts +62 -0
- package/apps/agents-server/src/utils/shibbolethAuthentication/shibbolethAuthenticationTypes.ts +105 -0
- package/apps/agents-server/src/utils/shibbolethAuthentication.ts +25 -957
- package/apps/agents-server/src/utils/speech-to-text/SpeechToTextFailoverRecognition/SpeechToTextFailoverRecognitionProviderRuntime.ts +0 -1
- package/apps/agents-server/src/utils/speech-to-text/SpeechToTextFailoverRecognition.ts +34 -2
- package/apps/agents-server/src/utils/taskTerminal/resolveAdminTaskTerminalSession.ts +535 -0
- package/apps/agents-server/src/utils/taskTerminal/runWithTaskTerminalCapture.ts +134 -0
- package/apps/agents-server/src/utils/taskTerminal/taskTerminalLog.ts +360 -0
- package/apps/agents-server/src/utils/userChat/finalizeUserChatJob.ts +16 -0
- package/apps/agents-server/src/utils/userChat/userChatMessageLifecycle.ts +39 -9
- package/apps/agents-server/src/utils/userChatTimeout/userChatTimeoutStore/updateUserChatTimeoutTerminalState.ts +3 -0
- package/apps/agents-server/src/utils/userChatTimeout/userChatTimeoutWorker.ts +4 -1
- package/apps/agents-server/src/utils/vpsConfiguration.ts +7 -3
- package/apps/agents-server/src/utils/vpsSelfUpdate/deleteVpsSelfUpdateInstalledVersion.ts +81 -0
- package/apps/agents-server/src/utils/vpsSelfUpdate/listVpsSelfUpdateCandidateCommits.ts +217 -0
- package/apps/agents-server/src/utils/vpsSelfUpdate/readAgentsServerFooterVersion.ts +335 -0
- package/apps/agents-server/src/utils/vpsSelfUpdate/readPersistedVpsSelfUpdateJob.ts +310 -0
- package/apps/agents-server/src/utils/vpsSelfUpdate/readVpsSelfUpdateOverview.ts +178 -0
- package/apps/agents-server/src/utils/vpsSelfUpdate/resolveVpsSelfUpdateJobForOverview.ts +42 -0
- package/apps/agents-server/src/utils/vpsSelfUpdate/startVpsSelfUpdate.ts +201 -0
- package/apps/agents-server/src/utils/vpsSelfUpdate/vpsSelfUpdateAutomaticConfiguration.ts +152 -0
- package/apps/agents-server/src/utils/vpsSelfUpdate/vpsSelfUpdateConfiguration.ts +81 -0
- package/apps/agents-server/src/utils/vpsSelfUpdate/vpsSelfUpdateCron.ts +357 -0
- package/apps/agents-server/src/utils/vpsSelfUpdate/vpsSelfUpdateEnvironment.ts +120 -0
- package/apps/agents-server/src/utils/vpsSelfUpdate/vpsSelfUpdateInstalledVersions.ts +162 -0
- package/apps/agents-server/src/utils/vpsSelfUpdate/vpsSelfUpdateJobConstants.ts +15 -0
- package/apps/agents-server/src/utils/vpsSelfUpdate/vpsSelfUpdateJobHistory.ts +490 -0
- package/apps/agents-server/src/utils/vpsSelfUpdate/vpsSelfUpdateJobIdentity.ts +26 -0
- package/apps/agents-server/src/utils/vpsSelfUpdate/vpsSelfUpdateOriginRepository.ts +90 -0
- package/apps/agents-server/src/utils/vpsSelfUpdate/vpsSelfUpdateRepository.ts +286 -0
- package/apps/agents-server/src/utils/vpsSelfUpdate/vpsSelfUpdateScheduler.ts +191 -0
- package/apps/agents-server/src/utils/vpsSelfUpdate/vpsSelfUpdateStateFiles.ts +197 -0
- package/apps/agents-server/src/utils/vpsSelfUpdate/vpsSelfUpdateTypes.ts +452 -0
- package/apps/agents-server/src/utils/vpsSelfUpdate.ts +66 -1547
- package/apps/agents-server/tests/e2e/support/ChatHistoryNavigationSupport.ts +5 -0
- package/esm/apps/agents-server/src/database/migratePrefix.d.ts +19 -0
- package/esm/apps/agents-server/src/database/runDatabaseMigrations.d.ts +4 -0
- package/esm/book/scripts/import-markdown/increaseHeadings.d.ts +8 -0
- package/esm/index.es.js +30174 -28539
- package/esm/index.es.js.map +1 -1
- package/esm/scripts/find-refactor-candidates/find-refactor-candidates.d.ts +7 -0
- package/esm/scripts/find-refactor-candidates/selectMostImportantRefactorCandidates.d.ts +12 -0
- package/esm/scripts/run-agent-messages/main/runMultipleAgentMessages/MultipleAgentAutoPuller.d.ts +27 -0
- package/esm/scripts/run-agent-messages/main/runMultipleAgentMessages/MultipleAgentGithubSynchronizer.d.ts +26 -0
- package/esm/scripts/run-agent-messages/main/runMultipleAgentMessages/MultipleAgentRunUiPresenter.d.ts +66 -0
- package/esm/scripts/run-agent-messages/main/runMultipleAgentMessages/RunMultipleAgentMessageTaskScheduler.d.ts +67 -0
- package/esm/scripts/run-agent-messages/main/runMultipleAgentMessages/formatProjectPath.d.ts +6 -0
- package/esm/scripts/run-agent-messages/main/runMultipleAgentMessages/loadLocalAgentRunnerProjectSummaries.d.ts +11 -0
- package/esm/scripts/run-agent-messages/main/runMultipleAgentMessages/wait.d.ts +6 -0
- package/esm/scripts/run-agent-messages/main/runMultipleAgentMessages.d.ts +1 -1
- package/esm/scripts/run-codex-prompts/common/buildCoderRunProgressSnapshot.d.ts +1 -1
- package/esm/scripts/run-codex-prompts/common/cliProgressDisplay.d.ts +2 -1
- package/esm/scripts/run-codex-prompts/common/resolveCoderAgent.d.ts +20 -0
- package/esm/scripts/run-codex-prompts/common/sleepWithCountdown.d.ts +1 -0
- package/esm/scripts/run-codex-prompts/common/waitUntilWorldTimeDeadline.d.ts +17 -0
- package/esm/scripts/run-codex-prompts/runners/claude-code/ClaudeCodeRunner.d.ts +4 -0
- package/esm/scripts/run-codex-prompts/runners/claude-code/ClaudeCodeSessionResurrection.d.ts +37 -0
- package/esm/scripts/run-codex-prompts/runners/claude-code/parseClaudeCodeOutputEvents.d.ts +47 -0
- package/esm/scripts/run-codex-prompts/ui/CoderRunUiState.d.ts +8 -1
- package/esm/scripts/run-codex-prompts/ui/buildCoderRunAgentVisual.d.ts +41 -0
- package/esm/scripts/run-codex-prompts/ui/buildCoderRunUiFrame.d.ts +10 -0
- package/esm/scripts/run-codex-prompts/ui/coderRunUiRefresh.d.ts +2 -2
- package/esm/src/_packages/types.index.d.ts +2 -2
- package/esm/src/avatars/renderAvatarVisualAsciiArt.d.ts +98 -0
- package/esm/src/avatars/visuals/octopus3dAvatarVisualShared.d.ts +1 -1
- package/esm/src/book-components/BookEditor/BookEditorMonacoUploadPanel.d.ts +1 -1
- package/esm/src/book-components/BookEditor/useBookEditorMonacoUploads/bookEditorMonacoUploadTypes.d.ts +120 -0
- package/esm/src/book-components/BookEditor/useBookEditorMonacoUploads/clearScheduledTimer.d.ts +6 -0
- package/esm/src/book-components/BookEditor/useBookEditorMonacoUploads/enqueueFilesForUpload.d.ts +26 -0
- package/esm/src/book-components/BookEditor/useBookEditorMonacoUploads/useBookEditorMonacoUploadEditorSync.d.ts +23 -0
- package/esm/src/book-components/BookEditor/useBookEditorMonacoUploads/useBookEditorMonacoUploadItemsState.d.ts +21 -0
- package/esm/src/book-components/BookEditor/useBookEditorMonacoUploads/useBookEditorMonacoUploadProgressQueue.d.ts +12 -0
- package/esm/src/book-components/BookEditor/useBookEditorMonacoUploads/useBookEditorMonacoUploadQueue.d.ts +27 -0
- package/esm/src/book-components/BookEditor/useBookEditorMonacoUploads/useCompletedUploadsAutoClear.d.ts +12 -0
- package/esm/src/book-components/BookEditor/useBookEditorMonacoUploads.d.ts +5 -58
- package/esm/src/book-components/Chat/Chat/ChatImageAttachmentModal.d.ts +25 -0
- package/esm/src/book-components/Chat/Chat/ChatInputArea.d.ts +3 -0
- package/esm/src/book-components/Chat/Chat/ChatMessageAttachments.d.ts +27 -0
- package/esm/src/book-components/Chat/Chat/ChatMessageItem.d.ts +1 -1
- package/esm/src/book-components/Chat/Chat/ChatMessageList.d.ts +1 -0
- package/esm/src/book-components/Chat/Chat/ChatProps.d.ts +8 -0
- package/esm/src/book-components/Chat/Chat/CitationIframePreview.d.ts +1 -1
- package/esm/src/book-components/Chat/Chat/CitationIframePreview.test.d.ts +2 -0
- package/esm/src/book-components/Chat/Chat/insertDictationChunk.d.ts +1 -1
- package/esm/src/book-components/Chat/Chat/insertDictationChunk.test.d.ts +1 -0
- package/esm/src/book-components/Chat/Chat/learnDictationDictionary.test.d.ts +1 -0
- package/esm/src/book-components/Chat/Chat/refineFinalDictationChunk.test.d.ts +1 -0
- package/esm/src/book-components/Chat/Chat/useChatInputAreaComposer.d.ts +12 -0
- package/esm/src/book-components/Chat/Chat/useChatInputAreaComposer.draftMessage.test.d.ts +2 -0
- package/esm/src/book-components/Chat/utils/isVisibleChatToolCall.d.ts +1 -1
- package/esm/src/book-components/Chat/utils/parseMessageButtons.d.ts +16 -2
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/AGENTS_SERVER_BUILD_CACHE_FILENAME.d.ts +6 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/AGENTS_SERVER_BUILD_CACHE_VERSION.d.ts +6 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/AGENTS_SERVER_NEXT_BUILD_ID_FILENAME.d.ts +6 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/AgentsServerBuildCache.d.ts +10 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/AgentsServerBuildCacheOptions.d.ts +10 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/NODE_MODULES_DIRECTORY_NAME.d.ts +6 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/PreparedAgentsServerRuntime.d.ts +18 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/createAgentsServerBuildSourceFingerprint.d.ts +6 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/createAgentsServerRuntimeEnvironment.d.ts +28 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/ensureAgentsServerBuild.d.ts +19 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/getAgentsServerBuildInputRelativePaths.d.ts +11 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/isAgentsServerAppPath.d.ts +6 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/isAgentsServerAppPathMaterialized.d.ts +6 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/isAgentsServerBuildCacheCurrent.d.ts +7 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/isAgentsServerBuildInputTestFile.d.ts +6 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/isExcludedAgentsServerBuildInputDirectoryName.d.ts +6 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/isExcludedAgentsServerBuildInputPath.d.ts +6 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/isExcludedAgentsServerRuntimeSourcePath.d.ts +6 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/isFile.d.ts +6 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/isPathInsideNodeModules.d.ts +6 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/normalizeAgentsServerBuildInputPath.d.ts +6 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/prepareAgentsServerRuntime.d.ts +9 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/readAgentsServerBuildCache.d.ts +8 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/resolveAgentsServerAppPath.d.ts +6 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/resolveAgentsServerBuildAppPath.d.ts +9 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/resolveAgentsServerBuildOutputPath.d.ts +7 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/resolveNextCliPath.d.ts +6 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/resolveNodeModulesPath.d.ts +6 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/runNextBuild.d.ts +12 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/shouldCopyAgentsServerRuntimePath.d.ts +6 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/synchronizeMaterializedAgentsServerRuntime.d.ts +11 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/writeAgentsServerBuildCache.d.ts +7 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer.d.ts +8 -109
- package/esm/src/cli/cli-commands/agents-server/ensureAgentsServerEnvFile.d.ts +1 -1
- package/esm/src/cli/cli-commands/agents-server/ensureAgentsServerGitignoreFile.d.ts +1 -1
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerChildEnvironment.d.ts +16 -0
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerLogStreams.d.ts +30 -0
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerRuntimePaths.d.ts +19 -0
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerSupervisorState.d.ts +37 -0
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/LocalAgentRunnerLimits.d.ts +9 -0
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/PreparedAgentsServerLaunch.d.ts +13 -0
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/StartAgentsServerOptions.d.ts +24 -0
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/createInternalRouteErrorMessage.d.ts +6 -0
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/createLocalAgentRunOptions.d.ts +9 -0
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/forwardChildOutput.d.ts +13 -0
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/loadAgentsServerProjectEnvironment.d.ts +6 -0
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/prepareAgentsServerLaunch.d.ts +18 -0
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/readInternalRouteErrorDetails.d.ts +6 -0
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/resolveAgentsServerChildHostname.d.ts +7 -0
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/startNextServer.d.ts +20 -0
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/startUserChatJobWorkerPump.d.ts +15 -0
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/stopChildProcess.d.ts +8 -0
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/waitForLocalAgentRunnerLimits.d.ts +16 -0
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer.d.ts +3 -30
- package/esm/src/cli/cli-commands/common/createPositiveIntegerOptionParser.d.ts +10 -0
- package/esm/src/cli/cli-commands/common/promptRunnerCliOptions.d.ts +1 -1
- package/esm/src/collection/agent-collection/CreateAgentInput.d.ts +1 -1
- package/esm/src/collection/agent-collection/constructors/agent-collection-in-supabase/prepareAgentSourceForPersistence.d.ts +1 -1
- package/esm/src/commitments/META/META.d.ts +2 -2
- package/esm/src/commitments/META_AVATAR/META_AVATAR.d.ts +9 -4
- package/esm/src/commitments/index.d.ts +1 -1
- package/esm/src/conversion/validation/validatePipeline/createPipelineValidationContext.d.ts +16 -0
- package/esm/src/conversion/validation/validatePipeline/validatePipelineCollectionsStructure.d.ts +7 -0
- package/esm/src/conversion/validation/validatePipeline/validatePipelineDependencyResolution.d.ts +7 -0
- package/esm/src/conversion/validation/validatePipeline/validatePipelineMetadata.d.ts +7 -0
- package/esm/src/conversion/validation/validatePipeline/validatePipelineParameters.d.ts +7 -0
- package/esm/src/conversion/validation/validatePipeline/validatePipelineTasks.d.ts +7 -0
- package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/RegisteredLlmToolsMessageContext.d.ts +46 -0
- package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/USED_ENV_FILENAME.d.ts +11 -0
- package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolConfigurationStatusMessage.d.ts +7 -0
- package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolEntryKey.d.ts +7 -0
- package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolInstallationStatusMessage.d.ts +7 -0
- package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolStatus.d.ts +14 -0
- package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolsMessageContext.d.ts +7 -0
- package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/getAvailableRegisteredLlmToolsEnvironmentVariables.d.ts +7 -0
- package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/getRegisteredLlmToolRegisters.d.ts +7 -0
- package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/hasRegisteredLlmToolEntry.d.ts +7 -0
- package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/listRegisteredLlmToolEntries.d.ts +9 -0
- package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/listRegisteredLlmToolStatuses.d.ts +7 -0
- package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/renderAvailableRegisteredLlmTools.d.ts +7 -0
- package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/renderNoRegisteredLlmToolsMessage.d.ts +7 -0
- package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/renderRegisteredLlmToolsMessage.d.ts +8 -0
- package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/renderRelevantRegisteredLlmToolsEnvironmentVariables.d.ts +7 -0
- package/esm/src/utils/agent-message-runtime/agentMessageRuntimePaths.d.ts +24 -0
- package/esm/src/utils/agents/resolveAgentAvatarImageUrl.d.ts +2 -2
- package/esm/src/utils/agents/terminalAgentAvatarVisual.d.ts +94 -0
- package/esm/src/utils/agents/terminalAgentAvatarVisual.test.d.ts +1 -0
- package/esm/src/utils/ascii-art/$detectTerminalAnsiColorDepth.d.ts +15 -0
- package/esm/src/utils/ascii-art/convertImageDataToAsciiArt.d.ts +80 -0
- package/esm/src/utils/color/Color.d.ts +1 -1
- package/esm/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/_packages/types.index.ts +2 -2
- package/src/avatars/Avatar.tsx +2 -13
- package/src/avatars/avatarAnimationScheduler.ts +2 -1
- package/src/avatars/renderAvatarVisual.ts +2 -13
- package/src/avatars/renderAvatarVisualAsciiArt.ts +257 -0
- package/src/avatars/visuals/asciiOctopusAvatarVisual.ts +1 -6
- package/src/avatars/visuals/avatarVisualRegistry.ts +1 -1
- package/src/avatars/visuals/minecraft2AvatarVisual.ts +1 -2
- package/src/avatars/visuals/octopus2AvatarVisual.ts +1 -5
- package/src/avatars/visuals/octopus3AvatarVisual.ts +1 -8
- package/src/avatars/visuals/octopus3d2AvatarVisual.ts +4 -13
- package/src/avatars/visuals/octopus3d3AvatarVisual.ts +10 -15
- package/src/avatars/visuals/octopus3d4AvatarVisual.ts +18 -31
- package/src/avatars/visuals/octopus3dAvatarVisual.ts +3 -3
- package/src/avatars/visuals/octopus3dAvatarVisualShared.ts +2 -7
- package/src/book-2.0/agent-source/parseAgentSource/applyMetaCommitment.ts +2 -1
- package/src/book-2.0/book-language-documentation/createStandaloneBookLanguageMarkdown.ts +3 -5
- package/src/book-3.0/CliAgent.ts +1 -7
- package/src/book-3.0/LiteAgent.ts +5 -5
- package/src/book-components/AvatarProfile/AvatarProfile/AvatarProfile.tsx +1 -4
- package/src/book-components/BookEditor/BookEditor.tsx +2 -2
- package/src/book-components/BookEditor/BookEditorAboutPromptbookInformation.tsx +3 -2
- package/src/book-components/BookEditor/BookEditorActionbar.tsx +1 -1
- package/src/book-components/BookEditor/BookEditorMonaco.tsx +2 -2
- package/src/book-components/BookEditor/BookEditorMonacoUploadPanel.tsx +1 -1
- package/src/book-components/BookEditor/useBookEditorMonacoLanguage.ts +1 -1
- package/src/book-components/BookEditor/useBookEditorMonacoStyles.ts +1 -1
- package/src/book-components/BookEditor/useBookEditorMonacoUploads/bookEditorMonacoUploadTypes.ts +147 -0
- package/src/book-components/BookEditor/useBookEditorMonacoUploads/clearScheduledTimer.ts +10 -0
- package/src/book-components/BookEditor/useBookEditorMonacoUploads/enqueueFilesForUpload.ts +209 -0
- package/src/book-components/BookEditor/useBookEditorMonacoUploads/useBookEditorMonacoUploadEditorSync.ts +164 -0
- package/src/book-components/BookEditor/useBookEditorMonacoUploads/useBookEditorMonacoUploadItemsState.ts +121 -0
- package/src/book-components/BookEditor/useBookEditorMonacoUploads/useBookEditorMonacoUploadProgressQueue.ts +81 -0
- package/src/book-components/BookEditor/useBookEditorMonacoUploads/useBookEditorMonacoUploadQueue.ts +360 -0
- package/src/book-components/BookEditor/useBookEditorMonacoUploads/useCompletedUploadsAutoClear.ts +47 -0
- package/src/book-components/BookEditor/useBookEditorMonacoUploads.ts +10 -1067
- package/src/book-components/Chat/Chat/Chat.module.css +199 -12
- package/src/book-components/Chat/Chat/Chat.tsx +16 -1
- package/src/book-components/Chat/Chat/ChatCitationModal.tsx +2 -2
- package/src/book-components/Chat/Chat/ChatImageAttachmentModal.tsx +108 -0
- package/src/book-components/Chat/Chat/ChatInputArea.tsx +43 -27
- package/src/book-components/Chat/Chat/ChatMessageAttachments.tsx +212 -0
- package/src/book-components/Chat/Chat/ChatMessageItem.tsx +32 -18
- package/src/book-components/Chat/Chat/ChatMessageList.tsx +3 -0
- package/src/book-components/Chat/Chat/ChatProps.tsx +9 -0
- package/src/book-components/Chat/Chat/CitationIframePreview.tsx +108 -156
- package/src/book-components/Chat/Chat/createProgressCardChecklistMarkdown.ts +1 -8
- package/src/book-components/Chat/Chat/insertDictationChunk.ts +3 -3
- package/src/book-components/Chat/Chat/learnDictationDictionary.ts +1 -1
- package/src/book-components/Chat/Chat/renderTimeoutToolCallDetails.tsx +1 -5
- package/src/book-components/Chat/Chat/useChatInputAreaComposer.ts +59 -7
- package/src/book-components/Chat/Chat/useChatInputAreaDictation.ts +140 -33
- package/src/book-components/Chat/Chat/useChatToolCallModalState.ts +1 -4
- package/src/book-components/Chat/hooks/useChatRatings.ts +1 -1
- package/src/book-components/Chat/save/html/htmlSaveFormatDefinition.ts +2 -3
- package/src/book-components/Chat/save/markdown/mdSaveFormatDefinition.ts +2 -2
- package/src/book-components/Chat/save/pdf/buildChatPdf.ts +1 -1
- package/src/book-components/Chat/utils/getToolCallChipletInfo.ts +1 -5
- package/src/book-components/Chat/utils/isVisibleChatToolCall.ts +2 -1
- package/src/book-components/Chat/utils/parseMessageButtons.ts +27 -2
- package/src/cli/cli-commands/about.ts +1 -1
- package/src/cli/cli-commands/agent/agentCliOptions.ts +2 -5
- package/src/cli/cli-commands/agent-folder/agentProjectPaths.ts +6 -12
- package/src/cli/cli-commands/agent-folder/init.ts +3 -8
- package/src/cli/cli-commands/agent-folder/initializeAgentProjectConfiguration.ts +2 -11
- package/src/cli/cli-commands/agent-folder/printAgentInitializationSummary.ts +2 -9
- package/src/cli/cli-commands/agents-server/buildAgentsServer/AGENTS_SERVER_BUILD_CACHE_FILENAME.ts +6 -0
- package/src/cli/cli-commands/agents-server/buildAgentsServer/AGENTS_SERVER_BUILD_CACHE_VERSION.ts +6 -0
- package/src/cli/cli-commands/agents-server/buildAgentsServer/AGENTS_SERVER_NEXT_BUILD_ID_FILENAME.ts +6 -0
- package/src/cli/cli-commands/agents-server/buildAgentsServer/AgentsServerBuildCache.ts +11 -0
- package/src/cli/cli-commands/agents-server/buildAgentsServer/AgentsServerBuildCacheOptions.ts +9 -0
- package/src/cli/cli-commands/agents-server/buildAgentsServer/NODE_MODULES_DIRECTORY_NAME.ts +6 -0
- package/src/cli/cli-commands/agents-server/buildAgentsServer/PreparedAgentsServerRuntime.ts +19 -0
- package/src/cli/cli-commands/agents-server/buildAgentsServer/createAgentsServerBuildSourceFingerprint.ts +71 -0
- package/src/cli/cli-commands/agents-server/buildAgentsServer/createAgentsServerRuntimeEnvironment.ts +69 -0
- package/src/cli/cli-commands/agents-server/buildAgentsServer/ensureAgentsServerBuild.ts +59 -0
- package/src/cli/cli-commands/agents-server/buildAgentsServer/getAgentsServerBuildInputRelativePaths.ts +23 -0
- package/src/cli/cli-commands/agents-server/buildAgentsServer/isAgentsServerAppPath.ts +20 -0
- package/src/cli/cli-commands/agents-server/buildAgentsServer/isAgentsServerAppPathMaterialized.ts +17 -0
- package/src/cli/cli-commands/agents-server/buildAgentsServer/isAgentsServerBuildCacheCurrent.ts +27 -0
- package/src/cli/cli-commands/agents-server/buildAgentsServer/isAgentsServerBuildInputTestFile.ts +21 -0
- package/src/cli/cli-commands/agents-server/buildAgentsServer/isExcludedAgentsServerBuildInputDirectoryName.ts +22 -0
- package/src/cli/cli-commands/agents-server/buildAgentsServer/isExcludedAgentsServerBuildInputPath.ts +30 -0
- package/src/cli/cli-commands/agents-server/buildAgentsServer/isExcludedAgentsServerRuntimeSourcePath.ts +41 -0
- package/src/cli/cli-commands/agents-server/buildAgentsServer/isFile.ts +14 -0
- package/src/cli/cli-commands/agents-server/buildAgentsServer/isPathInsideNodeModules.ts +10 -0
- package/src/cli/cli-commands/agents-server/buildAgentsServer/normalizeAgentsServerBuildInputPath.ts +10 -0
- package/src/cli/cli-commands/agents-server/buildAgentsServer/prepareAgentsServerRuntime.ts +31 -0
- package/src/cli/cli-commands/agents-server/buildAgentsServer/readAgentsServerBuildCache.ts +35 -0
- package/src/cli/cli-commands/agents-server/buildAgentsServer/resolveAgentsServerAppPath.ts +33 -0
- package/src/cli/cli-commands/agents-server/buildAgentsServer/resolveAgentsServerBuildAppPath.ts +30 -0
- package/src/cli/cli-commands/agents-server/buildAgentsServer/resolveAgentsServerBuildOutputPath.ts +19 -0
- package/src/cli/cli-commands/agents-server/buildAgentsServer/resolveNextCliPath.ts +21 -0
- package/src/cli/cli-commands/agents-server/buildAgentsServer/resolveNodeModulesPath.ts +19 -0
- package/src/cli/cli-commands/agents-server/buildAgentsServer/runNextBuild.ts +184 -0
- package/src/cli/cli-commands/agents-server/buildAgentsServer/shouldCopyAgentsServerRuntimePath.ts +48 -0
- package/src/cli/cli-commands/agents-server/buildAgentsServer/synchronizeMaterializedAgentsServerRuntime.ts +179 -0
- package/src/cli/cli-commands/agents-server/buildAgentsServer/writeAgentsServerBuildCache.ts +28 -0
- package/src/cli/cli-commands/agents-server/buildAgentsServer.ts +22 -1043
- package/src/cli/cli-commands/agents-server/ensureAgentsServerEnvFile.ts +2 -1
- package/src/cli/cli-commands/agents-server/ensureAgentsServerGitignoreFile.ts +2 -1
- package/src/cli/cli-commands/agents-server/run.ts +2 -5
- package/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerChildEnvironment.ts +67 -0
- package/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerLogStreams.ts +43 -0
- package/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerRuntimePaths.ts +44 -0
- package/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerSupervisorState.ts +59 -0
- package/src/cli/cli-commands/agents-server/startAgentsServer/LocalAgentRunnerLimits.ts +9 -0
- package/src/cli/cli-commands/agents-server/startAgentsServer/PreparedAgentsServerLaunch.ts +14 -0
- package/src/cli/cli-commands/agents-server/startAgentsServer/StartAgentsServerOptions.ts +26 -0
- package/src/cli/cli-commands/agents-server/startAgentsServer/createInternalRouteErrorMessage.ts +15 -0
- package/src/cli/cli-commands/agents-server/startAgentsServer/createLocalAgentRunOptions.ts +29 -0
- package/src/cli/cli-commands/agents-server/startAgentsServer/forwardChildOutput.ts +32 -0
- package/src/cli/cli-commands/agents-server/startAgentsServer/loadAgentsServerProjectEnvironment.ts +18 -0
- package/src/cli/cli-commands/agents-server/startAgentsServer/prepareAgentsServerLaunch.ts +81 -0
- package/src/cli/cli-commands/agents-server/startAgentsServer/readInternalRouteErrorDetails.ts +52 -0
- package/src/cli/cli-commands/agents-server/startAgentsServer/resolveAgentsServerChildHostname.ts +17 -0
- package/src/cli/cli-commands/agents-server/startAgentsServer/startNextServer.ts +97 -0
- package/src/cli/cli-commands/agents-server/startAgentsServer/startUserChatJobWorkerPump.ts +132 -0
- package/src/cli/cli-commands/agents-server/startAgentsServer/stopChildProcess.ts +14 -0
- package/src/cli/cli-commands/agents-server/startAgentsServer/waitForLocalAgentRunnerLimits.ts +132 -0
- package/src/cli/cli-commands/agents-server/startAgentsServer.ts +24 -797
- package/src/cli/cli-commands/agents-server.ts +2 -6
- package/src/cli/cli-commands/coder/agentCodingFile.ts +1 -7
- package/src/cli/cli-commands/coder/boilerplateTemplates.ts +14 -21
- package/src/cli/cli-commands/coder/find-refactor-candidates.ts +9 -2
- package/src/cli/cli-commands/coder/generate-boilerplates.ts +2 -6
- package/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.ts +2 -10
- package/src/cli/cli-commands/coder/run.ts +3 -27
- package/src/cli/cli-commands/coder/server.ts +4 -2
- package/src/cli/cli-commands/common/createPositiveIntegerOptionParser.ts +31 -0
- package/src/cli/cli-commands/common/promptRunnerCliOptions.ts +3 -8
- package/src/cli/cli-commands/make.ts +1 -1
- package/src/cli/cli-commands/run/runCommandAction.ts +1 -1
- package/src/cli/promptbookCli.ts +28 -3
- package/src/collection/agent-collection/CreateAgentInput.ts +2 -5
- package/src/collection/agent-collection/constructors/agent-collection-in-supabase/prepareAgentSourceForPersistence.ts +1 -1
- package/src/commitments/MEMORY/createMemoryToolFunctions.ts +1 -10
- package/src/commitments/MEMORY/getMemoryToolRuntimeAdapterOrDisabledResult.ts +1 -10
- package/src/commitments/MEMORY/parseMemoryToolArgs.ts +1 -6
- package/src/commitments/META/META.ts +4 -4
- package/src/commitments/META_AVATAR/META_AVATAR.ts +16 -10
- package/src/commitments/TEAM/TEAM.ts +5 -5
- package/src/commitments/USE_CALENDAR/createUseCalendarToolFunctions.ts +1 -4
- package/src/commitments/USE_PROJECT/createUseProjectToolFunctions.ts +2 -10
- package/src/commitments/USE_TIMEOUT/createTimeoutToolFunctions.ts +1 -11
- package/src/commitments/USE_TIMEOUT/getTimeoutToolRuntimeAdapterOrDisabledResult.ts +1 -6
- package/src/commitments/USE_TIMEOUT/parseTimeoutToolArgs.ts +1 -6
- package/src/commitments/WALLET/createWalletToolFunctions.ts +2 -11
- package/src/commitments/WALLET/getWalletToolRuntimeAdapterOrDisabledResult.ts +1 -6
- package/src/commitments/WALLET/parseWalletToolArgs.ts +1 -10
- package/src/commitments/index.ts +1 -0
- package/src/conversion/parsePipeline/applyPipelineHead.ts +1 -1
- package/src/conversion/parsePipeline/createUniqueSectionNameResolver.ts +1 -1
- package/src/conversion/parsePipeline/processPipelineSection.ts +1 -1
- package/src/conversion/validation/validatePipeline/createPipelineValidationContext.ts +43 -0
- package/src/conversion/validation/validatePipeline/validatePipelineCollectionsStructure.ts +72 -0
- package/src/conversion/validation/validatePipeline/validatePipelineDependencyResolution.ts +220 -0
- package/src/conversion/validation/validatePipeline/validatePipelineMetadata.ts +66 -0
- package/src/conversion/validation/validatePipeline/validatePipelineParameters.ts +136 -0
- package/src/conversion/validation/validatePipeline/validatePipelineTasks.ts +243 -0
- package/src/conversion/validation/validatePipeline.ts +7 -750
- package/src/execution/LlmExecutionTools.ts +1 -6
- package/src/execution/createPipelineExecutor/getReservedParametersForTask.ts +1 -5
- package/src/llm-providers/_common/register/$registeredLlmToolsMessage/RegisteredLlmToolsMessageContext.ts +51 -0
- package/src/llm-providers/_common/register/$registeredLlmToolsMessage/USED_ENV_FILENAME.ts +30 -0
- package/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolConfigurationStatusMessage.ts +62 -0
- package/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolEntryKey.ts +10 -0
- package/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolInstallationStatusMessage.ts +75 -0
- package/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolStatus.ts +101 -0
- package/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolsMessageContext.ts +24 -0
- package/src/llm-providers/_common/register/$registeredLlmToolsMessage/getAvailableRegisteredLlmToolsEnvironmentVariables.ts +17 -0
- package/src/llm-providers/_common/register/$registeredLlmToolsMessage/getRegisteredLlmToolRegisters.ts +15 -0
- package/src/llm-providers/_common/register/$registeredLlmToolsMessage/hasRegisteredLlmToolEntry.ts +19 -0
- package/src/llm-providers/_common/register/$registeredLlmToolsMessage/listRegisteredLlmToolEntries.ts +44 -0
- package/src/llm-providers/_common/register/$registeredLlmToolsMessage/listRegisteredLlmToolStatuses.ts +21 -0
- package/src/llm-providers/_common/register/$registeredLlmToolsMessage/renderAvailableRegisteredLlmTools.ts +97 -0
- package/src/llm-providers/_common/register/$registeredLlmToolsMessage/renderNoRegisteredLlmToolsMessage.ts +17 -0
- package/src/llm-providers/_common/register/$registeredLlmToolsMessage/renderRegisteredLlmToolsMessage.ts +30 -0
- package/src/llm-providers/_common/register/$registeredLlmToolsMessage/renderRelevantRegisteredLlmToolsEnvironmentVariables.ts +32 -0
- package/src/llm-providers/_common/register/$registeredLlmToolsMessage.ts +5 -568
- package/src/llm-providers/_common/utils/count-total-usage/limitTotalUsage.ts +1 -6
- package/src/llm-providers/openai/OpenAiAgentKitExecutionTools.ts +2 -2
- package/src/llm-providers/openai/OpenAiAssistantExecutionTools.ts +1 -1
- package/src/llm-providers/openai/OpenAiAssistantExecutionToolsStreamRunner.ts +2 -2
- package/src/llm-providers/openai/OpenAiAssistantExecutionToolsToolRunner.ts +1 -1
- package/src/llm-providers/openai/OpenAiCompatibleExecutionTools.ts +2 -7
- package/src/llm-providers/openai/utils/OpenAiCompatibleChatPromptBuilder.ts +1 -1
- package/src/llm-providers/openai/utils/OpenAiCompatibleChatToolCaller.ts +2 -2
- package/src/llm-providers/openai/utils/OpenAiCompatibleUnsupportedParameterRetrier.ts +1 -5
- package/src/llm-providers/openai/utils/buildToolInvocationScript.ts +1 -6
- package/src/other/templates/getTemplatesPipelineCollection.ts +840 -755
- package/src/remote-server/startRemoteServer/registerExecutionRoutes.ts +1 -1
- package/src/remote-server/startRemoteServer/registerServerIndexRoute.ts +1 -1
- package/src/scrapers/_common/utils/makeKnowledgeSourceHandler.ts +1 -6
- package/src/speech-recognition/OpenAiSpeechRecognition.ts +1 -6
- package/src/transpilers/_common/prepareSdkTranspilerContext.ts +1 -4
- package/src/types/Prompt.ts +1 -7
- package/src/types/string_host.ts +1 -9
- package/src/types/string_pipeline_url.ts +1 -4
- package/src/utils/agent-message-runtime/agentMessageRuntimePaths.ts +66 -0
- package/src/utils/agents/resolveAgentAvatarImageUrl.ts +2 -2
- package/src/utils/agents/terminalAgentAvatarVisual.ts +261 -0
- package/src/utils/ascii-art/$detectTerminalAnsiColorDepth.ts +45 -0
- package/src/utils/ascii-art/convertImageDataToAsciiArt.ts +396 -0
- package/src/utils/color/Color.ts +2 -2
- package/src/utils/markdown/parseMarkdownSection.ts +1 -5
- package/src/utils/random/$randomFullnameWithColor.ts +1 -6
- package/src/version.ts +2 -2
- package/src/versions.txt +7 -0
- package/umd/apps/agents-server/src/database/migratePrefix.d.ts +19 -0
- package/umd/apps/agents-server/src/database/runDatabaseMigrations.d.ts +4 -0
- package/umd/book/scripts/import-markdown/increaseHeadings.d.ts +8 -0
- package/umd/index.umd.js +30176 -28541
- package/umd/index.umd.js.map +1 -1
- package/umd/scripts/find-refactor-candidates/find-refactor-candidates.d.ts +7 -0
- package/umd/scripts/find-refactor-candidates/selectMostImportantRefactorCandidates.d.ts +12 -0
- package/umd/scripts/run-agent-messages/main/runMultipleAgentMessages/MultipleAgentAutoPuller.d.ts +27 -0
- package/umd/scripts/run-agent-messages/main/runMultipleAgentMessages/MultipleAgentGithubSynchronizer.d.ts +26 -0
- package/umd/scripts/run-agent-messages/main/runMultipleAgentMessages/MultipleAgentRunUiPresenter.d.ts +66 -0
- package/umd/scripts/run-agent-messages/main/runMultipleAgentMessages/RunMultipleAgentMessageTaskScheduler.d.ts +67 -0
- package/umd/scripts/run-agent-messages/main/runMultipleAgentMessages/formatProjectPath.d.ts +6 -0
- package/umd/scripts/run-agent-messages/main/runMultipleAgentMessages/loadLocalAgentRunnerProjectSummaries.d.ts +11 -0
- package/umd/scripts/run-agent-messages/main/runMultipleAgentMessages/wait.d.ts +6 -0
- package/umd/scripts/run-agent-messages/main/runMultipleAgentMessages.d.ts +1 -1
- package/umd/scripts/run-codex-prompts/common/buildCoderRunProgressSnapshot.d.ts +1 -1
- package/umd/scripts/run-codex-prompts/common/cliProgressDisplay.d.ts +2 -1
- package/umd/scripts/run-codex-prompts/common/resolveCoderAgent.d.ts +20 -0
- package/umd/scripts/run-codex-prompts/common/sleepWithCountdown.d.ts +1 -0
- package/umd/scripts/run-codex-prompts/common/waitUntilWorldTimeDeadline.d.ts +17 -0
- package/umd/scripts/run-codex-prompts/runners/claude-code/ClaudeCodeRunner.d.ts +4 -0
- package/umd/scripts/run-codex-prompts/runners/claude-code/ClaudeCodeSessionResurrection.d.ts +37 -0
- package/umd/scripts/run-codex-prompts/runners/claude-code/parseClaudeCodeOutputEvents.d.ts +47 -0
- package/umd/scripts/run-codex-prompts/ui/CoderRunUiState.d.ts +8 -1
- package/umd/scripts/run-codex-prompts/ui/buildCoderRunAgentVisual.d.ts +41 -0
- package/umd/scripts/run-codex-prompts/ui/buildCoderRunUiFrame.d.ts +10 -0
- package/umd/scripts/run-codex-prompts/ui/coderRunUiRefresh.d.ts +2 -2
- package/umd/src/_packages/types.index.d.ts +2 -2
- package/umd/src/avatars/renderAvatarVisualAsciiArt.d.ts +98 -0
- package/umd/src/avatars/visuals/octopus3dAvatarVisualShared.d.ts +1 -1
- package/umd/src/book-components/BookEditor/BookEditorMonacoUploadPanel.d.ts +1 -1
- package/umd/src/book-components/BookEditor/useBookEditorMonacoUploads/bookEditorMonacoUploadTypes.d.ts +120 -0
- package/umd/src/book-components/BookEditor/useBookEditorMonacoUploads/clearScheduledTimer.d.ts +6 -0
- package/umd/src/book-components/BookEditor/useBookEditorMonacoUploads/enqueueFilesForUpload.d.ts +26 -0
- package/umd/src/book-components/BookEditor/useBookEditorMonacoUploads/useBookEditorMonacoUploadEditorSync.d.ts +23 -0
- package/umd/src/book-components/BookEditor/useBookEditorMonacoUploads/useBookEditorMonacoUploadItemsState.d.ts +21 -0
- package/umd/src/book-components/BookEditor/useBookEditorMonacoUploads/useBookEditorMonacoUploadProgressQueue.d.ts +12 -0
- package/umd/src/book-components/BookEditor/useBookEditorMonacoUploads/useBookEditorMonacoUploadQueue.d.ts +27 -0
- package/umd/src/book-components/BookEditor/useBookEditorMonacoUploads/useCompletedUploadsAutoClear.d.ts +12 -0
- package/umd/src/book-components/BookEditor/useBookEditorMonacoUploads.d.ts +5 -58
- package/umd/src/book-components/Chat/Chat/ChatImageAttachmentModal.d.ts +25 -0
- package/umd/src/book-components/Chat/Chat/ChatInputArea.d.ts +3 -0
- package/umd/src/book-components/Chat/Chat/ChatMessageAttachments.d.ts +27 -0
- package/umd/src/book-components/Chat/Chat/ChatMessageItem.d.ts +1 -1
- package/umd/src/book-components/Chat/Chat/ChatMessageList.d.ts +1 -0
- package/umd/src/book-components/Chat/Chat/ChatProps.d.ts +8 -0
- package/umd/src/book-components/Chat/Chat/CitationIframePreview.d.ts +1 -1
- package/umd/src/book-components/Chat/Chat/CitationIframePreview.test.d.ts +2 -0
- package/umd/src/book-components/Chat/Chat/insertDictationChunk.d.ts +1 -1
- package/umd/src/book-components/Chat/Chat/insertDictationChunk.test.d.ts +1 -0
- package/umd/src/book-components/Chat/Chat/learnDictationDictionary.test.d.ts +1 -0
- package/umd/src/book-components/Chat/Chat/refineFinalDictationChunk.test.d.ts +1 -0
- package/umd/src/book-components/Chat/Chat/useChatInputAreaComposer.d.ts +12 -0
- package/umd/src/book-components/Chat/Chat/useChatInputAreaComposer.draftMessage.test.d.ts +2 -0
- package/umd/src/book-components/Chat/utils/isVisibleChatToolCall.d.ts +1 -1
- package/umd/src/book-components/Chat/utils/parseMessageButtons.d.ts +16 -2
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/AGENTS_SERVER_BUILD_CACHE_FILENAME.d.ts +6 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/AGENTS_SERVER_BUILD_CACHE_VERSION.d.ts +6 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/AGENTS_SERVER_NEXT_BUILD_ID_FILENAME.d.ts +6 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/AgentsServerBuildCache.d.ts +10 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/AgentsServerBuildCacheOptions.d.ts +10 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/NODE_MODULES_DIRECTORY_NAME.d.ts +6 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/PreparedAgentsServerRuntime.d.ts +18 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/createAgentsServerBuildSourceFingerprint.d.ts +6 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/createAgentsServerRuntimeEnvironment.d.ts +28 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/ensureAgentsServerBuild.d.ts +19 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/getAgentsServerBuildInputRelativePaths.d.ts +11 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/isAgentsServerAppPath.d.ts +6 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/isAgentsServerAppPathMaterialized.d.ts +6 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/isAgentsServerBuildCacheCurrent.d.ts +7 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/isAgentsServerBuildInputTestFile.d.ts +6 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/isExcludedAgentsServerBuildInputDirectoryName.d.ts +6 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/isExcludedAgentsServerBuildInputPath.d.ts +6 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/isExcludedAgentsServerRuntimeSourcePath.d.ts +6 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/isFile.d.ts +6 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/isPathInsideNodeModules.d.ts +6 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/normalizeAgentsServerBuildInputPath.d.ts +6 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/prepareAgentsServerRuntime.d.ts +9 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/readAgentsServerBuildCache.d.ts +8 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/resolveAgentsServerAppPath.d.ts +6 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/resolveAgentsServerBuildAppPath.d.ts +9 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/resolveAgentsServerBuildOutputPath.d.ts +7 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/resolveNextCliPath.d.ts +6 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/resolveNodeModulesPath.d.ts +6 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/runNextBuild.d.ts +12 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/shouldCopyAgentsServerRuntimePath.d.ts +6 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/synchronizeMaterializedAgentsServerRuntime.d.ts +11 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/writeAgentsServerBuildCache.d.ts +7 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer.d.ts +8 -109
- package/umd/src/cli/cli-commands/agents-server/ensureAgentsServerEnvFile.d.ts +1 -1
- package/umd/src/cli/cli-commands/agents-server/ensureAgentsServerGitignoreFile.d.ts +1 -1
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerChildEnvironment.d.ts +16 -0
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerLogStreams.d.ts +30 -0
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerRuntimePaths.d.ts +19 -0
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerSupervisorState.d.ts +37 -0
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/LocalAgentRunnerLimits.d.ts +9 -0
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/PreparedAgentsServerLaunch.d.ts +13 -0
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/StartAgentsServerOptions.d.ts +24 -0
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/createInternalRouteErrorMessage.d.ts +6 -0
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/createLocalAgentRunOptions.d.ts +9 -0
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/forwardChildOutput.d.ts +13 -0
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/loadAgentsServerProjectEnvironment.d.ts +6 -0
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/prepareAgentsServerLaunch.d.ts +18 -0
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/readInternalRouteErrorDetails.d.ts +6 -0
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/resolveAgentsServerChildHostname.d.ts +7 -0
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/startNextServer.d.ts +20 -0
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/startUserChatJobWorkerPump.d.ts +15 -0
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/stopChildProcess.d.ts +8 -0
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/waitForLocalAgentRunnerLimits.d.ts +16 -0
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer.d.ts +3 -30
- package/umd/src/cli/cli-commands/common/createPositiveIntegerOptionParser.d.ts +10 -0
- package/umd/src/cli/cli-commands/common/promptRunnerCliOptions.d.ts +1 -1
- package/umd/src/collection/agent-collection/CreateAgentInput.d.ts +1 -1
- package/umd/src/collection/agent-collection/constructors/agent-collection-in-supabase/prepareAgentSourceForPersistence.d.ts +1 -1
- package/umd/src/commitments/META/META.d.ts +2 -2
- package/umd/src/commitments/META_AVATAR/META_AVATAR.d.ts +9 -4
- package/umd/src/commitments/index.d.ts +1 -1
- package/umd/src/conversion/validation/validatePipeline/createPipelineValidationContext.d.ts +16 -0
- package/umd/src/conversion/validation/validatePipeline/validatePipelineCollectionsStructure.d.ts +7 -0
- package/umd/src/conversion/validation/validatePipeline/validatePipelineDependencyResolution.d.ts +7 -0
- package/umd/src/conversion/validation/validatePipeline/validatePipelineMetadata.d.ts +7 -0
- package/umd/src/conversion/validation/validatePipeline/validatePipelineParameters.d.ts +7 -0
- package/umd/src/conversion/validation/validatePipeline/validatePipelineTasks.d.ts +7 -0
- package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/RegisteredLlmToolsMessageContext.d.ts +46 -0
- package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/USED_ENV_FILENAME.d.ts +11 -0
- package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolConfigurationStatusMessage.d.ts +7 -0
- package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolEntryKey.d.ts +7 -0
- package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolInstallationStatusMessage.d.ts +7 -0
- package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolStatus.d.ts +14 -0
- package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolsMessageContext.d.ts +7 -0
- package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/getAvailableRegisteredLlmToolsEnvironmentVariables.d.ts +7 -0
- package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/getRegisteredLlmToolRegisters.d.ts +7 -0
- package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/hasRegisteredLlmToolEntry.d.ts +7 -0
- package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/listRegisteredLlmToolEntries.d.ts +9 -0
- package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/listRegisteredLlmToolStatuses.d.ts +7 -0
- package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/renderAvailableRegisteredLlmTools.d.ts +7 -0
- package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/renderNoRegisteredLlmToolsMessage.d.ts +7 -0
- package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/renderRegisteredLlmToolsMessage.d.ts +8 -0
- package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/renderRelevantRegisteredLlmToolsEnvironmentVariables.d.ts +7 -0
- package/umd/src/utils/agent-message-runtime/agentMessageRuntimePaths.d.ts +24 -0
- package/umd/src/utils/agents/resolveAgentAvatarImageUrl.d.ts +2 -2
- package/umd/src/utils/agents/terminalAgentAvatarVisual.d.ts +94 -0
- package/umd/src/utils/agents/terminalAgentAvatarVisual.test.d.ts +1 -0
- package/umd/src/utils/ascii-art/$detectTerminalAnsiColorDepth.d.ts +15 -0
- package/umd/src/utils/ascii-art/convertImageDataToAsciiArt.d.ts +80 -0
- package/umd/src/utils/color/Color.d.ts +1 -1
- package/umd/src/version.d.ts +1 -1
- package/apps/agents-server/src/app/api/page-preview/interact/route.ts +0 -179
- package/apps/agents-server/src/app/api/page-preview/live/route.ts +0 -67
- package/apps/agents-server/src/utils/pagePreview/livePagePreviewSessions.ts +0 -365
- package/apps/agents-server/src/utils/pagePreview/resolvePagePreviewRequestUrl.ts +0 -74
- package/apps/agents-server/src/utils/userChat/createUserChatRunnerProgressCard.ts +0 -57
- package/esm/scripts/run-codex-prompts/common/resolveAgentSystemMessage.d.ts +0 -6
- package/esm/src/book-components/Chat/utils/livePagePreviewConstants.d.ts +0 -12
- package/src/book-components/Chat/utils/livePagePreviewConstants.ts +0 -17
- package/umd/scripts/run-codex-prompts/common/resolveAgentSystemMessage.d.ts +0 -6
- package/umd/src/book-components/Chat/utils/livePagePreviewConstants.d.ts +0 -12
|
@@ -1,1046 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Next production build marker required before a cached build is reused.
|
|
25
|
-
*
|
|
26
|
-
* @private internal constant of `ptbk agents-server`
|
|
27
|
-
*/
|
|
28
|
-
const AGENTS_SERVER_NEXT_BUILD_ID_FILENAME = 'BUILD_ID';
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Next output directory used by the local Agents Server runtime unless Next overrides it.
|
|
32
|
-
*
|
|
33
|
-
* @private internal constant of `ptbk agents-server`
|
|
34
|
-
*/
|
|
35
|
-
const DEFAULT_AGENTS_SERVER_NEXT_DIST_DIRECTORY_NAME = '.next';
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Node.js heap size limit (in MiB) injected into `NODE_OPTIONS` for the Next.js production build.
|
|
39
|
-
*
|
|
40
|
-
* Next.js webpack peaks at ~1.9 GiB on a fresh install; the Node.js default cap is ~1.7 GiB,
|
|
41
|
-
* which causes an OOM crash on first-run VPS installations where swap is the primary resource.
|
|
42
|
-
* Raising the limit lets the build complete on the first attempt.
|
|
43
|
-
*
|
|
44
|
-
* @private internal constant of `ptbk agents-server`
|
|
45
|
-
*/
|
|
46
|
-
const AGENTS_SERVER_BUILD_MAX_OLD_SPACE_MIB = 4096;
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Conservative Next.js build worker count used by CLI-owned Agents Server production builds.
|
|
50
|
-
*
|
|
51
|
-
* Standalone VPS self-updates build the replacement server while the current pm2 process is
|
|
52
|
-
* still serving traffic. Keeping Next's static workers serial avoids CPU-count-based memory
|
|
53
|
-
* spikes that can make the OS kill the build child with no normal exit code.
|
|
54
|
-
*
|
|
55
|
-
* @private internal constant of `ptbk agents-server`
|
|
56
|
-
*/
|
|
57
|
-
const AGENTS_SERVER_BUILD_WORKER_COUNT = 1;
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Maximum attempts for a Next.js build that was killed by the operating system.
|
|
61
|
-
*
|
|
62
|
-
* @private internal constant of `ptbk agents-server`
|
|
63
|
-
*/
|
|
64
|
-
const AGENTS_SERVER_BUILD_MAX_ATTEMPTS = 2;
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Signals that indicate the Next.js build may have been terminated by resource pressure.
|
|
68
|
-
*
|
|
69
|
-
* @private internal constant of `ptbk agents-server`
|
|
70
|
-
*/
|
|
71
|
-
const RETRYABLE_NEXT_BUILD_SIGNALS = new Set<NodeJS.Signals | null>(['SIGKILL', null]);
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Environment variable passed to the bundled Next app so webpack can resolve dependencies
|
|
75
|
-
* installed beside `ptbk` even when the app sources are materialized into a project cache.
|
|
76
|
-
*
|
|
77
|
-
* @private internal constant of `ptbk agents-server`
|
|
78
|
-
*/
|
|
79
|
-
export const PTBK_AGENTS_SERVER_NODE_MODULES_PATH_ENV = 'PTBK_AGENTS_SERVER_NODE_MODULES_PATH';
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Environment variable consumed by `apps/agents-server/next.config.ts` to throttle build workers.
|
|
83
|
-
*
|
|
84
|
-
* @private internal constant of `ptbk agents-server`
|
|
85
|
-
*/
|
|
86
|
-
export const PTBK_AGENTS_SERVER_BUILD_WORKER_COUNT_ENV = 'PTBK_AGENTS_SERVER_BUILD_WORKER_COUNT';
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Environment variable used only by the CLI-owned production build.
|
|
90
|
-
*
|
|
91
|
-
* @private internal constant of `ptbk agents-server`
|
|
92
|
-
*/
|
|
93
|
-
export const PTBK_AGENTS_SERVER_IGNORE_NEXT_VALIDATION_ENV = 'PTBK_AGENTS_SERVER_IGNORE_NEXT_VALIDATION';
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Runtime copy metadata filename stored in the project-local materialized app root.
|
|
97
|
-
*
|
|
98
|
-
* @private internal constant of `ptbk agents-server`
|
|
99
|
-
*/
|
|
100
|
-
const AGENTS_SERVER_MATERIALIZED_RUNTIME_CACHE_FILENAME = '.ptbk-agents-server-runtime-cache.json';
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Directory segment used for Node package installs.
|
|
104
|
-
*
|
|
105
|
-
* @private internal constant of `ptbk agents-server`
|
|
106
|
-
*/
|
|
107
|
-
const NODE_MODULES_DIRECTORY_NAME = 'node_modules';
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Runtime paths copied into the CLI package and used by the Agents Server production build.
|
|
111
|
-
*
|
|
112
|
-
* @private internal constant of `ptbk agents-server`
|
|
113
|
-
*/
|
|
114
|
-
const AGENTS_SERVER_BUILD_INPUT_RELATIVE_PATHS = [
|
|
115
|
-
'apps/agents-server',
|
|
116
|
-
'apps/_common',
|
|
117
|
-
'src',
|
|
118
|
-
'books',
|
|
119
|
-
'package.json',
|
|
120
|
-
'package-lock.json',
|
|
121
|
-
'security.config.ts',
|
|
122
|
-
'servers.ts',
|
|
123
|
-
'tsconfig.json',
|
|
124
|
-
] as const;
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Directory names excluded while fingerprinting production build inputs.
|
|
128
|
-
*
|
|
129
|
-
* @private internal constant of `ptbk agents-server`
|
|
130
|
-
*/
|
|
131
|
-
const AGENTS_SERVER_BUILD_INPUT_EXCLUDED_DIRECTORY_NAMES = new Set([
|
|
132
|
-
'.git',
|
|
133
|
-
'.next',
|
|
134
|
-
'.next-e2e',
|
|
135
|
-
'.promptbook',
|
|
136
|
-
'coverage',
|
|
137
|
-
'node_modules',
|
|
138
|
-
'playwright-report',
|
|
139
|
-
'test-results',
|
|
140
|
-
]);
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Runtime source files excluded from the packaged Agents Server copy.
|
|
144
|
-
*
|
|
145
|
-
* @private internal constant of `ptbk agents-server`
|
|
146
|
-
*/
|
|
147
|
-
const AGENTS_SERVER_BUILD_INPUT_EXCLUDED_SOURCE_PATHS = new Set([
|
|
148
|
-
'src/_packages/browser.index.ts',
|
|
149
|
-
'src/_packages/browser.readme.md',
|
|
150
|
-
'src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.ts',
|
|
151
|
-
'src/llm-providers/_common/utils/assertUniqueModels.ts',
|
|
152
|
-
]);
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Runtime source folders excluded from the packaged Agents Server copy.
|
|
156
|
-
*
|
|
157
|
-
* @private internal constant of `ptbk agents-server`
|
|
158
|
-
*/
|
|
159
|
-
const AGENTS_SERVER_BUILD_INPUT_EXCLUDED_SOURCE_PATH_PREFIXES = [
|
|
160
|
-
'src/dialogs/simple-prompt',
|
|
161
|
-
'src/storage/local-storage',
|
|
162
|
-
] as const;
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Test files copied out of packaged runtime input paths because Next does not build them.
|
|
166
|
-
*
|
|
167
|
-
* @private internal constant of `ptbk agents-server`
|
|
168
|
-
*/
|
|
169
|
-
const AGENTS_SERVER_BUILD_INPUT_TEST_FILE_PATTERN = /\.(?:spec|test)(?:\.|$)/iu;
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* Type-only compile check files copied out of packaged runtime input paths.
|
|
173
|
-
*
|
|
174
|
-
* @private internal constant of `ptbk agents-server`
|
|
175
|
-
*/
|
|
176
|
-
const AGENTS_SERVER_BUILD_INPUT_TEST_TYPE_FILE_PATTERN = /\.test-type\.[jt]sx?$/iu;
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Metadata persisted after one successful Agents Server production build.
|
|
180
|
-
*
|
|
181
|
-
* @private internal type of `ptbk agents-server`
|
|
182
|
-
*/
|
|
183
|
-
type AgentsServerBuildCache = {
|
|
184
|
-
readonly version: typeof AGENTS_SERVER_BUILD_CACHE_VERSION;
|
|
185
|
-
readonly sourceFingerprint: string;
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* Metadata persisted after copying the npm-packaged Agents Server runtime into the launch project.
|
|
190
|
-
*
|
|
191
|
-
* @private internal type of `ptbk agents-server`
|
|
192
|
-
*/
|
|
193
|
-
type AgentsServerMaterializedRuntimeCache = {
|
|
194
|
-
readonly version: typeof AGENTS_SERVER_BUILD_CACHE_VERSION;
|
|
195
|
-
readonly sourceFingerprint: string;
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* Inputs controlling one cached Agents Server production build.
|
|
200
|
-
*
|
|
201
|
-
* @private internal type of `ptbk agents-server`
|
|
202
|
-
*/
|
|
203
|
-
type EnsureAgentsServerBuildOptions = {
|
|
204
|
-
readonly appPath?: string;
|
|
205
|
-
readonly environment?: NodeJS.ProcessEnv;
|
|
206
|
-
readonly isBuildForced?: boolean;
|
|
207
|
-
readonly onBuildEvent?: (event: string) => void;
|
|
208
|
-
readonly onBuildOutput?: (chunk: string) => void;
|
|
209
|
-
};
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* Paths needed after the Agents Server production build is ready.
|
|
213
|
-
*
|
|
214
|
-
* @private internal type of `ptbk agents-server`
|
|
215
|
-
*/
|
|
216
|
-
export type AgentsServerBuildArtifacts = {
|
|
217
|
-
readonly appPath: string;
|
|
218
|
-
readonly nodeModulesPath: string;
|
|
219
|
-
readonly nextCliPath: string;
|
|
220
|
-
};
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* Runtime paths resolved for Agents Server commands before choosing build or dev execution.
|
|
224
|
-
*
|
|
225
|
-
* @private internal type of `ptbk agents-server`
|
|
226
|
-
*/
|
|
227
|
-
export type PreparedAgentsServerRuntime = AgentsServerBuildArtifacts & {
|
|
228
|
-
readonly isAppPathMaterialized: boolean;
|
|
229
|
-
};
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* Input paths required to validate or update the cached Agents Server build.
|
|
233
|
-
*
|
|
234
|
-
* @private internal type of `ptbk agents-server`
|
|
235
|
-
*/
|
|
236
|
-
type AgentsServerBuildCacheOptions = {
|
|
237
|
-
readonly appPath: string;
|
|
238
|
-
readonly environment?: NodeJS.ProcessEnv;
|
|
239
|
-
};
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* Exit status reported by one spawned Next.js build child process.
|
|
243
|
-
*
|
|
244
|
-
* @private internal type of `ptbk agents-server`
|
|
245
|
-
*/
|
|
246
|
-
type NextBuildExitStatus = {
|
|
247
|
-
readonly code: number | null;
|
|
248
|
-
readonly signal: NodeJS.Signals | null;
|
|
249
|
-
};
|
|
250
|
-
|
|
251
|
-
/**
|
|
252
|
-
* Ensures that the local Agents Server production build exists and matches its source fingerprint.
|
|
253
|
-
*
|
|
254
|
-
* @private internal utility of `ptbk agents-server`
|
|
255
|
-
*/
|
|
256
|
-
export async function ensureAgentsServerBuild(
|
|
257
|
-
options: EnsureAgentsServerBuildOptions = {},
|
|
258
|
-
): Promise<PreparedAgentsServerRuntime> {
|
|
259
|
-
const environment = options.environment ?? process.env;
|
|
260
|
-
const preparedRuntime = await prepareAgentsServerRuntime({
|
|
261
|
-
appPath: options.appPath,
|
|
262
|
-
});
|
|
263
|
-
const buildEnvironment = createAgentsServerRuntimeEnvironment(environment, preparedRuntime.nodeModulesPath, {
|
|
264
|
-
isNextValidationIgnored: preparedRuntime.isAppPathMaterialized,
|
|
265
|
-
});
|
|
266
|
-
|
|
267
|
-
if (
|
|
268
|
-
!options.isBuildForced &&
|
|
269
|
-
(await isAgentsServerBuildCacheCurrent({
|
|
270
|
-
appPath: preparedRuntime.appPath,
|
|
271
|
-
environment: buildEnvironment,
|
|
272
|
-
}))
|
|
273
|
-
) {
|
|
274
|
-
options.onBuildEvent?.('Using the cached Agents Server Next app build.');
|
|
275
|
-
return preparedRuntime;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
options.onBuildEvent?.('Building the Agents Server Next app.');
|
|
279
|
-
await runNextBuild({
|
|
280
|
-
appPath: preparedRuntime.appPath,
|
|
281
|
-
environment: buildEnvironment,
|
|
282
|
-
nextCliPath: preparedRuntime.nextCliPath,
|
|
283
|
-
onBuildOutput: options.onBuildOutput,
|
|
284
|
-
});
|
|
285
|
-
await writeAgentsServerBuildCache({
|
|
286
|
-
appPath: preparedRuntime.appPath,
|
|
287
|
-
environment: buildEnvironment,
|
|
288
|
-
});
|
|
289
|
-
|
|
290
|
-
return preparedRuntime;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
/**
|
|
294
|
-
* Resolves the runtime app and dependency paths shared by Agents Server start and dev commands.
|
|
295
|
-
*
|
|
296
|
-
* @private internal utility of `ptbk agents-server`
|
|
297
|
-
*/
|
|
298
|
-
export async function prepareAgentsServerRuntime(
|
|
299
|
-
options: {
|
|
300
|
-
readonly appPath?: string;
|
|
301
|
-
} = {},
|
|
302
|
-
): Promise<PreparedAgentsServerRuntime> {
|
|
303
|
-
const nextCliPath = resolveNextCliPath();
|
|
304
|
-
const nodeModulesPath = resolveNodeModulesPath(nextCliPath);
|
|
305
|
-
const appPath = await resolveAgentsServerBuildAppPath({
|
|
306
|
-
sourceAppPath: options.appPath ?? (await resolveAgentsServerAppPath()),
|
|
307
|
-
nodeModulesPath,
|
|
308
|
-
});
|
|
309
|
-
|
|
310
|
-
return {
|
|
311
|
-
appPath,
|
|
312
|
-
nextCliPath,
|
|
313
|
-
nodeModulesPath,
|
|
314
|
-
isAppPathMaterialized: isAgentsServerAppPathMaterialized(appPath),
|
|
315
|
-
};
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
/**
|
|
319
|
-
* Returns true when the production build marker and source fingerprint still match.
|
|
320
|
-
*
|
|
321
|
-
* @private internal utility of `ptbk agents-server`
|
|
322
|
-
*/
|
|
323
|
-
export async function isAgentsServerBuildCacheCurrent(options: AgentsServerBuildCacheOptions): Promise<boolean> {
|
|
324
|
-
const buildCache = await readAgentsServerBuildCache(options);
|
|
325
|
-
|
|
326
|
-
if (!buildCache) {
|
|
327
|
-
return false;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
const buildOutputPath = resolveAgentsServerBuildOutputPath(options);
|
|
331
|
-
if (!(await isFile(join(buildOutputPath, AGENTS_SERVER_NEXT_BUILD_ID_FILENAME)))) {
|
|
332
|
-
return false;
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
return buildCache.sourceFingerprint === (await createAgentsServerBuildSourceFingerprint(options.appPath));
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
/**
|
|
339
|
-
* Persists the source fingerprint for the just-created production build.
|
|
340
|
-
*
|
|
341
|
-
* @private internal utility of `ptbk agents-server`
|
|
342
|
-
*/
|
|
343
|
-
export async function writeAgentsServerBuildCache(options: AgentsServerBuildCacheOptions): Promise<void> {
|
|
344
|
-
const buildOutputPath = resolveAgentsServerBuildOutputPath(options);
|
|
345
|
-
const buildCache: AgentsServerBuildCache = {
|
|
346
|
-
version: AGENTS_SERVER_BUILD_CACHE_VERSION,
|
|
347
|
-
sourceFingerprint: await createAgentsServerBuildSourceFingerprint(options.appPath),
|
|
348
|
-
};
|
|
349
|
-
|
|
350
|
-
await mkdir(buildOutputPath, { recursive: true });
|
|
351
|
-
await writeFile(
|
|
352
|
-
join(buildOutputPath, AGENTS_SERVER_BUILD_CACHE_FILENAME),
|
|
353
|
-
`${JSON.stringify(buildCache, null, 4)}\n`,
|
|
354
|
-
'utf-8',
|
|
355
|
-
);
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
/**
|
|
359
|
-
* Finds the Agents Server app in a source checkout or generated CLI package.
|
|
360
|
-
*
|
|
361
|
-
* @private internal utility of `ptbk agents-server`
|
|
362
|
-
*/
|
|
363
|
-
export async function resolveAgentsServerAppPath(): Promise<string> {
|
|
364
|
-
const candidates = [
|
|
365
|
-
join(process.cwd(), 'apps', 'agents-server'),
|
|
366
|
-
join(__dirname, '..', '..', '..', '..', 'apps', 'agents-server'),
|
|
367
|
-
join(__dirname, '..', '..', 'apps', 'agents-server'),
|
|
368
|
-
join(__dirname, '..', 'apps', 'agents-server'),
|
|
369
|
-
];
|
|
370
|
-
|
|
371
|
-
for (const candidate of candidates) {
|
|
372
|
-
if (await isAgentsServerAppPath(candidate)) {
|
|
373
|
-
return candidate;
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
throw new NotAllowed(
|
|
378
|
-
spaceTrim(`
|
|
379
|
-
Cannot find the bundled Agents Server app.
|
|
380
|
-
|
|
381
|
-
Checked:
|
|
382
|
-
${candidates.map((candidate) => `- \`${candidate}\``).join('\n')}
|
|
383
|
-
`),
|
|
384
|
-
);
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
/**
|
|
388
|
-
* Adds dependency-resolution environment required by the materialized Agents Server runtime.
|
|
389
|
-
*
|
|
390
|
-
* @private internal utility of `ptbk agents-server`
|
|
391
|
-
*/
|
|
392
|
-
export function createAgentsServerRuntimeEnvironment(
|
|
393
|
-
environment: NodeJS.ProcessEnv,
|
|
394
|
-
nodeModulesPath: string,
|
|
395
|
-
options: {
|
|
396
|
-
readonly isNextValidationIgnored?: boolean;
|
|
397
|
-
} = {},
|
|
398
|
-
): NodeJS.ProcessEnv {
|
|
399
|
-
return {
|
|
400
|
-
...environment,
|
|
401
|
-
NODE_PATH: mergeNodePath(nodeModulesPath, environment.NODE_PATH),
|
|
402
|
-
[PTBK_AGENTS_SERVER_NODE_MODULES_PATH_ENV]: nodeModulesPath,
|
|
403
|
-
[PTBK_AGENTS_SERVER_BUILD_WORKER_COUNT_ENV]:
|
|
404
|
-
environment[PTBK_AGENTS_SERVER_BUILD_WORKER_COUNT_ENV] || String(AGENTS_SERVER_BUILD_WORKER_COUNT),
|
|
405
|
-
...(options.isNextValidationIgnored
|
|
406
|
-
? {
|
|
407
|
-
[PTBK_AGENTS_SERVER_IGNORE_NEXT_VALIDATION_ENV]: 'true',
|
|
408
|
-
}
|
|
409
|
-
: {}),
|
|
410
|
-
};
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
/**
|
|
414
|
-
* Uses the source checkout app directly, but copies npm-packaged app sources out of `node_modules`.
|
|
415
|
-
*
|
|
416
|
-
* @private internal utility of `ptbk agents-server`
|
|
417
|
-
*/
|
|
418
|
-
export async function resolveAgentsServerBuildAppPath(options: {
|
|
419
|
-
readonly nodeModulesPath: string;
|
|
420
|
-
readonly sourceAppPath: string;
|
|
421
|
-
}): Promise<string> {
|
|
422
|
-
if (!isPathInsideNodeModules(options.sourceAppPath)) {
|
|
423
|
-
return options.sourceAppPath;
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
const sourceRuntimeRootPath = resolve(options.sourceAppPath, '..', '..');
|
|
427
|
-
const materializedRuntimeRootPath = resolvePromptbookTemporaryPath(process.cwd(), 'agents-server', 'runtime');
|
|
428
|
-
|
|
429
|
-
await synchronizeMaterializedAgentsServerRuntime({
|
|
430
|
-
materializedRuntimeRootPath,
|
|
431
|
-
nodeModulesPath: options.nodeModulesPath,
|
|
432
|
-
sourceAppPath: options.sourceAppPath,
|
|
433
|
-
sourceRuntimeRootPath,
|
|
434
|
-
});
|
|
435
|
-
|
|
436
|
-
return join(materializedRuntimeRootPath, 'apps', 'agents-server');
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
/**
|
|
440
|
-
* Copies the bundled runtime into the launch project when the original app lives under `node_modules`.
|
|
441
|
-
*/
|
|
442
|
-
async function synchronizeMaterializedAgentsServerRuntime(options: {
|
|
443
|
-
readonly materializedRuntimeRootPath: string;
|
|
444
|
-
readonly nodeModulesPath: string;
|
|
445
|
-
readonly sourceAppPath: string;
|
|
446
|
-
readonly sourceRuntimeRootPath: string;
|
|
447
|
-
}): Promise<void> {
|
|
448
|
-
const sourceFingerprint = await createAgentsServerBuildSourceFingerprint(options.sourceAppPath);
|
|
449
|
-
const runtimeCache = await readAgentsServerMaterializedRuntimeCache(options.materializedRuntimeRootPath);
|
|
450
|
-
const isRuntimeCurrent =
|
|
451
|
-
runtimeCache?.version === AGENTS_SERVER_BUILD_CACHE_VERSION &&
|
|
452
|
-
runtimeCache.sourceFingerprint === sourceFingerprint &&
|
|
453
|
-
(await isAgentsServerAppPath(join(options.materializedRuntimeRootPath, 'apps', 'agents-server')));
|
|
454
|
-
|
|
455
|
-
if (!isRuntimeCurrent) {
|
|
456
|
-
await rm(options.materializedRuntimeRootPath, { recursive: true, force: true });
|
|
457
|
-
await mkdir(options.materializedRuntimeRootPath, { recursive: true });
|
|
458
|
-
|
|
459
|
-
for (const relativeInputPath of AGENTS_SERVER_BUILD_INPUT_RELATIVE_PATHS) {
|
|
460
|
-
await copyAgentsServerRuntimePath({
|
|
461
|
-
destinationPath: join(options.materializedRuntimeRootPath, relativeInputPath),
|
|
462
|
-
sourcePath: join(options.sourceRuntimeRootPath, relativeInputPath),
|
|
463
|
-
});
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
await assertMaterializedAgentsServerAppExists(options.materializedRuntimeRootPath);
|
|
467
|
-
await writeAgentsServerMaterializedRuntimeCache(options.materializedRuntimeRootPath, sourceFingerprint);
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
await ensureMaterializedRuntimeNodeModulesLink({
|
|
471
|
-
materializedRuntimeRootPath: options.materializedRuntimeRootPath,
|
|
472
|
-
nodeModulesPath: options.nodeModulesPath,
|
|
473
|
-
});
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
/**
|
|
477
|
-
* Verifies that the materialized runtime contains a usable Next app before caching it.
|
|
478
|
-
*/
|
|
479
|
-
async function assertMaterializedAgentsServerAppExists(materializedRuntimeRootPath: string): Promise<void> {
|
|
480
|
-
const materializedAppPath = join(materializedRuntimeRootPath, 'apps', 'agents-server');
|
|
481
|
-
|
|
482
|
-
if (await isAgentsServerAppPath(materializedAppPath)) {
|
|
483
|
-
return;
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
throw new NotAllowed(
|
|
487
|
-
spaceTrim(`
|
|
488
|
-
Cannot prepare the bundled Agents Server runtime.
|
|
489
|
-
|
|
490
|
-
The materialized app path is missing required files:
|
|
491
|
-
\`${materializedAppPath}\`
|
|
492
|
-
`),
|
|
493
|
-
);
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
/**
|
|
497
|
-
* Copies one source path into the materialized runtime, skipping generated or private files.
|
|
498
|
-
*/
|
|
499
|
-
async function copyAgentsServerRuntimePath(options: {
|
|
500
|
-
readonly destinationPath: string;
|
|
501
|
-
readonly sourcePath: string;
|
|
502
|
-
}): Promise<void> {
|
|
503
|
-
let sourceStats;
|
|
504
|
-
|
|
505
|
-
try {
|
|
506
|
-
sourceStats = await stat(options.sourcePath);
|
|
507
|
-
} catch {
|
|
508
|
-
return;
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
await mkdir(dirname(options.destinationPath), { recursive: true });
|
|
512
|
-
|
|
513
|
-
if (sourceStats.isDirectory()) {
|
|
514
|
-
await cp(options.sourcePath, options.destinationPath, {
|
|
515
|
-
recursive: true,
|
|
516
|
-
filter: (sourcePath) => shouldCopyAgentsServerRuntimePath(sourcePath, options.sourcePath),
|
|
517
|
-
});
|
|
518
|
-
return;
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
if (sourceStats.isFile() && shouldCopyAgentsServerRuntimePath(options.sourcePath, dirname(options.sourcePath))) {
|
|
522
|
-
await cp(options.sourcePath, options.destinationPath);
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
/**
|
|
527
|
-
* Excludes build artifacts, dependency folders, private env files, and test sources.
|
|
528
|
-
*/
|
|
529
|
-
function shouldCopyAgentsServerRuntimePath(sourcePath: string, sourceRootPath: string): boolean {
|
|
530
|
-
const sourceRelativePath = relative(sourceRootPath, sourcePath).replace(/\\/gu, '/');
|
|
531
|
-
const sourceRuntimeRelativePath = normalizeRuntimeSourceRelativePath(sourcePath, sourceRootPath);
|
|
532
|
-
const sourcePathSegments = sourceRelativePath.split('/').filter(Boolean);
|
|
533
|
-
const sourceBasename = basename(sourcePath);
|
|
534
|
-
|
|
535
|
-
if (
|
|
536
|
-
sourcePathSegments.some((sourcePathSegment) =>
|
|
537
|
-
AGENTS_SERVER_BUILD_INPUT_EXCLUDED_DIRECTORY_NAMES.has(sourcePathSegment),
|
|
538
|
-
)
|
|
539
|
-
) {
|
|
540
|
-
return false;
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
if (sourcePathSegments.includes('playground')) {
|
|
544
|
-
return false;
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
if (isExcludedAgentsServerRuntimeSourcePath(sourceRuntimeRelativePath)) {
|
|
548
|
-
return false;
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
if (sourceBasename.startsWith('.env')) {
|
|
552
|
-
return false;
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
return (
|
|
556
|
-
!AGENTS_SERVER_BUILD_INPUT_TEST_FILE_PATTERN.test(sourceBasename) &&
|
|
557
|
-
!AGENTS_SERVER_BUILD_INPUT_TEST_TYPE_FILE_PATTERN.test(sourceBasename)
|
|
558
|
-
);
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
/**
|
|
562
|
-
* Normalizes a copied runtime path to the shape used inside the packaged runtime root.
|
|
563
|
-
*/
|
|
564
|
-
function normalizeRuntimeSourceRelativePath(sourcePath: string, sourceRootPath: string): string {
|
|
565
|
-
const sourceRelativePath = relative(sourceRootPath, sourcePath).replace(/\\/gu, '/');
|
|
566
|
-
const sourceRootBasename = basename(sourceRootPath);
|
|
567
|
-
|
|
568
|
-
if (!sourceRelativePath) {
|
|
569
|
-
return sourceRootBasename;
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
return `${sourceRootBasename}/${sourceRelativePath}`;
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
/**
|
|
576
|
-
* Checks whether one normalized runtime path is equal to or nested below another path.
|
|
577
|
-
*/
|
|
578
|
-
function isRuntimePathWithin(sourceRuntimeRelativePath: string, excludedSourcePathPrefix: string): boolean {
|
|
579
|
-
return (
|
|
580
|
-
sourceRuntimeRelativePath === excludedSourcePathPrefix ||
|
|
581
|
-
sourceRuntimeRelativePath.startsWith(`${excludedSourcePathPrefix}/`)
|
|
582
|
-
);
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
/**
|
|
586
|
-
* Returns true for runtime source files and folders that are not needed by the Agents Server build.
|
|
587
|
-
*/
|
|
588
|
-
function isExcludedAgentsServerRuntimeSourcePath(sourceRuntimeRelativePath: string): boolean {
|
|
589
|
-
return (
|
|
590
|
-
AGENTS_SERVER_BUILD_INPUT_EXCLUDED_SOURCE_PATHS.has(sourceRuntimeRelativePath) ||
|
|
591
|
-
AGENTS_SERVER_BUILD_INPUT_EXCLUDED_SOURCE_PATH_PREFIXES.some((excludedSourcePathPrefix) =>
|
|
592
|
-
isRuntimePathWithin(sourceRuntimeRelativePath, excludedSourcePathPrefix),
|
|
593
|
-
)
|
|
594
|
-
);
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
/**
|
|
598
|
-
* Links the materialized runtime back to the package dependency tree used by the installed CLI.
|
|
599
|
-
*/
|
|
600
|
-
async function ensureMaterializedRuntimeNodeModulesLink(options: {
|
|
601
|
-
readonly materializedRuntimeRootPath: string;
|
|
602
|
-
readonly nodeModulesPath: string;
|
|
603
|
-
}): Promise<void> {
|
|
604
|
-
const nodeModulesLinkPath = join(options.materializedRuntimeRootPath, NODE_MODULES_DIRECTORY_NAME);
|
|
605
|
-
|
|
606
|
-
try {
|
|
607
|
-
const existingLinkStats = await lstat(nodeModulesLinkPath);
|
|
608
|
-
await rm(nodeModulesLinkPath, {
|
|
609
|
-
force: true,
|
|
610
|
-
recursive: existingLinkStats.isDirectory() && !existingLinkStats.isSymbolicLink(),
|
|
611
|
-
});
|
|
612
|
-
} catch {
|
|
613
|
-
// The link does not exist yet.
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
await symlink(options.nodeModulesPath, nodeModulesLinkPath, process.platform === 'win32' ? 'junction' : 'dir');
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
/**
|
|
620
|
-
* Reads and validates materialized runtime metadata.
|
|
621
|
-
*/
|
|
622
|
-
async function readAgentsServerMaterializedRuntimeCache(
|
|
623
|
-
materializedRuntimeRootPath: string,
|
|
624
|
-
): Promise<AgentsServerMaterializedRuntimeCache | undefined> {
|
|
625
|
-
try {
|
|
626
|
-
const serializedRuntimeCache = await readFile(
|
|
627
|
-
join(materializedRuntimeRootPath, AGENTS_SERVER_MATERIALIZED_RUNTIME_CACHE_FILENAME),
|
|
628
|
-
'utf-8',
|
|
629
|
-
);
|
|
630
|
-
const runtimeCache = JSON.parse(serializedRuntimeCache) as Partial<AgentsServerMaterializedRuntimeCache>;
|
|
631
|
-
|
|
632
|
-
if (
|
|
633
|
-
runtimeCache.version !== AGENTS_SERVER_BUILD_CACHE_VERSION ||
|
|
634
|
-
typeof runtimeCache.sourceFingerprint !== 'string'
|
|
635
|
-
) {
|
|
636
|
-
return undefined;
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
return runtimeCache as AgentsServerMaterializedRuntimeCache;
|
|
640
|
-
} catch {
|
|
641
|
-
return undefined;
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
/**
|
|
646
|
-
* Persists the source fingerprint used for the materialized runtime copy.
|
|
647
|
-
*/
|
|
648
|
-
async function writeAgentsServerMaterializedRuntimeCache(
|
|
649
|
-
materializedRuntimeRootPath: string,
|
|
650
|
-
sourceFingerprint: string,
|
|
651
|
-
): Promise<void> {
|
|
652
|
-
const runtimeCache: AgentsServerMaterializedRuntimeCache = {
|
|
653
|
-
version: AGENTS_SERVER_BUILD_CACHE_VERSION,
|
|
654
|
-
sourceFingerprint,
|
|
655
|
-
};
|
|
656
|
-
|
|
657
|
-
await writeFile(
|
|
658
|
-
join(materializedRuntimeRootPath, AGENTS_SERVER_MATERIALIZED_RUNTIME_CACHE_FILENAME),
|
|
659
|
-
`${JSON.stringify(runtimeCache, null, 4)}\n`,
|
|
660
|
-
'utf-8',
|
|
661
|
-
);
|
|
662
|
-
}
|
|
663
|
-
|
|
664
|
-
/**
|
|
665
|
-
* Runs the finite Next production build used by local Agents Server commands.
|
|
666
|
-
*/
|
|
667
|
-
async function runNextBuild(options: {
|
|
668
|
-
readonly appPath: string;
|
|
669
|
-
readonly environment: NodeJS.ProcessEnv;
|
|
670
|
-
readonly nextCliPath: string;
|
|
671
|
-
readonly onBuildOutput?: (chunk: string) => void;
|
|
672
|
-
}): Promise<void> {
|
|
673
|
-
for (let attempt = 1; attempt <= AGENTS_SERVER_BUILD_MAX_ATTEMPTS; attempt++) {
|
|
674
|
-
const exitStatus = await runNextBuildAttempt(options);
|
|
675
|
-
|
|
676
|
-
if (exitStatus.code === 0) {
|
|
677
|
-
return;
|
|
678
|
-
}
|
|
679
|
-
|
|
680
|
-
if (attempt < AGENTS_SERVER_BUILD_MAX_ATTEMPTS && isNextBuildTerminationRetryable(exitStatus)) {
|
|
681
|
-
forwardBuildOutput(createNextBuildRetryMessage(exitStatus, attempt + 1), options.onBuildOutput);
|
|
682
|
-
continue;
|
|
683
|
-
}
|
|
684
|
-
|
|
685
|
-
throw createNextBuildExitError(exitStatus, attempt);
|
|
686
|
-
}
|
|
687
|
-
}
|
|
688
|
-
|
|
689
|
-
/**
|
|
690
|
-
* Runs one Next.js production build attempt and returns its exit status.
|
|
691
|
-
*/
|
|
692
|
-
async function runNextBuildAttempt(options: {
|
|
693
|
-
readonly appPath: string;
|
|
694
|
-
readonly environment: NodeJS.ProcessEnv;
|
|
695
|
-
readonly nextCliPath: string;
|
|
696
|
-
readonly onBuildOutput?: (chunk: string) => void;
|
|
697
|
-
}): Promise<NextBuildExitStatus> {
|
|
698
|
-
return await new Promise<NextBuildExitStatus>((resolveBuild, rejectBuild) => {
|
|
699
|
-
const buildProcess = spawn(process.execPath, [options.nextCliPath, 'build'], {
|
|
700
|
-
cwd: options.appPath,
|
|
701
|
-
env: createNextBuildProcessEnvironment(options.environment),
|
|
702
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
703
|
-
});
|
|
704
|
-
|
|
705
|
-
buildProcess.stdout?.on('data', (chunk) => {
|
|
706
|
-
forwardBuildOutput(chunk.toString(), options.onBuildOutput);
|
|
707
|
-
});
|
|
708
|
-
buildProcess.stderr?.on('data', (chunk) => {
|
|
709
|
-
forwardBuildOutput(chunk.toString(), options.onBuildOutput);
|
|
710
|
-
});
|
|
711
|
-
|
|
712
|
-
buildProcess.once('error', (error) => {
|
|
713
|
-
rejectBuild(createNextBuildSpawnError(error));
|
|
714
|
-
});
|
|
715
|
-
buildProcess.once('close', (code, signal) => {
|
|
716
|
-
resolveBuild({ code, signal });
|
|
717
|
-
});
|
|
718
|
-
});
|
|
719
|
-
}
|
|
720
|
-
|
|
721
|
-
/**
|
|
722
|
-
* Creates the environment passed to the spawned Next.js build process.
|
|
723
|
-
*/
|
|
724
|
-
function createNextBuildProcessEnvironment(environment: NodeJS.ProcessEnv): NodeJS.ProcessEnv {
|
|
725
|
-
return {
|
|
726
|
-
...environment,
|
|
727
|
-
NODE_OPTIONS: mergeNodeOptionsWithHeapSize(environment.NODE_OPTIONS, AGENTS_SERVER_BUILD_MAX_OLD_SPACE_MIB),
|
|
728
|
-
};
|
|
729
|
-
}
|
|
730
|
-
|
|
731
|
-
/**
|
|
732
|
-
* Returns true when one failed build attempt is worth retrying.
|
|
733
|
-
*/
|
|
734
|
-
function isNextBuildTerminationRetryable(exitStatus: NextBuildExitStatus): boolean {
|
|
735
|
-
return exitStatus.code === null && RETRYABLE_NEXT_BUILD_SIGNALS.has(exitStatus.signal);
|
|
736
|
-
}
|
|
737
|
-
|
|
738
|
-
/**
|
|
739
|
-
* Creates one visible retry message for a killed Next.js build attempt.
|
|
740
|
-
*/
|
|
741
|
-
function createNextBuildRetryMessage(exitStatus: NextBuildExitStatus, nextAttempt: number): string {
|
|
742
|
-
return `\nAgents Server Next build was terminated by ${describeNextBuildExitStatus(exitStatus)}. Retrying attempt ${nextAttempt}/${AGENTS_SERVER_BUILD_MAX_ATTEMPTS}.\n`;
|
|
743
|
-
}
|
|
744
|
-
|
|
745
|
-
/**
|
|
746
|
-
* Creates a branded error for a failed Next.js build child process.
|
|
747
|
-
*/
|
|
748
|
-
function createNextBuildExitError(exitStatus: NextBuildExitStatus, attemptCount: number): NotAllowed {
|
|
749
|
-
const lowMemoryHint = isNextBuildTerminationRetryable(exitStatus)
|
|
750
|
-
? '\n\nThe build process was terminated by the operating system. On standalone VPS self-updates this usually means the host ran out of memory while Next.js was compiling or prerendering the app.'
|
|
751
|
-
: '';
|
|
752
|
-
|
|
753
|
-
return new NotAllowed(
|
|
754
|
-
spaceTrim(`
|
|
755
|
-
Agents Server Next production build failed.
|
|
756
|
-
|
|
757
|
-
- Exit code: \`${String(exitStatus.code)}\`
|
|
758
|
-
- Signal: \`${String(exitStatus.signal)}\`
|
|
759
|
-
- Attempts: \`${String(attemptCount)}\`
|
|
760
|
-
${lowMemoryHint}
|
|
761
|
-
`),
|
|
762
|
-
);
|
|
763
|
-
}
|
|
764
|
-
|
|
765
|
-
/**
|
|
766
|
-
* Creates a branded error for failures to start the Next.js build child process.
|
|
767
|
-
*/
|
|
768
|
-
function createNextBuildSpawnError(error: Error): NotAllowed {
|
|
769
|
-
return new NotAllowed(
|
|
770
|
-
spaceTrim(`
|
|
771
|
-
Cannot start the Agents Server Next production build.
|
|
772
|
-
|
|
773
|
-
${error.message}
|
|
774
|
-
`),
|
|
775
|
-
);
|
|
776
|
-
}
|
|
777
|
-
|
|
778
|
-
/**
|
|
779
|
-
* Formats one Next.js build exit status for foreground logs.
|
|
780
|
-
*/
|
|
781
|
-
function describeNextBuildExitStatus(exitStatus: NextBuildExitStatus): string {
|
|
782
|
-
if (exitStatus.signal) {
|
|
783
|
-
return `signal \`${exitStatus.signal}\``;
|
|
784
|
-
}
|
|
785
|
-
|
|
786
|
-
return `exit code \`${String(exitStatus.code)}\``;
|
|
787
|
-
}
|
|
788
|
-
|
|
789
|
-
/**
|
|
790
|
-
* Prepends `--max-old-space-size=<mib>` to `NODE_OPTIONS` unless the caller already set one.
|
|
791
|
-
*/
|
|
792
|
-
function mergeNodeOptionsWithHeapSize(existingNodeOptions: string | undefined, maxOldSpaceMib: number): string {
|
|
793
|
-
if (existingNodeOptions !== undefined && /--max-old-space-size[= ]/u.test(existingNodeOptions)) {
|
|
794
|
-
return existingNodeOptions;
|
|
795
|
-
}
|
|
796
|
-
|
|
797
|
-
const heapFlag = `--max-old-space-size=${maxOldSpaceMib}`;
|
|
798
|
-
|
|
799
|
-
return existingNodeOptions ? `${heapFlag} ${existingNodeOptions}` : heapFlag;
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
/**
|
|
803
|
-
* Sends one Next build output chunk through the caller handler or to the foreground terminal.
|
|
804
|
-
*/
|
|
805
|
-
function forwardBuildOutput(chunk: string, onBuildOutput: ((chunk: string) => void) | undefined): void {
|
|
806
|
-
if (onBuildOutput) {
|
|
807
|
-
onBuildOutput(chunk);
|
|
808
|
-
return;
|
|
809
|
-
}
|
|
810
|
-
|
|
811
|
-
process.stdout.write(chunk);
|
|
812
|
-
}
|
|
813
|
-
|
|
814
|
-
/**
|
|
815
|
-
* Reads and validates cached build metadata.
|
|
816
|
-
*/
|
|
817
|
-
async function readAgentsServerBuildCache(
|
|
818
|
-
options: AgentsServerBuildCacheOptions,
|
|
819
|
-
): Promise<AgentsServerBuildCache | undefined> {
|
|
820
|
-
try {
|
|
821
|
-
const serializedBuildCache = await readFile(
|
|
822
|
-
join(resolveAgentsServerBuildOutputPath(options), AGENTS_SERVER_BUILD_CACHE_FILENAME),
|
|
823
|
-
'utf-8',
|
|
824
|
-
);
|
|
825
|
-
const buildCache = JSON.parse(serializedBuildCache) as Partial<AgentsServerBuildCache>;
|
|
826
|
-
|
|
827
|
-
if (
|
|
828
|
-
buildCache.version !== AGENTS_SERVER_BUILD_CACHE_VERSION ||
|
|
829
|
-
typeof buildCache.sourceFingerprint !== 'string'
|
|
830
|
-
) {
|
|
831
|
-
return undefined;
|
|
832
|
-
}
|
|
833
|
-
|
|
834
|
-
return buildCache as AgentsServerBuildCache;
|
|
835
|
-
} catch {
|
|
836
|
-
return undefined;
|
|
837
|
-
}
|
|
838
|
-
}
|
|
839
|
-
|
|
840
|
-
/**
|
|
841
|
-
* Fingerprints all runtime source paths that can affect the local Agents Server build.
|
|
842
|
-
*/
|
|
843
|
-
async function createAgentsServerBuildSourceFingerprint(appPath: string): Promise<string> {
|
|
844
|
-
const runtimeRootPath = resolve(appPath, '..', '..');
|
|
845
|
-
const fingerprint = createHash('sha256');
|
|
846
|
-
|
|
847
|
-
for (const relativeInputPath of AGENTS_SERVER_BUILD_INPUT_RELATIVE_PATHS) {
|
|
848
|
-
await addAgentsServerBuildInputToFingerprint(fingerprint, {
|
|
849
|
-
inputPath: join(runtimeRootPath, relativeInputPath),
|
|
850
|
-
runtimeRootPath,
|
|
851
|
-
});
|
|
852
|
-
}
|
|
853
|
-
|
|
854
|
-
return fingerprint.digest('hex');
|
|
855
|
-
}
|
|
856
|
-
|
|
857
|
-
/**
|
|
858
|
-
* Adds one runtime source file or directory subtree to the production build fingerprint.
|
|
859
|
-
*/
|
|
860
|
-
async function addAgentsServerBuildInputToFingerprint(
|
|
861
|
-
fingerprint: Hash,
|
|
862
|
-
options: {
|
|
863
|
-
readonly inputPath: string;
|
|
864
|
-
readonly runtimeRootPath: string;
|
|
865
|
-
},
|
|
866
|
-
): Promise<void> {
|
|
867
|
-
if (isExcludedAgentsServerBuildInputPath(options.inputPath, options.runtimeRootPath)) {
|
|
868
|
-
return;
|
|
869
|
-
}
|
|
870
|
-
|
|
871
|
-
let inputStats;
|
|
872
|
-
|
|
873
|
-
try {
|
|
874
|
-
inputStats = await stat(options.inputPath);
|
|
875
|
-
} catch {
|
|
876
|
-
fingerprint.update(`missing:${normalizeBuildInputPath(options.runtimeRootPath, options.inputPath)}\n`);
|
|
877
|
-
return;
|
|
878
|
-
}
|
|
879
|
-
|
|
880
|
-
if (inputStats.isFile()) {
|
|
881
|
-
fingerprint.update(`file:${normalizeBuildInputPath(options.runtimeRootPath, options.inputPath)}\n`);
|
|
882
|
-
fingerprint.update(await readFile(options.inputPath));
|
|
883
|
-
fingerprint.update('\n');
|
|
884
|
-
return;
|
|
885
|
-
}
|
|
886
|
-
|
|
887
|
-
if (!inputStats.isDirectory()) {
|
|
888
|
-
return;
|
|
889
|
-
}
|
|
890
|
-
|
|
891
|
-
fingerprint.update(`directory:${normalizeBuildInputPath(options.runtimeRootPath, options.inputPath)}\n`);
|
|
892
|
-
const inputDirents = await readdir(options.inputPath, { withFileTypes: true });
|
|
893
|
-
const sortedInputDirents = [...inputDirents].sort((left, right) => left.name.localeCompare(right.name));
|
|
894
|
-
|
|
895
|
-
for (const inputDirent of sortedInputDirents) {
|
|
896
|
-
if (inputDirent.isDirectory() && AGENTS_SERVER_BUILD_INPUT_EXCLUDED_DIRECTORY_NAMES.has(inputDirent.name)) {
|
|
897
|
-
continue;
|
|
898
|
-
}
|
|
899
|
-
|
|
900
|
-
await addAgentsServerBuildInputToFingerprint(fingerprint, {
|
|
901
|
-
inputPath: join(options.inputPath, inputDirent.name),
|
|
902
|
-
runtimeRootPath: options.runtimeRootPath,
|
|
903
|
-
});
|
|
904
|
-
}
|
|
905
|
-
}
|
|
906
|
-
|
|
907
|
-
/**
|
|
908
|
-
* Returns true for non-build files and folders inside shared runtime source paths.
|
|
909
|
-
*/
|
|
910
|
-
function isExcludedAgentsServerBuildInputPath(inputPath: string, runtimeRootPath: string): boolean {
|
|
911
|
-
const inputRelativePath = normalizeBuildInputPath(runtimeRootPath, inputPath);
|
|
912
|
-
const inputPathSegments = inputRelativePath.split('/').filter(Boolean);
|
|
913
|
-
const inputBasename = basename(inputPath);
|
|
914
|
-
|
|
915
|
-
if (
|
|
916
|
-
inputPathSegments.some((inputPathSegment) =>
|
|
917
|
-
AGENTS_SERVER_BUILD_INPUT_EXCLUDED_DIRECTORY_NAMES.has(inputPathSegment),
|
|
918
|
-
)
|
|
919
|
-
) {
|
|
920
|
-
return true;
|
|
921
|
-
}
|
|
922
|
-
|
|
923
|
-
if (inputPathSegments.includes('playground')) {
|
|
924
|
-
return true;
|
|
925
|
-
}
|
|
926
|
-
|
|
927
|
-
if (isExcludedAgentsServerRuntimeSourcePath(inputRelativePath)) {
|
|
928
|
-
return true;
|
|
929
|
-
}
|
|
930
|
-
|
|
931
|
-
return (
|
|
932
|
-
AGENTS_SERVER_BUILD_INPUT_TEST_FILE_PATTERN.test(inputBasename) ||
|
|
933
|
-
AGENTS_SERVER_BUILD_INPUT_TEST_TYPE_FILE_PATTERN.test(inputBasename)
|
|
934
|
-
);
|
|
935
|
-
}
|
|
936
|
-
|
|
937
|
-
/**
|
|
938
|
-
* Normalizes one absolute runtime path so cache fingerprints are stable across platforms.
|
|
939
|
-
*/
|
|
940
|
-
function normalizeBuildInputPath(runtimeRootPath: string, inputPath: string): string {
|
|
941
|
-
return relative(runtimeRootPath, inputPath).replace(/\\/gu, '/');
|
|
942
|
-
}
|
|
943
|
-
|
|
944
|
-
/**
|
|
945
|
-
* Resolves the Next output directory used by a particular build environment.
|
|
946
|
-
*/
|
|
947
|
-
function resolveAgentsServerBuildOutputPath(options: AgentsServerBuildCacheOptions): string {
|
|
948
|
-
return resolve(
|
|
949
|
-
options.appPath,
|
|
950
|
-
options.environment?.NEXT_DIST_DIR || DEFAULT_AGENTS_SERVER_NEXT_DIST_DIRECTORY_NAME,
|
|
951
|
-
);
|
|
952
|
-
}
|
|
953
|
-
|
|
954
|
-
/**
|
|
955
|
-
* Returns true when the app path points at the project-local materialized runtime.
|
|
956
|
-
*/
|
|
957
|
-
function isAgentsServerAppPathMaterialized(appPath: string): boolean {
|
|
958
|
-
const normalizedAppPath = appPath.replace(/\\/gu, '/');
|
|
959
|
-
const normalizedMaterializedRuntimePath = resolvePromptbookTemporaryPath(
|
|
960
|
-
process.cwd(),
|
|
961
|
-
'agents-server',
|
|
962
|
-
'runtime',
|
|
963
|
-
).replace(/\\/gu, '/');
|
|
964
|
-
|
|
965
|
-
return normalizedAppPath.includes(normalizedMaterializedRuntimePath);
|
|
966
|
-
}
|
|
967
|
-
|
|
968
|
-
/**
|
|
969
|
-
* Returns true when one path is nested below a `node_modules` segment.
|
|
970
|
-
*/
|
|
971
|
-
function isPathInsideNodeModules(path: string): boolean {
|
|
972
|
-
return path.split(/[\\/]+/u).includes(NODE_MODULES_DIRECTORY_NAME);
|
|
973
|
-
}
|
|
974
|
-
|
|
975
|
-
/**
|
|
976
|
-
* Resolves the dependency root that contains the installed Next CLI.
|
|
977
|
-
*/
|
|
978
|
-
function resolveNodeModulesPath(nextCliPath: string): string {
|
|
979
|
-
const normalizedNextCliPath = nextCliPath.replace(/\\/gu, '/');
|
|
980
|
-
const marker = `/${NODE_MODULES_DIRECTORY_NAME}/next/`;
|
|
981
|
-
const markerIndex = normalizedNextCliPath.lastIndexOf(marker);
|
|
982
|
-
|
|
983
|
-
if (markerIndex === -1) {
|
|
984
|
-
return resolve(nextCliPath, '..', '..', '..');
|
|
985
|
-
}
|
|
986
|
-
|
|
987
|
-
return normalizedNextCliPath.slice(0, markerIndex + marker.length - '/next/'.length);
|
|
988
|
-
}
|
|
989
|
-
|
|
990
|
-
/**
|
|
991
|
-
* Prepends one dependency root to `NODE_PATH` while preserving any existing value.
|
|
992
|
-
*/
|
|
993
|
-
function mergeNodePath(nodeModulesPath: string, nodePath: string | undefined): string {
|
|
994
|
-
if (!nodePath) {
|
|
995
|
-
return nodeModulesPath;
|
|
996
|
-
}
|
|
997
|
-
|
|
998
|
-
return `${nodeModulesPath}${delimiter}${nodePath}`;
|
|
999
|
-
}
|
|
1000
|
-
|
|
1001
|
-
/**
|
|
1002
|
-
* Returns true when one path exists as a regular file.
|
|
1003
|
-
*/
|
|
1004
|
-
async function isFile(path: string): Promise<boolean> {
|
|
1005
|
-
try {
|
|
1006
|
-
return (await stat(path)).isFile();
|
|
1007
|
-
} catch {
|
|
1008
|
-
return false;
|
|
1009
|
-
}
|
|
1010
|
-
}
|
|
1011
|
-
|
|
1012
|
-
/**
|
|
1013
|
-
* Returns true when one folder contains the Next Agents Server app marker files.
|
|
1014
|
-
*/
|
|
1015
|
-
async function isAgentsServerAppPath(candidate: string): Promise<boolean> {
|
|
1016
|
-
try {
|
|
1017
|
-
const [packageStats, nextConfigStats] = await Promise.all([
|
|
1018
|
-
stat(join(candidate, 'package.json')),
|
|
1019
|
-
stat(join(candidate, 'next.config.ts')),
|
|
1020
|
-
]);
|
|
1021
|
-
|
|
1022
|
-
return packageStats.isFile() && nextConfigStats.isFile();
|
|
1023
|
-
} catch {
|
|
1024
|
-
return false;
|
|
1025
|
-
}
|
|
1026
|
-
}
|
|
1027
|
-
|
|
1028
|
-
/**
|
|
1029
|
-
* Resolves the Next CLI module installed alongside the Promptbook CLI.
|
|
1030
|
-
*/
|
|
1031
|
-
function resolveNextCliPath(): string {
|
|
1032
|
-
try {
|
|
1033
|
-
return require.resolve('next/dist/bin/next');
|
|
1034
|
-
} catch {
|
|
1035
|
-
throw new NotAllowed(
|
|
1036
|
-
spaceTrim(`
|
|
1037
|
-
Cannot start Agents Server because the \`next\` package is unavailable.
|
|
1038
|
-
|
|
1039
|
-
Reinstall \`ptbk\` so the CLI package contains the Agents Server runtime dependencies.
|
|
1040
|
-
`),
|
|
1041
|
-
);
|
|
1042
|
-
}
|
|
1043
|
-
}
|
|
1
|
+
// Note: This file is a thin facade over the focused modules under `./buildAgentsServer/`.
|
|
2
|
+
// It keeps the local Agents Server build API stable while runtime preparation,
|
|
3
|
+
// materialization, fingerprinting, cache handling, and Next build execution are
|
|
4
|
+
// split into small single-responsibility modules.
|
|
5
|
+
|
|
6
|
+
export {
|
|
7
|
+
createAgentsServerRuntimeEnvironment,
|
|
8
|
+
PTBK_AGENTS_SERVER_BUILD_WORKER_COUNT_ENV,
|
|
9
|
+
PTBK_AGENTS_SERVER_IGNORE_NEXT_VALIDATION_ENV,
|
|
10
|
+
PTBK_AGENTS_SERVER_NODE_MODULES_PATH_ENV,
|
|
11
|
+
} from './buildAgentsServer/createAgentsServerRuntimeEnvironment';
|
|
12
|
+
export { ensureAgentsServerBuild } from './buildAgentsServer/ensureAgentsServerBuild';
|
|
13
|
+
export { isAgentsServerBuildCacheCurrent } from './buildAgentsServer/isAgentsServerBuildCacheCurrent';
|
|
14
|
+
export { prepareAgentsServerRuntime } from './buildAgentsServer/prepareAgentsServerRuntime';
|
|
15
|
+
export { resolveAgentsServerAppPath } from './buildAgentsServer/resolveAgentsServerAppPath';
|
|
16
|
+
export { resolveAgentsServerBuildAppPath } from './buildAgentsServer/resolveAgentsServerBuildAppPath';
|
|
17
|
+
export { writeAgentsServerBuildCache } from './buildAgentsServer/writeAgentsServerBuildCache';
|
|
18
|
+
|
|
19
|
+
export type {
|
|
20
|
+
AgentsServerBuildArtifacts,
|
|
21
|
+
PreparedAgentsServerRuntime,
|
|
22
|
+
} from './buildAgentsServer/PreparedAgentsServerRuntime';
|
|
1044
23
|
|
|
1045
24
|
// Note: [🟡] Code for CLI runtime [buildAgentsServer](src/cli/cli-commands/agents-server/buildAgentsServer.ts) should never be published outside of `@promptbook/cli`
|
|
1046
25
|
// Note: [💞] Ignore a discrepancy between file name and entity name
|