@promptbook/cli 0.113.0-0 → 0.113.0-10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (710) hide show
  1. package/README.md +1 -17
  2. package/agents/default/developer.book +3 -0
  3. package/apps/agents-server/next.config.ts +6 -3
  4. package/apps/agents-server/src/app/admin/resource-monitor/page.tsx +456 -0
  5. package/apps/agents-server/src/app/admin/task-manager/TaskManagerClient.tsx +17 -5
  6. package/apps/agents-server/src/app/admin/task-manager/TaskManagerTaskLogActions.tsx +150 -0
  7. package/apps/agents-server/src/app/admin/task-manager/TaskManagerTaskRow.tsx +69 -20
  8. package/apps/agents-server/src/app/admin/task-manager/TaskManagerTaskTerminalDialog.tsx +125 -0
  9. package/apps/agents-server/src/app/admin/task-manager/TaskManagerTasksCard.tsx +8 -6
  10. package/apps/agents-server/src/app/admin/task-manager/page.tsx +3 -2
  11. package/apps/agents-server/src/app/admin/update/AdvancedOriginRepositoryPanel.tsx +81 -0
  12. package/apps/agents-server/src/app/admin/update/AutomaticSelfUpdateConfigurationCard.tsx +90 -0
  13. package/apps/agents-server/src/app/admin/update/CurrentDeploymentCard.tsx +162 -0
  14. package/apps/agents-server/src/app/admin/update/CustomCommitPicker.tsx +10 -10
  15. package/apps/agents-server/src/app/admin/update/InstalledVersionsCard.tsx +112 -0
  16. package/apps/agents-server/src/app/admin/update/PendingCommitsCard.tsx +87 -0
  17. package/apps/agents-server/src/app/admin/update/TargetEnvironmentCard.tsx +331 -0
  18. package/apps/agents-server/src/app/admin/update/UpdateClient.tsx +35 -878
  19. package/apps/agents-server/src/app/admin/update/UpdateDatabaseMigrationsPanel.tsx +305 -0
  20. package/apps/agents-server/src/app/admin/update/UpdateJobCard.tsx +350 -0
  21. package/apps/agents-server/src/app/admin/update/UpdateOverview.ts +142 -0
  22. package/apps/agents-server/src/app/admin/update/buildDeploymentTimeBehindLabel.ts +29 -0
  23. package/apps/agents-server/src/app/admin/update/formatHumanReadableTimestamp.ts +18 -0
  24. package/apps/agents-server/src/app/admin/update/getUpdateJobFailureMessage.ts +13 -0
  25. package/apps/agents-server/src/app/admin/update/getUpdateJobSuccessMessage.ts +13 -0
  26. package/apps/agents-server/src/app/admin/update/updatePageCardClassName.ts +6 -0
  27. package/apps/agents-server/src/app/admin/update/useUpdateClientState.ts +675 -0
  28. package/apps/agents-server/src/app/agents/[agentName]/AgentChatWrapper.tsx +17 -3
  29. package/apps/agents-server/src/app/agents/[agentName]/api/book/route.ts +13 -1
  30. package/apps/agents-server/src/app/agents/[agentName]/chat/CanonicalAgentChatSurface.tsx +6 -2
  31. package/apps/agents-server/src/app/agents/[agentName]/export-as-transpiled-code/AgentCodePageClient.tsx +14 -559
  32. package/apps/agents-server/src/app/agents/[agentName]/export-as-transpiled-code/AgentCodePageHeader.tsx +84 -0
  33. package/apps/agents-server/src/app/agents/[agentName]/export-as-transpiled-code/AgentCodePageSection.tsx +52 -0
  34. package/apps/agents-server/src/app/agents/[agentName]/export-as-transpiled-code/GeneratedCodePreview.tsx +138 -0
  35. package/apps/agents-server/src/app/agents/[agentName]/export-as-transpiled-code/GeneratedHarnessSection.tsx +98 -0
  36. package/apps/agents-server/src/app/agents/[agentName]/export-as-transpiled-code/SourceBookSection.tsx +66 -0
  37. package/apps/agents-server/src/app/agents/[agentName]/export-as-transpiled-code/TranspiledCodeErrorBanner.tsx +30 -0
  38. package/apps/agents-server/src/app/agents/[agentName]/export-as-transpiled-code/TranspiledCodeExportWarningBanner.tsx +62 -0
  39. package/apps/agents-server/src/app/agents/[agentName]/export-as-transpiled-code/Transpiler.ts +9 -0
  40. package/apps/agents-server/src/app/agents/[agentName]/export-as-transpiled-code/useAgentCodeExportState.ts +478 -0
  41. package/apps/agents-server/src/app/api/admin/chat-tasks/[taskId]/terminal/route.ts +52 -0
  42. package/apps/agents-server/src/app/api/admin/update/route.ts +55 -8
  43. package/apps/agents-server/src/app/api/admin/update/versions/route.ts +34 -0
  44. package/apps/agents-server/src/app/api/auth/shibboleth/acs/route.ts +4 -2
  45. package/apps/agents-server/src/app/api/auth/shibboleth/login/route.ts +3 -1
  46. package/apps/agents-server/src/app/api/auth/shibboleth/metadata/route.ts +5 -2
  47. package/apps/agents-server/src/app/api/auth/shibboleth/status/route.ts +5 -2
  48. package/apps/agents-server/src/app/api/page-preview/input/route.ts +161 -0
  49. package/apps/agents-server/src/app/api/page-preview/stream/route.ts +81 -0
  50. package/apps/agents-server/src/app/layout.tsx +39 -25
  51. package/apps/agents-server/src/app/system/utilities/mocked-chats/cloneMockedChatPreset.ts +17 -0
  52. package/apps/agents-server/src/app/system/utilities/mocked-chats/confirmDeleteMockedChat.ts +16 -0
  53. package/apps/agents-server/src/app/system/utilities/mocked-chats/createDraftWithUpdatedMessage.ts +81 -0
  54. package/apps/agents-server/src/app/system/utilities/mocked-chats/createDraftWithUpdatedParticipant.ts +146 -0
  55. package/apps/agents-server/src/app/system/utilities/mocked-chats/createDraftWithUpdatedSettings.ts +19 -0
  56. package/apps/agents-server/src/app/system/utilities/mocked-chats/createDuplicatedDraft.ts +66 -0
  57. package/apps/agents-server/src/app/system/utilities/mocked-chats/findMockedChatById.ts +51 -0
  58. package/apps/agents-server/src/app/system/utilities/mocked-chats/persistMockedChats.ts +51 -0
  59. package/apps/agents-server/src/app/system/utilities/mocked-chats/useMockedChatsEditorState.ts +16 -426
  60. package/apps/agents-server/src/components/AgentAvatar/AgentAvatar.tsx +1 -1
  61. package/apps/agents-server/src/components/AgentAvatar/DefaultAgentAvatarVisualProvider.tsx +1 -1
  62. package/apps/agents-server/src/components/CronJobConfiguration/CronJobConfiguration.tsx +834 -0
  63. package/apps/agents-server/src/components/Header/Header.tsx +16 -3
  64. package/apps/agents-server/src/components/Header/HeaderDesktopTopMenuNavigation.tsx +22 -2
  65. package/apps/agents-server/src/components/Header/HeaderHomepageLink.tsx +1 -1
  66. package/apps/agents-server/src/components/Header/HeaderMobileDrawer.tsx +22 -2
  67. package/apps/agents-server/src/components/Header/HeaderTypes.ts +12 -1
  68. package/apps/agents-server/src/components/Header/buildAgentMenuStructure.tsx +6 -4
  69. package/apps/agents-server/src/components/Header/buildDocumentationDropdownItems.tsx +198 -3
  70. package/apps/agents-server/src/components/Header/buildHeaderMenuItems.ts +6 -0
  71. package/apps/agents-server/src/components/Header/buildHeaderSystemMenuItems.ts +182 -16
  72. package/apps/agents-server/src/components/Homepage/buildFreeGraphBoxLayout.ts +446 -0
  73. package/apps/agents-server/src/components/Homepage/buildGraphLayoutNodes.ts +415 -157
  74. package/apps/agents-server/src/components/Homepage/useAgentsGraphCanvasState.ts +2 -1
  75. package/apps/agents-server/src/components/Homepage/useAgentsListState.ts +1 -1
  76. package/apps/agents-server/src/components/LayoutWrapper/LayoutWrapper.tsx +21 -5
  77. package/apps/agents-server/src/constants/chatVisualMode.ts +1 -1
  78. package/apps/agents-server/src/constants/defaultAgentAvatarVisual.ts +4 -3
  79. package/apps/agents-server/src/constants/themeMode.ts +1 -1
  80. package/apps/agents-server/src/database/metadataDefaults.ts +1 -1
  81. package/apps/agents-server/src/database/migrate.ts +25 -1
  82. package/apps/agents-server/src/database/migratePrefix.ts +24 -0
  83. package/apps/agents-server/src/database/migrations/2026-05-2600-default-theme.sql +2 -2
  84. package/apps/agents-server/src/database/runDatabaseMigrations.ts +9 -1
  85. package/apps/agents-server/src/database/sqlite/$provideLocalSqliteSupabase.ts +3 -1541
  86. package/apps/agents-server/src/database/sqlite/localSqliteSupabase/LocalSqliteQueryBuilder.ts +623 -0
  87. package/apps/agents-server/src/database/sqlite/localSqliteSupabase/LocalSqliteSupabaseClient.ts +64 -0
  88. package/apps/agents-server/src/database/sqlite/localSqliteSupabase/ensureTable.ts +93 -0
  89. package/apps/agents-server/src/database/sqlite/localSqliteSupabase/localSqliteFilters.ts +202 -0
  90. package/apps/agents-server/src/database/sqlite/localSqliteSupabase/localSqliteMutationPayload.ts +131 -0
  91. package/apps/agents-server/src/database/sqlite/localSqliteSupabase/localSqliteRowOperations.ts +102 -0
  92. package/apps/agents-server/src/database/sqlite/localSqliteSupabase/localSqliteSql.ts +59 -0
  93. package/apps/agents-server/src/database/sqlite/localSqliteSupabase/localSqliteTableSchema.ts +329 -0
  94. package/apps/agents-server/src/database/sqlite/localSqliteSupabase/localSqliteTypes.ts +84 -0
  95. package/apps/agents-server/src/database/sqlite/localSqliteSupabase/localSqliteValueCodec.ts +63 -0
  96. package/apps/agents-server/src/database/sqlite/localSqliteSupabase/normalizeSqliteError.ts +22 -0
  97. package/apps/agents-server/src/instrumentation-node.ts +15 -0
  98. package/apps/agents-server/src/languages/ServerTranslationKeys.ts +1 -0
  99. package/apps/agents-server/src/languages/translations/czech.yaml +1 -0
  100. package/apps/agents-server/src/languages/translations/english.yaml +1 -0
  101. package/apps/agents-server/src/search/createDefaultServerSearchProviders/loadLocalOrganizationSearchDataset.ts +12 -1
  102. package/apps/agents-server/src/tools/send_email.ts +1 -2
  103. package/apps/agents-server/src/{components/Homepage → utils/agentOrganization}/hiddenFolders.ts +49 -29
  104. package/apps/agents-server/src/utils/agentOrganization/loadAgentOrganizationState.ts +13 -1
  105. package/apps/agents-server/src/utils/backup/createServerBackupZipStream.ts +7 -1382
  106. package/apps/agents-server/src/utils/backup/serverBackup/appendAgentBackupEntriesToZip.ts +27 -0
  107. package/apps/agents-server/src/utils/backup/serverBackup/appendConversationBackupEntriesToZip.ts +140 -0
  108. package/apps/agents-server/src/utils/backup/serverBackup/appendFileBackupEntriesToZip.ts +147 -0
  109. package/apps/agents-server/src/utils/backup/serverBackup/appendMessageBackupEntriesToZip.ts +65 -0
  110. package/apps/agents-server/src/utils/backup/serverBackup/appendMetadataBackupEntriesToZip.ts +39 -0
  111. package/apps/agents-server/src/utils/backup/serverBackup/appendSectionEntriesToZip.ts +92 -0
  112. package/apps/agents-server/src/utils/backup/serverBackup/appendUserBackupEntriesToZip.ts +80 -0
  113. package/apps/agents-server/src/utils/backup/serverBackup/createRedactedWalletBackupRecord.ts +34 -0
  114. package/apps/agents-server/src/utils/backup/serverBackup/createServerBackupManifest.ts +82 -0
  115. package/apps/agents-server/src/utils/backup/serverBackup/downloadBackupBinaryContent.ts +39 -0
  116. package/apps/agents-server/src/utils/backup/serverBackup/resolveFeedbackThreadMessages.ts +53 -0
  117. package/apps/agents-server/src/utils/backup/serverBackup/serverBackupAttachments.ts +151 -0
  118. package/apps/agents-server/src/utils/backup/serverBackup/serverBackupContext.ts +167 -0
  119. package/apps/agents-server/src/utils/backup/serverBackup/serverBackupFilenames.ts +161 -0
  120. package/apps/agents-server/src/utils/backup/serverBackup/serverBackupPreviews.ts +97 -0
  121. package/apps/agents-server/src/utils/backup/serverBackup/serverBackupRowUtilities.ts +158 -0
  122. package/apps/agents-server/src/utils/backup/serverBackup/serverBackupTypes.ts +59 -0
  123. package/apps/agents-server/src/utils/chat/createAttachmentAwareCitationLabelResolver.ts +147 -0
  124. package/apps/agents-server/src/utils/chatTasksAdmin.ts +4 -1
  125. package/apps/agents-server/src/utils/createLocalAgentSourceImporter.ts +159 -0
  126. package/apps/agents-server/src/utils/createMissingImportedAgentFallback.ts +60 -0
  127. package/apps/agents-server/src/utils/createPagePreviewBrowserStream.ts +179 -0
  128. package/apps/agents-server/src/utils/customDomainRouting.ts +157 -12
  129. package/apps/agents-server/src/utils/externalChatRunner/processExternalUserChatJob.ts +12 -6
  130. package/apps/agents-server/src/utils/getAdminChatTasksResponse/getAdminChatTasks/GetAdminChatTasksData.ts +12 -0
  131. package/apps/agents-server/src/utils/getAdminChatTasksResponse/getAdminChatTasks/adminChatTaskSqlQuery.ts +264 -0
  132. package/apps/agents-server/src/utils/getAdminChatTasksResponse/getAdminChatTasks/adminChatTaskSqlValues.ts +35 -0
  133. package/apps/agents-server/src/utils/getAdminChatTasksResponse/getAdminChatTasks/adminChatTaskTimeUtilities.ts +30 -0
  134. package/apps/agents-server/src/utils/getAdminChatTasksResponse/getAdminChatTasks/compareAdminChatTasks.ts +135 -0
  135. package/apps/agents-server/src/utils/getAdminChatTasksResponse/getAdminChatTasks/createAdminChatTaskCounters.ts +29 -0
  136. package/apps/agents-server/src/utils/getAdminChatTasksResponse/getAdminChatTasks/filterAdminChatTasks.ts +78 -0
  137. package/apps/agents-server/src/utils/getAdminChatTasksResponse/getAdminChatTasks/getAdminChatTasksViaClientSql.ts +62 -0
  138. package/apps/agents-server/src/utils/getAdminChatTasksResponse/getAdminChatTasks/getAdminChatTasksViaSupabaseQuery.ts +29 -0
  139. package/apps/agents-server/src/utils/getAdminChatTasksResponse/getAdminChatTasks/loadAdminChatTaskFallbackData.ts +193 -0
  140. package/apps/agents-server/src/utils/getAdminChatTasksResponse/getAdminChatTasks/mapAdminChatTaskFallbackRows.ts +99 -0
  141. package/apps/agents-server/src/utils/getAdminChatTasksResponse/getAdminChatTasks/mapAdminChatTaskSqlRows.ts +94 -0
  142. package/apps/agents-server/src/utils/getAdminChatTasksResponse/getAdminChatTasks.ts +4 -947
  143. package/apps/agents-server/src/utils/getAdminChatTasksResponse/mapVpsSelfUpdateJobToAdminChatTask.ts +97 -0
  144. package/apps/agents-server/src/utils/getAdminChatTasksResponse.ts +258 -6
  145. package/apps/agents-server/src/utils/importAgentWithFallback.ts +1 -58
  146. package/apps/agents-server/src/utils/localAgentRouteReferences.ts +167 -0
  147. package/apps/agents-server/src/utils/localChatRunner/processLocalUserChatJob.ts +21 -6
  148. package/apps/agents-server/src/utils/managementApi/managementApiAgents.ts +17 -3
  149. package/apps/agents-server/src/utils/messages/sendMessage.ts +5 -3
  150. package/apps/agents-server/src/utils/pagePreviewBrowserSessions.ts +246 -0
  151. package/apps/agents-server/src/utils/resolveAgentStateFromSource.ts +7 -1
  152. package/apps/agents-server/src/utils/resolveInheritedAgentSource.ts +54 -5
  153. package/apps/agents-server/src/utils/resolveServerAgentContext.ts +12 -1
  154. package/apps/agents-server/src/utils/resolveStoredAgentState.ts +2 -1
  155. package/apps/agents-server/src/utils/resourceMonitor/formatResourceMonitorValue.ts +50 -0
  156. package/apps/agents-server/src/utils/resourceMonitor/readCpuResourceUsage.ts +75 -0
  157. package/apps/agents-server/src/utils/resourceMonitor/readDiskResourceUsage.ts +42 -0
  158. package/apps/agents-server/src/utils/resourceMonitor/readMemoryResourceUsage.ts +28 -0
  159. package/apps/agents-server/src/utils/resourceMonitor/readNetworkResourceUsage.ts +271 -0
  160. package/apps/agents-server/src/utils/resourceMonitor/readServerResourceMonitorSnapshot.ts +47 -0
  161. package/apps/agents-server/src/utils/resourceMonitor/resolveServerResourceWarningStatus.ts +72 -0
  162. package/apps/agents-server/src/utils/resourceMonitor/resourceMonitorConstants.ts +29 -0
  163. package/apps/agents-server/src/utils/resourceMonitor/resourceMonitorTypes.ts +155 -0
  164. package/apps/agents-server/src/utils/resourceMonitor/waitForResourceMonitorSample.ts +11 -0
  165. package/apps/agents-server/src/utils/shibbolethAuthentication/createShibbolethSamlClient.ts +35 -0
  166. package/apps/agents-server/src/utils/shibbolethAuthentication/createShibbolethServiceProviderMetadataXml.ts +25 -0
  167. package/apps/agents-server/src/utils/shibbolethAuthentication/extractShibbolethProfileAttributes.ts +173 -0
  168. package/apps/agents-server/src/utils/shibbolethAuthentication/fetchIdentityProviderMetadataXml.ts +21 -0
  169. package/apps/agents-server/src/utils/shibbolethAuthentication/findOrCreateShibbolethUser.ts +323 -0
  170. package/apps/agents-server/src/utils/shibbolethAuthentication/getShibbolethAuthenticationAttemptTableName.ts +13 -0
  171. package/apps/agents-server/src/utils/shibbolethAuthentication/getShibbolethRequestDetails.ts +19 -0
  172. package/apps/agents-server/src/utils/shibbolethAuthentication/getShibbolethUserIdentityTableName.ts +13 -0
  173. package/apps/agents-server/src/utils/shibbolethAuthentication/parseIdentityProviderMetadataXml.ts +110 -0
  174. package/apps/agents-server/src/utils/shibbolethAuthentication/recordShibbolethAuthenticationAttempt.ts +57 -0
  175. package/apps/agents-server/src/utils/shibbolethAuthentication/resolveShibbolethAuthenticationConfiguration.ts +78 -0
  176. package/apps/agents-server/src/utils/shibbolethAuthentication/resolveShibbolethPublicRequestUrl.ts +101 -0
  177. package/apps/agents-server/src/utils/shibbolethAuthentication/resolveShibbolethServiceProviderUrls.ts +63 -0
  178. package/apps/agents-server/src/utils/shibbolethAuthentication/sanitizeShibbolethRelayState.ts +17 -0
  179. package/apps/agents-server/src/utils/shibbolethAuthentication/shibbolethAuthenticationConstants.ts +62 -0
  180. package/apps/agents-server/src/utils/shibbolethAuthentication/shibbolethAuthenticationTypes.ts +105 -0
  181. package/apps/agents-server/src/utils/shibbolethAuthentication.ts +25 -957
  182. package/apps/agents-server/src/utils/speech-to-text/SpeechToTextFailoverRecognition/SpeechToTextFailoverRecognitionProviderRuntime.ts +0 -1
  183. package/apps/agents-server/src/utils/speech-to-text/SpeechToTextFailoverRecognition.ts +34 -2
  184. package/apps/agents-server/src/utils/taskTerminal/resolveAdminTaskTerminalSession.ts +512 -0
  185. package/apps/agents-server/src/utils/taskTerminal/runWithTaskTerminalCapture.ts +134 -0
  186. package/apps/agents-server/src/utils/taskTerminal/taskTerminalLog.ts +360 -0
  187. package/apps/agents-server/src/utils/userChat/finalizeUserChatJob.ts +16 -0
  188. package/apps/agents-server/src/utils/userChat/userChatMessageLifecycle.ts +39 -9
  189. package/apps/agents-server/src/utils/userChatTimeout/userChatTimeoutStore/updateUserChatTimeoutTerminalState.ts +3 -0
  190. package/apps/agents-server/src/utils/userChatTimeout/userChatTimeoutWorker.ts +4 -1
  191. package/apps/agents-server/src/utils/vpsConfiguration.ts +4 -0
  192. package/apps/agents-server/src/utils/vpsSelfUpdate/deleteVpsSelfUpdateInstalledVersion.ts +81 -0
  193. package/apps/agents-server/src/utils/vpsSelfUpdate/listVpsSelfUpdateCandidateCommits.ts +217 -0
  194. package/apps/agents-server/src/utils/vpsSelfUpdate/readPersistedVpsSelfUpdateJob.ts +310 -0
  195. package/apps/agents-server/src/utils/vpsSelfUpdate/readVpsSelfUpdateOverview.ts +178 -0
  196. package/apps/agents-server/src/utils/vpsSelfUpdate/resolveVpsSelfUpdateJobForOverview.ts +42 -0
  197. package/apps/agents-server/src/utils/vpsSelfUpdate/startVpsSelfUpdate.ts +201 -0
  198. package/apps/agents-server/src/utils/vpsSelfUpdate/vpsSelfUpdateAutomaticConfiguration.ts +152 -0
  199. package/apps/agents-server/src/utils/vpsSelfUpdate/vpsSelfUpdateConfiguration.ts +81 -0
  200. package/apps/agents-server/src/utils/vpsSelfUpdate/vpsSelfUpdateCron.ts +357 -0
  201. package/apps/agents-server/src/utils/vpsSelfUpdate/vpsSelfUpdateEnvironment.ts +120 -0
  202. package/apps/agents-server/src/utils/vpsSelfUpdate/vpsSelfUpdateInstalledVersions.ts +162 -0
  203. package/apps/agents-server/src/utils/vpsSelfUpdate/vpsSelfUpdateJobConstants.ts +15 -0
  204. package/apps/agents-server/src/utils/vpsSelfUpdate/vpsSelfUpdateJobHistory.ts +387 -0
  205. package/apps/agents-server/src/utils/vpsSelfUpdate/vpsSelfUpdateJobIdentity.ts +26 -0
  206. package/apps/agents-server/src/utils/vpsSelfUpdate/vpsSelfUpdateOriginRepository.ts +90 -0
  207. package/apps/agents-server/src/utils/vpsSelfUpdate/vpsSelfUpdateRepository.ts +286 -0
  208. package/apps/agents-server/src/utils/vpsSelfUpdate/vpsSelfUpdateScheduler.ts +191 -0
  209. package/apps/agents-server/src/utils/vpsSelfUpdate/vpsSelfUpdateStateFiles.ts +197 -0
  210. package/apps/agents-server/src/utils/vpsSelfUpdate/vpsSelfUpdateTypes.ts +452 -0
  211. package/apps/agents-server/src/utils/vpsSelfUpdate.ts +66 -1535
  212. package/apps/agents-server/tests/e2e/support/ChatHistoryNavigationSupport.ts +5 -0
  213. package/esm/apps/agents-server/src/database/migratePrefix.d.ts +19 -0
  214. package/esm/apps/agents-server/src/database/runDatabaseMigrations.d.ts +4 -0
  215. package/esm/book/scripts/import-markdown/increaseHeadings.d.ts +8 -0
  216. package/esm/index.es.js +28592 -27063
  217. package/esm/index.es.js.map +1 -1
  218. package/esm/scripts/find-refactor-candidates/find-refactor-candidates.d.ts +7 -0
  219. package/esm/scripts/find-refactor-candidates/selectMostImportantRefactorCandidates.d.ts +12 -0
  220. package/esm/scripts/run-agent-messages/main/runMultipleAgentMessages/MultipleAgentAutoPuller.d.ts +27 -0
  221. package/esm/scripts/run-agent-messages/main/runMultipleAgentMessages/MultipleAgentGithubSynchronizer.d.ts +26 -0
  222. package/esm/scripts/run-agent-messages/main/runMultipleAgentMessages/MultipleAgentRunUiPresenter.d.ts +66 -0
  223. package/esm/scripts/run-agent-messages/main/runMultipleAgentMessages/RunMultipleAgentMessageTaskScheduler.d.ts +67 -0
  224. package/esm/scripts/run-agent-messages/main/runMultipleAgentMessages/formatProjectPath.d.ts +6 -0
  225. package/esm/scripts/run-agent-messages/main/runMultipleAgentMessages/loadLocalAgentRunnerProjectSummaries.d.ts +11 -0
  226. package/esm/scripts/run-agent-messages/main/runMultipleAgentMessages/wait.d.ts +6 -0
  227. package/esm/scripts/run-agent-messages/main/runMultipleAgentMessages.d.ts +1 -1
  228. package/esm/scripts/run-codex-prompts/common/buildCoderRunProgressSnapshot.d.ts +1 -1
  229. package/esm/scripts/run-codex-prompts/common/cliProgressDisplay.d.ts +2 -1
  230. package/esm/scripts/run-codex-prompts/common/resolveCoderAgent.d.ts +20 -0
  231. package/esm/scripts/run-codex-prompts/runners/claude-code/ClaudeCodeRunner.d.ts +4 -0
  232. package/esm/scripts/run-codex-prompts/runners/claude-code/ClaudeCodeSessionResurrection.d.ts +37 -0
  233. package/esm/scripts/run-codex-prompts/runners/claude-code/parseClaudeCodeOutputEvents.d.ts +47 -0
  234. package/esm/scripts/run-codex-prompts/ui/CoderRunUiState.d.ts +8 -1
  235. package/esm/scripts/run-codex-prompts/ui/buildCoderRunAgentVisual.d.ts +54 -0
  236. package/esm/scripts/run-codex-prompts/ui/buildCoderRunUiFrame.d.ts +10 -0
  237. package/esm/scripts/run-codex-prompts/ui/coderRunUiRefresh.d.ts +2 -2
  238. package/esm/src/_packages/types.index.d.ts +2 -2
  239. package/esm/src/avatars/renderAvatarVisualAsciiArt.d.ts +98 -0
  240. package/esm/src/avatars/visuals/octopus3dAvatarVisualShared.d.ts +1 -1
  241. package/esm/src/book-components/BookEditor/BookEditorMonacoUploadPanel.d.ts +1 -1
  242. package/esm/src/book-components/BookEditor/useBookEditorMonacoUploads/bookEditorMonacoUploadTypes.d.ts +120 -0
  243. package/esm/src/book-components/BookEditor/useBookEditorMonacoUploads/clearScheduledTimer.d.ts +6 -0
  244. package/esm/src/book-components/BookEditor/useBookEditorMonacoUploads/enqueueFilesForUpload.d.ts +26 -0
  245. package/esm/src/book-components/BookEditor/useBookEditorMonacoUploads/useBookEditorMonacoUploadEditorSync.d.ts +23 -0
  246. package/esm/src/book-components/BookEditor/useBookEditorMonacoUploads/useBookEditorMonacoUploadItemsState.d.ts +21 -0
  247. package/esm/src/book-components/BookEditor/useBookEditorMonacoUploads/useBookEditorMonacoUploadProgressQueue.d.ts +12 -0
  248. package/esm/src/book-components/BookEditor/useBookEditorMonacoUploads/useBookEditorMonacoUploadQueue.d.ts +27 -0
  249. package/esm/src/book-components/BookEditor/useBookEditorMonacoUploads/useCompletedUploadsAutoClear.d.ts +12 -0
  250. package/esm/src/book-components/BookEditor/useBookEditorMonacoUploads.d.ts +5 -58
  251. package/esm/src/book-components/Chat/Chat/ChatImageAttachmentModal.d.ts +25 -0
  252. package/esm/src/book-components/Chat/Chat/ChatInputArea.d.ts +3 -0
  253. package/esm/src/book-components/Chat/Chat/ChatMessageAttachments.d.ts +27 -0
  254. package/esm/src/book-components/Chat/Chat/ChatMessageItem.d.ts +1 -1
  255. package/esm/src/book-components/Chat/Chat/ChatMessageList.d.ts +1 -0
  256. package/esm/src/book-components/Chat/Chat/ChatProps.d.ts +8 -0
  257. package/esm/src/book-components/Chat/Chat/CitationIframePreview.d.ts +2 -2
  258. package/esm/src/book-components/Chat/Chat/CitationIframePreview.test.d.ts +2 -0
  259. package/esm/src/book-components/Chat/Chat/insertDictationChunk.d.ts +1 -1
  260. package/esm/src/book-components/Chat/Chat/insertDictationChunk.test.d.ts +1 -0
  261. package/esm/src/book-components/Chat/Chat/learnDictationDictionary.test.d.ts +1 -0
  262. package/esm/src/book-components/Chat/Chat/refineFinalDictationChunk.test.d.ts +1 -0
  263. package/esm/src/book-components/Chat/Chat/useChatInputAreaComposer.d.ts +12 -0
  264. package/esm/src/book-components/Chat/Chat/useChatInputAreaComposer.draftMessage.test.d.ts +2 -0
  265. package/esm/src/book-components/Chat/utils/isVisibleChatToolCall.d.ts +1 -1
  266. package/esm/src/book-components/Chat/utils/parseMessageButtons.d.ts +16 -2
  267. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/AGENTS_SERVER_BUILD_CACHE_FILENAME.d.ts +6 -0
  268. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/AGENTS_SERVER_BUILD_CACHE_VERSION.d.ts +6 -0
  269. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/AGENTS_SERVER_NEXT_BUILD_ID_FILENAME.d.ts +6 -0
  270. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/AgentsServerBuildCache.d.ts +10 -0
  271. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/AgentsServerBuildCacheOptions.d.ts +10 -0
  272. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/NODE_MODULES_DIRECTORY_NAME.d.ts +6 -0
  273. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/PreparedAgentsServerRuntime.d.ts +18 -0
  274. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/createAgentsServerBuildSourceFingerprint.d.ts +6 -0
  275. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/createAgentsServerRuntimeEnvironment.d.ts +28 -0
  276. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/ensureAgentsServerBuild.d.ts +19 -0
  277. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/getAgentsServerBuildInputRelativePaths.d.ts +11 -0
  278. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/isAgentsServerAppPath.d.ts +6 -0
  279. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/isAgentsServerAppPathMaterialized.d.ts +6 -0
  280. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/isAgentsServerBuildCacheCurrent.d.ts +7 -0
  281. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/isAgentsServerBuildInputTestFile.d.ts +6 -0
  282. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/isExcludedAgentsServerBuildInputDirectoryName.d.ts +6 -0
  283. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/isExcludedAgentsServerBuildInputPath.d.ts +6 -0
  284. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/isExcludedAgentsServerRuntimeSourcePath.d.ts +6 -0
  285. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/isFile.d.ts +6 -0
  286. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/isPathInsideNodeModules.d.ts +6 -0
  287. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/normalizeAgentsServerBuildInputPath.d.ts +6 -0
  288. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/prepareAgentsServerRuntime.d.ts +9 -0
  289. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/readAgentsServerBuildCache.d.ts +8 -0
  290. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/resolveAgentsServerAppPath.d.ts +6 -0
  291. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/resolveAgentsServerBuildAppPath.d.ts +9 -0
  292. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/resolveAgentsServerBuildOutputPath.d.ts +7 -0
  293. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/resolveNextCliPath.d.ts +6 -0
  294. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/resolveNodeModulesPath.d.ts +6 -0
  295. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/runNextBuild.d.ts +12 -0
  296. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/shouldCopyAgentsServerRuntimePath.d.ts +6 -0
  297. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/synchronizeMaterializedAgentsServerRuntime.d.ts +11 -0
  298. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/writeAgentsServerBuildCache.d.ts +7 -0
  299. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer.d.ts +8 -109
  300. package/esm/src/cli/cli-commands/agents-server/ensureAgentsServerEnvFile.d.ts +1 -1
  301. package/esm/src/cli/cli-commands/agents-server/ensureAgentsServerGitignoreFile.d.ts +1 -1
  302. package/esm/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerChildEnvironment.d.ts +16 -0
  303. package/esm/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerLogStreams.d.ts +30 -0
  304. package/esm/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerRuntimePaths.d.ts +19 -0
  305. package/esm/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerSupervisorState.d.ts +37 -0
  306. package/esm/src/cli/cli-commands/agents-server/startAgentsServer/LocalAgentRunnerLimits.d.ts +9 -0
  307. package/esm/src/cli/cli-commands/agents-server/startAgentsServer/PreparedAgentsServerLaunch.d.ts +13 -0
  308. package/esm/src/cli/cli-commands/agents-server/startAgentsServer/StartAgentsServerOptions.d.ts +24 -0
  309. package/esm/src/cli/cli-commands/agents-server/startAgentsServer/createInternalRouteErrorMessage.d.ts +6 -0
  310. package/esm/src/cli/cli-commands/agents-server/startAgentsServer/createLocalAgentRunOptions.d.ts +9 -0
  311. package/esm/src/cli/cli-commands/agents-server/startAgentsServer/forwardChildOutput.d.ts +13 -0
  312. package/esm/src/cli/cli-commands/agents-server/startAgentsServer/loadAgentsServerProjectEnvironment.d.ts +6 -0
  313. package/esm/src/cli/cli-commands/agents-server/startAgentsServer/prepareAgentsServerLaunch.d.ts +18 -0
  314. package/esm/src/cli/cli-commands/agents-server/startAgentsServer/readInternalRouteErrorDetails.d.ts +6 -0
  315. package/esm/src/cli/cli-commands/agents-server/startAgentsServer/resolveAgentsServerChildHostname.d.ts +7 -0
  316. package/esm/src/cli/cli-commands/agents-server/startAgentsServer/startNextServer.d.ts +20 -0
  317. package/esm/src/cli/cli-commands/agents-server/startAgentsServer/startUserChatJobWorkerPump.d.ts +15 -0
  318. package/esm/src/cli/cli-commands/agents-server/startAgentsServer/stopChildProcess.d.ts +8 -0
  319. package/esm/src/cli/cli-commands/agents-server/startAgentsServer/waitForLocalAgentRunnerLimits.d.ts +16 -0
  320. package/esm/src/cli/cli-commands/agents-server/startAgentsServer.d.ts +3 -30
  321. package/esm/src/cli/cli-commands/common/createPositiveIntegerOptionParser.d.ts +10 -0
  322. package/esm/src/cli/cli-commands/common/promptRunnerCliOptions.d.ts +1 -1
  323. package/esm/src/collection/agent-collection/CreateAgentInput.d.ts +1 -1
  324. package/esm/src/collection/agent-collection/constructors/agent-collection-in-supabase/prepareAgentSourceForPersistence.d.ts +1 -1
  325. package/esm/src/commitments/META/META.d.ts +2 -2
  326. package/esm/src/commitments/META_AVATAR/META_AVATAR.d.ts +9 -4
  327. package/esm/src/commitments/index.d.ts +1 -1
  328. package/esm/src/conversion/validation/validatePipeline/createPipelineValidationContext.d.ts +16 -0
  329. package/esm/src/conversion/validation/validatePipeline/validatePipelineCollectionsStructure.d.ts +7 -0
  330. package/esm/src/conversion/validation/validatePipeline/validatePipelineDependencyResolution.d.ts +7 -0
  331. package/esm/src/conversion/validation/validatePipeline/validatePipelineMetadata.d.ts +7 -0
  332. package/esm/src/conversion/validation/validatePipeline/validatePipelineParameters.d.ts +7 -0
  333. package/esm/src/conversion/validation/validatePipeline/validatePipelineTasks.d.ts +7 -0
  334. package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/RegisteredLlmToolsMessageContext.d.ts +46 -0
  335. package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/USED_ENV_FILENAME.d.ts +11 -0
  336. package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolConfigurationStatusMessage.d.ts +7 -0
  337. package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolEntryKey.d.ts +7 -0
  338. package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolInstallationStatusMessage.d.ts +7 -0
  339. package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolStatus.d.ts +14 -0
  340. package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolsMessageContext.d.ts +7 -0
  341. package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/getAvailableRegisteredLlmToolsEnvironmentVariables.d.ts +7 -0
  342. package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/getRegisteredLlmToolRegisters.d.ts +7 -0
  343. package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/hasRegisteredLlmToolEntry.d.ts +7 -0
  344. package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/listRegisteredLlmToolEntries.d.ts +9 -0
  345. package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/listRegisteredLlmToolStatuses.d.ts +7 -0
  346. package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/renderAvailableRegisteredLlmTools.d.ts +7 -0
  347. package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/renderNoRegisteredLlmToolsMessage.d.ts +7 -0
  348. package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/renderRegisteredLlmToolsMessage.d.ts +8 -0
  349. package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/renderRelevantRegisteredLlmToolsEnvironmentVariables.d.ts +7 -0
  350. package/esm/src/utils/agent-message-runtime/agentMessageRuntimePaths.d.ts +24 -0
  351. package/esm/src/utils/agents/resolveAgentAvatarImageUrl.d.ts +2 -2
  352. package/esm/src/utils/ascii-art/$detectTerminalAnsiColorDepth.d.ts +15 -0
  353. package/esm/src/utils/ascii-art/convertImageDataToAsciiArt.d.ts +80 -0
  354. package/esm/src/utils/color/Color.d.ts +1 -1
  355. package/esm/src/version.d.ts +1 -1
  356. package/package.json +1 -1
  357. package/src/_packages/types.index.ts +2 -2
  358. package/src/avatars/Avatar.tsx +2 -13
  359. package/src/avatars/avatarAnimationScheduler.ts +2 -1
  360. package/src/avatars/renderAvatarVisual.ts +2 -13
  361. package/src/avatars/renderAvatarVisualAsciiArt.ts +257 -0
  362. package/src/avatars/visuals/asciiOctopusAvatarVisual.ts +1 -6
  363. package/src/avatars/visuals/avatarVisualRegistry.ts +1 -1
  364. package/src/avatars/visuals/minecraft2AvatarVisual.ts +1 -2
  365. package/src/avatars/visuals/octopus2AvatarVisual.ts +1 -5
  366. package/src/avatars/visuals/octopus3AvatarVisual.ts +1 -8
  367. package/src/avatars/visuals/octopus3d2AvatarVisual.ts +4 -13
  368. package/src/avatars/visuals/octopus3d3AvatarVisual.ts +10 -15
  369. package/src/avatars/visuals/octopus3d4AvatarVisual.ts +18 -31
  370. package/src/avatars/visuals/octopus3dAvatarVisual.ts +3 -3
  371. package/src/avatars/visuals/octopus3dAvatarVisualShared.ts +2 -7
  372. package/src/book-2.0/agent-source/parseAgentSource/applyMetaCommitment.ts +2 -1
  373. package/src/book-2.0/book-language-documentation/createStandaloneBookLanguageMarkdown.ts +3 -5
  374. package/src/book-3.0/CliAgent.ts +1 -7
  375. package/src/book-3.0/LiteAgent.ts +5 -5
  376. package/src/book-components/AvatarProfile/AvatarProfile/AvatarProfile.tsx +1 -4
  377. package/src/book-components/BookEditor/BookEditor.tsx +2 -2
  378. package/src/book-components/BookEditor/BookEditorAboutPromptbookInformation.tsx +3 -2
  379. package/src/book-components/BookEditor/BookEditorActionbar.tsx +1 -1
  380. package/src/book-components/BookEditor/BookEditorMonaco.tsx +2 -2
  381. package/src/book-components/BookEditor/BookEditorMonacoUploadPanel.tsx +1 -1
  382. package/src/book-components/BookEditor/useBookEditorMonacoLanguage.ts +1 -1
  383. package/src/book-components/BookEditor/useBookEditorMonacoStyles.ts +1 -1
  384. package/src/book-components/BookEditor/useBookEditorMonacoUploads/bookEditorMonacoUploadTypes.ts +147 -0
  385. package/src/book-components/BookEditor/useBookEditorMonacoUploads/clearScheduledTimer.ts +10 -0
  386. package/src/book-components/BookEditor/useBookEditorMonacoUploads/enqueueFilesForUpload.ts +209 -0
  387. package/src/book-components/BookEditor/useBookEditorMonacoUploads/useBookEditorMonacoUploadEditorSync.ts +164 -0
  388. package/src/book-components/BookEditor/useBookEditorMonacoUploads/useBookEditorMonacoUploadItemsState.ts +121 -0
  389. package/src/book-components/BookEditor/useBookEditorMonacoUploads/useBookEditorMonacoUploadProgressQueue.ts +81 -0
  390. package/src/book-components/BookEditor/useBookEditorMonacoUploads/useBookEditorMonacoUploadQueue.ts +360 -0
  391. package/src/book-components/BookEditor/useBookEditorMonacoUploads/useCompletedUploadsAutoClear.ts +47 -0
  392. package/src/book-components/BookEditor/useBookEditorMonacoUploads.ts +10 -1067
  393. package/src/book-components/Chat/Chat/Chat.module.css +196 -0
  394. package/src/book-components/Chat/Chat/Chat.tsx +16 -1
  395. package/src/book-components/Chat/Chat/ChatCitationModal.tsx +2 -2
  396. package/src/book-components/Chat/Chat/ChatImageAttachmentModal.tsx +108 -0
  397. package/src/book-components/Chat/Chat/ChatInputArea.tsx +43 -27
  398. package/src/book-components/Chat/Chat/ChatMessageAttachments.tsx +212 -0
  399. package/src/book-components/Chat/Chat/ChatMessageItem.tsx +32 -18
  400. package/src/book-components/Chat/Chat/ChatMessageList.tsx +3 -0
  401. package/src/book-components/Chat/Chat/ChatProps.tsx +9 -0
  402. package/src/book-components/Chat/Chat/CitationIframePreview.tsx +138 -11
  403. package/src/book-components/Chat/Chat/createProgressCardChecklistMarkdown.ts +1 -8
  404. package/src/book-components/Chat/Chat/insertDictationChunk.ts +3 -3
  405. package/src/book-components/Chat/Chat/learnDictationDictionary.ts +1 -1
  406. package/src/book-components/Chat/Chat/renderTimeoutToolCallDetails.tsx +1 -5
  407. package/src/book-components/Chat/Chat/useChatInputAreaComposer.ts +59 -7
  408. package/src/book-components/Chat/Chat/useChatInputAreaDictation.ts +140 -33
  409. package/src/book-components/Chat/Chat/useChatToolCallModalState.ts +1 -4
  410. package/src/book-components/Chat/hooks/useChatRatings.ts +1 -1
  411. package/src/book-components/Chat/save/html/htmlSaveFormatDefinition.ts +2 -3
  412. package/src/book-components/Chat/save/markdown/mdSaveFormatDefinition.ts +2 -2
  413. package/src/book-components/Chat/save/pdf/buildChatPdf.ts +1 -1
  414. package/src/book-components/Chat/utils/getToolCallChipletInfo.ts +1 -5
  415. package/src/book-components/Chat/utils/isVisibleChatToolCall.ts +2 -1
  416. package/src/book-components/Chat/utils/parseMessageButtons.ts +27 -2
  417. package/src/cli/cli-commands/about.ts +1 -1
  418. package/src/cli/cli-commands/agent/agentCliOptions.ts +2 -5
  419. package/src/cli/cli-commands/agent-folder/agentProjectPaths.ts +6 -12
  420. package/src/cli/cli-commands/agent-folder/init.ts +3 -8
  421. package/src/cli/cli-commands/agent-folder/initializeAgentProjectConfiguration.ts +2 -11
  422. package/src/cli/cli-commands/agent-folder/printAgentInitializationSummary.ts +2 -9
  423. package/src/cli/cli-commands/agents-server/buildAgentsServer/AGENTS_SERVER_BUILD_CACHE_FILENAME.ts +6 -0
  424. package/src/cli/cli-commands/agents-server/buildAgentsServer/AGENTS_SERVER_BUILD_CACHE_VERSION.ts +6 -0
  425. package/src/cli/cli-commands/agents-server/buildAgentsServer/AGENTS_SERVER_NEXT_BUILD_ID_FILENAME.ts +6 -0
  426. package/src/cli/cli-commands/agents-server/buildAgentsServer/AgentsServerBuildCache.ts +11 -0
  427. package/src/cli/cli-commands/agents-server/buildAgentsServer/AgentsServerBuildCacheOptions.ts +9 -0
  428. package/src/cli/cli-commands/agents-server/buildAgentsServer/NODE_MODULES_DIRECTORY_NAME.ts +6 -0
  429. package/src/cli/cli-commands/agents-server/buildAgentsServer/PreparedAgentsServerRuntime.ts +19 -0
  430. package/src/cli/cli-commands/agents-server/buildAgentsServer/createAgentsServerBuildSourceFingerprint.ts +71 -0
  431. package/src/cli/cli-commands/agents-server/buildAgentsServer/createAgentsServerRuntimeEnvironment.ts +69 -0
  432. package/src/cli/cli-commands/agents-server/buildAgentsServer/ensureAgentsServerBuild.ts +59 -0
  433. package/src/cli/cli-commands/agents-server/buildAgentsServer/getAgentsServerBuildInputRelativePaths.ts +23 -0
  434. package/src/cli/cli-commands/agents-server/buildAgentsServer/isAgentsServerAppPath.ts +20 -0
  435. package/src/cli/cli-commands/agents-server/buildAgentsServer/isAgentsServerAppPathMaterialized.ts +17 -0
  436. package/src/cli/cli-commands/agents-server/buildAgentsServer/isAgentsServerBuildCacheCurrent.ts +27 -0
  437. package/src/cli/cli-commands/agents-server/buildAgentsServer/isAgentsServerBuildInputTestFile.ts +21 -0
  438. package/src/cli/cli-commands/agents-server/buildAgentsServer/isExcludedAgentsServerBuildInputDirectoryName.ts +22 -0
  439. package/src/cli/cli-commands/agents-server/buildAgentsServer/isExcludedAgentsServerBuildInputPath.ts +30 -0
  440. package/src/cli/cli-commands/agents-server/buildAgentsServer/isExcludedAgentsServerRuntimeSourcePath.ts +41 -0
  441. package/src/cli/cli-commands/agents-server/buildAgentsServer/isFile.ts +14 -0
  442. package/src/cli/cli-commands/agents-server/buildAgentsServer/isPathInsideNodeModules.ts +10 -0
  443. package/src/cli/cli-commands/agents-server/buildAgentsServer/normalizeAgentsServerBuildInputPath.ts +10 -0
  444. package/src/cli/cli-commands/agents-server/buildAgentsServer/prepareAgentsServerRuntime.ts +31 -0
  445. package/src/cli/cli-commands/agents-server/buildAgentsServer/readAgentsServerBuildCache.ts +35 -0
  446. package/src/cli/cli-commands/agents-server/buildAgentsServer/resolveAgentsServerAppPath.ts +33 -0
  447. package/src/cli/cli-commands/agents-server/buildAgentsServer/resolveAgentsServerBuildAppPath.ts +30 -0
  448. package/src/cli/cli-commands/agents-server/buildAgentsServer/resolveAgentsServerBuildOutputPath.ts +19 -0
  449. package/src/cli/cli-commands/agents-server/buildAgentsServer/resolveNextCliPath.ts +21 -0
  450. package/src/cli/cli-commands/agents-server/buildAgentsServer/resolveNodeModulesPath.ts +19 -0
  451. package/src/cli/cli-commands/agents-server/buildAgentsServer/runNextBuild.ts +184 -0
  452. package/src/cli/cli-commands/agents-server/buildAgentsServer/shouldCopyAgentsServerRuntimePath.ts +48 -0
  453. package/src/cli/cli-commands/agents-server/buildAgentsServer/synchronizeMaterializedAgentsServerRuntime.ts +179 -0
  454. package/src/cli/cli-commands/agents-server/buildAgentsServer/writeAgentsServerBuildCache.ts +28 -0
  455. package/src/cli/cli-commands/agents-server/buildAgentsServer.ts +22 -1043
  456. package/src/cli/cli-commands/agents-server/ensureAgentsServerEnvFile.ts +2 -1
  457. package/src/cli/cli-commands/agents-server/ensureAgentsServerGitignoreFile.ts +2 -1
  458. package/src/cli/cli-commands/agents-server/run.ts +2 -5
  459. package/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerChildEnvironment.ts +67 -0
  460. package/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerLogStreams.ts +43 -0
  461. package/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerRuntimePaths.ts +44 -0
  462. package/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerSupervisorState.ts +59 -0
  463. package/src/cli/cli-commands/agents-server/startAgentsServer/LocalAgentRunnerLimits.ts +9 -0
  464. package/src/cli/cli-commands/agents-server/startAgentsServer/PreparedAgentsServerLaunch.ts +14 -0
  465. package/src/cli/cli-commands/agents-server/startAgentsServer/StartAgentsServerOptions.ts +26 -0
  466. package/src/cli/cli-commands/agents-server/startAgentsServer/createInternalRouteErrorMessage.ts +15 -0
  467. package/src/cli/cli-commands/agents-server/startAgentsServer/createLocalAgentRunOptions.ts +29 -0
  468. package/src/cli/cli-commands/agents-server/startAgentsServer/forwardChildOutput.ts +32 -0
  469. package/src/cli/cli-commands/agents-server/startAgentsServer/loadAgentsServerProjectEnvironment.ts +18 -0
  470. package/src/cli/cli-commands/agents-server/startAgentsServer/prepareAgentsServerLaunch.ts +81 -0
  471. package/src/cli/cli-commands/agents-server/startAgentsServer/readInternalRouteErrorDetails.ts +52 -0
  472. package/src/cli/cli-commands/agents-server/startAgentsServer/resolveAgentsServerChildHostname.ts +17 -0
  473. package/src/cli/cli-commands/agents-server/startAgentsServer/startNextServer.ts +97 -0
  474. package/src/cli/cli-commands/agents-server/startAgentsServer/startUserChatJobWorkerPump.ts +132 -0
  475. package/src/cli/cli-commands/agents-server/startAgentsServer/stopChildProcess.ts +14 -0
  476. package/src/cli/cli-commands/agents-server/startAgentsServer/waitForLocalAgentRunnerLimits.ts +132 -0
  477. package/src/cli/cli-commands/agents-server/startAgentsServer.ts +24 -797
  478. package/src/cli/cli-commands/agents-server.ts +2 -6
  479. package/src/cli/cli-commands/coder/agentCodingFile.ts +1 -7
  480. package/src/cli/cli-commands/coder/boilerplateTemplates.ts +14 -21
  481. package/src/cli/cli-commands/coder/find-refactor-candidates.ts +9 -2
  482. package/src/cli/cli-commands/coder/generate-boilerplates.ts +2 -6
  483. package/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.ts +2 -10
  484. package/src/cli/cli-commands/coder/run.ts +3 -27
  485. package/src/cli/cli-commands/coder/server.ts +4 -2
  486. package/src/cli/cli-commands/common/createPositiveIntegerOptionParser.ts +31 -0
  487. package/src/cli/cli-commands/common/promptRunnerCliOptions.ts +3 -8
  488. package/src/cli/cli-commands/make.ts +1 -1
  489. package/src/cli/cli-commands/run/runCommandAction.ts +1 -1
  490. package/src/cli/promptbookCli.ts +28 -3
  491. package/src/collection/agent-collection/CreateAgentInput.ts +2 -5
  492. package/src/collection/agent-collection/constructors/agent-collection-in-supabase/prepareAgentSourceForPersistence.ts +1 -1
  493. package/src/commitments/MEMORY/createMemoryToolFunctions.ts +1 -10
  494. package/src/commitments/MEMORY/getMemoryToolRuntimeAdapterOrDisabledResult.ts +1 -10
  495. package/src/commitments/MEMORY/parseMemoryToolArgs.ts +1 -6
  496. package/src/commitments/META/META.ts +4 -4
  497. package/src/commitments/META_AVATAR/META_AVATAR.ts +16 -10
  498. package/src/commitments/TEAM/TEAM.ts +5 -5
  499. package/src/commitments/USE_CALENDAR/createUseCalendarToolFunctions.ts +1 -4
  500. package/src/commitments/USE_PROJECT/createUseProjectToolFunctions.ts +2 -10
  501. package/src/commitments/USE_TIMEOUT/createTimeoutToolFunctions.ts +1 -11
  502. package/src/commitments/USE_TIMEOUT/getTimeoutToolRuntimeAdapterOrDisabledResult.ts +1 -6
  503. package/src/commitments/USE_TIMEOUT/parseTimeoutToolArgs.ts +1 -6
  504. package/src/commitments/WALLET/createWalletToolFunctions.ts +2 -11
  505. package/src/commitments/WALLET/getWalletToolRuntimeAdapterOrDisabledResult.ts +1 -6
  506. package/src/commitments/WALLET/parseWalletToolArgs.ts +1 -10
  507. package/src/commitments/index.ts +1 -0
  508. package/src/conversion/parsePipeline/applyPipelineHead.ts +1 -1
  509. package/src/conversion/parsePipeline/createUniqueSectionNameResolver.ts +1 -1
  510. package/src/conversion/parsePipeline/processPipelineSection.ts +1 -1
  511. package/src/conversion/validation/validatePipeline/createPipelineValidationContext.ts +43 -0
  512. package/src/conversion/validation/validatePipeline/validatePipelineCollectionsStructure.ts +72 -0
  513. package/src/conversion/validation/validatePipeline/validatePipelineDependencyResolution.ts +220 -0
  514. package/src/conversion/validation/validatePipeline/validatePipelineMetadata.ts +66 -0
  515. package/src/conversion/validation/validatePipeline/validatePipelineParameters.ts +136 -0
  516. package/src/conversion/validation/validatePipeline/validatePipelineTasks.ts +243 -0
  517. package/src/conversion/validation/validatePipeline.ts +7 -750
  518. package/src/execution/LlmExecutionTools.ts +1 -6
  519. package/src/execution/createPipelineExecutor/getReservedParametersForTask.ts +1 -5
  520. package/src/llm-providers/_common/register/$registeredLlmToolsMessage/RegisteredLlmToolsMessageContext.ts +51 -0
  521. package/src/llm-providers/_common/register/$registeredLlmToolsMessage/USED_ENV_FILENAME.ts +30 -0
  522. package/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolConfigurationStatusMessage.ts +62 -0
  523. package/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolEntryKey.ts +10 -0
  524. package/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolInstallationStatusMessage.ts +75 -0
  525. package/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolStatus.ts +101 -0
  526. package/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolsMessageContext.ts +24 -0
  527. package/src/llm-providers/_common/register/$registeredLlmToolsMessage/getAvailableRegisteredLlmToolsEnvironmentVariables.ts +17 -0
  528. package/src/llm-providers/_common/register/$registeredLlmToolsMessage/getRegisteredLlmToolRegisters.ts +15 -0
  529. package/src/llm-providers/_common/register/$registeredLlmToolsMessage/hasRegisteredLlmToolEntry.ts +19 -0
  530. package/src/llm-providers/_common/register/$registeredLlmToolsMessage/listRegisteredLlmToolEntries.ts +44 -0
  531. package/src/llm-providers/_common/register/$registeredLlmToolsMessage/listRegisteredLlmToolStatuses.ts +21 -0
  532. package/src/llm-providers/_common/register/$registeredLlmToolsMessage/renderAvailableRegisteredLlmTools.ts +97 -0
  533. package/src/llm-providers/_common/register/$registeredLlmToolsMessage/renderNoRegisteredLlmToolsMessage.ts +17 -0
  534. package/src/llm-providers/_common/register/$registeredLlmToolsMessage/renderRegisteredLlmToolsMessage.ts +30 -0
  535. package/src/llm-providers/_common/register/$registeredLlmToolsMessage/renderRelevantRegisteredLlmToolsEnvironmentVariables.ts +32 -0
  536. package/src/llm-providers/_common/register/$registeredLlmToolsMessage.ts +5 -568
  537. package/src/llm-providers/_common/utils/count-total-usage/limitTotalUsage.ts +1 -6
  538. package/src/llm-providers/openai/OpenAiAgentKitExecutionTools.ts +2 -2
  539. package/src/llm-providers/openai/OpenAiAssistantExecutionTools.ts +1 -1
  540. package/src/llm-providers/openai/OpenAiAssistantExecutionToolsStreamRunner.ts +2 -2
  541. package/src/llm-providers/openai/OpenAiAssistantExecutionToolsToolRunner.ts +1 -1
  542. package/src/llm-providers/openai/OpenAiCompatibleExecutionTools.ts +2 -7
  543. package/src/llm-providers/openai/utils/OpenAiCompatibleChatPromptBuilder.ts +1 -1
  544. package/src/llm-providers/openai/utils/OpenAiCompatibleChatToolCaller.ts +2 -2
  545. package/src/llm-providers/openai/utils/OpenAiCompatibleUnsupportedParameterRetrier.ts +1 -5
  546. package/src/llm-providers/openai/utils/buildToolInvocationScript.ts +1 -6
  547. package/src/other/templates/getTemplatesPipelineCollection.ts +889 -773
  548. package/src/remote-server/startRemoteServer/registerExecutionRoutes.ts +1 -1
  549. package/src/remote-server/startRemoteServer/registerServerIndexRoute.ts +1 -1
  550. package/src/scrapers/_common/utils/makeKnowledgeSourceHandler.ts +1 -6
  551. package/src/speech-recognition/OpenAiSpeechRecognition.ts +1 -6
  552. package/src/transpilers/_common/prepareSdkTranspilerContext.ts +1 -4
  553. package/src/types/Prompt.ts +1 -7
  554. package/src/types/string_host.ts +1 -9
  555. package/src/types/string_pipeline_url.ts +1 -4
  556. package/src/utils/agent-message-runtime/agentMessageRuntimePaths.ts +66 -0
  557. package/src/utils/agents/resolveAgentAvatarImageUrl.ts +2 -2
  558. package/src/utils/ascii-art/$detectTerminalAnsiColorDepth.ts +45 -0
  559. package/src/utils/ascii-art/convertImageDataToAsciiArt.ts +396 -0
  560. package/src/utils/color/Color.ts +2 -2
  561. package/src/utils/markdown/parseMarkdownSection.ts +1 -5
  562. package/src/utils/random/$randomFullnameWithColor.ts +1 -6
  563. package/src/version.ts +2 -2
  564. package/src/versions.txt +7 -0
  565. package/umd/apps/agents-server/src/database/migratePrefix.d.ts +19 -0
  566. package/umd/apps/agents-server/src/database/runDatabaseMigrations.d.ts +4 -0
  567. package/umd/book/scripts/import-markdown/increaseHeadings.d.ts +8 -0
  568. package/umd/index.umd.js +28594 -27065
  569. package/umd/index.umd.js.map +1 -1
  570. package/umd/scripts/find-refactor-candidates/find-refactor-candidates.d.ts +7 -0
  571. package/umd/scripts/find-refactor-candidates/selectMostImportantRefactorCandidates.d.ts +12 -0
  572. package/umd/scripts/run-agent-messages/main/runMultipleAgentMessages/MultipleAgentAutoPuller.d.ts +27 -0
  573. package/umd/scripts/run-agent-messages/main/runMultipleAgentMessages/MultipleAgentGithubSynchronizer.d.ts +26 -0
  574. package/umd/scripts/run-agent-messages/main/runMultipleAgentMessages/MultipleAgentRunUiPresenter.d.ts +66 -0
  575. package/umd/scripts/run-agent-messages/main/runMultipleAgentMessages/RunMultipleAgentMessageTaskScheduler.d.ts +67 -0
  576. package/umd/scripts/run-agent-messages/main/runMultipleAgentMessages/formatProjectPath.d.ts +6 -0
  577. package/umd/scripts/run-agent-messages/main/runMultipleAgentMessages/loadLocalAgentRunnerProjectSummaries.d.ts +11 -0
  578. package/umd/scripts/run-agent-messages/main/runMultipleAgentMessages/wait.d.ts +6 -0
  579. package/umd/scripts/run-agent-messages/main/runMultipleAgentMessages.d.ts +1 -1
  580. package/umd/scripts/run-codex-prompts/common/buildCoderRunProgressSnapshot.d.ts +1 -1
  581. package/umd/scripts/run-codex-prompts/common/cliProgressDisplay.d.ts +2 -1
  582. package/umd/scripts/run-codex-prompts/common/resolveCoderAgent.d.ts +20 -0
  583. package/umd/scripts/run-codex-prompts/runners/claude-code/ClaudeCodeRunner.d.ts +4 -0
  584. package/umd/scripts/run-codex-prompts/runners/claude-code/ClaudeCodeSessionResurrection.d.ts +37 -0
  585. package/umd/scripts/run-codex-prompts/runners/claude-code/parseClaudeCodeOutputEvents.d.ts +47 -0
  586. package/umd/scripts/run-codex-prompts/ui/CoderRunUiState.d.ts +8 -1
  587. package/umd/scripts/run-codex-prompts/ui/buildCoderRunAgentVisual.d.ts +54 -0
  588. package/umd/scripts/run-codex-prompts/ui/buildCoderRunUiFrame.d.ts +10 -0
  589. package/umd/scripts/run-codex-prompts/ui/coderRunUiRefresh.d.ts +2 -2
  590. package/umd/src/_packages/types.index.d.ts +2 -2
  591. package/umd/src/avatars/renderAvatarVisualAsciiArt.d.ts +98 -0
  592. package/umd/src/avatars/visuals/octopus3dAvatarVisualShared.d.ts +1 -1
  593. package/umd/src/book-components/BookEditor/BookEditorMonacoUploadPanel.d.ts +1 -1
  594. package/umd/src/book-components/BookEditor/useBookEditorMonacoUploads/bookEditorMonacoUploadTypes.d.ts +120 -0
  595. package/umd/src/book-components/BookEditor/useBookEditorMonacoUploads/clearScheduledTimer.d.ts +6 -0
  596. package/umd/src/book-components/BookEditor/useBookEditorMonacoUploads/enqueueFilesForUpload.d.ts +26 -0
  597. package/umd/src/book-components/BookEditor/useBookEditorMonacoUploads/useBookEditorMonacoUploadEditorSync.d.ts +23 -0
  598. package/umd/src/book-components/BookEditor/useBookEditorMonacoUploads/useBookEditorMonacoUploadItemsState.d.ts +21 -0
  599. package/umd/src/book-components/BookEditor/useBookEditorMonacoUploads/useBookEditorMonacoUploadProgressQueue.d.ts +12 -0
  600. package/umd/src/book-components/BookEditor/useBookEditorMonacoUploads/useBookEditorMonacoUploadQueue.d.ts +27 -0
  601. package/umd/src/book-components/BookEditor/useBookEditorMonacoUploads/useCompletedUploadsAutoClear.d.ts +12 -0
  602. package/umd/src/book-components/BookEditor/useBookEditorMonacoUploads.d.ts +5 -58
  603. package/umd/src/book-components/Chat/Chat/ChatImageAttachmentModal.d.ts +25 -0
  604. package/umd/src/book-components/Chat/Chat/ChatInputArea.d.ts +3 -0
  605. package/umd/src/book-components/Chat/Chat/ChatMessageAttachments.d.ts +27 -0
  606. package/umd/src/book-components/Chat/Chat/ChatMessageItem.d.ts +1 -1
  607. package/umd/src/book-components/Chat/Chat/ChatMessageList.d.ts +1 -0
  608. package/umd/src/book-components/Chat/Chat/ChatProps.d.ts +8 -0
  609. package/umd/src/book-components/Chat/Chat/CitationIframePreview.d.ts +2 -2
  610. package/umd/src/book-components/Chat/Chat/CitationIframePreview.test.d.ts +2 -0
  611. package/umd/src/book-components/Chat/Chat/insertDictationChunk.d.ts +1 -1
  612. package/umd/src/book-components/Chat/Chat/insertDictationChunk.test.d.ts +1 -0
  613. package/umd/src/book-components/Chat/Chat/learnDictationDictionary.test.d.ts +1 -0
  614. package/umd/src/book-components/Chat/Chat/refineFinalDictationChunk.test.d.ts +1 -0
  615. package/umd/src/book-components/Chat/Chat/useChatInputAreaComposer.d.ts +12 -0
  616. package/umd/src/book-components/Chat/Chat/useChatInputAreaComposer.draftMessage.test.d.ts +2 -0
  617. package/umd/src/book-components/Chat/utils/isVisibleChatToolCall.d.ts +1 -1
  618. package/umd/src/book-components/Chat/utils/parseMessageButtons.d.ts +16 -2
  619. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/AGENTS_SERVER_BUILD_CACHE_FILENAME.d.ts +6 -0
  620. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/AGENTS_SERVER_BUILD_CACHE_VERSION.d.ts +6 -0
  621. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/AGENTS_SERVER_NEXT_BUILD_ID_FILENAME.d.ts +6 -0
  622. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/AgentsServerBuildCache.d.ts +10 -0
  623. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/AgentsServerBuildCacheOptions.d.ts +10 -0
  624. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/NODE_MODULES_DIRECTORY_NAME.d.ts +6 -0
  625. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/PreparedAgentsServerRuntime.d.ts +18 -0
  626. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/createAgentsServerBuildSourceFingerprint.d.ts +6 -0
  627. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/createAgentsServerRuntimeEnvironment.d.ts +28 -0
  628. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/ensureAgentsServerBuild.d.ts +19 -0
  629. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/getAgentsServerBuildInputRelativePaths.d.ts +11 -0
  630. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/isAgentsServerAppPath.d.ts +6 -0
  631. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/isAgentsServerAppPathMaterialized.d.ts +6 -0
  632. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/isAgentsServerBuildCacheCurrent.d.ts +7 -0
  633. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/isAgentsServerBuildInputTestFile.d.ts +6 -0
  634. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/isExcludedAgentsServerBuildInputDirectoryName.d.ts +6 -0
  635. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/isExcludedAgentsServerBuildInputPath.d.ts +6 -0
  636. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/isExcludedAgentsServerRuntimeSourcePath.d.ts +6 -0
  637. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/isFile.d.ts +6 -0
  638. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/isPathInsideNodeModules.d.ts +6 -0
  639. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/normalizeAgentsServerBuildInputPath.d.ts +6 -0
  640. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/prepareAgentsServerRuntime.d.ts +9 -0
  641. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/readAgentsServerBuildCache.d.ts +8 -0
  642. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/resolveAgentsServerAppPath.d.ts +6 -0
  643. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/resolveAgentsServerBuildAppPath.d.ts +9 -0
  644. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/resolveAgentsServerBuildOutputPath.d.ts +7 -0
  645. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/resolveNextCliPath.d.ts +6 -0
  646. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/resolveNodeModulesPath.d.ts +6 -0
  647. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/runNextBuild.d.ts +12 -0
  648. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/shouldCopyAgentsServerRuntimePath.d.ts +6 -0
  649. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/synchronizeMaterializedAgentsServerRuntime.d.ts +11 -0
  650. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/writeAgentsServerBuildCache.d.ts +7 -0
  651. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer.d.ts +8 -109
  652. package/umd/src/cli/cli-commands/agents-server/ensureAgentsServerEnvFile.d.ts +1 -1
  653. package/umd/src/cli/cli-commands/agents-server/ensureAgentsServerGitignoreFile.d.ts +1 -1
  654. package/umd/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerChildEnvironment.d.ts +16 -0
  655. package/umd/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerLogStreams.d.ts +30 -0
  656. package/umd/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerRuntimePaths.d.ts +19 -0
  657. package/umd/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerSupervisorState.d.ts +37 -0
  658. package/umd/src/cli/cli-commands/agents-server/startAgentsServer/LocalAgentRunnerLimits.d.ts +9 -0
  659. package/umd/src/cli/cli-commands/agents-server/startAgentsServer/PreparedAgentsServerLaunch.d.ts +13 -0
  660. package/umd/src/cli/cli-commands/agents-server/startAgentsServer/StartAgentsServerOptions.d.ts +24 -0
  661. package/umd/src/cli/cli-commands/agents-server/startAgentsServer/createInternalRouteErrorMessage.d.ts +6 -0
  662. package/umd/src/cli/cli-commands/agents-server/startAgentsServer/createLocalAgentRunOptions.d.ts +9 -0
  663. package/umd/src/cli/cli-commands/agents-server/startAgentsServer/forwardChildOutput.d.ts +13 -0
  664. package/umd/src/cli/cli-commands/agents-server/startAgentsServer/loadAgentsServerProjectEnvironment.d.ts +6 -0
  665. package/umd/src/cli/cli-commands/agents-server/startAgentsServer/prepareAgentsServerLaunch.d.ts +18 -0
  666. package/umd/src/cli/cli-commands/agents-server/startAgentsServer/readInternalRouteErrorDetails.d.ts +6 -0
  667. package/umd/src/cli/cli-commands/agents-server/startAgentsServer/resolveAgentsServerChildHostname.d.ts +7 -0
  668. package/umd/src/cli/cli-commands/agents-server/startAgentsServer/startNextServer.d.ts +20 -0
  669. package/umd/src/cli/cli-commands/agents-server/startAgentsServer/startUserChatJobWorkerPump.d.ts +15 -0
  670. package/umd/src/cli/cli-commands/agents-server/startAgentsServer/stopChildProcess.d.ts +8 -0
  671. package/umd/src/cli/cli-commands/agents-server/startAgentsServer/waitForLocalAgentRunnerLimits.d.ts +16 -0
  672. package/umd/src/cli/cli-commands/agents-server/startAgentsServer.d.ts +3 -30
  673. package/umd/src/cli/cli-commands/common/createPositiveIntegerOptionParser.d.ts +10 -0
  674. package/umd/src/cli/cli-commands/common/promptRunnerCliOptions.d.ts +1 -1
  675. package/umd/src/collection/agent-collection/CreateAgentInput.d.ts +1 -1
  676. package/umd/src/collection/agent-collection/constructors/agent-collection-in-supabase/prepareAgentSourceForPersistence.d.ts +1 -1
  677. package/umd/src/commitments/META/META.d.ts +2 -2
  678. package/umd/src/commitments/META_AVATAR/META_AVATAR.d.ts +9 -4
  679. package/umd/src/commitments/index.d.ts +1 -1
  680. package/umd/src/conversion/validation/validatePipeline/createPipelineValidationContext.d.ts +16 -0
  681. package/umd/src/conversion/validation/validatePipeline/validatePipelineCollectionsStructure.d.ts +7 -0
  682. package/umd/src/conversion/validation/validatePipeline/validatePipelineDependencyResolution.d.ts +7 -0
  683. package/umd/src/conversion/validation/validatePipeline/validatePipelineMetadata.d.ts +7 -0
  684. package/umd/src/conversion/validation/validatePipeline/validatePipelineParameters.d.ts +7 -0
  685. package/umd/src/conversion/validation/validatePipeline/validatePipelineTasks.d.ts +7 -0
  686. package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/RegisteredLlmToolsMessageContext.d.ts +46 -0
  687. package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/USED_ENV_FILENAME.d.ts +11 -0
  688. package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolConfigurationStatusMessage.d.ts +7 -0
  689. package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolEntryKey.d.ts +7 -0
  690. package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolInstallationStatusMessage.d.ts +7 -0
  691. package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolStatus.d.ts +14 -0
  692. package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolsMessageContext.d.ts +7 -0
  693. package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/getAvailableRegisteredLlmToolsEnvironmentVariables.d.ts +7 -0
  694. package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/getRegisteredLlmToolRegisters.d.ts +7 -0
  695. package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/hasRegisteredLlmToolEntry.d.ts +7 -0
  696. package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/listRegisteredLlmToolEntries.d.ts +9 -0
  697. package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/listRegisteredLlmToolStatuses.d.ts +7 -0
  698. package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/renderAvailableRegisteredLlmTools.d.ts +7 -0
  699. package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/renderNoRegisteredLlmToolsMessage.d.ts +7 -0
  700. package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/renderRegisteredLlmToolsMessage.d.ts +8 -0
  701. package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/renderRelevantRegisteredLlmToolsEnvironmentVariables.d.ts +7 -0
  702. package/umd/src/utils/agent-message-runtime/agentMessageRuntimePaths.d.ts +24 -0
  703. package/umd/src/utils/agents/resolveAgentAvatarImageUrl.d.ts +2 -2
  704. package/umd/src/utils/ascii-art/$detectTerminalAnsiColorDepth.d.ts +15 -0
  705. package/umd/src/utils/ascii-art/convertImageDataToAsciiArt.d.ts +80 -0
  706. package/umd/src/utils/color/Color.d.ts +1 -1
  707. package/umd/src/version.d.ts +1 -1
  708. package/apps/agents-server/src/utils/userChat/createUserChatRunnerProgressCard.ts +0 -57
  709. package/esm/scripts/run-codex-prompts/common/resolveAgentSystemMessage.d.ts +0 -6
  710. package/umd/scripts/run-codex-prompts/common/resolveAgentSystemMessage.d.ts +0 -6
