@promptbook/core 0.114.0-5 → 0.114.0-50

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 (430) hide show
  1. package/README.md +50 -31
  2. package/esm/index.es.js +628 -135
  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/CreateAgentModelRequirementsOptions.d.ts +2 -0
  11. package/esm/src/book-2.0/agent-source/ParsedUnknownCommitment.d.ts +26 -0
  12. package/esm/src/book-2.0/agent-source/deduplicateSystemMessage.d.ts +14 -0
  13. package/esm/src/book-2.0/agent-source/explicitFromCommitment.d.ts +62 -0
  14. package/esm/src/book-2.0/agent-source/extractAgentReferenceTokens.d.ts +32 -0
  15. package/esm/src/book-2.0/agent-source/getBookCommitmentLineType.d.ts +19 -0
  16. package/esm/src/book-2.0/agent-source/parseAgentSourceWithCommitments.unknown.test.d.ts +1 -0
  17. package/esm/src/book-2.0/agent-source/resolveInheritedAgentSource.d.ts +73 -0
  18. package/esm/src/book-2.0/book-language-documentation/getSafeCodeBlock.d.ts +1 -1
  19. package/esm/src/book-3.0/AgentMessageRunReport.d.ts +46 -0
  20. package/esm/src/book-3.0/AgentPlannedMessagesSidecar.d.ts +127 -0
  21. package/esm/src/book-3.0/AgentPlannedMessagesSidecar.test.d.ts +1 -0
  22. package/esm/src/book-3.0/AgentTeamConversationWorkspace.d.ts +85 -0
  23. package/esm/src/book-3.0/cliAgentEnv.d.ts +3 -3
  24. package/esm/src/book-3.0/createAgentMessageSidecarBaseName.d.ts +13 -0
  25. package/esm/src/book-3.0/describeAgentPlannedMessageSchedule.d.ts +31 -0
  26. package/esm/src/book-components/BookEditor/createDeprecatedCommitmentDiagnostics.browser.d.ts +1 -9
  27. package/esm/src/book-components/BookEditor/createDuplicateFromCommitmentDiagnostics.d.ts +28 -0
  28. package/esm/src/book-components/BookEditor/createDuplicateFromCommitmentDiagnostics.test.d.ts +1 -0
  29. package/esm/src/book-components/BookEditor/createUnknownCommitmentDiagnostics.d.ts +28 -0
  30. package/esm/src/book-components/BookEditor/createUnknownCommitmentDiagnostics.test.d.ts +1 -0
  31. package/esm/src/book-components/Chat/Chat/ChatProps.d.ts +3 -2
  32. package/esm/src/book-components/Chat/Chat/renderAgentProjectDiff.d.ts +13 -0
  33. package/esm/src/book-components/Chat/Chat/renderAgentProjectToolCallDetails.d.ts +16 -0
  34. package/esm/src/book-components/Chat/MockedChat/MockedChat.test.d.ts +2 -0
  35. package/esm/src/book-components/Chat/utils/agentProjectToolCall.d.ts +85 -0
  36. package/esm/src/book-components/Chat/utils/agentProjectToolCall.test.d.ts +1 -0
  37. package/esm/src/book-components/Chat/utils/externalSourceToolCall.d.ts +38 -0
  38. package/esm/src/book-components/Chat/utils/renderMarkdown.d.ts +68 -3
  39. package/esm/src/book-components/Chat/utils/timeoutToolCallPresentation.d.ts +30 -0
  40. package/esm/src/cli/$initializePromptbookCliProgram.d.ts +8 -0
  41. package/esm/src/cli/cli-commands/coder/$ensureCoderHarnessGitignoreRules.d.ts +10 -0
  42. package/esm/src/cli/cli-commands/coder/$ensureCoderHarnessGitignoreRules.test.d.ts +1 -0
  43. package/esm/src/cli/cli-commands/coder/GitChangesMode.d.ts +28 -0
  44. package/esm/src/cli/cli-commands/coder/add.d.ts +22 -1
  45. package/esm/src/cli/cli-commands/coder/agentCliOptions.d.ts +27 -0
  46. package/esm/src/cli/cli-commands/coder/augmentCoderAgentTeam.d.ts +7 -0
  47. package/esm/src/cli/cli-commands/coder/boilerplateCount.d.ts +1 -1
  48. package/esm/src/cli/cli-commands/coder/boilerplateTemplates.d.ts +8 -21
  49. package/esm/src/cli/cli-commands/coder/coderAgentRole.d.ts +21 -0
  50. package/esm/src/cli/cli-commands/coder/coderReferencedArtifacts.d.ts +34 -0
  51. package/esm/src/cli/cli-commands/coder/ensureCoderDefaultAgentFiles.d.ts +8 -0
  52. package/esm/src/cli/cli-commands/coder/ensureCoderDefaultAgentFiles.test.d.ts +1 -0
  53. package/esm/src/cli/cli-commands/coder/ensureCoderGitattributesFile.d.ts +13 -0
  54. package/esm/src/cli/cli-commands/coder/ensureCoderGitignoreFile.d.ts +14 -1
  55. package/esm/src/cli/cli-commands/coder/ensureCoderPackageJsonFile.d.ts +5 -2
  56. package/esm/src/cli/cli-commands/coder/ensureCoderPackageJsonFile.test.d.ts +1 -0
  57. package/esm/src/cli/cli-commands/coder/ensureCoderRoleAgentFile.d.ts +12 -0
  58. package/esm/src/cli/cli-commands/coder/ensureCoderVscodeSettingsFile.d.ts +2 -0
  59. package/esm/src/cli/cli-commands/coder/ensureDirectory.d.ts +6 -0
  60. package/esm/src/cli/cli-commands/coder/findLegacyCoderCheckCallers.d.ts +5 -0
  61. package/esm/src/cli/cli-commands/coder/fix.d.ts +7 -0
  62. package/esm/src/cli/cli-commands/coder/fix.test.d.ts +1 -0
  63. package/esm/src/cli/cli-commands/coder/fixWorkflow.test.d.ts +1 -0
  64. package/esm/src/cli/cli-commands/coder/generate-boilerplates.d.ts +2 -2
  65. package/esm/src/cli/cli-commands/coder/getCoderInitializationCommitPaths.d.ts +9 -0
  66. package/esm/src/cli/cli-commands/coder/getDefaultCoderPackageJsonScripts.d.ts +6 -0
  67. package/esm/src/cli/cli-commands/coder/init.test.d.ts +1 -0
  68. package/esm/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.d.ts +18 -6
  69. package/esm/src/cli/cli-commands/coder/list.d.ts +10 -0
  70. package/esm/src/cli/cli-commands/coder/list.test.d.ts +1 -0
  71. package/esm/src/cli/cli-commands/coder/mergeStringRecordJsonFile.d.ts +21 -1
  72. package/esm/src/cli/cli-commands/coder/plan.d.ts +7 -0
  73. package/esm/src/cli/cli-commands/coder/planning/assertPlanningCommitSafe.d.ts +6 -0
  74. package/esm/src/cli/cli-commands/coder/planning/assertPlanningPrdCommitScope.d.ts +7 -0
  75. package/esm/src/cli/cli-commands/coder/planning/assertPlanningRuntimePath.d.ts +6 -0
  76. package/esm/src/cli/cli-commands/coder/planning/createPlanningTerminal.d.ts +8 -0
  77. package/esm/src/cli/cli-commands/coder/planning/createPlanningTerminal.test.d.ts +1 -0
  78. package/esm/src/cli/cli-commands/coder/planning/createPlanningWorkspace.d.ts +11 -0
  79. package/esm/src/cli/cli-commands/coder/planning/discussPlanningTurn.d.ts +15 -0
  80. package/esm/src/cli/cli-commands/coder/planning/fixtures/snapshotPlanningProject.d.ts +5 -0
  81. package/esm/src/cli/cli-commands/coder/planning/planningGitSync.test.d.ts +1 -0
  82. package/esm/src/cli/cli-commands/coder/planning/planningPackagedCli.test.d.ts +1 -0
  83. package/esm/src/cli/cli-commands/coder/planning/planningProtocol.d.ts +152 -0
  84. package/esm/src/cli/cli-commands/coder/planning/planningTeam.test.d.ts +1 -0
  85. package/esm/src/cli/cli-commands/coder/planning/preparePlanningChanges.d.ts +16 -0
  86. package/esm/src/cli/cli-commands/coder/planning/readPlanningContext.d.ts +6 -0
  87. package/esm/src/cli/cli-commands/coder/planning/resolvePlanningPath.d.ts +7 -0
  88. package/esm/src/cli/cli-commands/coder/planning/runPlanningHarness.d.ts +30 -0
  89. package/esm/src/cli/cli-commands/coder/planning/runPlanningHarness.test.d.ts +1 -0
  90. package/esm/src/cli/cli-commands/coder/planning/runPlanningSession.d.ts +24 -0
  91. package/esm/src/cli/cli-commands/coder/planning/runPlanningSession.test.d.ts +1 -0
  92. package/esm/src/cli/cli-commands/coder/planning/savePlanningChanges.d.ts +7 -0
  93. package/esm/src/cli/cli-commands/coder/prepareCoderPackageJsonScripts.d.ts +12 -0
  94. package/esm/src/cli/cli-commands/coder/printCoderRunFailure.d.ts +6 -0
  95. package/esm/src/cli/cli-commands/coder/printInitializationSummary.d.ts +2 -1
  96. package/esm/src/cli/cli-commands/coder/promptsReadmeTemplate.d.ts +13 -0
  97. package/esm/src/cli/cli-commands/coder/promptsReadmeTemplate.test.d.ts +1 -0
  98. package/esm/src/cli/cli-commands/coder/readCoderAgentBook.d.ts +8 -0
  99. package/esm/src/cli/cli-commands/coder/server.test.d.ts +1 -0
  100. package/esm/src/cli/cli-commands/coder/waitOptions.d.ts +12 -0
  101. package/esm/src/cli/cli-commands/coder/workspacePreflight.test.d.ts +1 -0
  102. package/esm/src/cli/cli-commands/coder.d.ts +3 -0
  103. package/esm/src/cli/cli-commands/common/$askForConfirmation.d.ts +11 -0
  104. package/esm/src/cli/cli-commands/common/$askForConfirmation.test.d.ts +1 -0
  105. package/esm/src/cli/cli-commands/common/LocalAgentBookCollection.d.ts +48 -0
  106. package/esm/src/cli/cli-commands/common/coderCheckCliOptions.d.ts +21 -0
  107. package/esm/src/cli/cli-commands/common/coderCheckCliOptions.test.d.ts +1 -0
  108. package/esm/src/cli/cli-commands/common/coderGitSyncCliOptions.d.ts +1 -1
  109. package/esm/src/cli/cli-commands/common/createLocalAgentReferenceResolver.d.ts +8 -0
  110. package/esm/src/cli/cli-commands/common/disk-space/$assertSufficientFreeDiskSpace.d.ts +12 -0
  111. package/esm/src/cli/cli-commands/common/disk-space/$assertSufficientFreeDiskSpace.test.d.ts +1 -0
  112. package/esm/src/cli/cli-commands/common/disk-space/$readFreeDiskSpaceStatus.d.ts +11 -0
  113. package/esm/src/cli/cli-commands/common/disk-space/$readFreeDiskSpaceStatus.test.d.ts +1 -0
  114. package/esm/src/cli/cli-commands/common/disk-space/FreeDiskSpaceStatus.d.ts +33 -0
  115. package/esm/src/cli/cli-commands/common/disk-space/formatFreeDiskSpaceBytes.d.ts +6 -0
  116. package/esm/src/cli/cli-commands/common/disk-space/formatFreeDiskSpaceBytes.test.d.ts +1 -0
  117. package/esm/src/cli/cli-commands/common/disk-space/formatLowFreeDiskSpaceWarning.d.ts +10 -0
  118. package/esm/src/cli/cli-commands/common/disk-space/freeDiskSpaceConstants.d.ts +28 -0
  119. package/esm/src/cli/cli-commands/common/disk-space/resolveFreeDiskSpaceLevel.d.ts +7 -0
  120. package/esm/src/cli/cli-commands/common/disk-space/resolveFreeDiskSpaceLevel.test.d.ts +1 -0
  121. package/esm/src/cli/cli-commands/common/ensureAdamAgentBook.d.ts +12 -0
  122. package/esm/src/cli/cli-commands/common/ensureProjectTextFile.d.ts +7 -0
  123. package/esm/src/cli/cli-commands/common/harness/$applyHarnessInstallationStatus.d.ts +3 -2
  124. package/esm/src/cli/cli-commands/common/harness/$checkHarnessInstallation.d.ts +3 -3
  125. package/esm/src/cli/cli-commands/common/harness/$checkHarnessInstallation.test.d.ts +1 -0
  126. package/esm/src/cli/cli-commands/common/harness/$ensureHarnessInstallations.d.ts +6 -3
  127. package/esm/src/cli/cli-commands/common/harness/$resolveHarnessCommandPath.d.ts +14 -0
  128. package/esm/src/cli/cli-commands/common/harness/$resolveHarnessInstallationOrigin.d.ts +10 -0
  129. package/esm/src/cli/cli-commands/common/harness/$runHarnessInstallationCommand.d.ts +43 -0
  130. package/esm/src/cli/cli-commands/common/harness/HARNESS_DEFAULT_MODELS.d.ts +25 -0
  131. package/esm/src/cli/cli-commands/common/harness/HarnessDefinition.d.ts +62 -0
  132. package/esm/src/cli/cli-commands/common/harness/HarnessInstallationOrigin.d.ts +36 -0
  133. package/esm/src/cli/cli-commands/common/harness/HarnessInstallationStatus.d.ts +8 -2
  134. package/esm/src/cli/cli-commands/common/harness/HarnessUpdatePlan.d.ts +23 -0
  135. package/esm/src/cli/cli-commands/common/harness/buildHarnessInstallCommand.d.ts +4 -1
  136. package/esm/src/cli/cli-commands/common/harness/formatHarnessManualUpdateInstruction.d.ts +8 -0
  137. package/esm/src/cli/cli-commands/common/harness/formatHarnessManualUpdateInstruction.test.d.ts +1 -0
  138. package/esm/src/cli/cli-commands/common/harness/resolveHarnessInstallationMethodFromPaths.d.ts +31 -0
  139. package/esm/src/cli/cli-commands/common/harness/resolveHarnessInstallationMethodFromPaths.test.d.ts +1 -0
  140. package/esm/src/cli/cli-commands/common/harness/resolveHarnessUpdatePlan.d.ts +12 -0
  141. package/esm/src/cli/cli-commands/common/harness/resolveHarnessUpdatePlan.test.d.ts +1 -0
  142. package/esm/src/cli/cli-commands/common/npm/$askForNpmPackageInstallationApproval.d.ts +11 -0
  143. package/{umd/src/cli/cli-commands/common/harness/$resolveLatestHarnessVersion.d.ts → esm/src/cli/cli-commands/common/npm/$resolveLatestNpmPackageVersion.d.ts} +2 -3
  144. package/esm/src/cli/cli-commands/common/npm/$resolveLatestNpmPackageVersion.test.d.ts +1 -0
  145. package/esm/src/cli/cli-commands/common/npm/$resolveNpmGlobalPrefixPath.d.ts +9 -0
  146. package/esm/src/cli/cli-commands/common/npm/buildNpmPackageInstallCommand.d.ts +12 -0
  147. package/esm/src/cli/cli-commands/common/npm/buildNpmPackageInstallCommand.test.d.ts +1 -0
  148. package/esm/src/cli/cli-commands/common/npm/extractNpmPackageVersionFromOutput.d.ts +12 -0
  149. package/esm/src/cli/cli-commands/common/npm/extractNpmPackageVersionFromOutput.test.d.ts +1 -0
  150. package/esm/src/cli/cli-commands/common/npm/isNpmPackageVersionOutdated.d.ts +12 -0
  151. package/esm/src/cli/cli-commands/common/npm/isNpmPackageVersionOutdated.test.d.ts +1 -0
  152. package/esm/src/cli/cli-commands/common/projectCliOptions.d.ts +30 -0
  153. package/esm/src/cli/cli-commands/common/projectCliOptions.test.d.ts +1 -0
  154. package/esm/src/cli/cli-commands/common/projectInitialization.d.ts +6 -0
  155. package/esm/src/cli/cli-commands/common/promptPriorityCliOptions.d.ts +7 -0
  156. package/esm/src/cli/cli-commands/common/promptRunnerCliOptions.d.ts +17 -4
  157. package/esm/src/cli/cli-commands/common/promptbook-cli/$checkPromptbookCliInstallations.d.ts +9 -0
  158. package/esm/src/cli/cli-commands/common/promptbook-cli/$checkPromptbookCliInstallations.test.d.ts +1 -0
  159. package/esm/src/cli/cli-commands/common/promptbook-cli/$ensurePromptbookCliInstallations.d.ts +15 -0
  160. package/esm/src/cli/cli-commands/common/promptbook-cli/$ensurePromptbookCliInstallations.test.d.ts +1 -0
  161. package/esm/src/cli/cli-commands/common/promptbook-cli/$resolvePromptbookCliInstallations.d.ts +12 -0
  162. package/esm/src/cli/cli-commands/common/promptbook-cli/$resolvePromptbookCliInstallations.test.d.ts +1 -0
  163. package/esm/src/cli/cli-commands/common/promptbook-cli/$updatePromptbookCliInstallation.d.ts +10 -0
  164. package/esm/src/cli/cli-commands/common/promptbook-cli/$updatePromptbookCliInstallation.test.d.ts +1 -0
  165. package/esm/src/cli/cli-commands/common/promptbook-cli/PromptbookCliInstallation.d.ts +66 -0
  166. package/esm/src/cli/cli-commands/common/promptbook-cli/PromptbookCliInstallationStatus.d.ts +26 -0
  167. package/esm/src/cli/cli-commands/common/promptbook-cli/buildPromptbookCliInstallCommand.d.ts +7 -0
  168. package/esm/src/cli/cli-commands/common/promptbook-cli/formatPromptbookCliInstallationWarning.d.ts +7 -0
  169. package/esm/src/cli/cli-commands/common/questionsCliOptions.d.ts +45 -0
  170. package/esm/src/cli/cli-commands/common/questionsCliOptions.test.d.ts +1 -0
  171. package/esm/src/cli/cli-commands/common/resolveBundledAgentBookPath.d.ts +6 -0
  172. package/esm/src/cli/cli-commands/common/resolveLocalAgentSource.d.ts +26 -0
  173. package/esm/src/cli/cli-commands/common/validateCoderRunOptions.d.ts +6 -0
  174. package/esm/src/cli/cli-commands/common/workspaceRepository.d.ts +48 -0
  175. package/esm/src/cli/cli-commands/common/workspaceRepository.test.d.ts +1 -0
  176. package/esm/src/cli/cli-commands/common/workspaceRepositoryCliOptions.d.ts +11 -0
  177. package/esm/src/cli/common/$deprecateCliCommand.d.ts +3 -0
  178. package/esm/src/cli/common/$hideCliCommandFromHelp.d.ts +11 -0
  179. package/esm/src/cli/common/$hideCliCommandFromHelp.test.d.ts +1 -0
  180. package/esm/src/cli/common/$requireCliSubcommand.d.ts +18 -0
  181. package/esm/src/cli/common/$requireCliSubcommand.test.d.ts +1 -0
  182. package/esm/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +15 -0
  183. package/esm/src/commitments/TEAM/TEAM.test.d.ts +1 -0
  184. package/esm/src/commitments/WRITING_RULES/WRITING_RULES.d.ts +14 -7
  185. package/esm/src/commitments/index.d.ts +1 -1
  186. package/esm/src/conversion/archive/loadJsZipModule.d.ts +10 -0
  187. package/esm/src/executables/platforms/locateAppOnWindows.d.ts +1 -1
  188. package/esm/src/executables/platforms/locateAppOnWindows.test.d.ts +1 -0
  189. package/esm/src/llm-providers/vercel/VercelExecutionToolsOptions.d.ts +5 -2
  190. package/esm/src/utils/agent-message-runtime/AgentMessageProjectChange.d.ts +76 -0
  191. package/esm/src/utils/agent-message-runtime/AgentMessageTouchedExternalSource.d.ts +45 -0
  192. package/esm/src/utils/agent-message-runtime/parseAgentMessageRuntimeLogEvents.d.ts +62 -0
  193. package/esm/src/utils/agent-message-runtime/resolveAgentMessageRuntimeActivity.d.ts +3 -3
  194. package/esm/src/utils/agent-message-runtime/resolveAgentMessageTouchedExternalSources.d.ts +18 -0
  195. package/esm/src/utils/agent-message-runtime/resolveAgentMessageTouchedExternalSources.test.d.ts +1 -0
  196. package/esm/src/utils/agent-message-runtime/resolveAgentMessageTouchedProjectNames.d.ts +19 -0
  197. package/esm/src/utils/agent-message-runtime/resolveAgentMessageTouchedProjectNames.test.d.ts +1 -0
  198. package/esm/src/utils/agents/terminalAgentAvatarVisual.d.ts +5 -2
  199. package/esm/src/utils/ascii-art/convertImageDataToAsciiArt.d.ts +6 -0
  200. package/esm/src/utils/ascii-art/createAnsiColorCode.d.ts +46 -0
  201. package/esm/src/utils/files/findFilesByGlob.d.ts +28 -0
  202. package/esm/src/utils/misc/debounce.d.ts +4 -2
  203. package/esm/src/utils/misc/debounce.test.d.ts +1 -0
  204. package/esm/src/utils/misc/emojis.d.ts +3 -2
  205. package/esm/src/utils/random/$generateBookBoilerplate.test.d.ts +1 -0
  206. package/esm/src/version.d.ts +1 -1
  207. package/package.json +2 -9
  208. package/umd/index.umd.js +628 -135
  209. package/umd/index.umd.js.map +1 -1
  210. package/umd/src/_packages/components.index.d.ts +4 -0
  211. package/umd/src/_packages/types.index.d.ts +4 -0
  212. package/umd/src/avatars/renderAvatarVisualTerminalText.d.ts +80 -0
  213. package/umd/src/avatars/renderAvatarVisualTerminalText.test.d.ts +1 -0
  214. package/umd/src/avatars/types/AvatarVisualDefinition.d.ts +54 -0
  215. package/umd/src/book-2.0/agent-source/AgentReferenceResolutionIssue.d.ts +45 -0
  216. package/umd/src/book-2.0/agent-source/AgentSourceParseResult.d.ts +5 -0
  217. package/umd/src/book-2.0/agent-source/CreateAgentModelRequirementsOptions.d.ts +2 -0
  218. package/umd/src/book-2.0/agent-source/ParsedUnknownCommitment.d.ts +26 -0
  219. package/umd/src/book-2.0/agent-source/createAgentModelRequirements.deduplication.test.d.ts +1 -0
  220. package/umd/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.unknown.test.d.ts +1 -0
  221. package/umd/src/book-2.0/agent-source/deduplicateSystemMessage.d.ts +14 -0
  222. package/umd/src/book-2.0/agent-source/deduplicateSystemMessage.test.d.ts +1 -0
  223. package/umd/src/book-2.0/agent-source/explicitFromCommitment.d.ts +62 -0
  224. package/umd/src/book-2.0/agent-source/extractAgentReferenceTokens.d.ts +32 -0
  225. package/umd/src/book-2.0/agent-source/getBookCommitmentLineType.d.ts +19 -0
  226. package/umd/src/book-2.0/agent-source/parseAgentSourceWithCommitments.unknown.test.d.ts +1 -0
  227. package/umd/src/book-2.0/agent-source/resolveInheritedAgentSource.d.ts +73 -0
  228. package/umd/src/book-2.0/book-language-documentation/getSafeCodeBlock.d.ts +1 -1
  229. package/umd/src/book-3.0/AgentMessageRunReport.d.ts +46 -0
  230. package/umd/src/book-3.0/AgentPlannedMessagesSidecar.d.ts +127 -0
  231. package/umd/src/book-3.0/AgentPlannedMessagesSidecar.test.d.ts +1 -0
  232. package/umd/src/book-3.0/AgentTeamConversationWorkspace.d.ts +85 -0
  233. package/umd/src/book-3.0/cliAgentEnv.d.ts +3 -3
  234. package/umd/src/book-3.0/createAgentMessageSidecarBaseName.d.ts +13 -0
  235. package/umd/src/book-3.0/describeAgentPlannedMessageSchedule.d.ts +31 -0
  236. package/umd/src/book-components/BookEditor/createDeprecatedCommitmentDiagnostics.browser.d.ts +1 -9
  237. package/umd/src/book-components/BookEditor/createDuplicateFromCommitmentDiagnostics.d.ts +28 -0
  238. package/umd/src/book-components/BookEditor/createDuplicateFromCommitmentDiagnostics.test.d.ts +1 -0
  239. package/umd/src/book-components/BookEditor/createUnknownCommitmentDiagnostics.d.ts +28 -0
  240. package/umd/src/book-components/BookEditor/createUnknownCommitmentDiagnostics.test.d.ts +1 -0
  241. package/umd/src/book-components/Chat/Chat/ChatProps.d.ts +3 -2
  242. package/umd/src/book-components/Chat/Chat/renderAgentProjectDiff.d.ts +13 -0
  243. package/umd/src/book-components/Chat/Chat/renderAgentProjectToolCallDetails.d.ts +16 -0
  244. package/umd/src/book-components/Chat/MockedChat/MockedChat.test.d.ts +2 -0
  245. package/umd/src/book-components/Chat/utils/agentProjectToolCall.d.ts +85 -0
  246. package/umd/src/book-components/Chat/utils/agentProjectToolCall.test.d.ts +1 -0
  247. package/umd/src/book-components/Chat/utils/externalSourceToolCall.d.ts +38 -0
  248. package/umd/src/book-components/Chat/utils/renderMarkdown.d.ts +68 -3
  249. package/umd/src/book-components/Chat/utils/timeoutToolCallPresentation.d.ts +30 -0
  250. package/umd/src/cli/$initializePromptbookCliProgram.d.ts +8 -0
  251. package/umd/src/cli/cli-commands/coder/$ensureCoderHarnessGitignoreRules.d.ts +10 -0
  252. package/umd/src/cli/cli-commands/coder/$ensureCoderHarnessGitignoreRules.test.d.ts +1 -0
  253. package/umd/src/cli/cli-commands/coder/GitChangesMode.d.ts +28 -0
  254. package/umd/src/cli/cli-commands/coder/add.d.ts +22 -1
  255. package/umd/src/cli/cli-commands/coder/agentCliOptions.d.ts +27 -0
  256. package/umd/src/cli/cli-commands/coder/augmentCoderAgentTeam.d.ts +7 -0
  257. package/umd/src/cli/cli-commands/coder/boilerplateCount.d.ts +1 -1
  258. package/umd/src/cli/cli-commands/coder/boilerplateTemplates.d.ts +8 -21
  259. package/umd/src/cli/cli-commands/coder/coderAgentRole.d.ts +21 -0
  260. package/umd/src/cli/cli-commands/coder/coderReferencedArtifacts.d.ts +34 -0
  261. package/umd/src/cli/cli-commands/coder/ensureCoderDefaultAgentFiles.d.ts +8 -0
  262. package/umd/src/cli/cli-commands/coder/ensureCoderDefaultAgentFiles.test.d.ts +1 -0
  263. package/umd/src/cli/cli-commands/coder/ensureCoderGitattributesFile.d.ts +13 -0
  264. package/umd/src/cli/cli-commands/coder/ensureCoderGitignoreFile.d.ts +14 -1
  265. package/umd/src/cli/cli-commands/coder/ensureCoderPackageJsonFile.d.ts +5 -2
  266. package/umd/src/cli/cli-commands/coder/ensureCoderPackageJsonFile.test.d.ts +1 -0
  267. package/umd/src/cli/cli-commands/coder/ensureCoderRoleAgentFile.d.ts +12 -0
  268. package/umd/src/cli/cli-commands/coder/ensureCoderVscodeSettingsFile.d.ts +2 -0
  269. package/umd/src/cli/cli-commands/coder/ensureDirectory.d.ts +6 -0
  270. package/umd/src/cli/cli-commands/coder/findLegacyCoderCheckCallers.d.ts +5 -0
  271. package/umd/src/cli/cli-commands/coder/fix.d.ts +7 -0
  272. package/umd/src/cli/cli-commands/coder/fix.test.d.ts +1 -0
  273. package/umd/src/cli/cli-commands/coder/fixWorkflow.test.d.ts +1 -0
  274. package/umd/src/cli/cli-commands/coder/generate-boilerplates.d.ts +2 -2
  275. package/umd/src/cli/cli-commands/coder/getCoderInitializationCommitPaths.d.ts +9 -0
  276. package/umd/src/cli/cli-commands/coder/getDefaultCoderPackageJsonScripts.d.ts +6 -0
  277. package/umd/src/cli/cli-commands/coder/init.test.d.ts +1 -0
  278. package/umd/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.d.ts +18 -6
  279. package/umd/src/cli/cli-commands/coder/list.d.ts +10 -0
  280. package/umd/src/cli/cli-commands/coder/list.test.d.ts +1 -0
  281. package/umd/src/cli/cli-commands/coder/mergeStringRecordJsonFile.d.ts +21 -1
  282. package/umd/src/cli/cli-commands/coder/plan.d.ts +7 -0
  283. package/umd/src/cli/cli-commands/coder/planning/assertPlanningCommitSafe.d.ts +6 -0
  284. package/umd/src/cli/cli-commands/coder/planning/assertPlanningPrdCommitScope.d.ts +7 -0
  285. package/umd/src/cli/cli-commands/coder/planning/assertPlanningRuntimePath.d.ts +6 -0
  286. package/umd/src/cli/cli-commands/coder/planning/createPlanningTerminal.d.ts +8 -0
  287. package/umd/src/cli/cli-commands/coder/planning/createPlanningTerminal.test.d.ts +1 -0
  288. package/umd/src/cli/cli-commands/coder/planning/createPlanningWorkspace.d.ts +11 -0
  289. package/umd/src/cli/cli-commands/coder/planning/discussPlanningTurn.d.ts +15 -0
  290. package/umd/src/cli/cli-commands/coder/planning/fixtures/snapshotPlanningProject.d.ts +5 -0
  291. package/umd/src/cli/cli-commands/coder/planning/planningGitSync.test.d.ts +1 -0
  292. package/umd/src/cli/cli-commands/coder/planning/planningPackagedCli.test.d.ts +1 -0
  293. package/umd/src/cli/cli-commands/coder/planning/planningProtocol.d.ts +152 -0
  294. package/umd/src/cli/cli-commands/coder/planning/planningTeam.test.d.ts +1 -0
  295. package/umd/src/cli/cli-commands/coder/planning/preparePlanningChanges.d.ts +16 -0
  296. package/umd/src/cli/cli-commands/coder/planning/readPlanningContext.d.ts +6 -0
  297. package/umd/src/cli/cli-commands/coder/planning/resolvePlanningPath.d.ts +7 -0
  298. package/umd/src/cli/cli-commands/coder/planning/runPlanningHarness.d.ts +30 -0
  299. package/umd/src/cli/cli-commands/coder/planning/runPlanningHarness.test.d.ts +1 -0
  300. package/umd/src/cli/cli-commands/coder/planning/runPlanningSession.d.ts +24 -0
  301. package/umd/src/cli/cli-commands/coder/planning/runPlanningSession.test.d.ts +1 -0
  302. package/umd/src/cli/cli-commands/coder/planning/savePlanningChanges.d.ts +7 -0
  303. package/umd/src/cli/cli-commands/coder/prepareCoderPackageJsonScripts.d.ts +12 -0
  304. package/umd/src/cli/cli-commands/coder/printCoderRunFailure.d.ts +6 -0
  305. package/umd/src/cli/cli-commands/coder/printInitializationSummary.d.ts +2 -1
  306. package/umd/src/cli/cli-commands/coder/promptsReadmeTemplate.d.ts +13 -0
  307. package/umd/src/cli/cli-commands/coder/promptsReadmeTemplate.test.d.ts +1 -0
  308. package/umd/src/cli/cli-commands/coder/readCoderAgentBook.d.ts +8 -0
  309. package/umd/src/cli/cli-commands/coder/server.test.d.ts +1 -0
  310. package/umd/src/cli/cli-commands/coder/waitOptions.d.ts +12 -0
  311. package/umd/src/cli/cli-commands/coder/workspacePreflight.test.d.ts +1 -0
  312. package/umd/src/cli/cli-commands/coder.d.ts +3 -0
  313. package/umd/src/cli/cli-commands/common/$askForConfirmation.d.ts +11 -0
  314. package/umd/src/cli/cli-commands/common/$askForConfirmation.test.d.ts +1 -0
  315. package/umd/src/cli/cli-commands/common/LocalAgentBookCollection.d.ts +48 -0
  316. package/umd/src/cli/cli-commands/common/coderCheckCliOptions.d.ts +21 -0
  317. package/umd/src/cli/cli-commands/common/coderCheckCliOptions.test.d.ts +1 -0
  318. package/umd/src/cli/cli-commands/common/coderGitSyncCliOptions.d.ts +1 -1
  319. package/umd/src/cli/cli-commands/common/createLocalAgentReferenceResolver.d.ts +8 -0
  320. package/umd/src/cli/cli-commands/common/disk-space/$assertSufficientFreeDiskSpace.d.ts +12 -0
  321. package/umd/src/cli/cli-commands/common/disk-space/$assertSufficientFreeDiskSpace.test.d.ts +1 -0
  322. package/umd/src/cli/cli-commands/common/disk-space/$readFreeDiskSpaceStatus.d.ts +11 -0
  323. package/umd/src/cli/cli-commands/common/disk-space/$readFreeDiskSpaceStatus.test.d.ts +1 -0
  324. package/umd/src/cli/cli-commands/common/disk-space/FreeDiskSpaceStatus.d.ts +33 -0
  325. package/umd/src/cli/cli-commands/common/disk-space/formatFreeDiskSpaceBytes.d.ts +6 -0
  326. package/umd/src/cli/cli-commands/common/disk-space/formatFreeDiskSpaceBytes.test.d.ts +1 -0
  327. package/umd/src/cli/cli-commands/common/disk-space/formatLowFreeDiskSpaceWarning.d.ts +10 -0
  328. package/umd/src/cli/cli-commands/common/disk-space/freeDiskSpaceConstants.d.ts +28 -0
  329. package/umd/src/cli/cli-commands/common/disk-space/resolveFreeDiskSpaceLevel.d.ts +7 -0
  330. package/umd/src/cli/cli-commands/common/disk-space/resolveFreeDiskSpaceLevel.test.d.ts +1 -0
  331. package/umd/src/cli/cli-commands/common/ensureAdamAgentBook.d.ts +12 -0
  332. package/umd/src/cli/cli-commands/common/ensureProjectTextFile.d.ts +7 -0
  333. package/umd/src/cli/cli-commands/common/harness/$applyHarnessInstallationStatus.d.ts +3 -2
  334. package/umd/src/cli/cli-commands/common/harness/$checkHarnessInstallation.d.ts +3 -3
  335. package/umd/src/cli/cli-commands/common/harness/$checkHarnessInstallation.test.d.ts +1 -0
  336. package/umd/src/cli/cli-commands/common/harness/$ensureHarnessInstallations.d.ts +6 -3
  337. package/umd/src/cli/cli-commands/common/harness/$resolveHarnessCommandPath.d.ts +14 -0
  338. package/umd/src/cli/cli-commands/common/harness/$resolveHarnessInstallationOrigin.d.ts +10 -0
  339. package/umd/src/cli/cli-commands/common/harness/$runHarnessInstallationCommand.d.ts +43 -0
  340. package/umd/src/cli/cli-commands/common/harness/HARNESS_DEFAULT_MODELS.d.ts +25 -0
  341. package/umd/src/cli/cli-commands/common/harness/HarnessDefinition.d.ts +62 -0
  342. package/umd/src/cli/cli-commands/common/harness/HarnessInstallationOrigin.d.ts +36 -0
  343. package/umd/src/cli/cli-commands/common/harness/HarnessInstallationStatus.d.ts +8 -2
  344. package/umd/src/cli/cli-commands/common/harness/HarnessUpdatePlan.d.ts +23 -0
  345. package/umd/src/cli/cli-commands/common/harness/buildHarnessInstallCommand.d.ts +4 -1
  346. package/umd/src/cli/cli-commands/common/harness/formatHarnessManualUpdateInstruction.d.ts +8 -0
  347. package/umd/src/cli/cli-commands/common/harness/formatHarnessManualUpdateInstruction.test.d.ts +1 -0
  348. package/umd/src/cli/cli-commands/common/harness/resolveHarnessInstallationMethodFromPaths.d.ts +31 -0
  349. package/umd/src/cli/cli-commands/common/harness/resolveHarnessInstallationMethodFromPaths.test.d.ts +1 -0
  350. package/umd/src/cli/cli-commands/common/harness/resolveHarnessUpdatePlan.d.ts +12 -0
  351. package/umd/src/cli/cli-commands/common/harness/resolveHarnessUpdatePlan.test.d.ts +1 -0
  352. package/umd/src/cli/cli-commands/common/npm/$askForNpmPackageInstallationApproval.d.ts +11 -0
  353. package/{esm/src/cli/cli-commands/common/harness/$resolveLatestHarnessVersion.d.ts → umd/src/cli/cli-commands/common/npm/$resolveLatestNpmPackageVersion.d.ts} +2 -3
  354. package/umd/src/cli/cli-commands/common/npm/$resolveLatestNpmPackageVersion.test.d.ts +1 -0
  355. package/umd/src/cli/cli-commands/common/npm/$resolveNpmGlobalPrefixPath.d.ts +9 -0
  356. package/umd/src/cli/cli-commands/common/npm/buildNpmPackageInstallCommand.d.ts +12 -0
  357. package/umd/src/cli/cli-commands/common/npm/buildNpmPackageInstallCommand.test.d.ts +1 -0
  358. package/umd/src/cli/cli-commands/common/npm/extractNpmPackageVersionFromOutput.d.ts +12 -0
  359. package/umd/src/cli/cli-commands/common/npm/extractNpmPackageVersionFromOutput.test.d.ts +1 -0
  360. package/umd/src/cli/cli-commands/common/npm/isNpmPackageVersionOutdated.d.ts +12 -0
  361. package/umd/src/cli/cli-commands/common/npm/isNpmPackageVersionOutdated.test.d.ts +1 -0
  362. package/umd/src/cli/cli-commands/common/projectCliOptions.d.ts +30 -0
  363. package/umd/src/cli/cli-commands/common/projectCliOptions.test.d.ts +1 -0
  364. package/umd/src/cli/cli-commands/common/projectInitialization.d.ts +6 -0
  365. package/umd/src/cli/cli-commands/common/promptPriorityCliOptions.d.ts +7 -0
  366. package/umd/src/cli/cli-commands/common/promptRunnerCliOptions.d.ts +17 -4
  367. package/umd/src/cli/cli-commands/common/promptbook-cli/$checkPromptbookCliInstallations.d.ts +9 -0
  368. package/umd/src/cli/cli-commands/common/promptbook-cli/$checkPromptbookCliInstallations.test.d.ts +1 -0
  369. package/umd/src/cli/cli-commands/common/promptbook-cli/$ensurePromptbookCliInstallations.d.ts +15 -0
  370. package/umd/src/cli/cli-commands/common/promptbook-cli/$ensurePromptbookCliInstallations.test.d.ts +1 -0
  371. package/umd/src/cli/cli-commands/common/promptbook-cli/$resolvePromptbookCliInstallations.d.ts +12 -0
  372. package/umd/src/cli/cli-commands/common/promptbook-cli/$resolvePromptbookCliInstallations.test.d.ts +1 -0
  373. package/umd/src/cli/cli-commands/common/promptbook-cli/$updatePromptbookCliInstallation.d.ts +10 -0
  374. package/umd/src/cli/cli-commands/common/promptbook-cli/$updatePromptbookCliInstallation.test.d.ts +1 -0
  375. package/umd/src/cli/cli-commands/common/promptbook-cli/PromptbookCliInstallation.d.ts +66 -0
  376. package/umd/src/cli/cli-commands/common/promptbook-cli/PromptbookCliInstallationStatus.d.ts +26 -0
  377. package/umd/src/cli/cli-commands/common/promptbook-cli/buildPromptbookCliInstallCommand.d.ts +7 -0
  378. package/umd/src/cli/cli-commands/common/promptbook-cli/formatPromptbookCliInstallationWarning.d.ts +7 -0
  379. package/umd/src/cli/cli-commands/common/questionsCliOptions.d.ts +45 -0
  380. package/umd/src/cli/cli-commands/common/questionsCliOptions.test.d.ts +1 -0
  381. package/umd/src/cli/cli-commands/common/resolveBundledAgentBookPath.d.ts +6 -0
  382. package/umd/src/cli/cli-commands/common/resolveLocalAgentSource.d.ts +26 -0
  383. package/umd/src/cli/cli-commands/common/validateCoderRunOptions.d.ts +6 -0
  384. package/umd/src/cli/cli-commands/common/workspaceRepository.d.ts +48 -0
  385. package/umd/src/cli/cli-commands/common/workspaceRepository.test.d.ts +1 -0
  386. package/umd/src/cli/cli-commands/common/workspaceRepositoryCliOptions.d.ts +11 -0
  387. package/umd/src/cli/common/$deprecateCliCommand.d.ts +3 -0
  388. package/umd/src/cli/common/$hideCliCommandFromHelp.d.ts +11 -0
  389. package/umd/src/cli/common/$hideCliCommandFromHelp.test.d.ts +1 -0
  390. package/umd/src/cli/common/$requireCliSubcommand.d.ts +18 -0
  391. package/umd/src/cli/common/$requireCliSubcommand.test.d.ts +1 -0
  392. package/umd/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +15 -0
  393. package/umd/src/commitments/TEAM/TEAM.test.d.ts +1 -0
  394. package/umd/src/commitments/WRITING_RULES/WRITING_RULES.d.ts +14 -7
  395. package/umd/src/commitments/index.d.ts +1 -1
  396. package/umd/src/conversion/archive/loadJsZipModule.d.ts +10 -0
  397. package/umd/src/executables/platforms/locateAppOnWindows.d.ts +1 -1
  398. package/umd/src/executables/platforms/locateAppOnWindows.test.d.ts +1 -0
  399. package/umd/src/llm-providers/vercel/VercelExecutionToolsOptions.d.ts +5 -2
  400. package/umd/src/utils/agent-message-runtime/AgentMessageProjectChange.d.ts +76 -0
  401. package/umd/src/utils/agent-message-runtime/AgentMessageTouchedExternalSource.d.ts +45 -0
  402. package/umd/src/utils/agent-message-runtime/parseAgentMessageRuntimeLogEvents.d.ts +62 -0
  403. package/umd/src/utils/agent-message-runtime/resolveAgentMessageRuntimeActivity.d.ts +3 -3
  404. package/umd/src/utils/agent-message-runtime/resolveAgentMessageTouchedExternalSources.d.ts +18 -0
  405. package/umd/src/utils/agent-message-runtime/resolveAgentMessageTouchedExternalSources.test.d.ts +1 -0
  406. package/umd/src/utils/agent-message-runtime/resolveAgentMessageTouchedProjectNames.d.ts +19 -0
  407. package/umd/src/utils/agent-message-runtime/resolveAgentMessageTouchedProjectNames.test.d.ts +1 -0
  408. package/umd/src/utils/agents/terminalAgentAvatarVisual.d.ts +5 -2
  409. package/umd/src/utils/ascii-art/convertImageDataToAsciiArt.d.ts +6 -0
  410. package/umd/src/utils/ascii-art/createAnsiColorCode.d.ts +46 -0
  411. package/umd/src/utils/files/findFilesByGlob.d.ts +28 -0
  412. package/umd/src/utils/misc/debounce.d.ts +4 -2
  413. package/umd/src/utils/misc/debounce.test.d.ts +1 -0
  414. package/umd/src/utils/misc/emojis.d.ts +3 -2
  415. package/umd/src/utils/random/$generateBookBoilerplate.test.d.ts +1 -0
  416. package/umd/src/version.d.ts +1 -1
  417. package/esm/src/cli/cli-commands/coder/agentCodingFile.d.ts +0 -13
  418. package/esm/src/cli/cli-commands/common/harness/$askForHarnessInstallationApproval.d.ts +0 -9
  419. package/esm/src/cli/cli-commands/common/harness/$installHarness.d.ts +0 -13
  420. package/esm/src/cli/cli-commands/common/harness/extractHarnessVersionFromOutput.d.ts +0 -11
  421. package/esm/src/cli/cli-commands/common/harness/isHarnessVersionOutdated.d.ts +0 -9
  422. package/umd/src/cli/cli-commands/coder/agentCodingFile.d.ts +0 -13
  423. package/umd/src/cli/cli-commands/common/harness/$askForHarnessInstallationApproval.d.ts +0 -9
  424. package/umd/src/cli/cli-commands/common/harness/$installHarness.d.ts +0 -13
  425. package/umd/src/cli/cli-commands/common/harness/extractHarnessVersionFromOutput.d.ts +0 -11
  426. package/umd/src/cli/cli-commands/common/harness/isHarnessVersionOutdated.d.ts +0 -9
  427. /package/esm/src/{cli/cli-commands/common/harness/extractHarnessVersionFromOutput.test.d.ts → avatars/renderAvatarVisualTerminalText.test.d.ts} +0 -0
  428. /package/esm/src/{cli/cli-commands/common/harness/isHarnessVersionOutdated.test.d.ts → book-2.0/agent-source/createAgentModelRequirements.deduplication.test.d.ts} +0 -0
  429. /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
  430. /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-5';
