@promptbook/cli 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 (138) hide show
  1. package/README.md +119 -18
  2. package/esm/index.es.js +1289 -323
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/scripts/find-refactor-candidates/RefactorCandidateLevel.d.ts +41 -0
  5. package/esm/scripts/find-refactor-candidates/analyzeSourceFileForRefactorCandidate.d.ts +5 -0
  6. package/esm/scripts/find-refactor-candidates/find-refactor-candidates.constants.d.ts +2 -14
  7. package/esm/scripts/find-refactor-candidates/find-refactor-candidates.d.ts +13 -1
  8. package/esm/scripts/find-refactor-candidates/findRefactorCandidatesInProject.d.ts +18 -1
  9. package/esm/src/_packages/components.index.d.ts +2 -0
  10. package/esm/src/_packages/types.index.d.ts +48 -46
  11. package/esm/src/book-components/Chat/Chat/ChatActionsBar.d.ts +7 -0
  12. package/esm/src/book-components/Chat/Chat/ChatActionsBar.test.d.ts +2 -0
  13. package/esm/src/book-components/Chat/Chat/ChatInputArea.d.ts +4 -0
  14. package/esm/src/book-components/Chat/Chat/ChatMessageItem.d.ts +8 -0
  15. package/esm/src/book-components/Chat/Chat/ChatMessageList.d.ts +2 -0
  16. package/esm/src/book-components/Chat/Chat/ChatProps.d.ts +50 -1
  17. package/esm/src/book-components/Chat/Chat/ChatReplyPreview.d.ts +19 -0
  18. package/esm/src/book-components/Chat/Chat/createProgressCardChecklistMarkdown.d.ts +2 -2
  19. package/esm/src/book-components/Chat/MockedChat/MockedChat.d.ts +1 -1
  20. package/esm/src/book-components/Chat/types/ChatMessage.d.ts +35 -0
  21. package/esm/src/book-components/Chat/utils/resolveChatMessageReplyPreviewText.d.ts +25 -0
  22. package/esm/src/book-components/Chat/utils/resolveChatMessageReplySenderLabel.d.ts +12 -0
  23. package/esm/src/cli/cli-commands/coder/agentCodingFile.d.ts +14 -0
  24. package/esm/src/cli/cli-commands/coder/agentsFile.d.ts +12 -0
  25. package/esm/src/cli/cli-commands/coder/appendBlock.d.ts +6 -0
  26. package/esm/src/cli/cli-commands/coder/boilerplateTemplates.d.ts +137 -0
  27. package/esm/src/cli/cli-commands/coder/boilerplateTemplates.test.d.ts +1 -0
  28. package/esm/src/cli/cli-commands/coder/ensureCoderEnvFile.d.ts +15 -0
  29. package/esm/src/cli/cli-commands/coder/ensureCoderGitignoreFile.d.ts +7 -0
  30. package/esm/src/cli/cli-commands/coder/ensureCoderMarkdownFile.d.ts +7 -0
  31. package/esm/src/cli/cli-commands/coder/ensureCoderPackageJsonFile.d.ts +7 -0
  32. package/esm/src/cli/cli-commands/coder/ensureCoderVscodeSettingsFile.d.ts +7 -0
  33. package/esm/src/cli/cli-commands/coder/ensureDirectory.d.ts +7 -0
  34. package/esm/src/cli/cli-commands/coder/find-refactor-candidates.d.ts +1 -1
  35. package/esm/src/cli/cli-commands/coder/find-refactor-candidates.test.d.ts +1 -0
  36. package/esm/src/cli/cli-commands/coder/formatDisplayPath.d.ts +6 -0
  37. package/esm/src/cli/cli-commands/coder/generate-boilerplates.d.ts +10 -0
  38. package/esm/src/cli/cli-commands/coder/getDefaultCoderPackageJsonScripts.d.ts +6 -0
  39. package/esm/src/cli/cli-commands/coder/getDefaultCoderVscodeSettings.d.ts +6 -0
  40. package/esm/src/cli/cli-commands/coder/init.d.ts +3 -0
  41. package/esm/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.d.ts +25 -0
  42. package/esm/src/cli/cli-commands/coder/mergeStringRecordJsonFile.d.ts +18 -0
  43. package/esm/src/cli/cli-commands/coder/printInitializationSummary.d.ts +7 -0
  44. package/esm/src/cli/cli-commands/coder/readTextFileIfExists.d.ts +6 -0
  45. package/esm/src/types/string_agent_url.d.ts +7 -0
  46. package/esm/src/types/string_agent_url_private.d.ts +9 -0
  47. package/esm/src/types/string_base64.d.ts +13 -0
  48. package/esm/src/types/string_base64_private.d.ts +2 -2
  49. package/esm/src/types/string_base_url.d.ts +7 -0
  50. package/esm/src/types/string_base_url_private.d.ts +9 -0
  51. package/esm/src/types/string_email.d.ts +13 -0
  52. package/esm/src/types/string_email_private.d.ts +2 -2
  53. package/esm/src/types/string_host.d.ts +42 -0
  54. package/esm/src/types/string_host_private.d.ts +7 -7
  55. package/esm/src/types/string_href.d.ts +19 -0
  56. package/esm/src/types/string_href_private.d.ts +24 -0
  57. package/esm/src/types/string_mime_type.d.ts +15 -0
  58. package/esm/src/types/string_mime_type_private.d.ts +2 -2
  59. package/esm/src/types/string_pipeline_root_url.d.ts +7 -0
  60. package/esm/src/types/string_pipeline_root_url_private.d.ts +9 -0
  61. package/esm/src/types/string_pipeline_url.d.ts +13 -0
  62. package/esm/src/types/string_pipeline_url_private.d.ts +17 -0
  63. package/esm/src/types/string_promptbook_server_url.d.ts +7 -0
  64. package/esm/src/types/string_promptbook_server_url_private.d.ts +9 -0
  65. package/esm/src/types/string_url.d.ts +14 -141
  66. package/esm/src/types/string_url_image.d.ts +7 -0
  67. package/esm/src/types/string_url_image_private.d.ts +9 -0
  68. package/esm/src/types/string_url_private.d.ts +0 -80
  69. package/esm/src/version.d.ts +1 -1
  70. package/package.json +1 -1
  71. package/umd/index.umd.js +1287 -321
  72. package/umd/index.umd.js.map +1 -1
  73. package/umd/scripts/find-refactor-candidates/RefactorCandidateLevel.d.ts +41 -0
  74. package/umd/scripts/find-refactor-candidates/analyzeSourceFileForRefactorCandidate.d.ts +5 -0
  75. package/umd/scripts/find-refactor-candidates/find-refactor-candidates.constants.d.ts +2 -14
  76. package/umd/scripts/find-refactor-candidates/find-refactor-candidates.d.ts +13 -1
  77. package/umd/scripts/find-refactor-candidates/findRefactorCandidatesInProject.d.ts +18 -1
  78. package/umd/src/_packages/components.index.d.ts +2 -0
  79. package/umd/src/_packages/types.index.d.ts +48 -46
  80. package/umd/src/book-components/Chat/Chat/ChatActionsBar.d.ts +7 -0
  81. package/umd/src/book-components/Chat/Chat/ChatActionsBar.test.d.ts +2 -0
  82. package/umd/src/book-components/Chat/Chat/ChatInputArea.d.ts +4 -0
  83. package/umd/src/book-components/Chat/Chat/ChatMessageItem.d.ts +8 -0
  84. package/umd/src/book-components/Chat/Chat/ChatMessageList.d.ts +2 -0
  85. package/umd/src/book-components/Chat/Chat/ChatProps.d.ts +50 -1
  86. package/umd/src/book-components/Chat/Chat/ChatReplyPreview.d.ts +19 -0
  87. package/umd/src/book-components/Chat/Chat/createProgressCardChecklistMarkdown.d.ts +2 -2
  88. package/umd/src/book-components/Chat/MockedChat/MockedChat.d.ts +1 -1
  89. package/umd/src/book-components/Chat/types/ChatMessage.d.ts +35 -0
  90. package/umd/src/book-components/Chat/utils/resolveChatMessageReplyPreviewText.d.ts +25 -0
  91. package/umd/src/book-components/Chat/utils/resolveChatMessageReplySenderLabel.d.ts +12 -0
  92. package/umd/src/cli/cli-commands/coder/agentCodingFile.d.ts +14 -0
  93. package/umd/src/cli/cli-commands/coder/agentsFile.d.ts +12 -0
  94. package/umd/src/cli/cli-commands/coder/appendBlock.d.ts +6 -0
  95. package/umd/src/cli/cli-commands/coder/boilerplateTemplates.d.ts +137 -0
  96. package/umd/src/cli/cli-commands/coder/boilerplateTemplates.test.d.ts +1 -0
  97. package/umd/src/cli/cli-commands/coder/ensureCoderEnvFile.d.ts +15 -0
  98. package/umd/src/cli/cli-commands/coder/ensureCoderGitignoreFile.d.ts +7 -0
  99. package/umd/src/cli/cli-commands/coder/ensureCoderMarkdownFile.d.ts +7 -0
  100. package/umd/src/cli/cli-commands/coder/ensureCoderPackageJsonFile.d.ts +7 -0
  101. package/umd/src/cli/cli-commands/coder/ensureCoderVscodeSettingsFile.d.ts +7 -0
  102. package/umd/src/cli/cli-commands/coder/ensureDirectory.d.ts +7 -0
  103. package/umd/src/cli/cli-commands/coder/find-refactor-candidates.d.ts +1 -1
  104. package/umd/src/cli/cli-commands/coder/find-refactor-candidates.test.d.ts +1 -0
  105. package/umd/src/cli/cli-commands/coder/formatDisplayPath.d.ts +6 -0
  106. package/umd/src/cli/cli-commands/coder/generate-boilerplates.d.ts +10 -0
  107. package/umd/src/cli/cli-commands/coder/getDefaultCoderPackageJsonScripts.d.ts +6 -0
  108. package/umd/src/cli/cli-commands/coder/getDefaultCoderVscodeSettings.d.ts +6 -0
  109. package/umd/src/cli/cli-commands/coder/init.d.ts +3 -0
  110. package/umd/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.d.ts +25 -0
  111. package/umd/src/cli/cli-commands/coder/mergeStringRecordJsonFile.d.ts +18 -0
  112. package/umd/src/cli/cli-commands/coder/printInitializationSummary.d.ts +7 -0
  113. package/umd/src/cli/cli-commands/coder/readTextFileIfExists.d.ts +6 -0
  114. package/umd/src/types/string_agent_url.d.ts +7 -0
  115. package/umd/src/types/string_agent_url_private.d.ts +9 -0
  116. package/umd/src/types/string_base64.d.ts +13 -0
  117. package/umd/src/types/string_base64_private.d.ts +2 -2
  118. package/umd/src/types/string_base_url.d.ts +7 -0
  119. package/umd/src/types/string_base_url_private.d.ts +9 -0
  120. package/umd/src/types/string_email.d.ts +13 -0
  121. package/umd/src/types/string_email_private.d.ts +2 -2
  122. package/umd/src/types/string_host.d.ts +42 -0
  123. package/umd/src/types/string_host_private.d.ts +7 -7
  124. package/umd/src/types/string_href.d.ts +19 -0
  125. package/umd/src/types/string_href_private.d.ts +24 -0
  126. package/umd/src/types/string_mime_type.d.ts +15 -0
  127. package/umd/src/types/string_mime_type_private.d.ts +2 -2
  128. package/umd/src/types/string_pipeline_root_url.d.ts +7 -0
  129. package/umd/src/types/string_pipeline_root_url_private.d.ts +9 -0
  130. package/umd/src/types/string_pipeline_url.d.ts +13 -0
  131. package/umd/src/types/string_pipeline_url_private.d.ts +17 -0
  132. package/umd/src/types/string_promptbook_server_url.d.ts +7 -0
  133. package/umd/src/types/string_promptbook_server_url_private.d.ts +9 -0
  134. package/umd/src/types/string_url.d.ts +14 -141
  135. package/umd/src/types/string_url_image.d.ts +7 -0
  136. package/umd/src/types/string_url_image_private.d.ts +9 -0
  137. package/umd/src/types/string_url_private.d.ts +0 -80
  138. package/umd/src/version.d.ts +1 -1
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Supported aggressiveness levels for refactor-candidate scanning.
3
+ */
4
+ export declare const REFACTOR_CANDIDATE_LEVEL_VALUES: readonly ["low", "medium", "high", "xhigh"];
5
+ /**
6
+ * Supported aggressiveness levels for refactor-candidate scanning.
7
+ */
8
+ export type RefactorCandidateLevel = (typeof REFACTOR_CANDIDATE_LEVEL_VALUES)[number];
9
+ /**
10
+ * Thresholds used when deciding whether a file should be suggested for refactoring.
11
+ */
12
+ export type RefactorCandidateLevelConfiguration = {
13
+ /**
14
+ * Fallback line-count threshold when a file extension has no dedicated entry.
15
+ */
16
+ readonly maxDefaultLineCount: number;
17
+ /**
18
+ * Per-extension line-count thresholds.
19
+ */
20
+ readonly maxLineCountByExtension: Readonly<Record<string, number>>;
21
+ /**
22
+ * Maximum number of top-level entities before a file is flagged.
23
+ */
24
+ readonly maxEntityCountPerFile: number;
25
+ /**
26
+ * Maximum number of named functions and methods before a file is flagged.
27
+ */
28
+ readonly maxFunctionCountPerFile: number;
29
+ /**
30
+ * Maximum complexity allowed for any single function in the file.
31
+ */
32
+ readonly maxFunctionComplexity: number;
33
+ };
34
+ /**
35
+ * Default aggressiveness level for refactor-candidate scanning.
36
+ */
37
+ export declare const DEFAULT_REFACTOR_CANDIDATE_LEVEL: RefactorCandidateLevel;
38
+ /**
39
+ * Resolves the thresholds for a selected refactor-candidate scanning level.
40
+ */
41
+ export declare function getRefactorCandidateLevelConfiguration(level?: RefactorCandidateLevel): RefactorCandidateLevelConfiguration;
@@ -1,4 +1,5 @@
1
1
  import type { RefactorCandidate } from './RefactorCandidate';
