@promptbook/cli 0.114.0-1 → 0.114.0-3

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 (199) hide show
  1. package/README.md +16 -15
  2. package/apps/agents-server/next.config.ts +11 -0
  3. package/apps/agents-server/package.json +6 -4
  4. package/apps/agents-server/playwright.config.ts +28 -38
  5. package/apps/agents-server/scripts/build-agents-server.js +62 -0
  6. package/apps/agents-server/scripts/build-e2e.js +38 -0
  7. package/apps/agents-server/scripts/ensure-root-dependencies.js +86 -0
  8. package/apps/agents-server/scripts/prerender-homepage.js +1 -1
  9. package/apps/agents-server/scripts/run-e2e-tests.js +34 -0
  10. package/apps/agents-server/scripts/run-npm.js +42 -0
  11. package/apps/agents-server/src/app/admin/email-server/page.tsx +14 -6
  12. package/apps/agents-server/src/app/api/elevenlabs/tts/route.ts +3 -3
  13. package/apps/agents-server/src/app/api/onboarding/book/route.ts +7 -6
  14. package/apps/agents-server/src/app/layout.tsx +6 -0
  15. package/apps/agents-server/src/app/superadmin/servers/ServersRegistryTable.tsx +105 -102
  16. package/apps/agents-server/src/app/superadmin/servers/useServersRegistryState.ts +15 -7
  17. package/apps/agents-server/src/components/AgentProjectDnsInstructions/AgentProjectDnsInstructions.tsx +11 -11
  18. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/ManGoBookEditor.tsx +82 -0
  19. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/WizardShell.tsx +2 -2
  20. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/steps/BookStep.tsx +13 -16
  21. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/steps/ZadaniStep.tsx +4 -4
  22. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/config/bookSections.ts +23 -16
  23. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/lib/bookSource.ts +54 -0
  24. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/services/bookService.ts +15 -8
  25. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/services/createManGoAgentSource.ts +3 -37
  26. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/services/createManGoOpenEditorRequest.ts +1 -1
  27. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/state/OnboardingProvider.tsx +2 -2
  28. package/apps/agents-server/src/components/UsersList/CreateUserDialog.tsx +13 -22
  29. package/apps/agents-server/src/components/UsersList/PasswordGeneratorDialog.tsx +216 -0
  30. package/apps/agents-server/src/components/UsersList/UsersList.tsx +16 -11
  31. package/apps/agents-server/src/components/UsersList/generateSecurePassword.ts +112 -24
  32. package/apps/agents-server/src/components/UsersList/userDialogClassNames.ts +11 -0
  33. package/apps/agents-server/src/languages/ServerTranslationKeys.ts +11 -0
  34. package/apps/agents-server/src/languages/translations/czech.yaml +11 -0
  35. package/apps/agents-server/src/languages/translations/english.yaml +11 -0
  36. package/apps/agents-server/src/utils/agentProjects/agentProjectHrefs.ts +11 -0
  37. package/apps/agents-server/src/utils/agentProjects/createAgentProjectDnsRecords.ts +53 -7
  38. package/apps/agents-server/src/utils/agentProjects/createAgentProjectMarkdownReferences.ts +37 -27
  39. package/apps/agents-server/src/utils/manGoOnboarding/manGoOnboardingAgentBooks.ts +2 -13
  40. package/apps/agents-server/src/utils/manGoOnboarding/manGoOnboardingAgentRuntime.ts +21 -73
  41. package/apps/agents-server/src/utils/stalwart/createEmailDnsInstructions.ts +9 -5
  42. package/apps/agents-server/src/utils/stalwart/readStalwartEmailSnapshot.ts +23 -5
  43. package/apps/agents-server/src/utils/stalwart/stalwartBootstrap.ts +2 -1
  44. package/apps/agents-server/src/utils/stalwart/stalwartMailBridge.ts +7 -0
  45. package/apps/agents-server/tests/e2e/e2eEnvironment.cjs +49 -0
  46. package/esm/index.es.js +1105 -273
  47. package/esm/index.es.js.map +1 -1
  48. package/esm/scripts/run-codex-prompts/common/runGoScript/scriptExecutionLog.d.ts +7 -0
  49. package/esm/scripts/run-codex-prompts/git/coderGitSync.d.ts +43 -0
  50. package/esm/scripts/run-codex-prompts/git/commitChanges.d.ts +3 -0
  51. package/esm/scripts/run-codex-prompts/main/resolvePromptRunner.d.ts +8 -1
  52. package/esm/scripts/run-codex-prompts/ping/buildCoderPingPrompt.d.ts +20 -0
  53. package/esm/scripts/run-codex-prompts/ping/extractCoderPingAnswer.d.ts +9 -0
  54. package/esm/scripts/run-codex-prompts/ping/pingCoderHarness.d.ts +23 -0
  55. package/esm/scripts/run-codex-prompts/ping/printCoderPingResult.d.ts +5 -0
  56. package/esm/scripts/run-codex-prompts/prompts/findNextTodoPrompt.d.ts +2 -1
  57. package/esm/scripts/run-codex-prompts/prompts/isPromptCompatibleWithRunner.d.ts +27 -0
  58. package/esm/scripts/run-codex-prompts/prompts/listRunnablePrompts.d.ts +2 -1
  59. package/esm/scripts/run-codex-prompts/prompts/listUpcomingTasks.d.ts +2 -1
  60. package/esm/scripts/run-codex-prompts/prompts/replacePromptTodoStatusLine.d.ts +7 -0
  61. package/esm/scripts/run-codex-prompts/testing/TestBeforeMode.d.ts +16 -0
  62. package/esm/scripts/run-codex-prompts/testing/createTestBeforeRepairPrompt.d.ts +9 -0
  63. package/esm/scripts/run-codex-prompts/testing/limitTestOutput.d.ts +4 -0
  64. package/esm/scripts/run-codex-prompts/testing/runPromptTestCommand.d.ts +1 -2
  65. package/esm/scripts/run-codex-prompts/testing/runTestBefore.d.ts +24 -0
  66. package/esm/scripts/run-codex-prompts/ui/buildRunUiFrameShared.d.ts +1 -0
  67. package/esm/scripts/verify-prompts/verify-prompts.d.ts +5 -0
  68. package/esm/src/book-2.0/book-language-documentation/BookLanguageManualDictionary.d.ts +1 -15
  69. package/esm/src/book-2.0/book-language-documentation/getBookLanguageManualCommitmentGroups.d.ts +1 -1
  70. package/esm/src/book-2.0/book-language-documentation/renderCommitmentCatalogSection.d.ts +0 -4
  71. package/esm/src/book-components/Chat/utils/$provideServerDomWindow.d.ts +11 -0
  72. package/esm/src/book-components/Chat/utils/renderMarkdown.d.ts +7 -0
  73. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/createAgentsServerRuntimeEnvironment.d.ts +7 -0
  74. package/esm/src/cli/cli-commands/coder/agentCodingFile.d.ts +2 -3
  75. package/esm/src/cli/cli-commands/coder/ping.d.ts +10 -0
  76. package/esm/src/cli/cli-commands/coder/ping.test.d.ts +1 -0
  77. package/esm/src/cli/cli-commands/coder.d.ts +1 -0
  78. package/esm/src/cli/cli-commands/common/coderGitSyncCliOptions.d.ts +34 -0
  79. package/esm/src/cli/cli-commands/common/coderGitSyncCliOptions.test.d.ts +1 -0
  80. package/esm/src/cli/common/loadPromptsModule.d.ts +16 -0
  81. package/esm/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +1 -1
  82. package/esm/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +1 -1
  83. package/esm/src/llm-providers/openai/OpenAiAgentKitExecutionTools.d.ts +1 -1
  84. package/esm/src/llm-providers/openai/OpenAiAgentKitExecutionToolsToolBuilder.d.ts +1 -1
  85. package/esm/src/llm-providers/openai/OpenAiAssistantExecutionToolsStreamRunner.d.ts +1 -1
  86. package/esm/src/llm-providers/openai/OpenAiAssistantExecutionToolsToolRunner.d.ts +1 -1
  87. package/esm/src/llm-providers/openai/OpenAiCompatibleNonChatPromptCaller.d.ts +1 -1
  88. package/esm/src/llm-providers/openai/OpenAiCompatibleRequestManager.d.ts +1 -1
  89. package/esm/src/llm-providers/openai/utils/callOpenAiCompatibleChatModel.d.ts +1 -1
  90. package/esm/src/llm-providers/openai/utils/loadOpenAiAgentsModule.d.ts +203 -0
  91. package/esm/src/llm-providers/openai/utils/uploadFilesToOpenAi.d.ts +1 -1
  92. package/esm/src/utils/misc/createLazyModuleLoader.d.ts +14 -0
  93. package/esm/src/version.d.ts +1 -1
  94. package/package.json +1 -1
  95. package/src/book-2.0/book-language-documentation/BookLanguageManualDictionary.ts +1 -15
  96. package/src/book-2.0/book-language-documentation/bookLanguageDocumentationExamples.ts +1 -2
  97. package/src/book-2.0/book-language-documentation/createStandaloneBookLanguageMarkdown.ts +92 -32
  98. package/src/book-2.0/book-language-documentation/czechBookLanguageManualDictionary.ts +16 -39
  99. package/src/book-2.0/book-language-documentation/englishBookLanguageManualDictionary.ts +16 -36
  100. package/src/book-2.0/book-language-documentation/getBookLanguageManualCommitmentGroups.ts +9 -1
  101. package/src/book-2.0/book-language-documentation/renderCommitmentCatalogSection.ts +4 -51
  102. package/src/book-2.0/book-language-documentation/renderGroupedCommitmentDocumentationMarkdown.ts +291 -4
  103. package/src/book-3.0/LiteAgent.ts +11 -9
  104. package/src/book-components/Chat/utils/$provideServerDomWindow.ts +77 -0
  105. package/src/book-components/Chat/utils/renderMarkdown.ts +135 -32
  106. package/src/cli/cli-commands/agents-server/buildAgentsServer/createAgentsServerRuntimeEnvironment.ts +14 -0
  107. package/src/cli/cli-commands/agents-server/buildAgentsServer/ensureAgentsServerBuild.ts +1 -0
  108. package/src/cli/cli-commands/agents-server/startAgentsServer/createLocalAgentRunOptions.ts +1 -0
  109. package/src/cli/cli-commands/coder/add.ts +40 -12
  110. package/src/cli/cli-commands/coder/agentCodingFile.ts +6 -129
  111. package/src/cli/cli-commands/coder/generate-boilerplates.ts +31 -5
  112. package/src/cli/cli-commands/coder/getDefaultCoderPackageJsonScripts.ts +1 -1
  113. package/src/cli/cli-commands/coder/init.ts +27 -1
  114. package/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.ts +1 -4
  115. package/src/cli/cli-commands/coder/ping.ts +72 -0
  116. package/src/cli/cli-commands/coder/run.ts +25 -2
  117. package/src/cli/cli-commands/coder/verify.ts +27 -12
  118. package/src/cli/cli-commands/coder.ts +4 -0
  119. package/src/cli/cli-commands/common/coderGitSyncCliOptions.ts +78 -0
  120. package/src/cli/cli-commands/run/prepareRunCommandResources.ts +2 -1
  121. package/src/cli/cli-commands/run/resolveRunInputParameters.ts +2 -1
  122. package/src/cli/cli-commands/runInteractiveChatbot.ts +2 -1
  123. package/src/cli/common/$provideLlmToolsForCli.ts +2 -1
  124. package/src/cli/common/loadPromptsModule.ts +13 -0
  125. package/src/conversion/archive/loadArchive.ts +2 -1
  126. package/src/conversion/archive/loadJsZipModule.ts +10 -0
  127. package/src/conversion/archive/saveArchive.ts +2 -1
  128. package/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.ts +13 -1
  129. package/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.ts +13 -1
  130. package/src/llm-providers/openai/OpenAiAgentKitExecutionTools.ts +6 -2
  131. package/src/llm-providers/openai/OpenAiAgentKitExecutionToolsToolBuilder.ts +7 -5
  132. package/src/llm-providers/openai/OpenAiAssistantExecutionTools.ts +1 -1
  133. package/src/llm-providers/openai/OpenAiAssistantExecutionToolsStreamRunner.ts +1 -1
  134. package/src/llm-providers/openai/OpenAiAssistantExecutionToolsToolRunner.ts +1 -1
  135. package/src/llm-providers/openai/OpenAiCompatibleNonChatPromptCaller.ts +1 -1
  136. package/src/llm-providers/openai/OpenAiCompatibleRequestManager.ts +12 -1
  137. package/src/llm-providers/openai/utils/callOpenAiCompatibleChatModel.ts +1 -1
  138. package/src/llm-providers/openai/utils/loadOpenAiAgentsModule.ts +11 -0
  139. package/src/llm-providers/openai/utils/uploadFilesToOpenAi.ts +1 -1
  140. package/src/other/templates/getTemplatesPipelineCollection.ts +731 -923
  141. package/src/remote-server/createRemoteClient.ts +12 -1
  142. package/src/scrapers/website/WebsiteScraper.ts +22 -2
  143. package/src/utils/agent-message-runtime/resolveAgentMessageRuntimeActivity.ts +101 -0
  144. package/src/utils/misc/createLazyModuleLoader.ts +27 -0
  145. package/src/version.ts +2 -2
  146. package/src/versions.txt +2 -1
  147. package/umd/index.umd.js +1180 -342
  148. package/umd/index.umd.js.map +1 -1
  149. package/umd/scripts/run-codex-prompts/common/runGoScript/scriptExecutionLog.d.ts +7 -0
  150. package/umd/scripts/run-codex-prompts/git/coderGitSync.d.ts +43 -0
  151. package/umd/scripts/run-codex-prompts/git/commitChanges.d.ts +3 -0
  152. package/umd/scripts/run-codex-prompts/main/resolvePromptRunner.d.ts +8 -1
  153. package/umd/scripts/run-codex-prompts/ping/buildCoderPingPrompt.d.ts +20 -0
  154. package/umd/scripts/run-codex-prompts/ping/extractCoderPingAnswer.d.ts +9 -0
  155. package/umd/scripts/run-codex-prompts/ping/pingCoderHarness.d.ts +23 -0
  156. package/umd/scripts/run-codex-prompts/ping/printCoderPingResult.d.ts +5 -0
  157. package/umd/scripts/run-codex-prompts/prompts/findNextTodoPrompt.d.ts +2 -1
  158. package/umd/scripts/run-codex-prompts/prompts/isPromptCompatibleWithRunner.d.ts +27 -0
  159. package/umd/scripts/run-codex-prompts/prompts/listRunnablePrompts.d.ts +2 -1
  160. package/umd/scripts/run-codex-prompts/prompts/listUpcomingTasks.d.ts +2 -1
  161. package/umd/scripts/run-codex-prompts/prompts/replacePromptTodoStatusLine.d.ts +7 -0
  162. package/umd/scripts/run-codex-prompts/testing/TestBeforeMode.d.ts +16 -0
  163. package/umd/scripts/run-codex-prompts/testing/createTestBeforeRepairPrompt.d.ts +9 -0
  164. package/umd/scripts/run-codex-prompts/testing/limitTestOutput.d.ts +4 -0
  165. package/umd/scripts/run-codex-prompts/testing/runPromptTestCommand.d.ts +1 -2
  166. package/umd/scripts/run-codex-prompts/testing/runTestBefore.d.ts +24 -0
  167. package/umd/scripts/run-codex-prompts/ui/buildRunUiFrameShared.d.ts +1 -0
  168. package/umd/scripts/verify-prompts/verify-prompts.d.ts +5 -0
  169. package/umd/src/book-2.0/book-language-documentation/BookLanguageManualDictionary.d.ts +1 -15
  170. package/umd/src/book-2.0/book-language-documentation/getBookLanguageManualCommitmentGroups.d.ts +1 -1
  171. package/umd/src/book-2.0/book-language-documentation/renderCommitmentCatalogSection.d.ts +0 -4
  172. package/umd/src/book-components/Chat/utils/$provideServerDomWindow.d.ts +11 -0
  173. package/umd/src/book-components/Chat/utils/renderMarkdown.d.ts +7 -0
  174. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/createAgentsServerRuntimeEnvironment.d.ts +7 -0
  175. package/umd/src/cli/cli-commands/coder/agentCodingFile.d.ts +2 -3
  176. package/umd/src/cli/cli-commands/coder/ping.d.ts +10 -0
  177. package/umd/src/cli/cli-commands/coder/ping.test.d.ts +1 -0
  178. package/umd/src/cli/cli-commands/coder.d.ts +1 -0
  179. package/umd/src/cli/cli-commands/common/coderGitSyncCliOptions.d.ts +34 -0
  180. package/umd/src/cli/cli-commands/common/coderGitSyncCliOptions.test.d.ts +1 -0
  181. package/umd/src/cli/common/loadPromptsModule.d.ts +16 -0
  182. package/umd/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +1 -1
  183. package/umd/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +1 -1
  184. package/umd/src/llm-providers/openai/OpenAiAgentKitExecutionTools.d.ts +1 -1
  185. package/umd/src/llm-providers/openai/OpenAiAgentKitExecutionToolsToolBuilder.d.ts +1 -1
  186. package/umd/src/llm-providers/openai/OpenAiAssistantExecutionToolsStreamRunner.d.ts +1 -1
  187. package/umd/src/llm-providers/openai/OpenAiAssistantExecutionToolsToolRunner.d.ts +1 -1
  188. package/umd/src/llm-providers/openai/OpenAiCompatibleNonChatPromptCaller.d.ts +1 -1
  189. package/umd/src/llm-providers/openai/OpenAiCompatibleRequestManager.d.ts +1 -1
  190. package/umd/src/llm-providers/openai/utils/callOpenAiCompatibleChatModel.d.ts +1 -1
  191. package/umd/src/llm-providers/openai/utils/loadOpenAiAgentsModule.d.ts +203 -0
  192. package/umd/src/llm-providers/openai/utils/uploadFilesToOpenAi.d.ts +1 -1
  193. package/umd/src/utils/misc/createLazyModuleLoader.d.ts +14 -0
  194. package/umd/src/version.d.ts +1 -1
  195. package/apps/agents-server/src/app/api/onboarding/draft/route.ts +0 -23
  196. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/BookLanguagePanel.tsx +0 -125
  197. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/MarkdownBookEditor.tsx +0 -154
  198. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/components/MarkdownPreview.tsx +0 -188
  199. package/apps/agents-server/src/components/NewAgentDialog/ManGoNewAgentWizard/services/draftService.ts +0 -32
