@promptbook/core 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 +586 -127
  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 -9
  156. package/umd/index.umd.js +586 -127
  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/esm/index.es.js CHANGED
@@ -26,7 +26,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
26
26
  * @generated
27
27
  * @see https://github.com/webgptorg/promptbook
28
28
  */
29
- const PROMPTBOOK_ENGINE_VERSION = '0.114.0-4';
29
+ const PROMPTBOOK_ENGINE_VERSION = '0.114.0-41';
30
30
  /**
31
31
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
32
32
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -9896,6 +9896,12 @@ class FromCommitmentDefinition extends BaseCommitmentDefinition {
9896
9896
 
9897
9897
  Inherits agent source from another agent.
9898
9898
 
9899
+ Every agent inherits from the core agent \`@Adam\` unless it says otherwise, so writing no ${this.type} at all
9900
+ is the same as writing \`${this.type} @Adam\`. Write \`${this.type} @Null\` to inherit from nothing.
9901
+
9902
+ An agent has exactly one parent, so when ${this.type} is written more than once, the last one wins and
9903
+ overrides every earlier one.
9904
+
9899
9905
  ## Examples
9900
9906
 
9901
9907
  \`\`\`book
@@ -9904,6 +9910,13 @@ class FromCommitmentDefinition extends BaseCommitmentDefinition {
9904
9910
  FROM https://s6.ptbk.io/benjamin-white
9905
9911
  RULE Speak only in English.
9906
9912
  \`\`\`
9913
+
9914
+ \`\`\`book
9915
+ My Standalone Agent
9916
+
9917
+ FROM @Null
9918
+ RULE Speak only in English.
9919
+ \`\`\`
9907
9920
  `);
9908
9921
  }
9909
9922
  applyToAgentModelRequirements(requirements, content) {
@@ -11036,6 +11049,13 @@ function darken(amount) {
11036
11049
  }
11037
11050
 
11038
11051
  /* eslint-disable no-magic-numbers */
11052
+ // Note: [💞] Ignore a discrepancy between file name and entity name
11053
+ /**
11054
+ * Default square size used by avatar renderers.
11055
+ *
11056
+ * @private utility of the avatar rendering system
11057
+ */
11058
+ const DEFAULT_AVATAR_SIZE = 192;
11039
11059
  /**
11040
11060
  * Corner radius ratio used for the common rounded card frame.
11041
11061
  *
@@ -11406,6 +11426,15 @@ const OUTLINE_GLYPHS = ['#', '%', '@'];
11406
11426
  * @private helper of `asciiOctopusAvatarVisual`
11407
11427
  */
11408
11428
  const ATMOSPHERE_GLYPHS = ['.', ':', "'", '`'];