2
+ import type { RefactorCandidateLevelConfiguration } from './RefactorCandidateLevel';
2
3
  /**
3
4
  * Input required to analyze one source file for refactor candidacy.
4
5
  *
@@ -17,6 +18,10 @@ export type AnalyzeSourceFileForRefactorCandidateOptions = {
17
18
  * Normalized absolute paths exempt from line-count checks.
18
19
  */
19
20
  readonly lineCountExemptPaths: ReadonlySet<string>;
21
+ /**
22
+ * Thresholds used to decide whether the file should be flagged.
23
+ */
24
+ readonly heuristics: RefactorCandidateLevelConfiguration;
20
25
  };
21
26
  /**
22
27
  * Resolves whether a source file should produce a refactor candidate entry.
@@ -10,26 +10,14 @@ export declare const SOURCE_FILE_EXTENSIONS: ReadonlyArray<string>;
10
10
  * Glob patterns that should be ignored when scanning for source files.
11
11
  */
12
12
  export declare const SOURCE_FILE_IGNORE_GLOBS: ReadonlyArray<string>;
13
- /**
14
- * Default maximum line count for source files.
15
- */
16
- export declare const DEFAULT_MAX_LINE_COUNT = 2000;
17
- /**
18
- * Per-extension line count limits.
19
- */
20
- export declare const LINE_COUNT_LIMITS_BY_EXTENSION: Readonly<Record<string, number>>;
21
13
  /**
22
14
  * Glob patterns that are exempt from line-count checks.
23
15
  */
