@promptbook/cli 0.112.0-104 → 0.112.0-106

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 (174) hide show
  1. package/apps/agents-server/src/app/admin/image-generator-test/ImageAttachmentsEditor.tsx +19 -3
  2. package/apps/agents-server/src/app/admin/limits/LimitsClient.tsx +11 -12
  3. package/apps/agents-server/src/app/admin/metadata/MetadataClient.tsx +34 -2
  4. package/apps/agents-server/src/app/admin/servers/CreateServerDialog.tsx +6 -1
  5. package/apps/agents-server/src/app/admin/servers/useCreateServerWizard.ts +13 -1
  6. package/apps/agents-server/src/app/agents/[agentName]/AgentChatWrapper.tsx +11 -2
  7. package/apps/agents-server/src/app/agents/[agentName]/AgentProfileChat.tsx +11 -1
  8. package/apps/agents-server/src/app/agents/[agentName]/book/BookEditorWrapper.tsx +7 -1
  9. package/apps/agents-server/src/app/agents/[agentName]/chat/CanonicalAgentChatSurface.tsx +11 -1
  10. package/apps/agents-server/src/app/agents/[agentName]/images/default-avatar.png/route.ts +6 -2
  11. package/apps/agents-server/src/app/api/images/[filename]/route.ts +6 -2
  12. package/apps/agents-server/src/app/api/internal/agent-runner-limits/route.ts +51 -0
  13. package/apps/agents-server/src/app/api/upload/route.ts +48 -12
  14. package/apps/agents-server/src/app/layout.tsx +13 -0
  15. package/apps/agents-server/src/components/FileUploadAvailability/FileUploadAvailabilityContext.tsx +50 -0
  16. package/apps/agents-server/src/components/FileUploadAvailability/FileUploadUnavailableNotice.tsx +45 -0
  17. package/apps/agents-server/src/components/LayoutWrapper/LayoutWrapper.tsx +85 -76
  18. package/apps/agents-server/src/components/NewAgentDialog/NewAgentDialog.tsx +7 -3
  19. package/apps/agents-server/src/components/NewAgentDialog/NewAgentWizardKnowledgeStep.tsx +6 -0
  20. package/apps/agents-server/src/components/NewAgentDialog/useNewAgentWizardKnowledgeState.ts +8 -1
  21. package/apps/agents-server/src/constants/serverLimits.ts +22 -2
  22. package/apps/agents-server/src/database/seedDefaultAgents.ts +218 -0
  23. package/apps/agents-server/src/tools/$provideCdnForServer.ts +72 -8
  24. package/apps/agents-server/src/utils/defaultAgents/loadDefaultAgentBooks.ts +103 -0
  25. package/apps/agents-server/src/utils/knowledge/createInlineKnowledgeSourceUploader.ts +24 -5
  26. package/apps/agents-server/src/utils/serverLimits.ts +26 -1
  27. package/apps/agents-server/src/utils/serverManagement/createManagedServer/seedServerDefaultAgents.ts +1 -85
  28. package/apps/agents-server/src/utils/shareTargetPayloads.ts +20 -2
  29. package/apps/agents-server/src/utils/upload/fileUploadAvailability.ts +91 -0
  30. package/apps/agents-server/src/utils/upload/uploadFileToServer.ts +46 -2
  31. package/esm/apps/agents-server/src/constants/federatedAgentImport.d.ts +42 -0
  32. package/esm/apps/agents-server/src/constants/serverLimits.d.ts +207 -0
  33. package/esm/apps/agents-server/src/constants/toolUsageLimits.d.ts +55 -0
  34. package/esm/index.es.js +602 -39
  35. package/esm/index.es.js.map +1 -1
  36. package/esm/scripts/run-agent-messages/main/AgentMessageFailureTracker.d.ts +27 -0
  37. package/esm/scripts/run-agent-messages/main/handleAgentWatchError.d.ts +4 -0
  38. package/esm/scripts/run-agent-messages/main/runAgentMessages.d.ts +1 -0
  39. package/esm/scripts/run-agent-messages/messages/moveAgentMessageToFailed.d.ts +17 -0
  40. package/esm/src/book-components/BookEditor/BookEditor.d.ts +5 -4
  41. package/esm/src/book-components/BookEditor/BookEditorTheme.d.ts +24 -0
  42. package/esm/src/book-components/BookEditor/useBookEditorMonacoLanguage.d.ts +1 -6
  43. package/esm/src/book-components/BookEditor/useBookEditorMonacoLifecycle.d.ts +1 -4
  44. package/esm/src/book-components/BookEditor/useBookEditorMonacoStyles.d.ts +2 -1
  45. package/esm/src/cli/cli-commands/agent-folder/agentProjectPaths.d.ts +6 -0
  46. package/esm/src/version.d.ts +1 -1
  47. package/package.json +1 -1
  48. package/src/avatars/visuals/octopus3d3AvatarVisual.ts +28 -29
  49. package/src/book-components/BookEditor/BookEditor.tsx +10 -7
  50. package/src/book-components/BookEditor/BookEditorMonaco.tsx +3 -1
  51. package/src/book-components/BookEditor/BookEditorTheme.ts +32 -0
  52. package/src/book-components/BookEditor/useBookEditorMonacoLanguage.ts +15 -15
  53. package/src/book-components/BookEditor/useBookEditorMonacoLifecycle.ts +1 -5
  54. package/src/book-components/BookEditor/useBookEditorMonacoStyles.ts +2 -1
  55. package/src/cli/cli-commands/agent-folder/agentProjectPaths.ts +7 -0
  56. package/src/cli/cli-commands/agents-server/buildAgentsServer.ts +109 -9
  57. package/src/cli/cli-commands/agents-server/startAgentsServer.ts +132 -4
  58. package/src/other/templates/getTemplatesPipelineCollection.ts +874 -760
  59. package/src/version.ts +2 -2
  60. package/src/versions.txt +2 -0
  61. package/umd/apps/agents-server/src/constants/federatedAgentImport.d.ts +42 -0
  62. package/umd/apps/agents-server/src/constants/serverLimits.d.ts +207 -0
  63. package/umd/apps/agents-server/src/constants/toolUsageLimits.d.ts +55 -0
  64. package/umd/index.umd.js +602 -39
  65. package/umd/index.umd.js.map +1 -1
  66. package/umd/scripts/run-agent-messages/main/AgentMessageFailureTracker.d.ts +27 -0
  67. package/umd/scripts/run-agent-messages/main/handleAgentWatchError.d.ts +4 -0
  68. package/umd/scripts/run-agent-messages/main/runAgentMessages.d.ts +1 -0
  69. package/umd/scripts/run-agent-messages/messages/moveAgentMessageToFailed.d.ts +17 -0
  70. package/umd/src/book-components/BookEditor/BookEditor.d.ts +5 -4
  71. package/umd/src/book-components/BookEditor/BookEditorTheme.d.ts +24 -0
  72. package/umd/src/book-components/BookEditor/useBookEditorMonacoLanguage.d.ts +1 -6
  73. package/umd/src/book-components/BookEditor/useBookEditorMonacoLifecycle.d.ts +1 -4
  74. package/umd/src/book-components/BookEditor/useBookEditorMonacoStyles.d.ts +2 -1
  75. package/umd/src/cli/cli-commands/agent-folder/agentProjectPaths.d.ts +6 -0
  76. package/umd/src/version.d.ts +1 -1
  77. package/apps/agents-server/src/message-providers/email/_common/utils/parseEmailAddress.test.ts.todo +0 -108
  78. package/apps/agents-server/src/message-providers/email/_common/utils/parseEmailAddresses.test.ts.todo +0 -117
  79. package/apps/agents-server/src/message-providers/email/_common/utils/stringifyEmailAddress.test.ts.todo +0 -119
  80. package/apps/agents-server/src/message-providers/email/_common/utils/stringifyEmailAddresses.test.ts.todo +0 -74
  81. package/apps/agents-server/src/utils/defaultAgents/defaultAgents.ts +0 -168
  82. package/apps/agents-server/src/utils/defaultAgents/installDefaultAgents.ts +0 -139
  83. package/apps/agents-server/tests/e2e/authentication-and-navigation.spec.ts.todo +0 -178
  84. package/src/_packages/browser.index.ts +0 -31
  85. package/src/_packages/browser.readme.md +0 -43
  86. package/src/book-2.0/agent-source/parseAgentSourceWithCommitments.test.ts.todo +0 -265
  87. package/src/book-components/BookEditor/BookEditorMonaco.test.tsx.todo +0 -115
  88. package/src/book-components/Chat/utils/renderMarkdown.test.ts.tmp +0 -199
  89. package/src/collection/agent-collection/constructors/agent-collection-in-directory/AgentCollectionInDirectory.test.ts.todo +0 -131
  90. package/src/commands/_common/parseCommand.test.ts.todo +0 -48
  91. package/src/commitments/META_LINK/META_LINK.test.ts.todo +0 -75
  92. package/src/conversion/validation/pipelineStringToJson-errors.test.ts.todo +0 -33
  93. package/src/dialogs/simple-prompt/SimplePromptInterfaceTools.ts +0 -51
  94. package/src/executables/browsers/locateSafari.test.ts.tmp +0 -15
  95. package/src/execution/PromptbookFetch.test-type.ts +0 -14
  96. package/src/execution/createPipelineExecutor/00-createPipelineExecutor.test.ts.todo +0 -0
  97. package/src/execution/execution-report/executionReportJsonToString.test.ts.todo +0 -83
  98. package/src/execution/utils/usageToHuman.test.ts.todo +0 -80
  99. package/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.ts +0 -76
  100. package/src/llm-providers/_common/utils/assertUniqueModels.ts +0 -27
  101. package/src/llm-providers/_multiple/playground/playground.ts +0 -141
  102. package/src/llm-providers/_multiple/playground/tsconfig.json +0 -19
  103. package/src/llm-providers/agent/playground/playground.ts +0 -190
  104. package/src/llm-providers/agent/playground/tsconfig.json +0 -19
  105. package/src/llm-providers/anthropic-claude/playground/playground.ts +0 -99
  106. package/src/llm-providers/anthropic-claude/playground/tsconfig.json +0 -19
  107. package/src/llm-providers/azure-openai/playground/playground.ts +0 -101
  108. package/src/llm-providers/azure-openai/playground/tsconfig.json +0 -19
  109. package/src/llm-providers/ollama/playground/playground.ts +0 -120
  110. package/src/llm-providers/ollama/playground/tsconfig.json +0 -19
  111. package/src/llm-providers/openai/playground/playground.ts +0 -406
  112. package/src/llm-providers/openai/playground/tsconfig.json +0 -19
  113. package/src/llm-providers/remote/playground/playground.ts +0 -144
  114. package/src/llm-providers/remote/playground/tsconfig.json +0 -19
  115. package/src/llm-providers/vercel/playground/playground.ts +0 -133
  116. package/src/llm-providers/vercel/playground/tsconfig.json +0 -19
  117. package/src/personas/preparePersona.test.ts.todo +0 -126
  118. package/src/playground/backup/_playground-boilerplate.ts.txt +0 -37
  119. package/src/playground/backup/playground-agent-os.txt +0 -62
  120. package/src/playground/backup/playground-brj-app.ts.txt +0 -302
  121. package/src/playground/backup/playground-browser-playwright.txt +0 -110
  122. package/src/playground/backup/playground-claude-mcp.txt +0 -43
  123. package/src/playground/backup/playground-document-conversion.txt +0 -84
  124. package/src/playground/backup/playground-glob.ts.txt +0 -42
  125. package/src/playground/backup/playground-mcp-server.txt +0 -1
  126. package/src/playground/backup/playground-openai-agent-kit.txt +0 -73
  127. package/src/playground/backup/playground-openai-function-calling.txt +0 -131
  128. package/src/playground/backup/playground-openai-streaming.ts.txt +0 -68
  129. package/src/playground/backup/playground-scrape-knowledge.txt +0 -65
  130. package/src/playground/backup/playground-scraperFetch.ts.txt +0 -44
  131. package/src/playground/backup/playground-using-openai-compatible-route-on-agents-server.ts.txt +0 -49
  132. package/src/playground/backup/playground-write-pavolhejny-bio.txt +0 -120
  133. package/src/playground/permanent/_boilerplate.ts +0 -54
  134. package/src/playground/permanent/agent-with-browser-playground.ts +0 -92
  135. package/src/playground/permanent/error-handling-playground.ts +0 -103
  136. package/src/playground/playground.ts +0 -36
  137. package/src/playground/tsconfig.json +0 -19
  138. package/src/scrapers/_boilerplate/BoilerplateScraper.test.ts.todo +0 -73
  139. package/src/scrapers/_boilerplate/playground/boilerplate-scraper-playground.ts +0 -79
  140. package/src/scrapers/_boilerplate/playground/tsconfig.json +0 -19
  141. package/src/scrapers/_common/utils/files/blobToDataurl.test.ts.todo +0 -17
  142. package/src/scrapers/_common/utils/files/dataurlToBlob.test.ts.todo +0 -52
  143. package/src/scrapers/_common/utils/files/isValidDataurl.test.ts.todo +0 -42
  144. package/src/scrapers/_common/utils/files/shorten.test.ts.todo +0 -13
  145. package/src/scrapers/document/playground/document-scraper-playground.ts +0 -80
  146. package/src/scrapers/document/playground/tsconfig.json +0 -19
  147. package/src/scrapers/document-legacy/playground/legacy-document-scraper-playground.ts +0 -80
  148. package/src/scrapers/document-legacy/playground/tsconfig.json +0 -19
  149. package/src/scrapers/markdown/playground/markdown-scraper-playground.ts +0 -74
  150. package/src/scrapers/markdown/playground/tsconfig.json +0 -19
  151. package/src/scrapers/markitdown/MarkitdownScraper.test.ts.todo +0 -132
  152. package/src/scrapers/markitdown/playground/markitdown-scraper-playground.ts +0 -91
  153. package/src/scrapers/markitdown/playground/tsconfig.json +0 -19
  154. package/src/scrapers/pdf/PdfScraper.test.ts.todo +0 -52
  155. package/src/scrapers/pdf/playground/pdf-scraper-playground.ts +0 -75
  156. package/src/scrapers/pdf/playground/tsconfig.json +0 -19
  157. package/src/scrapers/website/playground/tsconfig.json +0 -19
  158. package/src/scrapers/website/playground/website-scraper-playground.ts +0 -82
  159. package/src/storage/_common/PromptbookStorage.test-type.ts +0 -14
  160. package/src/storage/local-storage/getIndexedDbStorage.ts +0 -36
  161. package/src/storage/local-storage/getLocalStorage.ts +0 -33
  162. package/src/storage/local-storage/getSessionStorage.ts +0 -33
  163. package/src/storage/local-storage/utils/IndexedDbStorageOptions.ts +0 -16
  164. package/src/storage/local-storage/utils/makePromptbookStorageFromIndexedDb.ts +0 -58
  165. package/src/storage/local-storage/utils/makePromptbookStorageFromWebStorage.ts +0 -45
  166. package/src/transpilers/formatted-book-in-markdown/FormattedBookInMarkdownTranspiler.test.ts.todo +0 -35
  167. package/src/transpilers/openai-sdk/playground/playground.ts +0 -85
  168. package/src/transpilers/openai-sdk/playground/tmp/chatbot-openaisdk-1.js +0 -194
  169. package/src/transpilers/openai-sdk/playground/tmp/package.json +0 -3
  170. package/src/transpilers/openai-sdk/playground/tsconfig.json +0 -18
  171. package/src/utils/editable/utils/findUsableParameters.test.ts.todo +0 -43
  172. package/src/utils/editable/utils/stringifyPipelineJson.test.ts.todo +0 -38
  173. package/src/utils/markdown/prettifyMarkdown.test.ts.tmp +0 -42
  174. package/src/utils/serialization/serializeToPromptbookJavascript.test.ts.todo +0 -116