@@ -0,0 +1,203 @@
1
+ /// <reference types="node" />
2
+ /**
3
+ * Loads the OpenAI AgentKit SDK (`@openai/agents`) on demand
4
+ *
5
+ * Note: [🐌] The AgentKit SDK is one of the heaviest dependencies of Promptbook, loading it eagerly would slow down
6
+ * every single run of the `ptbk` CLI utility even when no AgentKit agent is used
7
+ *
8
+ * @private internal utility of `@promptbook/openai`
9
+ */
10
+ export declare const loadOpenAiAgentsModule: () => Promise<{
11
+ default: typeof import("@openai/agents");
12
+ applyPatchTool: typeof import("@openai/agents").applyPatchTool;
13
+ shellTool: typeof import("@openai/agents").shellTool;
14
+ realtime: typeof import("@openai/agents-realtime");
15
+ RuntimeEventEmitter: typeof import("events");
16
+ Agent: typeof import("@openai/agents").Agent;
17
+ AgentsError: typeof import("@openai/agents").AgentsError;
18
+ GuardrailExecutionError: typeof import("@openai/agents").GuardrailExecutionError;
19
+ InputGuardrailTripwireTriggered: typeof import("@openai/agents").InputGuardrailTripwireTriggered;
20
+ MaxTurnsExceededError: typeof import("@openai/agents").MaxTurnsExceededError;
21
+ ModelBehaviorError: typeof import("@openai/agents").ModelBehaviorError;
22
+ OutputGuardrailTripwireTriggered: typeof import("@openai/agents").OutputGuardrailTripwireTriggered;
23
+ ToolInputGuardrailTripwireTriggered: typeof import("@openai/agents").ToolInputGuardrailTripwireTriggered;
24
+ ToolOutputGuardrailTripwireTriggered: typeof import("@openai/agents").ToolOutputGuardrailTripwireTriggered;
25
+ ToolCallError: typeof import("@openai/agents").ToolCallError;
26
+ ToolTimeoutError: typeof import("@openai/agents").ToolTimeoutError;
27
+ UserError: typeof import("@openai/agents").UserError;
28
+ SystemError: typeof import("@openai/agents").SystemError;
29
+ RunAgentUpdatedStreamEvent: typeof import("@openai/agents").RunAgentUpdatedStreamEvent;
30
+ RunRawModelStreamEvent: typeof import("@openai/agents").RunRawModelStreamEvent;
31
+ RunItemStreamEvent: typeof import("@openai/agents").RunItemStreamEvent;
32
+ defineOutputGuardrail: typeof import("@openai/agents").defineOutputGuardrail;
33
+ ToolGuardrailFunctionOutputFactory: {
34
+ allow(outputInfo?: any): import("@openai/agents").ToolGuardrailFunctionOutput;
35
+ rejectContent(message: string, outputInfo?: any): import("@openai/agents").ToolGuardrailFunctionOutput;
36
+ throwException(outputInfo?: any): import("@openai/agents").ToolGuardrailFunctionOutput;
37
+ };
38
+ defineToolInputGuardrail: typeof import("@openai/agents").defineToolInputGuardrail;
39
+ defineToolOutputGuardrail: typeof import("@openai/agents").defineToolOutputGuardrail;
40
+ resolveToolInputGuardrails: typeof import("@openai/agents").resolveToolInputGuardrails;
41
+ resolveToolOutputGuardrails: typeof import("@openai/agents").resolveToolOutputGuardrails;
42
+ getHandoff: typeof import("@openai/agents").getHandoff;
43
+ getTransferMessage: typeof import("@openai/agents").getTransferMessage;
44
+ Handoff: typeof import("@openai/agents").Handoff;
45
+ handoff: typeof import("@openai/agents").handoff;
46
+ assistant: typeof import("@openai/agents").assistant;
47
+ system: typeof import("@openai/agents").system;
48
+ user: typeof import("@openai/agents").user;
49
+ extractAllTextOutput: typeof import("@openai/agents").extractAllTextOutput;
50
+ RunHandoffCallItem: typeof import("@openai/agents").RunHandoffCallItem;
51
+ RunHandoffOutputItem: typeof import("@openai/agents").RunHandoffOutputItem;
52
+ RunMessageOutputItem: typeof import("@openai/agents").RunMessageOutputItem;
53
+ RunReasoningItem: typeof import("@openai/agents").RunReasoningItem;
54
+ RunToolApprovalItem: typeof import("@openai/agents").RunToolApprovalItem;
55
+ RunToolCallItem: typeof import("@openai/agents").RunToolCallItem;
56
+ RunToolCallOutputItem: typeof import("@openai/agents").RunToolCallOutputItem;
57
+ AgentHooks: typeof import("@openai/agents").AgentHooks;
58
+ getLogger: typeof import("@openai/agents").getLogger;
59
+ applyDiff: typeof import("@openai/agents").applyDiff;
60
+ getAllMcpTools: typeof import("@openai/agents").getAllMcpTools;
61
+ invalidateServerToolsCache: typeof import("@openai/agents").invalidateServerToolsCache;
62
+ mcpToFunctionTool: typeof import("@openai/agents").mcpToFunctionTool;
63
+ MCPServerStdio: typeof import("@openai/agents").MCPServerStdio;
64
+ MCPServerStreamableHttp: typeof import("@openai/agents").MCPServerStreamableHttp;
65
+ MCPServerSSE: typeof import("@openai/agents").MCPServerSSE;
66
+ MCPServers: typeof import("@openai/agents").MCPServers;
67
+ connectMcpServers: typeof import("@openai/agents").connectMcpServers;
68
+ createMCPToolStaticFilter: typeof import("@openai/agents").createMCPToolStaticFilter;
69
+ OPENAI_DEFAULT_MODEL_ENV_VARIABLE_NAME: "OPENAI_DEFAULT_MODEL";
70
+ gpt5ReasoningSettingsRequired: typeof import("@openai/agents").gpt5ReasoningSettingsRequired;
71
+ getDefaultModel: typeof import("@openai/agents").getDefaultModel;
72
+ getDefaultModelSettings: typeof import("@openai/agents").getDefaultModelSettings;
73
+ isGpt5Default: typeof import("@openai/agents").isGpt5Default;
74
+ setDefaultModelProvider: typeof import("@openai/agents").setDefaultModelProvider;
75
+ RunResult: typeof import("@openai/agents").RunResult;
76
+ StreamedRunResult: typeof import("@openai/agents").StreamedRunResult;
77
+ run: typeof import("@openai/agents").run;
78
+ Runner: typeof import("@openai/agents").Runner;
79
+ RunContext: typeof import("@openai/agents").RunContext;
80
+ RunState: typeof import("@openai/agents").RunState;
81
+ computerTool: typeof import("@openai/agents").computerTool;
82
+ hostedMcpTool: typeof import("@openai/agents").hostedMcpTool;
83
+ tool: typeof import("@openai/agents").tool;
84
+ invokeFunctionTool: typeof import("@openai/agents").invokeFunctionTool;
85
+ getGlobalTraceProvider: typeof import("@openai/agents").getGlobalTraceProvider;
86
+ TraceProvider: typeof import("@openai/agents").TraceProvider;
87
+ runToolInputGuardrails: typeof import("@openai/agents").runToolInputGuardrails;
88
+ runToolOutputGuardrails: typeof import("@openai/agents").runToolOutputGuardrails;
89
+ RequestUsage: typeof import("@openai/agents").RequestUsage;
90
+ Usage: typeof import("@openai/agents").Usage;
91
+ isOpenAIResponsesCompactionAwareSession: typeof import("@openai/agents").isOpenAIResponsesCompactionAwareSession;
92
+ MemorySession: typeof import("@openai/agents").MemorySession;
93
+ protocol: typeof import("@openai/agents-core/dist/types/protocol");
94
+ addTraceProcessor(processor: import("@openai/agents").TracingProcessor): void;
95
+ setTraceProcessors(processors: import("@openai/agents").TracingProcessor[]): void;
96
+ setTracingDisabled(disabled: boolean): void;
97
+ startTraceExportLoop(): void;
98
+ getCurrentSpan: typeof import("@openai/agents").getCurrentSpan;
99
+ getCurrentTrace: typeof import("@openai/agents").getCurrentTrace;
100
+ getOrCreateTrace: typeof import("@openai/agents").getOrCreateTrace;
101
+ resetCurrentSpan: typeof import("@openai/agents").resetCurrentSpan;
102
+ setCurrentSpan: typeof import("@openai/agents").setCurrentSpan;
103
+ withTrace: typeof import("@openai/agents").withTrace;
104
+ BatchTraceProcessor: typeof import("@openai/agents").BatchTraceProcessor;
105
+ ConsoleSpanExporter: typeof import("@openai/agents").ConsoleSpanExporter;
106
+ NoopSpan: typeof import("@openai/agents").NoopSpan;
107
+ Span: typeof import("@openai/agents").Span;
108
+ NoopTrace: typeof import("@openai/agents").NoopTrace;
109
+ Trace: typeof import("@openai/agents").Trace;
110
+ generateGroupId: typeof import("@openai/agents").generateGroupId;
111
+ generateSpanId: typeof import("@openai/agents").generateSpanId;
112
+ generateTraceId: typeof import("@openai/agents").generateTraceId;
113
+ createResponseSpan(options?: import("@openai/agents-core/types").DeepPartial<import("@openai/agents-core/dist/tracing/provider").CreateSpanOptions<import("@openai/agents").ResponseSpanData>> | undefined, parent?: import("@openai/agents").Trace | import("@openai/agents").Span<any> | undefined): import("@openai/agents").Span<import("@openai/agents").ResponseSpanData>;
114
+ createAgentSpan(options?: import("@openai/agents-core/types").DeepPartial<import("@openai/agents-core/dist/tracing/provider").CreateSpanOptions<import("@openai/agents").AgentSpanData>> | undefined, parent?: import("@openai/agents").Trace | import("@openai/agents").Span<any> | undefined): import("@openai/agents").Span<import("@openai/agents").AgentSpanData>;
115
+ createFunctionSpan(options: import("@openai/agents-core/types").DeepPartial<import("@openai/agents-core/dist/tracing/provider").CreateSpanOptions<import("@openai/agents").FunctionSpanData>> & {
116
+ data: {
117
+ name: string;
118
+ };
119
+ }, parent?: import("@openai/agents").Trace | import("@openai/agents").Span<any> | undefined): import("@openai/agents").Span<import("@openai/agents").FunctionSpanData>;
120
+ createHandoffSpan(options?: import("@openai/agents-core/types").DeepPartial<import("@openai/agents-core/dist/tracing/provider").CreateSpanOptions<import("@openai/agents").HandoffSpanData>> | undefined, parent?: import("@openai/agents").Trace | import("@openai/agents").Span<any> | undefined): import("@openai/agents").Span<import("@openai/agents").HandoffSpanData>;
121
+ createGenerationSpan(options?: import("@openai/agents-core/types").DeepPartial<import("@openai/agents-core/dist/tracing/provider").CreateSpanOptions<import("@openai/agents").GenerationSpanData>> | undefined, parent?: import("@openai/agents").Trace | import("@openai/agents").Span<any> | undefined): import("@openai/agents").Span<import("@openai/agents").GenerationSpanData>;
122
+ createCustomSpan(options: import("@openai/agents-core/types").DeepPartial<import("@openai/agents-core/dist/tracing/provider").CreateSpanOptions<import("@openai/agents").CustomSpanData>> & {
123
+ data: {
124
+ name: string;
125
+ };
126
+ }, parent?: import("@openai/agents").Trace | import("@openai/agents").Span<any> | undefined): import("@openai/agents").Span<import("@openai/agents").CustomSpanData>;
127
+ createGuardrailSpan(options: import("@openai/agents-core/types").DeepPartial<import("@openai/agents-core/dist/tracing/provider").CreateSpanOptions<import("@openai/agents").GuardrailSpanData>> & {
128
+ data: {
129
+ name: string;
130
+ };
131
+ }, parent?: import("@openai/agents").Trace | import("@openai/agents").Span<any> | undefined): import("@openai/agents").Span<import("@openai/agents").GuardrailSpanData>;
132
+ createTranscriptionSpan(options: import("@openai/agents-core/types").DeepPartial<import("@openai/agents-core/dist/tracing/provider").CreateSpanOptions<import("@openai/agents").TranscriptionSpanData>> & {
133
+ data: {
134
+ input: {
135
+ data: string;
136
+ format: (string & {}) | "pcm";
137
+ };
138
+ };
139
+ }, parent?: import("@openai/agents").Trace | import("@openai/agents").Span<any> | undefined): import("@openai/agents").Span<import("@openai/agents").TranscriptionSpanData>;
140
+ createSpeechSpan(options: import("@openai/agents-core/types").DeepPartial<import("@openai/agents-core/dist/tracing/provider").CreateSpanOptions<import("@openai/agents").SpeechSpanData>> & {
141
+ data: {
142
+ output: {
143
+ data: string;
144
+ format: (string & {}) | "pcm";
145
+ };
146
+ };
147
+ }, parent?: import("@openai/agents").Trace | import("@openai/agents").Span<any> | undefined): import("@openai/agents").Span<import("@openai/agents").SpeechSpanData>;
148
+ createSpeechGroupSpan(options?: import("@openai/agents-core/types").DeepPartial<import("@openai/agents-core/dist/tracing/provider").CreateSpanOptions<import("@openai/agents").SpeechGroupSpanData>> | undefined, parent?: import("@openai/agents").Trace | import("@openai/agents").Span<any> | undefined): import("@openai/agents").Span<import("@openai/agents").SpeechGroupSpanData>;
149
+ createMCPListToolsSpan(options?: import("@openai/agents-core/types").DeepPartial<import("@openai/agents-core/dist/tracing/provider").CreateSpanOptions<import("@openai/agents").MCPListToolsSpanData>> | undefined, parent?: import("@openai/agents").Trace | import("@openai/agents").Span<any> | undefined): import("@openai/agents").Span<import("@openai/agents").MCPListToolsSpanData>;
150
+ withResponseSpan: <TOutput>(fn: (span: import("@openai/agents").Span<import("@openai/agents").ResponseSpanData>) => Promise<TOutput>, options?: import("@openai/agents-core/types").DeepPartial<import("@openai/agents-core/dist/tracing/provider").CreateSpanOptions<import("@openai/agents").ResponseSpanData>> | undefined, parent?: import("@openai/agents").Trace | import("@openai/agents").Span<any> | undefined) => Promise<TOutput>;
151
+ withAgentSpan: <TOutput_1>(fn: (span: import("@openai/agents").Span<import("@openai/agents").AgentSpanData>) => Promise<TOutput_1>, options?: import("@openai/agents-core/types").DeepPartial<import("@openai/agents-core/dist/tracing/provider").CreateSpanOptions<import("@openai/agents").AgentSpanData>> | undefined, parent?: import("@openai/agents").Trace | import("@openai/agents").Span<any> | undefined) => Promise<TOutput_1>;
152
+ withFunctionSpan: <TOutput_2>(fn: (span: import("@openai/agents").Span<import("@openai/agents").FunctionSpanData>) => Promise<TOutput_2>, options: import("@openai/agents-core/types").DeepPartial<import("@openai/agents-core/dist/tracing/provider").CreateSpanOptions<import("@openai/agents").FunctionSpanData>> & {
153
+ data: {
154
+ name: string;
155
+ };
156
+ }, parent?: import("@openai/agents").Trace | import("@openai/agents").Span<any> | undefined) => Promise<TOutput_2>;
157
+ withHandoffSpan: <TOutput_3>(fn: (span: import("@openai/agents").Span<import("@openai/agents").HandoffSpanData>) => Promise<TOutput_3>, options?: import("@openai/agents-core/types").DeepPartial<import("@openai/agents-core/dist/tracing/provider").CreateSpanOptions<import("@openai/agents").HandoffSpanData>> | undefined, parent?: import("@openai/agents").Trace | import("@openai/agents").Span<any> | undefined) => Promise<TOutput_3>;
158
+ withGenerationSpan: <TOutput_4>(fn: (span: import("@openai/agents").Span<import("@openai/agents").GenerationSpanData>) => Promise<TOutput_4>, options?: import("@openai/agents-core/types").DeepPartial<import("@openai/agents-core/dist/tracing/provider").CreateSpanOptions<import("@openai/agents").GenerationSpanData>> | undefined, parent?: import("@openai/agents").Trace | import("@openai/agents").Span<any> | undefined) => Promise<TOutput_4>;
159
+ withCustomSpan: <TOutput_5>(fn: (span: import("@openai/agents").Span<import("@openai/agents").CustomSpanData>) => Promise<TOutput_5>, options: import("@openai/agents-core/types").DeepPartial<import("@openai/agents-core/dist/tracing/provider").CreateSpanOptions<import("@openai/agents").CustomSpanData>> & {
160
+ data: {
161
+ name: string;
162
+ };
163
+ }, parent?: import("@openai/agents").Trace | import("@openai/agents").Span<any> | undefined) => Promise<TOutput_5>;
164
+ withGuardrailSpan: <TOutput_6>(fn: (span: import("@openai/agents").Span<import("@openai/agents").GuardrailSpanData>) => Promise<TOutput_6>, options: import("@openai/agents-core/types").DeepPartial<import("@openai/agents-core/dist/tracing/provider").CreateSpanOptions<import("@openai/agents").GuardrailSpanData>> & {
165
+ data: {
166
+ name: string;
167
+ };
168
+ }, parent?: import("@openai/agents").Trace | import("@openai/agents").Span<any> | undefined) => Promise<TOutput_6>;
169
+ withTranscriptionSpan: <TOutput_7>(fn: (span: import("@openai/agents").Span<import("@openai/agents").TranscriptionSpanData>) => Promise<TOutput_7>, options: import("@openai/agents-core/types").DeepPartial<import("@openai/agents-core/dist/tracing/provider").CreateSpanOptions<import("@openai/agents").TranscriptionSpanData>> & {
170
+ data: {
171
+ input: {
172
+ data: string;
173
+ format: (string & {}) | "pcm";
174
+ };
175
+ };
176
+ }, parent?: import("@openai/agents").Trace | import("@openai/agents").Span<any> | undefined) => Promise<TOutput_7>;
177
+ withSpeechSpan: <TOutput_8>(fn: (span: import("@openai/agents").Span<import("@openai/agents").SpeechSpanData>) => Promise<TOutput_8>, options: import("@openai/agents-core/types").DeepPartial<import("@openai/agents-core/dist/tracing/provider").CreateSpanOptions<import("@openai/agents").SpeechSpanData>> & {
178
+ data: {
179
+ output: {
180
+ data: string;
181
+ format: (string & {}) | "pcm";
182
+ };
183
+ };
184
+ }, parent?: import("@openai/agents").Trace | import("@openai/agents").Span<any> | undefined) => Promise<TOutput_8>;
185
+ withSpeechGroupSpan: <TOutput_9>(fn: (span: import("@openai/agents").Span<import("@openai/agents").SpeechGroupSpanData>) => Promise<TOutput_9>, options?: import("@openai/agents-core/types").DeepPartial<import("@openai/agents-core/dist/tracing/provider").CreateSpanOptions<import("@openai/agents").SpeechGroupSpanData>> | undefined, parent?: import("@openai/agents").Trace | import("@openai/agents").Span<any> | undefined) => Promise<TOutput_9>;
186
+ withMCPListToolsSpan: <TOutput_10>(fn: (span: import("@openai/agents").Span<import("@openai/agents").MCPListToolsSpanData>) => Promise<TOutput_10>, options?: import("@openai/agents-core/types").DeepPartial<import("@openai/agents-core/dist/tracing/provider").CreateSpanOptions<import("@openai/agents").MCPListToolsSpanData>> | undefined, parent?: import("@openai/agents").Trace | import("@openai/agents").Span<any> | undefined) => Promise<TOutput_10>;
187
+ OpenAIProvider: typeof import("@openai/agents").OpenAIProvider;
188
+ OpenAIResponsesModel: typeof import("@openai/agents").OpenAIResponsesModel;
189
+ OpenAIChatCompletionsModel: typeof import("@openai/agents").OpenAIChatCompletionsModel;
190
+ setDefaultOpenAIClient: typeof import("@openai/agents").setDefaultOpenAIClient;
191
+ setOpenAIAPI: typeof import("@openai/agents").setOpenAIAPI;
192
+ setDefaultOpenAIKey: typeof import("@openai/agents").setDefaultOpenAIKey;
193
+ setTracingExportApiKey: typeof import("@openai/agents").setTracingExportApiKey;
194
+ setDefaultOpenAITracingExporter: typeof import("@openai/agents").setDefaultOpenAITracingExporter;
195
+ OpenAITracingExporter: typeof import("@openai/agents").OpenAITracingExporter;
196
+ webSearchTool: typeof import("@openai/agents").webSearchTool;
197
+ fileSearchTool: typeof import("@openai/agents").fileSearchTool;
198
+ codeInterpreterTool: typeof import("@openai/agents").codeInterpreterTool;
199
+ imageGenerationTool: typeof import("@openai/agents").imageGenerationTool;
200
+ OpenAIConversationsSession: typeof import("@openai/agents").OpenAIConversationsSession;
201
+ startOpenAIConversationsSession: typeof import("@openai/agents").startOpenAIConversationsSession;
202
+ OpenAIResponsesCompactionSession: typeof import("@openai/agents").OpenAIResponsesCompactionSession;
203
+ }>;
@@ -1,4 +1,4 @@
1
- import OpenAI from 'openai';
1
+ import type OpenAI from 'openai';
2
2
  /**
3
3
  * Uploads files to OpenAI and returns their IDs
4
4
  *
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Creates a loader which imports one module on the first call and reuses the very same module afterwards
3
+ *
4
+ * Note: [🐌] Heavy third-party dependencies are imported lazily to keep the startup of the Promptbook CLI fast.
5
+ * A statically imported dependency is loaded every single time the bundle is loaded, even when the running
6
+ * command never touches it. A lazily imported dependency is loaded only when the feature is really used.
7
+ *
8
+ * @example
9
+ * const loadJsdomModule = createLazyModuleLoader(() => import('jsdom'));
10
+ * const { JSDOM } = await loadJsdomModule();
11
+ *
12
+ * @private internal utility of Promptbook
13
+ */
14
+ export declare function createLazyModuleLoader<TModule>(importModule: () => Promise<TModule>): () => Promise<TModule>;
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
15
15
  export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