29
+ const PROMPTBOOK_ENGINE_VERSION = '0.114.0-50';
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
  *
@@ -19569,6 +19672,18 @@ class TeamCommitmentDefinition extends BaseCommitmentDefinition {
19569
19672
 
19570
19673
  Registers teammate agents that the current agent can consult via tools.
19571
19674
 
19675
+ The primary agent sends a question and relevant context to a teammate and receives an attributed answer.
19676
+ Each teammate uses its own Book. Declaring a team makes advisers available when relevant; it does not
19677
+ merge their rules into the primary agent or start every teammate automatically.
19678
+
19679
+ In \`ptbk coder run\` and \`ptbk coder plan\`, TEAM entries in the selected Book, its ancestors and imports
19680
+ use the existing reference rules: \`@Name\`, \`{Agent Name}\`, \`{./lawyer.book}\`, project paths such as
19681
+ \`{agents/lawyer.book}\`, and HTTP(S) Book URLs. Local advisers require no Agents Server. A remote Book
19682
+ must be readable through its normal endpoint; private or inaccessible sources return errors.
19683
+ Coding harnesses expose scoped command tools; planning uses restricted host tools and currently requires
19684
+ OpenAI Codex. Planning restrictions apply to every adviser, including custom Developer Books.
19685
+ The primary agent retains responsibility for the task, PRD proposals and final output.
19686
+
19572
19687
  ## Examples
19573
19688
 
19574
19689
  \`\`\`book
@@ -19580,7 +19695,7 @@ class TeamCommitmentDefinition extends BaseCommitmentDefinition {
19580
19695
  `);
