@promptbook/cli 0.114.0-5 → 0.114.0-7

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 (296) hide show
  1. package/agents/default/developer.book +1 -0
  2. package/apps/agents-server/next.config.ts +22 -0
  3. package/apps/agents-server/package.json +6 -6
  4. package/apps/agents-server/scripts/build-agents-server.js +43 -7
  5. package/apps/agents-server/scripts/build-e2e.js +12 -2
  6. package/apps/agents-server/scripts/generate-reserved-paths/generate-reserved-paths.ts +30 -16
  7. package/apps/agents-server/scripts/kill-port.js +163 -0
  8. package/apps/agents-server/scripts/run-e2e-tests.js +21 -8
  9. package/apps/agents-server/scripts/run-npm.js +81 -5
  10. package/apps/agents-server/src/app/actions.ts +3 -0
  11. package/apps/agents-server/src/app/admin/email-server/page.tsx +17 -18
  12. package/apps/agents-server/src/app/admin/task-manager/TaskManagerTaskRow.tsx +2 -0
  13. package/apps/agents-server/src/app/admin/task-manager/[taskId]/TaskManagerTaskDetailClient.tsx +2 -0
  14. package/apps/agents-server/src/app/admin/task-manager/taskManagerTaskPresentation.tsx +23 -0
  15. package/apps/agents-server/src/app/agents/[agentName]/api/book/route.ts +7 -0
  16. package/apps/agents-server/src/app/agents/[agentName]/api/timeouts/[timeoutId]/route.ts +10 -153
  17. package/apps/agents-server/src/app/agents/[agentName]/api/timeouts/route.ts +9 -4
  18. package/apps/agents-server/src/app/agents/[agentName]/api/user-chats/[chatId]/route.ts +3 -0
  19. package/apps/agents-server/src/app/agents/[agentName]/api/user-chats/[chatId]/stream/route.ts +2 -0
  20. package/apps/agents-server/src/app/agents/[agentName]/api/user-chats/resolveUserChatScope.ts +8 -1
  21. package/apps/agents-server/src/app/agents/[agentName]/api/user-chats/route.ts +15 -7
  22. package/apps/agents-server/src/app/agents/[agentName]/book/useBookEditorSaving.ts +18 -28
  23. package/apps/agents-server/src/app/agents/[agentName]/chat/AgentChatHistoryClient.tsx +19 -1
  24. package/apps/agents-server/src/app/agents/[agentName]/chat/AgentChatSidebarDefault.tsx +17 -5
  25. package/apps/agents-server/src/app/agents/[agentName]/chat/AgentGoalChatNotice.tsx +23 -0
  26. package/apps/agents-server/src/app/agents/[agentName]/chat/AgentGoalChatPlannedMessages.tsx +153 -0
  27. package/apps/agents-server/src/app/agents/[agentName]/chat/CanonicalAgentChatPanel.tsx +6 -0
  28. package/apps/agents-server/src/app/agents/[agentName]/chat/CanonicalAgentChatSurface.tsx +13 -0
  29. package/apps/agents-server/src/app/agents/[agentName]/chat/ExternalUserChatAdminActions.tsx +51 -3
  30. package/apps/agents-server/src/app/agents/[agentName]/chat/TeamMemberFrozenChatPrimaryAgentLink.tsx +31 -0
  31. package/apps/agents-server/src/app/agents/[agentName]/chat/useAgentChatSidebarState.ts +26 -2
  32. package/apps/agents-server/src/app/agents/[agentName]/goal/page.tsx +35 -0
  33. package/apps/agents-server/src/app/agents/[agentName]/projects/[projectName]/page.tsx +2 -2
  34. package/apps/agents-server/src/app/api/admin/dns-records/cloudflare/route.ts +26 -16
  35. package/apps/agents-server/src/app/api/emails/incoming/stalwart/route.ts +9 -2
  36. package/apps/agents-server/src/app/superadmin/servers/ServersRegistryTable.tsx +31 -39
  37. package/apps/agents-server/src/components/AgentProfile/AgentProfile.tsx +10 -3
  38. package/apps/agents-server/src/components/AgentProjects/AgentProjectIcon.tsx +137 -0
  39. package/apps/agents-server/src/components/AgentProjects/AgentProjectItem.tsx +26 -10
  40. package/apps/agents-server/src/components/CloudflareDnsWizard/CloudflareDnsApiTokenImportStep.tsx +5 -6
  41. package/apps/agents-server/src/components/CloudflareDnsWizard/CloudflareDnsCheckStep.tsx +6 -5
  42. package/apps/agents-server/src/components/CloudflareDnsWizard/CloudflareDnsManualStep.tsx +10 -14
  43. package/apps/agents-server/src/components/CloudflareDnsWizard/CloudflareDnsWizard.tsx +11 -20
  44. package/apps/agents-server/src/components/CloudflareDnsWizard/useCloudflareDnsRecordImport.ts +5 -6
  45. package/apps/agents-server/src/components/DnsRecordsInstructions/DnsRecordsInstructions.tsx +91 -57
  46. package/apps/agents-server/src/components/DnsRecordsInstructions/DnsRecordsSectionPanel.tsx +63 -0
  47. package/apps/agents-server/src/components/DnsRecordsInstructions/DnsRecordsSectionVariantTabs.tsx +67 -0
  48. package/apps/agents-server/src/components/DnsRecordsInstructions/DnsRecordsTable.tsx +40 -0
  49. package/apps/agents-server/src/components/Header/buildActiveAgentViewItems.ts +5 -4
  50. package/apps/agents-server/src/components/Header/createAgentViewLabel.tsx +4 -4
  51. package/apps/agents-server/src/components/Header/resolveActiveAgentNavigation.ts +2 -2
  52. package/apps/agents-server/src/components/Homepage/useAgentsListImportExportState.ts +22 -10
  53. package/apps/agents-server/src/components/_utils/generateMetaTxt.ts +1 -1
  54. package/apps/agents-server/src/database/migratePrefix.ts +13 -12
  55. package/apps/agents-server/src/database/migrations/2026-08-0100-agent-goal-chat-source.sql +10 -0
  56. package/apps/agents-server/src/generated/reservedPaths.ts +42 -42
  57. package/apps/agents-server/src/languages/ServerTranslationKeys.ts +9 -1
  58. package/apps/agents-server/src/languages/translations/czech.yaml +9 -1
  59. package/apps/agents-server/src/languages/translations/english.yaml +9 -1
  60. package/apps/agents-server/src/message-providers/email/stalwart/parseInboundStalwartEmail.ts +17 -2
  61. package/apps/agents-server/src/utils/agentGoalChat/agentGoalChatConstants.ts +9 -0
  62. package/apps/agents-server/src/utils/agentGoalChat/agentGoalChatIdentity.ts +28 -0
  63. package/apps/agents-server/src/utils/agentGoalChat/appendAgentGoalChatNote.ts +43 -0
  64. package/apps/agents-server/src/utils/agentGoalChat/canAccessAgentGoalChat.ts +14 -0
  65. package/apps/agents-server/src/utils/agentGoalChat/createAgentGoalChatNoteContent.ts +69 -0
  66. package/apps/agents-server/src/utils/agentGoalChat/ensureAgentGoalChat.ts +66 -0
  67. package/apps/agents-server/src/utils/agentGoalChat/prependAgentGoalChatSummarySeed.ts +40 -0
  68. package/apps/agents-server/src/utils/agentGoalChat/recordAgentGoalChatLifecycleNote.ts +36 -0
  69. package/apps/agents-server/src/utils/agentGoalChat/resolveAgentGoalChatOwnerUserId.ts +104 -0
  70. package/apps/agents-server/src/utils/agentGoalChat/scheduleAgentGoalChatModifiedNote.ts +82 -0
  71. package/apps/agents-server/src/utils/agentGoalChat.ts +19 -0
  72. package/apps/agents-server/src/utils/agentProjects/AgentProjectInfo.ts +10 -1
  73. package/apps/agents-server/src/utils/agentProjects/AgentProjectReferenceInfo.ts +5 -2
  74. package/apps/agents-server/src/utils/agentProjects/agentProjectFileNames.ts +21 -0
  75. package/apps/agents-server/src/utils/agentProjects/agentProjectHrefs.ts +20 -11
  76. package/apps/agents-server/src/utils/agentProjects/agentProjectsPaths.ts +15 -5
  77. package/apps/agents-server/src/utils/agentProjects/createAgentProjectInitials.ts +36 -0
  78. package/apps/agents-server/src/utils/agentProjects/createAgentProjectMarkdownReferences.ts +11 -9
  79. package/apps/agents-server/src/utils/agentProjects/createAgentProjectsDnsRecordsSection.ts +113 -0
  80. package/apps/agents-server/src/utils/agentProjects/createStaticAgentProjectServer.ts +2 -6
  81. package/apps/agents-server/src/utils/agentProjects/humanizeAgentProjectName.ts +25 -0
  82. package/apps/agents-server/src/utils/agentProjects/listAgentProjectChatReferences.ts +10 -3
  83. package/apps/agents-server/src/utils/agentProjects/parseAgentProjectIndexHtml.ts +167 -0
  84. package/apps/agents-server/src/utils/agentProjects/readAgentProjectIndexHtmlProfile.ts +24 -0
  85. package/apps/agents-server/src/utils/agentProjects/readAgentProjectReadme.ts +3 -53
  86. package/apps/agents-server/src/utils/agentProjects/readAgentProjectRootTextFile.ts +73 -0
  87. package/apps/agents-server/src/utils/agentProjects/resolveAgentProjectFaviconRelativePath.ts +108 -0
  88. package/apps/agents-server/src/utils/agentProjects/resolveAgentProjectInfo.ts +12 -3
  89. package/apps/agents-server/src/utils/agentProjects/{resolveAgentProjectReadmeProfile.ts → resolveAgentProjectProfile.ts} +33 -33
  90. package/apps/agents-server/src/utils/agentProjects/resolveAgentProjectPublicUrls.ts +34 -0
  91. package/apps/agents-server/src/utils/bookLanguageDocumentation/createBookLanguageDocumentationPdfResponse.ts +19 -17
  92. package/apps/agents-server/src/utils/chatTasksAdmin.ts +9 -0
  93. package/apps/agents-server/src/utils/dnsRecords/DnsRecordInstruction.ts +20 -0
  94. package/apps/agents-server/src/utils/dnsRecords/DnsRecordsSection.ts +77 -0
  95. package/apps/agents-server/src/utils/dnsRecords/createServerDnsRecordsSections.ts +58 -0
  96. package/apps/agents-server/src/utils/dnsRecords/createServerDomainDnsRecordsSection.ts +48 -0
  97. package/apps/agents-server/src/utils/dnsRecords/dnsRecordGroups.ts +52 -0
  98. package/apps/agents-server/src/utils/dnsRecords/resolveDnsRecordBatchPlan.ts +47 -1
  99. package/apps/agents-server/src/utils/getAdminChatTasksResponse/getAdminChatTasks/adminChatTaskSqlQuery.ts +41 -36
  100. package/apps/agents-server/src/utils/getAdminChatTasksResponse/getAdminChatTasks/mapAdminChatTaskFallbackRows.ts +3 -0
  101. package/apps/agents-server/src/utils/getAdminChatTasksResponse/getAdminChatTasks/mapAdminChatTaskSqlRows.ts +2 -0
  102. package/apps/agents-server/src/utils/localChatRunner/parseLocalTeamConversations.ts +281 -0
  103. package/apps/agents-server/src/utils/localChatRunner/persistLocalTeamConversations.ts +71 -0
  104. package/apps/agents-server/src/utils/localChatRunner/prepareLocalTeamConversationWorkspace.ts +233 -0
  105. package/apps/agents-server/src/utils/localChatRunner/processLocalUserChatJob.ts +37 -6
  106. package/apps/agents-server/src/utils/serverManagement/createManagedServer/insertManagedServerRegistryRow.ts +2 -2
  107. package/apps/agents-server/src/utils/serverManagement/createManagedServer/seedServerCoreAgents.ts +7 -6
  108. package/apps/agents-server/src/utils/serverManagement/createManagedServer/seedServerDefaultAgents.ts +5 -4
  109. package/apps/agents-server/src/utils/serverManagement/createManagedServer/seedServerMetadata.ts +3 -2
  110. package/apps/agents-server/src/utils/serverManagement/createManagedServer/seedServerUsers.ts +3 -2
  111. package/apps/agents-server/src/utils/serverManagement/deleteManagedServer.ts +2 -2
  112. package/apps/agents-server/src/utils/stalwart/createEmailDnsRecordsSection.ts +53 -0
  113. package/apps/agents-server/src/utils/userChat/UserChatRecord.ts +13 -0
  114. package/apps/agents-server/src/utils/userChat/UserChatSource.ts +14 -0
  115. package/apps/agents-server/src/utils/userChat/createUserChatSummary.ts +10 -2
  116. package/apps/agents-server/src/utils/userChat/finalizeUserChatJob.ts +3 -2
  117. package/apps/agents-server/src/utils/userChat/getUserChat.ts +16 -1
  118. package/apps/agents-server/src/utils/userChat/getUserChatForJobRunner.ts +31 -0
  119. package/apps/agents-server/src/utils/userChat/listUserChats.ts +113 -110
  120. package/apps/agents-server/src/utils/userChat/persistFrozenUserChat.ts +21 -6
  121. package/apps/agents-server/src/utils/userChat/runImmediateUserChatAnswer.ts +2 -6
  122. package/apps/agents-server/src/utils/userChat/runUserChatJob.ts +2 -6
  123. package/apps/agents-server/src/utils/userChat/teamMemberUserChatContext.ts +63 -0
  124. package/apps/agents-server/src/utils/userChat.ts +5 -1
  125. package/apps/agents-server/src/utils/userChatClient/cancelAgentUserTimeout.ts +2 -2
  126. package/apps/agents-server/src/utils/userChatClient/fetchAgentUserTimeouts.ts +2 -2
  127. package/apps/agents-server/src/utils/userChatClient.ts +9 -31
  128. package/apps/agents-server/src/utils/userChatTimeout/UserChatTimeoutRecord.ts +10 -2
  129. package/apps/agents-server/src/utils/userChatTimeout/userChatTimeoutStore/claimNextDueUserChatTimeout.ts +28 -25
  130. package/apps/agents-server/src/utils/userChatTimeout/userChatTimeoutStore/getAgentScopedUserChatTimeout.ts +8 -4
  131. package/apps/agents-server/src/utils/userChatTimeout/userChatTimeoutStore/listAgentUserChatTimeouts.ts +4 -1
  132. package/apps/agents-server/src/utils/userChatTimeout/userChatTimeoutStore/recoverExpiredRunningUserChatTimeouts.ts +3 -2
  133. package/apps/agents-server/src/utils/userChatTimeout/userChatTimeoutWorker.ts +53 -0
  134. package/esm/index.es.js +1534 -401
  135. package/esm/index.es.js.map +1 -1
  136. package/esm/scripts/run-agent-messages/messages/buildAgentMessagePrompt.d.ts +7 -1
  137. package/esm/scripts/run-agent-messages/messages/buildAgentTeamPromptSection.d.ts +12 -0
  138. package/esm/scripts/run-agent-messages/messages/finalizeAgentTeamConversationWorkspace.d.ts +16 -0
  139. package/esm/scripts/run-agent-messages/messages/loadAgentTeamConversationWorkspace.d.ts +6 -0
  140. package/esm/scripts/run-codex-prompts/common/normalizeLineEndingsInChangedFiles.d.ts +2 -3
  141. package/esm/scripts/run-codex-prompts/git/coderCommitScope.d.ts +31 -0
  142. package/esm/scripts/run-codex-prompts/git/coderGitSync.d.ts +15 -2
  143. package/esm/scripts/run-codex-prompts/git/commitChanges.d.ts +9 -3
  144. package/esm/scripts/run-codex-prompts/git/workingTreeChanges.d.ts +40 -0
  145. package/esm/scripts/run-codex-prompts/server/coderServerHtml.d.ts +1 -1
  146. package/esm/scripts/run-codex-prompts/ui/buildCoderRunAgentVisual.d.ts +5 -5
  147. package/esm/scripts/run-codex-prompts/ui/buildCoderRunUiTerminalFrameUpdate.d.ts +27 -0
  148. package/esm/src/avatars/renderAvatarVisualTerminalText.d.ts +80 -0
  149. package/esm/src/avatars/types/AvatarVisualDefinition.d.ts +54 -0
  150. package/esm/src/book-3.0/AgentTeamConversationWorkspace.d.ts +85 -0
  151. package/esm/src/book-components/Chat/Chat/ChatProps.d.ts +3 -2
  152. package/esm/src/book-components/Chat/utils/renderMarkdown.d.ts +12 -3
  153. package/esm/src/cli/cli-commands/coder/boilerplateCount.d.ts +1 -1
  154. package/esm/src/cli/cli-commands/coder/generate-boilerplates.d.ts +1 -1
  155. package/esm/src/cli/cli-commands/common/{harness/$askForHarnessInstallationApproval.d.ts → npm/$askForNpmPackageInstallationApproval.d.ts} +2 -2
  156. package/{umd/src/cli/cli-commands/common/harness/$resolveLatestHarnessVersion.d.ts → esm/src/cli/cli-commands/common/npm/$resolveLatestNpmPackageVersion.d.ts} +2 -3
  157. package/esm/src/cli/cli-commands/common/npm/extractNpmPackageVersionFromOutput.d.ts +12 -0
  158. package/esm/src/cli/cli-commands/common/npm/isNpmPackageVersionOutdated.d.ts +9 -0
  159. package/esm/src/cli/cli-commands/common/promptbook-cli/$checkPromptbookCliInstallations.d.ts +9 -0
  160. package/esm/src/cli/cli-commands/common/promptbook-cli/$ensurePromptbookCliInstallations.d.ts +14 -0
  161. package/esm/src/cli/cli-commands/common/promptbook-cli/$ensurePromptbookCliInstallations.test.d.ts +1 -0
  162. package/esm/src/cli/cli-commands/common/promptbook-cli/$resolvePromptbookCliInstallations.d.ts +12 -0
  163. package/esm/src/cli/cli-commands/common/promptbook-cli/$resolvePromptbookCliInstallations.test.d.ts +1 -0
  164. package/esm/src/cli/cli-commands/common/promptbook-cli/$updatePromptbookCliInstallation.d.ts +10 -0
  165. package/esm/src/cli/cli-commands/common/promptbook-cli/PromptbookCliInstallation.d.ts +39 -0
  166. package/esm/src/cli/cli-commands/common/promptbook-cli/PromptbookCliInstallationStatus.d.ts +26 -0
  167. package/esm/src/cli/cli-commands/common/promptbook-cli/buildPromptbookCliInstallCommand.d.ts +7 -0
  168. package/esm/src/cli/cli-commands/common/promptbook-cli/buildPromptbookCliInstallCommand.test.d.ts +1 -0
  169. package/esm/src/cli/cli-commands/common/promptbook-cli/formatPromptbookCliInstallationWarning.d.ts +7 -0
  170. package/esm/src/utils/agent-message-runtime/resolveAgentMessageRuntimeActivity.d.ts +3 -3
  171. package/esm/src/utils/agents/terminalAgentAvatarVisual.d.ts +5 -2
  172. package/esm/src/utils/ascii-art/convertImageDataToAsciiArt.d.ts +6 -0
  173. package/esm/src/utils/ascii-art/createAnsiColorCode.d.ts +46 -0
  174. package/esm/src/utils/misc/debounce.d.ts +4 -2
  175. package/esm/src/utils/misc/debounce.test.d.ts +1 -0
  176. package/esm/src/version.d.ts +1 -1
  177. package/package.json +1 -1
  178. package/src/avatars/renderAvatarVisualTerminalText.ts +249 -0
  179. package/src/avatars/types/AvatarVisualDefinition.ts +60 -0
  180. package/src/avatars/visuals/asciiOctopusAvatarVisual.ts +144 -22
  181. package/src/book-2.0/book-language-documentation/createStandaloneBookLanguageMarkdown.ts +4 -4
  182. package/src/book-2.0/book-language-documentation/renderCommitmentCatalogSection.ts +1 -4
  183. package/src/book-2.0/book-language-documentation/renderGroupedCommitmentDocumentationMarkdown.ts +4 -17
  184. package/src/book-3.0/AgentTeamConversationWorkspace.ts +172 -0
  185. package/src/book-components/BookEditor/useBookEditorMonacoStyles.ts +56 -55
  186. package/src/book-components/Chat/Chat/Chat.module.css +1 -8
  187. package/src/book-components/Chat/Chat/ChatMessageMap.tsx +8 -4
  188. package/src/book-components/Chat/Chat/ChatProps.tsx +3 -2
  189. package/src/book-components/Chat/MarkdownContent/MarkdownContent.module.css +14 -14
  190. package/src/book-components/Chat/save/react/exports/chat-preview-2025-10-13 (1).jsx +95 -5
  191. package/src/book-components/Chat/utils/renderMarkdown.ts +535 -89
  192. package/src/cli/cli-commands/coder/add.ts +3 -3
  193. package/src/cli/cli-commands/coder/boilerplateCount.ts +1 -1
  194. package/src/cli/cli-commands/coder/generate-boilerplates.ts +27 -27
  195. package/src/cli/cli-commands/coder/getDefaultCoderPackageJsonScripts.ts +5 -4
  196. package/src/cli/cli-commands/coder/init.ts +3 -3
  197. package/src/cli/cli-commands/coder/run.ts +10 -2
  198. package/src/cli/cli-commands/common/coderGitSyncCliOptions.ts +6 -2
  199. package/src/cli/cli-commands/common/harness/$applyHarnessInstallationStatus.ts +2 -2
  200. package/src/cli/cli-commands/common/harness/$checkHarnessInstallation.ts +4 -4
  201. package/src/cli/cli-commands/common/harness/$resolveInstalledHarnessVersion.ts +2 -2
  202. package/src/cli/cli-commands/common/{harness/$askForHarnessInstallationApproval.ts → npm/$askForNpmPackageInstallationApproval.ts} +3 -3
  203. package/src/cli/cli-commands/common/npm/$resolveLatestNpmPackageVersion.ts +49 -0
  204. package/src/cli/cli-commands/common/npm/extractNpmPackageVersionFromOutput.ts +25 -0
  205. package/src/cli/cli-commands/common/{harness/isHarnessVersionOutdated.ts → npm/isNpmPackageVersionOutdated.ts} +6 -4
  206. package/src/cli/cli-commands/common/projectInitialization.ts +10 -1
  207. package/src/cli/cli-commands/common/promptbook-cli/$checkPromptbookCliInstallations.ts +73 -0
  208. package/src/cli/cli-commands/common/promptbook-cli/$ensurePromptbookCliInstallations.ts +94 -0
  209. package/src/cli/cli-commands/common/promptbook-cli/$resolvePromptbookCliInstallations.ts +223 -0
  210. package/src/cli/cli-commands/common/promptbook-cli/$updatePromptbookCliInstallation.ts +53 -0
  211. package/src/cli/cli-commands/common/promptbook-cli/PromptbookCliInstallation.ts +46 -0
  212. package/src/cli/cli-commands/common/promptbook-cli/PromptbookCliInstallationStatus.ts +32 -0
  213. package/src/cli/cli-commands/common/promptbook-cli/buildPromptbookCliInstallCommand.ts +22 -0
  214. package/src/cli/cli-commands/common/promptbook-cli/formatPromptbookCliInstallationWarning.ts +47 -0
  215. package/src/commands/FORMAT/formatCommandParser.ts +2 -2
  216. package/src/llm-providers/openai/utils/buildToolInvocationScript.ts +21 -18
  217. package/src/other/templates/getTemplatesPipelineCollection.ts +976 -668
  218. package/src/utils/agent-message-runtime/resolveAgentMessageRuntimeActivity.ts +80 -27
  219. package/src/utils/agents/terminalAgentAvatarVisual.ts +31 -3
  220. package/src/utils/ascii-art/convertImageDataToAsciiArt.ts +9 -109
  221. package/src/utils/ascii-art/createAnsiColorCode.ts +132 -0
  222. package/src/utils/misc/debounce.ts +26 -5
  223. package/src/version.ts +2 -2
  224. package/src/versions.txt +2 -0
  225. package/umd/index.umd.js +1533 -400
  226. package/umd/index.umd.js.map +1 -1
  227. package/umd/scripts/run-agent-messages/messages/buildAgentMessagePrompt.d.ts +7 -1
  228. package/umd/scripts/run-agent-messages/messages/buildAgentTeamPromptSection.d.ts +12 -0
  229. package/umd/scripts/run-agent-messages/messages/finalizeAgentTeamConversationWorkspace.d.ts +16 -0
  230. package/umd/scripts/run-agent-messages/messages/loadAgentTeamConversationWorkspace.d.ts +6 -0
  231. package/umd/scripts/run-codex-prompts/common/normalizeLineEndingsInChangedFiles.d.ts +2 -3
  232. package/umd/scripts/run-codex-prompts/git/coderCommitScope.d.ts +31 -0
  233. package/umd/scripts/run-codex-prompts/git/coderGitSync.d.ts +15 -2
  234. package/umd/scripts/run-codex-prompts/git/commitChanges.d.ts +9 -3
  235. package/umd/scripts/run-codex-prompts/git/workingTreeChanges.d.ts +40 -0
  236. package/umd/scripts/run-codex-prompts/server/coderServerHtml.d.ts +1 -1
  237. package/umd/scripts/run-codex-prompts/ui/buildCoderRunAgentVisual.d.ts +5 -5
  238. package/umd/scripts/run-codex-prompts/ui/buildCoderRunUiTerminalFrameUpdate.d.ts +27 -0
  239. package/umd/src/avatars/renderAvatarVisualTerminalText.d.ts +80 -0
  240. package/umd/src/avatars/renderAvatarVisualTerminalText.test.d.ts +1 -0
  241. package/umd/src/avatars/types/AvatarVisualDefinition.d.ts +54 -0
  242. package/umd/src/book-3.0/AgentTeamConversationWorkspace.d.ts +85 -0
  243. package/umd/src/book-components/Chat/Chat/ChatProps.d.ts +3 -2
  244. package/umd/src/book-components/Chat/utils/renderMarkdown.d.ts +12 -3
  245. package/umd/src/cli/cli-commands/coder/boilerplateCount.d.ts +1 -1
  246. package/umd/src/cli/cli-commands/coder/generate-boilerplates.d.ts +1 -1
  247. package/umd/src/cli/cli-commands/common/{harness/$askForHarnessInstallationApproval.d.ts → npm/$askForNpmPackageInstallationApproval.d.ts} +2 -2
  248. package/{esm/src/cli/cli-commands/common/harness/$resolveLatestHarnessVersion.d.ts → umd/src/cli/cli-commands/common/npm/$resolveLatestNpmPackageVersion.d.ts} +2 -3
  249. package/umd/src/cli/cli-commands/common/npm/$resolveLatestNpmPackageVersion.test.d.ts +1 -0
  250. package/umd/src/cli/cli-commands/common/npm/extractNpmPackageVersionFromOutput.d.ts +12 -0
  251. package/umd/src/cli/cli-commands/common/npm/extractNpmPackageVersionFromOutput.test.d.ts +1 -0
  252. package/umd/src/cli/cli-commands/common/npm/isNpmPackageVersionOutdated.d.ts +9 -0
  253. package/umd/src/cli/cli-commands/common/npm/isNpmPackageVersionOutdated.test.d.ts +1 -0
  254. package/umd/src/cli/cli-commands/common/promptbook-cli/$checkPromptbookCliInstallations.d.ts +9 -0
  255. package/umd/src/cli/cli-commands/common/promptbook-cli/$ensurePromptbookCliInstallations.d.ts +14 -0
  256. package/umd/src/cli/cli-commands/common/promptbook-cli/$ensurePromptbookCliInstallations.test.d.ts +1 -0
  257. package/umd/src/cli/cli-commands/common/promptbook-cli/$resolvePromptbookCliInstallations.d.ts +12 -0
  258. package/umd/src/cli/cli-commands/common/promptbook-cli/$resolvePromptbookCliInstallations.test.d.ts +1 -0
  259. package/umd/src/cli/cli-commands/common/promptbook-cli/$updatePromptbookCliInstallation.d.ts +10 -0
  260. package/umd/src/cli/cli-commands/common/promptbook-cli/PromptbookCliInstallation.d.ts +39 -0
  261. package/umd/src/cli/cli-commands/common/promptbook-cli/PromptbookCliInstallationStatus.d.ts +26 -0
  262. package/umd/src/cli/cli-commands/common/promptbook-cli/buildPromptbookCliInstallCommand.d.ts +7 -0
  263. package/umd/src/cli/cli-commands/common/promptbook-cli/buildPromptbookCliInstallCommand.test.d.ts +1 -0
  264. package/umd/src/cli/cli-commands/common/promptbook-cli/formatPromptbookCliInstallationWarning.d.ts +7 -0
  265. package/umd/src/utils/agent-message-runtime/resolveAgentMessageRuntimeActivity.d.ts +3 -3
  266. package/umd/src/utils/agents/terminalAgentAvatarVisual.d.ts +5 -2
  267. package/umd/src/utils/ascii-art/convertImageDataToAsciiArt.d.ts +6 -0
  268. package/umd/src/utils/ascii-art/createAnsiColorCode.d.ts +46 -0
  269. package/umd/src/utils/misc/debounce.d.ts +4 -2
  270. package/umd/src/utils/misc/debounce.test.d.ts +1 -0
  271. package/umd/src/version.d.ts +1 -1
  272. package/apps/agents-server/scripts/ignore-kill-eperm.js +0 -31
  273. package/apps/agents-server/src/app/agents/[agentName]/api/timeouts/actions/route.ts +0 -103
  274. package/apps/agents-server/src/app/agents/[agentName]/timeouts/AgentTimeoutsClient.tsx +0 -43
  275. package/apps/agents-server/src/app/agents/[agentName]/timeouts/AgentTimeoutsEditDialog.tsx +0 -98
  276. package/apps/agents-server/src/app/agents/[agentName]/timeouts/AgentTimeoutsFiltersCard.tsx +0 -75
  277. package/apps/agents-server/src/app/agents/[agentName]/timeouts/AgentTimeoutsHeader.tsx +0 -53
  278. package/apps/agents-server/src/app/agents/[agentName]/timeouts/AgentTimeoutsSummaryMetrics.tsx +0 -70
  279. package/apps/agents-server/src/app/agents/[agentName]/timeouts/AgentTimeoutsTableCard.tsx +0 -58
  280. package/apps/agents-server/src/app/agents/[agentName]/timeouts/AgentTimeoutsTableRow.tsx +0 -242
  281. package/apps/agents-server/src/app/agents/[agentName]/timeouts/loading.tsx +0 -15
  282. package/apps/agents-server/src/app/agents/[agentName]/timeouts/page.tsx +0 -28
  283. package/apps/agents-server/src/app/agents/[agentName]/timeouts/useAgentTimeoutsClientState.ts +0 -769
  284. package/apps/agents-server/src/components/AgentProjectDnsInstructions/AgentProjectDnsInstructions.tsx +0 -182
  285. package/apps/agents-server/src/utils/userChatClient/runAgentUserTimeoutBulkAction.ts +0 -24
  286. package/apps/agents-server/src/utils/userChatClient/updateAgentUserTimeout.ts +0 -25
  287. package/esm/src/cli/cli-commands/common/harness/extractHarnessVersionFromOutput.d.ts +0 -11
  288. package/esm/src/cli/cli-commands/common/harness/isHarnessVersionOutdated.d.ts +0 -9
  289. package/src/cli/cli-commands/common/harness/$resolveLatestHarnessVersion.ts +0 -34
  290. package/src/cli/cli-commands/common/harness/extractHarnessVersionFromOutput.ts +0 -28
  291. package/umd/src/cli/cli-commands/common/harness/extractHarnessVersionFromOutput.d.ts +0 -11
  292. package/umd/src/cli/cli-commands/common/harness/isHarnessVersionOutdated.d.ts +0 -9
  293. /package/esm/src/{cli/cli-commands/common/harness/extractHarnessVersionFromOutput.test.d.ts → avatars/renderAvatarVisualTerminalText.test.d.ts} +0 -0
  294. /package/esm/src/cli/cli-commands/common/{harness/isHarnessVersionOutdated.test.d.ts → npm/$resolveLatestNpmPackageVersion.test.d.ts} +0 -0
  295. /package/{umd/src/cli/cli-commands/common/harness/extractHarnessVersionFromOutput.test.d.ts → esm/src/cli/cli-commands/common/npm/extractNpmPackageVersionFromOutput.test.d.ts} +0 -0
  296. /package/{umd/src/cli/cli-commands/common/harness/isHarnessVersionOutdated.test.d.ts → esm/src/cli/cli-commands/common/npm/isNpmPackageVersionOutdated.test.d.ts} +0 -0
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable no-magic-numbers */
2
2
 
