@promptbook/cli 0.114.0-13 → 0.114.0-18

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 (231) hide show
  1. package/apps/agents-server/next.config.ts +6 -0
  2. package/apps/agents-server/src/app/admin/_components/AdminFilterFields.tsx +84 -0
  3. package/apps/agents-server/src/app/admin/_components/AdminMetricCard.tsx +36 -0
  4. package/apps/agents-server/src/app/admin/_components/AdminTaskManagerTabs.tsx +97 -0
  5. package/apps/agents-server/src/app/admin/planned-messages/PlannedMessageManagerClient.tsx +103 -0
  6. package/apps/agents-server/src/app/admin/planned-messages/PlannedMessageManagerEditDialog.tsx +232 -0
  7. package/apps/agents-server/src/app/admin/planned-messages/PlannedMessageManagerFiltersCard.tsx +195 -0
  8. package/apps/agents-server/src/app/admin/planned-messages/PlannedMessageManagerRow.tsx +189 -0
  9. package/apps/agents-server/src/app/admin/planned-messages/PlannedMessageManagerSummaryMetrics.tsx +60 -0
  10. package/apps/agents-server/src/app/admin/planned-messages/PlannedMessageManagerTableCard.tsx +147 -0
  11. package/apps/agents-server/src/app/admin/planned-messages/page.tsx +17 -0
  12. package/apps/agents-server/src/app/admin/planned-messages/plannedMessageEditForm.ts +186 -0
  13. package/apps/agents-server/src/app/admin/planned-messages/plannedMessageManagerDialogs.ts +46 -0
  14. package/apps/agents-server/src/app/admin/planned-messages/plannedMessageManagerPresentation.tsx +188 -0
  15. package/apps/agents-server/src/app/admin/planned-messages/resolvePlannedMessageSortValue.ts +115 -0
  16. package/apps/agents-server/src/app/admin/planned-messages/usePlannedMessageManagerData.ts +116 -0
  17. package/apps/agents-server/src/app/admin/planned-messages/usePlannedMessageManagerState.ts +289 -0
  18. package/apps/agents-server/src/app/admin/task-manager/TaskManagerClient.tsx +7 -2
  19. package/apps/agents-server/src/app/admin/task-manager/TaskManagerFiltersCard.tsx +7 -73
  20. package/apps/agents-server/src/app/admin/task-manager/TaskManagerSummaryMetrics.tsx +5 -30
  21. package/apps/agents-server/src/app/admin/task-manager/[taskId]/TaskManagerTaskDetailClient.tsx +1 -1
  22. package/apps/agents-server/src/app/agents/[agentName]/api/book/reference-diagnostics/route.ts +30 -7
  23. package/apps/agents-server/src/app/agents/[agentName]/api/book/route.ts +1 -0
  24. package/apps/agents-server/src/app/agents/[agentName]/api/book/test.http +3 -3
  25. package/apps/agents-server/src/app/agents/[agentName]/book/BookEditorMissingReferences.tsx +106 -12
  26. package/apps/agents-server/src/app/agents/[agentName]/book/BookEditorWrapper.tsx +3 -0
  27. package/apps/agents-server/src/app/agents/[agentName]/book/useBookEditorDiagnostics.ts +12 -0
  28. package/apps/agents-server/src/app/agents/[agentName]/book/useBookEditorWrapper.tsx +2 -0
  29. package/apps/agents-server/src/app/agents/[agentName]/chat/AgentGoalChatPlannedMessages.tsx +46 -3
  30. package/apps/agents-server/src/app/api/admin/default-agents/reinstate/route.ts +5 -1
  31. package/apps/agents-server/src/app/api/admin/planned-messages/[timeoutId]/route.ts +80 -0
  32. package/apps/agents-server/src/app/api/admin/planned-messages/route.ts +19 -0
  33. package/apps/agents-server/src/app/api/internal/agent-goal-chat-planned-messages/route.ts +30 -2
  34. package/apps/agents-server/src/components/DefaultAgents/ReinstateBundledAgentsButton.tsx +7 -0
  35. package/apps/agents-server/src/components/DefaultAgents/coreAgentsAdminRoute.ts +6 -0
  36. package/apps/agents-server/src/components/Header/buildHeaderSystemMenuItems.ts +7 -0
  37. package/apps/agents-server/src/components/Homepage/DefaultAgentsStatusNotice.tsx +1 -7
  38. package/apps/agents-server/src/database/migrations/2026-08-1800-user-chat-timeout-schedule.sql +11 -0
  39. package/apps/agents-server/src/instrumentation-node.ts +18 -0
  40. package/apps/agents-server/src/languages/ServerTranslationKeys.ts +4 -0
  41. package/apps/agents-server/src/languages/translations/czech.yaml +4 -0
  42. package/apps/agents-server/src/languages/translations/english.yaml +4 -0
  43. package/apps/agents-server/src/tools/agentGoalChatTimeoutToolFunctions.ts +62 -15
  44. package/apps/agents-server/src/tools/agentGoalChatTimeoutTools.ts +63 -9
  45. package/apps/agents-server/src/utils/adminEntityLookups/loadAgentNamesByPermanentId.ts +45 -0
  46. package/apps/agents-server/src/utils/adminEntityLookups/loadUsernamesByUserId.ts +36 -0
  47. package/apps/agents-server/src/utils/adminEntityLookups.ts +2 -0
  48. package/apps/agents-server/src/utils/agentGoalChat/agentGoalChatPlannedMessageActions.ts +299 -52
  49. package/apps/agents-server/src/utils/agentGoalChat/createAgentGoalChatNoteContent.ts +45 -17
  50. package/apps/agents-server/src/utils/agentGoalChat.ts +1 -0
  51. package/apps/agents-server/src/utils/agentProjects/agentProjectIdentity.ts +46 -0
  52. package/apps/agents-server/src/utils/agentProjects/agentProjectRuntimeAutostartScheduler.ts +162 -0
  53. package/apps/agents-server/src/utils/agentProjects/agentProjectRuntimeDesiredState.ts +252 -0
  54. package/apps/agents-server/src/utils/agentProjects/agentProjectRuntimeDisplay.ts +6 -3
  55. package/apps/agents-server/src/utils/agentProjects/agentProjectRuntimeDomains.ts +2 -44
  56. package/apps/agents-server/src/utils/agentProjects/agentProjectRuntimePaths.ts +25 -0
  57. package/apps/agents-server/src/utils/agentProjects/agentProjectRuntimePm2.ts +4 -3
  58. package/apps/agents-server/src/utils/agentProjects/agentProjectRuntimeRegistry.ts +77 -24
  59. package/apps/agents-server/src/utils/agentProjects/agentProjectStateMutationQueue.ts +58 -0
  60. package/apps/agents-server/src/utils/agentProjects/listAllLocalAgentProjectIdentities.ts +48 -0
  61. package/apps/agents-server/src/utils/agentProjects/resolveAgentProjectRuntimeEnvironmentFlag.ts +23 -0
  62. package/apps/agents-server/src/utils/agentProjects/resolveAgentProjectRuntimeStatus.ts +73 -0
  63. package/apps/agents-server/src/utils/agentProjects/startDefaultAgentProjectRuntimes.ts +110 -0
  64. package/apps/agents-server/src/utils/agentReferenceResolver/MissingCoreAgentRecovery.ts +19 -0
  65. package/apps/agents-server/src/utils/agentReferenceResolver/bookScopedAgentReferences.ts +7 -0
  66. package/apps/agents-server/src/utils/agentReferenceResolver/createAgentInheritanceDiagnostics.ts +457 -0
  67. package/apps/agents-server/src/utils/agentReferenceResolver/createUnresolvedAgentReferenceDiagnostics.ts +27 -0
  68. package/apps/agents-server/src/utils/agentReferenceResolver/resolveCoreAgentAwareMissingReferences.ts +156 -0
  69. package/apps/agents-server/src/utils/chatMessageChips/createAnsweredMessageChipToolCalls.ts +15 -3
  70. package/apps/agents-server/src/utils/chatMessageChips/createPlannedMessageChipToolCalls.ts +8 -3
  71. package/apps/agents-server/src/utils/chatMessageChips/createTouchedExternalSourceChipToolCalls.ts +39 -0
  72. package/apps/agents-server/src/utils/chatMessageChips/createTouchedProjectChipResult.ts +45 -0
  73. package/apps/agents-server/src/utils/chatMessageChips/createTouchedProjectChipToolCalls.ts +58 -24
  74. package/apps/agents-server/src/utils/cronExpression/CronExpression.ts +63 -0
  75. package/apps/agents-server/src/utils/cronExpression/normalizeCronExpression.ts +34 -0
  76. package/apps/agents-server/src/utils/cronExpression/normalizeCronExpressionWhitespace.ts +11 -0
  77. package/apps/agents-server/src/utils/cronExpression/parseCronExpression.ts +41 -0
  78. package/apps/agents-server/src/utils/cronExpression/parseCronExpressionField.ts +140 -0
  79. package/apps/agents-server/src/utils/cronExpression/resolveNextCronRun.ts +100 -0
  80. package/apps/agents-server/src/utils/cronExpression/throwInvalidCronExpressionField.ts +20 -0
  81. package/apps/agents-server/src/utils/cronExpression.ts +10 -0
  82. package/apps/agents-server/src/utils/explicitFromCommitment.ts +130 -0
  83. package/apps/agents-server/src/utils/getAdminChatTasksResponse/getAdminChatTasks/loadAdminChatTaskFallbackData.ts +3 -77
  84. package/apps/agents-server/src/utils/localChatRunner/applyLocalAgentPlannedMessageCommands.ts +53 -4
  85. package/apps/agents-server/src/utils/localChatRunner/prepareLocalAgentPlannedMessagesSidecar.ts +15 -7
  86. package/apps/agents-server/src/utils/localChatRunner/processLocalUserChatJob.ts +8 -0
  87. package/apps/agents-server/src/utils/manGoOnboarding/manGoOnboardingAgentBooks.ts +5 -11
  88. package/apps/agents-server/src/utils/manGoOnboarding/manGoOnboardingAgentRuntime.ts +2 -2
  89. package/apps/agents-server/src/utils/managementApi/managementApiSchemas.ts +2 -2
  90. package/apps/agents-server/src/utils/plannedMessageManager/cancelManagedPlannedMessage.ts +35 -0
  91. package/apps/agents-server/src/utils/plannedMessageManager/collectPlannedMessageAgentOptions.ts +56 -0
  92. package/apps/agents-server/src/utils/plannedMessageManager/createPlannedMessageManagerCounters.ts +104 -0
  93. package/apps/agents-server/src/utils/plannedMessageManager/filterPlannedMessages.ts +191 -0
  94. package/apps/agents-server/src/utils/plannedMessageManager/getPlannedMessageManagerResponse.ts +55 -0
  95. package/apps/agents-server/src/utils/plannedMessageManager/isPlannedMessageStillPlanned.ts +18 -0
  96. package/apps/agents-server/src/utils/plannedMessageManager/loadPlannedMessageManagerRecord.ts +32 -0
  97. package/apps/agents-server/src/utils/plannedMessageManager/mapPlannedMessageManagerRecord.ts +73 -0
  98. package/apps/agents-server/src/utils/plannedMessageManager/parsePlannedMessageManagerUpdateRequest.ts +76 -0
  99. package/apps/agents-server/src/utils/plannedMessageManager/resolvePlannedMessageEndReason.ts +59 -0
  100. package/apps/agents-server/src/utils/plannedMessageManager/resolvePlannedMessageLifecycle.ts +99 -0
  101. package/apps/agents-server/src/utils/plannedMessageManager/resolvePlannedMessageRecurrenceKind.ts +40 -0
  102. package/apps/agents-server/src/utils/plannedMessageManager/updateManagedPlannedMessage.ts +121 -0
  103. package/apps/agents-server/src/utils/plannedMessagesAdmin.ts +200 -0
  104. package/apps/agents-server/src/utils/resolveInheritedAgentSource.ts +114 -95
  105. package/apps/agents-server/src/utils/userChatClient.ts +4 -0
  106. package/apps/agents-server/src/utils/userChatTimeout/UserChatTimeoutRecord.ts +37 -1
  107. package/apps/agents-server/src/utils/userChatTimeout/agentScopedTimeoutBulkActions.ts +11 -17
  108. package/apps/agents-server/src/utils/userChatTimeout/createTimeoutWakeUpMessage.ts +37 -13
  109. package/apps/agents-server/src/utils/userChatTimeout/plannedMessageSchedule/PlannedMessageSchedule.ts +52 -0
  110. package/apps/agents-server/src/utils/userChatTimeout/plannedMessageSchedule/hasPlannedMessageRecurrence.ts +13 -0
  111. package/apps/agents-server/src/utils/userChatTimeout/plannedMessageSchedule/isPlannedMessageScheduleFinished.ts +30 -0
  112. package/apps/agents-server/src/utils/userChatTimeout/plannedMessageSchedule/normalizePlannedMessageScheduleValues.ts +62 -0
  113. package/apps/agents-server/src/utils/userChatTimeout/plannedMessageSchedule/parsePlannedMessageSchedule.ts +202 -0
  114. package/apps/agents-server/src/utils/userChatTimeout/plannedMessageSchedule/resolvePlannedMessageDueAt.ts +121 -0
  115. package/apps/agents-server/src/utils/userChatTimeout/plannedMessageSchedule.ts +12 -0
  116. package/apps/agents-server/src/utils/userChatTimeout/setAgentScopedUserChatTimeoutPausedState.ts +66 -0
  117. package/apps/agents-server/src/utils/userChatTimeout/userChatTimeoutStore/createUserChatTimeout.ts +76 -5
  118. package/apps/agents-server/src/utils/userChatTimeout/userChatTimeoutStore/listAllUserChatTimeouts.ts +37 -0
  119. package/apps/agents-server/src/utils/userChatTimeout/userChatTimeoutStore/mapUserChatTimeoutRow.ts +9 -0
  120. package/apps/agents-server/src/utils/userChatTimeout/userChatTimeoutStore/repeatFiredUserChatTimeout.ts +19 -9
  121. package/apps/agents-server/src/utils/userChatTimeout/userChatTimeoutStore/updateAgentScopedUserChatTimeout.ts +39 -6
  122. package/apps/agents-server/src/utils/userChatTimeout/userChatTimeoutStore.ts +1 -0
  123. package/apps/agents-server/src/utils/userChatTimeout/userChatTimeoutWorker.ts +110 -11
  124. package/apps/agents-server/src/utils/userChatTimeout.ts +16 -0
  125. package/apps/agents-server/src/utils/vpsSelfUpdate/vpsSelfUpdateCron.ts +23 -316
  126. package/apps/agents-server/tests/e2e/support/AgentManagementApi.ts +3 -3
  127. package/esm/index.es.js +951 -102
  128. package/esm/index.es.js.map +1 -1
  129. package/esm/scripts/run-agent-messages/git/commitAgentProjectChanges.d.ts +15 -0
  130. package/esm/scripts/run-agent-messages/git/commitAnsweredMessageProjectChanges.d.ts +24 -0
  131. package/esm/scripts/run-agent-messages/git/ensureAgentProjectGitRepository.d.ts +20 -0
  132. package/esm/scripts/run-agent-messages/git/readAgentProjectCommitChange.d.ts +11 -0
  133. package/esm/scripts/run-agent-messages/git/runAgentProjectGitCommand.d.ts +29 -0
  134. package/esm/scripts/run-agent-messages/messages/buildAgentGoalChatPromptSection.d.ts +3 -3
  135. package/esm/scripts/run-agent-messages/messages/listAgentProjectDirectoryNames.d.ts +7 -0
  136. package/esm/scripts/run-agent-messages/messages/resolveAnsweredMessageTouches.d.ts +29 -0
  137. package/esm/scripts/run-codex-prompts/ping/pingCoderHarnessPeriodically.d.ts +22 -0
  138. package/esm/src/book-3.0/AgentMessageRunReport.d.ts +18 -0
  139. package/esm/src/book-3.0/AgentPlannedMessagesSidecar.d.ts +38 -5
  140. package/esm/src/book-3.0/describeAgentPlannedMessageSchedule.d.ts +31 -0
  141. package/esm/src/book-components/BookEditor/createDeprecatedCommitmentDiagnostics.browser.d.ts +1 -9
  142. package/esm/src/book-components/BookEditor/createDuplicateFromCommitmentDiagnostics.d.ts +28 -0
  143. package/esm/src/book-components/BookEditor/createDuplicateFromCommitmentDiagnostics.test.d.ts +1 -0
  144. package/esm/src/book-components/Chat/Chat/renderAgentProjectDiff.d.ts +13 -0
  145. package/esm/src/book-components/Chat/Chat/renderAgentProjectToolCallDetails.d.ts +16 -0
  146. package/esm/src/book-components/Chat/utils/agentProjectToolCall.d.ts +39 -0
  147. package/esm/src/book-components/Chat/utils/agentProjectToolCall.test.d.ts +1 -0
  148. package/esm/src/book-components/Chat/utils/externalSourceToolCall.d.ts +38 -0
  149. package/esm/src/book-components/Chat/utils/timeoutToolCallPresentation.d.ts +6 -0
  150. package/esm/src/cli/cli-commands/coder/waitOptions.d.ts +12 -0
  151. package/esm/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +15 -0
  152. package/esm/src/utils/agent-message-runtime/AgentMessageProjectChange.d.ts +76 -0
  153. package/esm/src/utils/agent-message-runtime/AgentMessageTouchedExternalSource.d.ts +45 -0
  154. package/esm/src/utils/agent-message-runtime/parseAgentMessageRuntimeLogEvents.d.ts +3 -0
  155. package/esm/src/utils/agent-message-runtime/resolveAgentMessageTouchedExternalSources.d.ts +18 -0
  156. package/esm/src/utils/agent-message-runtime/resolveAgentMessageTouchedExternalSources.test.d.ts +1 -0
  157. package/esm/src/utils/random/$generateBookBoilerplate.test.d.ts +1 -0
  158. package/esm/src/version.d.ts +1 -1
  159. package/package.json +1 -1
  160. package/src/book-2.0/agent-source/string_book.ts +1 -1
  161. package/src/book-2.0/book-language-documentation/czechBookLanguageManualDictionary.ts +6 -1
  162. package/src/book-2.0/book-language-documentation/englishBookLanguageManualDictionary.ts +6 -1
  163. package/src/book-3.0/AgentMessageRunReport.ts +59 -0
  164. package/src/book-3.0/AgentPlannedMessagesSidecar.ts +64 -9
  165. package/src/book-3.0/describeAgentPlannedMessageSchedule.ts +94 -0
  166. package/src/book-components/BookEditor/BookEditorMonaco.tsx +2 -0
  167. package/src/book-components/BookEditor/createDeprecatedCommitmentDiagnostics.browser.ts +3 -11
  168. package/src/book-components/BookEditor/createDuplicateFromCommitmentDiagnostics.ts +71 -0
  169. package/src/book-components/Chat/Chat/Chat.module.css +165 -18
  170. package/src/book-components/Chat/Chat/ChatMessageMap.tsx +0 -1
  171. package/src/book-components/Chat/Chat/renderAgentProjectDiff.tsx +85 -0
  172. package/src/book-components/Chat/Chat/renderAgentProjectToolCallDetails.tsx +206 -0
  173. package/src/book-components/Chat/Chat/renderToolCallDetails.tsx +8 -0
  174. package/src/book-components/Chat/MarkdownContent/MarkdownContent.tsx +2 -3
  175. package/src/book-components/Chat/utils/agentProjectToolCall.ts +82 -5
  176. package/src/book-components/Chat/utils/externalSourceToolCall.ts +65 -0
  177. package/src/book-components/Chat/utils/getToolCallChipletInfo.ts +36 -0
  178. package/src/book-components/Chat/utils/renderMarkdown.ts +3 -10
  179. package/src/book-components/Chat/utils/timeoutToolCallPresentation.ts +12 -1
  180. package/src/cli/cli-commands/coder/ping.ts +35 -9
  181. package/src/cli/cli-commands/coder/waitOptions.ts +33 -0
  182. package/src/cli/cli-commands/common/harness/$applyHarnessInstallationStatus.ts +3 -1
  183. package/src/cli/cli-commands/common/harness/$checkHarnessInstallation.ts +3 -1
  184. package/src/cli/cli-commands/common/harnessUpdateCliOptions.ts +1 -4
  185. package/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.ts +47 -3
  186. package/src/commands/FORMAT/formatCommandParser.ts +4 -2
  187. package/src/commitments/FROM/FROM.ts +13 -0
  188. package/src/other/templates/getTemplatesPipelineCollection.ts +819 -751
  189. package/src/utils/agent-message-runtime/AgentMessageProjectChange.ts +183 -0
  190. package/src/utils/agent-message-runtime/AgentMessageTouchedExternalSource.ts +80 -0
  191. package/src/utils/agent-message-runtime/parseAgentMessageRuntimeLogEvents.ts +3 -0
  192. package/src/utils/agent-message-runtime/resolveAgentMessageRuntimeActivity.ts +2 -4
  193. package/src/utils/agent-message-runtime/resolveAgentMessageTouchedExternalSources.ts +341 -0
  194. package/src/utils/random/$generateBookBoilerplate.ts +1 -1
  195. package/src/version.ts +2 -2
  196. package/src/versions.txt +5 -0
  197. package/umd/index.umd.js +950 -101
  198. package/umd/index.umd.js.map +1 -1
  199. package/umd/scripts/run-agent-messages/git/commitAgentProjectChanges.d.ts +15 -0
  200. package/umd/scripts/run-agent-messages/git/commitAnsweredMessageProjectChanges.d.ts +24 -0
  201. package/umd/scripts/run-agent-messages/git/ensureAgentProjectGitRepository.d.ts +20 -0
  202. package/umd/scripts/run-agent-messages/git/readAgentProjectCommitChange.d.ts +11 -0
  203. package/umd/scripts/run-agent-messages/git/runAgentProjectGitCommand.d.ts +29 -0
  204. package/umd/scripts/run-agent-messages/messages/buildAgentGoalChatPromptSection.d.ts +3 -3
  205. package/umd/scripts/run-agent-messages/messages/listAgentProjectDirectoryNames.d.ts +7 -0
  206. package/umd/scripts/run-agent-messages/messages/resolveAnsweredMessageTouches.d.ts +29 -0
  207. package/umd/scripts/run-codex-prompts/ping/pingCoderHarnessPeriodically.d.ts +22 -0
  208. package/umd/src/book-3.0/AgentMessageRunReport.d.ts +18 -0
  209. package/umd/src/book-3.0/AgentPlannedMessagesSidecar.d.ts +38 -5
  210. package/umd/src/book-3.0/describeAgentPlannedMessageSchedule.d.ts +31 -0
  211. package/umd/src/book-components/BookEditor/createDeprecatedCommitmentDiagnostics.browser.d.ts +1 -9
  212. package/umd/src/book-components/BookEditor/createDuplicateFromCommitmentDiagnostics.d.ts +28 -0
  213. package/umd/src/book-components/BookEditor/createDuplicateFromCommitmentDiagnostics.test.d.ts +1 -0
  214. package/umd/src/book-components/Chat/Chat/renderAgentProjectDiff.d.ts +13 -0
  215. package/umd/src/book-components/Chat/Chat/renderAgentProjectToolCallDetails.d.ts +16 -0
  216. package/umd/src/book-components/Chat/utils/agentProjectToolCall.d.ts +39 -0
  217. package/umd/src/book-components/Chat/utils/agentProjectToolCall.test.d.ts +1 -0
  218. package/umd/src/book-components/Chat/utils/externalSourceToolCall.d.ts +38 -0
  219. package/umd/src/book-components/Chat/utils/timeoutToolCallPresentation.d.ts +6 -0
  220. package/umd/src/cli/cli-commands/coder/waitOptions.d.ts +12 -0
  221. package/umd/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +15 -0
  222. package/umd/src/utils/agent-message-runtime/AgentMessageProjectChange.d.ts +76 -0
  223. package/umd/src/utils/agent-message-runtime/AgentMessageTouchedExternalSource.d.ts +45 -0
  224. package/umd/src/utils/agent-message-runtime/parseAgentMessageRuntimeLogEvents.d.ts +3 -0
  225. package/umd/src/utils/agent-message-runtime/resolveAgentMessageTouchedExternalSources.d.ts +18 -0
  226. package/umd/src/utils/agent-message-runtime/resolveAgentMessageTouchedExternalSources.test.d.ts +1 -0
  227. package/umd/src/utils/random/$generateBookBoilerplate.test.d.ts +1 -0
  228. package/umd/src/version.d.ts +1 -1
  229. package/apps/agents-server/src/app/admin/task-manager/TaskManagerScopeTabs.tsx +0 -74
  230. package/esm/scripts/run-agent-messages/messages/resolveTouchedAgentProjects.d.ts +0 -15
  231. package/umd/scripts/run-agent-messages/messages/resolveTouchedAgentProjects.d.ts +0 -15