19581
19696
  }
19582
19697
  applyToAgentModelRequirements(requirements, content) {
19583
- var _a, _b, _c;
19698
+ var _a, _b, _c, _d;
19584
19699
  const trimmedContent = content.trim();
19585
19700
  if (!trimmedContent) {
19586
19701
  return requirements;
@@ -19594,20 +19709,30 @@ class TeamCommitmentDefinition extends BaseCommitmentDefinition {
19594
19709
  const existingTeammates = ((_b = requirements._metadata) === null || _b === void 0 ? void 0 : _b.teammates) || [];
19595
19710
  const preResolvedProfiles = (((_c = requirements._metadata) === null || _c === void 0 ? void 0 : _c.preResolvedTeammateProfiles) || {});
19596
19711
  const resolvedTeammates = resolveTeamTeammateLabels(trimmedContent, teammates);
19712
+ const toolUrls = new Map(existingTeammates.map((teammate) => [teammate.toolName, teammate.url]));
19597
19713
  const teamEntries = resolvedTeammates.map((teammate) => {
19598
19714
  const profile = preResolvedProfiles[teammate.url];
19599
19715
  const resolvedLabel = (profile === null || profile === void 0 ? void 0 : profile.agentName) || teammate.label;
19600
19716
  const existingTeammate = existingTeammates.find((entry) => entry.url === teammate.url);
19717
+ const baseToolName = (existingTeammate === null || existingTeammate === void 0 ? void 0 : existingTeammate.toolName) || createTeamToolName(teammate.url, resolvedLabel);
19718
+ let toolName = baseToolName;
19719
+ let suffix = 1;
19720
+ // Explicit paths can identify distinct Books with the same display name or normalized label.
19721
+ while (toolUrls.has(toolName) && toolUrls.get(toolName) !== teammate.url) {
19722
+ toolName = `${baseToolName}_${++suffix}`;
19723
+ }
19724
+ toolUrls.set(toolName, teammate.url);
19601
19725
  return {
19602
- toolName: ((existingTeammate === null || existingTeammate === void 0 ? void 0 : existingTeammate.toolName) ||
19603
- createTeamToolName(teammate.url, resolvedLabel)),
19726
+ toolName: toolName,
19604
19727
  teammate: { ...teammate, label: resolvedLabel },
19605
19728
  agentName,
19606
19729
  description: (profile === null || profile === void 0 ? void 0 : profile.personaDescription) || null,
19607
19730
  };
19608
19731
  });
19609
- for (const entry of teamEntries) {
19610
- registerTeamTool(entry);
19732
+ if (!((_d = requirements._metadata) === null || _d === void 0 ? void 0 : _d.isTeamToolRegistrationDisabled)) {
19733
+ for (const entry of teamEntries) {
19734
+ registerTeamTool(entry);
19735
+ }
19611
19736
  }
19612
19737
  const existingTools = requirements.tools || [];
19613
19738
  const updatedTools = [...existingTools];
@@ -23760,29 +23885,36 @@ class UseUserLocationCommitmentDefinition extends BaseCommitmentDefinition {
23760
23885
  /**
23761
23886
  * `WRITING RULES` commitment definition.
23762
23887
  *
23763
- * It adds constraints that apply strictly to writing style and presentation
23764
- * rather than task-solving behavior.
23888
+ * The `WRITING RULES`/`WRITING RULE` commitment adds constraints that apply strictly to writing style
23889
+ * and presentation rather than task-solving behavior.
23890
+ *
23891
+ * Example usage in agent source:
23892
+ *
23893
+ * ```book
23894
+ * WRITING RULES Keep every response under 120 words
23895
+ * WRITING RULE Always end the message with an emoji
23896
+ * ```
23765
23897
  *
23766
23898
  * @private [🪔] Maybe export the commitments through some package
23767
23899
  */
23768
23900
  class WritingRulesCommitmentDefinition extends BaseCommitmentDefinition {
23769
- constructor() {
23770
- super('WRITING RULES');
23901
+ constructor(type = 'WRITING RULES') {
23902
+ super(type);
23771
23903
  }
23772
23904
  /**
23773
- * Short one-line description of `WRITING RULES`.
23905
+ * Short one-line description of `WRITING RULES`/`WRITING RULE`.
23774
23906
  */
23775
23907
  get description() {
23776
23908
  return 'Add writing-only constraints such as tone, length, formatting, or emoji usage.';
23777
23909
  }
23778
23910
  /**
23779
- * Icon for `WRITING RULES`.
23911
+ * Icon for `WRITING RULES`/`WRITING RULE`.
23780
23912
  */
23781
23913
  get icon() {
23782
23914
  return '📝';
23783
23915
  }
23784
23916
  /**
23785
- * Markdown documentation for `WRITING RULES`.
23917
+ * Markdown documentation for `WRITING RULES`/`WRITING RULE` commitment.
23786
23918
  */
23787
23919
  get documentation() {
23788
23920
  return spaceTrim$1(`
@@ -23792,6 +23924,7 @@ class WritingRulesCommitmentDefinition extends BaseCommitmentDefinition {
23792
23924
 
23793
23925
  ## Key aspects
23794
23926
 
23927
+ - All writing rules are treated equally regardless of singular/plural form.
23795
23928
  - Use it for writing-only constraints such as tone, formatting, length, emoji usage, punctuation, or reading level.
23796
23929
  - Do **not** use it for problem-solving behavior, policy, tool usage, or decision-making logic. Use \`RULE\` for that.
23797
23930
  - Newer writing-rules blocks override conflicting earlier writing-rules blocks.
@@ -23990,7 +24123,8 @@ const COMMITMENT_REGISTRY = [
23990
24123
  new LanguageCommitmentDefinition('LANGUAGE'),
23991
24124
  new LanguageCommitmentDefinition('LANGUAGES'),
23992
24125
  new WritingSampleCommitmentDefinition(),
23993
- new WritingRulesCommitmentDefinition(),
24126
+ new WritingRulesCommitmentDefinition('WRITING RULES'),
24127
+ new WritingRulesCommitmentDefinition('WRITING RULE'),
23994
24128
  new SampleCommitmentDefinition('SAMPLE'),
23995
24129
  new SampleCommitmentDefinition('EXAMPLE'),
23996
24130
  new FormatCommitmentDefinition('FORMAT'),
@@ -24188,9 +24322,15 @@ async function preResolveTeammateProfilesForTeamCommitment(requirements, commitm
24188
24322
  if (preResolvedTeammateProfiles[teammate.url]) {
24189
24323
  continue;
24190
24324
  }
24191
- const profile = await profileResolver.resolveTeammateProfile(teammate.url);
24192
- if (profile) {
24193
- preResolvedTeammateProfiles[teammate.url] = profile;
24325
+ try {
24326
+ const profile = await profileResolver.resolveTeammateProfile(teammate.url);
24327
+ if (profile) {
24328
+ preResolvedTeammateProfiles[teammate.url] = profile;
24329
+ }
24330
+ }
24331
+ catch (error) {
24332
+ // One inaccessible adviser must not erase the names and roles of other callable teammates.
24333
+ console.warn(`Failed to resolve TEAM profile for ${teammate.url}:`, error);
24194
24334
  }
24195
24335
  }
24196
24336
  return {
@@ -24244,6 +24384,30 @@ function applyCommitmentDefinitionSafely(requirements, commitment, commitmentCon
24244
24384
  }
24245
24385
  }
24246
24386
 
24387
+ /**
24388
+ * Pattern shared by Book parsing and editor highlighting for a commitment-like line.
24389
+ *
24390
+ * A Book commitment keyword consists of one or more all-uppercase words with at least
24391
+ * two characters each. This deliberately mirrors the Book editor syntax rule so an
24392
+ * unknown keyword starts a new source block everywhere it is interpreted.
24393
+ *
24394
+ * @private internal constant of `getBookCommitmentLineType`
24395
+ */
24396
+ const BOOK_COMMITMENT_LINE_TYPE_REGEX = /^\s*(?<type>[A-Z][A-Z0-9]+(?:\s+[A-Z][A-Z0-9]+)*)(?=\s|$)/;
24397
+ /**
24398
+ * Extracts the uppercase commitment type from a Book line, including types not registered by Promptbook.
24399
+ *
24400
+ * @param line - One raw Book source line.
24401
+ * @returns Matched commitment type or `null` when the line does not begin with commitment syntax.
24402
+ *
24403
+ * @private internal utility of Book parsing and `<BookEditor/>`
24404
+ */
24405
+ function getBookCommitmentLineType(line) {
24406
+ var _a;
24407
+ const match = BOOK_COMMITMENT_LINE_TYPE_REGEX.exec(line);
24408
+ return ((_a = match === null || match === void 0 ? void 0 : match.groups) === null || _a === void 0 ? void 0 : _a.type) || null;
24409
+ }
24410
+
24247
24411
  /**
24248
24412
  * Consumes the agent-name prelude from raw source.
24249
24413
  *
@@ -24301,13 +24465,15 @@ function parseAgentSourceWithCommitments(agentSource) {
24301
24465
  return {
24302
24466
  agentName: null,
24303
24467
  commitments: [],
24468
+ unknownCommitments: [],
24304
24469
  nonCommitmentLines: [],
24305
24470
  };
24306
24471
  }
24307
24472
  const { lines, agentName, agentNameLineIndex, agentNameLineNumber } = parseAgentSourcePrelude(agentSource);
24308
24473
  const commitments = [];
24474
+ const unknownCommitments = [];
24309
24475
  const nonCommitmentLines = agentNameLineIndex >= 0 ? [lines[agentNameLineIndex]] : [];
24310
- // Parse commitments with multiline support
24476
+ // Parse commitments with multiline support.
24311
24477
  let currentCommitment = null;
24312
24478
  // Process lines starting from after the agent name line
24313
24479
  const startIndex = agentNameLineIndex >= 0 ? agentNameLineIndex + 1 : 0;
@@ -24321,25 +24487,11 @@ function parseAgentSourceWithCommitments(agentSource) {
24321
24487
  // Check if this line starts or ends a code block
24322
24488
  if (trimmedLine.startsWith('```')) {
24323
24489
  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
- }
24490
+ appendLineToCurrentCommitmentOrNonCommitmentLines(currentCommitment, line, nonCommitmentLines);
24332
24491
  continue;
24333
24492
  }
24334
24493
  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
- }
24494
+ appendLineToCurrentCommitmentOrNonCommitmentLines(currentCommitment, line, nonCommitmentLines);
24343
24495
  continue;
24344
24496
  }
24345
24497
  // Check if this line starts a new commitment
@@ -24348,22 +24500,14 @@ function parseAgentSourceWithCommitments(agentSource) {
24348
24500
  const typeRegex = definition.createTypeRegex();
24349
24501
  const match = typeRegex.exec(line.trim());
24350
24502
  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
- }
24503
+ appendCurrentCommitment(currentCommitment, commitments, unknownCommitments);
24361
24504
  // Extract the initial content from the commitment line
24362
24505
  const fullRegex = definition.createRegex();
24363
24506
  const fullMatch = fullRegex.exec(line.trim());
24364
24507
  const initialContent = ((_b = fullMatch === null || fullMatch === void 0 ? void 0 : fullMatch.groups) === null || _b === void 0 ? void 0 : _b.contents) || '';
24365
24508
  // Start a new commitment
24366
24509
  currentCommitment = {
24510
+ kind: 'known',
24367
24511
  type: definition.type,
24368
24512
  startLineNumber: i + 1,
24369
24513
  originalStartLine: line,
@@ -24373,52 +24517,90 @@ function parseAgentSourceWithCommitments(agentSource) {
24373
24517
  break;
24374
24518
  }
24375
24519
  }
24520
+ if (foundNewCommitment) {
24521
+ continue;
24522
+ }
24523
+ const unknownCommitmentType = getBookCommitmentLineType(line);
24524
+ if (unknownCommitmentType) {
24525
+ appendCurrentCommitment(currentCommitment, commitments, unknownCommitments);
24526
+ currentCommitment = {
24527
+ kind: 'unknown',
24528
+ type: unknownCommitmentType,
24529
+ startLineNumber: i + 1,
24530
+ originalStartLine: line,
24531
+ sourceLines: [line],
24532
+ };
24533
+ continue;
24534
+ }
24376
24535
  // Check if this is a horizontal line (ends any current commitment)
24377
24536
  const isHorizontalLine = HORIZONTAL_LINE_PATTERN$1.test(line);
24378
24537
  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
- }
24538
+ appendCurrentCommitment(currentCommitment, commitments, unknownCommitments);
24539
+ currentCommitment = null;
24390
24540
  // Add horizontal line to non-commitment lines
24391
24541
  nonCommitmentLines.push(line);
24392
24542
  continue;
24393
24543
  }
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
- });
24544
+ appendLineToCurrentCommitmentOrNonCommitmentLines(currentCommitment, line, nonCommitmentLines);
24414
24545
  }
