@promptbook/browser 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 +531 -107
  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 +2 -7
  156. package/umd/index.umd.js +530 -106
  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
@@ -27,7 +27,7 @@
27
27
  * @generated
28
28
  * @see https://github.com/webgptorg/promptbook
29
29
  */
30
- const PROMPTBOOK_ENGINE_VERSION = '0.114.0-4';
30
+ const PROMPTBOOK_ENGINE_VERSION = '0.114.0-41';
31
31
  /**
32
32
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
33
33
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -2604,6 +2604,12 @@
2604
2604
 
2605
2605
  Inherits agent source from another agent.
2606
2606
 
2607
+ Every agent inherits from the core agent \`@Adam\` unless it says otherwise, so writing no ${this.type} at all
2608
+ is the same as writing \`${this.type} @Adam\`. Write \`${this.type} @Null\` to inherit from nothing.
2609
+
2610
+ An agent has exactly one parent, so when ${this.type} is written more than once, the last one wins and
2611
+ overrides every earlier one.
2612
+
2607
2613
  ## Examples
2608
2614
 
2609
2615
  \`\`\`book
@@ -2612,6 +2618,13 @@
2612
2618
  FROM https://s6.ptbk.io/benjamin-white
2613
2619
  RULE Speak only in English.
2614
2620
  \`\`\`
2621
+
2622
+ \`\`\`book
2623
+ My Standalone Agent
2624
+
2625
+ FROM @Null
2626
+ RULE Speak only in English.
2627
+ \`\`\`
2615
2628
  `);
2616
2629
  }
2617
2630
  applyToAgentModelRequirements(requirements, content) {
@@ -4116,6 +4129,13 @@
4116
4129
  }
4117
4130
 
4118
4131
  /* eslint-disable no-magic-numbers */
4132
+ // Note: [💞] Ignore a discrepancy between file name and entity name
4133
+ /**
4134
+ * Default square size used by avatar renderers.
4135
+ *
4136
+ * @private utility of the avatar rendering system
4137
+ */
4138
+ const DEFAULT_AVATAR_SIZE = 192;
4119
4139
  /**
4120
4140
  * Corner radius ratio used for the common rounded card frame.
4121
4141
  *
@@ -4486,6 +4506,15 @@
4486
4506
  * @private helper of `asciiOctopusAvatarVisual`
4487
4507
  */
4488
4508
  const ATMOSPHERE_GLYPHS = ['.', ':', "'", '`'];