16
16
  /**
17
17
  * Represents the version string of the Promptbook engine.
18
- * It follows semantic versioning (e.g., `0.113.1-0`).
18
+ * It follows semantic versioning (e.g., `0.114.0-2`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/cli",
3
- "version": "0.114.0-1",
3
+ "version": "0.114.0-3",
4
4
  "description": "Promptbook: Create persistent AI agents that turn your company's scattered knowledge into action",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -98,9 +98,7 @@ export type BookLanguageManualDictionary = {
98
98
  readonly metadataLabels: {
99
99
  readonly bookLanguageVersion: string;
100
100
  readonly generatedAt: string;
101
- readonly commitmentGroups: string;
102
- readonly implementedCommitments: string;
103
- readonly placeholderCommitments: string;
101
+ readonly commitmentCount: string;
104
102
  };
105
103
 
106
104
  /**
@@ -144,7 +142,6 @@ export type BookLanguageManualDictionary = {
144
142
  readonly primitivesSections: {
145
143
  readonly coreSyntax: BookLanguageManualChapter;
146
144
  readonly references: BookLanguageManualChapter;
147
- readonly keywordsTitle: string;
148
145
  };
149
146
 
150
147
  /**
@@ -159,18 +156,7 @@ export type BookLanguageManualDictionary = {
159
156
  * Labels used in every commitment catalog entry.
160
157
  */