@@ -0,0 +1,27 @@
1
+ import type { AgentMessageFile } from '../messages/AgentMessageFile';
2
+ /**
3
+ * Result of recording one failed queued-message attempt.
4
+ */
5
+ export type AgentMessageFailureTrackingResult = {
6
+ readonly failureCount: number;
7
+ readonly maxMessageProcessingFailures: number;
8
+ readonly isMessageMovedToFailed: boolean;
9
+ };
10
+ /**
11
+ * Tracks repeated watch-level failures for queued message files and stops retrying them after a configured cap.
12
+ */
13
+ export declare class AgentMessageFailureTracker {
14
+ private readonly failuresByMessageKey;
15
+ private readonly maxMessageProcessingFailures;
16
+ constructor(options?: {
17
+ readonly maxMessageProcessingFailures?: number;
18
+ });
19
+ /**
20
+ * Clears the failure counter after a queued message is processed successfully.
21
+ */
22
+ clearMessageFailure(projectPath: string, messageFile: AgentMessageFile | undefined): void;
23
+ /**
24
+ * Records one queued-message failure and moves the message into `messages/failed` when the retry cap is reached.
25
+ */
26
+ recordFailure(error: unknown): Promise<AgentMessageFailureTrackingResult | null>;
27
+ }
@@ -19,3 +19,7 @@ export declare function handleAgentWatchError(options: {
19
19
  readonly logDirectoryPath: string;
20
20
  readonly error: unknown;
21
21
  }): Promise<void>;