3
- import { drawAvatarFrame } from '../avatarRenderingUtils';
3
+ import { DEFAULT_AVATAR_SIZE, drawAvatarFrame } from '../avatarRenderingUtils';
4
4
  import type { AvatarPalette, AvatarVisualDefinition } from '../types/AvatarVisualDefinition';
5
5
  import type { OrganicTentacleRibbonPoint } from './octopusAvatarVisualShared';
6
6
  import {
@@ -31,6 +31,16 @@ const OUTLINE_GLYPHS = ['#', '%', '@'];
31
31
  */
32
32
  const ATMOSPHERE_GLYPHS = ['.', ':', "'", '`'];
33
33
 
34
+ /**
35
+ * Coordinate space the octopus layout is generated in when it is painted into a terminal.
36
+ *
37
+ * The terminal renderer has its own character grid, so the geometry only needs one stable
38
+ * square coordinate space which the grid is then sampled from.
39
+ *
40
+ * @private helper of `asciiOctopusAvatarVisual`
41
+ */
42
+ const TERMINAL_ASCII_OCTOPUS_LAYOUT_SIZE = DEFAULT_AVATAR_SIZE;
43
+
34
44
  /**
35
45
  * One 2D point used by the ASCII octopus helpers.
36
46
  *
@@ -42,12 +52,11 @@ type Point = {
42
52
  };
43
53
 
44
54
  /**
45
- * Character-grid metrics used by the ASCII renderer.
55
+ * Character-cell sampling grid shared by the canvas and the terminal ASCII renderers.
46
56
  *
47
57
  * @private helper of `asciiOctopusAvatarVisual`
48
58
  */
49
- type AsciiGridMetrics = {
50
- readonly fontSize: number;
59
+ type AsciiSampleGrid = {
51
60
  readonly cellWidth: number;
52
61
  readonly cellHeight: number;
53
62
  readonly columnCount: number;
@@ -56,6 +65,22 @@ type AsciiGridMetrics = {
56
65
  readonly offsetY: number;
57
66
  };
58
67
 
68
+ /**
69
+ * Character-grid metrics used by the canvas ASCII renderer.
70
+ *
71
+ * @private helper of `asciiOctopusAvatarVisual`
72
+ */
73
+ type AsciiGridMetrics = AsciiSampleGrid & {
74
+ readonly fontSize: number;
75
+ };
76
+
77
+ /**
78
+ * Resolved glyph of every sampled cell of one ASCII octopus frame.
79
+ *
80
+ * @private helper of `asciiOctopusAvatarVisual`
81
+ */
82
+ type AsciiOctopusGlyphGrid = ReadonlyArray<ReadonlyArray<AsciiGlyphDescriptor | null>>;
83
+
59
84
  /**
60
85
  * One seeded eye definition used by the ASCII renderer.
61
86
  *
@@ -135,6 +160,13 @@ export const asciiOctopusAvatarVisual: AvatarVisualDefinition = {
135
160
  const staticRandom = createRandom('ascii-octopus-static');
136
161
  const gridMetrics = createAsciiGridMetrics(size, gridRandom);
137
162
  const layout = createAsciiOctopusLayout(size, timeMs, createRandom, staticRandom, interaction);
163
+ const glyphGrid = createAsciiOctopusGlyphGrid({
164
+ sampleGrid: gridMetrics,
165
+ layout,
166
+ palette,
167
+ cellRandom: createRandom('ascii-octopus-cells'),
168
+ timeMs,
169
+ });
138
170
 
139
171
  drawAvatarFrame(context, size, palette);
140
172
  drawAsciiBackdrop(context, size, palette, layout, timeMs);
@@ -144,31 +176,15 @@ export const asciiOctopusAvatarVisual: AvatarVisualDefinition = {
144
176
  context.textAlign = 'center';
145
177
  context.textBaseline = 'middle';
146
178
 
147
- // The ASCII renderer samples the morphing octopus field on a low-resolution grid so the shape stays organic
148
- // while the glyph layout remains deterministic for the same avatar input.
149
- const cellRandom = createRandom('ascii-octopus-cells');
150
-
151
179
  for (let rowIndex = 0; rowIndex < gridMetrics.rowCount; rowIndex++) {
152
180
  for (let columnIndex = 0; columnIndex < gridMetrics.columnCount; columnIndex++) {
153
- const point = {
154
- x: gridMetrics.offsetX + columnIndex * gridMetrics.cellWidth,
155
- y: gridMetrics.offsetY + rowIndex * gridMetrics.cellHeight,
156
- };
157
- const noise = cellRandom();
158
- const glyphDescriptor = resolveAsciiGlyph({
159
- point,
160
- layout,
161
- palette,
162
- cellWidth: gridMetrics.cellWidth,
163
- cellHeight: gridMetrics.cellHeight,
164
- noise,
165
- timeMs,
166
- });
181
+ const glyphDescriptor = glyphGrid[rowIndex]![columnIndex]!;
167
182
 
168
183
  if (!glyphDescriptor) {
169
184
  continue;
170
185
  }
171
186
 
187
+ const point = resolveAsciiSampleGridPoint(gridMetrics, columnIndex, rowIndex);
172
188
  context.fillStyle = glyphDescriptor.color;
173
189
  context.fillText(glyphDescriptor.character, point.x, point.y);
174
190
  }
@@ -176,8 +192,114 @@ export const asciiOctopusAvatarVisual: AvatarVisualDefinition = {
176
192
 
177
193
  context.restore();
178
194
  },
195
+ renderTerminalText({ columns, rows, palette, createRandom, timeMs, interaction }) {
196
+ const staticRandom = createRandom('ascii-octopus-static');
197
+ const layout = createAsciiOctopusLayout(
198
+ TERMINAL_ASCII_OCTOPUS_LAYOUT_SIZE,
199
+ timeMs,
200
+ createRandom,
201
+ staticRandom,
202
+ interaction,
203
+ );
204
+
205
+ return createAsciiOctopusGlyphGrid({
206
+ sampleGrid: createAsciiTerminalSampleGrid(columns, rows),
207
+ layout,
208
+ palette,
209
+ cellRandom: createRandom('ascii-octopus-cells'),
210
+ timeMs,
211
+ });
212
+ },
179
213
  };
180
214
 
215
+ /**
216
+ * Resolves the geometry point sampled for one cell of the grid.
217
+ *
218
+ * @param sampleGrid Character-cell sampling grid.
219
+ * @param columnIndex Zero-based cell column.
220
+ * @param rowIndex Zero-based cell row.
221
+ * @returns Sampled point in the octopus coordinate space.
222
+ *
223
+ * @private helper of `asciiOctopusAvatarVisual`
224
+ */
225
+ function resolveAsciiSampleGridPoint(sampleGrid: AsciiSampleGrid, columnIndex: number, rowIndex: number): Point {
226
+ return {
227
+ x: sampleGrid.offsetX + columnIndex * sampleGrid.cellWidth,
228
+ y: sampleGrid.offsetY + rowIndex * sampleGrid.cellHeight,
229
+ };
230
+ }
231
+
232
+ /**
233
+ * Builds the sampling grid used when the octopus is painted straight into terminal character cells.
234
+ *
235
+ * @param columns Available terminal columns.
236
+ * @param rows Available terminal rows.
237
+ * @returns Character-cell sampling grid covering the whole octopus coordinate space.
238
+ *
239
+ * @private helper of `asciiOctopusAvatarVisual`
240
+ */
241
+ function createAsciiTerminalSampleGrid(columns: number, rows: number): AsciiSampleGrid {
242
+ const cellWidth = TERMINAL_ASCII_OCTOPUS_LAYOUT_SIZE / columns;
243
+ const cellHeight = TERMINAL_ASCII_OCTOPUS_LAYOUT_SIZE / rows;
244
+
245
+ return {
246
+ cellWidth,
247
+ cellHeight,
248
+ columnCount: columns,
249
+ rowCount: rows,
250
+ offsetX: cellWidth / 2,
251
+ offsetY: cellHeight / 2,
252
+ };
253
+ }
254
+
255
+ /**
256
+ * Samples the morphing octopus field into one deterministic grid of ASCII glyphs.
257
+ *
258
+ * The field is sampled on a low-resolution grid so the shape stays organic while the glyph
259
+ * layout remains deterministic for the same avatar input. Both the canvas visual and the
260
+ * terminal visual share this single sampling pass so they always describe the same octopus.
261
+ *
262
+ * @param options Sampling grid, prepared octopus layout, palette, per-cell noise, and animation time.
263
+ * @returns Resolved glyph of every sampled cell, where `null` means an empty cell.
264
+ *
265
+ * @private helper of `asciiOctopusAvatarVisual`
266
+ */
267
+ function createAsciiOctopusGlyphGrid(options: {
268
+ sampleGrid: AsciiSampleGrid;
269
+ layout: AsciiOctopusLayout;
270
+ palette: AvatarPalette;
271
+ cellRandom: () => number;
272
+ timeMs: number;
273
+ }): AsciiOctopusGlyphGrid {
274
+ const { sampleGrid, layout, palette, cellRandom, timeMs } = options;
275
+ const glyphGrid: Array<Array<AsciiGlyphDescriptor | null>> = [];
276
+
277
+ for (let rowIndex = 0; rowIndex < sampleGrid.rowCount; rowIndex++) {
278
+ const glyphRow: Array<AsciiGlyphDescriptor | null> = [];
279
+
280
+ for (let columnIndex = 0; columnIndex < sampleGrid.columnCount; columnIndex++) {
281
+ const point = resolveAsciiSampleGridPoint(sampleGrid, columnIndex, rowIndex);
282
+ const noise = cellRandom();
283
+
284
+ glyphRow.push(
285
+ resolveAsciiGlyph({
286
+ point,
287
+ layout,
288
+ palette,
289
+ cellWidth: sampleGrid.cellWidth,
290
+ cellHeight: sampleGrid.cellHeight,
291
+ noise,
292
+ timeMs,
293
+ }),
294
+ );
295
+ }
296
+
297
+ glyphGrid.push(glyphRow);
298
+ }
299
+
300
+ return glyphGrid;
301
+ }
302
+
181
303
  /**
182
304
  * Draws the dark terminal-like glow behind the ASCII octopus.
183
305
  *
@@ -280,9 +280,7 @@ export function createStandaloneBookLanguageMarkdown(
280
280
  ${block(dictionary.tutorialSections.checklistBody)}
281
281
 
282
282
  ${block(
283
- isLowLevelCommitmentsIncluded
284
- ? renderLowLevelCommitmentsChapter(lowLevelCommitments, dictionary)
285
- : '',
283
+ isLowLevelCommitmentsIncluded ? renderLowLevelCommitmentsChapter(lowLevelCommitments, dictionary) : '',
286
284
  )}
287
285
 
288
286
  ---
@@ -596,7 +594,9 @@ function renderExampleSection(
596
594
  **${dictionary.exampleLabels.goal}:** ${exampleText.goal}
597
595
 
598
596
  **${dictionary.exampleLabels.commitmentsUsed}:** ${renderCommitmentSectionLinks(
599
- parseAgentSourceWithCommitments(example.source as string_book).commitments.map((commitment) => commitment.type),
597
+ parseAgentSourceWithCommitments(example.source as string_book).commitments.map(
598
+ (commitment) => commitment.type,
599
+ ),
600
600
  commitmentSectionAnchorByType,
601
601
  )}
602
602
 
@@ -53,10 +53,7 @@ export function renderCommitmentCatalogSection(options: RenderCommitmentCatalogS
53
53
  ${aliasesMarkdown}
54
54
 
55
55
  ${block(
56
- renderGroupedCommitmentDocumentationMarkdown(
57
- groupedCommitment,
58
- COMMITMENT_CATALOG_HEADING_LEVEL_SHIFT,
59
- ),
56
+ renderGroupedCommitmentDocumentationMarkdown(groupedCommitment, COMMITMENT_CATALOG_HEADING_LEVEL_SHIFT),
60
57
  )}
61
58
  `,
62
59
  );
@@ -196,10 +196,7 @@ export function renderGroupedCommitmentDocumentationMarkdown(
196
196
  *
197
197
  * @private internal utility of `createStandaloneBookLanguageMarkdown`
198
198
  */
199
- function renderFocusedCommitmentExamples(
200
- documentation: string,
201
- group: GroupedCommitmentDocumentationSource,
202
- ): string {
199
+ function renderFocusedCommitmentExamples(documentation: string, group: GroupedCommitmentDocumentationSource): string {
203
200
  return documentation.replace(BOOK_CODE_BLOCK_PATTERN, (codeBlock, _fence, source: string) => {
204
201
  const focusedSource = createFocusedCommitmentExampleSource(source, group);
205
202
  return focusedSource ? getSafeCodeBlock(focusedSource, 'book') : codeBlock;
@@ -223,12 +220,7 @@ function createFocusedCommitmentExampleSource(
223
220
  const commitmentTypes = new Set([group.primary.type, ...group.aliases]);
224
221
  const isOpenClosedCommitmentFamily =
225
222
  commitmentTypes.has(OPEN_COMMITMENT_TYPE) && commitmentTypes.has(CLOSED_COMMITMENT_TYPE);
226
- const allowedCommitmentTypes = new Set([
227
- group.primary.type,
228
- ...group.aliases,
229
- 'GOAL',
230
- CLOSED_COMMITMENT_TYPE,
231
- ]);
223
+ const allowedCommitmentTypes = new Set([group.primary.type, ...group.aliases, 'GOAL', CLOSED_COMMITMENT_TYPE]);
232
224
  const canonicalTypeByCommitmentType = createCanonicalCommitmentTypeByCommitmentType(
233
225
  group,
234
226
  isOpenClosedCommitmentFamily,
@@ -384,9 +376,7 @@ function finalizeFocusedCommitmentExampleSource(
384
376
  normalizedFocusedCommitments.push(CLOSED_COMMITMENT_TYPE);
385
377
  }
386
378
 
387
- return [agentName, ...normalizedFocusedCommitments]
388
- .filter((line): line is string => Boolean(line))
389
- .join('\n\n');
379
+ return [agentName, ...normalizedFocusedCommitments].filter((line): line is string => Boolean(line)).join('\n\n');
390
380
  }
391
381
 
392
382
  /**
@@ -427,10 +417,7 @@ function createCanonicalCommitmentTypeByCommitmentType(
427
417
  canonicalTypeByCommitmentType.set(group.primary.type, group.primary.type);
428
418
 
429
419
  for (const alias of group.aliases) {
430
- canonicalTypeByCommitmentType.set(
431
- alias,
432
- isOpenClosedCommitmentFamily ? alias : group.primary.type,
433
- );
420
+ canonicalTypeByCommitmentType.set(alias, isOpenClosedCommitmentFamily ? alias : group.primary.type);
434
421
  }
435
422
 
436
423
  return canonicalTypeByCommitmentType;
@@ -0,0 +1,172 @@
1
+ import { basename, join } from 'path';
2
+ import { AGENT_FINISHED_MESSAGES_DIRECTORY_PATH, AGENT_MESSAGES_DIRECTORY_PATH } from './agentFolderPaths';
3
+
4
+ // Note: [💞] This file defines the shared TEAM workspace convention rather than one standalone entity.
5
+
6
+ /**
7
+ * Relative directory for an active TEAM conversation workspace.
8
+ *
9
+ * @private internal convention shared by the Agents Server and agent-folder runner
10
+ */
11
+ export const AGENT_TEAM_CONVERSATIONS_DIRECTORY_PATH = join(AGENT_MESSAGES_DIRECTORY_PATH, 'team');
12
+
13
+ /**
14
+ * Relative directory where completed TEAM conversation transcripts are retained.
15
+ *
16
+ * @private internal convention shared by the Agents Server and agent-folder runner
17
+ */
18
+ export const AGENT_FINISHED_TEAM_CONVERSATIONS_DIRECTORY_PATH = join(AGENT_FINISHED_MESSAGES_DIRECTORY_PATH, 'team');
19
+
20
+ /**
21
+ * Name of the JSON manifest that describes one TEAM conversation workspace.
22
+ *
23
+ * @private internal convention shared by the Agents Server and agent-folder runner
24
+ */
25
+ export const AGENT_TEAM_CONVERSATION_MANIFEST_FILE_NAME = 'team.json';
26
+
27
+ /**
28
+ * Name of the read-only teammate-source directory inside one TEAM workspace.
29
+ *
30
+ * @private internal convention shared by the Agents Server and agent-folder runner
31
+ */
32
+ export const AGENT_TEAMMATE_SOURCES_DIRECTORY_NAME = 'teammates';
33
+
34
+ /**
35
+ * One primary agent represented in a TEAM workspace manifest.
36
+ *
37
+ * @private internal convention shared by the Agents Server and agent-folder runner
38
+ */
39
+ export type AgentTeamConversationPrimaryAgent = {
40
+ readonly permanentId: string;
41
+ readonly agentName: string;
42
+ };
43
+
44
+ /**
45
+ * One local teammate made available to the coding harness for a single user turn.
46
+ *
47
+ * @private internal convention shared by the Agents Server and agent-folder runner
48
+ */
49
+ export type AgentTeamConversationTeammate = {
50
+ readonly permanentId: string;
51
+ readonly agentName: string;
52
+ readonly url: string;
53
+ readonly instructions: string;
54
+ readonly sourceFileName: string;
55
+ };
56
+
57
+ /**
58
+ * Persisted roster snapshot for the optional TEAM workspace of one queued message.
59
+ *
60
+ * @private internal convention shared by the Agents Server and agent-folder runner
61
+ */
62
+ export type AgentTeamConversationWorkspaceManifest = {
63
+ readonly version: 1;
64
+ readonly primaryAgent: AgentTeamConversationPrimaryAgent;
65
+ readonly teammates: ReadonlyArray<AgentTeamConversationTeammate>;
66
+ };
67
+
68
+ /**
69
+ * Creates the stable directory name that belongs to one queued `.book` message.
70
+ *
71
+ * @private internal convention shared by the Agents Server and agent-folder runner
72
+ */
73
+ export function createAgentTeamConversationWorkspaceDirectoryName(messageFileName: string): string {
74
+ const rawBaseName = basename(messageFileName).replace(/\.book$/iu, '');
75
+ const normalizedBaseName = rawBaseName.replace(/[^A-Za-z0-9._-]+/gu, '-').replace(/^[._-]+|[._-]+$/gu, '');
76
+
77
+ return normalizedBaseName || 'message';
78
+ }
79
+
80
+ /**
81
+ * Creates the relative active workspace path for one queued message.
82
+ *
83
+ * @private internal convention shared by the Agents Server and agent-folder runner
84
+ */
85
+ export function createAgentTeamConversationWorkspacePath(messageFileName: string): string {
86
+ return join(
87
+ AGENT_TEAM_CONVERSATIONS_DIRECTORY_PATH,
88
+ createAgentTeamConversationWorkspaceDirectoryName(messageFileName),
89
+ );
90
+ }
91
+
92
+ /**
93
+ * Creates the relative completed-workspace path for one queued message.
94
+ *
95
+ * @private internal convention shared by the Agents Server and agent-folder runner
96
+ */
97
+ export function createFinishedAgentTeamConversationWorkspacePath(messageFileName: string): string {
98
+ return join(
99
+ AGENT_FINISHED_TEAM_CONVERSATIONS_DIRECTORY_PATH,
100
+ createAgentTeamConversationWorkspaceDirectoryName(messageFileName),
101
+ );
102
+ }
103
+
104
+ /**
105
+ * Creates the source-snapshot file name for one teammate.
106
+ *
107
+ * @private internal convention shared by the Agents Server and agent-folder runner
108
+ */
109
+ export function createAgentTeamTeammateSourceFileName(teammatePermanentId: string): string {
110
+ const normalizedPermanentId = teammatePermanentId
111
+ .trim()
112
+ .replace(/[^A-Za-z0-9._-]+/gu, '-')
113
+ .replace(/^[._-]+|[._-]+$/gu, '');
114
+
115
+ return `${normalizedPermanentId || 'teammate'}.book`;
116
+ }
117
+
118
+ /**
119
+ * Checks whether unknown JSON has the minimum shape required for a TEAM workspace manifest.
120
+ *
121
+ * @private internal convention shared by the Agents Server and agent-folder runner
122
+ */
123
+ export function isAgentTeamConversationWorkspaceManifest(
124
+ value: unknown,
125
+ ): value is AgentTeamConversationWorkspaceManifest {
126
+ if (!value || typeof value !== 'object') {
127
+ return false;
128
+ }
129
+
130
+ const manifest = value as Partial<AgentTeamConversationWorkspaceManifest>;
131
+ if (
132
+ manifest.version !== 1 ||
133
+ !isPrimaryAgent(manifest.primaryAgent) ||
134
+ !Array.isArray(manifest.teammates) ||
135
+ !manifest.teammates.every(isTeammate)
136
+ ) {
137
+ return false;
138
+ }
139
+
140
+ return true;
141
+ }
142
+
143
+ /**
144
+ * Checks the primary-agent part of an untrusted manifest.
145
+ *
146
+ * @private internal utility of `isAgentTeamConversationWorkspaceManifest`
147
+ */
148
+ function isPrimaryAgent(value: unknown): value is AgentTeamConversationPrimaryAgent {
149
+ return Boolean(
150
+ value &&
151
+ typeof value === 'object' &&
152
+ typeof (value as AgentTeamConversationPrimaryAgent).permanentId === 'string' &&
153
+ typeof (value as AgentTeamConversationPrimaryAgent).agentName === 'string',
154
+ );
155
+ }
156
+
157
+ /**
158
+ * Checks one teammate part of an untrusted manifest.
159
+ *
160
+ * @private internal utility of `isAgentTeamConversationWorkspaceManifest`
161
+ */
162
+ function isTeammate(value: unknown): value is AgentTeamConversationTeammate {
163
+ return Boolean(
164
+ value &&
165
+ typeof value === 'object' &&
166
+ typeof (value as AgentTeamConversationTeammate).permanentId === 'string' &&
167
+ typeof (value as AgentTeamConversationTeammate).agentName === 'string' &&
168
+ typeof (value as AgentTeamConversationTeammate).url === 'string' &&
169
+ typeof (value as AgentTeamConversationTeammate).instructions === 'string' &&
170
+ typeof (value as AgentTeamConversationTeammate).sourceFileName === 'string',
171
+ );
172
+ }
@@ -1,3 +1,4 @@
1
+ import { spaceTrim } from 'spacetrim';
1
2
  import { useEffect } from 'react';
2
3
  import { PROMPTBOOK_SYNTAX_COLORS } from '../../config';
3
4
  import type { BookEditorTheme } from './BookEditorTheme';
@@ -48,66 +49,66 @@ export function useBookEditorMonacoStyles({
48
49
  document.head.appendChild(style);
49
50
  }
50
51
 
51
- style.innerHTML = `
52
+ style.innerHTML = spaceTrim(`
52
53
 
53
- @import url('https://fonts.googleapis.com/css2?family=Bitcount+Grid+Single:wght@100..900&family=Playfair+Display:ital,wght@0,400..900;1,400..900&display=swap');
54
- /* <- [🚚] */
54
+ @import url('https://fonts.googleapis.com/css2?family=Bitcount+Grid+Single:wght@100..900&family=Playfair+Display:ital,wght@0,400..900;1,400..900&display=swap');
55
+ /* <- [🚚] */
55
56
 
56
- .${instanceClass} .monaco-editor .view-lines {
57
- background-image: linear-gradient(to bottom, transparent ${scaledLineHeight - 1}px, ${lineColor} ${
57
+ .${instanceClass} .monaco-editor .view-lines {
58
+ background-image: linear-gradient(to bottom, transparent ${scaledLineHeight - 1}px, ${lineColor} ${
58
59
  scaledLineHeight - 1
59
60
  }px);
60
- background-size: calc(100% + ${scaledContentPaddingLeft}px) ${scaledLineHeight}px;
61
- background-position-x: -${scaledContentPaddingLeft}px;
62
- background-position-y: ${scaledLineHeight * BACKGROUND_POSITION_Y_MULTIPLIER}px;
63
- }
64
- .${instanceClass} .monaco-editor .overflow-guard::before {
65
- content: '';
66
- position: absolute;
67
- left: ${scaledVerticalLineLeft}px;
68
- top: 0;
69
- bottom: 0;
70
- width: 1px;
71
- background-color: ${lineColor};
72
- z-index: 10;
73
- }
61
+ background-size: calc(100% + ${scaledContentPaddingLeft}px) ${scaledLineHeight}px;
62
+ background-position-x: -${scaledContentPaddingLeft}px;
63
+ background-position-y: ${scaledLineHeight * BACKGROUND_POSITION_Y_MULTIPLIER}px;
64
+ }
65
+ .${instanceClass} .monaco-editor .overflow-guard::before {
66
+ content: '';
67
+ position: absolute;
68
+ left: ${scaledVerticalLineLeft}px;
69
+ top: 0;
70
+ bottom: 0;
71
+ width: 1px;
72
+ background-color: ${lineColor};
73
+ z-index: 10;
74
+ }
74
75
 
75
- .${instanceClass} .monaco-editor .separator-line {
76
- background: linear-gradient(
77
- to bottom,
78
- transparent ${scaledLineHeight * 0.9 - 2}px,
79
- ${separatorColor} ${scaledLineHeight * 0.9 - 2}px,
80
- ${separatorColor} ${scaledLineHeight * 0.9 + 1}px,
81
- transparent ${scaledLineHeight * 0.9 + 1}px
82
- );
83
- }
84
-
85
- .${instanceClass} .monaco-editor .transparent-text {
86
- color: transparent !important;
87
- }
88
-
89
- .${instanceClass} .monaco-editor .code-block-box {
90
- background-color: ${codeBlockBackground};
91
- border-left: 1px solid ${codeBlockBorderColor};
92
- border-right: 1px solid ${codeBlockBorderColor};
93
- padding-left: ${Math.round(8 * zoomLevel)}px;
94
- padding-right: ${Math.round(8 * zoomLevel)}px;
95
- }
96
-
97
- .${instanceClass} .monaco-editor .code-block-top {
98
- border-top: 1px solid ${codeBlockBorderColor};
99
- border-top-left-radius: ${Math.round(10 * zoomLevel)}px;
100
- border-top-right-radius: ${Math.round(10 * zoomLevel)}px;
101
- overflow: hidden;
102
- }
103
-
104
- .${instanceClass} .monaco-editor .code-block-bottom {
105
- border-bottom: 1px solid ${codeBlockBorderColor};
106
- border-bottom-left-radius: ${Math.round(10 * zoomLevel)}px;
107
- border-bottom-right-radius: ${Math.round(10 * zoomLevel)}px;
108
- overflow: hidden;
109
- }
110
- `;
76
+ .${instanceClass} .monaco-editor .separator-line {
77
+ background: linear-gradient(
78
+ to bottom,
79
+ transparent ${scaledLineHeight * 0.9 - 2}px,
80
+ ${separatorColor} ${scaledLineHeight * 0.9 - 2}px,
81
+ ${separatorColor} ${scaledLineHeight * 0.9 + 1}px,
82
+ transparent ${scaledLineHeight * 0.9 + 1}px
83
+ );
84
+ }
85
+
86
+ .${instanceClass} .monaco-editor .transparent-text {
87
+ color: transparent !important;
88
+ }
89
+
90
+ .${instanceClass} .monaco-editor .code-block-box {
91
+ background-color: ${codeBlockBackground};
92
+ border-left: 1px solid ${codeBlockBorderColor};
93
+ border-right: 1px solid ${codeBlockBorderColor};
94
+ padding-left: ${Math.round(8 * zoomLevel)}px;
95
+ padding-right: ${Math.round(8 * zoomLevel)}px;
96
+ }
97
+
98
+ .${instanceClass} .monaco-editor .code-block-top {
99
+ border-top: 1px solid ${codeBlockBorderColor};
100
+ border-top-left-radius: ${Math.round(10 * zoomLevel)}px;
101
+ border-top-right-radius: ${Math.round(10 * zoomLevel)}px;
102
+ overflow: hidden;
103
+ }
104
+
105
+ .${instanceClass} .monaco-editor .code-block-bottom {
106
+ border-bottom: 1px solid ${codeBlockBorderColor};
107
+ border-bottom-left-radius: ${Math.round(10 * zoomLevel)}px;
108
+ border-bottom-right-radius: ${Math.round(10 * zoomLevel)}px;
109
+ overflow: hidden;
110
+ }
111
+ `);
111
112
 
112
113
  return () => {
113
114
  if (process.env.NODE_ENV === 'production') {
@@ -426,17 +426,10 @@
426
426
  }
427
427
 
428
428
  .chatMainFlow .chatChildren {
429
- grid-area: 💬;
429
+ grid-area: 🟦;
430
430
  width: 100%;
431
- height: 100%;
432
431
  min-width: 0;
433
- min-height: 0;
434
432
  z-index: 300;
435
- pointer-events: none;
436
- }
437
-
438
- .chatMainFlow .chatChildren > * {
439
- pointer-events: auto;
440
433
  }
441
434
 
442
435
  /* Chat messages area */
@@ -1,4 +1,6 @@
1
1
  'use client';
2
+ import { spaceTrim } from 'spacetrim';
3
+
2
4
 
3
5
  import type { Feature, GeoJsonObject, GeoJsonProperties, Geometry } from 'geojson';
4
6
  import type { LatLng, Layer, Map as LeafletMap, Path, PathOptions } from 'leaflet';
@@ -253,10 +255,12 @@ function createPointOfInterestMarker(leaflet: LeafletNamespace, feature: ChatGeo
253
255
 
254
256
  const icon = leaflet.divIcon({
255
257
  className: styles.poiMarkerIcon,
256
- html: `
257
- <span class="${styles.poiMarkerPulse}" aria-hidden="true"></span>
258
- ${initialHtml}
259
- `.trim(),
258
+ html: spaceTrim(
259
+ (block) => `
260
+ <span class="${styles.poiMarkerPulse}" aria-hidden="true"></span>
261
+ ${block(initialHtml)}
262
+ `,
263
+ ).trim(),
260
264
  iconSize: [POI_MARKER_CONFIG.size, POI_MARKER_CONFIG.size],
261
265
  iconAnchor: POI_MARKER_CONFIG.anchor,
262
266
  });
@@ -681,8 +681,9 @@ export type ChatProps = {
681
681
  readonly tasksProgress?: Array<{ id: string; name: string; progress?: number }>; // Simplified task progress type
682
682
 
683
683
  /**
684
- * Content to be shown inside the chat bar in head
685
- * If not provided, the chat bar will not be rendered
684
+ * Optional content displayed in the chat header above the message list.
685
+ *
686
+ * If not provided, the header row is not rendered.
686
687
  */
687
688
  readonly children?: ReactNode;
688
689