@@ -0,0 +1,65 @@
1
+ import type {
2
+ AgentMessageTouchedExternalSource,
3
+ AgentMessageTouchedExternalSourceKind,
4
+ } from '../../../utils/agent-message-runtime/AgentMessageTouchedExternalSource';
5
+ import { normalizeAgentMessageTouchedExternalSource } from '../../../utils/agent-message-runtime/AgentMessageTouchedExternalSource';
6
+
7
+ /**
8
+ * Synthetic tool name used for external-source chips in chat UI.
9
+ *
10
+ * The Agents Server emits one such tool call per source outside the agent an answer viewed or
11
+ * edited, so the chat shows which services, websites and searches the agent really reached below
12
+ * the message that touched them. Work the agent does inside itself emits nothing.
13
+ *
14
+ * @private internal chat-ui marker for touched external sources
15
+ */
16
+ export const EXTERNAL_SOURCE_TOOL_CALL_NAME = 'external_source_touched';
17
+
18
+ /**
19
+ * Emoji shown in the chip of each external source category.
20
+ *
21
+ * @private internal chat-ui constant for touched external sources
22
+ */
23
+ const EXTERNAL_SOURCE_EMOJI_BY_KIND: Readonly<Record<AgentMessageTouchedExternalSourceKind, string>> = {
24
+ integration: '🔌',
25
+ website: '🌐',
26
+ search: '🔎',
27
+ };
28
+
29
+ /**
30
+ * Parses the external-source chip payload from one tool result.
31
+ *
32
+ * @param result - Raw tool result payload.
33
+ * @returns Parsed source metadata, or `null` when the result describes no external source.
34
+ *
35
+ * @private internal helper reused by chip and modal rendering
36
+ */
37
+ export function parseExternalSourceToolCallResult(result: unknown): AgentMessageTouchedExternalSource | null {
38
+ return normalizeAgentMessageTouchedExternalSource(result);
39
+ }
40
+
41
+ /**
42
+ * Resolves the chip label of one touched external source.
43
+ *
44
+ * @param externalSource - Parsed source metadata.
45
+ * @returns User-facing name of the source.
46
+ *
47
+ * @private internal helper reused by chip and modal rendering
48
+ */
49
+ export function resolveExternalSourceToolCallLabel(externalSource: AgentMessageTouchedExternalSource): string {
50
+ return externalSource.name;
51
+ }
52
+
53
+ /**
54
+ * Resolves the chip emoji of one touched external source.
55
+ *
56
+ * @param externalSource - Parsed source metadata.
57
+ * @returns Emoji telling apart an integration, a website and a search.
58
+ *
59
+ * @private internal helper reused by chip and modal rendering
60
+ */
61
+ export function resolveExternalSourceToolCallEmoji(externalSource: AgentMessageTouchedExternalSource): string {
62
+ return EXTERNAL_SOURCE_EMOJI_BY_KIND[externalSource.kind];
63
+ }
64
+
65
+ // Note: [💞] Ignore a discrepancy between file name and entity name
@@ -6,6 +6,12 @@ import {
6
6
  parseAgentProjectToolCallResult,
7
7
  resolveAgentProjectToolCallLabel,
8
8
  } from './agentProjectToolCall';