22
+ /**
23
+ * Recovers previously attached watch-loop context from an error-like value.
24
+ */
25
+ export declare function getAgentWatchErrorContext(error: unknown): AgentWatchErrorContext | undefined;
@@ -4,4 +4,5 @@ import type { AgentRunOptions } from '../AgentRunOptions';
4
4
  */
5
5
  export declare function runAgentMessages(options: AgentRunOptions, controls?: {
6
6
  readonly shouldContinue?: () => boolean;
7
+ readonly queuePollIntervalMs?: number;
7
8
  }): Promise<void>;
@@ -0,0 +1,17 @@
1
+ import type { AgentMessageFile } from './AgentMessageFile';
2
+ /**
3
+ * Result of moving one abandoned queued message into the failed queue.
4
+ */
5
+ export type FailedAgentMessageFile = {
6
+ readonly absolutePath: string;
7
+ readonly relativePath: string;
8
+ readonly fileName: string;
9
+ };
10
+ /**
11
+ * Moves one repeatedly failing queued message to `messages/failed` with a visible agent failure reply.
12
+ */
13
+ export declare function moveAgentMessageToFailed(options: {
14
+ readonly projectPath: string;
15
+ readonly messageFile: AgentMessageFile;
16
+ readonly failureReason: string;
17
+ }): Promise<FailedAgentMessageFile>;
@@ -6,6 +6,7 @@ import type { number_positive } from '../../types/number_positive';
6
6
  import type { string_knowledge_source_content } from '../../types/string_knowledge_source_content';
