@promptbook/remote-server 0.114.0-4 → 0.114.0-41

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 (326) hide show
  1. package/README.md +9 -9
  2. package/esm/index.es.js +543 -115
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/src/_packages/components.index.d.ts +4 -0
  5. package/esm/src/_packages/types.index.d.ts +4 -0
  6. package/esm/src/avatars/renderAvatarVisualTerminalText.d.ts +80 -0
  7. package/esm/src/avatars/types/AvatarVisualDefinition.d.ts +54 -0
  8. package/esm/src/book-2.0/agent-source/AgentReferenceResolutionIssue.d.ts +45 -0
  9. package/esm/src/book-2.0/agent-source/AgentSourceParseResult.d.ts +5 -0
  10. package/esm/src/book-2.0/agent-source/ParsedUnknownCommitment.d.ts +26 -0
  11. package/esm/src/book-2.0/agent-source/deduplicateSystemMessage.d.ts +14 -0
  12. package/esm/src/book-2.0/agent-source/explicitFromCommitment.d.ts +62 -0
  13. package/esm/src/book-2.0/agent-source/extractAgentReferenceTokens.d.ts +32 -0
  14. package/esm/src/book-2.0/agent-source/getBookCommitmentLineType.d.ts +19 -0
  15. package/esm/src/book-2.0/agent-source/parseAgentSourceWithCommitments.unknown.test.d.ts +1 -0
  16. package/esm/src/book-2.0/agent-source/resolveInheritedAgentSource.d.ts +73 -0
  17. package/esm/src/book-2.0/book-language-documentation/getSafeCodeBlock.d.ts +1 -1
  18. package/esm/src/book-3.0/AgentMessageRunReport.d.ts +46 -0
  19. package/esm/src/book-3.0/AgentPlannedMessagesSidecar.d.ts +127 -0
  20. package/esm/src/book-3.0/AgentPlannedMessagesSidecar.test.d.ts +1 -0
  21. package/esm/src/book-3.0/AgentTeamConversationWorkspace.d.ts +85 -0
  22. package/esm/src/book-3.0/cliAgentEnv.d.ts +3 -3
  23. package/esm/src/book-3.0/createAgentMessageSidecarBaseName.d.ts +13 -0
  24. package/esm/src/book-3.0/describeAgentPlannedMessageSchedule.d.ts +31 -0
  25. package/esm/src/book-components/BookEditor/createDeprecatedCommitmentDiagnostics.browser.d.ts +1 -9
  26. package/esm/src/book-components/BookEditor/createDuplicateFromCommitmentDiagnostics.d.ts +28 -0
  27. package/esm/src/book-components/BookEditor/createDuplicateFromCommitmentDiagnostics.test.d.ts +1 -0
  28. package/esm/src/book-components/BookEditor/createUnknownCommitmentDiagnostics.d.ts +28 -0
  29. package/esm/src/book-components/BookEditor/createUnknownCommitmentDiagnostics.test.d.ts +1 -0
  30. package/esm/src/book-components/Chat/Chat/ChatProps.d.ts +3 -2
  31. package/esm/src/book-components/Chat/Chat/renderAgentProjectDiff.d.ts +13 -0
  32. package/esm/src/book-components/Chat/Chat/renderAgentProjectToolCallDetails.d.ts +16 -0
  33. package/esm/src/book-components/Chat/MockedChat/MockedChat.test.d.ts +2 -0
  34. package/esm/src/book-components/Chat/utils/agentProjectToolCall.d.ts +85 -0
  35. package/esm/src/book-components/Chat/utils/agentProjectToolCall.test.d.ts +1 -0
  36. package/esm/src/book-components/Chat/utils/externalSourceToolCall.d.ts +38 -0
  37. package/esm/src/book-components/Chat/utils/renderMarkdown.d.ts +68 -3
  38. package/esm/src/book-components/Chat/utils/timeoutToolCallPresentation.d.ts +30 -0
  39. package/esm/src/cli/$initializePromptbookCliProgram.d.ts +8 -0
  40. package/esm/src/cli/cli-commands/coder/$ensureCoderHarnessGitignoreRules.d.ts +10 -0
  41. package/esm/src/cli/cli-commands/coder/$ensureCoderHarnessGitignoreRules.test.d.ts +1 -0
  42. package/esm/src/cli/cli-commands/coder/GitChangesMode.d.ts +28 -0
  43. package/esm/src/cli/cli-commands/coder/agentCliOptions.d.ts +21 -0
  44. package/esm/src/cli/cli-commands/coder/boilerplateCount.d.ts +1 -1
  45. package/esm/src/cli/cli-commands/coder/boilerplateTemplates.d.ts +8 -21
  46. package/esm/src/cli/cli-commands/coder/coderReferencedArtifacts.d.ts +33 -0
  47. package/esm/src/cli/cli-commands/coder/ensureCoderGitignoreFile.d.ts +14 -1
  48. package/esm/src/cli/cli-commands/coder/ensureCoderPackageJsonFile.d.ts +4 -2
  49. package/esm/src/cli/cli-commands/coder/ensureCoderVscodeSettingsFile.d.ts +2 -0
  50. package/esm/src/cli/cli-commands/coder/ensureDirectory.d.ts +6 -0
  51. package/esm/src/cli/cli-commands/coder/generate-boilerplates.d.ts +1 -1
  52. package/esm/src/cli/cli-commands/coder/getDefaultCoderPackageJsonScripts.d.ts +6 -0
  53. package/esm/src/cli/cli-commands/coder/init.test.d.ts +1 -0
  54. package/esm/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.d.ts +8 -5
  55. package/esm/src/cli/cli-commands/coder/list.d.ts +10 -0
  56. package/esm/src/cli/cli-commands/coder/list.test.d.ts +1 -0
  57. package/esm/src/cli/cli-commands/coder/mergeStringRecordJsonFile.d.ts +19 -1
  58. package/esm/src/cli/cli-commands/coder/printCoderRunFailure.d.ts +6 -0
  59. package/esm/src/cli/cli-commands/coder/server.test.d.ts +1 -0
  60. package/esm/src/cli/cli-commands/coder/verify.d.ts +1 -1
  61. package/esm/src/cli/cli-commands/coder/waitOptions.d.ts +12 -0
  62. package/esm/src/cli/cli-commands/coder.d.ts +1 -0
  63. package/esm/src/cli/cli-commands/common/$askForConfirmation.d.ts +11 -0
  64. package/esm/src/cli/cli-commands/common/$askForConfirmation.test.d.ts +1 -0
  65. package/esm/src/cli/cli-commands/common/LocalAgentBookCollection.d.ts +46 -0
  66. package/esm/src/cli/cli-commands/common/createLocalAgentReferenceResolver.d.ts +8 -0
  67. package/esm/src/cli/cli-commands/common/disk-space/$assertSufficientFreeDiskSpace.d.ts +12 -0
  68. package/esm/src/cli/cli-commands/common/disk-space/$assertSufficientFreeDiskSpace.test.d.ts +1 -0
  69. package/esm/src/cli/cli-commands/common/disk-space/$readFreeDiskSpaceStatus.d.ts +11 -0
  70. package/esm/src/cli/cli-commands/common/disk-space/$readFreeDiskSpaceStatus.test.d.ts +1 -0
  71. package/esm/src/cli/cli-commands/common/disk-space/FreeDiskSpaceStatus.d.ts +33 -0
  72. package/esm/src/cli/cli-commands/common/disk-space/formatFreeDiskSpaceBytes.d.ts +6 -0
  73. package/esm/src/cli/cli-commands/common/disk-space/formatFreeDiskSpaceBytes.test.d.ts +1 -0
  74. package/esm/src/cli/cli-commands/common/disk-space/formatLowFreeDiskSpaceWarning.d.ts +10 -0
  75. package/esm/src/cli/cli-commands/common/disk-space/freeDiskSpaceConstants.d.ts +28 -0
  76. package/esm/src/cli/cli-commands/common/disk-space/resolveFreeDiskSpaceLevel.d.ts +7 -0
  77. package/esm/src/cli/cli-commands/common/disk-space/resolveFreeDiskSpaceLevel.test.d.ts +1 -0
  78. package/esm/src/cli/cli-commands/common/ensureAdamAgentBook.d.ts +12 -0
  79. package/esm/src/cli/cli-commands/common/harness/$applyHarnessInstallationStatus.d.ts +3 -2
  80. package/esm/src/cli/cli-commands/common/harness/$checkHarnessInstallation.d.ts +3 -3
  81. package/esm/src/cli/cli-commands/common/harness/$checkHarnessInstallation.test.d.ts +1 -0
  82. package/esm/src/cli/cli-commands/common/harness/$ensureHarnessInstallations.d.ts +4 -3
  83. package/esm/src/cli/cli-commands/common/harness/$resolveHarnessCommandPath.d.ts +14 -0
  84. package/esm/src/cli/cli-commands/common/harness/$resolveHarnessInstallationOrigin.d.ts +10 -0
  85. package/esm/src/cli/cli-commands/common/harness/$runHarnessInstallationCommand.d.ts +43 -0
  86. package/esm/src/cli/cli-commands/common/harness/HARNESS_DEFAULT_MODELS.d.ts +25 -0
  87. package/esm/src/cli/cli-commands/common/harness/HarnessDefinition.d.ts +62 -0
  88. package/esm/src/cli/cli-commands/common/harness/HarnessInstallationOrigin.d.ts +36 -0
  89. package/esm/src/cli/cli-commands/common/harness/HarnessInstallationStatus.d.ts +8 -2
  90. package/esm/src/cli/cli-commands/common/harness/HarnessUpdatePlan.d.ts +23 -0
  91. package/esm/src/cli/cli-commands/common/harness/buildHarnessInstallCommand.d.ts +4 -1
  92. package/esm/src/cli/cli-commands/common/harness/formatHarnessManualUpdateInstruction.d.ts +8 -0
  93. package/esm/src/cli/cli-commands/common/harness/formatHarnessManualUpdateInstruction.test.d.ts +1 -0
  94. package/esm/src/cli/cli-commands/common/harness/resolveHarnessInstallationMethodFromPaths.d.ts +31 -0
  95. package/esm/src/cli/cli-commands/common/harness/resolveHarnessInstallationMethodFromPaths.test.d.ts +1 -0
  96. package/esm/src/cli/cli-commands/common/harness/resolveHarnessUpdatePlan.d.ts +12 -0
  97. package/esm/src/cli/cli-commands/common/harness/resolveHarnessUpdatePlan.test.d.ts +1 -0
  98. package/esm/src/cli/cli-commands/common/npm/$askForNpmPackageInstallationApproval.d.ts +11 -0
  99. package/{umd/src/cli/cli-commands/common/harness/$resolveLatestHarnessVersion.d.ts → esm/src/cli/cli-commands/common/npm/$resolveLatestNpmPackageVersion.d.ts} +2 -3
  100. package/esm/src/cli/cli-commands/common/npm/$resolveLatestNpmPackageVersion.test.d.ts +1 -0
  101. package/esm/src/cli/cli-commands/common/npm/$resolveNpmGlobalPrefixPath.d.ts +9 -0
  102. package/esm/src/cli/cli-commands/common/npm/buildNpmPackageInstallCommand.d.ts +12 -0
  103. package/esm/src/cli/cli-commands/common/npm/buildNpmPackageInstallCommand.test.d.ts +1 -0
  104. package/esm/src/cli/cli-commands/common/npm/extractNpmPackageVersionFromOutput.d.ts +12 -0
  105. package/esm/src/cli/cli-commands/common/npm/extractNpmPackageVersionFromOutput.test.d.ts +1 -0
  106. package/esm/src/cli/cli-commands/common/npm/isNpmPackageVersionOutdated.d.ts +12 -0
  107. package/esm/src/cli/cli-commands/common/npm/isNpmPackageVersionOutdated.test.d.ts +1 -0
  108. package/esm/src/cli/cli-commands/common/projectInitialization.d.ts +6 -0
  109. package/esm/src/cli/cli-commands/common/promptPriorityCliOptions.d.ts +7 -0
  110. package/esm/src/cli/cli-commands/common/promptRunnerCliOptions.d.ts +17 -4
  111. package/esm/src/cli/cli-commands/common/promptbook-cli/$checkPromptbookCliInstallations.d.ts +9 -0
  112. package/esm/src/cli/cli-commands/common/promptbook-cli/$checkPromptbookCliInstallations.test.d.ts +1 -0
  113. package/esm/src/cli/cli-commands/common/promptbook-cli/$ensurePromptbookCliInstallations.d.ts +15 -0
  114. package/esm/src/cli/cli-commands/common/promptbook-cli/$ensurePromptbookCliInstallations.test.d.ts +1 -0
  115. package/esm/src/cli/cli-commands/common/promptbook-cli/$resolvePromptbookCliInstallations.d.ts +12 -0
  116. package/esm/src/cli/cli-commands/common/promptbook-cli/$resolvePromptbookCliInstallations.test.d.ts +1 -0
  117. package/esm/src/cli/cli-commands/common/promptbook-cli/$updatePromptbookCliInstallation.d.ts +10 -0
  118. package/esm/src/cli/cli-commands/common/promptbook-cli/$updatePromptbookCliInstallation.test.d.ts +1 -0
  119. package/esm/src/cli/cli-commands/common/promptbook-cli/PromptbookCliInstallation.d.ts +66 -0
  120. package/esm/src/cli/cli-commands/common/promptbook-cli/PromptbookCliInstallationStatus.d.ts +26 -0
  121. package/esm/src/cli/cli-commands/common/promptbook-cli/buildPromptbookCliInstallCommand.d.ts +7 -0
  122. package/esm/src/cli/cli-commands/common/promptbook-cli/formatPromptbookCliInstallationWarning.d.ts +7 -0
  123. package/esm/src/cli/cli-commands/common/questionsCliOptions.d.ts +45 -0
  124. package/esm/src/cli/cli-commands/common/questionsCliOptions.test.d.ts +1 -0
  125. package/esm/src/cli/cli-commands/common/resolveBundledAgentBookPath.d.ts +6 -0
  126. package/esm/src/cli/cli-commands/common/resolveLocalAgentSource.d.ts +19 -0
  127. package/esm/src/cli/common/$deprecateCliCommand.d.ts +3 -0
  128. package/esm/src/cli/common/$hideCliCommandFromHelp.d.ts +11 -0
  129. package/esm/src/cli/common/$hideCliCommandFromHelp.test.d.ts +1 -0
  130. package/esm/src/cli/common/$requireCliSubcommand.d.ts +18 -0
  131. package/esm/src/cli/common/$requireCliSubcommand.test.d.ts +1 -0
  132. package/esm/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +15 -0
  133. package/esm/src/commitments/WRITING_RULES/WRITING_RULES.d.ts +14 -7
  134. package/esm/src/commitments/index.d.ts +1 -1
  135. package/esm/src/executables/platforms/locateAppOnWindows.d.ts +1 -1
  136. package/esm/src/executables/platforms/locateAppOnWindows.test.d.ts +1 -0
  137. package/esm/src/llm-providers/vercel/VercelExecutionToolsOptions.d.ts +5 -2
  138. package/esm/src/utils/agent-message-runtime/AgentMessageProjectChange.d.ts +76 -0
  139. package/esm/src/utils/agent-message-runtime/AgentMessageTouchedExternalSource.d.ts +45 -0
  140. package/esm/src/utils/agent-message-runtime/parseAgentMessageRuntimeLogEvents.d.ts +62 -0
  141. package/esm/src/utils/agent-message-runtime/resolveAgentMessageRuntimeActivity.d.ts +3 -3
  142. package/esm/src/utils/agent-message-runtime/resolveAgentMessageTouchedExternalSources.d.ts +18 -0
  143. package/esm/src/utils/agent-message-runtime/resolveAgentMessageTouchedExternalSources.test.d.ts +1 -0
  144. package/esm/src/utils/agent-message-runtime/resolveAgentMessageTouchedProjectNames.d.ts +19 -0
  145. package/esm/src/utils/agent-message-runtime/resolveAgentMessageTouchedProjectNames.test.d.ts +1 -0
  146. package/esm/src/utils/agents/terminalAgentAvatarVisual.d.ts +5 -2
  147. package/esm/src/utils/ascii-art/convertImageDataToAsciiArt.d.ts +6 -0
  148. package/esm/src/utils/ascii-art/createAnsiColorCode.d.ts +46 -0
  149. package/esm/src/utils/files/findFilesByGlob.d.ts +28 -0
  150. package/esm/src/utils/misc/debounce.d.ts +4 -2
  151. package/esm/src/utils/misc/debounce.test.d.ts +1 -0
  152. package/esm/src/utils/misc/emojis.d.ts +3 -2
  153. package/esm/src/utils/random/$generateBookBoilerplate.test.d.ts +1 -0
  154. package/esm/src/version.d.ts +1 -1
  155. package/package.json +4 -8
  156. package/umd/index.umd.js +541 -113
  157. package/umd/index.umd.js.map +1 -1
  158. package/umd/src/_packages/components.index.d.ts +4 -0
  159. package/umd/src/_packages/types.index.d.ts +4 -0
  160. package/umd/src/avatars/renderAvatarVisualTerminalText.d.ts +80 -0
  161. package/umd/src/avatars/renderAvatarVisualTerminalText.test.d.ts +1 -0
  162. package/umd/src/avatars/types/AvatarVisualDefinition.d.ts +54 -0
  163. package/umd/src/book-2.0/agent-source/AgentReferenceResolutionIssue.d.ts +45 -0
  164. package/umd/src/book-2.0/agent-source/AgentSourceParseResult.d.ts +5 -0
  165. package/umd/src/book-2.0/agent-source/ParsedUnknownCommitment.d.ts +26 -0
  166. package/umd/src/book-2.0/agent-source/createAgentModelRequirements.deduplication.test.d.ts +1 -0
  167. package/umd/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.unknown.test.d.ts +1 -0
  168. package/umd/src/book-2.0/agent-source/deduplicateSystemMessage.d.ts +14 -0
  169. package/umd/src/book-2.0/agent-source/deduplicateSystemMessage.test.d.ts +1 -0
  170. package/umd/src/book-2.0/agent-source/explicitFromCommitment.d.ts +62 -0
  171. package/umd/src/book-2.0/agent-source/extractAgentReferenceTokens.d.ts +32 -0
  172. package/umd/src/book-2.0/agent-source/getBookCommitmentLineType.d.ts +19 -0
  173. package/umd/src/book-2.0/agent-source/parseAgentSourceWithCommitments.unknown.test.d.ts +1 -0
  174. package/umd/src/book-2.0/agent-source/resolveInheritedAgentSource.d.ts +73 -0
  175. package/umd/src/book-2.0/book-language-documentation/getSafeCodeBlock.d.ts +1 -1
  176. package/umd/src/book-3.0/AgentMessageRunReport.d.ts +46 -0
  177. package/umd/src/book-3.0/AgentPlannedMessagesSidecar.d.ts +127 -0
  178. package/umd/src/book-3.0/AgentPlannedMessagesSidecar.test.d.ts +1 -0
  179. package/umd/src/book-3.0/AgentTeamConversationWorkspace.d.ts +85 -0
  180. package/umd/src/book-3.0/cliAgentEnv.d.ts +3 -3
  181. package/umd/src/book-3.0/createAgentMessageSidecarBaseName.d.ts +13 -0
  182. package/umd/src/book-3.0/describeAgentPlannedMessageSchedule.d.ts +31 -0
  183. package/umd/src/book-components/BookEditor/createDeprecatedCommitmentDiagnostics.browser.d.ts +1 -9
  184. package/umd/src/book-components/BookEditor/createDuplicateFromCommitmentDiagnostics.d.ts +28 -0
  185. package/umd/src/book-components/BookEditor/createDuplicateFromCommitmentDiagnostics.test.d.ts +1 -0
  186. package/umd/src/book-components/BookEditor/createUnknownCommitmentDiagnostics.d.ts +28 -0
  187. package/umd/src/book-components/BookEditor/createUnknownCommitmentDiagnostics.test.d.ts +1 -0
  188. package/umd/src/book-components/Chat/Chat/ChatProps.d.ts +3 -2
  189. package/umd/src/book-components/Chat/Chat/renderAgentProjectDiff.d.ts +13 -0
  190. package/umd/src/book-components/Chat/Chat/renderAgentProjectToolCallDetails.d.ts +16 -0
  191. package/umd/src/book-components/Chat/MockedChat/MockedChat.test.d.ts +2 -0
  192. package/umd/src/book-components/Chat/utils/agentProjectToolCall.d.ts +85 -0
  193. package/umd/src/book-components/Chat/utils/agentProjectToolCall.test.d.ts +1 -0
  194. package/umd/src/book-components/Chat/utils/externalSourceToolCall.d.ts +38 -0
  195. package/umd/src/book-components/Chat/utils/renderMarkdown.d.ts +68 -3
  196. package/umd/src/book-components/Chat/utils/timeoutToolCallPresentation.d.ts +30 -0
  197. package/umd/src/cli/$initializePromptbookCliProgram.d.ts +8 -0
  198. package/umd/src/cli/cli-commands/coder/$ensureCoderHarnessGitignoreRules.d.ts +10 -0
  199. package/umd/src/cli/cli-commands/coder/$ensureCoderHarnessGitignoreRules.test.d.ts +1 -0
  200. package/umd/src/cli/cli-commands/coder/GitChangesMode.d.ts +28 -0
  201. package/umd/src/cli/cli-commands/coder/agentCliOptions.d.ts +21 -0
  202. package/umd/src/cli/cli-commands/coder/boilerplateCount.d.ts +1 -1
  203. package/umd/src/cli/cli-commands/coder/boilerplateTemplates.d.ts +8 -21
  204. package/umd/src/cli/cli-commands/coder/coderReferencedArtifacts.d.ts +33 -0
  205. package/umd/src/cli/cli-commands/coder/ensureCoderGitignoreFile.d.ts +14 -1
  206. package/umd/src/cli/cli-commands/coder/ensureCoderPackageJsonFile.d.ts +4 -2
  207. package/umd/src/cli/cli-commands/coder/ensureCoderVscodeSettingsFile.d.ts +2 -0
  208. package/umd/src/cli/cli-commands/coder/ensureDirectory.d.ts +6 -0
  209. package/umd/src/cli/cli-commands/coder/generate-boilerplates.d.ts +1 -1
  210. package/umd/src/cli/cli-commands/coder/getDefaultCoderPackageJsonScripts.d.ts +6 -0
  211. package/umd/src/cli/cli-commands/coder/init.test.d.ts +1 -0
  212. package/umd/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.d.ts +8 -5
  213. package/umd/src/cli/cli-commands/coder/list.d.ts +10 -0
  214. package/umd/src/cli/cli-commands/coder/list.test.d.ts +1 -0
  215. package/umd/src/cli/cli-commands/coder/mergeStringRecordJsonFile.d.ts +19 -1
  216. package/umd/src/cli/cli-commands/coder/printCoderRunFailure.d.ts +6 -0
  217. package/umd/src/cli/cli-commands/coder/server.test.d.ts +1 -0
  218. package/umd/src/cli/cli-commands/coder/verify.d.ts +1 -1
  219. package/umd/src/cli/cli-commands/coder/waitOptions.d.ts +12 -0
  220. package/umd/src/cli/cli-commands/coder.d.ts +1 -0
  221. package/umd/src/cli/cli-commands/common/$askForConfirmation.d.ts +11 -0
  222. package/umd/src/cli/cli-commands/common/$askForConfirmation.test.d.ts +1 -0
  223. package/umd/src/cli/cli-commands/common/LocalAgentBookCollection.d.ts +46 -0
  224. package/umd/src/cli/cli-commands/common/createLocalAgentReferenceResolver.d.ts +8 -0
  225. package/umd/src/cli/cli-commands/common/disk-space/$assertSufficientFreeDiskSpace.d.ts +12 -0
  226. package/umd/src/cli/cli-commands/common/disk-space/$assertSufficientFreeDiskSpace.test.d.ts +1 -0
  227. package/umd/src/cli/cli-commands/common/disk-space/$readFreeDiskSpaceStatus.d.ts +11 -0
  228. package/umd/src/cli/cli-commands/common/disk-space/$readFreeDiskSpaceStatus.test.d.ts +1 -0
  229. package/umd/src/cli/cli-commands/common/disk-space/FreeDiskSpaceStatus.d.ts +33 -0
  230. package/umd/src/cli/cli-commands/common/disk-space/formatFreeDiskSpaceBytes.d.ts +6 -0
  231. package/umd/src/cli/cli-commands/common/disk-space/formatFreeDiskSpaceBytes.test.d.ts +1 -0
  232. package/umd/src/cli/cli-commands/common/disk-space/formatLowFreeDiskSpaceWarning.d.ts +10 -0
  233. package/umd/src/cli/cli-commands/common/disk-space/freeDiskSpaceConstants.d.ts +28 -0
  234. package/umd/src/cli/cli-commands/common/disk-space/resolveFreeDiskSpaceLevel.d.ts +7 -0
  235. package/umd/src/cli/cli-commands/common/disk-space/resolveFreeDiskSpaceLevel.test.d.ts +1 -0
  236. package/umd/src/cli/cli-commands/common/ensureAdamAgentBook.d.ts +12 -0
  237. package/umd/src/cli/cli-commands/common/harness/$applyHarnessInstallationStatus.d.ts +3 -2
  238. package/umd/src/cli/cli-commands/common/harness/$checkHarnessInstallation.d.ts +3 -3
  239. package/umd/src/cli/cli-commands/common/harness/$checkHarnessInstallation.test.d.ts +1 -0
  240. package/umd/src/cli/cli-commands/common/harness/$ensureHarnessInstallations.d.ts +4 -3
  241. package/umd/src/cli/cli-commands/common/harness/$resolveHarnessCommandPath.d.ts +14 -0
  242. package/umd/src/cli/cli-commands/common/harness/$resolveHarnessInstallationOrigin.d.ts +10 -0
  243. package/umd/src/cli/cli-commands/common/harness/$runHarnessInstallationCommand.d.ts +43 -0
  244. package/umd/src/cli/cli-commands/common/harness/HARNESS_DEFAULT_MODELS.d.ts +25 -0
  245. package/umd/src/cli/cli-commands/common/harness/HarnessDefinition.d.ts +62 -0
  246. package/umd/src/cli/cli-commands/common/harness/HarnessInstallationOrigin.d.ts +36 -0
  247. package/umd/src/cli/cli-commands/common/harness/HarnessInstallationStatus.d.ts +8 -2
  248. package/umd/src/cli/cli-commands/common/harness/HarnessUpdatePlan.d.ts +23 -0
  249. package/umd/src/cli/cli-commands/common/harness/buildHarnessInstallCommand.d.ts +4 -1
  250. package/umd/src/cli/cli-commands/common/harness/formatHarnessManualUpdateInstruction.d.ts +8 -0
  251. package/umd/src/cli/cli-commands/common/harness/formatHarnessManualUpdateInstruction.test.d.ts +1 -0
  252. package/umd/src/cli/cli-commands/common/harness/resolveHarnessInstallationMethodFromPaths.d.ts +31 -0
  253. package/umd/src/cli/cli-commands/common/harness/resolveHarnessInstallationMethodFromPaths.test.d.ts +1 -0
  254. package/umd/src/cli/cli-commands/common/harness/resolveHarnessUpdatePlan.d.ts +12 -0
  255. package/umd/src/cli/cli-commands/common/harness/resolveHarnessUpdatePlan.test.d.ts +1 -0
  256. package/umd/src/cli/cli-commands/common/npm/$askForNpmPackageInstallationApproval.d.ts +11 -0
  257. package/{esm/src/cli/cli-commands/common/harness/$resolveLatestHarnessVersion.d.ts → umd/src/cli/cli-commands/common/npm/$resolveLatestNpmPackageVersion.d.ts} +2 -3
  258. package/umd/src/cli/cli-commands/common/npm/$resolveLatestNpmPackageVersion.test.d.ts +1 -0
  259. package/umd/src/cli/cli-commands/common/npm/$resolveNpmGlobalPrefixPath.d.ts +9 -0
  260. package/umd/src/cli/cli-commands/common/npm/buildNpmPackageInstallCommand.d.ts +12 -0
  261. package/umd/src/cli/cli-commands/common/npm/buildNpmPackageInstallCommand.test.d.ts +1 -0
  262. package/umd/src/cli/cli-commands/common/npm/extractNpmPackageVersionFromOutput.d.ts +12 -0
  263. package/umd/src/cli/cli-commands/common/npm/extractNpmPackageVersionFromOutput.test.d.ts +1 -0
  264. package/umd/src/cli/cli-commands/common/npm/isNpmPackageVersionOutdated.d.ts +12 -0
  265. package/umd/src/cli/cli-commands/common/npm/isNpmPackageVersionOutdated.test.d.ts +1 -0
  266. package/umd/src/cli/cli-commands/common/projectInitialization.d.ts +6 -0
  267. package/umd/src/cli/cli-commands/common/promptPriorityCliOptions.d.ts +7 -0
  268. package/umd/src/cli/cli-commands/common/promptRunnerCliOptions.d.ts +17 -4
  269. package/umd/src/cli/cli-commands/common/promptbook-cli/$checkPromptbookCliInstallations.d.ts +9 -0
  270. package/umd/src/cli/cli-commands/common/promptbook-cli/$checkPromptbookCliInstallations.test.d.ts +1 -0
  271. package/umd/src/cli/cli-commands/common/promptbook-cli/$ensurePromptbookCliInstallations.d.ts +15 -0
  272. package/umd/src/cli/cli-commands/common/promptbook-cli/$ensurePromptbookCliInstallations.test.d.ts +1 -0
  273. package/umd/src/cli/cli-commands/common/promptbook-cli/$resolvePromptbookCliInstallations.d.ts +12 -0
  274. package/umd/src/cli/cli-commands/common/promptbook-cli/$resolvePromptbookCliInstallations.test.d.ts +1 -0
  275. package/umd/src/cli/cli-commands/common/promptbook-cli/$updatePromptbookCliInstallation.d.ts +10 -0
  276. package/umd/src/cli/cli-commands/common/promptbook-cli/$updatePromptbookCliInstallation.test.d.ts +1 -0
  277. package/umd/src/cli/cli-commands/common/promptbook-cli/PromptbookCliInstallation.d.ts +66 -0
  278. package/umd/src/cli/cli-commands/common/promptbook-cli/PromptbookCliInstallationStatus.d.ts +26 -0
  279. package/umd/src/cli/cli-commands/common/promptbook-cli/buildPromptbookCliInstallCommand.d.ts +7 -0
  280. package/umd/src/cli/cli-commands/common/promptbook-cli/formatPromptbookCliInstallationWarning.d.ts +7 -0
  281. package/umd/src/cli/cli-commands/common/questionsCliOptions.d.ts +45 -0
  282. package/umd/src/cli/cli-commands/common/questionsCliOptions.test.d.ts +1 -0
  283. package/umd/src/cli/cli-commands/common/resolveBundledAgentBookPath.d.ts +6 -0
  284. package/umd/src/cli/cli-commands/common/resolveLocalAgentSource.d.ts +19 -0
  285. package/umd/src/cli/common/$deprecateCliCommand.d.ts +3 -0
  286. package/umd/src/cli/common/$hideCliCommandFromHelp.d.ts +11 -0
  287. package/umd/src/cli/common/$hideCliCommandFromHelp.test.d.ts +1 -0
  288. package/umd/src/cli/common/$requireCliSubcommand.d.ts +18 -0
  289. package/umd/src/cli/common/$requireCliSubcommand.test.d.ts +1 -0
  290. package/umd/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +15 -0
  291. package/umd/src/commitments/WRITING_RULES/WRITING_RULES.d.ts +14 -7
  292. package/umd/src/commitments/index.d.ts +1 -1
  293. package/umd/src/executables/platforms/locateAppOnWindows.d.ts +1 -1
  294. package/umd/src/executables/platforms/locateAppOnWindows.test.d.ts +1 -0
  295. package/umd/src/llm-providers/vercel/VercelExecutionToolsOptions.d.ts +5 -2
  296. package/umd/src/utils/agent-message-runtime/AgentMessageProjectChange.d.ts +76 -0
  297. package/umd/src/utils/agent-message-runtime/AgentMessageTouchedExternalSource.d.ts +45 -0
  298. package/umd/src/utils/agent-message-runtime/parseAgentMessageRuntimeLogEvents.d.ts +62 -0
  299. package/umd/src/utils/agent-message-runtime/resolveAgentMessageRuntimeActivity.d.ts +3 -3
  300. package/umd/src/utils/agent-message-runtime/resolveAgentMessageTouchedExternalSources.d.ts +18 -0
  301. package/umd/src/utils/agent-message-runtime/resolveAgentMessageTouchedExternalSources.test.d.ts +1 -0
  302. package/umd/src/utils/agent-message-runtime/resolveAgentMessageTouchedProjectNames.d.ts +19 -0
  303. package/umd/src/utils/agent-message-runtime/resolveAgentMessageTouchedProjectNames.test.d.ts +1 -0
  304. package/umd/src/utils/agents/terminalAgentAvatarVisual.d.ts +5 -2
  305. package/umd/src/utils/ascii-art/convertImageDataToAsciiArt.d.ts +6 -0
  306. package/umd/src/utils/ascii-art/createAnsiColorCode.d.ts +46 -0
  307. package/umd/src/utils/files/findFilesByGlob.d.ts +28 -0
  308. package/umd/src/utils/misc/debounce.d.ts +4 -2
  309. package/umd/src/utils/misc/debounce.test.d.ts +1 -0
  310. package/umd/src/utils/misc/emojis.d.ts +3 -2
  311. package/umd/src/utils/random/$generateBookBoilerplate.test.d.ts +1 -0
  312. package/umd/src/version.d.ts +1 -1
  313. package/esm/src/cli/cli-commands/coder/agentCodingFile.d.ts +0 -13
  314. package/esm/src/cli/cli-commands/common/harness/$askForHarnessInstallationApproval.d.ts +0 -9
  315. package/esm/src/cli/cli-commands/common/harness/$installHarness.d.ts +0 -13
  316. package/esm/src/cli/cli-commands/common/harness/extractHarnessVersionFromOutput.d.ts +0 -11
  317. package/esm/src/cli/cli-commands/common/harness/isHarnessVersionOutdated.d.ts +0 -9
  318. package/umd/src/cli/cli-commands/coder/agentCodingFile.d.ts +0 -13
  319. package/umd/src/cli/cli-commands/common/harness/$askForHarnessInstallationApproval.d.ts +0 -9
  320. package/umd/src/cli/cli-commands/common/harness/$installHarness.d.ts +0 -13
  321. package/umd/src/cli/cli-commands/common/harness/extractHarnessVersionFromOutput.d.ts +0 -11
  322. package/umd/src/cli/cli-commands/common/harness/isHarnessVersionOutdated.d.ts +0 -9
  323. /package/esm/src/{cli/cli-commands/common/harness/extractHarnessVersionFromOutput.test.d.ts → avatars/renderAvatarVisualTerminalText.test.d.ts} +0 -0
  324. /package/esm/src/{cli/cli-commands/common/harness/isHarnessVersionOutdated.test.d.ts → book-2.0/agent-source/createAgentModelRequirements.deduplication.test.d.ts} +0 -0
  325. /package/{umd/src/cli/cli-commands/common/harness/extractHarnessVersionFromOutput.test.d.ts → esm/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.unknown.test.d.ts} +0 -0
  326. /package/{umd/src/cli/cli-commands/common/harness/isHarnessVersionOutdated.test.d.ts → esm/src/book-2.0/agent-source/deduplicateSystemMessage.test.d.ts} +0 -0