161
158
  readonly commitmentLabels: {
162
- readonly status: string;
163
159
  readonly aliases: string;
164
- readonly semantics: string;
165
- readonly typeSchema: string;
166
- readonly blockSchema: string;
167
- readonly lowLevelNotice: string;
168
- readonly usage: string;
169
- readonly usageOccurrence: string;
170
- readonly usageOccurrences: string;
171
- readonly statusImplemented: string;
172
- readonly statusPlaceholder: string;
173
- readonly noAliases: string;
174
160
  };
175
161
 
176
162
  /**
@@ -60,13 +60,12 @@ export const bookLanguageDocumentationExamples: ReadonlyArray<BookLanguageDocume
60
60
  `),
61
61
  },
62
62
  {
63
- id: 'use-project-and-wallet-integration-agent',
63
+ id: 'use-project-integration-agent',
64
64
  source: spaceTrim(`
65
65
  Repository Maintainer
66
66
 
67
67
  GOAL Maintain a GitHub repository and prepare safe pull requests.
68
68
  USE PROJECT https://github.com/acme/website
69
- WALLET Store credentials for repository operations.
70
69
  RULE Before editing files, explain the planned change and impacted paths.
71
70
  RULE Never reveal raw credentials in chat output.
72
71
  INITIAL MESSAGE I can inspect the repository and help you prepare PR-ready changes.
@@ -1,5 +1,4 @@
1
1
  import { spaceTrim } from 'spacetrim';
2
- import { NotYetImplementedCommitmentDefinition } from '../../commitments/_base/NotYetImplementedCommitmentDefinition';
3
2
  import { getGroupedCommitmentDefinitions } from '../../commitments/_common/getGroupedCommitmentDefinitions';
4
3
  import { parseAgentSourceWithCommitments } from '../agent-source/parseAgentSourceWithCommitments';
5
4
  import type { string_book } from '../agent-source/string_book';
@@ -172,14 +171,10 @@ export function createStandaloneBookLanguageMarkdown(
172
171
  : [];
173
172
  const manualCommitments = [...catalogCommitments, ...lowLevelCommitments];
174
173
  const generatedAtIso = new Date().toISOString();
175
- const placeholderCommitmentCount = manualCommitments.filter(
176
- ({ primary }) => primary instanceof NotYetImplementedCommitmentDefinition,
177
- ).length;
178
174
  const catalogTitleSuffix = isServerSpecificManual
179
175
  ? dictionary.commitmentCatalogTitleSuffixes.usedFirst
180
176
  : dictionary.commitmentCatalogTitleSuffixes.all;
181
-
182
- const allCommitmentKeywords = manualCommitments.flatMap(({ primary, aliases }) => [primary.type, ...aliases]);
177
+ const commitmentSectionAnchorByType = createCommitmentSectionAnchorByType(manualCommitments);
183
178
 
184
179
  return spaceTrim(
185
180
  // [✨]
@@ -190,11 +185,7 @@ export function createStandaloneBookLanguageMarkdown(
190
185
 
191
186
  - ${dictionary.metadataLabels.bookLanguageVersion}: \`${BOOK_LANGUAGE_VERSION}\`
192
187
  - ${dictionary.metadataLabels.generatedAt}: \`${generatedAtIso}\`
193
- - ${dictionary.metadataLabels.commitmentGroups}: \`${manualCommitments.length}\`
194
- - ${dictionary.metadataLabels.implementedCommitments}: \`${
195
- manualCommitments.length - placeholderCommitmentCount
196
- }\`
197
- - ${dictionary.metadataLabels.placeholderCommitments}: \`${placeholderCommitmentCount}\`
188
+ - ${dictionary.metadataLabels.commitmentCount}: \`${manualCommitments.length}\`
198
189
 
199
190
  ## <a id="table-of-contents"></a>${dictionary.tableOfContentsTitle}
200
191
 
@@ -203,14 +194,18 @@ export function createStandaloneBookLanguageMarkdown(
203
194
  - [${dictionary.chapters.howToStructure.title}](#how-to-structure-good-agents)
204
195
  - [${dictionary.chapters.primitives.title}](#primitives-and-constructs-reference)
205
196
  - [${dictionary.chapters.commitmentCatalog.title}${catalogTitleSuffix}](#commitment-catalog)
197
+ ${block(renderCommitmentCatalogTableOfContents(catalogCommitments))}
206
198
  - [${dictionary.chapters.examples.title}](#end-to-end-examples)
207
199
  - [${dictionary.chapters.pitfalls.title}](#do-nots-and-common-pitfalls)
208
200
  - [${dictionary.chapters.tutorial.title}](#build-an-agent-from-scratch-offline-tutorial)
209
- ${
201
+ ${block(
210
202
  isLowLevelCommitmentsIncluded
211
- ? `- [${dictionary.chapters.lowLevelCommitments.title}](#low-level-commitments)`
212
- : ''
213
- }
203
+ ? spaceTrim(`
204
+ - [${dictionary.chapters.lowLevelCommitments.title}](#low-level-commitments)
205
+ ${renderCommitmentCatalogTableOfContents(lowLevelCommitments)}
206
+ `)
207
+ : '',
208
+ )}
214
209
 
215
210
  ## <a id="what-book-language-is"></a>${dictionary.chapters.whatIs.title}
216
211
 
@@ -254,25 +249,23 @@ export function createStandaloneBookLanguageMarkdown(
254
249
 
255
250
  ${block(dictionary.primitivesSections.references.body)}
256
251
 
257
- ### ${dictionary.primitivesSections.keywordsTitle}
258
-
259
- ${block(getSafeCodeBlock(allCommitmentKeywords.join(', '), 'text'))}
260
-
261
- <a id="commitment-catalog-all-commitments"></a>
262
-
263
252
  ## <a id="commitment-catalog"></a>${dictionary.chapters.commitmentCatalog.title}${catalogTitleSuffix}
264
253
 
265
254
  ${block(dictionary.chapters.commitmentCatalog.body)}
266
255
 
267
- ${block(renderCommitmentCatalogSections(catalogCommitments, commitmentUsageByType, dictionary))}
256
+ ${block(renderCommitmentCatalogSections(catalogCommitments, dictionary))}
268
257
 
269
258
  ## <a id="end-to-end-examples"></a>${dictionary.chapters.examples.title}
270
259
 
271
260
  ${block(
272
261
  isServerSpecificManual
273
- ? selectedAgents.map((agent) => renderBakedAgentExampleSection(agent, dictionary)).join('\n\n')
262
+ ? selectedAgents
263
+ .map((agent) =>
264
+ renderBakedAgentExampleSection(agent, dictionary, commitmentSectionAnchorByType),
265
+ )
266
+ .join('\n\n')
274
267
  : bookLanguageDocumentationExamples
275
- .map((example) => renderExampleSection(example, dictionary))
268
+ .map((example) => renderExampleSection(example, dictionary, commitmentSectionAnchorByType))
276
269
  .join('\n\n'),
277
270
  )}
278
271
 
@@ -296,7 +289,7 @@ export function createStandaloneBookLanguageMarkdown(
296
289
 
297
290
  ${block(
298
291
  isLowLevelCommitmentsIncluded
299
- ? renderLowLevelCommitmentsChapter(lowLevelCommitments, commitmentUsageByType, dictionary)
292
+ ? renderLowLevelCommitmentsChapter(lowLevelCommitments, dictionary)
300
293
  : '',
301
294
  )}
302
295
 
@@ -345,7 +338,6 @@ function renderDetectedCommitmentList(
345
338
  * Renders every commitment section of one catalog chapter.
346
339
  *
347
340
  * @param commitmentGroups - Commitment groups to render, in final order.
348
- * @param commitmentUsageByType - Selected-agent occurrence counts by primary type.
349
341
  * @param dictionary - Translated labels of the manual.
350
342
  * @returns Markdown sections joined by blank lines.
351
343
  *
@@ -353,14 +345,12 @@ function renderDetectedCommitmentList(
353
345
  */