24546
+ appendCurrentCommitment(currentCommitment, commitments, unknownCommitments);
24415
24547
  return {
24416
24548
  agentName,
24417
24549
  agentNameLineNumber,
24418
24550
  commitments,
24551
+ unknownCommitments,
24419
24552
  nonCommitmentLines,
24420
24553
  };
24421
24554
  }
24555
+ /**
24556
+ * Stores the current known or unknown commitment in its appropriate parsed collection.
24557
+ *
24558
+ * @param currentCommitment - Commitment-like block collected so far.
24559
+ * @param commitments - Parsed registered commitments to append to.
24560
+ * @param unknownCommitments - Parsed unregistered commitments to append to.
24561
+ *
24562
+ * @private internal utility of `parseAgentSourceWithCommitments`
24563
+ */
24564
+ function appendCurrentCommitment(currentCommitment, commitments, unknownCommitments) {
24565
+ if (!currentCommitment) {
24566
+ return;
24567
+ }
24568
+ if (currentCommitment.kind === 'unknown') {
24569
+ unknownCommitments.push({
24570
+ type: currentCommitment.type,
24571
+ originalLine: currentCommitment.originalStartLine,
24572
+ lineNumber: currentCommitment.startLineNumber,
24573
+ source: spaceTrim$1(currentCommitment.sourceLines.join('\n')),
24574
+ });
24575
+ return;
24576
+ }
24577
+ commitments.push({
24578
+ type: currentCommitment.type,
24579
+ content: spaceTrim$1(currentCommitment.contentLines.join('\n')),
24580
+ originalLine: currentCommitment.originalStartLine,
24581
+ lineNumber: currentCommitment.startLineNumber,
24582
+ });
24583
+ }
24584
+ /**
24585
+ * Adds one source line to the active commitment-like block, or to plain source content when none is active.
24586
+ *
24587
+ * @param currentCommitment - Commitment-like block currently being collected.
24588
+ * @param line - Source line to append.
24589
+ * @param nonCommitmentLines - Plain source lines to append to when no block is active.
24590
+ *
24591
+ * @private internal utility of `parseAgentSourceWithCommitments`
24592
+ */
24593
+ function appendLineToCurrentCommitmentOrNonCommitmentLines(currentCommitment, line, nonCommitmentLines) {
24594
+ if (!currentCommitment) {
24595
+ nonCommitmentLines.push(line);
24596
+ return;
24597
+ }
24598
+ if (currentCommitment.kind === 'unknown') {
24599
+ currentCommitment.sourceLines.push(line);
24600
+ return;
24601
+ }
24602
+ currentCommitment.contentLines.push(line);
24603
+ }
24422
24604
 
