@promptbook/wizard 0.112.0-35 → 0.112.0-38

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 (126) hide show
  1. package/README.md +119 -18
  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 +137 -0
  21. package/esm/src/cli/cli-commands/coder/boilerplateTemplates.test.d.ts +1 -0
  22. package/esm/src/cli/cli-commands/coder/ensureCoderEnvFile.d.ts +15 -0
  23. package/esm/src/cli/cli-commands/coder/ensureCoderGitignoreFile.d.ts +7 -0
  24. package/esm/src/cli/cli-commands/coder/ensureCoderMarkdownFile.d.ts +7 -0
  25. package/esm/src/cli/cli-commands/coder/ensureCoderPackageJsonFile.d.ts +7 -0
  26. package/esm/src/cli/cli-commands/coder/ensureCoderVscodeSettingsFile.d.ts +7 -0
  27. package/esm/src/cli/cli-commands/coder/ensureDirectory.d.ts +7 -0
  28. package/esm/src/cli/cli-commands/coder/find-refactor-candidates.d.ts +1 -1
  29. package/esm/src/cli/cli-commands/coder/find-refactor-candidates.test.d.ts +1 -0
  30. package/esm/src/cli/cli-commands/coder/formatDisplayPath.d.ts +6 -0
  31. package/esm/src/cli/cli-commands/coder/generate-boilerplates.d.ts +10 -0
  32. package/esm/src/cli/cli-commands/coder/getDefaultCoderPackageJsonScripts.d.ts +6 -0
  33. package/esm/src/cli/cli-commands/coder/getDefaultCoderVscodeSettings.d.ts +6 -0
  34. package/esm/src/cli/cli-commands/coder/init.d.ts +3 -0
  35. package/esm/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.d.ts +25 -0
  36. package/esm/src/cli/cli-commands/coder/mergeStringRecordJsonFile.d.ts +18 -0
  37. package/esm/src/cli/cli-commands/coder/printInitializationSummary.d.ts +7 -0
  38. package/esm/src/cli/cli-commands/coder/readTextFileIfExists.d.ts +6 -0
  39. package/esm/src/types/string_agent_url.d.ts +7 -0
  40. package/esm/src/types/string_agent_url_private.d.ts +9 -0
  41. package/esm/src/types/string_base64.d.ts +13 -0
  42. package/esm/src/types/string_base64_private.d.ts +2 -2
  43. package/esm/src/types/string_base_url.d.ts +7 -0
  44. package/esm/src/types/string_base_url_private.d.ts +9 -0
  45. package/esm/src/types/string_email.d.ts +13 -0
  46. package/esm/src/types/string_email_private.d.ts +2 -2
  47. package/esm/src/types/string_host.d.ts +42 -0
  48. package/esm/src/types/string_host_private.d.ts +7 -7
  49. package/esm/src/types/string_href.d.ts +19 -0
  50. package/esm/src/types/string_href_private.d.ts +24 -0
  51. package/esm/src/types/string_mime_type.d.ts +15 -0
  52. package/esm/src/types/string_mime_type_private.d.ts +2 -2
  53. package/esm/src/types/string_pipeline_root_url.d.ts +7 -0
  54. package/esm/src/types/string_pipeline_root_url_private.d.ts +9 -0
  55. package/esm/src/types/string_pipeline_url.d.ts +13 -0
  56. package/esm/src/types/string_pipeline_url_private.d.ts +17 -0
  57. package/esm/src/types/string_promptbook_server_url.d.ts +7 -0
  58. package/esm/src/types/string_promptbook_server_url_private.d.ts +9 -0
  59. package/esm/src/types/string_url.d.ts +14 -141
  60. package/esm/src/types/string_url_image.d.ts +7 -0
  61. package/esm/src/types/string_url_image_private.d.ts +9 -0
  62. package/esm/src/types/string_url_private.d.ts +0 -80
  63. package/esm/src/version.d.ts +1 -1
  64. package/package.json +2 -2
  65. package/umd/index.umd.js +1 -1
  66. package/umd/src/_packages/components.index.d.ts +2 -0
  67. package/umd/src/_packages/types.index.d.ts +48 -46
  68. package/umd/src/book-components/Chat/Chat/ChatActionsBar.d.ts +7 -0
  69. package/umd/src/book-components/Chat/Chat/ChatActionsBar.test.d.ts +2 -0
  70. package/umd/src/book-components/Chat/Chat/ChatInputArea.d.ts +4 -0
  71. package/umd/src/book-components/Chat/Chat/ChatMessageItem.d.ts +8 -0
  72. package/umd/src/book-components/Chat/Chat/ChatMessageList.d.ts +2 -0
  73. package/umd/src/book-components/Chat/Chat/ChatProps.d.ts +50 -1
  74. package/umd/src/book-components/Chat/Chat/ChatReplyPreview.d.ts +19 -0
  75. package/umd/src/book-components/Chat/Chat/createProgressCardChecklistMarkdown.d.ts +2 -2
  76. package/umd/src/book-components/Chat/MockedChat/MockedChat.d.ts +1 -1
  77. package/umd/src/book-components/Chat/types/ChatMessage.d.ts +35 -0
  78. package/umd/src/book-components/Chat/utils/resolveChatMessageReplyPreviewText.d.ts +25 -0
  79. package/umd/src/book-components/Chat/utils/resolveChatMessageReplySenderLabel.d.ts +12 -0
  80. package/umd/src/cli/cli-commands/coder/agentCodingFile.d.ts +14 -0
  81. package/umd/src/cli/cli-commands/coder/agentsFile.d.ts +12 -0
  82. package/umd/src/cli/cli-commands/coder/appendBlock.d.ts +6 -0
  83. package/umd/src/cli/cli-commands/coder/boilerplateTemplates.d.ts +137 -0
  84. package/umd/src/cli/cli-commands/coder/boilerplateTemplates.test.d.ts +1 -0
  85. package/umd/src/cli/cli-commands/coder/ensureCoderEnvFile.d.ts +15 -0
  86. package/umd/src/cli/cli-commands/coder/ensureCoderGitignoreFile.d.ts +7 -0
  87. package/umd/src/cli/cli-commands/coder/ensureCoderMarkdownFile.d.ts +7 -0
  88. package/umd/src/cli/cli-commands/coder/ensureCoderPackageJsonFile.d.ts +7 -0
  89. package/umd/src/cli/cli-commands/coder/ensureCoderVscodeSettingsFile.d.ts +7 -0
  90. package/umd/src/cli/cli-commands/coder/ensureDirectory.d.ts +7 -0
  91. package/umd/src/cli/cli-commands/coder/find-refactor-candidates.d.ts +1 -1
  92. package/umd/src/cli/cli-commands/coder/find-refactor-candidates.test.d.ts +1 -0
  93. package/umd/src/cli/cli-commands/coder/formatDisplayPath.d.ts +6 -0
  94. package/umd/src/cli/cli-commands/coder/generate-boilerplates.d.ts +10 -0
  95. package/umd/src/cli/cli-commands/coder/getDefaultCoderPackageJsonScripts.d.ts +6 -0
  96. package/umd/src/cli/cli-commands/coder/getDefaultCoderVscodeSettings.d.ts +6 -0
  97. package/umd/src/cli/cli-commands/coder/init.d.ts +3 -0
  98. package/umd/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.d.ts +25 -0
  99. package/umd/src/cli/cli-commands/coder/mergeStringRecordJsonFile.d.ts +18 -0
  100. package/umd/src/cli/cli-commands/coder/printInitializationSummary.d.ts +7 -0
  101. package/umd/src/cli/cli-commands/coder/readTextFileIfExists.d.ts +6 -0
  102. package/umd/src/types/string_agent_url.d.ts +7 -0
  103. package/umd/src/types/string_agent_url_private.d.ts +9 -0
  104. package/umd/src/types/string_base64.d.ts +13 -0
  105. package/umd/src/types/string_base64_private.d.ts +2 -2
  106. package/umd/src/types/string_base_url.d.ts +7 -0
  107. package/umd/src/types/string_base_url_private.d.ts +9 -0
  108. package/umd/src/types/string_email.d.ts +13 -0
  109. package/umd/src/types/string_email_private.d.ts +2 -2
  110. package/umd/src/types/string_host.d.ts +42 -0
  111. package/umd/src/types/string_host_private.d.ts +7 -7
  112. package/umd/src/types/string_href.d.ts +19 -0
  113. package/umd/src/types/string_href_private.d.ts +24 -0
  114. package/umd/src/types/string_mime_type.d.ts +15 -0
  115. package/umd/src/types/string_mime_type_private.d.ts +2 -2
  116. package/umd/src/types/string_pipeline_root_url.d.ts +7 -0
  117. package/umd/src/types/string_pipeline_root_url_private.d.ts +9 -0
  118. package/umd/src/types/string_pipeline_url.d.ts +13 -0
  119. package/umd/src/types/string_pipeline_url_private.d.ts +17 -0
  120. package/umd/src/types/string_promptbook_server_url.d.ts +7 -0
  121. package/umd/src/types/string_promptbook_server_url_private.d.ts +9 -0
  122. package/umd/src/types/string_url.d.ts +14 -141
  123. package/umd/src/types/string_url_image.d.ts +7 -0
  124. package/umd/src/types/string_url_image_private.d.ts +9 -0
  125. package/umd/src/types/string_url_private.d.ts +0 -80
  126. package/umd/src/version.d.ts +1 -1