@@ -1,138 +1,10 @@
1
- import { $getTableName } from '@/src/database/$getTableName';
2
- import { $provideClientSql } from '@/src/database/$provideClientSql';
3
- import { $provideSupabaseForServer } from '@/src/database/$provideSupabaseForServer';
4
1
  import { isAgentsServerSqliteMode } from '@/src/database/agentsServerDatabaseMode';
5
- import type { AgentsServerDatabase } from '@/src/database/schema';
6
- import type { AdminChatTaskCounters, AdminChatTaskRecord, AdminChatTaskView } from '../chatTasksAdmin';
7
- import { provideUserChatJobTable } from '../userChat/provideUserChatJobTable';
8
- import type { UserChatJobStatus } from '../userChat/UserChatJobRecord';
9
- import { provideUserChatTimeoutTable } from '../userChatTimeout/userChatTimeoutStore/provideUserChatTimeoutTable';
2
+ import { getAdminChatTasksViaClientSql } from './getAdminChatTasks/getAdminChatTasksViaClientSql';
3
+ import { getAdminChatTasksViaSupabaseQuery } from './getAdminChatTasks/getAdminChatTasksViaSupabaseQuery';
4
+ import type { GetAdminChatTasksData } from './getAdminChatTasks/GetAdminChatTasksData';
10
5
  import type { ParsedAdminChatTaskQuery } from './parseAdminChatTaskQuery';