package/umd/index.umd.js CHANGED
@@ -50,7 +50,7 @@
50
50
  * @generated
51
51
  * @see https://github.com/webgptorg/promptbook
52
52
  */
53
- const PROMPTBOOK_ENGINE_VERSION = '0.114.0-4';
53
+ const PROMPTBOOK_ENGINE_VERSION = '0.114.0-41';
54
54
  /**
55
55
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
56
56
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -8737,23 +8737,27 @@
8737
8737
  // TODO: [🧠][♿] Maybe export through `@promptbook/node`
8738
8738
 
8739
8739
  /**
8740
- * Attempts to locate the specified application on a Windows system by searching common installation directories.
8740
+ * Attempts to locate the specified application on a Windows system by searching PATH and common installation directories.
8741
8741
  * Returns the path to the executable if found, or null otherwise.
8742
8742
  *
8743
8743
  * @private within the repository
8744
8744
  */
8745
8745
  async function locateAppOnWindows({ appName, windowsSuffix, }) {
8746
8746
  try {
8747
- const prefixes = [
8747
+ const EXECUTABLE_FILENAME = windowsSuffix.replace(/^.*[\\/]/, '');
8748
+ const PATH_EXECUTABLE_PATHS = (process.env.PATH || '')
8749
+ .split(path.delimiter)
8750
+ .filter(Boolean)
8751
+ .map((pathPrefix) => path.join(pathPrefix, EXECUTABLE_FILENAME));
8752
+ const INSTALLATION_EXECUTABLE_PATHS = [
8748
8753
  process.env.LOCALAPPDATA,
8749
8754
  path.join(process.env.LOCALAPPDATA || '', 'Programs'),
8750
8755
  process.env.PROGRAMFILES,
8751
8756
  process.env['PROGRAMFILES(X86)'],
8752
- ];
8753
- for (const prefix of prefixes) {
8754
- const path = prefix + windowsSuffix;
8755
- if (await isExecutable(path, $provideFilesystemForNode())) {
8756
- return path;
8757
+ ].map((pathPrefix) => pathPrefix + windowsSuffix);
8758
+ for (const executablePath of [...PATH_EXECUTABLE_PATHS, ...INSTALLATION_EXECUTABLE_PATHS]) {
8759
+ if (await isExecutable(executablePath, $provideFilesystemForNode())) {
8760
+ return executablePath;
8757
8761
  }
8758
8762
  }
8759
8763
  throw new Error(`Can not locate app ${appName} on Windows.`);
@@ -10451,6 +10455,12 @@
10451
10455
 
10452
10456
  Inherits agent source from another agent.
10453
10457
 
10458
+ Every agent inherits from the core agent \`@Adam\` unless it says otherwise, so writing no ${this.type} at all
10459
+ is the same as writing \`${this.type} @Adam\`. Write \`${this.type} @Null\` to inherit from nothing.
10460
+
10461
+ An agent has exactly one parent, so when ${this.type} is written more than once, the last one wins and
10462
+ overrides every earlier one.
10463
+
10454
10464
  ## Examples
10455
10465
 
10456
10466
  \`\`\`book
@@ -10459,6 +10469,13 @@
10459
10469
  FROM https://s6.ptbk.io/benjamin-white
10460
10470
  RULE Speak only in English.
10461
10471
  \`\`\`
10472
+
10473
+ \`\`\`book
10474
+ My Standalone Agent
10475
+
10476
+ FROM @Null
10477
+ RULE Speak only in English.
10478
+ \`\`\`
10462
10479
  `);
10463
10480
  }
10464
10481
  applyToAgentModelRequirements(requirements, content) {
@@ -11591,6 +11608,13 @@
11591
11608
  }
11592
11609
 
11593
11610
  /* eslint-disable no-magic-numbers */
11611
+ // Note: [💞] Ignore a discrepancy between file name and entity name
11612
+ /**
11613
+ * Default square size used by avatar renderers.
11614
+ *
11615
+ * @private utility of the avatar rendering system
11616
+ */
11617
+ const DEFAULT_AVATAR_SIZE = 192;
11594
11618
  /**
11595
11619
  * Corner radius ratio used for the common rounded card frame.
11596
11620
  *
@@ -11961,6 +11985,15 @@
11961
11985
  * @private helper of `asciiOctopusAvatarVisual`
11962
11986
  */
11963
11987
  const ATMOSPHERE_GLYPHS = ['.', ':', "'", '`'];
11988
+ /**
11989
+ * Coordinate space the octopus layout is generated in when it is painted into a terminal.
11990
+ *
11991
+ * The terminal renderer has its own character grid, so the geometry only needs one stable
11992
+ * square coordinate space which the grid is then sampled from.
11993
+ *
11994
+ * @private helper of `asciiOctopusAvatarVisual`
11995
+ */
11996
+ const TERMINAL_ASCII_OCTOPUS_LAYOUT_SIZE = DEFAULT_AVATAR_SIZE;
11964
11997
  /**
11965
11998
  * AsciiOctopus avatar visual.
11966
11999
  *
@@ -11977,41 +12010,115 @@
11977
12010
  const staticRandom = createRandom('ascii-octopus-static');
11978
12011
  const gridMetrics = createAsciiGridMetrics(size, gridRandom);
11979
12012
  const layout = createAsciiOctopusLayout(size, timeMs, createRandom, staticRandom, interaction);
12013
+ const glyphGrid = createAsciiOctopusGlyphGrid({
12014
+ sampleGrid: gridMetrics,
12015
+ layout,
12016
+ palette,
12017
+ cellRandom: createRandom('ascii-octopus-cells'),
12018
+ timeMs,
12019
+ });
11980
12020
  drawAvatarFrame(context, size, palette);
11981
12021
  drawAsciiBackdrop(context, size, palette, layout, timeMs);
11982
12022
  context.save();
11983
12023
  context.font = `600 ${gridMetrics.fontSize}px monospace`;
11984
12024
  context.textAlign = 'center';
11985
12025
  context.textBaseline = 'middle';
11986
- // The ASCII renderer samples the morphing octopus field on a low-resolution grid so the shape stays organic
11987
- // while the glyph layout remains deterministic for the same avatar input.
11988
- const cellRandom = createRandom('ascii-octopus-cells');
11989
12026
  for (let rowIndex = 0; rowIndex < gridMetrics.rowCount; rowIndex++) {
11990
12027
  for (let columnIndex = 0; columnIndex < gridMetrics.columnCount; columnIndex++) {
11991
- const point = {
11992
- x: gridMetrics.offsetX + columnIndex * gridMetrics.cellWidth,
11993
- y: gridMetrics.offsetY + rowIndex * gridMetrics.cellHeight,
11994
- };
11995
- const noise = cellRandom();
11996
- const glyphDescriptor = resolveAsciiGlyph({
11997
- point,
11998
- layout,
11999
- palette,
12000
- cellWidth: gridMetrics.cellWidth,
12001
- cellHeight: gridMetrics.cellHeight,
12002
- noise,
12003
- timeMs,
12004
- });
12028
+ const glyphDescriptor = glyphGrid[rowIndex][columnIndex];
12005
12029
  if (!glyphDescriptor) {
12006
12030
  continue;
12007
12031
  }
12032
+ const point = resolveAsciiSampleGridPoint(gridMetrics, columnIndex, rowIndex);
12008
12033
  context.fillStyle = glyphDescriptor.color;
12009
12034
  context.fillText(glyphDescriptor.character, point.x, point.y);
12010
12035
  }
12011
12036
  }
12012
12037
  context.restore();
12013
12038
  },
12039
+ renderTerminalText({ columns, rows, palette, createRandom, timeMs, interaction }) {
12040
+ const staticRandom = createRandom('ascii-octopus-static');
12041
+ const layout = createAsciiOctopusLayout(TERMINAL_ASCII_OCTOPUS_LAYOUT_SIZE, timeMs, createRandom, staticRandom, interaction);
12042
+ return createAsciiOctopusGlyphGrid({
12043
+ sampleGrid: createAsciiTerminalSampleGrid(columns, rows),
12044
+ layout,
12045
+ palette,
12046
+ cellRandom: createRandom('ascii-octopus-cells'),
12047
+ timeMs,
12048
+ });
12049
+ },
12014
12050
  };
12051
+ /**
12052
+ * Resolves the geometry point sampled for one cell of the grid.
12053
+ *
12054
+ * @param sampleGrid Character-cell sampling grid.
12055
+ * @param columnIndex Zero-based cell column.
12056
+ * @param rowIndex Zero-based cell row.
12057
+ * @returns Sampled point in the octopus coordinate space.
12058
+ *
12059
+ * @private helper of `asciiOctopusAvatarVisual`
12060
+ */
12061
+ function resolveAsciiSampleGridPoint(sampleGrid, columnIndex, rowIndex) {
12062
+ return {
12063
+ x: sampleGrid.offsetX + columnIndex * sampleGrid.cellWidth,
12064
+ y: sampleGrid.offsetY + rowIndex * sampleGrid.cellHeight,
12065
+ };
12066
+ }
12067
+ /**
12068
+ * Builds the sampling grid used when the octopus is painted straight into terminal character cells.
12069
+ *
12070
+ * @param columns Available terminal columns.
12071
+ * @param rows Available terminal rows.
12072
+ * @returns Character-cell sampling grid covering the whole octopus coordinate space.
12073
+ *
12074
+ * @private helper of `asciiOctopusAvatarVisual`
12075
+ */
12076
+ function createAsciiTerminalSampleGrid(columns, rows) {
12077
+ const cellWidth = TERMINAL_ASCII_OCTOPUS_LAYOUT_SIZE / columns;
12078
+ const cellHeight = TERMINAL_ASCII_OCTOPUS_LAYOUT_SIZE / rows;
12079
+ return {
12080
+ cellWidth,
12081
+ cellHeight,
12082
+ columnCount: columns,
12083
+ rowCount: rows,
12084
+ offsetX: cellWidth / 2,
12085
+ offsetY: cellHeight / 2,
12086
+ };
12087
+ }
12088
+ /**
12089
+ * Samples the morphing octopus field into one deterministic grid of ASCII glyphs.
12090
+ *
12091
+ * The field is sampled on a low-resolution grid so the shape stays organic while the glyph
12092
+ * layout remains deterministic for the same avatar input. Both the canvas visual and the
12093
+ * terminal visual share this single sampling pass so they always describe the same octopus.
12094
+ *
12095
+ * @param options Sampling grid, prepared octopus layout, palette, per-cell noise, and animation time.
12096
+ * @returns Resolved glyph of every sampled cell, where `null` means an empty cell.
12097
+ *
12098
+ * @private helper of `asciiOctopusAvatarVisual`
12099
+ */
12100
+ function createAsciiOctopusGlyphGrid(options) {
12101
+ const { sampleGrid, layout, palette, cellRandom, timeMs } = options;
12102
+ const glyphGrid = [];
12103
+ for (let rowIndex = 0; rowIndex < sampleGrid.rowCount; rowIndex++) {
12104
+ const glyphRow = [];
12105
+ for (let columnIndex = 0; columnIndex < sampleGrid.columnCount; columnIndex++) {
12106
+ const point = resolveAsciiSampleGridPoint(sampleGrid, columnIndex, rowIndex);
12107
+ const noise = cellRandom();
12108
+ glyphRow.push(resolveAsciiGlyph({
12109
+ point,
12110
+ layout,
12111
+ palette,
12112
+ cellWidth: sampleGrid.cellWidth,
12113
+ cellHeight: sampleGrid.cellHeight,
12114
+ noise,
12115
+ timeMs,
12116
+ }));
12117
+ }
12118
+ glyphGrid.push(glyphRow);
12119
+ }
12120
+ return glyphGrid;
12121
+ }
12015
12122
  /**
12016
12123
  * Draws the dark terminal-like glow behind the ASCII octopus.
12017
12124
  *
@@ -24315,29 +24422,36 @@
24315
24422
  /**
24316
24423
  * `WRITING RULES` commitment definition.
24317
24424
  *
24318
- * It adds constraints that apply strictly to writing style and presentation
24319
- * rather than task-solving behavior.
24425
+ * The `WRITING RULES`/`WRITING RULE` commitment adds constraints that apply strictly to writing style
24426
+ * and presentation rather than task-solving behavior.
24427
+ *
24428
+ * Example usage in agent source:
24429
+ *
24430
+ * ```book
24431
+ * WRITING RULES Keep every response under 120 words
24432
+ * WRITING RULE Always end the message with an emoji
24433
+ * ```
24320
24434
  *
24321
24435
  * @private [🪔] Maybe export the commitments through some package
24322
24436
  */
24323
24437
  class WritingRulesCommitmentDefinition extends BaseCommitmentDefinition {
24324
- constructor() {
24325
- super('WRITING RULES');
24438
+ constructor(type = 'WRITING RULES') {
24439
+ super(type);
24326
24440
  }
24327
24441
  /**
24328
- * Short one-line description of `WRITING RULES`.
24442
+ * Short one-line description of `WRITING RULES`/`WRITING RULE`.
24329
24443
  */
24330
24444
  get description() {
24331
24445
  return 'Add writing-only constraints such as tone, length, formatting, or emoji usage.';
24332
24446
  }
24333
24447
  /**
24334
- * Icon for `WRITING RULES`.
24448
+ * Icon for `WRITING RULES`/`WRITING RULE`.
24335
24449
  */
24336
24450
  get icon() {
24337
24451
  return '📝';
24338
24452
  }
24339
24453
  /**
24340
- * Markdown documentation for `WRITING RULES`.
24454
+ * Markdown documentation for `WRITING RULES`/`WRITING RULE` commitment.
24341
24455
  */
24342
24456
  get documentation() {
24343
24457
  return _spaceTrim.spaceTrim(`
@@ -24347,6 +24461,7 @@
24347
24461
 
24348
24462
  ## Key aspects
24349
24463
 
24464
+ - All writing rules are treated equally regardless of singular/plural form.
24350
24465
  - Use it for writing-only constraints such as tone, formatting, length, emoji usage, punctuation, or reading level.
24351
24466
  - Do **not** use it for problem-solving behavior, policy, tool usage, or decision-making logic. Use \`RULE\` for that.
24352
24467
  - Newer writing-rules blocks override conflicting earlier writing-rules blocks.
@@ -24545,7 +24660,8 @@
24545
24660
  new LanguageCommitmentDefinition('LANGUAGE'),
24546
24661
  new LanguageCommitmentDefinition('LANGUAGES'),
24547
24662
  new WritingSampleCommitmentDefinition(),
24548
- new WritingRulesCommitmentDefinition(),
24663
+ new WritingRulesCommitmentDefinition('WRITING RULES'),
24664
+ new WritingRulesCommitmentDefinition('WRITING RULE'),
24549
24665
  new SampleCommitmentDefinition('SAMPLE'),
24550
24666
  new SampleCommitmentDefinition('EXAMPLE'),
24551
24667
  new FormatCommitmentDefinition('FORMAT'),
@@ -28829,7 +28945,7 @@
28829
28945
  padBook(validateBook(_spaceTrim.spaceTrim(`
28830
28946
  AI Avatar
28831
28947
 
28832
- PERSONA A friendly AI assistant that helps you with your tasks
28948
+ GOAL Help users with their tasks as a friendly AI assistant.
28833
28949
  `)));
28834
28950
  // <- Note: Not using book`...` notation to avoid strange error in jest unit tests `TypeError: (0 , book_notation_1.book) is not a function`
28835
28951
  // <- TODO: [🐱‍🚀] `GENESIS_BOOK` / `ADAM_BOOK` in `/agents/adam.book`
@@ -29224,6 +29340,30 @@
29224
29340
  return normalizeAgentName(`Agent ${agentHash.substring(0, LIMITS.SHORT_NAME_LENGTH)}`);
29225
29341
  }
29226
29342
 
29343
+ /**
29344
+ * Pattern shared by Book parsing and editor highlighting for a commitment-like line.
29345
+ *
29346
+ * A Book commitment keyword consists of one or more all-uppercase words with at least
29347
+ * two characters each. This deliberately mirrors the Book editor syntax rule so an
29348
+ * unknown keyword starts a new source block everywhere it is interpreted.
29349
+ *
29350
+ * @private internal constant of `getBookCommitmentLineType`
29351
+ */
29352
+ const BOOK_COMMITMENT_LINE_TYPE_REGEX = /^\s*(?<type>[A-Z][A-Z0-9]+(?:\s+[A-Z][A-Z0-9]+)*)(?=\s|$)/;
29353
+ /**
29354
+ * Extracts the uppercase commitment type from a Book line, including types not registered by Promptbook.
29355
+ *
29356
+ * @param line - One raw Book source line.
29357
+ * @returns Matched commitment type or `null` when the line does not begin with commitment syntax.
29358
+ *
29359
+ * @private internal utility of Book parsing and `<BookEditor/>`
29360
+ */
29361
+ function getBookCommitmentLineType(line) {
29362
+ var _a;
29363
+ const match = BOOK_COMMITMENT_LINE_TYPE_REGEX.exec(line);
29364
+ return ((_a = match === null || match === void 0 ? void 0 : match.groups) === null || _a === void 0 ? void 0 : _a.type) || null;
29365
+ }
29366
+
29227
29367
  /**
29228
29368
  * Consumes the agent-name prelude from raw source.
29229
29369
  *
@@ -29281,13 +29421,15 @@
29281
29421
  return {
29282
29422
  agentName: null,
29283
29423
  commitments: [],
29424
+ unknownCommitments: [],
29284
29425
  nonCommitmentLines: [],
29285
29426
  };
29286
29427
  }
29287
29428
  const { lines, agentName, agentNameLineIndex, agentNameLineNumber } = parseAgentSourcePrelude(agentSource);
29288
29429
  const commitments = [];
29430
+ const unknownCommitments = [];
29289
29431
  const nonCommitmentLines = agentNameLineIndex >= 0 ? [lines[agentNameLineIndex]] : [];
29290
- // Parse commitments with multiline support
29432
+ // Parse commitments with multiline support.
29291
29433
  let currentCommitment = null;
29292
29434
  // Process lines starting from after the agent name line
29293
29435
  const startIndex = agentNameLineIndex >= 0 ? agentNameLineIndex + 1 : 0;
@@ -29301,25 +29443,11 @@
29301
29443
  // Check if this line starts or ends a code block
29302
29444
  if (trimmedLine.startsWith('```')) {
29303
29445
  isInsideCodeBlock = !isInsideCodeBlock;
29304
- if (currentCommitment) {
29305
- // If we are inside a commitment, the code block is part of it
29306
- currentCommitment.contentLines.push(line);
29307
- }
29308
- else {
29309
- // If we are not inside a commitment, the code block is non-commitment
29310
- nonCommitmentLines.push(line);
29311
- }
29446
+ appendLineToCurrentCommitmentOrNonCommitmentLines(currentCommitment, line, nonCommitmentLines);
29312
29447
  continue;
29313
29448
  }
29314
29449
  if (isInsideCodeBlock) {
29315
- if (currentCommitment) {
29316
- // If we are inside a commitment and a code block, the line is part of the commitment
29317
- currentCommitment.contentLines.push(line);
29318
- }
29319
- else {
29320
- // If we are inside a code block but not a commitment, the line is non-commitment
29321
- nonCommitmentLines.push(line);
29322
- }
29450
+ appendLineToCurrentCommitmentOrNonCommitmentLines(currentCommitment, line, nonCommitmentLines);
29323
29451
  continue;
29324
29452
  }
29325
29453
  // Check if this line starts a new commitment
@@ -29328,22 +29456,14 @@
29328
29456
  const typeRegex = definition.createTypeRegex();
29329
29457
  const match = typeRegex.exec(line.trim());
29330
29458
  if (match && ((_a = match.groups) === null || _a === void 0 ? void 0 : _a.type)) {
29331
- // Save the previous commitment if it exists
29332
- if (currentCommitment) {
29333
- const fullContent = currentCommitment.contentLines.join('\n');
29334
- commitments.push({
29335
- type: currentCommitment.type,
29336
- content: _spaceTrim.spaceTrim(fullContent),
29337
- originalLine: currentCommitment.originalStartLine,
29338
- lineNumber: currentCommitment.startLineNumber,
29339
- });
29340
- }
29459
+ appendCurrentCommitment(currentCommitment, commitments, unknownCommitments);
29341
29460
  // Extract the initial content from the commitment line
29342
29461
  const fullRegex = definition.createRegex();
29343
29462
  const fullMatch = fullRegex.exec(line.trim());
29344
29463
  const initialContent = ((_b = fullMatch === null || fullMatch === void 0 ? void 0 : fullMatch.groups) === null || _b === void 0 ? void 0 : _b.contents) || '';
29345
29464
  // Start a new commitment
29346
29465
  currentCommitment = {
29466
+ kind: 'known',
29347
29467
  type: definition.type,
29348
29468
  startLineNumber: i + 1,
29349
29469
  originalStartLine: line,
@@ -29353,52 +29473,90 @@
29353
29473
  break;
29354
29474
  }
29355
29475
  }
29476
+ if (foundNewCommitment) {
29477
+ continue;
29478
+ }
29479
+ const unknownCommitmentType = getBookCommitmentLineType(line);
29480
+ if (unknownCommitmentType) {
29481
+ appendCurrentCommitment(currentCommitment, commitments, unknownCommitments);
29482
+ currentCommitment = {
29483
+ kind: 'unknown',
29484
+ type: unknownCommitmentType,
29485
+ startLineNumber: i + 1,
29486
+ originalStartLine: line,
29487
+ sourceLines: [line],
29488
+ };
29489
+ continue;
29490
+ }
29356
29491
  // Check if this is a horizontal line (ends any current commitment)
29357
29492
  const isHorizontalLine = HORIZONTAL_LINE_PATTERN$1.test(line);
29358
29493
  if (isHorizontalLine) {
29359
- // Save the current commitment if it exists
29360
- if (currentCommitment) {
29361
- const fullContent = currentCommitment.contentLines.join('\n');
29362
- commitments.push({
29363
- type: currentCommitment.type,
29364
- content: _spaceTrim.spaceTrim(fullContent),
29365
- originalLine: currentCommitment.originalStartLine,
29366
- lineNumber: currentCommitment.startLineNumber,
29367
- });
29368
- currentCommitment = null;
29369
- }
29494
+ appendCurrentCommitment(currentCommitment, commitments, unknownCommitments);
29495
+ currentCommitment = null;
29370
29496
  // Add horizontal line to non-commitment lines
29371
29497
  nonCommitmentLines.push(line);
29372
29498
  continue;
29373
29499
  }
29374
- if (!foundNewCommitment) {
29375
- if (currentCommitment) {
29376
- // This line belongs to the current commitment
29377
- currentCommitment.contentLines.push(line);
29378
- }
29379
- else {
29380
- // This line is not part of any commitment
29381
- nonCommitmentLines.push(line);
29382
- }
29383
- }
29384
- }
29385
- // Don't forget to save the last commitment if it exists
29386
- if (currentCommitment) {
29387
- const fullContent = currentCommitment.contentLines.join('\n');
29388
- commitments.push({
29389
- type: currentCommitment.type,
29390
- content: _spaceTrim.spaceTrim(fullContent),
29391
- originalLine: currentCommitment.originalStartLine,
29392
- lineNumber: currentCommitment.startLineNumber,
29393
- });
29500
+ appendLineToCurrentCommitmentOrNonCommitmentLines(currentCommitment, line, nonCommitmentLines);
29394
29501
  }
29502
+ appendCurrentCommitment(currentCommitment, commitments, unknownCommitments);
29395
29503
  return {
29396
29504
  agentName,
29397
29505
  agentNameLineNumber,
29398
29506
  commitments,
29507
+ unknownCommitments,
29399
29508
  nonCommitmentLines,
29400
29509
  };
29401
29510
  }
29511
+ /**
29512
+ * Stores the current known or unknown commitment in its appropriate parsed collection.
29513
+ *
29514
+ * @param currentCommitment - Commitment-like block collected so far.
29515
+ * @param commitments - Parsed registered commitments to append to.
29516
+ * @param unknownCommitments - Parsed unregistered commitments to append to.
29517
+ *
29518
+ * @private internal utility of `parseAgentSourceWithCommitments`
29519
+ */
29520
+ function appendCurrentCommitment(currentCommitment, commitments, unknownCommitments) {
29521
+ if (!currentCommitment) {
29522
+ return;
29523
+ }
29524
+ if (currentCommitment.kind === 'unknown') {
29525
+ unknownCommitments.push({
29526
+ type: currentCommitment.type,
29527
+ originalLine: currentCommitment.originalStartLine,
29528
+ lineNumber: currentCommitment.startLineNumber,
29529
+ source: _spaceTrim.spaceTrim(currentCommitment.sourceLines.join('\n')),
29530
+ });
29531
+ return;
29532
+ }
29533
+ commitments.push({
29534
+ type: currentCommitment.type,
29535
+ content: _spaceTrim.spaceTrim(currentCommitment.contentLines.join('\n')),
29536
+ originalLine: currentCommitment.originalStartLine,
29537
+ lineNumber: currentCommitment.startLineNumber,
29538
+ });
29539
+ }
29540
+ /**
29541
+ * Adds one source line to the active commitment-like block, or to plain source content when none is active.
29542
+ *
29543
+ * @param currentCommitment - Commitment-like block currently being collected.
29544
+ * @param line - Source line to append.
29545
+ * @param nonCommitmentLines - Plain source lines to append to when no block is active.
29546
+ *
29547
+ * @private internal utility of `parseAgentSourceWithCommitments`
29548
+ */
29549
+ function appendLineToCurrentCommitmentOrNonCommitmentLines(currentCommitment, line, nonCommitmentLines) {
29550
+ if (!currentCommitment) {
29551
+ nonCommitmentLines.push(line);
29552
+ return;
29553
+ }
29554
+ if (currentCommitment.kind === 'unknown') {
29555
+ currentCommitment.sourceLines.push(line);
29556
+ return;
29557
+ }
29558
+ currentCommitment.contentLines.push(line);
29559
+ }
29402
29560
 
29403
29561
  /**
29404
29562
  * Parses parameters from text using both supported notations:
@@ -30491,7 +30649,8 @@
30491
30649
  requirements = await importReferencedFiles(requirements);
30492
30650
  requirements = appendMcpServers(requirements, agentSource);
30493
30651
  requirements = appendNonCommitmentContent(requirements, parseResult);
30494
- return appendExampleInteractions(requirements, parseResult);
30652
+ requirements = appendExampleInteractions(requirements, parseResult);
30653
+ return appendUnknownCommitmentContent(requirements, parseResult);
30495
30654
  }
30496
30655
  /**
30497
30656
  * Imports text files referenced by IMPORT commitments and appends their transformed content to the system message.
@@ -30613,6 +30772,36 @@
30613
30772
  }
30614
30773
  return appendSystemMessageSection(requirements, nonCommitmentContent);
30615
30774
  }
30775
+ /**
30776
+ * Appends unknown commitment blocks as final extra context without applying commitment side effects.
30777
+ *
30778
+ * @param requirements - Current requirements snapshot.
30779
+ * @param parseResult - Parsed source including unknown commitment blocks.
30780
+ * @returns Requirements with unknown commitment context appended at the end of the system message.
30781
+ *
30782
+ * @private internal utility of `augmentAgentModelRequirementsFromSource`
30783
+ */
30784
+ function appendUnknownCommitmentContent(requirements, parseResult) {
30785
+ const unknownCommitmentContent = getUnknownCommitmentContent(parseResult);
30786
+ if (!unknownCommitmentContent) {
30787
+ return requirements;
30788
+ }
30789
+ return appendSystemMessageSection(requirements, unknownCommitmentContent);
30790
+ }
30791
+ /**
30792
+ * Joins unknown commitment blocks into their final extra-context representation.
30793
+ *
30794
+ * @param parseResult - Parsed source including unknown commitment blocks.
30795
+ * @returns Unknown commitment source blocks in their original order.
30796
+ *
30797
+ * @private internal utility of `appendUnknownCommitmentContent`
30798
+ */
30799
+ function getUnknownCommitmentContent(parseResult) {
30800
+ return parseResult.unknownCommitments
30801
+ .map((commitment) => commitment.source)
30802
+ .filter(Boolean)
30803
+ .join('\n\n');
30804
+ }
30616
30805
  /**
30617
30806
  * Collects plain-text lines that were not parsed as commitments and should still become part of the final system message.
30618
30807
  *
@@ -30940,6 +31129,245 @@
30940
31129
  return Object.keys(rest).length > 0 ? rest : undefined;
30941
31130
  }
30942
31131
 
31132
+ /**
31133
+ * Pattern matching a markdown section heading (`## Title`) that separates system-message sections
31134
+ *
31135
+ * @private internal constant of `deduplicateSystemMessage`
31136
+ */
31137
+ const SYSTEM_MESSAGE_SECTION_HEADING_PATTERN = /^##(?!#)\s*(.+?)\s*$/;
31138
+ /**
31139
+ * Pattern matching a fenced code block delimiter which suspends section and block splitting
31140
+ *
31141
+ * @private internal constant of `deduplicateSystemMessage`
31142
+ */
31143
+ const CODE_FENCE_PATTERN = /^\s*(?:```|~~~)/;
31144
+ /**
31145
+ * Pattern matching a markdown list item which keeps merged bullet lists visually compact
31146
+ *
31147
+ * @private internal constant of `deduplicateSystemMessage`
31148
+ */
31149
+ const LIST_ITEM_PATTERN = /^\s*(?:[-*+]|\d+[.)])\s/;
31150
+ /**
31151
+ * Removes duplicated instructions from a generated system message
31152
+ *
31153
+ * Commitments are applied one by one, so a commitment used multiple times in one book repeats its whole
31154
+ * section, including the shared guidance preamble. For example two `WRITING RULES` commitments emit the
31155
+ * `## Writing rules` heading and its guidance paragraph twice. This function merges all sections sharing
31156
+ * one heading into the position of their first occurrence and keeps every identical block only once.
31157
+ *
31158
+ * @param systemMessage The assembled system message which may contain repeated sections and blocks
31159
+ * @returns The system message where each section heading and each identical block appears exactly once
31160
+ *
31161
+ * @private internal utility of `createAgentModelRequirementsWithCommitments`
31162
+ */
31163
+ function deduplicateSystemMessage(systemMessage) {
31164
+ if (!systemMessage.trim()) {
31165
+ return systemMessage;
31166
+ }
31167
+ return splitSystemMessageIntoRegions(systemMessage)
31168
+ .reduce(mergeRegionSharingHeading, [])
31169
+ .map(removeDuplicateBlocksFromRegion)
31170
+ .map(renderRegion)
31171
+ .filter((renderedRegion) => renderedRegion !== '')
31172
+ .join('\n\n');
31173
+ }
31174
+ /**
31175
+ * Splits the system message into the intro region and one region per `## Title` section
31176
+ *
31177
+ * @param systemMessage The system message to split
31178
+ * @returns Regions in their original order, without empty ones
31179
+ *
31180
+ * @private internal utility of `deduplicateSystemMessage`
31181
+ */
31182
+ function splitSystemMessageIntoRegions(systemMessage) {
31183
+ const regions = [];
31184
+ let headingLine = null;
31185
+ let bodyLines = [];
31186
+ let isInsideCodeFence = false;
31187
+ for (const line of systemMessage.split(/\r?\n/)) {
31188
+ if (CODE_FENCE_PATTERN.test(line)) {
31189
+ isInsideCodeFence = !isInsideCodeFence;
31190
+ }
31191
+ if (isInsideCodeFence || !SYSTEM_MESSAGE_SECTION_HEADING_PATTERN.test(line)) {
31192
+ bodyLines.push(line);
31193
+ continue;
31194
+ }
31195
+ regions.push(createRegion(headingLine, bodyLines));
31196
+ headingLine = line;
31197
+ bodyLines = [];
31198
+ }
31199
+ regions.push(createRegion(headingLine, bodyLines));
31200
+ return regions.filter((region) => region.headingLine !== null || region.blocks.length > 0);
31201
+ }
31202
+ /**
31203
+ * Creates one region from its heading line and its raw body lines
31204
+ *
31205
+ * @param headingLine The original `## Title` line, or `null` for the intro before the first heading
31206
+ * @param bodyLines The raw lines following the heading line
31207
+ * @returns The region with its body already split into blocks
31208
+ *
31209
+ * @private internal utility of `splitSystemMessageIntoRegions`
31210
+ */
31211
+ function createRegion(headingLine, bodyLines) {
31212
+ return {
31213
+ titleKey: headingLine === null ? null : normalizeSectionTitle(headingLine),
31214
+ headingLine,
31215
+ isBodySeparatedByBlankLine: bodyLines[0] !== undefined && bodyLines[0].trim() === '',
31216
+ blocks: splitBodyIntoBlocks(bodyLines),
31217
+ };
31218
+ }
31219
+ /**
31220
+ * Normalizes a heading line into a key usable for matching sections which belong together
31221
+ *
31222
+ * @param headingLine The original `## Title` line
31223
+ * @returns Lowercased title without the markdown heading prefix
31224
+ *
31225
+ * @private internal utility of `createRegion`
31226
+ */
31227
+ function normalizeSectionTitle(headingLine) {
31228
+ var _a, _b;
31229
+ return ((_b = (_a = SYSTEM_MESSAGE_SECTION_HEADING_PATTERN.exec(headingLine)) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : headingLine).toLowerCase();
31230
+ }
31231
+ /**
31232
+ * Splits raw body lines into blocks separated by blank lines while keeping fenced code blocks intact
31233
+ *
31234
+ * @param bodyLines The raw lines of one region body
31235
+ * @returns Non-empty blocks in their original order
31236
+ *
31237
+ * @private internal utility of `createRegion`
31238
+ */
31239
+ function splitBodyIntoBlocks(bodyLines) {
31240
+ const blockTexts = [];
31241
+ let blockLines = [];
31242
+ let isInsideCodeFence = false;
31243
+ for (const line of bodyLines) {
31244
+ if (CODE_FENCE_PATTERN.test(line)) {
31245
+ isInsideCodeFence = !isInsideCodeFence;
31246
+ }
31247
+ if (!isInsideCodeFence && line.trim() === '') {
31248
+ blockTexts.push(blockLines.join('\n'));
31249
+ blockLines = [];
31250
+ continue;
31251
+ }
31252
+ blockLines.push(line);
31253
+ }
31254
+ blockTexts.push(blockLines.join('\n'));
31255
+ return blockTexts
31256
+ .filter((blockText) => blockText.trim() !== '')
31257
+ .map((blockText) => ({ text: blockText, isOpeningMergedSection: false }));
31258
+ }
31259
+ /**
31260
+ * Appends one region to the already merged regions, merging it into an earlier region with the same heading
31261
+ *
31262
+ * @param mergedRegions Regions merged so far, used as the reducer accumulator
31263
+ * @param region The next region in original order
31264
+ * @returns The accumulator with the region either appended or merged into its earlier twin
31265
+ *
31266
+ * @private internal utility of `deduplicateSystemMessage`
31267
+ */
31268
+ function mergeRegionSharingHeading(mergedRegions, region) {
31269
+ const existingRegionIndex = mergedRegions.findIndex((mergedRegion) => region.titleKey !== null && mergedRegion.titleKey === region.titleKey);
31270
+ if (existingRegionIndex === -1) {
31271
+ return [...mergedRegions, region];
31272
+ }
31273
+ return mergedRegions.map((mergedRegion, index) => index !== existingRegionIndex
31274
+ ? mergedRegion
31275
+ : {
31276
+ ...mergedRegion,
31277
+ blocks: [...mergedRegion.blocks, ...markFirstBlockAsOpeningMergedSection(region.blocks)],
31278
+ });
31279
+ }
31280
+ /**
31281
+ * Marks the first block of a merged section occurrence so the merge seam can be rendered as one list
31282
+ *
31283
+ * @param blocks The blocks of the section occurrence being merged into an earlier section
31284
+ * @returns The same blocks with the first one marked as opening a merged section
31285
+ *
31286
+ * @private internal utility of `mergeRegionSharingHeading`
31287
+ */
31288
+ function markFirstBlockAsOpeningMergedSection(blocks) {
31289
+ return blocks.map((block, index) => (index === 0 ? { ...block, isOpeningMergedSection: true } : block));
31290
+ }
31291
+ /**
31292
+ * Keeps only the first occurrence of every identical block inside one region
31293
+ *
31294
+ * @param region The region whose blocks may repeat
31295
+ * @returns The region without repeated blocks
31296
+ *
31297
+ * @private internal utility of `deduplicateSystemMessage`
31298
+ */
31299
+ function removeDuplicateBlocksFromRegion(region) {
31300
+ const alreadyRenderedTexts = new Set();
31301
+ const uniqueBlocks = [];
31302
+ let isMergeSeamPending = false;
31303
+ for (const block of region.blocks) {
31304
+ if (alreadyRenderedTexts.has(block.text)) {
31305
+ // Note: A removed block must still hand its merge seam over to the next block which survives
31306
+ isMergeSeamPending = isMergeSeamPending || block.isOpeningMergedSection;
31307
+ continue;
31308
+ }
31309
+ alreadyRenderedTexts.add(block.text);
31310
+ uniqueBlocks.push({
31311
+ text: block.text,
31312
+ isOpeningMergedSection: block.isOpeningMergedSection || isMergeSeamPending,
31313
+ });
31314
+ isMergeSeamPending = false;
31315
+ }
31316
+ return { ...region, blocks: uniqueBlocks };
31317
+ }
31318
+ /**
31319
+ * Renders one region back into its markdown representation
31320
+ *
31321
+ * @param region The region to render
31322
+ * @returns The heading line together with its joined blocks
31323
+ *
31324
+ * @private internal utility of `deduplicateSystemMessage`
31325
+ */
31326
+ function renderRegion(region) {
31327
+ const body = joinBlocks(region.blocks);
31328
+ if (region.headingLine === null) {
31329
+ return body;
31330
+ }
31331
+ if (body === '') {
31332
+ return region.headingLine;
31333
+ }
31334
+ return `${region.headingLine}${region.isBodySeparatedByBlankLine ? '\n\n' : '\n'}${body}`;
31335
+ }
31336
+ /**
31337
+ * Joins blocks of one region back together
31338
+ *
31339
+ * @param blocks The blocks to join in their original order
31340
+ * @returns The joined body of one region
31341
+ *
31342
+ * @private internal utility of `renderRegion`
31343
+ */
31344
+ function joinBlocks(blocks) {
31345
+ return blocks
31346
+ .map((block, index) => index === 0 ? block.text : `${createBlockSeparator(blocks[index - 1], block)}${block.text}`)
31347
+ .join('');
31348
+ }
31349
+ /**
31350
+ * Chooses the separator between two neighboring blocks
31351
+ *
31352
+ * Blocks are normally separated by a blank line, exactly as they were written. Only where two sections were
31353
+ * merged together their lists are joined into one compact list instead of two separate ones.
31354
+ *
31355
+ * @param previousBlock The block rendered before the separator
31356
+ * @param nextBlock The block rendered after the separator
31357
+ * @returns Either a single or a double newline
31358
+ *
31359
+ * @private internal utility of `joinBlocks`
31360
+ */
31361
+ function createBlockSeparator(previousBlock, nextBlock) {
31362
+ if (!nextBlock.isOpeningMergedSection) {
31363
+ return '\n\n';
31364
+ }
31365
+ const previousBlockLines = previousBlock.text.split('\n');
31366
+ const isListContinuing = LIST_ITEM_PATTERN.test(previousBlockLines[previousBlockLines.length - 1]) &&
31367
+ LIST_ITEM_PATTERN.test(nextBlock.text.split('\n')[0]);
31368
+ return isListContinuing ? '\n' : '\n\n';
31369
+ }
31370
+
30943
31371
  /**
30944
31372
  * Removes single-hash comment lines (`# Comment`) from a system message
30945
31373
  * This is used to clean up the final system message before sending it to the AI model
@@ -31013,14 +31441,14 @@
31013
31441
  * Performs the final system-message cleanup pass after all other augmentation steps are complete.
31014
31442
  *
31015
31443
  * @param requirements - Fully built requirements before final cleanup.
31016
- * @returns Requirements with comment lines removed from the final system message.
31444
+ * @returns Requirements with comment lines removed and repeated instructions deduplicated in the final system message.
31017
31445
  *
31018
31446
  * @private internal utility of `createAgentModelRequirementsWithCommitments`
31019
31447
  */
31020
31448
  function finalizeRequirements(requirements) {
31021
31449
  return {
31022
31450
  ...requirements,
31023
- systemMessage: removeCommentsFromSystemMessage(requirements.systemMessage),
31451
+ systemMessage: deduplicateSystemMessage(removeCommentsFromSystemMessage(requirements.systemMessage)),
31024
31452
  };
31025
31453
  }
31026
31454
 
@@ -31683,28 +32111,28 @@
31683
32111
  */
31684
32112
  function buildToolInvocationScript(options) {
31685
32113
  const { functionName, functionArgsExpression } = options;
31686
- return `
31687
- const args = ${functionArgsExpression};
31688
- const runtimeContextRaw =
31689
- typeof ${TOOL_RUNTIME_CONTEXT_PARAMETER} === 'undefined'
31690
- ? undefined
31691
- : ${TOOL_RUNTIME_CONTEXT_PARAMETER};
32114
+ return _spaceTrim.spaceTrim((block) => `
32115
+ const args = ${block(functionArgsExpression)};
32116
+ const runtimeContextRaw =
32117
+ typeof ${TOOL_RUNTIME_CONTEXT_PARAMETER} === 'undefined'
32118
+ ? undefined
32119
+ : ${TOOL_RUNTIME_CONTEXT_PARAMETER};
31692
32120
 
31693
- if (runtimeContextRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
31694
- args.${TOOL_RUNTIME_CONTEXT_ARGUMENT} = runtimeContextRaw;
31695
- }
32121
+ if (runtimeContextRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
32122
+ args.${TOOL_RUNTIME_CONTEXT_ARGUMENT} = runtimeContextRaw;
32123
+ }
31696
32124
 
31697
- const toolProgressTokenRaw =
31698
- typeof ${TOOL_PROGRESS_TOKEN_PARAMETER} === 'undefined'
31699
- ? undefined
31700
- : ${TOOL_PROGRESS_TOKEN_PARAMETER};
32125
+ const toolProgressTokenRaw =
32126
+ typeof ${TOOL_PROGRESS_TOKEN_PARAMETER} === 'undefined'
32127
+ ? undefined
32128
+ : ${TOOL_PROGRESS_TOKEN_PARAMETER};
31701
32129
 
31702
- if (toolProgressTokenRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
31703
- args.${TOOL_PROGRESS_TOKEN_ARGUMENT} = toolProgressTokenRaw;
31704
- }
32130
+ if (toolProgressTokenRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
32131
+ args.${TOOL_PROGRESS_TOKEN_ARGUMENT} = toolProgressTokenRaw;
32132
+ }
31705
32133
 
31706
- return await ${functionName}(args);
31707
- `;
32134
+ return await ${functionName}(args);
32135
+ `);
31708
32136
  }
31709
32137
 
31710
32138
  /**