@promptbook/wizard 0.112.0-96 → 0.112.0-98

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.
@@ -1,5 +1,6 @@
1
1
  import { type MouseEvent, type MutableRefObject, type ReactNode } from 'react';
2
2
  import type { Promisable } from 'type-fest';
3
+ import type { ChatSaveFormatHandlerMap } from '../save/_common/ChatSaveFormatHandler';
3
4
  import type { string_chat_format_name } from '../save/_common/string_chat_format_name';
4
5
  import type { ChatMessage } from '../types/ChatMessage';
5
6
  import type { ChatParticipant } from '../types/ChatParticipant';
@@ -27,6 +28,7 @@ export type ChatActionsBarProps = {
27
28
  onUseTemplate?: () => void;
28
29
  extraActions?: ReactNode;
29
30
  saveFormats?: Array<string_chat_format_name>;
31
+ saveFormatHandlers?: ChatSaveFormatHandlerMap;
30
32
  isSaveButtonEnabled: boolean;
31
33
  shouldFadeActions: boolean;
32
34
  /**
@@ -8,6 +8,7 @@ import type { AgentChipData } from '../AgentChip/AgentChip';
8
8
  import type { string_chat_format_name } from '../save/_common/string_chat_format_name';
9
9
  import type { ChatMessage } from '../types/ChatMessage';
10
10
  import type { ChatParticipant } from '../types/ChatParticipant';
11
+ import type { ChatSaveFormatHandlerMap } from '../save/_common/ChatSaveFormatHandler';
11
12
  /**
12
13
  * Response data returned by the optional `onFeedback` handler.
13
14
  *
@@ -629,6 +630,11 @@ export type ChatProps = {
629
630
  * @default * All supported formats (see `string_chat_format_name` type)
630
631
  */
631
632
  readonly saveFormats?: Array<string_chat_format_name>;
633
+ /**
634
+ * Optional host-provided handlers that replace the default browser download flow
635
+ * for selected save formats.
636
+ */
637
+ readonly saveFormatHandlers?: ChatSaveFormatHandlerMap;
632
638
  /**
633
639
  * Is the writing textarea automatically focused?
634
640
  *
@@ -0,0 +1,35 @@
1
+ import type { Promisable } from 'type-fest';
2
+ import type { ChatMessage } from '../../types/ChatMessage';
3
+ import type { ChatParticipant } from '../../types/ChatParticipant';
4
+ import type { string_chat_format_name } from './string_chat_format_name';
5
+ /**
6
+ * Serializable chat payload exposed to custom save-format handlers.
7
+ *
8
+ * @private Internal helper for chat save integrations.
9
+ */
10
+ export type ChatSaveFormatHandlerOptions = {
11
+ /**
12
+ * Exported chat title used by downstream filename or document generation.
13
+ */
14
+ readonly title: string;
15
+ /**
16
+ * Messages included in the export.
17
+ */
18
+ readonly messages: ReadonlyArray<ChatMessage>;
19
+ /**
20
+ * Participant metadata included in the export.
21
+ */
22
+ readonly participants: ReadonlyArray<ChatParticipant>;
23
+ };
24
+ /**
25
+ * Custom handler used to override one chat save format.
26
+ *
27
+ * @private Internal helper for chat save integrations.
28
+ */
29
+ export type ChatSaveFormatHandler = (options: ChatSaveFormatHandlerOptions) => Promisable<void>;
30
+ /**
31
+ * Optional map of chat save formats handled by the host application.
32
+ *
33
+ * @private Internal helper for chat save integrations.
34
+ */
35
+ export type ChatSaveFormatHandlerMap = Partial<Record<string_chat_format_name, ChatSaveFormatHandler>>;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Builds one normalized filename for a chat export download.
3
+ *
4
+ * @param title - Human-readable chat title.
5
+ * @param fileExtension - Output file extension without a leading dot.
6
+ * @param date - Export date used in the filename.
7
+ * @returns Stable filename suitable for browser downloads and HTTP headers.
8
+ *
9
+ * @private Internal helper shared by chat export flows.
10
+ */
11
+ export declare function createChatExportFilename(title: string, fileExtension: string, date?: Date): string;
@@ -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-94`).
18
+ * It follows semantic versioning (e.g., `0.112.0-97`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/wizard",
3
- "version": "0.112.0-96",
3
+ "version": "0.112.0-98",
4
4
  "description": "Promptbook: Create persistent AI agents that turn your company's scattered knowledge into action",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -99,7 +99,7 @@
99
99
  "types": "./esm/src/_packages/wizard.index.d.ts",
100
100
  "typings": "./esm/src/_packages/wizard.index.d.ts",
101
101
  "peerDependencies": {
102
- "@promptbook/core": "0.112.0-96"
102
+ "@promptbook/core": "0.112.0-98"
103
103
  },
104
104
  "dependencies": {
105
105
  "@ai-sdk/deepseek": "0.1.17",
package/umd/index.umd.js CHANGED
@@ -49,7 +49,7 @@
49
49
  * @generated
50
50
  * @see https://github.com/webgptorg/promptbook
51
51
  */
52
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0-96';
52
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-98';
53
53
  /**
54
54
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
55
55
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -16671,7 +16671,7 @@
16671
16671
  > },
16672
16672
  */
16673
16673
  };
16674
- const knowledge = this.markdownScraper.scrape(markdownSource);
16674
+ const knowledge = await this.markdownScraper.scrape(markdownSource);
16675
16675
  await cacheFilehandler.destroy();
16676
16676
  return knowledge;
16677
16677
  }
@@ -16835,7 +16835,7 @@
16835
16835
  > },
16836
16836
  */
16837
16837
  };
16838
- const knowledge = this.documentScraper.scrape(markdownSource);
16838
+ const knowledge = await this.documentScraper.scrape(markdownSource);
16839
16839
  await cacheFilehandler.destroy();
16840
16840
  return knowledge;
16841
16841
  }