11429
+ /**
11430
+ * Coordinate space the octopus layout is generated in when it is painted into a terminal.
11431
+ *
11432
+ * The terminal renderer has its own character grid, so the geometry only needs one stable
11433
+ * square coordinate space which the grid is then sampled from.
11434
+ *
11435
+ * @private helper of `asciiOctopusAvatarVisual`
11436
+ */
11437
+ const TERMINAL_ASCII_OCTOPUS_LAYOUT_SIZE = DEFAULT_AVATAR_SIZE;
11409
11438
  /**
11410
11439
  * AsciiOctopus avatar visual.
11411
11440
  *
@@ -11422,41 +11451,115 @@ const asciiOctopusAvatarVisual = {
11422
11451
  const staticRandom = createRandom('ascii-octopus-static');
11423
11452
  const gridMetrics = createAsciiGridMetrics(size, gridRandom);
11424
11453
  const layout = createAsciiOctopusLayout(size, timeMs, createRandom, staticRandom, interaction);
11454
+ const glyphGrid = createAsciiOctopusGlyphGrid({
11455
+ sampleGrid: gridMetrics,
11456
+ layout,
11457
+ palette,
11458
+ cellRandom: createRandom('ascii-octopus-cells'),
11459
+ timeMs,
11460
+ });
11425
11461
  drawAvatarFrame(context, size, palette);
11426
11462
  drawAsciiBackdrop(context, size, palette, layout, timeMs);
11427
11463
  context.save();
11428
11464
  context.font = `600 ${gridMetrics.fontSize}px monospace`;
11429
11465
  context.textAlign = 'center';
11430
11466
  context.textBaseline = 'middle';
11431
- // The ASCII renderer samples the morphing octopus field on a low-resolution grid so the shape stays organic
11432
- // while the glyph layout remains deterministic for the same avatar input.
11433
- const cellRandom = createRandom('ascii-octopus-cells');
11434
11467
  for (let rowIndex = 0; rowIndex < gridMetrics.rowCount; rowIndex++) {
11435
11468
  for (let columnIndex = 0; columnIndex < gridMetrics.columnCount; columnIndex++) {
11436
- const point = {
11437
- x: gridMetrics.offsetX + columnIndex * gridMetrics.cellWidth,
11438
- y: gridMetrics.offsetY + rowIndex * gridMetrics.cellHeight,
11439
- };
11440
- const noise = cellRandom();
11441
- const glyphDescriptor = resolveAsciiGlyph({
11442
- point,
11443
- layout,
11444
- palette,
11445
- cellWidth: gridMetrics.cellWidth,
11446
- cellHeight: gridMetrics.cellHeight,
11447
- noise,
11448
- timeMs,
11449
- });
11469
+ const glyphDescriptor = glyphGrid[rowIndex][columnIndex];
11450
11470
  if (!glyphDescriptor) {
11451
11471
  continue;
11452
11472
  }
11473
+ const point = resolveAsciiSampleGridPoint(gridMetrics, columnIndex, rowIndex);
11453
11474
  context.fillStyle = glyphDescriptor.color;
11454
11475
  context.fillText(glyphDescriptor.character, point.x, point.y);
11455
11476
  }
11456
11477
  }
11457
11478
  context.restore();
11458
11479
  },
11480
+ renderTerminalText({ columns, rows, palette, createRandom, timeMs, interaction }) {
11481
+ const staticRandom = createRandom('ascii-octopus-static');
11482
+ const layout = createAsciiOctopusLayout(TERMINAL_ASCII_OCTOPUS_LAYOUT_SIZE, timeMs, createRandom, staticRandom, interaction);
11483
+ return createAsciiOctopusGlyphGrid({
11484
+ sampleGrid: createAsciiTerminalSampleGrid(columns, rows),
11485
+ layout,
11486
+ palette,
11487
+ cellRandom: createRandom('ascii-octopus-cells'),
11488
+ timeMs,
11489
+ });
11490
+ },
11459
11491
  };
11492
+ /**
11493
+ * Resolves the geometry point sampled for one cell of the grid.
11494
+ *
11495
+ * @param sampleGrid Character-cell sampling grid.
11496
+ * @param columnIndex Zero-based cell column.
11497
+ * @param rowIndex Zero-based cell row.
11498
+ * @returns Sampled point in the octopus coordinate space.
11499
+ *
11500
+ * @private helper of `asciiOctopusAvatarVisual`
11501
+ */
11502
+ function resolveAsciiSampleGridPoint(sampleGrid, columnIndex, rowIndex) {
11503
+ return {
11504
+ x: sampleGrid.offsetX + columnIndex * sampleGrid.cellWidth,
11505
+ y: sampleGrid.offsetY + rowIndex * sampleGrid.cellHeight,
11506
+ };
11507
+ }
11508
+ /**
11509
+ * Builds the sampling grid used when the octopus is painted straight into terminal character cells.
11510
+ *
11511
+ * @param columns Available terminal columns.
11512
+ * @param rows Available terminal rows.
11513
+ * @returns Character-cell sampling grid covering the whole octopus coordinate space.
11514
+ *
11515
+ * @private helper of `asciiOctopusAvatarVisual`
11516
+ */
11517
+ function createAsciiTerminalSampleGrid(columns, rows) {
11518
+ const cellWidth = TERMINAL_ASCII_OCTOPUS_LAYOUT_SIZE / columns;
11519
+ const cellHeight = TERMINAL_ASCII_OCTOPUS_LAYOUT_SIZE / rows;
11520
+ return {
11521
+ cellWidth,
11522
+ cellHeight,
11523
+ columnCount: columns,
11524
+ rowCount: rows,
11525
+ offsetX: cellWidth / 2,
11526
+ offsetY: cellHeight / 2,
11527
+ };
11528
+ }
11529
+ /**
11530
+ * Samples the morphing octopus field into one deterministic grid of ASCII glyphs.
11531
+ *
11532
+ * The field is sampled on a low-resolution grid so the shape stays organic while the glyph
11533
+ * layout remains deterministic for the same avatar input. Both the canvas visual and the
11534
+ * terminal visual share this single sampling pass so they always describe the same octopus.
11535
+ *
11536
+ * @param options Sampling grid, prepared octopus layout, palette, per-cell noise, and animation time.
11537
+ * @returns Resolved glyph of every sampled cell, where `null` means an empty cell.
11538
+ *
11539
+ * @private helper of `asciiOctopusAvatarVisual`
11540
+ */
11541
+ function createAsciiOctopusGlyphGrid(options) {
11542
+ const { sampleGrid, layout, palette, cellRandom, timeMs } = options;
11543
+ const glyphGrid = [];
11544
+ for (let rowIndex = 0; rowIndex < sampleGrid.rowCount; rowIndex++) {
11545
+ const glyphRow = [];
11546
+ for (let columnIndex = 0; columnIndex < sampleGrid.columnCount; columnIndex++) {
11547
+ const point = resolveAsciiSampleGridPoint(sampleGrid, columnIndex, rowIndex);
11548
+ const noise = cellRandom();
11549
+ glyphRow.push(resolveAsciiGlyph({
11550
+ point,
11551
+ layout,
11552
+ palette,
11553
+ cellWidth: sampleGrid.cellWidth,
11554
+ cellHeight: sampleGrid.cellHeight,
11555
+ noise,
11556
+ timeMs,
11557
+ }));
11558
+ }
11559
+ glyphGrid.push(glyphRow);
11560
+ }
11561
+ return glyphGrid;
11562
+ }
11460
11563
  /**
11461
11564
  * Draws the dark terminal-like glow behind the ASCII octopus.
11462
11565
  *
@@ -23760,29 +23863,36 @@ class UseUserLocationCommitmentDefinition extends BaseCommitmentDefinition {
23760
23863
  /**
23761
23864
  * `WRITING RULES` commitment definition.
23762
23865
  *
23763
- * It adds constraints that apply strictly to writing style and presentation
23764
- * rather than task-solving behavior.
23866
+ * The `WRITING RULES`/`WRITING RULE` commitment adds constraints that apply strictly to writing style
23867
+ * and presentation rather than task-solving behavior.
23868
+ *
23869
+ * Example usage in agent source:
23870
+ *
23871
+ * ```book
23872
+ * WRITING RULES Keep every response under 120 words
23873
+ * WRITING RULE Always end the message with an emoji
23874
+ * ```
23765
23875
  *
23766
23876
  * @private [🪔] Maybe export the commitments through some package
23767
23877
  */