7
7
  import type { string_css_value } from '../../types/string_markdown';
8
8
  import type { HoistedMenuItem } from '../_common/MenuHoisting/MenuHoistingContext';
9
+ import type { BookEditorTheme } from './BookEditorTheme';
9
10
  /**
10
11
  * Monaco diagnostic shown inside `BookEditor`.
11
12
  *
@@ -94,14 +95,14 @@ export type BookEditorProps = {
94
95
  */
95
96
  readonly style?: CSSProperties;
96
97
  /**
97
- * Resolved visual theme used for the editor wrapper and Monaco instance.
98
+ * Resolved host application theme.
98
99
  *
99
- * Host applications should pass the final light/dark theme instead of relying on
100
- * browser media-query inference inside `<BookEditor/>`.
100
+ * `<BookEditor/>` accepts this for integration compatibility, but the notebook
101
+ * editor itself is intentionally rendered as light paper in every app theme.
101
102
  *
102
103
  * @default 'LIGHT'
103
104
  */
104
- readonly theme?: 'LIGHT' | 'DARK';
105
+ readonly theme?: BookEditorTheme;
105
106
  /**
106
107
  * Height of the `BookEditor` component
107
108
  *
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Visual theme accepted by `<BookEditor/>` integrations.
3
+ *
4
+ * @private internal type of `BookEditor`
5
+ */
6
+ export type BookEditorTheme = 'LIGHT' | 'DARK';
7
+ /**
8
+ * Theme used for the actual notebook editor surface.
9
+ *
10
+ * The host application can still pass its resolved app theme, but book sources
11
+ * are intentionally rendered as light paper in both light and dark app modes.
12
+ *
13
+ * @private internal constant of `BookEditor`
14
+ */
15
+ export declare const BOOK_EDITOR_RENDER_THEME = "LIGHT";
16
+ /**
17
+ * Resolves an app-level theme into the visual theme used by `<BookEditor/>`.
18
+ *
19
+ * @param hostTheme - Resolved theme from the embedding application.
20
+ * @returns Light theme used by the Book editor surface.
21
+ *
22
+ * @private internal utility of `BookEditor`
23
+ */
24
+ export declare function resolveBookEditorRenderTheme(hostTheme?: BookEditorTheme): BookEditorTheme;
@@ -1,14 +1,9 @@
1
1
  import type { editor } from 'monaco-editor';