11
6
 
12
- /**
13
- * Milliseconds in one hour.
14
- *
15
- * @private internal constant of `getAdminChatTasksResponse`
16
- */
17
- const HOUR_IN_MILLISECONDS = 60 * 60 * 1000;
18
-
19
- /**
20
- * Raw SQL row returned by the paginated admin task query.
21
- *
22
- * @private type of `getAdminChatTasksResponse`
23
- */
24
- type AdminChatTaskSqlRow = {
25
- id: string;
26
- kind: 'CHAT_COMPLETION' | 'CHAT_TIMEOUT';
27
- status: UserChatJobStatus;
28
- createdAt: string;
29
- queuedAt: string;
30
- startedAt: string | null;
31
- updatedAt: string;
32
- finishedAt: string | null;
33
- cancelRequestedAt: string | null;
34
- pausedAt: string | null;
35
- lastHeartbeatAt: string | null;
36
- leaseExpiresAt: string | null;
37
- recurrenceIntervalMs: string | number | null;
38
- attemptCount: number;
39
- lastErrorSummary: string | null;
40
- lastErrorDetails: string | null;
41
- userId: number;
42
- username: string | null;
43
- agentPermanentId: string;
44
- agentName: string | null;
45
- chatId: string;
46
- totalCount: string | number;
47
- };
48
-
49
- /**
50
- * Raw SQL row returned by the task-manager counters query.
51
- *
52
- * @private type of `getAdminChatTasksResponse`
53
- */
54
- type AdminChatTaskCountersSqlRow = {
55
- runningCount: string | number;
56
- queuedCount: string | number;
57
- failedLast24hCount: string | number;
58
- oldestQueuedAgeMs: string | number | null;
59
- };
60
-
61
- /**
62
- * SQLite-backed job row used by the admin task-manager fallback.
63
- *
64
- * @private type of `getAdminChatTasksResponse`
65
- */
66
- type AdminChatTaskJobRow = {
67
- id: string;
68
- createdAt: string;
69
- queuedAt: string;
70
- startedAt: string | null;
71
- updatedAt: string;
72
- completedAt: string | null;
73
- cancelRequestedAt: string | null;
74
- lastHeartbeatAt: string | null;
75
- leaseExpiresAt: string | null;
76
- attemptCount: number;
77
- failureReason: string | null;
78
- failureDetails?: string | null;
79
- userId: number;
80
- agentPermanentId: string;
81
- chatId: string;
82
- status: UserChatJobStatus;
83
- };
84
-
85
- /**
86
- * SQLite-backed timeout row used by the admin task-manager fallback.
87
- *
88
- * @private type of `getAdminChatTasksResponse`
89
- */
90
- type AdminChatTaskTimeoutRow = {
91
- id: string;
92
- createdAt: string;
93
- queuedAt: string;
94
- startedAt: string | null;
95
- updatedAt: string;
96
- completedAt: string | null;
97
- cancelRequestedAt: string | null;
98
- pausedAt: string | null;
99
- leaseExpiresAt: string | null;
100
- recurrenceIntervalMs: number | string | null;
101
- attemptCount: number;
102
- failureReason: string | null;
103
- userId: number;
104
- agentPermanentId: string;
105
- chatId: string;
106
- status: UserChatJobStatus;
107
- };
108
-
109
- /**
110
- * Minimal user lookup row needed by the admin task-manager fallback.
111
- *
112
- * @private type of `getAdminChatTasksResponse`
113
- */
114
- type AdminChatTaskUserLookupRow = Pick<AgentsServerDatabase['public']['Tables']['User']['Row'], 'id' | 'username'>;
115
-
116
- /**
117
- * Minimal agent lookup row needed by the admin task-manager fallback.
118
- *
119
- * @private type of `getAdminChatTasksResponse`
120
- */
121
- type AdminChatTaskAgentLookupRow = Pick<
122
- AgentsServerDatabase['public']['Tables']['Agent']['Row'],
123
- 'permanentId' | 'agentName'
124
- >;
125
-
126
- /**
127
- * Loaded admin chat-task data before the final response envelope is assembled.
128
- *
129
- * @private type of `getAdminChatTasksResponse`
130
- */
131
- export type GetAdminChatTasksData = {
132
- items: Array<AdminChatTaskRecord>;
133
- counters: AdminChatTaskCounters;
134
- total: number;
135
- };
7
+ export type { GetAdminChatTasksData };
136
8
 