4509
+ /**
4510
+ * Coordinate space the octopus layout is generated in when it is painted into a terminal.
4511
+ *
4512
+ * The terminal renderer has its own character grid, so the geometry only needs one stable
4513
+ * square coordinate space which the grid is then sampled from.
4514
+ *
4515
+ * @private helper of `asciiOctopusAvatarVisual`
4516
+ */
4517
+ const TERMINAL_ASCII_OCTOPUS_LAYOUT_SIZE = DEFAULT_AVATAR_SIZE;
4489
4518
  /**
4490
4519
  * AsciiOctopus avatar visual.
4491
4520
  *
@@ -4502,41 +4531,115 @@
4502
4531
  const staticRandom = createRandom('ascii-octopus-static');
4503
4532
  const gridMetrics = createAsciiGridMetrics(size, gridRandom);
4504
4533
  const layout = createAsciiOctopusLayout(size, timeMs, createRandom, staticRandom, interaction);
4534
+ const glyphGrid = createAsciiOctopusGlyphGrid({
4535
+ sampleGrid: gridMetrics,
4536
+ layout,
4537
+ palette,
4538
+ cellRandom: createRandom('ascii-octopus-cells'),
4539
+ timeMs,
4540
+ });
4505
4541
  drawAvatarFrame(context, size, palette);
4506
4542
  drawAsciiBackdrop(context, size, palette, layout, timeMs);
4507
4543
  context.save();
4508
4544
  context.font = `600 ${gridMetrics.fontSize}px monospace`;
4509
4545
  context.textAlign = 'center';
4510
4546
  context.textBaseline = 'middle';
4511
- // The ASCII renderer samples the morphing octopus field on a low-resolution grid so the shape stays organic
4512
- // while the glyph layout remains deterministic for the same avatar input.
4513
- const cellRandom = createRandom('ascii-octopus-cells');
4514
4547
  for (let rowIndex = 0; rowIndex < gridMetrics.rowCount; rowIndex++) {
4515
4548
  for (let columnIndex = 0; columnIndex < gridMetrics.columnCount; columnIndex++) {
4516
- const point = {
4517
- x: gridMetrics.offsetX + columnIndex * gridMetrics.cellWidth,
4518
- y: gridMetrics.offsetY + rowIndex * gridMetrics.cellHeight,
4519
- };
4520
- const noise = cellRandom();
4521
- const glyphDescriptor = resolveAsciiGlyph({
4522
- point,
4523
- layout,
4524
- palette,
4525
- cellWidth: gridMetrics.cellWidth,
4526
- cellHeight: gridMetrics.cellHeight,
4527
- noise,
4528
- timeMs,
4529
- });
4549
+ const glyphDescriptor = glyphGrid[rowIndex][columnIndex];
4530
4550
  if (!glyphDescriptor) {
4531
4551
  continue;
4532
4552
  }
4553
+ const point = resolveAsciiSampleGridPoint(gridMetrics, columnIndex, rowIndex);
4533
4554
  context.fillStyle = glyphDescriptor.color;
4534
4555
  context.fillText(glyphDescriptor.character, point.x, point.y);
4535
4556
  }
4536
4557
  }
4537
4558
  context.restore();
4538
4559
  },
4560
+ renderTerminalText({ columns, rows, palette, createRandom, timeMs, interaction }) {
4561
+ const staticRandom = createRandom('ascii-octopus-static');
4562
+ const layout = createAsciiOctopusLayout(TERMINAL_ASCII_OCTOPUS_LAYOUT_SIZE, timeMs, createRandom, staticRandom, interaction);
4563
+ return createAsciiOctopusGlyphGrid({
4564
+ sampleGrid: createAsciiTerminalSampleGrid(columns, rows),
4565
+ layout,
4566
+ palette,
4567
+ cellRandom: createRandom('ascii-octopus-cells'),
4568
+ timeMs,
4569
+ });
4570
+ },
4539
4571
  };
4572
+ /**
4573
+ * Resolves the geometry point sampled for one cell of the grid.
4574
+ *
4575
+ * @param sampleGrid Character-cell sampling grid.
4576
+ * @param columnIndex Zero-based cell column.
4577
+ * @param rowIndex Zero-based cell row.
4578
+ * @returns Sampled point in the octopus coordinate space.
4579
+ *
4580
+ * @private helper of `asciiOctopusAvatarVisual`
4581
+ */
4582
+ function resolveAsciiSampleGridPoint(sampleGrid, columnIndex, rowIndex) {
4583
+ return {
4584
+ x: sampleGrid.offsetX + columnIndex * sampleGrid.cellWidth,
4585
+ y: sampleGrid.offsetY + rowIndex * sampleGrid.cellHeight,
4586
+ };
4587
+ }
4588
+ /**
4589
+ * Builds the sampling grid used when the octopus is painted straight into terminal character cells.
4590
+ *
4591
+ * @param columns Available terminal columns.
4592
+ * @param rows Available terminal rows.
4593
+ * @returns Character-cell sampling grid covering the whole octopus coordinate space.
4594
+ *
4595
+ * @private helper of `asciiOctopusAvatarVisual`
4596
+ */
4597
+ function createAsciiTerminalSampleGrid(columns, rows) {
4598
+ const cellWidth = TERMINAL_ASCII_OCTOPUS_LAYOUT_SIZE / columns;
4599
+ const cellHeight = TERMINAL_ASCII_OCTOPUS_LAYOUT_SIZE / rows;
4600
+ return {
4601
+ cellWidth,
4602
+ cellHeight,
4603
+ columnCount: columns,
4604
+ rowCount: rows,
4605
+ offsetX: cellWidth / 2,
4606
+ offsetY: cellHeight / 2,
4607
+ };
4608
+ }
4609
+ /**
4610
+ * Samples the morphing octopus field into one deterministic grid of ASCII glyphs.
4611
+ *
4612
+ * The field is sampled on a low-resolution grid so the shape stays organic while the glyph
4613
+ * layout remains deterministic for the same avatar input. Both the canvas visual and the
4614
+ * terminal visual share this single sampling pass so they always describe the same octopus.
4615
+ *
4616
+ * @param options Sampling grid, prepared octopus layout, palette, per-cell noise, and animation time.
4617
+ * @returns Resolved glyph of every sampled cell, where `null` means an empty cell.
4618
+ *
4619
+ * @private helper of `asciiOctopusAvatarVisual`
4620
+ */
4621
+ function createAsciiOctopusGlyphGrid(options) {
4622
+ const { sampleGrid, layout, palette, cellRandom, timeMs } = options;
4623
+ const glyphGrid = [];
4624
+ for (let rowIndex = 0; rowIndex < sampleGrid.rowCount; rowIndex++) {
4625
+ const glyphRow = [];
4626
+ for (let columnIndex = 0; columnIndex < sampleGrid.columnCount; columnIndex++) {
4627
+ const point = resolveAsciiSampleGridPoint(sampleGrid, columnIndex, rowIndex);
4628
+ const noise = cellRandom();
4629
+ glyphRow.push(resolveAsciiGlyph({
4630
+ point,
4631
+ layout,
4632
+ palette,
4633
+ cellWidth: sampleGrid.cellWidth,
4634
+ cellHeight: sampleGrid.cellHeight,
4635
+ noise,
4636
+ timeMs,
4637
+ }));
4638
+ }
4639
+ glyphGrid.push(glyphRow);
4640
+ }
4641
+ return glyphGrid;
4642
+ }
4540
4643
  /**
4541
4644
  * Draws the dark terminal-like glow behind the ASCII octopus.
4542
4645
  *
@@ -16933,29 +17036,36 @@
16933
17036
  /**
16934
17037
  * `WRITING RULES` commitment definition.
16935
17038
  *
16936
- * It adds constraints that apply strictly to writing style and presentation
16937
- * rather than task-solving behavior.
17039
+ * The `WRITING RULES`/`WRITING RULE` commitment adds constraints that apply strictly to writing style
17040
+ * and presentation rather than task-solving behavior.
17041
+ *
17042
+ * Example usage in agent source:
17043
+ *
17044
+ * ```book
17045
+ * WRITING RULES Keep every response under 120 words
17046
+ * WRITING RULE Always end the message with an emoji
17047
+ * ```
16938
17048
  *
16939
17049
  * @private [🪔] Maybe export the commitments through some package
16940
17050
  */