9
+ import {
10
+ EXTERNAL_SOURCE_TOOL_CALL_NAME,
11
+ parseExternalSourceToolCallResult,
12
+ resolveExternalSourceToolCallEmoji,
13
+ resolveExternalSourceToolCallLabel,
14
+ } from './externalSourceToolCall';
9
15
  import { formatToolCallLocalTime } from './formatToolCallLocalTime';
10
16
  import { formatToolCallTranslationTemplate } from './formatToolCallTranslationTemplate';
11
17
  import {
@@ -118,6 +124,7 @@ type ToolCallChipletResolver = (context: ToolCallChipletContext) => ToolCallChip
118
124
  const SPECIALIZED_TOOL_CALL_CHIPLET_RESOLVERS: ReadonlyArray<ToolCallChipletResolver> = [
119
125
  resolveWalletCredentialChipletInfo,
120
126
  resolveAgentProjectToolCallChipletInfo,
127
+ resolveExternalSourceToolCallChipletInfo,
121
128
  resolveTeamToolCallChipletInfo,
122
129
  resolveTimeToolCallChipletInfo,
123
130
  resolveEmailToolCallChipletInfo,
@@ -147,6 +154,7 @@ export const TOOL_TITLES: Record<string, { title: string; emoji: string }> = {
147
154
  [ASSISTANT_PREPARATION_TOOL_CALL_NAME]: { title: 'Preparing agent', emoji: '✨' },
148
155
  [WALLET_CREDENTIAL_TOOL_CALL_NAME]: { title: 'Credential used', emoji: '🔐' },
149
156
  [AGENT_PROJECT_TOOL_CALL_NAME]: { title: 'Project', emoji: '📁' },
157
+ [EXTERNAL_SOURCE_TOOL_CALL_NAME]: { title: 'External source', emoji: '🌐' },
150
158
  'self-learning': { title: 'self-learning', emoji: '🧠' },
151
159
  retrieve_user_memory: { title: 'Reading memory', emoji: '🧠' },
152
160
  store_user_memory: { title: 'Storing memory', emoji: '🧠' },
@@ -348,6 +356,34 @@ function resolveAgentProjectToolCallChipletInfo(context: ToolCallChipletContext)
348
356
  return createEmojiToolCallChipletInfo(context, resolveAgentProjectToolCallLabel(projectResult));
349
357
  }
350
358
 
359
+ /**
360
+ * Resolves the source-name chip label for touched external sources.
361
+ *
362
+ * The emoji tells apart an integration, a website and a search, so it overrides the single emoji
363
+ * registered for the tool name itself.
364
+ *
365
+ * @param context - Shared chiplet resolution context.
366
+ * @returns Chiplet info when the tool call marks a touched external source, otherwise `null`.
367
+ *
368
+ * @private utility of `<Chat/>`
369
+ */
370
+ function resolveExternalSourceToolCallChipletInfo(context: ToolCallChipletContext): ToolCallChipletInfo | null {
371
+ if (context.toolCall.name !== EXTERNAL_SOURCE_TOOL_CALL_NAME) {
372
+ return null;
373
+ }
374
+
375
+ const externalSource = parseExternalSourceToolCallResult(context.resultRaw);
376
+ if (!externalSource) {
377
+ return null;
378
+ }
379
+
380
+ return {
381
+ text: `${resolveExternalSourceToolCallEmoji(externalSource)} ${resolveExternalSourceToolCallLabel(
382
+ externalSource,
383
+ )}`,
384
+ };
385
+ }
386
+
351
387
  /**
352
388
  * Resolves a chip label and agent metadata for TEAM tool calls.
353
389
  *
@@ -162,8 +162,7 @@ const INLINE_REFERENCE_MENU_OPTION_MARKER_ATTRIBUTE = 'data-promptbook-inline-re
162
162
  *
163
163
  * @private utility shared with `MarkdownContent`
164
164
  */
165
- export const MARKDOWN_INLINE_REFERENCE_MENU_ACTION_ATTRIBUTE =
166
- 'data-promptbook-inline-reference-menu-action';
165
+ export const MARKDOWN_INLINE_REFERENCE_MENU_ACTION_ATTRIBUTE = 'data-promptbook-inline-reference-menu-action';
167
166
 
168
167
  /**
169
168
  * Attribute identifying the inline reference which owns a client menu action.
@@ -1159,9 +1158,7 @@ function createMarkdownInlineReferenceTextAliasRegex(
1159
1158
  const escapedAlias = escapeRegularExpression(sourceTextAlias);
1160
1159
  const boundaryCharacterClass = '\\p{L}\\p{N}_-';
1161
1160
  const boundaryPattern = `[^${boundaryCharacterClass}]`;
1162
- const aliasPattern = isMarkdownFormattingMatched
1163
- ? `(?:\\*\\*|__)${escapedAlias}(?:\\*\\*|__)`
1164
- : escapedAlias;
1161
+ const aliasPattern = isMarkdownFormattingMatched ? `(?:\\*\\*|__)${escapedAlias}(?:\\*\\*|__)` : escapedAlias;
1165
1162
 
1166
1163
  return new RegExp(`(^|${boundaryPattern})${aliasPattern}(?=$|${boundaryPattern})`, 'giu');
1167
1164
  }
@@ -1645,11 +1642,7 @@ function applyMarkdownInlineReferences(markdown: string_markdown, options?: Rend
1645
1642
  const { masked: markdownWithMaskedLinksAndUrls, restore: restoreLinksAndUrls } =
1646
1643
  maskMarkdownLinksAndBareUrls(referencedMarkdown);
1647
1644
  referencedMarkdown = restoreLinksAndUrls(
1648
- replaceMarkdownInlineReferenceTextAliases(
1649
- markdownWithMaskedLinksAndUrls,
1650
- textMatchers,
1651
- createPlaceholder,
1652
- ),
1645
+ replaceMarkdownInlineReferenceTextAliases(markdownWithMaskedLinksAndUrls, textMatchers, createPlaceholder),
1653
1646
  );
1654
1647
  }
1655
1648
 
@@ -9,6 +9,13 @@ import { formatToolCallTranslationTemplate } from './formatToolCallTranslationTe
9
9
  */
10
10
  export const SET_TIMEOUT_TOOL_CALL_NAME = 'set_timeout';
11
11
 
12
+ /**
13
+ * Tool name of one re-planned wake-up, used by every producer of timeout chips.
14
+ *
15
+ * @private internal timeout-chat constant
16
+ */
17
+ export const UPDATE_TIMEOUT_TOOL_CALL_NAME = 'update_timeout';
18
+
12
19
  /**
13
20
  * Tool name of one cancelled wake-up, used by every producer of timeout chips.
14
21
  *
@@ -21,7 +28,11 @@ export const CANCEL_TIMEOUT_TOOL_CALL_NAME = 'cancel_timeout';
21
28
  *
22
29
  * @private internal timeout-chat constant
23
30
  */
24
- const TIMEOUT_TOOL_NAMES = [SET_TIMEOUT_TOOL_CALL_NAME, CANCEL_TIMEOUT_TOOL_CALL_NAME] as const;
31
+ const TIMEOUT_TOOL_NAMES = [
32
+ SET_TIMEOUT_TOOL_CALL_NAME,
33
+ UPDATE_TIMEOUT_TOOL_CALL_NAME,
34
+ CANCEL_TIMEOUT_TOOL_CALL_NAME,
35
+ ] as const;
25
36
 
26
37
  /**
27
38
  * Milliseconds in one second.
@@ -17,6 +17,7 @@ import {
17
17
  normalizePromptRunnerSelectionCliOptions,
18
18
  PROMPT_RUNNER_DESCRIPTION,
19
19
  } from '../common/promptRunnerCliOptions';
20
+ import { parseOptionalPeriodDuration } from './waitOptions';
20
21
 
21
22
  /**
22
23
  * Initializes `coder ping` command for Promptbook CLI utilities
@@ -37,6 +38,7 @@ export function $initializeCoderPingCommand(program: Program): $side_effect {
37
38
  - Verifies that the selected harness, model, thinking level and authentication really work
38
39
  - Reports the answer of the harness, the response time and the reported usage
39
40
  - Starts the hourly/weekly quota window before you need it, so it is already refreshing when you do
41
+ - Optional --period keeps the quota window refreshing by pinging once per period until stopped
40
42
  - Leaves the project exactly as it was — nothing is read, written, changed or committed
41
43
  - Checks that the selected harness is installed globally and up to date unless --no-harness-update is used
42
44
  - Use --no-ui to stream the raw harness output instead of only the compact result
@@ -46,9 +48,20 @@ export function $initializeCoderPingCommand(program: Program): $side_effect {
46
48
  addPromptRunnerSelectionOptions(command);
47
49
  addHarnessUpdateOption(command);
48
50
  addPromptRunnerRuntimeOptions(command);
51
+ command.option(
52
+ '--period <duration>',
53
+ spaceTrim(`
54
+ Keep pinging once per period instead of pinging only once.
55
+ Accepts durations like 5h, 30m, 1h30m and repeats until it is stopped with CTRL+C.
56
+ `),
57
+ );
49
58
 
50
59
  command.action(
51
60
  handleActionErrors(async (cliOptions) => {
61
+ const { period: periodValue } = cliOptions as {
62
+ readonly period?: string;
63
+ } & PromptRunnerSelectionCliOptions;
64
+
52
65
  const runnerOptions = normalizePromptRunnerSelectionCliOptions(
53
66
  cliOptions as PromptRunnerSelectionCliOptions,
54
67
  { isAgentRequired: true },
@@ -57,23 +70,36 @@ export function $initializeCoderPingCommand(program: Program): $side_effect {
57
70
  cliOptions as HarnessUpdateCliOptions,
58
71
  );
59
72
 
60
- await $ensureHarnessInstallations([runnerOptions.agentName], isHarnessUpdateCheckEnabled);
73
+ // Note: The period is validated before the harness installation check, so a mistyped duration fails fast
74
+ const periodMs = parseOptionalPeriodDuration('--period', periodValue);
61
75
 
62
- // Note: Import the ping dynamically to avoid loading heavy dependencies until needed
63
- const { pingCoderHarness } = await import('../../../../scripts/run-codex-prompts/ping/pingCoderHarness');
64
- const { printCoderPingResult } = await import(
65
- '../../../../scripts/run-codex-prompts/ping/printCoderPingResult'
66
- );
76
+ await $ensureHarnessInstallations([runnerOptions.agentName], isHarnessUpdateCheckEnabled);
67
77
 
68
- const result = await pingCoderHarness({
78
+ const pingOptions = {
69
79
  agentName: runnerOptions.agentName,
70
80
  model: runnerOptions.model,
71
81
  thinkingLevel: runnerOptions.thinkingLevel,
72
82
  allowCredits: runnerOptions.allowCredits,
73
83
  shouldPrintLiveOutput: runnerOptions.noUi,
74
- });
84
+ };
85
+
86
+ // Note: Import the ping dynamically to avoid loading heavy dependencies until needed
87
+ if (periodMs !== undefined) {
88
+ const { pingCoderHarnessPeriodically } = await import(
89
+ '../../../../scripts/run-codex-prompts/ping/pingCoderHarnessPeriodically'
90
+ );
91
+
92
+ // Note: This never returns - it keeps pinging until the user stops the process
93
+ await pingCoderHarnessPeriodically({ ...pingOptions, periodMs });
94
+ return;
95
+ }
96
+
97
+ const { pingCoderHarness } = await import('../../../../scripts/run-codex-prompts/ping/pingCoderHarness');
98
+ const { printCoderPingResult } = await import(
99
+ '../../../../scripts/run-codex-prompts/ping/printCoderPingResult'
100
+ );
75
101
 
76
- printCoderPingResult(result);
102
+ printCoderPingResult(await pingCoderHarness(pingOptions));
77
103
  }),
78
104
  );
79
105
  }
@@ -1,4 +1,6 @@
1
+ import { spaceTrim } from 'spacetrim';
1
2
  import { parseDuration } from '../../../../scripts/run-codex-prompts/common/parseDuration';
3
+ import { NotAllowed } from '../../../errors/NotAllowed';
2
4
 
3
5
  /**
4
6
  * Default wait duration applied before retrying a prompt round after an error (10 minutes).
@@ -21,4 +23,35 @@ export function parseOptionalWaitDuration(value: string | undefined, defaultMs:
21
23
  return parseDuration(value);
22
24
  }
23
25
 
26
+ /**
27
+ * Parses an optional Commander period duration string and returns the resolved milliseconds.
28
+ *
29
+ * Returns `undefined` when the flag was not provided or was provided without a non-empty value,
30
+ * which means the command runs only once instead of repeating itself.
31
+ *
32
+ * @throws {NotAllowed} When the duration is not a positive one, because a non-positive period
33
+ * would repeat the command without ever pausing between two rounds
34
+ *
35
+ * @private internal utility of `ptbk coder` wait handling
36
+ */
37
+ export function parseOptionalPeriodDuration(optionName: string, value: string | undefined): number | undefined {
38
+ if (typeof value !== 'string' || value === '') {
39
+ return undefined;
40
+ }
41
+
42
+ const periodMs = parseDuration(value);
43
+
44
+ if (periodMs <= 0) {
45
+ throw new NotAllowed(
46
+ spaceTrim(`
47
+ Invalid value for \`${optionName}\`: \`${value}\`.
48
+
49
+ Use a **positive** duration like \`5h\`, \`30m\` or \`1h30m\`.
50
+ `),
51
+ );
52
+ }
53
+
54
+ return periodMs;
55
+ }
56
+
24
57
  // Note: [💞] Ignore a discrepancy between file name and entity name
@@ -21,7 +21,9 @@ export async function $applyHarnessInstallationStatus(status: HarnessInstallatio
21
21
  }
22
22
 
23
23
  if (installationState === 'installed') {
24
- console.info(colors.gray(`✔ ${definition.label} ${installedVersion} is installed. Skipped checking for updates.`));
24
+ console.info(
25
+ colors.gray(`✔ ${definition.label} ${installedVersion} is installed. Skipped checking for updates.`),
26
+ );
25
27
  return;
26
28
  }
27
29
 
@@ -17,7 +17,9 @@ export async function $checkHarnessInstallation(
17
17
  ): Promise<HarnessInstallationStatus> {
18
18
  const [installedVersion, latestVersion] = await Promise.all([
19
19
  $resolveInstalledHarnessVersion(definition),
20
- isHarnessUpdateCheckEnabled ? $resolveLatestNpmPackageVersion(definition.npmPackageName) : Promise.resolve(null),
20
+ isHarnessUpdateCheckEnabled
21
+ ? $resolveLatestNpmPackageVersion(definition.npmPackageName)
22
+ : Promise.resolve(null),
21
23
  ]);
22
24
 
23
25
  return {
@@ -26,10 +26,7 @@ export type NormalizedHarnessUpdateCliOptions = {
26
26
  * @private internal utility of `promptbookCli`
27
27
  */
28
28
  export function addHarnessUpdateOption(command: Program): void {
29
- command.option(
30
- '--no-harness-update',
31
- 'Skip checking whether globally installed coding harnesses are up to date',
32
- );
29
+ command.option('--no-harness-update', 'Skip checking whether globally installed coding harnesses are up to date');
33
30
  }
34
31
 
35
32
  /**
@@ -214,20 +214,64 @@ export class AgentCollectionInSupabase /* TODO: [🌈][🐱‍🚀] implements A
214
214
 
215
215
  /**
216
216
  * Retrieves the permanent ID of an agent by its name or permanent ID.
217
+ *
218
+ * An agent that still exists always wins over a soft-deleted one, so a name that was deleted and
219
+ * later created again resolves to the agent that is live now instead of to the recycle-bin leftover.
220
+ * Soft-deleted agents stay resolvable as a fallback because the recycle bin restores them by name
221
+ * or permanent id.
217
222
  */
218
223
  public async getAgentPermanentId(
219
224
  agentNameOrPermanentId: string_agent_name | string_agent_permanent_id,
220
225
  ): Promise<string_agent_permanent_id> {
221
- const selectResult = await this.supabaseClient
226
+ const activeAgentPermanentId = await this.findAgentPermanentId(agentNameOrPermanentId, {
227
+ isDeletedAgentIncluded: false,
228
+ });
229
+
230
+ if (activeAgentPermanentId !== null) {
231
+ return activeAgentPermanentId;
232
+ }
233
+
234
+ const deletedAgentPermanentId = await this.findAgentPermanentId(agentNameOrPermanentId, {
235
+ isDeletedAgentIncluded: true,
236
+ });
237
+
238
+ if (deletedAgentPermanentId !== null) {
239
+ return deletedAgentPermanentId;
240
+ }
241
+
242
+ throw new NotFoundError(`Agent with name or id "${agentNameOrPermanentId}" not found`);
243
+ }
244
+
245
+ /**
246
+ * Looks up the permanent id of the oldest agent matching one name or permanent id.
247
+ *
248
+ * @param agentNameOrPermanentId - Agent name or stable permanent identifier to match.
249
+ * @param options - Whether soft-deleted agents may be matched as well.
250
+ * @returns Permanent id of the matched agent, or `null` when nothing matches.
251
+ *
252
+ * @private internal helper of `AgentCollectionInSupabase`
253
+ */
254
+ private async findAgentPermanentId(
255
+ agentNameOrPermanentId: string_agent_name | string_agent_permanent_id,
256
+ options: { readonly isDeletedAgentIncluded: boolean },
257
+ ): Promise<string_agent_permanent_id | null> {
258
+ const selectQuery = this.supabaseClient
222
259
  .from(this.getTableName('Agent'))
223
260
  .select('permanentId')
224
- .or(buildAgentNameOrPermanentIdFilter(agentNameOrPermanentId))
261
+ .or(buildAgentNameOrPermanentIdFilter(agentNameOrPermanentId));
262
+
263
+ if (!options.isDeletedAgentIncluded) {
264
+ selectQuery.is('deletedAt', null);
265
+ }
266
+
267
+ const selectResult = await selectQuery
225
268
  .order('createdAt', { ascending: true }) // Pick oldest if multiple match by name
226
269
  .limit(1);
227
270
 
228
271
  if (selectResult.error || !selectResult.data || selectResult.data.length === 0) {
229
- throw new NotFoundError(`Agent with name or id "${agentNameOrPermanentId}" not found`);
272
+ return null;
230
273
  }
274
+
231
275
  return selectResult.data[0]!.permanentId as string_agent_permanent_id;
232
276
  }
233
277
 
@@ -70,8 +70,10 @@ export const formatCommandParser: PipelineTaskCommandParser<FormatCommand> = {
70
70
  */
71
71
  $applyToTaskJson(command: FormatCommand, $taskJson: $TaskJson): $side_effect {
72
72
  if ($taskJson.format !== undefined && command.format !== $taskJson.format) {
73
- throw new ParseError(spaceTrim(`Format format is already defined to "${$taskJson.format}".
74
- Now you try to redefine it by "${command.format}"`));
73
+ throw new ParseError(
74
+ spaceTrim(`Format format is already defined to "${$taskJson.format}".
75
+ Now you try to redefine it by "${command.format}"`),
76
+ );
75
77
  }
76
78
  $taskJson.format = command.format;
77
79
  },
@@ -46,6 +46,12 @@ export class FromCommitmentDefinition extends BaseCommitmentDefinition<'FROM'> {
46
46
 
47
47
  Inherits agent source from another agent.
48
48
 
49
+ Every agent inherits from the core agent \`@Adam\` unless it says otherwise, so writing no ${this.type} at all
50
+ is the same as writing \`${this.type} @Adam\`. Write \`${this.type} @Null\` to inherit from nothing.
51
+
52
+ An agent has exactly one parent, so when ${this.type} is written more than once, the last one wins and
53
+ overrides every earlier one.
54
+
49
55
  ## Examples
50
56
 
51
57
  \`\`\`book
@@ -54,6 +60,13 @@ export class FromCommitmentDefinition extends BaseCommitmentDefinition<'FROM'> {
54
60
  FROM https://s6.ptbk.io/benjamin-white
55
61
  RULE Speak only in English.
56
62
  \`\`\`
63
+
64
+ \`\`\`book
65
+ My Standalone Agent
66
+
67
+ FROM @Null
68
+ RULE Speak only in English.
69
+ \`\`\`
57
70
  `);
58
71
  }
59
72