@promptbook/markdown-utils 0.112.0-36 → 0.112.0-39

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 (122) hide show
  1. package/README.md +10 -6
  2. package/esm/index.es.js +1 -1
  3. package/esm/src/_packages/components.index.d.ts +2 -0
  4. package/esm/src/_packages/types.index.d.ts +48 -46
  5. package/esm/src/book-components/Chat/Chat/ChatActionsBar.d.ts +7 -0
  6. package/esm/src/book-components/Chat/Chat/ChatActionsBar.test.d.ts +2 -0
  7. package/esm/src/book-components/Chat/Chat/ChatInputArea.d.ts +4 -0
  8. package/esm/src/book-components/Chat/Chat/ChatMessageItem.d.ts +8 -0
  9. package/esm/src/book-components/Chat/Chat/ChatMessageList.d.ts +2 -0
  10. package/esm/src/book-components/Chat/Chat/ChatProps.d.ts +50 -1
  11. package/esm/src/book-components/Chat/Chat/ChatReplyPreview.d.ts +19 -0
  12. package/esm/src/book-components/Chat/Chat/createProgressCardChecklistMarkdown.d.ts +2 -2
  13. package/esm/src/book-components/Chat/MockedChat/MockedChat.d.ts +1 -1
  14. package/esm/src/book-components/Chat/types/ChatMessage.d.ts +35 -0
  15. package/esm/src/book-components/Chat/utils/resolveChatMessageReplyPreviewText.d.ts +25 -0
  16. package/esm/src/book-components/Chat/utils/resolveChatMessageReplySenderLabel.d.ts +12 -0
  17. package/esm/src/cli/cli-commands/coder/agentCodingFile.d.ts +14 -0
  18. package/esm/src/cli/cli-commands/coder/agentsFile.d.ts +12 -0
  19. package/esm/src/cli/cli-commands/coder/appendBlock.d.ts +6 -0
  20. package/esm/src/cli/cli-commands/coder/boilerplateTemplates.d.ts +10 -0
  21. package/esm/src/cli/cli-commands/coder/ensureCoderEnvFile.d.ts +15 -0
  22. package/esm/src/cli/cli-commands/coder/ensureCoderGitignoreFile.d.ts +7 -0
  23. package/esm/src/cli/cli-commands/coder/ensureCoderMarkdownFile.d.ts +7 -0
  24. package/esm/src/cli/cli-commands/coder/ensureCoderPackageJsonFile.d.ts +7 -0
  25. package/esm/src/cli/cli-commands/coder/ensureCoderVscodeSettingsFile.d.ts +7 -0
  26. package/esm/src/cli/cli-commands/coder/ensureDirectory.d.ts +7 -0
  27. package/esm/src/cli/cli-commands/coder/find-refactor-candidates.d.ts +1 -1
  28. package/esm/src/cli/cli-commands/coder/find-refactor-candidates.test.d.ts +1 -0
  29. package/esm/src/cli/cli-commands/coder/formatDisplayPath.d.ts +6 -0
  30. package/esm/src/cli/cli-commands/coder/getDefaultCoderPackageJsonScripts.d.ts +6 -0
  31. package/esm/src/cli/cli-commands/coder/getDefaultCoderVscodeSettings.d.ts +6 -0
  32. package/esm/src/cli/cli-commands/coder/init.d.ts +3 -38
  33. package/esm/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.d.ts +25 -0
  34. package/esm/src/cli/cli-commands/coder/mergeStringRecordJsonFile.d.ts +18 -0
  35. package/esm/src/cli/cli-commands/coder/printInitializationSummary.d.ts +7 -0
  36. package/esm/src/cli/cli-commands/coder/readTextFileIfExists.d.ts +6 -0
  37. package/esm/src/types/string_agent_url.d.ts +7 -0
  38. package/esm/src/types/string_agent_url_private.d.ts +9 -0
  39. package/esm/src/types/string_base64.d.ts +13 -0
  40. package/esm/src/types/string_base64_private.d.ts +2 -2
  41. package/esm/src/types/string_base_url.d.ts +7 -0
  42. package/esm/src/types/string_base_url_private.d.ts +9 -0
  43. package/esm/src/types/string_email.d.ts +13 -0
  44. package/esm/src/types/string_email_private.d.ts +2 -2
  45. package/esm/src/types/string_host.d.ts +42 -0
  46. package/esm/src/types/string_host_private.d.ts +7 -7
  47. package/esm/src/types/string_href.d.ts +19 -0
  48. package/esm/src/types/string_href_private.d.ts +24 -0
  49. package/esm/src/types/string_mime_type.d.ts +15 -0
  50. package/esm/src/types/string_mime_type_private.d.ts +2 -2
  51. package/esm/src/types/string_pipeline_root_url.d.ts +7 -0
  52. package/esm/src/types/string_pipeline_root_url_private.d.ts +9 -0
  53. package/esm/src/types/string_pipeline_url.d.ts +13 -0
  54. package/esm/src/types/string_pipeline_url_private.d.ts +17 -0
  55. package/esm/src/types/string_promptbook_server_url.d.ts +7 -0
  56. package/esm/src/types/string_promptbook_server_url_private.d.ts +9 -0
  57. package/esm/src/types/string_url.d.ts +14 -141
  58. package/esm/src/types/string_url_image.d.ts +7 -0
  59. package/esm/src/types/string_url_image_private.d.ts +9 -0
  60. package/esm/src/types/string_url_private.d.ts +0 -80
  61. package/esm/src/version.d.ts +1 -1
  62. package/package.json +1 -1
  63. package/umd/index.umd.js +1 -1
  64. package/umd/src/_packages/components.index.d.ts +2 -0
  65. package/umd/src/_packages/types.index.d.ts +48 -46
  66. package/umd/src/book-components/Chat/Chat/ChatActionsBar.d.ts +7 -0
  67. package/umd/src/book-components/Chat/Chat/ChatActionsBar.test.d.ts +2 -0
  68. package/umd/src/book-components/Chat/Chat/ChatInputArea.d.ts +4 -0
  69. package/umd/src/book-components/Chat/Chat/ChatMessageItem.d.ts +8 -0
  70. package/umd/src/book-components/Chat/Chat/ChatMessageList.d.ts +2 -0
  71. package/umd/src/book-components/Chat/Chat/ChatProps.d.ts +50 -1
  72. package/umd/src/book-components/Chat/Chat/ChatReplyPreview.d.ts +19 -0
  73. package/umd/src/book-components/Chat/Chat/createProgressCardChecklistMarkdown.d.ts +2 -2
  74. package/umd/src/book-components/Chat/MockedChat/MockedChat.d.ts +1 -1
  75. package/umd/src/book-components/Chat/types/ChatMessage.d.ts +35 -0
  76. package/umd/src/book-components/Chat/utils/resolveChatMessageReplyPreviewText.d.ts +25 -0
  77. package/umd/src/book-components/Chat/utils/resolveChatMessageReplySenderLabel.d.ts +12 -0
  78. package/umd/src/cli/cli-commands/coder/agentCodingFile.d.ts +14 -0
  79. package/umd/src/cli/cli-commands/coder/agentsFile.d.ts +12 -0
  80. package/umd/src/cli/cli-commands/coder/appendBlock.d.ts +6 -0
  81. package/umd/src/cli/cli-commands/coder/boilerplateTemplates.d.ts +10 -0
  82. package/umd/src/cli/cli-commands/coder/ensureCoderEnvFile.d.ts +15 -0
  83. package/umd/src/cli/cli-commands/coder/ensureCoderGitignoreFile.d.ts +7 -0
  84. package/umd/src/cli/cli-commands/coder/ensureCoderMarkdownFile.d.ts +7 -0
  85. package/umd/src/cli/cli-commands/coder/ensureCoderPackageJsonFile.d.ts +7 -0
  86. package/umd/src/cli/cli-commands/coder/ensureCoderVscodeSettingsFile.d.ts +7 -0
  87. package/umd/src/cli/cli-commands/coder/ensureDirectory.d.ts +7 -0
  88. package/umd/src/cli/cli-commands/coder/find-refactor-candidates.d.ts +1 -1
  89. package/umd/src/cli/cli-commands/coder/find-refactor-candidates.test.d.ts +1 -0
  90. package/umd/src/cli/cli-commands/coder/formatDisplayPath.d.ts +6 -0
  91. package/umd/src/cli/cli-commands/coder/getDefaultCoderPackageJsonScripts.d.ts +6 -0
  92. package/umd/src/cli/cli-commands/coder/getDefaultCoderVscodeSettings.d.ts +6 -0
  93. package/umd/src/cli/cli-commands/coder/init.d.ts +3 -38
  94. package/umd/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.d.ts +25 -0
  95. package/umd/src/cli/cli-commands/coder/mergeStringRecordJsonFile.d.ts +18 -0
  96. package/umd/src/cli/cli-commands/coder/printInitializationSummary.d.ts +7 -0
  97. package/umd/src/cli/cli-commands/coder/readTextFileIfExists.d.ts +6 -0
  98. package/umd/src/types/string_agent_url.d.ts +7 -0
  99. package/umd/src/types/string_agent_url_private.d.ts +9 -0
  100. package/umd/src/types/string_base64.d.ts +13 -0
  101. package/umd/src/types/string_base64_private.d.ts +2 -2
  102. package/umd/src/types/string_base_url.d.ts +7 -0
  103. package/umd/src/types/string_base_url_private.d.ts +9 -0
  104. package/umd/src/types/string_email.d.ts +13 -0
  105. package/umd/src/types/string_email_private.d.ts +2 -2
  106. package/umd/src/types/string_host.d.ts +42 -0
  107. package/umd/src/types/string_host_private.d.ts +7 -7
  108. package/umd/src/types/string_href.d.ts +19 -0
  109. package/umd/src/types/string_href_private.d.ts +24 -0
  110. package/umd/src/types/string_mime_type.d.ts +15 -0
  111. package/umd/src/types/string_mime_type_private.d.ts +2 -2
  112. package/umd/src/types/string_pipeline_root_url.d.ts +7 -0
  113. package/umd/src/types/string_pipeline_root_url_private.d.ts +9 -0
  114. package/umd/src/types/string_pipeline_url.d.ts +13 -0
  115. package/umd/src/types/string_pipeline_url_private.d.ts +17 -0
  116. package/umd/src/types/string_promptbook_server_url.d.ts +7 -0
  117. package/umd/src/types/string_promptbook_server_url_private.d.ts +9 -0
  118. package/umd/src/types/string_url.d.ts +14 -141
  119. package/umd/src/types/string_url_image.d.ts +7 -0
  120. package/umd/src/types/string_url_image_private.d.ts +9 -0
  121. package/umd/src/types/string_url_private.d.ts +0 -80
  122. package/umd/src/version.d.ts +1 -1