354
346
  function renderCommitmentCatalogSections(
355
347
  commitmentGroups: ReadonlyArray<BookLanguageManualCommitmentGroup>,
356
- commitmentUsageByType: ReadonlyMap<string, number>,
357
348
  dictionary: BookLanguageManualDictionary,
358
349
  ): string {
359
350
  return commitmentGroups
360
351
  .map((groupedCommitment) =>
361
352
  renderCommitmentCatalogSection({
362
353
  groupedCommitment,
363
- usageCount: commitmentUsageByType.get(groupedCommitment.primary.type) || 0,
364
354
  dictionary,
365
355
  }),
366
356
  )
@@ -371,7 +361,6 @@ function renderCommitmentCatalogSections(
371
361
  * Renders the closing chapter documenting low-level commitments.
372
362
  *
373
363
  * @param commitmentGroups - Low-level commitment groups, in final order.
374
- * @param commitmentUsageByType - Selected-agent occurrence counts by primary type.
375
364
  * @param dictionary - Translated labels of the manual.
376
365
  * @returns Markdown chapter for low-level commitments.
377
366
  *
@@ -379,7 +368,6 @@ function renderCommitmentCatalogSections(
379
368
  */
380
369
  function renderLowLevelCommitmentsChapter(
381
370
  commitmentGroups: ReadonlyArray<BookLanguageManualCommitmentGroup>,
382
- commitmentUsageByType: ReadonlyMap<string, number>,
383
371
  dictionary: BookLanguageManualDictionary,
384
372
  ): string {
385
373
  return spaceTrim(
@@ -388,11 +376,55 @@ function renderLowLevelCommitmentsChapter(
388
376
 
389
377
  ${block(dictionary.chapters.lowLevelCommitments.body)}
390
378
 
391
- ${block(renderCommitmentCatalogSections(commitmentGroups, commitmentUsageByType, dictionary))}
379
+ ${block(renderCommitmentCatalogSections(commitmentGroups, dictionary))}
392
380
  `,
393
381
  );
394
382
  }
395
383
 
384
+ /**
385
+ * Renders links from the manual table of contents to the commitment sections.
386
+ *
387
+ * @param commitmentGroups - Commitment sections included in the manual.
388
+ * @returns Indented markdown links ordered like the catalog.
389
+ *
390
+ * @private internal utility of `createStandaloneBookLanguageMarkdown`
391
+ */
392
+ function renderCommitmentCatalogTableOfContents(
393
+ commitmentGroups: ReadonlyArray<BookLanguageManualCommitmentGroup>,
394
+ ): string {
395
+ return commitmentGroups
396
+ .map(
397
+ ({ primary }) =>
398
+ ` - [${primary.icon} \`${primary.type}\`](#commitment-${toStableAnchorId(primary.type)})`,
399
+ )
400
+ .join('\n');
401
+ }
402
+
403
+ /**
404
+ * Maps every recognized spelling of a documented commitment to its stable section anchor.
405
+ *
406
+ * @param commitmentGroups - Commitment sections included in the manual.
407
+ * @returns Canonical anchor id by parsed commitment type.
408
+ *
409
+ * @private internal utility of `createStandaloneBookLanguageMarkdown`
410
+ */
411
+ function createCommitmentSectionAnchorByType(
412
+ commitmentGroups: ReadonlyArray<BookLanguageManualCommitmentGroup>,
413
+ ): ReadonlyMap<string, string> {
414
+ const anchorByType = new Map<string, string>();
415
+
416
+ for (const { primary, aliases } of commitmentGroups) {
417
+ const anchorId = `commitment-${toStableAnchorId(primary.type)}`;
418
+ anchorByType.set(primary.type, anchorId);
419
+
420
+ for (const alias of aliases) {
421
+ anchorByType.set(alias, anchorId);
422
+ }
423
+ }
424
+
425
+ return anchorByType;
426
+ }
427
+
396
428
  /**
397
429
  * Renders the "don't vs do" list of common authoring pitfalls.
398
430
  *
@@ -523,11 +555,12 @@ function prioritizeGroupedCommitments(
523
555
  function renderBakedAgentExampleSection(
524
556
  agent: BookLanguageDocumentationAgent,
525
557
  dictionary: BookLanguageManualDictionary,
558
+ commitmentSectionAnchorByType: ReadonlyMap<string, string>,
526
559
  ): string {
527
560
  const usedCommitmentTypes = Array.from(
528
561
  new Set(parseAgentSourceWithCommitments(agent.agentSource).commitments.map((commitment) => commitment.type)),
529
562
  );
530
- const usedCommitmentsMarkdown = usedCommitmentTypes.map((type) => `\`${type}\``).join(', ');
563
+ const usedCommitmentsMarkdown = renderCommitmentSectionLinks(usedCommitmentTypes, commitmentSectionAnchorByType);
531
564
 
532
565
  return spaceTrim(
533
566
  (block) => `
@@ -556,6 +589,7 @@ function renderBakedAgentExampleSection(
556
589
  function renderExampleSection(
557
590
  example: BookLanguageDocumentationExample,
558
591
  dictionary: BookLanguageManualDictionary,
592
+ commitmentSectionAnchorByType: ReadonlyMap<string, string>,
559
593
  ): string {
560
594
  const exampleText = dictionary.exampleTexts[example.id];
561
595
 
@@ -569,6 +603,11 @@ function renderExampleSection(
569
603
 
570
604
  **${dictionary.exampleLabels.goal}:** ${exampleText.goal}
571
605
 
606
+ **${dictionary.exampleLabels.commitmentsUsed}:** ${renderCommitmentSectionLinks(
607
+ parseAgentSourceWithCommitments(example.source as string_book).commitments.map((commitment) => commitment.type),
608
+ commitmentSectionAnchorByType,
609
+ )}
610
+
572
611
  **${dictionary.exampleLabels.fullSource}**
573
612
 
574
613
  ${block(getSafeCodeBlock(example.source, 'book'))}
@@ -579,3 +618,24 @@ function renderExampleSection(
579
618
  `,
580
619
  );
581
620
  }
621
+
622
+ /**
623
+ * Renders unique commitment links used by an end-to-end example.
624
+ *
625
+ * @param commitmentTypes - Commitment types in their source order.
626
+ * @param commitmentSectionAnchorByType - Documented commitment anchors by parsed type.
627
+ * @returns Comma-separated markdown links, or an empty string when none are documented.
628
+ *
629
+ * @private internal utility of `createStandaloneBookLanguageMarkdown`
630
+ */
631
+ function renderCommitmentSectionLinks(
632
+ commitmentTypes: ReadonlyArray<string>,
633
+ commitmentSectionAnchorByType: ReadonlyMap<string, string>,
634
+ ): string {
635
+ return Array.from(new Set(commitmentTypes))
636
+ .flatMap((type) => {
637
+ const anchorId = commitmentSectionAnchorByType.get(type);
638
+ return anchorId ? [`[\`${type}\`](#${anchorId})`] : [];
639
+ })
640
+ .join(', ');
641
+ }