24
16
  export declare const LINE_COUNT_EXEMPT_GLOBS: ReadonlyArray<string>;
25
17
  /**
26
- * Maximum number of entities before a file is flagged.
27
- */
28
- export declare const MAX_ENTITIES_PER_FILE = 20;
29
- /**
30
- * File extensions eligible for entity counting.
18
+ * File extensions eligible for structural AST analysis.
31
19
  */
32
- export declare const ENTITY_COUNT_EXTENSIONS: ReadonlyArray<string>;
20
+ export declare const STRUCTURAL_ANALYSIS_EXTENSIONS: ReadonlyArray<string>;
33
21
  /**
34
22
  * Markers that identify generated files which should be skipped.
35
23
  */
@@ -1,6 +1,18 @@
1
+ import { type RefactorCandidateLevel } from './RefactorCandidateLevel';
1
2
  /**
2
3
  * Orchestrates scanning for refactor candidates and generating prompts.
3
4
  *
4
5
  * @public exported from `@promptbook/cli`
5
6
  */
6
- export declare function findRefactorCandidates(): Promise<void>;
7
+ export declare function findRefactorCandidates(options?: FindRefactorCandidatesOptions): Promise<void>;
8
+ /**
9
+ * Options supported by the refactor-candidate finder entrypoint.
10
+ *
11
+ * @public exported from `@promptbook/cli`
12
+ */
13
+ export type FindRefactorCandidatesOptions = {
14
+ /**
15
+ * Aggressiveness level used to score candidate files.
16
+ */
17
+ readonly level?: RefactorCandidateLevel;
18
+ };
@@ -1,7 +1,24 @@
1
1
  import type { RefactorCandidate } from './RefactorCandidate';
2
+ import type { RefactorCandidateLevelConfiguration } from './RefactorCandidateLevel';
3
+ /**
4
+ * Input required to scan one project for refactor candidates.
5
+ *
6
+ * @private type of findRefactorCandidates
7
+ */
8
+ type FindRefactorCandidatesInProjectOptions = {
9
+ /**
10
+ * Repository root to scan.
11
+ */
12
+ readonly rootDir: string;
13
+ /**
14
+ * Thresholds used to score files.
15
+ */
16
+ readonly heuristics: RefactorCandidateLevelConfiguration;
17
+ };
2
18
  /**
3
19
  * Scans the repository and returns all files that qualify as refactor candidates.
4
20
  *
5
21
  * @private function of findRefactorCandidates
6
22
  */
7
- export declare function findRefactorCandidatesInProject(rootDir: string): Promise<ReadonlyArray<RefactorCandidate>>;
23
+ export declare function findRefactorCandidatesInProject(options: FindRefactorCandidatesInProjectOptions): Promise<ReadonlyArray<RefactorCandidate>>;
24
+ export {};
@@ -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;