2
+ import type { BookEditorTheme } from './BookEditorTheme';
2
3
  /**
3
4
  * Type describing monaco editor.
4
5
  */
5
6
  type MonacoEditor = typeof import('monaco-editor');
6
- /**
7
- * Resolved visual theme supported by the Book editor.
8
- *
9
- * @private function of BookEditorMonaco
10
- */
11
- type BookEditorTheme = 'LIGHT' | 'DARK';
12
7
  /**
13
8
  * Props for use book editor monaco language.
14
9
  */
@@ -1,12 +1,9 @@
1
1
  import type { editor } from 'monaco-editor';
2
+ import type { BookEditorTheme } from './BookEditorTheme';
2
3
  /**
3
4
  * Type describing monaco editor.
4
5
  */
5
6
  type MonacoEditor = typeof import('monaco-editor');
6
- /**
7
- * Resolved visual theme supported by the Book editor.
8
- */
9
- type BookEditorTheme = 'LIGHT' | 'DARK';
10
7
  /**
11
8
  * Props for use book editor monaco lifecycle.
12
9
  */
@@ -1,3 +1,4 @@
1
+ import type { BookEditorTheme } from './BookEditorTheme';
1
2
  /**
2
3
  * Props for use book editor monaco styles.
3
4
  */
@@ -7,7 +8,7 @@ type UseBookEditorMonacoStylesProps = {
7
8
  readonly scaledContentPaddingLeft: number;
8
9
  readonly scaledVerticalLineLeft: number;
9
10
  readonly zoomLevel: number;
10
- readonly theme: 'LIGHT' | 'DARK';
11
+ readonly theme: BookEditorTheme;
11
12
  };
12
13
  /**
13
14
  * Injects notebook-inspired styling that is unique per `BookEditorMonaco` instance.
@@ -28,6 +28,12 @@ export declare const AGENT_QUEUED_MESSAGES_DIRECTORY_PATH: string;
28
28
  * @private internal utility of `ptbk agent-folder`
29
29
  */
30
30
  export declare const AGENT_FINISHED_MESSAGES_DIRECTORY_PATH: string;
31
+ /**
32
+ * Relative path to messages that the agent runner stopped retrying.
33
+ *
34
+ * @private internal utility of `ptbk agent-folder`
35
+ */
36
+ export declare const AGENT_FAILED_MESSAGES_DIRECTORY_PATH: string;
31
37
  /**
32
38
  * Relative path to generated local agent documentation initialized by `ptbk agent-folder init`.
33
39
  *
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
15
15
  export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
16
16
  /**
17
17
  * Represents the version string of the Promptbook engine.
18
- * It follows semantic versioning (e.g., `0.112.0-102`).
18
+ * It follows semantic versioning (e.g., `0.112.0-105`).
19
19
  *
20
20
  * @generated
21
21
  */