package/README.md CHANGED
@@ -492,7 +492,7 @@ In short: tools like Claude Code, Codex, or GitHub Copilot are the **engines**;
492
492
 
493
493
  #### How the workflow works
494
494
 
495
- 1. `ptbk coder init` prepares the project for the coder workflow, seeds project-owned templates in `prompts/templates/`, adds helper `npm run coder:*` scripts, ensures `.gitignore` ignores `/.tmp`, and configures VS Code prompt screenshots in `prompts/screenshots/`.
495
+ 1. `ptbk coder init` prepares the project for the coder workflow, seeds project-owned generic templates in `prompts/templates/`, creates a starter `AGENTS.md` context file, adds helper `npm run coder:*` scripts, ensures `.gitignore` ignores `/.tmp`, and configures VS Code prompt screenshots in `prompts/screenshots/`.
496
496
  2. `ptbk coder generate-boilerplates` creates prompt files in `prompts/`.
497
497
  3. You replace placeholder `@@@` sections with real coding tasks.
498
498
  4. `ptbk coder run` sends the next ready `[ ]` prompt to the selected coding agent.
@@ -529,6 +529,8 @@ npx ts-node ./src/cli/test/ptbk.ts coder run --agent github-copilot --model gpt-
529
529
 
530
530
  npx ts-node ./src/cli/test/ptbk.ts coder find-refactor-candidates