24423
24605
  /**
24424
24606
  * Plugin for importing agent books *(`.book` files)*
@@ -24556,7 +24738,8 @@ async function augmentAgentModelRequirementsFromSource(requirements, parseResult
24556
24738
  requirements = await importReferencedFiles(requirements);
24557
24739
  requirements = appendMcpServers(requirements, agentSource);
24558
24740
  requirements = appendNonCommitmentContent(requirements, parseResult);
24559
- return appendExampleInteractions(requirements, parseResult);
24741
+ requirements = appendExampleInteractions(requirements, parseResult);
24742
+ return appendUnknownCommitmentContent(requirements, parseResult);
24560
24743
  }
24561
24744
  /**
24562
24745
  * Imports text files referenced by IMPORT commitments and appends their transformed content to the system message.
@@ -24678,6 +24861,36 @@ function appendNonCommitmentContent(requirements, parseResult) {
24678
24861
  }
24679
24862
  return appendSystemMessageSection(requirements, nonCommitmentContent);
24680
24863
  }
24864
+ /**
24865
+ * Appends unknown commitment blocks as final extra context without applying commitment side effects.
24866
+ *
24867
+ * @param requirements - Current requirements snapshot.
24868
+ * @param parseResult - Parsed source including unknown commitment blocks.
24869
+ * @returns Requirements with unknown commitment context appended at the end of the system message.
24870
+ *
24871
+ * @private internal utility of `augmentAgentModelRequirementsFromSource`
24872
+ */
24873
+ function appendUnknownCommitmentContent(requirements, parseResult) {
24874
+ const unknownCommitmentContent = getUnknownCommitmentContent(parseResult);
24875
+ if (!unknownCommitmentContent) {
24876
+ return requirements;
24877
+ }
24878
+ return appendSystemMessageSection(requirements, unknownCommitmentContent);
24879
+ }
24880
+ /**
24881
+ * Joins unknown commitment blocks into their final extra-context representation.
24882
+ *
24883
+ * @param parseResult - Parsed source including unknown commitment blocks.
24884
+ * @returns Unknown commitment source blocks in their original order.
24885
+ *
24886
+ * @private internal utility of `appendUnknownCommitmentContent`
24887
+ */
24888
+ function getUnknownCommitmentContent(parseResult) {
24889
+ return parseResult.unknownCommitments
24890
+ .map((commitment) => commitment.source)
24891
+ .filter(Boolean)
24892
+ .join('\n\n');
24893
+ }
24681
24894
  /**
24682
24895
  * Collects plain-text lines that were not parsed as commitments and should still become part of the final system message.
24683
24896
  *
@@ -25064,6 +25277,245 @@ function stripInlineKnowledgeMetadata(metadata) {
25064
25277
  return Object.keys(rest).length > 0 ? rest : undefined;
25065
25278
  }
25066
25279
 
25280
+ /**
25281
+ * Pattern matching a markdown section heading (`## Title`) that separates system-message sections
25282
+ *
25283
+ * @private internal constant of `deduplicateSystemMessage`
25284
+ */
25285
+ const SYSTEM_MESSAGE_SECTION_HEADING_PATTERN = /^##(?!#)\s*(.+?)\s*$/;
25286
+ /**
25287
+ * Pattern matching a fenced code block delimiter which suspends section and block splitting
25288
+ *
25289
+ * @private internal constant of `deduplicateSystemMessage`
25290
+ */
25291
+ const CODE_FENCE_PATTERN = /^\s*(?:```|~~~)/;
25292
+ /**
25293
+ * Pattern matching a markdown list item which keeps merged bullet lists visually compact
25294
+ *
25295
+ * @private internal constant of `deduplicateSystemMessage`
25296
+ */
25297
+ const LIST_ITEM_PATTERN = /^\s*(?:[-*+]|\d+[.)])\s/;
25298
+ /**
25299
+ * Removes duplicated instructions from a generated system message
25300
+ *
25301
+ * Commitments are applied one by one, so a commitment used multiple times in one book repeats its whole
25302
+ * section, including the shared guidance preamble. For example two `WRITING RULES` commitments emit the
25303
+ * `## Writing rules` heading and its guidance paragraph twice. This function merges all sections sharing
25304
+ * one heading into the position of their first occurrence and keeps every identical block only once.
25305
+ *
25306
+ * @param systemMessage The assembled system message which may contain repeated sections and blocks
25307
+ * @returns The system message where each section heading and each identical block appears exactly once
25308
+ *
25309
+ * @private internal utility of `createAgentModelRequirementsWithCommitments`
25310
+ */
25311
+ function deduplicateSystemMessage(systemMessage) {
25312
+ if (!systemMessage.trim()) {
25313
+ return systemMessage;
25314
+ }
25315
+ return splitSystemMessageIntoRegions(systemMessage)
25316
+ .reduce(mergeRegionSharingHeading, [])
25317
+ .map(removeDuplicateBlocksFromRegion)
25318
+ .map(renderRegion)
25319
+ .filter((renderedRegion) => renderedRegion !== '')
25320
+ .join('\n\n');
25321
+ }
25322
+ /**
25323
+ * Splits the system message into the intro region and one region per `## Title` section
25324
+ *
25325
+ * @param systemMessage The system message to split
25326
+ * @returns Regions in their original order, without empty ones
25327
+ *
25328
+ * @private internal utility of `deduplicateSystemMessage`
25329
+ */
25330
+ function splitSystemMessageIntoRegions(systemMessage) {
25331
+ const regions = [];
25332
+ let headingLine = null;
25333
+ let bodyLines = [];
25334
+ let isInsideCodeFence = false;
25335
+ for (const line of systemMessage.split(/\r?\n/)) {
25336
+ if (CODE_FENCE_PATTERN.test(line)) {
25337
+ isInsideCodeFence = !isInsideCodeFence;
25338
+ }
25339
+ if (isInsideCodeFence || !SYSTEM_MESSAGE_SECTION_HEADING_PATTERN.test(line)) {
25340
+ bodyLines.push(line);
25341
+ continue;
25342
+ }
25343
+ regions.push(createRegion(headingLine, bodyLines));
25344
+ headingLine = line;
25345
+ bodyLines = [];
25346
+ }
25347
+ regions.push(createRegion(headingLine, bodyLines));
25348
+ return regions.filter((region) => region.headingLine !== null || region.blocks.length > 0);
25349
+ }
25350
+ /**
25351
+ * Creates one region from its heading line and its raw body lines
25352
+ *
25353
+ * @param headingLine The original `## Title` line, or `null` for the intro before the first heading
25354
+ * @param bodyLines The raw lines following the heading line
25355
+ * @returns The region with its body already split into blocks
25356
+ *
25357
+ * @private internal utility of `splitSystemMessageIntoRegions`
25358
+ */
25359
+ function createRegion(headingLine, bodyLines) {
25360
+ return {
25361
+ titleKey: headingLine === null ? null : normalizeSectionTitle(headingLine),
25362
+ headingLine,
25363
+ isBodySeparatedByBlankLine: bodyLines[0] !== undefined && bodyLines[0].trim() === '',
25364
+ blocks: splitBodyIntoBlocks(bodyLines),
25365
+ };
25366
+ }
25367
+ /**
25368
+ * Normalizes a heading line into a key usable for matching sections which belong together
25369
+ *
25370
+ * @param headingLine The original `## Title` line
25371
+ * @returns Lowercased title without the markdown heading prefix
25372
+ *
25373
+ * @private internal utility of `createRegion`
25374
+ */
25375
+ function normalizeSectionTitle(headingLine) {
25376
+ var _a, _b;
25377
+ 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();
25378
+ }
25379
+ /**
25380
+ * Splits raw body lines into blocks separated by blank lines while keeping fenced code blocks intact
25381
+ *
25382
+ * @param bodyLines The raw lines of one region body
25383
+ * @returns Non-empty blocks in their original order
25384
+ *
25385
+ * @private internal utility of `createRegion`
25386
+ */
25387
+ function splitBodyIntoBlocks(bodyLines) {
25388
+ const blockTexts = [];
25389
+ let blockLines = [];
25390
+ let isInsideCodeFence = false;
25391
+ for (const line of bodyLines) {
25392
+ if (CODE_FENCE_PATTERN.test(line)) {
25393
+ isInsideCodeFence = !isInsideCodeFence;
25394
+ }
25395
+ if (!isInsideCodeFence && line.trim() === '') {
25396
+ blockTexts.push(blockLines.join('\n'));
25397
+ blockLines = [];
25398
+ continue;
25399
+ }
25400
+ blockLines.push(line);
25401
+ }
25402
+ blockTexts.push(blockLines.join('\n'));
25403
+ return blockTexts
25404
+ .filter((blockText) => blockText.trim() !== '')
25405
+ .map((blockText) => ({ text: blockText, isOpeningMergedSection: false }));
25406
+ }
25407
+ /**
25408
+ * Appends one region to the already merged regions, merging it into an earlier region with the same heading
25409
+ *
25410
+ * @param mergedRegions Regions merged so far, used as the reducer accumulator
25411
+ * @param region The next region in original order
25412
+ * @returns The accumulator with the region either appended or merged into its earlier twin
25413
+ *
25414
+ * @private internal utility of `deduplicateSystemMessage`
25415
+ */
25416
+ function mergeRegionSharingHeading(mergedRegions, region) {
25417
+ const existingRegionIndex = mergedRegions.findIndex((mergedRegion) => region.titleKey !== null && mergedRegion.titleKey === region.titleKey);
25418
+ if (existingRegionIndex === -1) {
25419
+ return [...mergedRegions, region];
25420
+ }
25421
+ return mergedRegions.map((mergedRegion, index) => index !== existingRegionIndex
25422
+ ? mergedRegion
25423
+ : {
25424
+ ...mergedRegion,
25425
+ blocks: [...mergedRegion.blocks, ...markFirstBlockAsOpeningMergedSection(region.blocks)],
25426
+ });
25427
+ }
25428
+ /**
25429
+ * Marks the first block of a merged section occurrence so the merge seam can be rendered as one list
25430
+ *
25431
+ * @param blocks The blocks of the section occurrence being merged into an earlier section
25432
+ * @returns The same blocks with the first one marked as opening a merged section
25433
+ *
25434
+ * @private internal utility of `mergeRegionSharingHeading`
25435
+ */
25436
+ function markFirstBlockAsOpeningMergedSection(blocks) {
25437
+ return blocks.map((block, index) => (index === 0 ? { ...block, isOpeningMergedSection: true } : block));
25438
+ }
25439
+ /**
25440
+ * Keeps only the first occurrence of every identical block inside one region
25441
+ *
25442
+ * @param region The region whose blocks may repeat
25443
+ * @returns The region without repeated blocks
25444
+ *
25445
+ * @private internal utility of `deduplicateSystemMessage`
25446
+ */
25447
+ function removeDuplicateBlocksFromRegion(region) {
25448
+ const alreadyRenderedTexts = new Set();
25449
+ const uniqueBlocks = [];
25450
+ let isMergeSeamPending = false;
25451
+ for (const block of region.blocks) {
25452
+ if (alreadyRenderedTexts.has(block.text)) {
25453
+ // Note: A removed block must still hand its merge seam over to the next block which survives
25454
+ isMergeSeamPending = isMergeSeamPending || block.isOpeningMergedSection;
25455
+ continue;
25456
+ }
25457
+ alreadyRenderedTexts.add(block.text);
25458
+ uniqueBlocks.push({
25459
+ text: block.text,
25460
+ isOpeningMergedSection: block.isOpeningMergedSection || isMergeSeamPending,
25461
+ });
25462
+ isMergeSeamPending = false;
25463
+ }
25464
+ return { ...region, blocks: uniqueBlocks };
25465
+ }
25466
+ /**
25467
+ * Renders one region back into its markdown representation
25468
+ *
25469
+ * @param region The region to render
25470
+ * @returns The heading line together with its joined blocks
25471
+ *
25472
+ * @private internal utility of `deduplicateSystemMessage`
25473
+ */
25474
+ function renderRegion(region) {
25475
+ const body = joinBlocks(region.blocks);
25476
+ if (region.headingLine === null) {
25477
+ return body;
25478
+ }
25479
+ if (body === '') {
25480
+ return region.headingLine;
25481
+ }
25482
+ return `${region.headingLine}${region.isBodySeparatedByBlankLine ? '\n\n' : '\n'}${body}`;
25483
+ }
25484
+ /**
25485
+ * Joins blocks of one region back together
25486
+ *
25487
+ * @param blocks The blocks to join in their original order
25488
+ * @returns The joined body of one region
25489
+ *
25490
+ * @private internal utility of `renderRegion`
25491
+ */
25492
+ function joinBlocks(blocks) {
25493
+ return blocks
25494
+ .map((block, index) => index === 0 ? block.text : `${createBlockSeparator(blocks[index - 1], block)}${block.text}`)
25495
+ .join('');
25496
+ }
25497
+ /**
25498
+ * Chooses the separator between two neighboring blocks
25499
+ *
25500
+ * Blocks are normally separated by a blank line, exactly as they were written. Only where two sections were
25501
+ * merged together their lists are joined into one compact list instead of two separate ones.
25502
+ *
25503
+ * @param previousBlock The block rendered before the separator
25504
+ * @param nextBlock The block rendered after the separator
25505
+ * @returns Either a single or a double newline
25506
+ *
25507
+ * @private internal utility of `joinBlocks`
25508
+ */
25509
+ function createBlockSeparator(previousBlock, nextBlock) {
25510
+ if (!nextBlock.isOpeningMergedSection) {
25511
+ return '\n\n';
25512
+ }
25513
+ const previousBlockLines = previousBlock.text.split('\n');
25514
+ const isListContinuing = LIST_ITEM_PATTERN.test(previousBlockLines[previousBlockLines.length - 1]) &&
25515
+ LIST_ITEM_PATTERN.test(nextBlock.text.split('\n')[0]);
25516
+ return isListContinuing ? '\n' : '\n\n';
25517
+ }
25518
+
25067
25519
  /**
25068
25520
  * Removes single-hash comment lines (`# Comment`) from a system message
25069
25521
  * This is used to clean up the final system message before sending it to the AI model
@@ -25102,6 +25554,12 @@ async function createAgentModelRequirementsWithCommitments(agentSource, modelNam
25102
25554
  const parseResult = parseAgentSourceWithCommitments(agentSource);
25103
25555
  const filteredCommitments = filterCommitmentsForAgentModelRequirements(parseResult.commitments);
25104
25556
  let requirements = createInitialAgentModelRequirements(parseResult.agentName, modelName);
25557
+ if (options === null || options === void 0 ? void 0 : options.isTeamToolRegistrationDisabled) {
25558
+ requirements = {
25559
+ ...requirements,
25560
+ _metadata: { ...requirements._metadata, isTeamToolRegistrationDisabled: true },
25561
+ };
25562
+ }
25105
25563
  requirements = await applyCommitmentsToAgentModelRequirements(requirements, filteredCommitments, options);
25106
25564
  requirements = await augmentAgentModelRequirementsFromSource(requirements, parseResult, agentSource);
25107
25565
  requirements = await materializeInlineKnowledgeSources(requirements, options === null || options === void 0 ? void 0 : options.inlineKnowledgeSourceUploader);
@@ -25137,14 +25595,14 @@ function createInitialAgentModelRequirements(agentName, modelName) {
25137
25595
  * Performs the final system-message cleanup pass after all other augmentation steps are complete.
25138
25596
  *
25139
25597
  * @param requirements - Fully built requirements before final cleanup.
25140
- * @returns Requirements with comment lines removed from the final system message.
25598
+ * @returns Requirements with comment lines removed and repeated instructions deduplicated in the final system message.
25141
25599
  *
25142
25600
  * @private internal utility of `createAgentModelRequirementsWithCommitments`
25143
25601
  */
25144
25602
  function finalizeRequirements(requirements) {
25145
25603
  return {
25146
25604
  ...requirements,
25147
- systemMessage: removeCommentsFromSystemMessage(requirements.systemMessage),
25605
+ systemMessage: deduplicateSystemMessage(removeCommentsFromSystemMessage(requirements.systemMessage)),
25148
25606
  };
25149
25607
  }
25150
25608
 
@@ -25919,7 +26377,7 @@ function validateBook(source) {
25919
26377
  const DEFAULT_BOOK = padBook(validateBook(spaceTrim$1(`
25920
26378
  AI Avatar
25921
26379
 
25922
- PERSONA A friendly AI assistant that helps you with your tasks
26380
+ GOAL Help users with their tasks as a friendly AI assistant.
25923
26381
  `)));
25924
26382
  // <- Note: Not using book`...` notation to avoid strange error in jest unit tests `TypeError: (0 , book_notation_1.book) is not a function`
25925
26383
  // <- TODO: [🐱‍🚀] `GENESIS_BOOK` / `ADAM_BOOK` in `/agents/adam.book`
@@ -26410,7 +26868,12 @@ const czechBookLanguageManualDictionary = {
26410
26868
  \`FROM\` odkazuje na zdroj rodičovského agenta. Při vyhodnocení dědičnosti platí:
26411
26869
 
26412
26870
  - Obsah rodiče se sloučí do výsledného zdroje.
26413
- - \`FROM {Void}\` / \`FROM VOID\` znamená výslovné „žádný rodič“.
26871
+ - Když \`FROM\` není uvedeno vůbec, platí to samé jako \`FROM @Adam\`, tedy jádrový agent, ze kterého dědí každý agent.
26872
+ - \`FROM @Null\` / \`FROM {Void}\` / \`FROM VOID\` znamená výslovné „žádný rodič“.
26873
+ - Výslovně zvolený rodič nahradí implicitního Adama; vlastní řetězec \`FROM\` tohoto rodiče se pak zdědí běžným způsobem.
26874
+ - \`@Jmeno\` je pro jednoslovné jméno agenta zkratka zápisu \`{Jmeno}\`.
26875
+ - Když je \`FROM\` uvedeno vícekrát, platí poslední a přepíše všechna předchozí.
26876
+ - 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
26877
  - Chybějící odkazy se do výsledného zdroje propíší jako poznámky.
26415
26878
  `),
26416
26879
  },
@@ -26708,7 +27171,12 @@ const englishBookLanguageManualDictionary = {
26708
27171
  \`FROM\` points to a parent agent source. During inheritance resolution:
26709
27172
 
26710
27173
  - Parent corpus is merged into effective source.
26711
- - \`FROM {Void}\` / \`FROM VOID\` means explicit "no parent".
27174
+ - Writing no \`FROM\` at all is the same as writing \`FROM @Adam\`, the core agent every agent inherits from.
27175
+ - \`FROM @Null\` / \`FROM {Void}\` / \`FROM VOID\` means explicit "no parent".
27176
+ - An explicit parent replaces the implicit Adam parent; the selected parent's own \`FROM\` chain is then inherited normally.
27177
+ - \`@Name\` is shorthand for \`{Name}\` when the agent name is one word.
27178
+ - When \`FROM\` is written more than once, the last one wins and overrides every earlier one.
27179
+ - 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
27180
  - Missing references are surfaced as notes in resolved source.
26713
27181
  `),
26714
27182
  },