137
9
  /**
138
10
  * Loads the admin task-manager data from durable chat job and timeout tables.
@@ -146,818 +18,3 @@ export async function getAdminChatTasks(query: ParsedAdminChatTaskQuery): Promis
146
18
 
147
19
  return getAdminChatTasksViaClientSql(query);
148
20
  }
149
-
150
- /**
151
- * Loads admin task-manager data through the shared Supabase-shaped adapters used by SQLite mode.
152
- *
153
- * @private function of `getAdminChatTasksResponse`
154
- */
155
- async function getAdminChatTasksViaSupabaseQuery(query: ParsedAdminChatTaskQuery): Promise<GetAdminChatTasksData> {
156
- const [jobRows, timeoutRows] = await Promise.all([loadAdminChatTaskJobRows(), loadAdminChatTaskTimeoutRows()]);
157
- const allUserIds = [...new Set([...jobRows, ...timeoutRows].map((task) => task.userId))];
158
- const allAgentPermanentIds = [
159
- ...new Set([...jobRows, ...timeoutRows].map((task) => task.agentPermanentId).filter(Boolean)),
160
- ];
161
- const [usernamesById, agentNamesByPermanentId] = await Promise.all([
162
- loadAdminChatTaskUsernames(allUserIds),
163
- loadAdminChatTaskAgentNames(allAgentPermanentIds),
164
- ]);
165
- const allTasks = [
166
- ...jobRows.map((row) => mapAdminChatTaskJobRow(row, usernamesById, agentNamesByPermanentId)),
167
- ...timeoutRows.map((row) => mapAdminChatTaskTimeoutRow(row, usernamesById, agentNamesByPermanentId)),
168
- ];
169
- const nowTimestamp = Date.now();
170
- const filteredTasks = allTasks
171
- .filter((task) => matchesAdminChatTaskView(task, query, nowTimestamp))
172
- .filter((task) => matchesAdminChatTaskSearch(task, query.search))
173
- .sort((leftTask, rightTask) => compareAdminChatTasks(leftTask, rightTask, query.view));
174
- const pageOffset = (query.page - 1) * query.pageSize;
175
-
176
- return {
177
- items: filteredTasks.slice(pageOffset, pageOffset + query.pageSize),
178
- counters: createAdminChatTaskCounters(allTasks, nowTimestamp),
179
- total: filteredTasks.length,
180
- };
181
- }
182
-
183
- /**
184
- * Loads admin task-manager data through the existing PostgreSQL raw SQL path.
185
- *
186
- * @private function of `getAdminChatTasksResponse`
187
- */
188
- async function getAdminChatTasksViaClientSql(query: ParsedAdminChatTaskQuery): Promise<GetAdminChatTasksData> {
189
- const sql = await $provideClientSql();
190
- const userChatJobTable = quoteIdentifier(await $getTableName('UserChatJob'));
191
- const userChatTimeoutTable = quoteIdentifier(await resolvePrefixedTableName('UserChatTimeout'));
192
- const userTable = quoteIdentifier(await $getTableName('User'));
193
- const agentTable = quoteIdentifier(await $getTableName('Agent'));
194
- const baseTaskQuery = createAdminChatTaskBaseQuery({
195
- userChatJobTable,
196
- userChatTimeoutTable,
197
- userTable,
198
- agentTable,
199
- });
200
- const listQueryParts = createAdminChatTaskListQueryParts(query);
201
- const listRows = await sql.raw<Array<AdminChatTaskSqlRow>>(
202
- `
203
- WITH tasks AS (
204
- ${baseTaskQuery}
205
- )
206
- SELECT
207
- task.*,
208
- COUNT(*) OVER() AS "totalCount"
209
- FROM tasks task
210
- ${listQueryParts.whereClause}
211
- ORDER BY ${createAdminChatTaskOrderBySql(query.view, 'task')}
212
- LIMIT $${listQueryParts.limitPlaceholder}
213
- OFFSET $${listQueryParts.offsetPlaceholder}
214
- `,
215
- listQueryParts.values,
216
- );
217
- const counterRows = await sql.raw<Array<AdminChatTaskCountersSqlRow>>(
218
- `
219
- WITH tasks AS (
220
- ${baseTaskQuery}
221
- )
222
- SELECT
223
- COUNT(*) FILTER (WHERE "status" = 'RUNNING') AS "runningCount",
224
- COUNT(*) FILTER (WHERE "status" = 'QUEUED') AS "queuedCount",
225
- COUNT(*) FILTER (
226
- WHERE "status" = 'FAILED'
227
- AND "finishedAt" >= CURRENT_TIMESTAMP - INTERVAL '24 hours'
228
- ) AS "failedLast24hCount",
229
- CASE
230
- WHEN MIN("queuedAt") FILTER (WHERE "status" = 'QUEUED') IS NULL THEN NULL
231
- ELSE EXTRACT(EPOCH FROM (CURRENT_TIMESTAMP - MIN("queuedAt") FILTER (WHERE "status" = 'QUEUED'))) * 1000
232
- END AS "oldestQueuedAgeMs"
233
- FROM tasks
234
- `,
235
- );
236
-
237
- return {
238
- items: listRows.map(mapAdminChatTaskSqlRow),
239
- counters: mapAdminChatTaskCounters(counterRows[0]),
240
- total: resolveSqlCount(listRows[0]?.totalCount),
241
- };
242
- }
243
-
244
- /**
245
- * Loads lightweight durable chat-job rows for SQLite mode.
246
- *
247
- * @private function of `getAdminChatTasksResponse`
248
- */
249
- async function loadAdminChatTaskJobRows(): Promise<Array<AdminChatTaskJobRow>> {
250
- const userChatJobTable = await provideUserChatJobTable();
251
- const { data, error } = await userChatJobTable.select(
252
- 'id,createdAt,queuedAt,startedAt,updatedAt,completedAt,cancelRequestedAt,lastHeartbeatAt,leaseExpiresAt,attemptCount,failureReason,failureDetails,userId,agentPermanentId,chatId,status',
253
- );
254
-
255
- if (error) {
256
- throw new Error(`Failed to list admin user chat jobs: ${error.message}`);
257
- }
258
-
259
- return (data || []) as unknown as Array<AdminChatTaskJobRow>;
260
- }
261
-
262
- /**
263
- * Loads lightweight durable timeout rows for SQLite mode.
264
- *
265
- * @private function of `getAdminChatTasksResponse`
266
- */
267
- async function loadAdminChatTaskTimeoutRows(): Promise<Array<AdminChatTaskTimeoutRow>> {
268
- const userChatTimeoutTable = await provideUserChatTimeoutTable();
269
- const { data, error } = await userChatTimeoutTable.select(
270
- 'id,createdAt,queuedAt,startedAt,updatedAt,completedAt,cancelRequestedAt,pausedAt,leaseExpiresAt,recurrenceIntervalMs,attemptCount,failureReason,userId,agentPermanentId,chatId,status',
271
- );
272
-
273
- if (error) {
274
- throw new Error(`Failed to list admin user chat timeouts: ${error.message}`);
275
- }
276
-
277
- return (data || []) as unknown as Array<AdminChatTaskTimeoutRow>;
278
- }
279
-
280
- /**
281
- * Loads usernames keyed by user id for admin task rendering and search.
282
- *
283
- * @private function of `getAdminChatTasksResponse`
284
- */
285
- async function loadAdminChatTaskUsernames(userIds: ReadonlyArray<number>): Promise<Map<number, string>> {
286
- if (userIds.length === 0) {
287
- return new Map();
288
- }
289
-
290
- const supabase = $provideSupabaseForServer();
291
- const userTable = await $getTableName('User');
292
- const { data, error } = await supabase.from(userTable).select('id,username').in('id', [...new Set(userIds)]);
293
-
294
- if (error) {
295
- throw new Error(`Failed to load admin task-manager users: ${error.message}`);
296
- }
297
-
298
- return new Map(
299
- ((data || []) as Array<AdminChatTaskUserLookupRow>).map((userRow) => [userRow.id, userRow.username] as const),
300
- );
301
- }
302
-
303
- /**
304
- * Loads agent names keyed by permanent id for admin task rendering and search.
305
- *
306
- * @private function of `getAdminChatTasksResponse`
307
- */
308
- async function loadAdminChatTaskAgentNames(
309
- agentPermanentIds: ReadonlyArray<string>,
310
- ): Promise<Map<string, string | null>> {
311
- if (agentPermanentIds.length === 0) {
312
- return new Map();
313
- }
314
-
315
- const supabase = $provideSupabaseForServer();
316
- const agentTable = await $getTableName('Agent');
317
- const { data, error } = await supabase
318
- .from(agentTable)
319
- .select('permanentId,agentName')
320
- .in('permanentId', [...new Set(agentPermanentIds)]);
321
-
322
- if (error) {
323
- throw new Error(`Failed to load admin task-manager agents: ${error.message}`);
324
- }
325
-
326
- return new Map(
327
- ((data || []) as Array<AdminChatTaskAgentLookupRow>)
328
- .filter((agentRow): agentRow is AdminChatTaskAgentLookupRow & { permanentId: string } => Boolean(agentRow.permanentId))
329
- .map((agentRow) => [agentRow.permanentId, agentRow.agentName] as const),
330
- );
331
- }
332
-
333
- /**
334
- * Maps one SQLite-backed chat job into the public admin task row shape.
335
- *
336
- * @private function of `getAdminChatTasksResponse`
337
- */
338
- function mapAdminChatTaskJobRow(
339
- row: AdminChatTaskJobRow,
340
- usernamesById: ReadonlyMap<number, string>,
341
- agentNamesByPermanentId: ReadonlyMap<string, string | null>,
342
- ): AdminChatTaskRecord {
343
- return {
344
- id: row.id,
345
- kind: 'CHAT_COMPLETION',
346
- status: row.status,
347
- createdAt: row.createdAt,
348
- queuedAt: row.queuedAt,
349
- startedAt: row.startedAt,
350
- updatedAt: row.updatedAt,
351
- finishedAt: row.completedAt,
352
- cancelRequestedAt: row.cancelRequestedAt,
353
- pausedAt: null,
354
- lastHeartbeatAt: row.lastHeartbeatAt,
355
- leaseExpiresAt: row.leaseExpiresAt,
356
- recurrenceIntervalMs: null,
357
- priority: null,
358
- attemptCount: row.attemptCount,
359
- retryCount: Math.max(0, row.attemptCount - 1),
360
- lastErrorSummary: row.failureReason,
361
- lastErrorDetails: row.failureDetails ?? null,
362
- userId: row.userId,
363
- username: usernamesById.get(row.userId) ?? null,
364
- agentPermanentId: row.agentPermanentId,
365
- agentName: agentNamesByPermanentId.get(row.agentPermanentId) ?? null,
366
- chatId: row.chatId,
367
- workerId: null,
368
- queueName: 'user-chat-jobs',
369
- };
370
- }
371
-
372
- /**
373
- * Maps one SQLite-backed timeout into the public admin task row shape.
374
- *
375
- * @private function of `getAdminChatTasksResponse`
376
- */
377
- function mapAdminChatTaskTimeoutRow(
378
- row: AdminChatTaskTimeoutRow,
379
- usernamesById: ReadonlyMap<number, string>,
380
- agentNamesByPermanentId: ReadonlyMap<string, string | null>,
381
- ): AdminChatTaskRecord {
382
- return {
383
- id: row.id,
384
- kind: 'CHAT_TIMEOUT',
385
- status: row.status,
386
- createdAt: row.createdAt,
387
- queuedAt: row.queuedAt,
388
- startedAt: row.startedAt,
389
- updatedAt: row.updatedAt,
390
- finishedAt: row.completedAt,
391
- cancelRequestedAt: row.cancelRequestedAt,
392
- pausedAt: row.pausedAt,
393
- lastHeartbeatAt: null,
394
- leaseExpiresAt: row.leaseExpiresAt,
395
- recurrenceIntervalMs: resolveNullableSqlNumber(row.recurrenceIntervalMs),
396
- priority: null,
397
- attemptCount: row.attemptCount,
398
- retryCount: Math.max(0, row.attemptCount - 1),
399
- lastErrorSummary: row.failureReason,
400
- lastErrorDetails: null,
401
- userId: row.userId,
402
- username: usernamesById.get(row.userId) ?? null,
403
- agentPermanentId: row.agentPermanentId,
404
- agentName: agentNamesByPermanentId.get(row.agentPermanentId) ?? null,
405
- chatId: row.chatId,
406
- workerId: null,
407
- queueName: 'user-chat-timeouts',
408
- };
409
- }
410
-
411
- /**
412
- * Returns whether one task belongs in the requested admin task-manager view.
413
- *
414
- * @private function of `getAdminChatTasksResponse`
415
- */
416
- function matchesAdminChatTaskView(
417
- task: AdminChatTaskRecord,
418
- query: ParsedAdminChatTaskQuery,
419
- nowTimestamp: number,
420
- ): boolean {
421
- switch (query.view) {
422
- case 'running':
423
- return task.status === 'RUNNING';
424
- case 'queued':
425
- return task.status === 'QUEUED';
426
- case 'failed':
427
- return (
428
- task.status === 'FAILED' &&
429
- isIsoTimestampAtOrAfter(task.finishedAt, nowTimestamp - 24 * HOUR_IN_MILLISECONDS)
430
- );
431
- case 'all':
432
- return isIsoTimestampAtOrAfter(task.updatedAt, nowTimestamp - query.timeWindowHours * HOUR_IN_MILLISECONDS);
433
- case 'active':
434
- default:
435
- return task.status === 'QUEUED' || task.status === 'RUNNING';
436
- }
437
- }
438
-
439
- /**
440
- * Returns whether one task matches the free-text admin search input.
441
- *
442
- * @private function of `getAdminChatTasksResponse`
443
- */
444
- function matchesAdminChatTaskSearch(task: AdminChatTaskRecord, search: string): boolean {
445
- if (!search) {
446
- return true;
447
- }
448
-
449
- if (
450
- task.id === search ||
451
- task.id.startsWith(search) ||
452
- task.chatId === search ||
453
- task.chatId.startsWith(search) ||
454
- task.agentPermanentId === search ||
455
- task.agentPermanentId.startsWith(search)
456
- ) {
457
- return true;
458
- }
459
-
460
- const normalizedSearch = search.toLowerCase();
461
- if ((task.agentName || '').toLowerCase().includes(normalizedSearch)) {
462
- return true;
463
- }
464
- if ((task.username || '').toLowerCase().includes(normalizedSearch)) {
465
- return true;
466
- }
467
-
468
- return /^\d+$/.test(search) && task.userId === Number.parseInt(search, 10);
469
- }
470
-
471
- /**
472
- * Calculates the summary counters rendered above the admin task table.
473
- *
474
- * @private function of `getAdminChatTasksResponse`
475
- */
476
- function createAdminChatTaskCounters(
477
- tasks: ReadonlyArray<AdminChatTaskRecord>,
478
- nowTimestamp: number,
479
- ): AdminChatTaskCounters {
480
- const queuedTimestamps = tasks
481
- .filter((task) => task.status === 'QUEUED')
482
- .map((task) => parseIsoTimestamp(task.queuedAt))
483
- .filter((timestamp): timestamp is number => timestamp !== null);
484
- const oldestQueuedTimestamp =
485
- queuedTimestamps.length > 0 ? Math.min(...queuedTimestamps) : null;
486
-
487
- return {
488
- runningCount: tasks.filter((task) => task.status === 'RUNNING').length,
489
- queuedCount: tasks.filter((task) => task.status === 'QUEUED').length,
490
- failedLast24hCount: tasks.filter(
491
- (task) =>
492
- task.status === 'FAILED' &&
493
- isIsoTimestampAtOrAfter(task.finishedAt, nowTimestamp - 24 * HOUR_IN_MILLISECONDS),
494
- ).length,
495
- oldestQueuedAgeMs: oldestQueuedTimestamp === null ? null : Math.max(0, nowTimestamp - oldestQueuedTimestamp),
496
- };
497
- }
498
-
499
- /**
500
- * Compares two tasks using the same ordering semantics as the PostgreSQL dashboard query.
501
- *
502
- * @private function of `getAdminChatTasksResponse`
503
- */
504
- function compareAdminChatTasks(
505
- leftTask: AdminChatTaskRecord,
506
- rightTask: AdminChatTaskRecord,
507
- view: AdminChatTaskView,
508
- ): number {
509
- switch (view) {
510
- case 'running':
511
- return (
512
- compareNullableIsoTimestampsDescending(leftTask.startedAt, rightTask.startedAt) ||
513
- compareIsoTimestampsDescending(leftTask.createdAt, rightTask.createdAt) ||
514
- compareStringsDescending(leftTask.id, rightTask.id)
515
- );
516
- case 'queued':
517
- return (
518
- compareIsoTimestampsDescending(leftTask.createdAt, rightTask.createdAt) ||
519
- compareStringsDescending(leftTask.id, rightTask.id)
520
- );
521
- case 'failed':
522
- return (
523
- compareNullableIsoTimestampsDescending(leftTask.finishedAt, rightTask.finishedAt) ||
524
- compareIsoTimestampsDescending(leftTask.updatedAt, rightTask.updatedAt) ||
525
- compareStringsDescending(leftTask.id, rightTask.id)
526
- );
527
- case 'all':
528
- return (
529
- compareIsoTimestampsDescending(leftTask.updatedAt, rightTask.updatedAt) ||
530
- compareIsoTimestampsDescending(leftTask.createdAt, rightTask.createdAt) ||
531
- compareStringsDescending(leftTask.id, rightTask.id)
532
- );
533
- case 'active':
534
- default:
535
- return (
536
- compareNumbersAscending(
537
- resolveAdminChatTaskActiveStatusRank(leftTask.status),
538
- resolveAdminChatTaskActiveStatusRank(rightTask.status),
539
- ) ||
540
- compareNullableIsoTimestampsDescending(
541
- leftTask.status === 'RUNNING' ? leftTask.startedAt : null,
542
- rightTask.status === 'RUNNING' ? rightTask.startedAt : null,
543
- ) ||
544
- compareNullableIsoTimestampsDescending(
545
- leftTask.status === 'QUEUED' ? leftTask.createdAt : null,
546
- rightTask.status === 'QUEUED' ? rightTask.createdAt : null,
547
- ) ||
548
- compareIsoTimestampsDescending(leftTask.updatedAt, rightTask.updatedAt) ||
549
- compareStringsDescending(leftTask.id, rightTask.id)
550
- );
551
- }
552
- }
553
-
554
- /**
555
- * Resolves the status sort bucket used by the `Active` dashboard view.
556
- *
557
- * @private function of `getAdminChatTasksResponse`
558
- */
559
- function resolveAdminChatTaskActiveStatusRank(status: UserChatJobStatus): number {
560
- switch (status) {
561
- case 'RUNNING':
562
- return 0;
563
- case 'QUEUED':
564
- return 1;
565
- default:
566
- return 2;
567
- }
568
- }
569
-
570
- /**
571
- * Returns whether one ISO timestamp is at or after the given cutoff.
572
- *
573
- * @private function of `getAdminChatTasksResponse`
574
- */
575
- function isIsoTimestampAtOrAfter(timestampIso: string | null, cutoffTimestamp: number): boolean {
576
- const timestamp = parseIsoTimestamp(timestampIso);
577
- return timestamp !== null && timestamp >= cutoffTimestamp;
578
- }
579
-
580
- /**
581
- * Parses one ISO timestamp into milliseconds since epoch.
582
- *
583
- * @private function of `getAdminChatTasksResponse`
584
- */
585
- function parseIsoTimestamp(timestampIso: string | null): number | null {
586
- if (!timestampIso) {
587
- return null;
588
- }
589
-
590
- const timestamp = Date.parse(timestampIso);
591
- return Number.isFinite(timestamp) ? timestamp : null;
592
- }
593
-
594
- /**
595
- * Sorts timestamps descending while keeping `null` values last.
596
- *
597
- * @private function of `getAdminChatTasksResponse`
598
- */
599
- function compareNullableIsoTimestampsDescending(leftTimestampIso: string | null, rightTimestampIso: string | null): number {
600
- const leftTimestamp = parseIsoTimestamp(leftTimestampIso);
601
- const rightTimestamp = parseIsoTimestamp(rightTimestampIso);
602
-
603
- if (leftTimestamp === rightTimestamp) {
604
- return 0;
605
- }
606
- if (leftTimestamp === null) {
607
- return 1;
608
- }
609
- if (rightTimestamp === null) {
610
- return -1;
611
- }
612
-
613
- return compareNumbersDescending(leftTimestamp, rightTimestamp);
614
- }
615
-
616
- /**
617
- * Sorts required timestamps descending.
618
- *
619
- * @private function of `getAdminChatTasksResponse`
620
- */
621
- function compareIsoTimestampsDescending(leftTimestampIso: string, rightTimestampIso: string): number {
622
- return compareNullableIsoTimestampsDescending(leftTimestampIso, rightTimestampIso);
623
- }
624
-
625
- /**
626
- * Sorts numbers ascending.
627
- *
628
- * @private function of `getAdminChatTasksResponse`
629
- */
630
- function compareNumbersAscending(leftNumber: number, rightNumber: number): number {
631
- return leftNumber - rightNumber;
632
- }
633
-
634
- /**
635
- * Sorts numbers descending.
636
- *
637
- * @private function of `getAdminChatTasksResponse`
638
- */
639
- function compareNumbersDescending(leftNumber: number, rightNumber: number): number {
640
- return rightNumber - leftNumber;
641
- }
642
-
643
- /**
644
- * Sorts strings descending.
645
- *
646
- * @private function of `getAdminChatTasksResponse`
647
- */
648
- function compareStringsDescending(leftString: string, rightString: string): number {
649
- return leftString === rightString ? 0 : leftString < rightString ? 1 : -1;
650
- }
651
-
652
- /**
653
- * Creates the `WHERE` clause and parameter list for the paginated admin task query.
654
- *
655
- * @private function of `getAdminChatTasksResponse`
656
- */
657
- function createAdminChatTaskListQueryParts(query: ParsedAdminChatTaskQuery): {
658
- whereClause: string;
659
- values: Array<string | number>;
660
- limitPlaceholder: number;
661
- offsetPlaceholder: number;
662
- } {
663
- const values: Array<string | number> = [];
664
- const whereParts: Array<string> = [];
665
-
666
- appendAdminChatTaskViewClause(query, values, whereParts, 'task');
667
- appendAdminChatTaskSearchClause(query.search, values, whereParts, 'task');
668
-
669
- values.push(query.pageSize);
670
- values.push((query.page - 1) * query.pageSize);
671
-
672
- return {
673
- whereClause: whereParts.length > 0 ? `WHERE ${whereParts.join(' AND ')}` : '',
674
- values,
675
- limitPlaceholder: values.length - 1,
676
- offsetPlaceholder: values.length,
677
- };
678
- }
679
-
680
- /**
681
- * Appends the status/time-window filter for one dashboard view.
682
- *
683
- * @private function of `getAdminChatTasksResponse`
684
- */
685
- function appendAdminChatTaskViewClause(
686
- query: ParsedAdminChatTaskQuery,
687
- values: Array<string | number>,
688
- whereParts: Array<string>,
689
- alias: string,
690
- ): void {
691
- switch (query.view) {
692
- case 'running':
693
- whereParts.push(`${alias}."status" = 'RUNNING'`);
694
- return;
695
- case 'queued':
696
- whereParts.push(`${alias}."status" = 'QUEUED'`);
697
- return;
698
- case 'failed':
699
- whereParts.push(`${alias}."status" = 'FAILED'`);
700
- whereParts.push(`${alias}."finishedAt" >= CURRENT_TIMESTAMP - INTERVAL '24 hours'`);
701
- return;
702
- case 'all':
703
- values.push(query.timeWindowHours);
704
- whereParts.push(`${alias}."updatedAt" >= CURRENT_TIMESTAMP - ($${values.length} * INTERVAL '1 hour')`);
705
- return;
706
- case 'active':
707
- default:
708
- whereParts.push(`${alias}."status" IN ('QUEUED', 'RUNNING')`);
709
- }
710
- }
711
-
712
- /**
713
- * Appends the free-text search clause used by the dashboard.
714
- *
715
- * @private function of `getAdminChatTasksResponse`
716
- */
717
- function appendAdminChatTaskSearchClause(
718
- search: string,
719
- values: Array<string | number>,
720
- whereParts: Array<string>,
721
- alias: string,
722
- ): void {
723
- if (!search) {
724
- return;
725
- }
726
-
727
- values.push(search);
728
- const exactPlaceholder = values.length;
729
-
730
- values.push(`${search}%`);
731
- const prefixPlaceholder = values.length;
732
-
733
- values.push(`%${search}%`);
734
- const containsPlaceholder = values.length;
735
-
736
- const searchParts = [
737
- `${alias}."id" = $${exactPlaceholder}`,
738
- `${alias}."id" LIKE $${prefixPlaceholder}`,
739
- `${alias}."chatId" = $${exactPlaceholder}`,
740
- `${alias}."chatId" LIKE $${prefixPlaceholder}`,
741
- `${alias}."agentPermanentId" = $${exactPlaceholder}`,
742
- `${alias}."agentPermanentId" LIKE $${prefixPlaceholder}`,
743
- `COALESCE(${alias}."agentName", '') ILIKE $${containsPlaceholder}`,
744
- `COALESCE(${alias}."username", '') ILIKE $${containsPlaceholder}`,
745
- ];
746
-
747
- if (/^\d+$/.test(search)) {
748
- values.push(Number.parseInt(search, 10));
749
- searchParts.push(`${alias}."userId" = $${values.length}`);
750
- }
751
-
752
- whereParts.push(`(${searchParts.join(' OR ')})`);
753
- }
754
-
755
- /**
756
- * Resolves the stable sort order used by each dashboard view.
757
- *
758
- * @private function of `getAdminChatTasksResponse`
759
- */
760
- function createAdminChatTaskOrderBySql(view: AdminChatTaskView, alias: string): string {
761
- switch (view) {
762
- case 'running':
763
- return `${alias}."startedAt" DESC NULLS LAST, ${alias}."createdAt" DESC, ${alias}."id" DESC`;
764
- case 'queued':
765
- return `${alias}."createdAt" DESC, ${alias}."id" DESC`;
766
- case 'failed':
767
- return `${alias}."finishedAt" DESC NULLS LAST, ${alias}."updatedAt" DESC, ${alias}."id" DESC`;
768
- case 'all':
769
- return `${alias}."updatedAt" DESC, ${alias}."createdAt" DESC, ${alias}."id" DESC`;
770
- case 'active':
771
- default:
772
- return `
773
- CASE
774
- WHEN ${alias}."status" = 'RUNNING' THEN 0
775
- WHEN ${alias}."status" = 'QUEUED' THEN 1
776
- ELSE 2
777
- END ASC,
778
- CASE
779
- WHEN ${alias}."status" = 'RUNNING' THEN ${alias}."startedAt"
780
- ELSE NULL
781
- END DESC NULLS LAST,
782
- CASE
783
- WHEN ${alias}."status" = 'QUEUED' THEN ${alias}."createdAt"
784
- ELSE NULL
785
- END DESC NULLS LAST,
786
- ${alias}."updatedAt" DESC,
787
- ${alias}."id" DESC
788
- `;
789
- }
790
- }
791
-
792
- /**
793
- * Maps one SQL row into the public admin task-manager row shape.
794
- *
795
- * @private function of `getAdminChatTasksResponse`
796
- */
797
- function mapAdminChatTaskSqlRow(row: AdminChatTaskSqlRow): AdminChatTaskRecord {
798
- return {
799
- id: row.id,
800
- kind: row.kind,
801
- status: row.status,
802
- createdAt: row.createdAt,
803
- queuedAt: row.queuedAt,
804
- startedAt: row.startedAt,
805
- updatedAt: row.updatedAt,
806
- finishedAt: row.finishedAt,
807
- cancelRequestedAt: row.cancelRequestedAt,
808
- pausedAt: row.pausedAt,
809
- lastHeartbeatAt: row.lastHeartbeatAt,
810
- leaseExpiresAt: row.leaseExpiresAt,
811
- recurrenceIntervalMs: resolveNullableSqlNumber(row.recurrenceIntervalMs),
812
- priority: null,
813
- attemptCount: row.attemptCount,
814
- retryCount: Math.max(0, row.attemptCount - 1),
815
- lastErrorSummary: row.lastErrorSummary,
816
- lastErrorDetails: row.lastErrorDetails,
817
- userId: row.userId,
818
- username: row.username,
819
- agentPermanentId: row.agentPermanentId,
820
- agentName: row.agentName,
821
- chatId: row.chatId,
822
- workerId: null,
823
- queueName: row.kind === 'CHAT_TIMEOUT' ? 'user-chat-timeouts' : 'user-chat-jobs',
824
- };
825
- }
826
-
827
- /**
828
- * Maps the aggregate counters SQL row into the API response shape.
829
- *
830
- * @private function of `getAdminChatTasksResponse`
831
- */
832
- function mapAdminChatTaskCounters(row: AdminChatTaskCountersSqlRow | undefined): AdminChatTaskCounters {
833
- return {
834
- runningCount: resolveSqlCount(row?.runningCount),
835
- queuedCount: resolveSqlCount(row?.queuedCount),
836
- failedLast24hCount: resolveSqlCount(row?.failedLast24hCount),
837
- oldestQueuedAgeMs: resolveNullableSqlNumber(row?.oldestQueuedAgeMs),
838
- };
839
- }
840
-
841
- /**
842
- * Converts PostgreSQL count-like values into safe JavaScript numbers.
843
- *
844
- * @private function of `getAdminChatTasksResponse`
845
- */
846
- function resolveSqlCount(value: string | number | undefined): number {
847
- if (typeof value === 'number') {
848
- return value;
849
- }
850
-
851
- if (typeof value === 'string') {
852
- const parsed = Number.parseInt(value, 10);
853
- return Number.isFinite(parsed) ? parsed : 0;
854
- }
855
-
856
- return 0;
857
- }
858
-
859
- /**
860
- * Converts nullable numeric SQL values into safe JavaScript numbers.
861
- *
862
- * @private function of `getAdminChatTasksResponse`
863
- */
864
- function resolveNullableSqlNumber(value: string | number | null | undefined): number | null {
865
- if (value === null || value === undefined) {
866
- return null;
867
- }
868
-
869
- if (typeof value === 'number') {
870
- return value;
871
- }
872
-
873
- const parsed = Number.parseFloat(value);
874
- return Number.isFinite(parsed) ? parsed : null;
875
- }
876
-
877
- /**
878
- * Quotes one trusted internal table identifier for raw SQL usage.
879
- *
880
- * @private function of `getAdminChatTasksResponse`
881
- */
882
- function quoteIdentifier(identifier: string): string {
883
- return `"${identifier.replace(/"/g, '""')}"`;
884
- }
885
-
886
- /**
887
- * Builds the shared union query that surfaces durable chat jobs and timeouts as one admin task stream.
888
- *
889
- * @private function of `getAdminChatTasksResponse`
890
- */
891
- function createAdminChatTaskBaseQuery(options: {
892
- userChatJobTable: string;
893
- userChatTimeoutTable: string;
894
- userTable: string;
895
- agentTable: string;
896
- }): string {
897
- return `
898
- SELECT
899
- job."id" AS "id",
900
- 'CHAT_COMPLETION'::text AS "kind",
901
- job."status" AS "status",
902
- job."createdAt" AS "createdAt",
903
- job."queuedAt" AS "queuedAt",
904
- job."startedAt" AS "startedAt",
905
- job."updatedAt" AS "updatedAt",
906
- job."completedAt" AS "finishedAt",
907
- job."cancelRequestedAt" AS "cancelRequestedAt",
908
- NULL::TIMESTAMP WITH TIME ZONE AS "pausedAt",
909
- job."lastHeartbeatAt" AS "lastHeartbeatAt",
910
- job."leaseExpiresAt" AS "leaseExpiresAt",
911
- NULL::BIGINT AS "recurrenceIntervalMs",
912
- job."attemptCount" AS "attemptCount",
913
- job."failureReason" AS "lastErrorSummary",
914
- job."failureDetails" AS "lastErrorDetails",
915
- job."userId" AS "userId",
916
- "user"."username" AS "username",
917
- job."agentPermanentId" AS "agentPermanentId",
918
- agent."agentName" AS "agentName",
919
- job."chatId" AS "chatId"
920
- FROM ${options.userChatJobTable} job
921
- LEFT JOIN ${options.userTable} "user" ON "user"."id" = job."userId"
922
- LEFT JOIN ${options.agentTable} agent ON agent."permanentId" = job."agentPermanentId"
923
-
924
- UNION ALL
925
-
926
- SELECT
927
- timeout."id" AS "id",
928
- 'CHAT_TIMEOUT'::text AS "kind",
929
- timeout."status" AS "status",
930
- timeout."createdAt" AS "createdAt",
931
- timeout."queuedAt" AS "queuedAt",
932
- timeout."startedAt" AS "startedAt",
933
- timeout."updatedAt" AS "updatedAt",
934
- timeout."completedAt" AS "finishedAt",
935
- timeout."cancelRequestedAt" AS "cancelRequestedAt",
936
- timeout."pausedAt" AS "pausedAt",
937
- NULL::TIMESTAMP WITH TIME ZONE AS "lastHeartbeatAt",
938
- timeout."leaseExpiresAt" AS "leaseExpiresAt",
939
- timeout."recurrenceIntervalMs" AS "recurrenceIntervalMs",
940
- timeout."attemptCount" AS "attemptCount",
941
- timeout."failureReason" AS "lastErrorSummary",
942
- NULL::TEXT AS "lastErrorDetails",
943
- timeout."userId" AS "userId",
944
- "user"."username" AS "username",
945
- timeout."agentPermanentId" AS "agentPermanentId",
946
- agent."agentName" AS "agentName",
947
- timeout."chatId" AS "chatId"
948
- FROM ${options.userChatTimeoutTable} timeout
949
- LEFT JOIN ${options.userTable} "user" ON "user"."id" = timeout."userId"
950
- LEFT JOIN ${options.agentTable} agent ON agent."permanentId" = timeout."agentPermanentId"
951
- `;
952
- }
953
-
954
- /**
955
- * Resolves one prefixed table name using the runtime-configured Supabase prefix.
956
- *
957
- * @private function of `getAdminChatTasksResponse`
958
- */
959
- async function resolvePrefixedTableName(tableName: string): Promise<string> {
960
- const prefixedUserTable = await $getTableName('User');
961
- const tablePrefix = prefixedUserTable.slice(0, prefixedUserTable.length - 'User'.length);
962
- return `${tablePrefix}${tableName}`;
963
- }