531
531
 
532
+ npx ts-node ./src/cli/test/ptbk.ts coder find-refactor-candidates --level xhigh
533
+
532
534
  npx ts-node ./src/cli/test/ptbk.ts coder verify
533
535
  ```
534
536
 
@@ -543,7 +545,7 @@ ptbk coder init
543
545
 
544
546
  npx ptbk coder generate-boilerplates
545
547
 
546
- npx ptbk coder generate-boilerplates --template prompts/templates/agents-server.md
548
+ npx ptbk coder generate-boilerplates --template prompts/templates/common.md
547
549
 
548
550
  npx ptbk coder run --agent github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md
549
551
 
@@ -551,19 +553,21 @@ npx ptbk coder run --agent github-copilot --model gpt-5.4 --thinking-level xhigh
551
553
 
552
554
  npx ptbk coder find-refactor-candidates
553
555
 
556
+ npx ptbk coder find-refactor-candidates --level xhigh
557
+
554
558
  npx ptbk coder verify
555
559
  ```
556
560
 
557
- `ptbk coder init` also bootstraps `package.json` scripts for the four main coder commands, adds the coder temp ignore to `.gitignore`, and configures `.vscode/settings.json` so pasted images from `prompts/*.md` land in `prompts/screenshots/`.
561
+ `ptbk coder init` also bootstraps a starter `AGENTS.md`, adds `package.json` scripts for the four main coder commands, adds the coder temp ignore to `.gitignore`, and configures `.vscode/settings.json` so pasted images from `prompts/*.md` land in `prompts/screenshots/`.
558
562
 
559
563
  #### What each command does
560
564
 
561
565
  | Command | What it does |
562
566
  | --- | --- |
563
- | `ptbk coder init` | Creates `prompts/`, `prompts/done/`, `prompts/templates/common.md`, `prompts/templates/agents-server.md`, ensures `.env` contains `CODING_AGENT_GIT_NAME`, `CODING_AGENT_GIT_EMAIL`, and `CODING_AGENT_GIT_SIGNING_KEY`, adds helper coder scripts to `package.json`, ensures `.gitignore` contains `/.tmp`, and configures `.vscode/settings.json` to save pasted prompt images into `prompts/screenshots/`. |
567
+ | `ptbk coder init` | Creates `prompts/`, `prompts/done/`, the project-generic template files materialized in `prompts/templates/` (currently `common.md`), and a starter `AGENTS.md`; ensures `.env` contains `CODING_AGENT_GIT_NAME`, `CODING_AGENT_GIT_EMAIL`, and `CODING_AGENT_GIT_SIGNING_KEY`; adds helper coder scripts to `package.json`; ensures `.gitignore` contains `/.tmp`; and configures `.vscode/settings.json` to save pasted prompt images into `prompts/screenshots/`. |
564
568
  | `ptbk coder generate-boilerplates` | Creates new prompt markdown files with fresh emoji tags so you can quickly fill in coding tasks; `--template` accepts either a built-in alias or a markdown file path relative to the project root. |
565
569
  | `ptbk coder run` | Picks the next ready prompt, appends optional context, runs it through the selected coding agent, marks success or failure, then commits and pushes the result. |
566
- | `ptbk coder find-refactor-candidates` | Scans the repository for oversized or overpacked files and writes prompt files for likely refactors. |
570
+ | `ptbk coder find-refactor-candidates` | Scans the repository for oversized or overpacked files and writes prompt files for likely refactors; `--level <xlow|low|medium|high|xhigh|extreme>` ranges from a very benevolent scan to a very aggressive sweep. |
567
571
  | `ptbk coder verify` | Walks through completed prompts, archives truly finished work, and adds follow-up repair prompts for unfinished results. |
568
572
 
569
573
  #### Most useful `ptbk coder run` flags
@@ -585,7 +589,7 @@ npx ptbk coder verify
585
589
 
586
590
  1. Initialize once with `ptbk coder init`.
587
591
  2. Customize `prompts/templates/*.md` if needed, then create or write prompt files in `prompts/`.
588
- 3. Put repository-specific instructions in `AGENTS.md`, then pass `--context AGENTS.md`.
592
+ 3. Customize the starter `AGENTS.md` with repository-specific instructions, then pass `--context AGENTS.md`.
589
593
  4. Run one prompt at a time interactively, or use `--no-wait` for unattended batches.
590
594
  5. Finish with `ptbk coder verify` so resolved prompts are archived and broken ones get explicit repair follow-ups.
591
595
 
package/esm/index.es.js CHANGED
@@ -23,7 +23,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
23
23
  * @generated
24
24
  * @see https://github.com/webgptorg/promptbook
25
25
  */