@@ -26903,7 +27371,7 @@ function getBookLanguageManualDictionary(language) {
26903
27371
  * @param language - Optional info-string language label.
26904
27372
  * @returns Fenced code block.
26905
27373
  *
26906
- * @private internal utility of `createStandaloneBookLanguageMarkdown`
27374
+ * @private internal utility of `createStandaloneBookLanguageMarkdown` and of the `ptbk coder` run traces
26907
27375
  */
26908
27376
  function getSafeCodeBlock(content, language = 'markdown') {
26909
27377
  const maxBacktickCount = Math.max(0, ...(content.match(/`+/g) || []).map((match) => match.length));
@@ -27106,12 +27574,7 @@ function createFocusedCommitmentExampleSource(source, group) {
27106
27574
  const parsedSource = parseAgentSourceWithCommitments(source);
27107
27575
  const commitmentTypes = new Set([group.primary.type, ...group.aliases]);
27108
27576
  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
- ]);
27577
+ const allowedCommitmentTypes = new Set([group.primary.type, ...group.aliases, 'GOAL', CLOSED_COMMITMENT_TYPE]);
27115
27578
  const canonicalTypeByCommitmentType = createCanonicalCommitmentTypeByCommitmentType(group, isOpenClosedCommitmentFamily);
27116
27579
  const focusedCommitments = parsedSource.commitments
27117
27580
  .filter((commitment) => allowedCommitmentTypes.has(commitment.type))
@@ -27218,9 +27681,7 @@ function finalizeFocusedCommitmentExampleSource(agentName, focusedCommitments) {
27218
27681
  if (!isClosedCommitmentIncluded && !isOpenCommitmentIncluded) {
27219
27682
  normalizedFocusedCommitments.push(CLOSED_COMMITMENT_TYPE);
27220
27683
  }
27221
- return [agentName, ...normalizedFocusedCommitments]
27222
- .filter((line) => Boolean(line))
27223
- .join('\n\n');
27684
+ return [agentName, ...normalizedFocusedCommitments].filter((line) => Boolean(line)).join('\n\n');
27224
27685
  }
27225
27686
  /**
27226
27687
  * Keeps an example title unless the parser interpreted a commitment-only
@@ -27368,6 +27829,7 @@ const BEHAVIOR_COMMITMENT_TYPES = new Set([
27368
27829
  'LANGUAGES',
27369
27830
  'WRITING SAMPLE',
27370
27831
  'WRITING RULES',
27832
+ 'WRITING RULE',
27371
27833
  'SCENARIO',
27372
27834
  'SCENARIOS',
27373
27835
  'MESSAGE',
@@ -27512,9 +27974,7 @@ function createStandaloneBookLanguageMarkdown(options = {}) {
27512
27974
 
27513
27975
  ${block(dictionary.tutorialSections.checklistBody)}
27514
27976
 
27515
- ${block(isLowLevelCommitmentsIncluded
27516
- ? renderLowLevelCommitmentsChapter(lowLevelCommitments, dictionary)
27517
- : '')}
27977
+ ${block(isLowLevelCommitmentsIncluded ? renderLowLevelCommitmentsChapter(lowLevelCommitments, dictionary) : '')}
27518
27978
 
27519
27979
  ---
27520
27980
 
@@ -28310,16 +28770,49 @@ class AgentCollectionInSupabase /* TODO: [🌈][🐱‍🚀] implements AgentCol
28310
28770
  }
28311
28771
  /**
28312
28772
  * Retrieves the permanent ID of an agent by its name or permanent ID.
28773
+ *
28774
+ * An agent that still exists always wins over a soft-deleted one, so a name that was deleted and
28775
+ * later created again resolves to the agent that is live now instead of to the recycle-bin leftover.
28776
+ * Soft-deleted agents stay resolvable as a fallback because the recycle bin restores them by name
28777
+ * or permanent id.
28313
28778
  */
28314
28779
  async getAgentPermanentId(agentNameOrPermanentId) {
28315
- const selectResult = await this.supabaseClient
28780
+ const activeAgentPermanentId = await this.findAgentPermanentId(agentNameOrPermanentId, {
28781
+ isDeletedAgentIncluded: false,
28782
+ });
28783
+ if (activeAgentPermanentId !== null) {
28784
+ return activeAgentPermanentId;
28785
+ }
28786
+ const deletedAgentPermanentId = await this.findAgentPermanentId(agentNameOrPermanentId, {
28787
+ isDeletedAgentIncluded: true,
28788
+ });
28789
+ if (deletedAgentPermanentId !== null) {
28790
+ return deletedAgentPermanentId;
28791
+ }
28792
+ throw new NotFoundError(`Agent with name or id "${agentNameOrPermanentId}" not found`);
28793
+ }
28794
+ /**
28795
+ * Looks up the permanent id of the oldest agent matching one name or permanent id.
28796
+ *
28797
+ * @param agentNameOrPermanentId - Agent name or stable permanent identifier to match.
28798
+ * @param options - Whether soft-deleted agents may be matched as well.
28799
+ * @returns Permanent id of the matched agent, or `null` when nothing matches.
28800
+ *
28801
+ * @private internal helper of `AgentCollectionInSupabase`
28802
+ */
28803
+ async findAgentPermanentId(agentNameOrPermanentId, options) {
28804
+ const selectQuery = this.supabaseClient
28316
28805
  .from(this.getTableName('Agent'))
28317
28806
  .select('permanentId')
28318
- .or(buildAgentNameOrPermanentIdFilter(agentNameOrPermanentId))
28807
+ .or(buildAgentNameOrPermanentIdFilter(agentNameOrPermanentId));
28808
+ if (!options.isDeletedAgentIncluded) {
28809
+ selectQuery.is('deletedAt', null);
28810
+ }
28811
+ const selectResult = await selectQuery
28319
28812
  .order('createdAt', { ascending: true }) // Pick oldest if multiple match by name
28320
28813
  .limit(1);
28321
28814
  if (selectResult.error || !selectResult.data || selectResult.data.length === 0) {
28322
- throw new NotFoundError(`Agent with name or id "${agentNameOrPermanentId}" not found`);
28815
+ return null;
28323
28816
  }
28324
28817
  return selectResult.data[0].permanentId;
28325
28818
  }
@@ -29560,8 +30053,8 @@ const formatCommandParser = {
29560
30053
  */
29561
30054
  $applyToTaskJson(command, $taskJson) {
29562
30055
  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}"`);
30056
+ throw new ParseError(spaceTrim$1(`Format format is already defined to "${$taskJson.format}".
30057
+ Now you try to redefine it by "${command.format}"`));
29565
30058
  }
29566
30059
  $taskJson.format = command.format;
29567
30060
  },
@@ -34871,28 +35364,28 @@ function parseToolExecutionEnvelope(rawValue) {
34871
35364
  */
34872
35365
  function buildToolInvocationScript(options) {
34873
35366
  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};
35367
+ return spaceTrim$1((block) => `
35368
+ const args = ${block(functionArgsExpression)};
35369
+ const runtimeContextRaw =
35370
+ typeof ${TOOL_RUNTIME_CONTEXT_PARAMETER} === 'undefined'
35371
+ ? undefined
35372
+ : ${TOOL_RUNTIME_CONTEXT_PARAMETER};
34880
35373
 
34881
- if (runtimeContextRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
34882
- args.${TOOL_RUNTIME_CONTEXT_ARGUMENT} = runtimeContextRaw;
34883
- }
35374
+ if (runtimeContextRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
35375
+ args.${TOOL_RUNTIME_CONTEXT_ARGUMENT} = runtimeContextRaw;
35376
+ }
34884
35377
 
34885
- const toolProgressTokenRaw =
34886
- typeof ${TOOL_PROGRESS_TOKEN_PARAMETER} === 'undefined'
34887
- ? undefined
34888
- : ${TOOL_PROGRESS_TOKEN_PARAMETER};
35378
+ const toolProgressTokenRaw =
35379
+ typeof ${TOOL_PROGRESS_TOKEN_PARAMETER} === 'undefined'
35380
+ ? undefined
35381
+ : ${TOOL_PROGRESS_TOKEN_PARAMETER};
34889
35382
 
34890
- if (toolProgressTokenRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
34891
- args.${TOOL_PROGRESS_TOKEN_ARGUMENT} = toolProgressTokenRaw;
34892
- }
35383
+ if (toolProgressTokenRaw !== undefined && args && typeof args === 'object' && !Array.isArray(args)) {
35384
+ args.${TOOL_PROGRESS_TOKEN_ARGUMENT} = toolProgressTokenRaw;
35385
+ }
34893
35386
 
34894
- return await ${functionName}(args);
34895
- `;
35387
+ return await ${functionName}(args);
35388
+ `);
34896
35389
  }
34897
35390
 
34898
35391
  /**
@@ -48732,7 +49225,7 @@ function $generateBookBoilerplate(options) {
48732
49225
  ${agentName}
48733
49226
 
48734
49227
 
48735
- PERSONA ${block(personaDescription)}
49228
+ GOAL ${block(personaDescription)}
48736
49229
  ${block(initialRules.map((rule) => `RULE ${rule}`).join('\n'))}
48737
49230
  CLOSED
48738
49231
  `));