16941
17051
  class WritingRulesCommitmentDefinition extends BaseCommitmentDefinition {
16942
- constructor() {
16943
- super('WRITING RULES');
17052
+ constructor(type = 'WRITING RULES') {
17053
+ super(type);
16944
17054
  }
16945
17055
  /**
16946
- * Short one-line description of `WRITING RULES`.
17056
+ * Short one-line description of `WRITING RULES`/`WRITING RULE`.
16947
17057
  */
16948
17058
  get description() {
16949
17059
  return 'Add writing-only constraints such as tone, length, formatting, or emoji usage.';
16950
17060
  }
16951
17061
  /**
16952
- * Icon for `WRITING RULES`.
17062
+ * Icon for `WRITING RULES`/`WRITING RULE`.
16953
17063
  */
16954
17064
  get icon() {
16955
17065
  return '📝';
16956
17066
  }
16957
17067
  /**
16958
- * Markdown documentation for `WRITING RULES`.
17068
+ * Markdown documentation for `WRITING RULES`/`WRITING RULE` commitment.
16959
17069
  */
16960
17070
  get documentation() {
16961
17071
  return spacetrim.spaceTrim(`
@@ -16965,6 +17075,7 @@
16965
17075
 
16966
17076
  ## Key aspects
16967
17077
 
17078
+ - All writing rules are treated equally regardless of singular/plural form.
16968
17079
  - Use it for writing-only constraints such as tone, formatting, length, emoji usage, punctuation, or reading level.
16969
17080
  - Do **not** use it for problem-solving behavior, policy, tool usage, or decision-making logic. Use \`RULE\` for that.
16970
17081
  - Newer writing-rules blocks override conflicting earlier writing-rules blocks.
@@ -17163,7 +17274,8 @@
17163
17274
  new LanguageCommitmentDefinition('LANGUAGE'),
17164
17275
  new LanguageCommitmentDefinition('LANGUAGES'),
17165
17276
  new WritingSampleCommitmentDefinition(),
17166
- new WritingRulesCommitmentDefinition(),
17277
+ new WritingRulesCommitmentDefinition('WRITING RULES'),
17278
+ new WritingRulesCommitmentDefinition('WRITING RULE'),
17167
17279
  new SampleCommitmentDefinition('SAMPLE'),
17168
17280
  new SampleCommitmentDefinition('EXAMPLE'),
17169
17281
  new FormatCommitmentDefinition('FORMAT'),
@@ -18471,6 +18583,30 @@
18471
18583
  return normalizeAgentName(`Agent ${agentHash.substring(0, LIMITS.SHORT_NAME_LENGTH)}`);
18472
18584
  }
18473
18585
 
18586
+ /**
18587
+ * Pattern shared by Book parsing and editor highlighting for a commitment-like line.
18588
+ *
18589
+ * A Book commitment keyword consists of one or more all-uppercase words with at least
18590
+ * two characters each. This deliberately mirrors the Book editor syntax rule so an
18591
+ * unknown keyword starts a new source block everywhere it is interpreted.
18592
+ *
18593
+ * @private internal constant of `getBookCommitmentLineType`
18594
+ */
18595
+ const BOOK_COMMITMENT_LINE_TYPE_REGEX = /^\s*(?<type>[A-Z][A-Z0-9]+(?:\s+[A-Z][A-Z0-9]+)*)(?=\s|$)/;
18596
+ /**
18597
+ * Extracts the uppercase commitment type from a Book line, including types not registered by Promptbook.
18598
+ *
18599
+ * @param line - One raw Book source line.
18600
+ * @returns Matched commitment type or `null` when the line does not begin with commitment syntax.
18601
+ *
18602
+ * @private internal utility of Book parsing and `<BookEditor/>`
18603
+ */
18604
+ function getBookCommitmentLineType(line) {
18605
+ var _a;
18606
+ const match = BOOK_COMMITMENT_LINE_TYPE_REGEX.exec(line);
18607
+ return ((_a = match === null || match === void 0 ? void 0 : match.groups) === null || _a === void 0 ? void 0 : _a.type) || null;
18608
+ }
18609
+
18474
18610
  /**
18475
18611
  * Consumes the agent-name prelude from raw source.
18476
18612
  *
@@ -18528,13 +18664,15 @@
18528
18664
  return {
18529
18665
  agentName: null,
18530
18666
  commitments: [],
18667
+ unknownCommitments: [],
18531
18668
  nonCommitmentLines: [],
18532
18669
  };
18533
18670
  }
18534
18671
  const { lines, agentName, agentNameLineIndex, agentNameLineNumber } = parseAgentSourcePrelude(agentSource);
18535
18672
  const commitments = [];
18673
+ const unknownCommitments = [];
18536
18674
  const nonCommitmentLines = agentNameLineIndex >= 0 ? [lines[agentNameLineIndex]] : [];
18537
- // Parse commitments with multiline support
18675
+ // Parse commitments with multiline support.
18538
18676
  let currentCommitment = null;
18539
18677
  // Process lines starting from after the agent name line
18540
18678
  const startIndex = agentNameLineIndex >= 0 ? agentNameLineIndex + 1 : 0;
@@ -18548,25 +18686,11 @@
18548
18686
  // Check if this line starts or ends a code block
18549
18687
  if (trimmedLine.startsWith('```')) {
18550
18688
  isInsideCodeBlock = !isInsideCodeBlock;
18551
- if (currentCommitment) {
18552
- // If we are inside a commitment, the code block is part of it
18553
- currentCommitment.contentLines.push(line);
18554
- }
18555
- else {
18556
- // If we are not inside a commitment, the code block is non-commitment
18557
- nonCommitmentLines.push(line);
18558
- }
18689
+ appendLineToCurrentCommitmentOrNonCommitmentLines(currentCommitment, line, nonCommitmentLines);
18559
18690
  continue;
18560
18691
  }
18561
18692
  if (isInsideCodeBlock) {
18562
- if (currentCommitment) {
18563
- // If we are inside a commitment and a code block, the line is part of the commitment
18564
- currentCommitment.contentLines.push(line);
18565
- }
18566
- else {
18567
- // If we are inside a code block but not a commitment, the line is non-commitment
18568
- nonCommitmentLines.push(line);
18569
- }
18693
+ appendLineToCurrentCommitmentOrNonCommitmentLines(currentCommitment, line, nonCommitmentLines);
18570
18694
  continue;
18571
18695
  }
18572
18696
  // Check if this line starts a new commitment
@@ -18575,22 +18699,14 @@
18575
18699
  const typeRegex = definition.createTypeRegex();
18576
18700
  const match = typeRegex.exec(line.trim());
18577
18701
  if (match && ((_a = match.groups) === null || _a === void 0 ? void 0 : _a.type)) {
18578
- // Save the previous commitment if it exists
18579
- if (currentCommitment) {
18580
- const fullContent = currentCommitment.contentLines.join('\n');
18581
- commitments.push({
18582
- type: currentCommitment.type,
18583
- content: spacetrim.spaceTrim(fullContent),
18584
- originalLine: currentCommitment.originalStartLine,
18585
- lineNumber: currentCommitment.startLineNumber,
18586
- });
18587
- }
18702
+ appendCurrentCommitment(currentCommitment, commitments, unknownCommitments);
18588
18703
  // Extract the initial content from the commitment line
18589
18704
  const fullRegex = definition.createRegex();
18590
18705
  const fullMatch = fullRegex.exec(line.trim());
18591
18706
  const initialContent = ((_b = fullMatch === null || fullMatch === void 0 ? void 0 : fullMatch.groups) === null || _b === void 0 ? void 0 : _b.contents) || '';
18592
18707
  // Start a new commitment
18593
18708
  currentCommitment = {
18709
+ kind: 'known',
18594
18710
  type: definition.type,
18595
18711
  startLineNumber: i + 1,
18596
18712
  originalStartLine: line,
@@ -18600,52 +18716,90 @@
18600
18716
  break;
18601
18717
  }
18602
18718
  }
18719
+ if (foundNewCommitment) {
18720
+ continue;
18721
+ }
18722
+ const unknownCommitmentType = getBookCommitmentLineType(line);
18723
+ if (unknownCommitmentType) {
18724
+ appendCurrentCommitment(currentCommitment, commitments, unknownCommitments);
18725
+ currentCommitment = {
18726
+ kind: 'unknown',
18727
+ type: unknownCommitmentType,
18728
+ startLineNumber: i + 1,
18729
+ originalStartLine: line,
18730
+ sourceLines: [line],
18731
+ };
18732
+ continue;
18733
+ }
18603
18734
  // Check if this is a horizontal line (ends any current commitment)
18604
18735
  const isHorizontalLine = HORIZONTAL_LINE_PATTERN$1.test(line);
18605
18736
  if (isHorizontalLine) {
18606
- // Save the current commitment if it exists
18607
- if (currentCommitment) {
18608
- const fullContent = currentCommitment.contentLines.join('\n');
18609
- commitments.push({
18610
- type: currentCommitment.type,
18611
- content: spacetrim.spaceTrim(fullContent),
18612
- originalLine: currentCommitment.originalStartLine,
18613
- lineNumber: currentCommitment.startLineNumber,
18614
- });
18615
- currentCommitment = null;
18616
- }
18737
+ appendCurrentCommitment(currentCommitment, commitments, unknownCommitments);
18738
+ currentCommitment = null;
18617
18739
  // Add horizontal line to non-commitment lines
18618
18740
  nonCommitmentLines.push(line);
18619
18741
  continue;
18620
18742
  }
18621
- if (!foundNewCommitment) {
18622
- if (currentCommitment) {
18623
- // This line belongs to the current commitment
18624
- currentCommitment.contentLines.push(line);
18625
- }
18626
- else {
18627
- // This line is not part of any commitment
18628
- nonCommitmentLines.push(line);
18629
- }
18630
- }
18631
- }
18632
- // Don't forget to save the last commitment if it exists
18633
- if (currentCommitment) {
18634
- const fullContent = currentCommitment.contentLines.join('\n');
18635
- commitments.push({
18636
- type: currentCommitment.type,
18637
- content: spacetrim.spaceTrim(fullContent),
18638
- originalLine: currentCommitment.originalStartLine,
18639
- lineNumber: currentCommitment.startLineNumber,
18640
- });
18743
+ appendLineToCurrentCommitmentOrNonCommitmentLines(currentCommitment, line, nonCommitmentLines);
18641
18744
  }
18745
+ appendCurrentCommitment(currentCommitment, commitments, unknownCommitments);
18642
18746
  return {
18643
18747
  agentName,
18644
18748
  agentNameLineNumber,
18645
18749
  commitments,
18750
+ unknownCommitments,
18646
18751
  nonCommitmentLines,
18647
18752
  };
18648
18753
  }
18754
+ /**
18755
+ * Stores the current known or unknown commitment in its appropriate parsed collection.
18756
+ *
18757
+ * @param currentCommitment - Commitment-like block collected so far.
18758
+ * @param commitments - Parsed registered commitments to append to.
18759
+ * @param unknownCommitments - Parsed unregistered commitments to append to.
18760
+ *
18761
+ * @private internal utility of `parseAgentSourceWithCommitments`
18762
+ */
18763
+ function appendCurrentCommitment(currentCommitment, commitments, unknownCommitments) {
18764
+ if (!currentCommitment) {
18765
+ return;
18766
+ }
18767
+ if (currentCommitment.kind === 'unknown') {
18768
+ unknownCommitments.push({
18769
+ type: currentCommitment.type,
18770
+ originalLine: currentCommitment.originalStartLine,
18771
+ lineNumber: currentCommitment.startLineNumber,
18772
+ source: spacetrim.spaceTrim(currentCommitment.sourceLines.join('\n')),
18773
+ });
18774
+ return;
18775
+ }
18776
+ commitments.push({
18777
+ type: currentCommitment.type,
18778
+ content: spacetrim.spaceTrim(currentCommitment.contentLines.join('\n')),
18779
+ originalLine: currentCommitment.originalStartLine,
18780
+ lineNumber: currentCommitment.startLineNumber,
18781
+ });
18782
+ }
18783
+ /**
18784
+ * Adds one source line to the active commitment-like block, or to plain source content when none is active.
18785
+ *
18786
+ * @param currentCommitment - Commitment-like block currently being collected.
18787
+ * @param line - Source line to append.
18788
+ * @param nonCommitmentLines - Plain source lines to append to when no block is active.
18789
+ *
18790
+ * @private internal utility of `parseAgentSourceWithCommitments`
18791
+ */
18792
+ function appendLineToCurrentCommitmentOrNonCommitmentLines(currentCommitment, line, nonCommitmentLines) {
18793
+ if (!currentCommitment) {
18794
+ nonCommitmentLines.push(line);
18795
+ return;
18796
+ }
18797
+ if (currentCommitment.kind === 'unknown') {
18798
+ currentCommitment.sourceLines.push(line);
18799
+ return;
18800
+ }
18801
+ currentCommitment.contentLines.push(line);
18802
+ }
18649
18803
 
18650
18804
  /**
18651
18805
  * Parses parameters from text using both supported notations:
@@ -19546,7 +19700,7 @@
19546
19700
  padBook(validateBook(spacetrim.spaceTrim(`
19547
19701
  AI Avatar
19548
19702
 
19549
- PERSONA A friendly AI assistant that helps you with your tasks
19703
+ GOAL Help users with their tasks as a friendly AI assistant.
19550
19704
  `)));
19551
19705
  // <- Note: Not using book`...` notation to avoid strange error in jest unit tests `TypeError: (0 , book_notation_1.book) is not a function`
19552
19706
  // <- TODO: [🐱‍🚀] `GENESIS_BOOK` / `ADAM_BOOK` in `/agents/adam.book`
@@ -26428,7 +26582,8 @@
26428
26582
  requirements = await importReferencedFiles(requirements);
26429
26583
  requirements = appendMcpServers(requirements, agentSource);
26430
26584
  requirements = appendNonCommitmentContent(requirements, parseResult);
26431
- return appendExampleInteractions(requirements, parseResult);
26585
+ requirements = appendExampleInteractions(requirements, parseResult);
26586
+ return appendUnknownCommitmentContent(requirements, parseResult);
26432
26587
  }
26433
26588
  /**
26434
26589
  * Imports text files referenced by IMPORT commitments and appends their transformed content to the system message.
@@ -26550,6 +26705,36 @@
26550
26705
  }
26551
26706
  return appendSystemMessageSection(requirements, nonCommitmentContent);
26552
26707
  }
26708
+ /**
26709
+ * Appends unknown commitment blocks as final extra context without applying commitment side effects.
26710
+ *
26711
+ * @param requirements - Current requirements snapshot.
26712
+ * @param parseResult - Parsed source including unknown commitment blocks.
26713
+ * @returns Requirements with unknown commitment context appended at the end of the system message.
26714
+ *
26715
+ * @private internal utility of `augmentAgentModelRequirementsFromSource`
26716
+ */
26717
+ function appendUnknownCommitmentContent(requirements, parseResult) {
26718
+ const unknownCommitmentContent = getUnknownCommitmentContent(parseResult);
26719
+ if (!unknownCommitmentContent) {
26720
+ return requirements;
26721
+ }
26722
+ return appendSystemMessageSection(requirements, unknownCommitmentContent);
26723
+ }
26724
+ /**
26725
+ * Joins unknown commitment blocks into their final extra-context representation.
26726
+ *
26727
+ * @param parseResult - Parsed source including unknown commitment blocks.
26728
+ * @returns Unknown commitment source blocks in their original order.
26729
+ *
26730
+ * @private internal utility of `appendUnknownCommitmentContent`
26731
+ */
26732
+ function getUnknownCommitmentContent(parseResult) {
26733
+ return parseResult.unknownCommitments
26734
+ .map((commitment) => commitment.source)
26735
+ .filter(Boolean)
26736
+ .join('\n\n');
26737
+ }
26553
26738
  /**
26554
26739
  * Collects plain-text lines that were not parsed as commitments and should still become part of the final system message.
26555
26740
  *
@@ -26877,6 +27062,245 @@
26877
27062
  return Object.keys(rest).length > 0 ? rest : undefined;
26878
27063
  }
26879
27064
 
27065
+ /**
27066
+ * Pattern matching a markdown section heading (`## Title`) that separates system-message sections
27067
+ *
27068
+ * @private internal constant of `deduplicateSystemMessage`
27069
+ */
27070
+ const SYSTEM_MESSAGE_SECTION_HEADING_PATTERN = /^##(?!#)\s*(.+?)\s*$/;
27071
+ /**
27072
+ * Pattern matching a fenced code block delimiter which suspends section and block splitting
27073
+ *
27074
+ * @private internal constant of `deduplicateSystemMessage`
27075
+ */
27076
+ const CODE_FENCE_PATTERN = /^\s*(?:```|~~~)/;
27077
+ /**
27078
+ * Pattern matching a markdown list item which keeps merged bullet lists visually compact
27079
+ *
27080
+ * @private internal constant of `deduplicateSystemMessage`
27081
+ */
27082
+ const LIST_ITEM_PATTERN = /^\s*(?:[-*+]|\d+[.)])\s/;
27083
+ /**
27084
+ * Removes duplicated instructions from a generated system message
27085
+ *
27086
+ * Commitments are applied one by one, so a commitment used multiple times in one book repeats its whole
27087
+ * section, including the shared guidance preamble. For example two `WRITING RULES` commitments emit the
27088
+ * `## Writing rules` heading and its guidance paragraph twice. This function merges all sections sharing
27089
+ * one heading into the position of their first occurrence and keeps every identical block only once.
27090
+ *
27091
+ * @param systemMessage The assembled system message which may contain repeated sections and blocks
27092
+ * @returns The system message where each section heading and each identical block appears exactly once
27093
+ *
27094
+ * @private internal utility of `createAgentModelRequirementsWithCommitments`
27095
+ */
27096
+ function deduplicateSystemMessage(systemMessage) {
27097
+ if (!systemMessage.trim()) {
27098
+ return systemMessage;
27099
+ }
27100
+ return splitSystemMessageIntoRegions(systemMessage)
27101
+ .reduce(mergeRegionSharingHeading, [])
27102
+ .map(removeDuplicateBlocksFromRegion)
27103
+ .map(renderRegion)
27104
+ .filter((renderedRegion) => renderedRegion !== '')
27105
+ .join('\n\n');
27106
+ }
27107
+ /**
27108
+ * Splits the system message into the intro region and one region per `## Title` section
27109
+ *
27110
+ * @param systemMessage The system message to split
27111
+ * @returns Regions in their original order, without empty ones
27112
+ *
27113
+ * @private internal utility of `deduplicateSystemMessage`
27114
+ */
27115
+ function splitSystemMessageIntoRegions(systemMessage) {
27116
+ const regions = [];
27117
+ let headingLine = null;
27118
+ let bodyLines = [];
27119
+ let isInsideCodeFence = false;
27120
+ for (const line of systemMessage.split(/\r?\n/)) {
27121
+ if (CODE_FENCE_PATTERN.test(line)) {
27122
+ isInsideCodeFence = !isInsideCodeFence;
27123
+ }
27124
+ if (isInsideCodeFence || !SYSTEM_MESSAGE_SECTION_HEADING_PATTERN.test(line)) {
27125
+ bodyLines.push(line);
27126
+ continue;
27127
+ }
27128
+ regions.push(createRegion(headingLine, bodyLines));
27129
+ headingLine = line;
27130
+ bodyLines = [];
27131
+ }
27132
+ regions.push(createRegion(headingLine, bodyLines));
27133
+ return regions.filter((region) => region.headingLine !== null || region.blocks.length > 0);
27134
+ }
27135
+ /**
27136
+ * Creates one region from its heading line and its raw body lines
27137
+ *
27138
+ * @param headingLine The original `## Title` line, or `null` for the intro before the first heading
27139
+ * @param bodyLines The raw lines following the heading line
27140
+ * @returns The region with its body already split into blocks
27141
+ *
27142
+ * @private internal utility of `splitSystemMessageIntoRegions`
27143
+ */
27144
+ function createRegion(headingLine, bodyLines) {
27145
+ return {
27146
+ titleKey: headingLine === null ? null : normalizeSectionTitle(headingLine),
27147
+ headingLine,
27148
+ isBodySeparatedByBlankLine: bodyLines[0] !== undefined && bodyLines[0].trim() === '',
27149
+ blocks: splitBodyIntoBlocks(bodyLines),
27150
+ };
27151
+ }
27152
+ /**
27153
+ * Normalizes a heading line into a key usable for matching sections which belong together
27154
+ *
27155
+ * @param headingLine The original `## Title` line
27156
+ * @returns Lowercased title without the markdown heading prefix
27157
+ *
27158
+ * @private internal utility of `createRegion`
27159
+ */
27160
+ function normalizeSectionTitle(headingLine) {
27161
+ var _a, _b;
27162
+ 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();
27163
+ }
27164
+ /**
27165
+ * Splits raw body lines into blocks separated by blank lines while keeping fenced code blocks intact
27166
+ *
27167
+ * @param bodyLines The raw lines of one region body
27168
+ * @returns Non-empty blocks in their original order
27169
+ *
27170
+ * @private internal utility of `createRegion`
27171
+ */
27172
+ function splitBodyIntoBlocks(bodyLines) {
27173
+ const blockTexts = [];
27174
+ let blockLines = [];
27175
+ let isInsideCodeFence = false;
27176
+ for (const line of bodyLines) {
27177
+ if (CODE_FENCE_PATTERN.test(line)) {
27178
+ isInsideCodeFence = !isInsideCodeFence;
27179
+ }
27180
+ if (!isInsideCodeFence && line.trim() === '') {
27181
+ blockTexts.push(blockLines.join('\n'));
27182
+ blockLines = [];
27183
+ continue;
27184
+ }
27185
+ blockLines.push(line);
27186
+ }
27187
+ blockTexts.push(blockLines.join('\n'));
27188
+ return blockTexts
27189
+ .filter((blockText) => blockText.trim() !== '')
27190
+ .map((blockText) => ({ text: blockText, isOpeningMergedSection: false }));
27191
+ }
27192
+ /**
27193
+ * Appends one region to the already merged regions, merging it into an earlier region with the same heading
27194
+ *
27195
+ * @param mergedRegions Regions merged so far, used as the reducer accumulator
27196
+ * @param region The next region in original order
27197
+ * @returns The accumulator with the region either appended or merged into its earlier twin
27198
+ *
27199
+ * @private internal utility of `deduplicateSystemMessage`
27200
+ */
27201
+ function mergeRegionSharingHeading(mergedRegions, region) {
27202
+ const existingRegionIndex = mergedRegions.findIndex((mergedRegion) => region.titleKey !== null && mergedRegion.titleKey === region.titleKey);
27203
+ if (existingRegionIndex === -1) {
27204
+ return [...mergedRegions, region];
27205
+ }
27206
+ return mergedRegions.map((mergedRegion, index) => index !== existingRegionIndex
27207
+ ? mergedRegion
27208
+ : {
27209
+ ...mergedRegion,
27210
+ blocks: [...mergedRegion.blocks, ...markFirstBlockAsOpeningMergedSection(region.blocks)],
27211
+ });
27212
+ }
27213
+ /**
27214
+ * Marks the first block of a merged section occurrence so the merge seam can be rendered as one list
27215
+ *
27216
+ * @param blocks The blocks of the section occurrence being merged into an earlier section
27217
+ * @returns The same blocks with the first one marked as opening a merged section
27218
+ *
27219
+ * @private internal utility of `mergeRegionSharingHeading`
27220
+ */
27221
+ function markFirstBlockAsOpeningMergedSection(blocks) {
27222
+ return blocks.map((block, index) => (index === 0 ? { ...block, isOpeningMergedSection: true } : block));
27223
+ }
27224
+ /**
27225
+ * Keeps only the first occurrence of every identical block inside one region
27226
+ *
27227
+ * @param region The region whose blocks may repeat
27228
+ * @returns The region without repeated blocks
27229
+ *
27230
+ * @private internal utility of `deduplicateSystemMessage`
27231
+ */
27232
+ function removeDuplicateBlocksFromRegion(region) {
27233
+ const alreadyRenderedTexts = new Set();
27234
+ const uniqueBlocks = [];
27235
+ let isMergeSeamPending = false;
27236
+ for (const block of region.blocks) {
27237
+ if (alreadyRenderedTexts.has(block.text)) {
27238
+ // Note: A removed block must still hand its merge seam over to the next block which survives
27239
+ isMergeSeamPending = isMergeSeamPending || block.isOpeningMergedSection;
27240
+ continue;
27241
+ }
27242
+ alreadyRenderedTexts.add(block.text);
27243
+ uniqueBlocks.push({
27244
+ text: block.text,
27245
+ isOpeningMergedSection: block.isOpeningMergedSection || isMergeSeamPending,
27246
+ });
27247
+ isMergeSeamPending = false;
27248
+ }
27249
+ return { ...region, blocks: uniqueBlocks };
27250
+ }
27251
+ /**
27252
+ * Renders one region back into its markdown representation
27253
+ *
27254
+ * @param region The region to render
27255
+ * @returns The heading line together with its joined blocks
27256
+ *
27257
+ * @private internal utility of `deduplicateSystemMessage`
27258
+ */
27259
+ function renderRegion(region) {
27260
+ const body = joinBlocks(region.blocks);
27261
+ if (region.headingLine === null) {
27262
+ return body;
27263
+ }
27264
+ if (body === '') {
27265
+ return region.headingLine;
27266
+ }
27267
+ return `${region.headingLine}${region.isBodySeparatedByBlankLine ? '\n\n' : '\n'}${body}`;
27268
+ }
27269
+ /**
27270
+ * Joins blocks of one region back together
27271
+ *
27272
+ * @param blocks The blocks to join in their original order
27273
+ * @returns The joined body of one region
27274
+ *
27275
+ * @private internal utility of `renderRegion`
27276
+ */
27277
+ function joinBlocks(blocks) {
27278
+ return blocks
27279
+ .map((block, index) => index === 0 ? block.text : `${createBlockSeparator(blocks[index - 1], block)}${block.text}`)
27280
+ .join('');
27281
+ }
27282
+ /**
27283
+ * Chooses the separator between two neighboring blocks
27284
+ *
27285
+ * Blocks are normally separated by a blank line, exactly as they were written. Only where two sections were
27286
+ * merged together their lists are joined into one compact list instead of two separate ones.
27287
+ *
27288
+ * @param previousBlock The block rendered before the separator
27289
+ * @param nextBlock The block rendered after the separator
27290
+ * @returns Either a single or a double newline
27291
+ *
27292
+ * @private internal utility of `joinBlocks`
27293
+ */
27294
+ function createBlockSeparator(previousBlock, nextBlock) {
27295
+ if (!nextBlock.isOpeningMergedSection) {
27296
+ return '\n\n';
27297
+ }
27298
+ const previousBlockLines = previousBlock.text.split('\n');
27299
+ const isListContinuing = LIST_ITEM_PATTERN.test(previousBlockLines[previousBlockLines.length - 1]) &&
27300
+ LIST_ITEM_PATTERN.test(nextBlock.text.split('\n')[0]);
27301
+ return isListContinuing ? '\n' : '\n\n';
27302
+ }
27303
+
26880
27304
  /**
26881
27305
  * Removes single-hash comment lines (`# Comment`) from a system message
26882
27306
  * This is used to clean up the final system message before sending it to the AI model
@@ -26950,14 +27374,14 @@
26950
27374
  * Performs the final system-message cleanup pass after all other augmentation steps are complete.
26951
27375
  *
26952
27376
  * @param requirements - Fully built requirements before final cleanup.
26953
- * @returns Requirements with comment lines removed from the final system message.
27377
+ * @returns Requirements with comment lines removed and repeated instructions deduplicated in the final system message.
26954
27378
  *
26955
27379
  * @private internal utility of `createAgentModelRequirementsWithCommitments`
26956
27380
  */
26957
27381
  function finalizeRequirements(requirements) {
26958
27382
  return {
26959
27383
  ...requirements,
26960
- systemMessage: removeCommentsFromSystemMessage(requirements.systemMessage),
27384
+ systemMessage: deduplicateSystemMessage(removeCommentsFromSystemMessage(requirements.systemMessage)),
26961
27385
  };
26962
27386
  }
26963
27387
 
@@ -27633,28 +28057,28 @@
27633
28057
  */
27634
28058
  function buildToolInvocationScript(options) {
27635
28059
  const { functionName, functionArgsExpression } = options;
27636
- return `
27637
- const args = ${functionArgsExpression};
27638
- const runtimeContextRaw =
27639
- typeof ${TOOL_RUNTIME_CONTEXT_PARAMETER} === 'undefined'
27640
- ? undefined
27641
- : ${TOOL_RUNTIME_CONTEXT_PARAMETER};
28060
+ return spacetrim.spaceTrim((block) => `
28061
+ const args = ${block(functionArgsExpression)};
28062
+ const runtimeContextRaw =
28063
+ typeof ${TOOL_RUNTIME_CONTEXT_PARAMETER} === 'undefined'
28064
+ ? undefined
28065
+ : ${TOOL_RUNTIME_CONTEXT_PARAMETER};
27642
28066
 
27643
- if (runtimeContextRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
27644
- args.${TOOL_RUNTIME_CONTEXT_ARGUMENT} = runtimeContextRaw;
27645
- }
28067
+ if (runtimeContextRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
28068
+ args.${TOOL_RUNTIME_CONTEXT_ARGUMENT} = runtimeContextRaw;
28069
+ }
27646
28070
 
27647
- const toolProgressTokenRaw =
27648
- typeof ${TOOL_PROGRESS_TOKEN_PARAMETER} === 'undefined'
27649
- ? undefined
27650
- : ${TOOL_PROGRESS_TOKEN_PARAMETER};
28071
+ const toolProgressTokenRaw =
28072
+ typeof ${TOOL_PROGRESS_TOKEN_PARAMETER} === 'undefined'
28073
+ ? undefined
28074
+ : ${TOOL_PROGRESS_TOKEN_PARAMETER};
27651
28075
 
27652
- if (toolProgressTokenRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
27653
- args.${TOOL_PROGRESS_TOKEN_ARGUMENT} = toolProgressTokenRaw;
27654
- }
28076
+ if (toolProgressTokenRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
28077
+ args.${TOOL_PROGRESS_TOKEN_ARGUMENT} = toolProgressTokenRaw;
28078
+ }
27655
28079
 
27656
- return await ${functionName}(args);
27657
- `;
28080
+ return await ${functionName}(args);
28081
+ `);
27658
28082
  }
27659
28083
 
27660
28084
  /**