26
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0-36';
26
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-39';
27
27
  /**
28
28
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
29
29
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -61,6 +61,7 @@ import { reactSaveFormatDefinition } from '../book-components/Chat/save/react/re
61
61
  import { txtSaveFormatDefinition } from '../book-components/Chat/save/text/txtSaveFormatDefinition';
62
62
  import type { ChatProgressItem } from '../book-components/Chat/types/ChatMessage';
63
63
  import type { ChatProgressCard } from '../book-components/Chat/types/ChatMessage';
64
+ import type { ChatMessageReplyingTo } from '../book-components/Chat/types/ChatMessage';
64
65
  import type { ChatMessage } from '../book-components/Chat/types/ChatMessage';
65
66
  import type { ChatParticipant } from '../book-components/Chat/types/ChatParticipant';
66
67
  import type { MessageButton } from '../book-components/Chat/utils/parseMessageButtons';
@@ -142,6 +143,7 @@ export { reactSaveFormatDefinition };
142
143
  export { txtSaveFormatDefinition };
143
144
  export type { ChatProgressItem };
144
145
  export type { ChatProgressCard };
146
+ export type { ChatMessageReplyingTo };
145
147
  export type { ChatMessage };
146
148
  export type { ChatParticipant };
147
149
  export type { MessageButton };
@@ -44,6 +44,7 @@ import type { SourceChipProps } from '../book-components/Chat/SourceChip/SourceC
44
44
  import type { ChatToolCall } from '../book-components/Chat/types/ChatMessage';
45
45
  import type { ChatProgressItem } from '../book-components/Chat/types/ChatMessage';
46
46
  import type { ChatProgressCard } from '../book-components/Chat/types/ChatMessage';
47
+ import type { ChatMessageReplyingTo } from '../book-components/Chat/types/ChatMessage';
47
48
  import type { ChatMessage } from '../book-components/Chat/types/ChatMessage';
48
49
  import type { ChatParticipant } from '../book-components/Chat/types/ChatParticipant';
49
50
  import type { ParsedCitation } from '../book-components/Chat/utils/parseCitationsFromContent';
@@ -277,7 +278,13 @@ import type { string_agent_name } from '../types/string_agent_name';
277
278
  import type { string_agent_name_in_book } from '../types/string_agent_name';
278
279
  import type { string_agent_hash } from '../types/string_agent_name';
279
280
  import type { string_agent_permanent_id } from '../types/string_agent_name';
281
+ import type { string_agent_url } from '../types/string_agent_url';
282
+ import type { string_base_url } from '../types/string_base_url';
283
+ import type { string_base64 } from '../types/string_base64';
284
+ import type { string_data_url } from '../types/string_base64';
280
285
  import type { string_business_category_name } from '../types/string_business_category_name';
286
+ import type { string_email } from '../types/string_email';
287
+ import type { string_emails } from '../types/string_email';
281
288
  import type { string_absolute_filename } from '../types/string_filename';
282
289
  import type { string_relative_filename } from '../types/string_filename';
283
290
  import type { string_filename } from '../types/string_filename';
@@ -285,6 +292,16 @@ import type { string_absolute_dirname } from '../types/string_filename';
285
292
  import type { string_relative_dirname } from '../types/string_filename';
286
293
  import type { string_dirname } from '../types/string_filename';
287
294
  import type { string_executable_path } from '../types/string_filename';
295
+ import type { string_domain } from '../types/string_host';
296
+ import type { string_origin } from '../types/string_host';
297
+ import type { string_tdl } from '../types/string_host';
298
+ import type { string_hostname } from '../types/string_host';
299
+ import type { string_host } from '../types/string_host';
300
+ import type { string_protocol } from '../types/string_host';
301
+ import type { string_ip_address } from '../types/string_host';
302
+ import type { string_href } from '../types/string_href';
303
+ import type { string_uri } from '../types/string_href';
304
+ import type { string_uri_part } from '../types/string_href';
288
305
  import type { string_knowledge_source_content } from '../types/string_knowledge_source_content';
289
306
  import type { string_knowledge_source_link } from '../types/string_knowledge_source_content';
290
307
  import type { string_html } from '../types/string_markdown';
@@ -306,6 +323,8 @@ import type { string_css_property } from '../types/string_markdown';
306
323
  import type { string_fonts } from '../types/string_markdown';
307
324
  import type { string_css_value } from '../types/string_markdown';
308
325
  import type { string_css_selector } from '../types/string_markdown';
326
+ import type { string_mime_type } from '../types/string_mime_type';
327
+ import type { string_mime_type_with_wildcard } from '../types/string_mime_type';
309
328
  import type { string_model_name } from '../types/string_model_name';
310
329
  import type { string_name } from '../types/string_name';
311
330
  import type { string_parameter_name } from '../types/string_name';
@@ -329,6 +348,9 @@ import type { string_javascript_name } from '../types/string_person_fullname';
329
348
  import type { string_postprocessing_function_name } from '../types/string_person_fullname';
330
349
  import type { string_persona_description } from '../types/string_persona_description';
331
350
  import type { string_model_description } from '../types/string_persona_description';
351
+ import type { string_pipeline_root_url } from '../types/string_pipeline_root_url';
352
+ import type { string_pipeline_url } from '../types/string_pipeline_url';
353
+ import type { string_pipeline_url_with_task_hash } from '../types/string_pipeline_url';
332
354
  import type { string_prompt } from '../types/string_prompt';
333
355
  import type { string_prompt_image } from '../types/string_prompt';
334
356
  import type { string_template } from '../types/string_prompt';
@@ -336,6 +358,7 @@ import type { string_text_prompt } from '../types/string_prompt';
336
358
  import type { string_chat_prompt } from '../types/string_prompt';
337
359
  import type { string_system_message } from '../types/string_prompt';
338
360
  import type { string_completion_prompt } from '../types/string_prompt';
361
+ import type { string_promptbook_server_url } from '../types/string_promptbook_server_url';
339
362
  import type { string_uuid } from '../types/string_sha256';
340
363
  import type { string_sha256 } from '../types/string_sha256';
341
364
  import type { string_base_58 } from '../types/string_sha256';
@@ -355,30 +378,8 @@ import type { string_language } from '../types/string_token';
355
378
  import type { string_date_iso8601 } from '../types/string_token';
356
379
  import type { string_app_id } from '../types/string_token';
357
380
  import type { string_user_id } from '../types/string_token';
358
- import type { string_mime_type } from '../types/string_url';
359
- import type { string_mime_type_with_wildcard } from '../types/string_url';
360
- import type { string_base64 } from '../types/string_url';
361
- import type { string_data_url } from '../types/string_url';
362
- import type { string_domain } from '../types/string_url';
363
- import type { string_origin } from '../types/string_url';
364
- import type { string_tdl } from '../types/string_url';
365
- import type { string_hostname } from '../types/string_url';
366
- import type { string_host } from '../types/string_url';
367
- import type { string_protocol } from '../types/string_url';
368
- import type { string_ip_address } from '../types/string_url';
381
+ import type { string_url_image } from '../types/string_url_image';
369
382
  import type { string_url } from '../types/string_url';
370
- import type { string_promptbook_server_url } from '../types/string_url';
371
- import type { string_base_url } from '../types/string_url';
372
- import type { string_pipeline_root_url } from '../types/string_url';
373
- import type { string_agent_url } from '../types/string_url';
374
- import type { string_pipeline_url } from '../types/string_url';
375
- import type { string_pipeline_url_with_task_hash } from '../types/string_url';
376
- import type { string_href } from '../types/string_url';
377
- import type { string_url_image } from '../types/string_url';
378
- import type { string_uri } from '../types/string_url';
379
- import type { string_uri_part } from '../types/string_url';
380
- import type { string_email } from '../types/string_url';
381
- import type { string_emails } from '../types/string_url';
382
383
  import type { TaskType } from '../types/TaskType';
383
384
  import type { ToolCallState } from '../types/ToolCall';
384
385
  import type { ToolCallLogLevel } from '../types/ToolCall';
@@ -472,6 +473,7 @@ export type { SourceChipProps };
472
473
  export type { ChatToolCall };
473
474
  export type { ChatProgressItem };
474
475
  export type { ChatProgressCard };
476
+ export type { ChatMessageReplyingTo };
475
477
  export type { ChatMessage };
476
478
  export type { ChatParticipant };
477
479
  export type { ParsedCitation };
@@ -705,7 +707,13 @@ export type { string_agent_name };
705
707
  export type { string_agent_name_in_book };
706
708
  export type { string_agent_hash };
707
709
  export type { string_agent_permanent_id };
710
+ export type { string_agent_url };
711
+ export type { string_base_url };
712
+ export type { string_base64 };
713
+ export type { string_data_url };
708
714
  export type { string_business_category_name };
715
+ export type { string_email };
716
+ export type { string_emails };
709
717
  export type { string_absolute_filename };
710
718
  export type { string_relative_filename };
711
719
  export type { string_filename };
@@ -713,6 +721,16 @@ export type { string_absolute_dirname };
713
721
  export type { string_relative_dirname };
714
722
  export type { string_dirname };
715
723
  export type { string_executable_path };
724
+ export type { string_domain };
725
+ export type { string_origin };
726
+ export type { string_tdl };
727
+ export type { string_hostname };
728
+ export type { string_host };
729
+ export type { string_protocol };
730
+ export type { string_ip_address };
731
+ export type { string_href };
732
+ export type { string_uri };
733
+ export type { string_uri_part };
716
734
  export type { string_knowledge_source_content };
717
735
  export type { string_knowledge_source_link };
718
736
  export type { string_html };
@@ -734,6 +752,8 @@ export type { string_css_property };
734
752
  export type { string_fonts };
735
753
  export type { string_css_value };
736
754
  export type { string_css_selector };
755
+ export type { string_mime_type };
756
+ export type { string_mime_type_with_wildcard };
737
757
  export type { string_model_name };
738
758
  export type { string_name };
739
759
  export type { string_parameter_name };
@@ -757,6 +777,9 @@ export type { string_javascript_name };
757
777
  export type { string_postprocessing_function_name };
758
778
  export type { string_persona_description };
759
779
  export type { string_model_description };
780
+ export type { string_pipeline_root_url };
781
+ export type { string_pipeline_url };
782
+ export type { string_pipeline_url_with_task_hash };
760
783
  export type { string_prompt };
761
784
  export type { string_prompt_image };
762
785
  export type { string_template };
@@ -764,6 +787,7 @@ export type { string_text_prompt };
764
787
  export type { string_chat_prompt };
765
788
  export type { string_system_message };
766
789
  export type { string_completion_prompt };
790
+ export type { string_promptbook_server_url };
767
791
  export type { string_uuid };
768
792
  export type { string_sha256 };
769
793
  export type { string_base_58 };
@@ -783,30 +807,8 @@ export type { string_language };
783
807
  export type { string_date_iso8601 };
784
808
  export type { string_app_id };
785
809
  export type { string_user_id };
786
- export type { string_mime_type };
787
- export type { string_mime_type_with_wildcard };
788
- export type { string_base64 };
789
- export type { string_data_url };
790
- export type { string_domain };
791
- export type { string_origin };
792
- export type { string_tdl };
793
- export type { string_hostname };
794
- export type { string_host };
795
- export type { string_protocol };
796
- export type { string_ip_address };
797
- export type { string_url };
798
- export type { string_promptbook_server_url };
799
- export type { string_base_url };
800
- export type { string_pipeline_root_url };
801
- export type { string_agent_url };
802
- export type { string_pipeline_url };
803
- export type { string_pipeline_url_with_task_hash };
804
- export type { string_href };
805
810
  export type { string_url_image };
806
- export type { string_uri };
807
- export type { string_uri_part };
808
- export type { string_email };
809
- export type { string_emails };
811
+ export type { string_url };
810
812
  export type { TaskType };
811
813
  export type { ToolCallState };
812
814
  export type { ToolCallLogLevel };
@@ -17,6 +17,13 @@ export type ChatActionsBarProps = {
17
17
  title: string;
18
18
  onReset?: () => Promisable<void>;
19
19
  resetRequiresConfirmation?: boolean;
20
+ /**
21
+ * Optional navigation target for the "New chat" control.
22
+ *
23
+ * When provided, the control is rendered as a link so the host app can rely
24
+ * on browser-native navigation affordances such as opening in a new tab/window.
25
+ */
26
+ newChatButtonHref?: string;
20
27
  onUseTemplate?: () => void;