package/README.md CHANGED
@@ -365,24 +365,6 @@ You can install all of them at once:
365
365
  npm i ptbk
366
366
  ```
367
367
 
368
- Promptbook also ships coding-agent CLI utilities through `ptbk coder`.
369
- For full `coder run` options and runner-specific examples, see [`scripts/run-codex-prompts/README.md`](./scripts/run-codex-prompts/README.md).
370
-
371
- #### `ptbk coder`
372
-
373
- Locally in this repository:
374
-
375
- ```bash
376
- npx ts-node ./src/cli/test/ptbk.ts coder run --dry-run
377
- ```
378
-
379
- In another project with `ptbk` installed:
380
-
381
- ```bash
382
- npm install ptbk
383
- npx ptbk coder run --dry-run
384
- ```
385
-
386
368
  Or you can install them separately:
387
369
 
388
370
  > ⭐ Marked packages are worth to try first
@@ -420,6 +402,125 @@ Or you can install them separately:
420
402
 
421
403
 
422
404
 
405
+ ### 🤖 Promptbook Coder
406
+
407
+ `ptbk coder` is Promptbook's workflow layer for AI-assisted software changes. Instead of opening one chat and manually copy-pasting tasks, you keep a queue of coding prompts in `prompts/*.md`, let a coding agent execute the next ready task, and then verify the result before archiving the prompt.
408
+
409
+ Promptbook Coder is **not another standalone coding model**. It is an orchestration layer over coding agents such as **GitHub Copilot**, **OpenAI Codex**, **Claude Code**, **Opencode**, **Cline**, and **Gemini CLI**. The difference is that Promptbook Coder adds a repeatable repository workflow on top of them:
410
+
411
+ - prompt files with explicit statuses like `[ ]`, `[x]`, and `[-]`
412
+ - automatic selection of the next runnable task, including priority support
413
+ - optional shared repo context loaded from a file such as `AGENTS.md`
414
+ - automatic `git add`, commit, and push after each successful prompt
415
+ - dedicated coding-agent Git identity and optional GPG signing
416
+ - verification and repair flow for work that is done, partial, or broken
417
+ - helper commands for generating boilerplates and finding refactor prompts
418
+
419
+ In short: tools like Claude Code, Codex, or GitHub Copilot are the **engines**; Promptbook Coder is the **workflow** that keeps coding work structured, reviewable, and repeatable across many prompts.
420
+
421
+ #### How the workflow works
422
+
423
+ 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/`.
424
+ 2. `ptbk coder generate-boilerplates` creates prompt files in `prompts/`.
425
+ 3. You replace placeholder `@@@` sections with real coding tasks.
426
+ 4. `ptbk coder run` sends the next ready `[ ]` prompt to the selected coding agent.
427
+ 5. Promptbook Coder marks the prompt as done `[x]`, records runner metadata, then stages, commits, and pushes the resulting changes.
428
+ 6. `ptbk coder verify` reviews completed prompts, archives finished files to `prompts/done/`, and appends a repair prompt when more work is needed.
429
+
430
+ Prompts marked with `[-]` are not ready yet, prompts containing `@@@` are treated as not fully written, and prompts with more `!` markers have higher priority.
431
+
432
+ #### Features
433
+
434
+ - **Multi-runner execution:** `openai-codex`, `github-copilot`, `cline`, `claude-code`, `opencode`, `gemini`
435
+ - **Context injection:** `--context AGENTS.md` or inline extra instructions
436
+ - **Reasoning control:** `--thinking-level low|medium|high|xhigh` for supported runners
437
+ - **Interactive or unattended runs:** default wait mode, or `--no-wait` for batch execution
438
+ - **Git safety:** clean working tree check by default, optional `--ignore-git-changes`
439
+ - **Prompt triage:** `--priority` to process only more important tasks first
440
+ - **Failure logging:** failed runs write a neighboring `.error.log`
441
+ - **Line-ending normalization:** changed files are normalized back to LF by default
442
+
443
+ #### Local usage in this repository
444
+
445
+ When working on Promptbook itself, the repository usually runs the CLI straight from source:
446
+
447
+ ```bash
448
+ npx ts-node ./src/cli/test/ptbk.ts coder init
449
+
450
+ npx ts-node ./src/cli/test/ptbk.ts coder generate-boilerplates --template prompts/templates/common.md
451
+
452
+ npx ts-node ./src/cli/test/ptbk.ts coder generate-boilerplates --template prompts/templates/agents-server.md
453
+
454
+ npx ts-node ./src/cli/test/ptbk.ts coder run --agent github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md
455
+
456
+ npx ts-node ./src/cli/test/ptbk.ts coder run --agent github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md --ignore-git-changes --no-wait
457
+
458
+ npx ts-node ./src/cli/test/ptbk.ts coder find-refactor-candidates
459
+
460
+ npx ts-node ./src/cli/test/ptbk.ts coder find-refactor-candidates --level xhigh
461
+
462
+ npx ts-node ./src/cli/test/ptbk.ts coder verify
463
+ ```
464
+
465
+ #### Using `ptbk coder` in an external project
466
+
467
+ If you want to use the workflow in another repository, install the package and invoke the `ptbk` binary. After local installation, `npx ptbk ...` is the most portable form; plain `ptbk ...` also works when your environment exposes the local binary on `PATH`.
468
+
469
+ ```bash
470
+ npm install ptbk
471
+
472
+ ptbk coder init
473
+
474
+ npx ptbk coder generate-boilerplates
475
+
476
+ npx ptbk coder generate-boilerplates --template prompts/templates/common.md
477
+
478
+ npx ptbk coder run --agent github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md
479
+
480
+ npx ptbk coder run --agent github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md --ignore-git-changes --no-wait
481
+
482
+ npx ptbk coder find-refactor-candidates
483
+
484
+ npx ptbk coder find-refactor-candidates --level xhigh
485
+
486
+ npx ptbk coder verify
487
+ ```
488
+
489
+ `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/`.
490
+
491
+ #### What each command does
492
+
493
+ | Command | What it does |
494
+ | --- | --- |
495
+ | `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/`. |
496
+ | `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. |
497
+ | `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. |
498
+ | `ptbk coder find-refactor-candidates` | Scans the repository for oversized or overpacked files and writes prompt files for likely refactors; `--level <low|medium|high|xhigh>` makes the scan more or less aggressive. |
499
+ | `ptbk coder verify` | Walks through completed prompts, archives truly finished work, and adds follow-up repair prompts for unfinished results. |
500
+
501
+ #### Most useful `ptbk coder run` flags
502
+
503
+ | Flag | Purpose |
504
+ | --- | --- |
505
+ | `--agent <name>` | Selects the coding backend. |
506
+ | `--model <model>` | Chooses the runner model; required for `openai-codex` and `gemini`, optional for `github-copilot`. |
507
+ | `--context <text-or-file>` | Appends extra instructions inline or from a file like `AGENTS.md`. |
508
+ | `--thinking-level <level>` | Sets reasoning effort for supported runners. |
509
+ | `--no-wait` | Skips interactive pauses between prompts for unattended execution. |
510
+ | `--ignore-git-changes` | Disables the clean-working-tree guard. |
511
+ | `--priority <n>` | Runs only prompts at or above the given priority. |
512
+ | `--dry-run` | Prints which prompts are ready instead of executing them. |
513
+ | `--allow-credits` | Lets OpenAI Codex spend credits when required. |
514
+ | `--auto-migrate` | Runs testing-server database migrations after each successful prompt. |
515
+
516
+ #### Typical usage pattern
517
+
518
+ 1. Initialize once with `ptbk coder init`.
519
+ 2. Customize `prompts/templates/*.md` if needed, then create or write prompt files in `prompts/`.
520
+ 3. Customize the starter `AGENTS.md` with repository-specific instructions, then pass `--context AGENTS.md`.
521
+ 4. Run one prompt at a time interactively, or use `--no-wait` for unattended batches.
522
+ 5. Finish with `ptbk coder verify` so resolved prompts are archived and broken ones get explicit repair follow-ups.
523
+
423
524
 
424
525
 
425
526
 
package/esm/index.es.js CHANGED
@@ -38,7 +38,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
38
38
  * @generated
39
39
  * @see https://github.com/webgptorg/promptbook
40
40
  */
41
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0-35';
41
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-38';
42
42
  /**
43
43
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
44
44
  * 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;