23768
23878
  class WritingRulesCommitmentDefinition extends BaseCommitmentDefinition {
23769
- constructor() {
23770
- super('WRITING RULES');
23879
+ constructor(type = 'WRITING RULES') {
23880
+ super(type);
23771
23881
  }
23772
23882
  /**
23773
- * Short one-line description of `WRITING RULES`.
23883
+ * Short one-line description of `WRITING RULES`/`WRITING RULE`.
23774
23884
  */
23775
23885
  get description() {
23776
23886
  return 'Add writing-only constraints such as tone, length, formatting, or emoji usage.';
23777
23887
  }
23778
23888
  /**
23779
- * Icon for `WRITING RULES`.
23889
+ * Icon for `WRITING RULES`/`WRITING RULE`.
23780
23890
  */
23781
23891
  get icon() {
23782
23892
  return '📝';
23783
23893
  }
23784
23894
  /**
23785
- * Markdown documentation for `WRITING RULES`.
23895
+ * Markdown documentation for `WRITING RULES`/`WRITING RULE` commitment.
23786
23896
  */
23787
23897
  get documentation() {
23788
23898
  return spaceTrim$1(`
@@ -23792,6 +23902,7 @@ class WritingRulesCommitmentDefinition extends BaseCommitmentDefinition {
23792
23902
 
23793
23903
  ## Key aspects
23794
23904
 
23905
+ - All writing rules are treated equally regardless of singular/plural form.
23795
23906
  - Use it for writing-only constraints such as tone, formatting, length, emoji usage, punctuation, or reading level.
23796
23907
  - Do **not** use it for problem-solving behavior, policy, tool usage, or decision-making logic. Use \`RULE\` for that.
23797
23908
  - Newer writing-rules blocks override conflicting earlier writing-rules blocks.
@@ -23990,7 +24101,8 @@ const COMMITMENT_REGISTRY = [
23990
24101
  new LanguageCommitmentDefinition('LANGUAGE'),
23991
24102
  new LanguageCommitmentDefinition('LANGUAGES'),
23992
24103
  new WritingSampleCommitmentDefinition(),
23993
- new WritingRulesCommitmentDefinition(),
24104
+ new WritingRulesCommitmentDefinition('WRITING RULES'),
24105
+ new WritingRulesCommitmentDefinition('WRITING RULE'),
23994
24106
  new SampleCommitmentDefinition('SAMPLE'),
23995
24107
  new SampleCommitmentDefinition('EXAMPLE'),
23996
24108
  new FormatCommitmentDefinition('FORMAT'),
@@ -24244,6 +24356,30 @@ function applyCommitmentDefinitionSafely(requirements, commitment, commitmentCon
24244
24356
  }
24245
24357
  }
24246
24358
 
24359
+ /**
24360
+ * Pattern shared by Book parsing and editor highlighting for a commitment-like line.
24361
+ *
24362
+ * A Book commitment keyword consists of one or more all-uppercase words with at least
24363
+ * two characters each. This deliberately mirrors the Book editor syntax rule so an
24364
+ * unknown keyword starts a new source block everywhere it is interpreted.
24365
+ *
24366
+ * @private internal constant of `getBookCommitmentLineType`
24367
+ */
24368
+ const BOOK_COMMITMENT_LINE_TYPE_REGEX = /^\s*(?<type>[A-Z][A-Z0-9]+(?:\s+[A-Z][A-Z0-9]+)*)(?=\s|$)/;
24369
+ /**
24370
+ * Extracts the uppercase commitment type from a Book line, including types not registered by Promptbook.
24371
+ *
24372
+ * @param line - One raw Book source line.
24373
+ * @returns Matched commitment type or `null` when the line does not begin with commitment syntax.
24374
+ *
24375
+ * @private internal utility of Book parsing and `<BookEditor/>`
24376
+ */
24377
+ function getBookCommitmentLineType(line) {
24378
+ var _a;
24379
+ const match = BOOK_COMMITMENT_LINE_TYPE_REGEX.exec(line);
24380
+ return ((_a = match === null || match === void 0 ? void 0 : match.groups) === null || _a === void 0 ? void 0 : _a.type) || null;
24381
+ }
24382
+
24247
24383
  /**
24248
24384
  * Consumes the agent-name prelude from raw source.
24249
24385
  *
@@ -24301,13 +24437,15 @@ function parseAgentSourceWithCommitments(agentSource) {
24301
24437
  return {
24302
24438
  agentName: null,
24303
24439
  commitments: [],
24440
+ unknownCommitments: [],
24304
24441
  nonCommitmentLines: [],
24305
24442
  };
24306
24443
  }
24307
24444
  const { lines, agentName, agentNameLineIndex, agentNameLineNumber } = parseAgentSourcePrelude(agentSource);
24308
24445
  const commitments = [];
24446
+ const unknownCommitments = [];
24309
24447
  const nonCommitmentLines = agentNameLineIndex >= 0 ? [lines[agentNameLineIndex]] : [];
24310
- // Parse commitments with multiline support
24448
+ // Parse commitments with multiline support.
24311
24449
  let currentCommitment = null;
24312
24450
  // Process lines starting from after the agent name line
24313
24451
  const startIndex = agentNameLineIndex >= 0 ? agentNameLineIndex + 1 : 0;
@@ -24321,25 +24459,11 @@ function parseAgentSourceWithCommitments(agentSource) {
24321
24459
  // Check if this line starts or ends a code block
24322
24460
  if (trimmedLine.startsWith('```')) {
24323
24461
  isInsideCodeBlock = !isInsideCodeBlock;
24324
- if (currentCommitment) {
24325
- // If we are inside a commitment, the code block is part of it
24326
- currentCommitment.contentLines.push(line);
24327
- }
24328
- else {
24329
- // If we are not inside a commitment, the code block is non-commitment
24330
- nonCommitmentLines.push(line);
24331
- }
24462
+ appendLineToCurrentCommitmentOrNonCommitmentLines(currentCommitment, line, nonCommitmentLines);
24332
24463
  continue;
24333
24464
  }
24334
24465
  if (isInsideCodeBlock) {
24335
- if (currentCommitment) {
24336
- // If we are inside a commitment and a code block, the line is part of the commitment
24337
- currentCommitment.contentLines.push(line);
24338
- }
24339
- else {
24340
- // If we are inside a code block but not a commitment, the line is non-commitment
24341
- nonCommitmentLines.push(line);
24342
- }
24466
+ appendLineToCurrentCommitmentOrNonCommitmentLines(currentCommitment, line, nonCommitmentLines);
24343
24467
  continue;
24344
24468
  }
24345
24469
  // Check if this line starts a new commitment
@@ -24348,22 +24472,14 @@ function parseAgentSourceWithCommitments(agentSource) {
24348
24472
  const typeRegex = definition.createTypeRegex();
24349
24473
  const match = typeRegex.exec(line.trim());
24350
24474
  if (match && ((_a = match.groups) === null || _a === void 0 ? void 0 : _a.type)) {
24351
- // Save the previous commitment if it exists
24352
- if (currentCommitment) {
24353
- const fullContent = currentCommitment.contentLines.join('\n');
24354
- commitments.push({
24355
- type: currentCommitment.type,
24356
- content: spaceTrim$1(fullContent),
24357
- originalLine: currentCommitment.originalStartLine,
24358
- lineNumber: currentCommitment.startLineNumber,
24359
- });
24360
- }
24475
+ appendCurrentCommitment(currentCommitment, commitments, unknownCommitments);
24361
24476
  // Extract the initial content from the commitment line
24362
24477
  const fullRegex = definition.createRegex();
24363
24478
  const fullMatch = fullRegex.exec(line.trim());
24364
24479
  const initialContent = ((_b = fullMatch === null || fullMatch === void 0 ? void 0 : fullMatch.groups) === null || _b === void 0 ? void 0 : _b.contents) || '';
24365
24480
  // Start a new commitment
24366
24481
  currentCommitment = {
24482
+ kind: 'known',
24367
24483
  type: definition.type,
24368
24484
  startLineNumber: i + 1,
24369
24485
  originalStartLine: line,
@@ -24373,52 +24489,90 @@ function parseAgentSourceWithCommitments(agentSource) {
24373
24489
  break;
24374
24490
  }
24375
24491
  }
24492
+ if (foundNewCommitment) {
24493
+ continue;
24494
+ }
24495
+ const unknownCommitmentType = getBookCommitmentLineType(line);
24496
+ if (unknownCommitmentType) {
24497
+ appendCurrentCommitment(currentCommitment, commitments, unknownCommitments);
24498
+ currentCommitment = {
24499
+ kind: 'unknown',
24500
+ type: unknownCommitmentType,
24501
+ startLineNumber: i + 1,
24502
+ originalStartLine: line,
24503
+ sourceLines: [line],
24504
+ };
24505
+ continue;
24506
+ }
24376
24507
  // Check if this is a horizontal line (ends any current commitment)
24377
24508
  const isHorizontalLine = HORIZONTAL_LINE_PATTERN$1.test(line);
24378
24509
  if (isHorizontalLine) {
24379
- // Save the current commitment if it exists
24380
- if (currentCommitment) {
24381
- const fullContent = currentCommitment.contentLines.join('\n');
24382
- commitments.push({
24383
- type: currentCommitment.type,
24384
- content: spaceTrim$1(fullContent),
24385
- originalLine: currentCommitment.originalStartLine,
24386
- lineNumber: currentCommitment.startLineNumber,
24387
- });
24388
- currentCommitment = null;
24389
- }
24510
+ appendCurrentCommitment(currentCommitment, commitments, unknownCommitments);
24511
+ currentCommitment = null;
24390
24512
  // Add horizontal line to non-commitment lines
24391
24513
  nonCommitmentLines.push(line);
24392
24514
  continue;
24393
24515
  }
24394
- if (!foundNewCommitment) {
24395
- if (currentCommitment) {
24396
- // This line belongs to the current commitment
24397
- currentCommitment.contentLines.push(line);
24398
- }
24399
- else {
24400
- // This line is not part of any commitment
24401
- nonCommitmentLines.push(line);
24402
- }
24403
- }
24404
- }
24405
- // Don't forget to save the last commitment if it exists
24406
- if (currentCommitment) {
24407
- const fullContent = currentCommitment.contentLines.join('\n');
24408
- commitments.push({
24409
- type: currentCommitment.type,
24410
- content: spaceTrim$1(fullContent),
24411
- originalLine: currentCommitment.originalStartLine,
24412
- lineNumber: currentCommitment.startLineNumber,
24413
- });
24516
+ appendLineToCurrentCommitmentOrNonCommitmentLines(currentCommitment, line, nonCommitmentLines);
24414
24517
  }
24518
+ appendCurrentCommitment(currentCommitment, commitments, unknownCommitments);
24415
24519
  return {
24416
24520
  agentName,
24417
24521
  agentNameLineNumber,
24418
24522
  commitments,
24523
+ unknownCommitments,
24419
24524
  nonCommitmentLines,
24420
24525
  };
24421
24526
  }
24527
+ /**
24528
+ * Stores the current known or unknown commitment in its appropriate parsed collection.
24529
+ *
24530
+ * @param currentCommitment - Commitment-like block collected so far.
24531
+ * @param commitments - Parsed registered commitments to append to.
24532
+ * @param unknownCommitments - Parsed unregistered commitments to append to.
24533
+ *
24534
+ * @private internal utility of `parseAgentSourceWithCommitments`
24535
+ */
24536
+ function appendCurrentCommitment(currentCommitment, commitments, unknownCommitments) {
24537
+ if (!currentCommitment) {
24538
+ return;
24539
+ }
24540
+ if (currentCommitment.kind === 'unknown') {
24541
+ unknownCommitments.push({
24542
+ type: currentCommitment.type,
24543
+ originalLine: currentCommitment.originalStartLine,
24544
+ lineNumber: currentCommitment.startLineNumber,
24545
+ source: spaceTrim$1(currentCommitment.sourceLines.join('\n')),
24546
+ });
24547
+ return;
24548
+ }
24549
+ commitments.push({
24550
+ type: currentCommitment.type,
24551
+ content: spaceTrim$1(currentCommitment.contentLines.join('\n')),
24552
+ originalLine: currentCommitment.originalStartLine,
24553
+ lineNumber: currentCommitment.startLineNumber,
24554
+ });
24555
+ }
24556
+ /**
24557
+ * Adds one source line to the active commitment-like block, or to plain source content when none is active.
24558
+ *
24559
+ * @param currentCommitment - Commitment-like block currently being collected.
24560
+ * @param line - Source line to append.
24561
+ * @param nonCommitmentLines - Plain source lines to append to when no block is active.
24562
+ *
24563
+ * @private internal utility of `parseAgentSourceWithCommitments`
24564
+ */
24565
+ function appendLineToCurrentCommitmentOrNonCommitmentLines(currentCommitment, line, nonCommitmentLines) {
24566
+ if (!currentCommitment) {
24567
+ nonCommitmentLines.push(line);
24568
+ return;
24569
+ }
24570
+ if (currentCommitment.kind === 'unknown') {
24571
+ currentCommitment.sourceLines.push(line);
24572
+ return;
24573
+ }
24574
+ currentCommitment.contentLines.push(line);
24575
+ }
24422
24576
 
24423
24577
  /**
24424
24578
  * Plugin for importing agent books *(`.book` files)*
@@ -24556,7 +24710,8 @@ async function augmentAgentModelRequirementsFromSource(requirements, parseResult
24556
24710
  requirements = await importReferencedFiles(requirements);
24557
24711
  requirements = appendMcpServers(requirements, agentSource);
24558
24712
  requirements = appendNonCommitmentContent(requirements, parseResult);
24559
- return appendExampleInteractions(requirements, parseResult);
24713
+ requirements = appendExampleInteractions(requirements, parseResult);
24714
+ return appendUnknownCommitmentContent(requirements, parseResult);
24560
24715
  }
24561
24716
  /**
24562
24717
  * Imports text files referenced by IMPORT commitments and appends their transformed content to the system message.
@@ -24678,6 +24833,36 @@ function appendNonCommitmentContent(requirements, parseResult) {
24678
24833
  }
24679
24834
  return appendSystemMessageSection(requirements, nonCommitmentContent);
24680
24835
  }
24836
+ /**
24837
+ * Appends unknown commitment blocks as final extra context without applying commitment side effects.
24838
+ *
24839
+ * @param requirements - Current requirements snapshot.
24840
+ * @param parseResult - Parsed source including unknown commitment blocks.
24841
+ * @returns Requirements with unknown commitment context appended at the end of the system message.
24842
+ *
24843
+ * @private internal utility of `augmentAgentModelRequirementsFromSource`
24844
+ */
24845
+ function appendUnknownCommitmentContent(requirements, parseResult) {
24846
+ const unknownCommitmentContent = getUnknownCommitmentContent(parseResult);
24847
+ if (!unknownCommitmentContent) {
24848
+ return requirements;
24849
+ }
24850
+ return appendSystemMessageSection(requirements, unknownCommitmentContent);
24851
+ }
24852
+ /**
24853
+ * Joins unknown commitment blocks into their final extra-context representation.
24854
+ *
24855
+ * @param parseResult - Parsed source including unknown commitment blocks.
24856
+ * @returns Unknown commitment source blocks in their original order.
24857
+ *
24858
+ * @private internal utility of `appendUnknownCommitmentContent`
24859
+ */
24860
+ function getUnknownCommitmentContent(parseResult) {
24861
+ return parseResult.unknownCommitments
24862
+ .map((commitment) => commitment.source)
24863
+ .filter(Boolean)
24864
+ .join('\n\n');
24865
+ }
24681
24866
  /**
24682
24867
  * Collects plain-text lines that were not parsed as commitments and should still become part of the final system message.
24683
24868
  *
@@ -25064,6 +25249,245 @@ function stripInlineKnowledgeMetadata(metadata) {
25064
25249
  return Object.keys(rest).length > 0 ? rest : undefined;
25065
25250
  }
25066
25251
 
25252
+ /**
25253
+ * Pattern matching a markdown section heading (`## Title`) that separates system-message sections
25254
+ *
25255
+ * @private internal constant of `deduplicateSystemMessage`
25256
+ */
25257
+ const SYSTEM_MESSAGE_SECTION_HEADING_PATTERN = /^##(?!#)\s*(.+?)\s*$/;
25258
+ /**
25259
+ * Pattern matching a fenced code block delimiter which suspends section and block splitting
25260
+ *
25261
+ * @private internal constant of `deduplicateSystemMessage`
25262
+ */
25263
+ const CODE_FENCE_PATTERN = /^\s*(?:```|~~~)/;
25264
+ /**
25265
+ * Pattern matching a markdown list item which keeps merged bullet lists visually compact
25266
+ *
25267
+ * @private internal constant of `deduplicateSystemMessage`
25268
+ */
25269
+ const LIST_ITEM_PATTERN = /^\s*(?:[-*+]|\d+[.)])\s/;
25270
+ /**
25271
+ * Removes duplicated instructions from a generated system message
25272
+ *
25273
+ * Commitments are applied one by one, so a commitment used multiple times in one book repeats its whole
25274
+ * section, including the shared guidance preamble. For example two `WRITING RULES` commitments emit the
25275
+ * `## Writing rules` heading and its guidance paragraph twice. This function merges all sections sharing
25276
+ * one heading into the position of their first occurrence and keeps every identical block only once.
25277
+ *
25278
+ * @param systemMessage The assembled system message which may contain repeated sections and blocks
25279
+ * @returns The system message where each section heading and each identical block appears exactly once
25280
+ *
25281
+ * @private internal utility of `createAgentModelRequirementsWithCommitments`
25282
+ */
25283
+ function deduplicateSystemMessage(systemMessage) {
25284
+ if (!systemMessage.trim()) {
25285
+ return systemMessage;
25286
+ }
25287
+ return splitSystemMessageIntoRegions(systemMessage)
25288
+ .reduce(mergeRegionSharingHeading, [])
25289
+ .map(removeDuplicateBlocksFromRegion)
25290
+ .map(renderRegion)
25291
+ .filter((renderedRegion) => renderedRegion !== '')
25292
+ .join('\n\n');
25293
+ }
25294
+ /**
25295
+ * Splits the system message into the intro region and one region per `## Title` section
25296
+ *
25297
+ * @param systemMessage The system message to split
25298
+ * @returns Regions in their original order, without empty ones
25299
+ *
25300
+ * @private internal utility of `deduplicateSystemMessage`
25301
+ */
25302
+ function splitSystemMessageIntoRegions(systemMessage) {
25303
+ const regions = [];
25304
+ let headingLine = null;
25305
+ let bodyLines = [];
25306
+ let isInsideCodeFence = false;
25307
+ for (const line of systemMessage.split(/\r?\n/)) {
25308
+ if (CODE_FENCE_PATTERN.test(line)) {
25309
+ isInsideCodeFence = !isInsideCodeFence;
25310
+ }
25311
+ if (isInsideCodeFence || !SYSTEM_MESSAGE_SECTION_HEADING_PATTERN.test(line)) {
25312
+ bodyLines.push(line);
25313
+ continue;
25314
+ }
25315
+ regions.push(createRegion(headingLine, bodyLines));
25316
+ headingLine = line;
25317
+ bodyLines = [];
25318
+ }
25319
+ regions.push(createRegion(headingLine, bodyLines));
25320
+ return regions.filter((region) => region.headingLine !== null || region.blocks.length > 0);
25321
+ }
25322
+ /**
25323
+ * Creates one region from its heading line and its raw body lines
25324
+ *
25325
+ * @param headingLine The original `## Title` line, or `null` for the intro before the first heading
25326
+ * @param bodyLines The raw lines following the heading line
25327
+ * @returns The region with its body already split into blocks
25328
+ *
25329
+ * @private internal utility of `splitSystemMessageIntoRegions`
25330
+ */
25331
+ function createRegion(headingLine, bodyLines) {
25332
+ return {
25333
+ titleKey: headingLine === null ? null : normalizeSectionTitle(headingLine),
25334
+ headingLine,
25335
+ isBodySeparatedByBlankLine: bodyLines[0] !== undefined && bodyLines[0].trim() === '',
25336
+ blocks: splitBodyIntoBlocks(bodyLines),
25337
+ };
25338
+ }
25339
+ /**
25340
+ * Normalizes a heading line into a key usable for matching sections which belong together
25341
+ *
25342
+ * @param headingLine The original `## Title` line
25343
+ * @returns Lowercased title without the markdown heading prefix
25344
+ *
25345
+ * @private internal utility of `createRegion`
25346
+ */
25347
+ function normalizeSectionTitle(headingLine) {
25348
+ var _a, _b;
25349
+ 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();
25350
+ }
25351
+ /**
25352
+ * Splits raw body lines into blocks separated by blank lines while keeping fenced code blocks intact
25353
+ *
25354
+ * @param bodyLines The raw lines of one region body
25355
+ * @returns Non-empty blocks in their original order
25356
+ *
25357
+ * @private internal utility of `createRegion`
25358
+ */
25359
+ function splitBodyIntoBlocks(bodyLines) {
25360
+ const blockTexts = [];
25361
+ let blockLines = [];
25362
+ let isInsideCodeFence = false;
25363
+ for (const line of bodyLines) {
25364
+ if (CODE_FENCE_PATTERN.test(line)) {
25365
+ isInsideCodeFence = !isInsideCodeFence;
25366
+ }
25367
+ if (!isInsideCodeFence && line.trim() === '') {
25368
+ blockTexts.push(blockLines.join('\n'));
25369
+ blockLines = [];
25370
+ continue;
25371
+ }
25372
+ blockLines.push(line);
25373
+ }
25374
+ blockTexts.push(blockLines.join('\n'));
25375
+ return blockTexts
25376
+ .filter((blockText) => blockText.trim() !== '')
25377
+ .map((blockText) => ({ text: blockText, isOpeningMergedSection: false }));
25378
+ }
25379
+ /**
25380
+ * Appends one region to the already merged regions, merging it into an earlier region with the same heading
25381
+ *
25382
+ * @param mergedRegions Regions merged so far, used as the reducer accumulator
25383
+ * @param region The next region in original order
25384
+ * @returns The accumulator with the region either appended or merged into its earlier twin
25385
+ *
25386
+ * @private internal utility of `deduplicateSystemMessage`
25387
+ */
25388
+ function mergeRegionSharingHeading(mergedRegions, region) {
25389
+ const existingRegionIndex = mergedRegions.findIndex((mergedRegion) => region.titleKey !== null && mergedRegion.titleKey === region.titleKey);
25390
+ if (existingRegionIndex === -1) {
25391
+ return [...mergedRegions, region];
25392
+ }
25393
+ return mergedRegions.map((mergedRegion, index) => index !== existingRegionIndex
25394
+ ? mergedRegion
25395
+ : {
25396
+ ...mergedRegion,
25397
+ blocks: [...mergedRegion.blocks, ...markFirstBlockAsOpeningMergedSection(region.blocks)],
25398
+ });
25399
+ }
25400
+ /**
25401
+ * Marks the first block of a merged section occurrence so the merge seam can be rendered as one list
25402
+ *
25403
+ * @param blocks The blocks of the section occurrence being merged into an earlier section
25404
+ * @returns The same blocks with the first one marked as opening a merged section
25405
+ *
25406
+ * @private internal utility of `mergeRegionSharingHeading`
25407
+ */
25408
+ function markFirstBlockAsOpeningMergedSection(blocks) {
25409
+ return blocks.map((block, index) => (index === 0 ? { ...block, isOpeningMergedSection: true } : block));
25410
+ }
25411
+ /**
25412
+ * Keeps only the first occurrence of every identical block inside one region
25413
+ *
25414
+ * @param region The region whose blocks may repeat
25415
+ * @returns The region without repeated blocks
25416
+ *
25417
+ * @private internal utility of `deduplicateSystemMessage`
25418
+ */
25419
+ function removeDuplicateBlocksFromRegion(region) {
25420
+ const alreadyRenderedTexts = new Set();
25421
+ const uniqueBlocks = [];
25422
+ let isMergeSeamPending = false;
25423
+ for (const block of region.blocks) {
25424
+ if (alreadyRenderedTexts.has(block.text)) {
25425
+ // Note: A removed block must still hand its merge seam over to the next block which survives
25426
+ isMergeSeamPending = isMergeSeamPending || block.isOpeningMergedSection;
25427
+ continue;
25428
+ }
25429
+ alreadyRenderedTexts.add(block.text);
25430
+ uniqueBlocks.push({
25431
+ text: block.text,
25432
+ isOpeningMergedSection: block.isOpeningMergedSection || isMergeSeamPending,
25433
+ });
25434
+ isMergeSeamPending = false;
25435
+ }
25436
+ return { ...region, blocks: uniqueBlocks };
25437
+ }
25438
+ /**
25439
+ * Renders one region back into its markdown representation
25440
+ *
25441
+ * @param region The region to render
25442
+ * @returns The heading line together with its joined blocks
25443
+ *
25444
+ * @private internal utility of `deduplicateSystemMessage`
25445
+ */
25446
+ function renderRegion(region) {
25447
+ const body = joinBlocks(region.blocks);
25448
+ if (region.headingLine === null) {
25449
+ return body;
25450
+ }
25451
+ if (body === '') {
25452
+ return region.headingLine;
25453
+ }
25454
+ return `${region.headingLine}${region.isBodySeparatedByBlankLine ? '\n\n' : '\n'}${body}`;
25455
+ }
25456
+ /**
25457
+ * Joins blocks of one region back together
25458
+ *
25459
+ * @param blocks The blocks to join in their original order
25460
+ * @returns The joined body of one region
25461
+ *
25462
+ * @private internal utility of `renderRegion`
25463
+ */
25464
+ function joinBlocks(blocks) {
25465
+ return blocks
25466
+ .map((block, index) => index === 0 ? block.text : `${createBlockSeparator(blocks[index - 1], block)}${block.text}`)
25467
+ .join('');
25468
+ }
25469
+ /**
25470
+ * Chooses the separator between two neighboring blocks
25471
+ *
25472
+ * Blocks are normally separated by a blank line, exactly as they were written. Only where two sections were
25473
+ * merged together their lists are joined into one compact list instead of two separate ones.
25474
+ *
25475
+ * @param previousBlock The block rendered before the separator
25476
+ * @param nextBlock The block rendered after the separator
25477
+ * @returns Either a single or a double newline
25478
+ *
25479
+ * @private internal utility of `joinBlocks`
25480
+ */
25481
+ function createBlockSeparator(previousBlock, nextBlock) {
25482
+ if (!nextBlock.isOpeningMergedSection) {
25483
+ return '\n\n';
25484
+ }
25485
+ const previousBlockLines = previousBlock.text.split('\n');
25486
+ const isListContinuing = LIST_ITEM_PATTERN.test(previousBlockLines[previousBlockLines.length - 1]) &&
25487
+ LIST_ITEM_PATTERN.test(nextBlock.text.split('\n')[0]);
25488
+ return isListContinuing ? '\n' : '\n\n';
25489
+ }
25490
+
25067
25491
  /**
25068
25492
  * Removes single-hash comment lines (`# Comment`) from a system message
25069
25493
  * This is used to clean up the final system message before sending it to the AI model
@@ -25137,14 +25561,14 @@ function createInitialAgentModelRequirements(agentName, modelName) {
25137
25561
  * Performs the final system-message cleanup pass after all other augmentation steps are complete.
25138
25562
  *
25139
25563
  * @param requirements - Fully built requirements before final cleanup.
25140
- * @returns Requirements with comment lines removed from the final system message.
25564
+ * @returns Requirements with comment lines removed and repeated instructions deduplicated in the final system message.
25141
25565
  *
25142
25566
  * @private internal utility of `createAgentModelRequirementsWithCommitments`
25143
25567
  */
25144
25568
  function finalizeRequirements(requirements) {
25145
25569
  return {
25146
25570
  ...requirements,
25147
- systemMessage: removeCommentsFromSystemMessage(requirements.systemMessage),
25571
+ systemMessage: deduplicateSystemMessage(removeCommentsFromSystemMessage(requirements.systemMessage)),
25148
25572
  };
25149
25573
  }
25150
25574
 
@@ -25919,7 +26343,7 @@ function validateBook(source) {
25919
26343
  const DEFAULT_BOOK = padBook(validateBook(spaceTrim$1(`
25920
26344
  AI Avatar
25921
26345
 
25922
- PERSONA A friendly AI assistant that helps you with your tasks
26346
+ GOAL Help users with their tasks as a friendly AI assistant.
25923
26347
  `)));
25924
26348
  // <- Note: Not using book`...` notation to avoid strange error in jest unit tests `TypeError: (0 , book_notation_1.book) is not a function`
25925
26349
  // <- TODO: [🐱‍🚀] `GENESIS_BOOK` / `ADAM_BOOK` in `/agents/adam.book`
@@ -26410,7 +26834,12 @@ const czechBookLanguageManualDictionary = {
26410
26834
  \`FROM\` odkazuje na zdroj rodičovského agenta. Při vyhodnocení dědičnosti platí:
26411
26835
 
26412
26836
  - Obsah rodiče se sloučí do výsledného zdroje.
26413
- - \`FROM {Void}\` / \`FROM VOID\` znamená výslovné „žádný rodič“.
26837
+ - Když \`FROM\` není uvedeno vůbec, platí to samé jako \`FROM @Adam\`, tedy jádrový agent, ze kterého dědí každý agent.
26838
+ - \`FROM @Null\` / \`FROM {Void}\` / \`FROM VOID\` znamená výslovné „žádný rodič“.
26839
+ - Výslovně zvolený rodič nahradí implicitního Adama; vlastní řetězec \`FROM\` tohoto rodiče se pak zdědí běžným způsobem.
26840
+ - \`@Jmeno\` je pro jednoslovné jméno agenta zkratka zápisu \`{Jmeno}\`.
26841
+ - Když je \`FROM\` uvedeno vícekrát, platí poslední a přepíše všechna předchozí.
26842
+ - Adam je kořenový agent a musí výslovně použít \`FROM @Null\` (\`@Void\` je ekvivalentní). Editor knihy upozorní na jiného Adamova rodiče i na lokální cykly dědičnosti.
26414
26843
  - Chybějící odkazy se do výsledného zdroje propíší jako poznámky.
26415
26844
  `),
26416
26845
  },
@@ -26708,7 +27137,12 @@ const englishBookLanguageManualDictionary = {
26708
27137
  \`FROM\` points to a parent agent source. During inheritance resolution:
26709
27138
 
26710
27139
  - Parent corpus is merged into effective source.
26711
- - \`FROM {Void}\` / \`FROM VOID\` means explicit "no parent".
27140
+ - Writing no \`FROM\` at all is the same as writing \`FROM @Adam\`, the core agent every agent inherits from.
27141
+ - \`FROM @Null\` / \`FROM {Void}\` / \`FROM VOID\` means explicit "no parent".
27142
+ - An explicit parent replaces the implicit Adam parent; the selected parent's own \`FROM\` chain is then inherited normally.
27143
+ - \`@Name\` is shorthand for \`{Name}\` when the agent name is one word.
27144
+ - When \`FROM\` is written more than once, the last one wins and overrides every earlier one.
27145
+ - Adam is the root agent and must explicitly use \`FROM @Null\` (\`@Void\` is equivalent). The Book editor warns about a different Adam parent and local inheritance cycles.
26712
27146
  - Missing references are surfaced as notes in resolved source.
26713
27147
  `),
26714
27148
  },
@@ -26903,7 +27337,7 @@ function getBookLanguageManualDictionary(language) {
26903
27337
  * @param language - Optional info-string language label.
26904
27338
  * @returns Fenced code block.
26905
27339
  *
26906
- * @private internal utility of `createStandaloneBookLanguageMarkdown`
27340
+ * @private internal utility of `createStandaloneBookLanguageMarkdown` and of the `ptbk coder` run traces
26907
27341
  */
26908
27342
  function getSafeCodeBlock(content, language = 'markdown') {
26909
27343
  const maxBacktickCount = Math.max(0, ...(content.match(/`+/g) || []).map((match) => match.length));
@@ -27106,12 +27540,7 @@ function createFocusedCommitmentExampleSource(source, group) {
27106
27540
  const parsedSource = parseAgentSourceWithCommitments(source);
27107
27541
  const commitmentTypes = new Set([group.primary.type, ...group.aliases]);
27108
27542
  const isOpenClosedCommitmentFamily = commitmentTypes.has(OPEN_COMMITMENT_TYPE) && commitmentTypes.has(CLOSED_COMMITMENT_TYPE);
27109
- const allowedCommitmentTypes = new Set([
27110
- group.primary.type,
27111
- ...group.aliases,
27112
- 'GOAL',
27113
- CLOSED_COMMITMENT_TYPE,
27114
- ]);
27543
+ const allowedCommitmentTypes = new Set([group.primary.type, ...group.aliases, 'GOAL', CLOSED_COMMITMENT_TYPE]);
27115
27544
  const canonicalTypeByCommitmentType = createCanonicalCommitmentTypeByCommitmentType(group, isOpenClosedCommitmentFamily);
27116
27545
  const focusedCommitments = parsedSource.commitments
27117
27546
  .filter((commitment) => allowedCommitmentTypes.has(commitment.type))
@@ -27218,9 +27647,7 @@ function finalizeFocusedCommitmentExampleSource(agentName, focusedCommitments) {
27218
27647
  if (!isClosedCommitmentIncluded && !isOpenCommitmentIncluded) {
27219
27648
  normalizedFocusedCommitments.push(CLOSED_COMMITMENT_TYPE);
27220
27649
  }
27221
- return [agentName, ...normalizedFocusedCommitments]
27222
- .filter((line) => Boolean(line))
27223
- .join('\n\n');
27650
+ return [agentName, ...normalizedFocusedCommitments].filter((line) => Boolean(line)).join('\n\n');
27224
27651
  }
27225
27652
  /**
27226
27653
  * Keeps an example title unless the parser interpreted a commitment-only
@@ -27368,6 +27795,7 @@ const BEHAVIOR_COMMITMENT_TYPES = new Set([
27368
27795
  'LANGUAGES',
27369
27796
  'WRITING SAMPLE',
27370
27797
  'WRITING RULES',
27798
+ 'WRITING RULE',
27371
27799
  'SCENARIO',
27372
27800
  'SCENARIOS',
27373
27801
  'MESSAGE',
@@ -27512,9 +27940,7 @@ function createStandaloneBookLanguageMarkdown(options = {}) {
27512
27940
 
27513
27941
  ${block(dictionary.tutorialSections.checklistBody)}
27514
27942
 
27515
- ${block(isLowLevelCommitmentsIncluded
27516
- ? renderLowLevelCommitmentsChapter(lowLevelCommitments, dictionary)
27517
- : '')}
27943
+ ${block(isLowLevelCommitmentsIncluded ? renderLowLevelCommitmentsChapter(lowLevelCommitments, dictionary) : '')}
27518
27944
 
27519
27945
  ---
27520
27946
 
@@ -28310,16 +28736,49 @@ class AgentCollectionInSupabase /* TODO: [🌈][🐱‍🚀] implements AgentCol
28310
28736
  }
28311
28737
  /**
28312
28738
  * Retrieves the permanent ID of an agent by its name or permanent ID.
28739
+ *
28740
+ * An agent that still exists always wins over a soft-deleted one, so a name that was deleted and
28741
+ * later created again resolves to the agent that is live now instead of to the recycle-bin leftover.
28742
+ * Soft-deleted agents stay resolvable as a fallback because the recycle bin restores them by name
28743
+ * or permanent id.
28313
28744
  */
28314
28745
  async getAgentPermanentId(agentNameOrPermanentId) {
28315
- const selectResult = await this.supabaseClient
28746
+ const activeAgentPermanentId = await this.findAgentPermanentId(agentNameOrPermanentId, {
28747
+ isDeletedAgentIncluded: false,
28748
+ });
28749
+ if (activeAgentPermanentId !== null) {
28750
+ return activeAgentPermanentId;
28751
+ }
28752
+ const deletedAgentPermanentId = await this.findAgentPermanentId(agentNameOrPermanentId, {
28753
+ isDeletedAgentIncluded: true,
28754
+ });
28755
+ if (deletedAgentPermanentId !== null) {
28756
+ return deletedAgentPermanentId;
28757
+ }
28758
+ throw new NotFoundError(`Agent with name or id "${agentNameOrPermanentId}" not found`);
28759
+ }
28760
+ /**
28761
+ * Looks up the permanent id of the oldest agent matching one name or permanent id.
28762
+ *
28763
+ * @param agentNameOrPermanentId - Agent name or stable permanent identifier to match.
28764
+ * @param options - Whether soft-deleted agents may be matched as well.
28765
+ * @returns Permanent id of the matched agent, or `null` when nothing matches.
28766
+ *
28767
+ * @private internal helper of `AgentCollectionInSupabase`
28768
+ */
28769
+ async findAgentPermanentId(agentNameOrPermanentId, options) {
28770
+ const selectQuery = this.supabaseClient
28316
28771
  .from(this.getTableName('Agent'))
28317
28772
  .select('permanentId')
28318
- .or(buildAgentNameOrPermanentIdFilter(agentNameOrPermanentId))
28773
+ .or(buildAgentNameOrPermanentIdFilter(agentNameOrPermanentId));
28774
+ if (!options.isDeletedAgentIncluded) {
28775
+ selectQuery.is('deletedAt', null);
28776
+ }
28777
+ const selectResult = await selectQuery
28319
28778
  .order('createdAt', { ascending: true }) // Pick oldest if multiple match by name
28320
28779
  .limit(1);
28321
28780
  if (selectResult.error || !selectResult.data || selectResult.data.length === 0) {
28322
- throw new NotFoundError(`Agent with name or id "${agentNameOrPermanentId}" not found`);
28781
+ return null;
28323
28782
  }
28324
28783
  return selectResult.data[0].permanentId;
28325
28784
  }
@@ -29560,8 +30019,8 @@ const formatCommandParser = {
29560
30019
  */
29561
30020
  $applyToTaskJson(command, $taskJson) {
29562
30021
  if ($taskJson.format !== undefined && command.format !== $taskJson.format) {
29563
- throw new ParseError(`Format format is already defined to "${$taskJson.format}".
29564
- Now you try to redefine it by "${command.format}"`);
30022
+ throw new ParseError(spaceTrim$1(`Format format is already defined to "${$taskJson.format}".
30023
+ Now you try to redefine it by "${command.format}"`));
29565
30024
  }
29566
30025
  $taskJson.format = command.format;
29567
30026
  },
@@ -34871,28 +35330,28 @@ function parseToolExecutionEnvelope(rawValue) {
34871
35330
  */
34872
35331
  function buildToolInvocationScript(options) {
34873
35332
  const { functionName, functionArgsExpression } = options;
34874
- return `
34875
- const args = ${functionArgsExpression};
34876
- const runtimeContextRaw =
34877
- typeof ${TOOL_RUNTIME_CONTEXT_PARAMETER} === 'undefined'
34878
- ? undefined
34879
- : ${TOOL_RUNTIME_CONTEXT_PARAMETER};
35333
+ return spaceTrim$1((block) => `
35334
+ const args = ${block(functionArgsExpression)};
35335
+ const runtimeContextRaw =
35336
+ typeof ${TOOL_RUNTIME_CONTEXT_PARAMETER} === 'undefined'
35337
+ ? undefined
35338
+ : ${TOOL_RUNTIME_CONTEXT_PARAMETER};
34880
35339
 
34881
- if (runtimeContextRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
34882
- args.${TOOL_RUNTIME_CONTEXT_ARGUMENT} = runtimeContextRaw;
34883
- }
35340
+ if (runtimeContextRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
35341
+ args.${TOOL_RUNTIME_CONTEXT_ARGUMENT} = runtimeContextRaw;
35342
+ }
34884
35343
 
34885
- const toolProgressTokenRaw =
34886
- typeof ${TOOL_PROGRESS_TOKEN_PARAMETER} === 'undefined'
34887
- ? undefined
34888
- : ${TOOL_PROGRESS_TOKEN_PARAMETER};
35344
+ const toolProgressTokenRaw =
35345
+ typeof ${TOOL_PROGRESS_TOKEN_PARAMETER} === 'undefined'
35346
+ ? undefined
35347
+ : ${TOOL_PROGRESS_TOKEN_PARAMETER};
34889
35348
 
34890
- if (toolProgressTokenRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
34891
- args.${TOOL_PROGRESS_TOKEN_ARGUMENT} = toolProgressTokenRaw;
34892
- }
35349
+ if (toolProgressTokenRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
35350
+ args.${TOOL_PROGRESS_TOKEN_ARGUMENT} = toolProgressTokenRaw;
35351
+ }
34893
35352
 
34894
- return await ${functionName}(args);
34895
- `;
35353
+ return await ${functionName}(args);
35354
+ `);
34896
35355
  }
34897
35356
 
34898
35357
  /**
@@ -48732,7 +49191,7 @@ function $generateBookBoilerplate(options) {
48732
49191
  ${agentName}
48733
49192
 
48734
49193
 
48735
- PERSONA ${block(personaDescription)}
49194
+ GOAL ${block(personaDescription)}
48736
49195
  ${block(initialRules.map((rule) => `RULE ${rule}`).join('\n'))}
48737
49196
  CLOSED
48738
49197
  `));