21
28
  extraActions?: ReactNode;
22
29
  saveFormats?: Array<string_chat_format_name>;
@@ -0,0 +1,2 @@
1
+ /** @jest-environment jsdom */
2
+ export {};
@@ -1,6 +1,7 @@
1
1
  import { type MouseEvent } from 'react';
2
2
  import { Color } from '../../../utils/color/Color';
3
3
  import type { WithTake } from '../../../utils/take/interfaces/ITakeChain';
4
+ import type { ChatMessage } from '../types/ChatMessage';
4
5
  import type { ChatParticipant } from '../types/ChatParticipant';
5
6
  import type { ChatProps, ChatSoundSystem } from './ChatProps';
6
7
  /**
@@ -31,6 +32,8 @@ export type ChatInputAreaProps = {
31
32
  speechRecognition?: ChatProps['speechRecognition'];
32
33
  speechRecognitionLanguage?: ChatProps['speechRecognitionLanguage'];
33
34
  defaultMessage?: string;
35
+ replyingToMessage?: ChatMessage | null;
36
+ onCancelReply?: ChatProps['onCancelReply'];
34
37
  enterBehavior?: ChatProps['enterBehavior'];
35
38
  resolveEnterBehavior?: ChatProps['resolveEnterBehavior'];
36
39
  placeholderMessageContent?: string;
@@ -42,6 +45,7 @@ export type ChatInputAreaProps = {
42
45
  soundSystem?: ChatSoundSystem;
43
46
  onButtonClick: ChatInputButtonClickHandler;
44
47
  chatInputClassName?: string;
48
+ chatUiTranslations?: ChatProps['chatUiTranslations'];
45
49
  };
46
50
  /**
47
51
  * Renders the chat input area with text, file upload, and voice controls.
@@ -60,6 +60,14 @@ type ChatMessageItemProps = Pick<ChatProps, 'onMessage' | 'onActionButton' | 'on
60
60
  * Maps tool name to agent information
61
61
  */