@@ -1,108 +0,0 @@
1
- import { describe, expect, it } from '@jest/globals';
2
- import { parseEmailAddress } from './parseEmailAddress';
3
-
4
- describe('how parseEmailAddress works', () => {
5
- it('should work with simple email', () => {
6
- expect(parseEmailAddress('pavol@webgpt.cz')).toEqual({
7
- fullName: null,
8
- baseEmail: 'pavol@webgpt.cz',
9
- fullEmail: 'pavol@webgpt.cz',
10
- plus: [],
11
- });
12
- expect(parseEmailAddress('jirka@webgpt.cz')).toEqual({
13
- fullName: null,
14
- baseEmail: 'jirka@webgpt.cz',
15
- fullEmail: 'jirka@webgpt.cz',
16
- plus: [],
17
- });
18
- expect(parseEmailAddress('tomas@webgpt.cz')).toEqual({
19
- fullName: null,
20
- baseEmail: 'tomas@webgpt.cz',
21
- fullEmail: 'tomas@webgpt.cz',
22
- plus: [],
23
- });
24
- });
25
-
26
- it('should work with fullname', () => {
27
- expect(parseEmailAddress('Pavol Hejný <pavol@webgpt.cz>')).toEqual({
28
- fullName: 'Pavol Hejný',
29
- baseEmail: 'pavol@webgpt.cz',
30
- fullEmail: 'pavol@webgpt.cz',
31
- plus: [],
32
- });
33
- expect(parseEmailAddress('Jirka <jirka@webgpt.cz>')).toEqual({
34
- fullName: 'Jirka',
35
- baseEmail: 'jirka@webgpt.cz',
36
- fullEmail: 'jirka@webgpt.cz',
37
- plus: [],
38
- });
39
- expect(parseEmailAddress('"Tomáš Studeník" <tomas@webgpt.cz>')).toEqual({
40
- fullName: 'Tomáš Studeník',
41
- baseEmail: 'tomas@webgpt.cz',
42
- fullEmail: 'tomas@webgpt.cz',
43
- plus: [],
44
- });
45
- });
46
-
47
- it('should work with plus', () => {
48
- expect(parseEmailAddress('pavol+test@webgpt.cz')).toEqual({
49
- fullName: null,
50
- baseEmail: 'pavol@webgpt.cz',
51
- fullEmail: 'pavol+test@webgpt.cz',
52
- plus: ['test'],
53
- });
54
- expect(parseEmailAddress('jirka+test@webgpt.cz')).toEqual({
55
- fullName: null,
56
- baseEmail: 'jirka@webgpt.cz',
57
- fullEmail: 'jirka+test@webgpt.cz',
58
- plus: ['test'],
59
- });
60
- expect(parseEmailAddress('tomas+test+ainautes@webgpt.cz')).toEqual({
61
- fullName: null,
62
- baseEmail: 'tomas@webgpt.cz',
63
- fullEmail: 'tomas+test+ainautes@webgpt.cz',
64
- plus: ['test', 'ainautes'],
65
- });
66
- });
67
-
68
- it('should work with both fullname and plus', () => {
69
- expect(parseEmailAddress('Pavol Hejný <pavol+foo@webgpt.cz>')).toEqual({
70
- fullName: 'Pavol Hejný',
71
- baseEmail: 'pavol@webgpt.cz',
72
- fullEmail: 'pavol+foo@webgpt.cz',
73
- plus: ['foo'],
74
- });
75
- expect(parseEmailAddress('Jirka <jirka+test@webgpt.cz>')).toEqual({
76
- fullName: 'Jirka',
77
- baseEmail: 'jirka@webgpt.cz',
78
- fullEmail: 'jirka+test@webgpt.cz',
79
- plus: ['test'],
80
- });
81
- expect(parseEmailAddress('"Tomáš Studeník" <tomas+test+ainautes@webgpt.cz>')).toEqual({
82
- fullName: 'Tomáš Studeník',
83
- baseEmail: 'tomas@webgpt.cz',
84
- fullEmail: 'tomas+test+ainautes@webgpt.cz',
85
- plus: ['test', 'ainautes'],
86
- });
87
- });
88
-
89
- it('throws on multiple adresses', () => {
90
- expect(() => parseEmailAddress('Pavol <pavol@webgpt.cz>, Jirka <jirka@webgpt.cz>')).toThrowError(
91
- /Seems like you are trying to parse multiple email addresses/,
92
- );
93
- });
94
-
95
- it('throws on invalid email adresses', () => {
96
- expect(() => parseEmailAddress('')).toThrowError(/Invalid email address/);
97
- expect(() => parseEmailAddress('Pavol Hejný')).toThrowError(/Invalid email address/);
98
- expect(() => parseEmailAddress('Pavol Hejný <>')).toThrowError(/Invalid email address/);
99
- expect(() => parseEmailAddress('Pavol Hejný <@webgpt.cz>')).toThrowError(/Invalid email address/);
100
- expect(() => parseEmailAddress('Pavol Hejný <webgpt.cz>')).toThrowError(/Invalid email address/);
101
- expect(() => parseEmailAddress('Pavol Hejný <pavol@>')).toThrowError(/Invalid email address/);
102
- expect(() => parseEmailAddress('Pavol Hejný <a@b>')).toThrowError(/Invalid email address/);
103
- });
104
- });
105
-
106
- /**
107
- * TODO: [🐫] This test fails because of aliased imports `import type { string_emails } from '@promptbook-local/types';`, fix it
108
- */
@@ -1,117 +0,0 @@
1
- import { describe, expect, it } from '@jest/globals';
2
- import { parseEmailAddresses } from './parseEmailAddresses';
3
-
4
- describe('how parseEmailAddresses works', () => {
5
- it('should work with single email', () => {
6
- expect(parseEmailAddresses('pavol@webgpt.cz')).toEqual([
7
- {
8
- fullName: null,
9
- baseEmail: 'pavol@webgpt.cz',
10
- fullEmail: 'pavol@webgpt.cz',
11
- plus: [],
12
- },
13
- ]);
14
- });
15
-
16
- it('should work with simple emails', () => {
17
- expect(parseEmailAddresses('pavol@webgpt.cz, jirka@webgpt.cz, tomas@webgpt.cz')).toEqual([
18
- {
19
- fullName: null,
20
- baseEmail: 'pavol@webgpt.cz',
21
- fullEmail: 'pavol@webgpt.cz',
22
- plus: [],
23
- },
24
- {
25
- fullName: null,
26
- baseEmail: 'jirka@webgpt.cz',
27
- fullEmail: 'jirka@webgpt.cz',
28
- plus: [],
29
- },
30
- {
31
- fullName: null,
32
- baseEmail: 'tomas@webgpt.cz',
33
- fullEmail: 'tomas@webgpt.cz',
34
- plus: [],
35
- },
36
- ]);
37
- });
38
-
39
- it('should work with fullname', () => {
40
- expect(
41
- parseEmailAddresses(
42
- 'Pavol Hejný <pavol@webgpt.cz>, Jirka <jirka@webgpt.cz>, "Tomáš Studeník" <tomas@webgpt.cz>',
43
- ),
44
- ).toEqual([
45
- {
46
- fullName: 'Pavol Hejný',
47
- baseEmail: 'pavol@webgpt.cz',
48
- fullEmail: 'pavol@webgpt.cz',
49
- plus: [],
50
- },
51
- {
52
- fullName: 'Jirka',
53
- baseEmail: 'jirka@webgpt.cz',
54
- fullEmail: 'jirka@webgpt.cz',
55
- plus: [],
56
- },
57
- {
58
- fullName: 'Tomáš Studeník',
59
- baseEmail: 'tomas@webgpt.cz',
60
- fullEmail: 'tomas@webgpt.cz',
61
- plus: [],
62
- },
63
- ]);
64
- });
65
-
66
- it('not confused by comma', () => {
67
- expect(parseEmailAddresses(', pavol@webgpt.cz, ')).toEqual([
68
- {
69
- fullName: null,
70
- fullEmail: 'pavol@webgpt.cz',
71
- baseEmail: 'pavol@webgpt.cz',
72
- plus: [],
73
- },
74
- ]);
75
- });
76
-
77
- it('works on real-life example', () => {
78
- expect(
79
- parseEmailAddresses(
80
- '"bob" <bob@bot.webgpt.cz>, "pavolto" <pavol+to@ptbk.io>, "Pavol" <pavol@collboard.com>',
81
- ),
82
- ).toEqual([
83
- {
84
- fullName: 'bob',
85
- fullEmail: 'bob@bot.webgpt.cz',
86
- baseEmail: 'bob@bot.webgpt.cz',
87
- plus: [],
88
- },
89
- {
90
- fullName: 'pavolto',
91
- fullEmail: 'pavol+to@ptbk.io',
92
- baseEmail: 'pavol@ptbk.io',
93
- plus: ['to'],
94
- },
95
- {
96
- fullName: 'Pavol',
97
- fullEmail: 'pavol@collboard.com',
98
- baseEmail: 'pavol@collboard.com',
99
- plus: [],
100
- },
101
- ]);
102
- });
103
-
104
- it('throws on invalid email adresses', () => {
105
- expect(() => parseEmailAddresses('Pavol, Hejný')).toThrowError(/Invalid email address/);
106
- expect(() => parseEmailAddresses('Pavol Hejný <>')).toThrowError(/Invalid email address/);
107
- expect(() => parseEmailAddresses('Pavol Hejný, <@webgpt.cz>')).toThrowError(/Invalid email address/);
108
- expect(() => parseEmailAddresses('Pavol Hejný <webgpt.cz>')).toThrowError(/Invalid email address/);
109
- expect(() => parseEmailAddresses('Pavol Hejný <pavol@>')).toThrowError(/Invalid email address/);
110
- expect(() => parseEmailAddresses('Pavol Hejný <a@b>,')).toThrowError(/Invalid email address/);
111
- });
112
- });
113
-
114
-
115
- /**
116
- * TODO: [🐫] This test fails because of aliased imports `import type { string_emails } from '@promptbook-local/types';`, fix it
117
- */
@@ -1,119 +0,0 @@
1
- import { describe, expect, it } from '@jest/globals';
2
- import { stringifyEmailAddress } from './stringifyEmailAddress';
3
-
4
- describe('how stringifyEmailAddress works', () => {
5
- it('should work with simple email', () => {
6
- expect(
7
- stringifyEmailAddress({
8
- fullName: null,
9
- baseEmail: 'pavol@webgpt.cz',
10
- fullEmail: 'pavol@webgpt.cz',
11
- plus: [],
12
- }),
13
- ).toBe('pavol@webgpt.cz');
14
- expect(
15
- stringifyEmailAddress({
16
- fullName: null,
17
- baseEmail: 'jirka@webgpt.cz',
18
- fullEmail: 'jirka@webgpt.cz',
19
- plus: [],
20
- }),
21
- ).toBe('jirka@webgpt.cz');
22
- expect(
23
- stringifyEmailAddress({
24
- fullName: null,
25
- baseEmail: 'tomas@webgpt.cz',
26
- fullEmail: 'tomas@webgpt.cz',
27
- plus: [],
28
- }),
29
- ).toBe('tomas@webgpt.cz');
30
- });
31
-
32
- it('should work with fullname', () => {
33
- expect(
34
- stringifyEmailAddress({
35
- fullName: 'Pavol Hejný',
36
- baseEmail: 'pavol@webgpt.cz',
37
- fullEmail: 'pavol@webgpt.cz',
38
- plus: [],
39
- }),
40
- ).toBe('"Pavol Hejný" <pavol@webgpt.cz>');
41
- expect(
42
- stringifyEmailAddress({
43
- fullName: 'Jirka',
44
- baseEmail: 'jirka@webgpt.cz',
45
- fullEmail: 'jirka@webgpt.cz',
46
- plus: [],
47
- }),
48
- ).toBe('"Jirka" <jirka@webgpt.cz>');
49
- expect(
50
- stringifyEmailAddress({
51
- fullName: 'Tomáš Studeník',
52
- baseEmail: 'tomas@webgpt.cz',
53
- fullEmail: 'tomas@webgpt.cz',
54
- plus: [],
55
- }),
56
- ).toBe('"Tomáš Studeník" <tomas@webgpt.cz>');
57
- });
58
-
59
- it('should work with plus', () => {
60
- expect(
61
- stringifyEmailAddress({
62
- fullName: null,
63
- baseEmail: 'pavol@webgpt.cz',
64
- fullEmail: 'pavol+test@webgpt.cz',
65
- plus: ['test'],
66
- }),
67
- ).toBe('pavol+test@webgpt.cz');
68
- expect(
69
- stringifyEmailAddress({
70
- fullName: null,
71
- baseEmail: 'jirka@webgpt.cz',
72
- fullEmail: 'jirka+test@webgpt.cz',
73
- plus: ['test'],
74
- }),
75
- ).toBe('jirka+test@webgpt.cz');
76
- expect(
77
- stringifyEmailAddress({
78
- fullName: null,
79
- baseEmail: 'tomas@webgpt.cz',
80
- fullEmail: 'tomas+test+ainautes@webgpt.cz',
81
- plus: ['test', 'ainautes'],
82
- }),
83
- ).toBe('tomas+test+ainautes@webgpt.cz');
84
- });
85
-
86
- it('should work with both fullname and plus', () => {
87
- expect(
88
- stringifyEmailAddress({
89
- fullName: 'Pavol Hejný',
90
- baseEmail: 'pavol@webgpt.cz',
91
- fullEmail: 'pavol+test@webgpt.cz',
92
- plus: ['test'],
93
- }),
94
- ).toBe('"Pavol Hejný" <pavol+test@webgpt.cz>');
95
- expect(
96
- stringifyEmailAddress({
97
- fullName: 'Jirka',
98
- baseEmail: 'jirka@webgpt.cz',
99
- fullEmail: 'jirka+test@webgpt.cz',
100
- plus: ['test'],
101
- }),
102
- ).toBe('"Jirka" <jirka+test@webgpt.cz>');
103
- expect(
104
- stringifyEmailAddress({
105
- fullName: 'Tomáš Studeník',
106
- baseEmail: 'tomas@webgpt.cz',
107
- fullEmail: 'tomas+test+ainautes@webgpt.cz',
108
- plus: ['test', 'ainautes'],
109
- }),
110
- ).toBe('"Tomáš Studeník" <tomas+test+ainautes@webgpt.cz>');
111
- });
112
-
113
- // TODO: [🎾] Implement and test here escaping
114
- });
115
-
116
-
117
- /**
118
- * TODO: [🐫] This test fails because of aliased imports `import type { string_emails } from '@promptbook-local/types';`, fix it
119
- */
@@ -1,74 +0,0 @@
1
- import { describe, expect, it } from '@jest/globals';
2
- import { stringifyEmailAddresses } from './stringifyEmailAddresses';
3
-
4
- describe('how stringifyEmailAddresses works', () => {
5
- it('should work with single email', () => {
6
- expect(
7
- stringifyEmailAddresses([
8
- {
9
- fullName: null,
10
- baseEmail: 'pavol@webgpt.cz',
11
- fullEmail: 'pavol@webgpt.cz',
12
- plus: [],
13
- },
14
- ]),
15
- ).toEqual('pavol@webgpt.cz');
16
- });
17
-
18
- it('should work with simple emails', () => {
19
- expect(
20
- stringifyEmailAddresses([
21
- {
22
- fullName: null,
23
- baseEmail: 'pavol@webgpt.cz',
24
- fullEmail: 'pavol@webgpt.cz',
25
- plus: [],
26
- },
27
- {
28
- fullName: null,
29
- baseEmail: 'jirka@webgpt.cz',
30
- fullEmail: 'jirka@webgpt.cz',
31
- plus: [],
32
- },
33
- {
34
- fullName: null,
35
- baseEmail: 'tomas@webgpt.cz',
36
- fullEmail: 'tomas@webgpt.cz',
37
- plus: [],
38
- },
39
- ]),
40
- ).toEqual('pavol@webgpt.cz, jirka@webgpt.cz, tomas@webgpt.cz');
41
- });
42
-
43
- it('should work with fullname', () => {
44
- expect(
45
- stringifyEmailAddresses([
46
- {
47
- fullName: 'Pavol Hejný',
48
- baseEmail: 'pavol@webgpt.cz',
49
- fullEmail: 'pavol@webgpt.cz',
50
- plus: [],
51
- },
52
- {
53
- fullName: 'Jiří Jahn',
54
- baseEmail: 'jirka@webgpt.cz',
55
- fullEmail: 'jirka@webgpt.cz',
56
- plus: [],
57
- },
58
- {
59
- fullName: 'Tomáš Studeník',
60
- baseEmail: 'tomas@webgpt.cz',
61
- fullEmail: 'tomas@webgpt.cz',
62
- plus: [],
63
- },
64
- ]),
65
- ).toEqual('"Pavol Hejný" <pavol@webgpt.cz>, "Jiří Jahn" <jirka@webgpt.cz>, "Tomáš Studeník" <tomas@webgpt.cz>');
66
- });
67
-
68
- // TODO: [🎾] Implement and test here escaping
69
- });
70
-
71
-
72
- /**
73
- * TODO: [🐫] This test fails because of aliased imports `import type { string_emails } from '@promptbook-local/types';`, fix it
74
- */