62
62
  teammates?: ChatProps['teammates'];
63
+ /**
64
+ * Called when the user chooses to reply to this message.
65
+ */
66
+ onReplyToMessage?: ChatProps['onReplyToMessage'];
67
+ /**
68
+ * Determines whether this message can be replied to.
69
+ */
70
+ canReplyToMessage?: ChatProps['canReplyToMessage'];
63
71
  /**
64
72
  * Optional cached metadata keyed by TEAM tool names to enrich tool call chips.
65
73
  */
@@ -40,6 +40,8 @@ export type ChatMessageListProps = {
40
40
  onMessage?: (messageContent: string) => Promisable<void>;
41
41
  onActionButton?: ChatProps['onActionButton'];
42
42
  onQuickMessageButton?: ChatProps['onQuickMessageButton'];
43
+ onReplyToMessage?: ChatProps['onReplyToMessage'];
44
+ canReplyToMessage?: ChatProps['canReplyToMessage'];
43
45
  onCreateAgent?: (bookContent: string) => void;
44
46
  toolTitles?: Record<string, string>;
45
47
  teammates?: ChatProps['teammates'];
@@ -2,6 +2,7 @@ import type { CSSProperties, ReactNode } from 'react';
2
2
  import type { Promisable } from 'type-fest';
3
3
  import { Color } from '../../../_packages/color.index';
4
4
  import { SpeechRecognition } from '../../../types/SpeechRecognition';
5
+ import type { string_href } from '../../../types/typeAliases';
5
6
  import { string_color } from '../../../types/typeAliases';
6
7
  import type { string_chat_format_name } from '../save/_common/string_chat_format_name';
7
8
  import type { ChatMessage } from '../types/ChatMessage';
@@ -124,6 +125,26 @@ export type ChatUiTranslations = {
124
125
  * @default "Write a message..."
125
126
  */
126
127
  readonly inputPlaceholder?: string;
128
+ /**
129
+ * Label shown above quoted reply previews in both composer and reply bubbles.
130
+ * @default "Replying to"
131
+ */
132
+ readonly replyingToLabel?: string;
133
+ /**
134
+ * Visible label for the explicit reply action on one message.
135
+ * @default "Reply"
136
+ */
137
+ readonly replyActionLabel?: string;
138
+ /**
139
+ * Accessible title for the explicit reply action on one message.
140
+ * @default "Reply to this message"
141
+ */
142
+ readonly replyActionTitle?: string;
143
+ /**
144
+ * Accessible label for the composer button that cancels reply mode.
145
+ * @default "Cancel reply"
146
+ */
147
+ readonly cancelReplyLabel?: string;
127
148
  /**
128
149
  * Label for the "Save" button in the chat actions bar.
129
150
  * @default "Save"
@@ -433,7 +454,11 @@ export type ChatProps = {
433
454
  * - When set, the send textarea and button will be shown
434
455
  * - When undefined, the chat has no input and is read-only showing only the messages
435
456
  */
436
- onMessage?(messageContent: string): Promisable<void>;
457
+ onMessage?(messageContent: string, attachments?: Array<{
458
+ name: string;
459
+ type: string;
460
+ url: string;
461
+ }>, replyingToMessage?: ChatMessage | null): Promisable<void>;
437
462
  /**
438
463
  * Called when user clicks a quick action button parsed from message markdown.
439
464
  *
@@ -447,6 +472,22 @@ export type ChatProps = {
447
472
  * When not provided, quick message buttons fall back to `onMessage`.
448
473
  */
449
474
  onQuickMessageButton?(messageContent: string): Promisable<void>;
475
+ /**
476
+ * Optional callback fired when the user starts replying to one existing message.
477
+ */
478
+ onReplyToMessage?(message: ChatMessage): void;
479
+ /**
480
+ * Optional callback fired when the user cancels the currently composed reply.
481
+ */
482
+ onCancelReply?(): void;
483
+ /**
484
+ * Optional callback that determines whether one message can be replied to.
485
+ */
486
+ canReplyToMessage?(message: ChatMessage): boolean;
487
+ /**
488
+ * Optional message currently being quoted by the composer.
489
+ */
490
+ readonly replyingToMessage?: ChatMessage | null;
450
491
  /**
451
492
  * Optional callback
452
493
  *
@@ -460,6 +501,14 @@ export type ChatProps = {
460
501
  * @default true
461
502
  */
462
503
  readonly resetRequiresConfirmation?: boolean;
504
+ /**
505
+ * Optional navigation target for the action-bar "New chat" control.
506
+ *
507
+ * When provided, the control is rendered as a plain link instead of invoking `onReset`.
508
+ * This allows host applications to rely on browser-native navigation affordances such as
509
+ * right-click "Open in new tab/window".
510
+ */
511
+ readonly newChatButtonHref?: string_href;
463
512
  /**
464
513
  * Determines whether the voice recognition button is rendered
465
514
  */
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Props for one faded quoted-message preview rendered inside the chat UI.
3
+ *
4
+ * @private component of `<Chat/>`
5
+ */
6
+ export type ChatReplyPreviewProps = {
7
+ readonly label: string;
8
+ readonly senderLabel: string;
9
+ readonly previewText: string;
10
+ readonly className?: string;
11
+ readonly dismissLabel?: string;
12
+ readonly onDismiss?: () => void;
13
+ };
14
+ /**
15
+ * Renders the common faded preview used for reply bubbles and composer reply mode.
16
+ *
17
+ * @private component of `<Chat/>`
18
+ */
19
+ export declare function ChatReplyPreview(props: ChatReplyPreviewProps): import("react/jsx-runtime").JSX.Element;
@@ -1,9 +1,9 @@
1
1
  import type { ChatMessage } from '../types/ChatMessage';
2
2
  /**
3
- * Converts one structured progress card payload into markdown checklist content.
3
+ * Converts one structured progress card payload into markdown content.
4
4
  *
5
5
  * @param progressCard Structured progress card payload.
6
- * @returns Markdown checklist rendered through the normal message markdown pipeline.
6
+ * @returns Markdown rendered through the normal message markdown pipeline.
7
7
  *
8
8
  * @private internal helper of `<ChatMessageItem/>`
9
9
  */
@@ -53,7 +53,7 @@ export type MockedChatDelayConfig = {
53
53
  *
54
54
  * @public exported from `@promptbook/components`
55
55
  */
56
- export type MockedChatProps = Omit<ChatProps, 'onReset' | /*'onMessage' | */ 'onUseTemplate' | 'isVoiceRecognitionButtonShown'> & {
56
+ export type MockedChatProps = Omit<ChatProps, 'onReset' | 'newChatButtonHref' | /*'onMessage' | */ 'onUseTemplate' | 'isVoiceRecognitionButtonShown'> & {
57
57
  /**
58
58
  * Whether the chat can be reset via the "New chat" button.
59
59
  *
@@ -58,6 +58,37 @@ export type ChatProgressCard = {
58
58
  */
59
59
  readonly isVisible?: boolean;
60
60
  };
61
+ /**
62
+ * Serialized reference to an earlier chat message quoted by a reply bubble.
63
+ *
64
+ * Stores the durable relationship (`threadId` + `messageId`) together with a
65
+ * lightweight snapshot of the original message so UIs and prompt builders can
66
+ * render reply context without performing extra fetches.
67
+ *
68
+ * @public exported from `@promptbook/components`
69
+ */
70
+ export type ChatMessageReplyingTo = {
71
+ /**
72
+ * Durable chat thread identifier that owns the replied-to message.
73
+ */
74
+ readonly threadId: string;
75
+ /**
76
+ * Durable identifier of the specific replied-to message inside the thread.
77
+ */
78
+ readonly messageId: string;
79
+ /**
80
+ * Sender of the original replied-to message.
81
+ */
82
+ readonly sender: string;
83
+ /**
84
+ * Original markdown content of the replied-to message.
85
+ */
86
+ readonly content: string_markdown;
87
+ /**
88
+ * Optional list of attachment names from the replied-to message.
89
+ */
90
+ readonly attachmentNames?: ReadonlyArray<string>;
91
+ };
61
92
  /**
62
93
  * Serializable prompt snapshot stored alongside one assistant message for debugging and inspection.
63
94
  */
@@ -243,5 +274,9 @@ export type ChatMessage = Omit<Message<id>, 'direction' | 'recipients' | 'thread
243
274
  * resolved parameters, tool availability, and provider payload associated with one turn.
244
275
  */
245
276
  readonly prompt?: ChatMessagePrompt;
277
+ /**
278
+ * Optional metadata describing which earlier message this one replies to.
279
+ */
280
+ readonly replyingTo?: ChatMessageReplyingTo;
246
281
  };
247
282
  export {};
@@ -0,0 +1,25 @@
1
+ import type { ChatMessage, ChatMessageReplyingTo } from '../types/ChatMessage';
2
+ /**
3
+ * Lightweight message-like shape accepted by reply-preview text helpers.
4
+ *
5
+ * @private helper contract for chat reply previews
6
+ */
7
+ type ChatMessageReplyPreviewSource = Pick<ChatMessage, 'content' | 'attachments'> & {
8
+ readonly attachmentNames?: ChatMessageReplyingTo['attachmentNames'];
9
+ };
10
+ /**
11
+ * Optional settings for reply-preview text generation.
12
+ *
13
+ * @private helper contract for chat reply previews
14
+ */
15
+ type ResolveChatMessageReplyPreviewTextOptions = {
16
+ readonly maxLength?: number;
17
+ readonly emptyLabel?: string;
18
+ };
19
+ /**
20
+ * Resolves one compact plain-text preview for reply UI surfaces and prompt context.
21
+ *
22
+ * @private helper for chat reply previews
23
+ */
24
+ export declare function resolveChatMessageReplyPreviewText(source: ChatMessageReplyPreviewSource, options?: ResolveChatMessageReplyPreviewTextOptions): string;
25
+ export {};
@@ -0,0 +1,12 @@
1
+ import type { ChatMessage } from '../types/ChatMessage';
2
+ import type { ChatParticipant } from '../types/ChatParticipant';
3
+ /**
4
+ * Resolves the human-readable sender label shown in reply previews.
5
+ *
6
+ * @private helper for chat reply previews
7
+ */
8
+ export declare function resolveChatMessageReplySenderLabel(options: {
9
+ sender: ChatMessage['sender'];
10
+ participants?: ReadonlyArray<ChatParticipant>;
11
+ fallbackLabel?: string;
12
+ }): string;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Relative path to the Promptbook Coder quick-reference file initialized in project roots.
3
+ *
4
+ * @private internal utility of `ptbk coder`
5
+ */
6
+ export declare const AGENT_CODING_FILE_PATH = "AGENT_CODING.md";
7
+ /**
8
+ * Returns the default coder `AGENT_CODING.md` quick-reference content.
9
+ *
10
+ * @private internal utility of `ptbk coder`
11
+ */
12
+ export declare function getDefaultCoderAgentCodingFileContent({ packageJsonScripts, }: {
13
+ readonly packageJsonScripts: Readonly<Record<string, string>>;
14
+ }): string;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Relative path to the shared coder context file initialized in project roots.
3
+ *
4
+ * @private internal utility of `ptbk coder`
5
+ */
6
+ export declare const AGENTS_FILE_PATH = "AGENTS.md";
7
+ /**
8
+ * Returns the default coder `AGENTS.md` boilerplate instructions.
9
+ *
10
+ * @private internal utility of `ptbk coder`
11
+ */
12
+ export declare function getDefaultCoderAgentsFileContent(): string;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Appends one text block to existing file content while preserving readable newlines.
3
+ *
4
+ * @private function of `initializeCoderProjectConfiguration`
5
+ */
6
+ export declare function appendBlock(currentContent: string, blockToAppend: string): string;
@@ -50,6 +50,10 @@ export type CoderPromptTemplateDefinition = {
50
50
  * Markdown content of the template.
51
51
  */
52
52
  readonly content: string;
53
+ /**
54
+ * Whether `ptbk coder init` should materialize this template into project-owned files.
55
+ */
56
+ readonly isDefaultProjectTemplate: boolean;
53
57
  };
54
58
  /**
55
59
  * Result of ensuring one default coder template file exists inside a project.
@@ -99,6 +103,12 @@ export type ResolvedCoderPromptTemplate = {
99
103
  * @private internal utility of `ptbk coder`
100
104
  */
101
105
  export declare function getDefaultCoderPromptTemplateDefinitions(): ReadonlyArray<CoderPromptTemplateDefinition>;
106
+ /**
107
+ * Lists the built-in coder prompt templates that are safe to initialize in any project.
108
+ *
109
+ * @private internal utility of `ptbk coder`
110
+ */
111
+ export declare function getDefaultCoderProjectPromptTemplateDefinitions(): ReadonlyArray<CoderPromptTemplateDefinition>;
102
112
  /**
103
113
  * Resolves one built-in coder boilerplate template definition by its stable identifier.
104
114
  *
@@ -0,0 +1,15 @@
1
+ import type { InitializationStatus } from './boilerplateTemplates';
2
+ /**
3
+ * Result of ensuring coder environment variables inside `.env`.
4
+ */
5
+ type EnsureCoderEnvFileResult = {
6
+ readonly envFileStatus: InitializationStatus;
7
+ readonly initializedEnvVariableNames: ReadonlyArray<string>;
8
+ };
9
+ /**
10
+ * Ensures `.env` exists and contains all required coder environment variables.
11
+ *
12
+ * @private function of `initializeCoderProjectConfiguration`
13
+ */
14
+ export declare function ensureCoderEnvFile(projectPath: string): Promise<EnsureCoderEnvFileResult>;
15
+ export {};