conversationalist 0.0.5 → 0.0.7

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.
package/dist/schemas.d.ts CHANGED
@@ -17,6 +17,7 @@ export declare const messageInputSchema: z.ZodType<MessageInput>;
17
17
  export declare const messageJSONSchema: z.ZodType<MessageJSON>;
18
18
  export declare const conversationStatusSchema: z.ZodType<ConversationStatus>;
19
19
  export declare const conversationShape: {
20
+ readonly schemaVersion: z.ZodNumber;
20
21
  readonly id: z.ZodString;
21
22
  readonly title: z.ZodOptional<z.ZodString>;
22
23
  readonly status: z.ZodType<ConversationStatus, unknown, z.core.$ZodTypeInternals<ConversationStatus, unknown>>;
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EACV,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EACZ,WAAW,EACX,WAAW,EACX,UAAU,EACV,QAAQ,EACR,UAAU,EACX,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,uBAAuB;;;;;;;;2BAQlC,CAAC;AAEH,eAAO,MAAM,iBAAiB,EAQb,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;AAExC,eAAO,MAAM,cAAc,EAIV,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AAErC,eAAO,MAAM,gBAAgB,EAIZ,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAEvC,eAAO,MAAM,gBAAgB,EAIZ,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAEvC,eAAO,MAAM,kBAAkB,EASd,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;AAEzC,eAAO,MAAM,iBAAiB,EAcC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;AAEtD,eAAO,MAAM,wBAAwB,EAIpB,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAG/C,eAAO,MAAM,iBAAiB;;;;;;;;;CASpB,CAAC;AAEX,eAAO,MAAM,kBAAkB,EAEf,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC"}
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EACV,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EACZ,WAAW,EACX,WAAW,EACX,UAAU,EACV,QAAQ,EACR,UAAU,EACX,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,uBAAuB;;;;;;;;2BAQlC,CAAC;AAEH,eAAO,MAAM,iBAAiB,EAQb,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;AAExC,eAAO,MAAM,cAAc,EAIV,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AAErC,eAAO,MAAM,gBAAgB,EAIZ,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAEvC,eAAO,MAAM,gBAAgB,EAIZ,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAEvC,eAAO,MAAM,kBAAkB,EASd,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;AAEzC,eAAO,MAAM,iBAAiB,EAcC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;AAEtD,eAAO,MAAM,wBAAwB,EAIpB,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAG/C,eAAO,MAAM,iBAAiB;;;;;;;;;;CAUpB,CAAC;AAEX,eAAO,MAAM,kBAAkB,EAEf,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC"}
package/dist/types.d.ts CHANGED
@@ -1,4 +1,9 @@
1
1
  import type { MultiModalContent } from '@lasercat/homogenaize';
2
+ /**
3
+ * Current schema version for ConversationJSON.
4
+ * Increment when making breaking changes to the schema.
5
+ */
6
+ export declare const CURRENT_SCHEMA_VERSION = 1;
2
7
  export type MessageRole = 'user' | 'assistant' | 'system' | 'developer' | 'tool-use' | 'tool-result' | 'snapshot';
3
8
  export interface ToolCall {
4
9
  id: string;
@@ -56,6 +61,7 @@ export interface Message {
56
61
  }
57
62
  export type ConversationStatus = 'active' | 'archived' | 'deleted';
58
63
  export interface ConversationJSON {
64
+ schemaVersion: number;
59
65
  id: string;
60
66
  title?: string | undefined;
61
67
  status: ConversationStatus;
@@ -97,4 +103,46 @@ export interface ConversationHistoryJSON {
97
103
  root: HistoryNodeJSON;
98
104
  currentPath: number[];
99
105
  }
106
+ /**
107
+ * Base options for all export operations.
108
+ */
109
+ export interface ExportOptions {
110
+ /**
111
+ * When true, produces deterministic output with sorted keys and messages.
112
+ * Useful for testing, diffing, and content-addressable storage.
113
+ * @default false
114
+ */
115
+ deterministic?: boolean;
116
+ /**
117
+ * When true, strips transient metadata (keys starting with '_').
118
+ * @default false
119
+ */
120
+ stripTransient?: boolean;
121
+ /**
122
+ * When true, redacts tool call arguments with '[REDACTED]'.
123
+ * @default false
124
+ */
125
+ redactToolArguments?: boolean;
126
+ /**
127
+ * When true, redacts tool result content with '[REDACTED]'.
128
+ * @default false
129
+ */
130
+ redactToolResults?: boolean;
131
+ }
132
+ /**
133
+ * Options for exporting to markdown format.
134
+ */
135
+ export interface ToMarkdownOptions extends ExportOptions {
136
+ /**
137
+ * When true, includes YAML frontmatter with full metadata for lossless round-trip.
138
+ * Headers include message ID: `### Role (msg-id)`
139
+ * @default false
140
+ */
141
+ includeMetadata?: boolean;
142
+ }
143
+ /**
144
+ * Options for serializing conversations to JSON.
145
+ * Alias for ExportOptions for API consistency.
146
+ */
147
+ export type SerializeOptions = ExportOptions;
100
148
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types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I,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC5B,QAAQ,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,MAAM,CAAC;AAE1D;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,YAAY,KAAK,YAAY,CAAC;AAElE;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,gBAAgB,CAAC;IAC/B,QAAQ,EAAE,eAAe,EAAE,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,eAAe,CAAC;IACtB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAE9B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,aAAa;IACtD;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,aAAa,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { MultiModalContent } from '@lasercat/homogenaize';
2
+ /**
3
+ * Converts content to a multi-modal array format.
4
+ * Wraps strings in a text content object, normalizes single items to arrays.
5
+ */
6
+ export declare function toMultiModalArray(input: string | MultiModalContent | MultiModalContent[]): MultiModalContent[];
7
+ /**
8
+ * Normalizes content to either a string or multi-modal array.
9
+ * Single MultiModalContent items are wrapped in an array.
10
+ */
11
+ export declare function normalizeContent(content?: string | MultiModalContent | MultiModalContent[]): string | MultiModalContent[] | undefined;
12
+ //# sourceMappingURL=content.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../src/utilities/content.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,GAAG,iBAAiB,GAAG,iBAAiB,EAAE,GACtD,iBAAiB,EAAE,CAGrB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,CAAC,EAAE,MAAM,GAAG,iBAAiB,GAAG,iBAAiB,EAAE,GACzD,MAAM,GAAG,iBAAiB,EAAE,GAAG,SAAS,CAI1C"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Recursively sorts object keys alphabetically for deterministic JSON output.
3
+ * Arrays are processed recursively but maintain their element order.
4
+ * Primitives and null are returned as-is.
5
+ *
6
+ * @param obj - The value to process
7
+ * @returns A new object with sorted keys (or the original value for non-objects)
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * sortObjectKeys({ z: 1, a: 2 });
12
+ * // Returns: { a: 2, z: 1 }
13
+ *
14
+ * sortObjectKeys({ b: { y: 1, x: 2 }, a: 1 });
15
+ * // Returns: { a: 1, b: { x: 2, y: 1 } }
16
+ * ```
17
+ */
18
+ export declare function sortObjectKeys<T>(obj: T): T;
19
+ /**
20
+ * Sorts messages by position for deterministic output.
21
+ * When positions are equal, falls back to createdAt, then id.
22
+ *
23
+ * @param messages - Array of messages to sort
24
+ * @returns A new sorted array (does not mutate the original)
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * const sorted = sortMessagesByPosition(messages);
29
+ * // Messages are ordered by position (ascending)
30
+ * ```
31
+ */
32
+ export declare function sortMessagesByPosition<T extends {
33
+ position: number;
34
+ createdAt: string;
35
+ id: string;
36
+ }>(messages: readonly T[]): T[];
37
+ //# sourceMappingURL=deterministic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deterministic.d.ts","sourceRoot":"","sources":["../../src/utilities/deterministic.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAiB3C;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CACpC,CAAC,SAAS;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,EAC7D,QAAQ,EAAE,SAAS,CAAC,EAAE,GAAG,CAAC,EAAE,CAU7B"}
@@ -0,0 +1,10 @@
1
+ export type { ToMarkdownOptions } from '../types';
2
+ export { normalizeContent, toMultiModalArray } from './content';
3
+ export { sortMessagesByPosition, sortObjectKeys } from './deterministic';
4
+ export { fromMarkdown, getRoleFromLabel, getRoleLabel, LABEL_TO_ROLE, MarkdownParseError, ROLE_LABELS, toMarkdown, } from './markdown';
5
+ export { createMessage, messageHasImages, messageParts, messageText, messageToJSON, messageToString, } from './message';
6
+ export type { ToolCallPair } from './tool-calls';
7
+ export { pairToolCallsWithResults } from './tool-calls';
8
+ export { isTransientKey, stripTransientFromRecord, stripTransientMetadata, } from './transient';
9
+ export { hasOwnProperty, toReadonly } from './type-helpers';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utilities/index.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAGlD,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAGhE,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGzE,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,WAAW,EACX,UAAU,GACX,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,aAAa,EACb,eAAe,GAChB,MAAM,WAAW,CAAC;AAGnB,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAGxD,OAAO,EACL,cAAc,EACd,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,102 @@
1
+ import type { Conversation, MessageRole, ToMarkdownOptions } from '../types';
2
+ /**
3
+ * Maps message roles to human-readable display labels.
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * ROLE_LABELS['tool-use']; // 'Tool Use'
8
+ * ROLE_LABELS.assistant; // 'Assistant'
9
+ * ```
10
+ */
11
+ export declare const ROLE_LABELS: Record<MessageRole, string>;
12
+ /**
13
+ * Maps display labels back to message roles.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * LABEL_TO_ROLE['Tool Use']; // 'tool-use'
18
+ * LABEL_TO_ROLE.User; // 'user'
19
+ * ```
20
+ */
21
+ export declare const LABEL_TO_ROLE: Record<string, MessageRole>;
22
+ /**
23
+ * Gets the human-readable display label for a message role.
24
+ *
25
+ * @param role - The message role
26
+ * @returns The display label for the role
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * getRoleLabel('assistant'); // 'Assistant'
31
+ * getRoleLabel('tool-use'); // 'Tool Use'
32
+ * ```
33
+ */
34
+ export declare function getRoleLabel(role: MessageRole): string;
35
+ /**
36
+ * Gets the message role from a display label.
37
+ *
38
+ * @param label - The display label
39
+ * @returns The message role, or undefined if the label is not recognized
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * getRoleFromLabel('Assistant'); // 'assistant'
44
+ * getRoleFromLabel('Tool Use'); // 'tool-use'
45
+ * getRoleFromLabel('Unknown'); // undefined
46
+ * ```
47
+ */
48
+ export declare function getRoleFromLabel(label: string): MessageRole | undefined;
49
+ /**
50
+ * Converts a conversation to a Markdown string representation.
51
+ *
52
+ * By default, outputs clean, human-readable markdown with:
53
+ * - Each message with a header containing only the role: `### Role`
54
+ * - Message content rendered as markdown
55
+ *
56
+ * When `options.includeMetadata` is `true`, outputs markdown with full metadata
57
+ * for lossless round-trip conversion:
58
+ * - YAML frontmatter with conversation metadata and all message metadata keyed by message ID
59
+ * - Headers include message ID: `### Role (msg-id)`
60
+ * - Full content array preserved for multi-modal messages
61
+ *
62
+ * For multi-modal content:
63
+ * - Text parts are appended in order
64
+ * - Image parts are rendered as `![alt]({url})` on their own line
65
+ *
66
+ * @param conversation - The conversation to convert
67
+ * @param options - Options for markdown output
68
+ * @returns A Markdown string representation of the conversation
69
+ */
70
+ export declare function toMarkdown(conversation: Conversation, options?: ToMarkdownOptions): string;
71
+ /**
72
+ * Error thrown when markdown parsing fails.
73
+ */
74
+ export declare class MarkdownParseError extends Error {
75
+ constructor(message: string);
76
+ }
77
+ /**
78
+ * Parses a Markdown string back into a Conversation object.
79
+ *
80
+ * This is the inverse of `toMarkdown` and supports both:
81
+ * - Lossless round-trip conversion when markdown includes metadata
82
+ * (generated by `toMarkdown` with `includeMetadata: true`)
83
+ * - Best-effort parsing of simple markdown without metadata
84
+ * (generated by `toMarkdown` with `includeMetadata: false` or hand-written)
85
+ *
86
+ * When metadata is present:
87
+ * - YAML frontmatter provides conversation and message metadata
88
+ * - Headers include message ID: `### Role (msg-id)`
89
+ * - Full fidelity is preserved
90
+ *
91
+ * When metadata is absent:
92
+ * - Conversation ID and timestamps are generated
93
+ * - Message IDs are generated, positions are inferred from order
94
+ * - Content is parsed from markdown body
95
+ * - Defaults: status='active', hidden=false, empty metadata/tags
96
+ *
97
+ * @param markdown - The markdown string to parse
98
+ * @returns A Conversation object
99
+ * @throws {MarkdownParseError} If the markdown format is invalid (e.g., unknown role)
100
+ */
101
+ export declare function fromMarkdown(markdown: string): Conversation;
102
+ //# sourceMappingURL=markdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/utilities/markdown.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,YAAY,EAGZ,WAAW,EAEX,iBAAiB,EAGlB,MAAM,UAAU,CAAC;AAIlB;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAQnD,CAAC;AAKF;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAQrD,CAAC;AAKF;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CAEtD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAEvE;AAuDD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,UAAU,CACxB,YAAY,EAAE,YAAY,EAC1B,OAAO,GAAE,iBAAsB,GAC9B,MAAM,CAQR;AAqFD;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;gBAC/B,OAAO,EAAE,MAAM;CAI5B;AASD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY,CAW3D"}
@@ -0,0 +1,32 @@
1
+ import type { MultiModalContent } from '@lasercat/homogenaize';
2
+ import type { Message, MessageJSON } from '../types';
3
+ /**
4
+ * Creates an immutable Message from a JSON representation.
5
+ * Deep copies nested objects and arrays to ensure immutability.
6
+ */
7
+ export declare function createMessage(props: MessageJSON): Message;
8
+ /**
9
+ * Converts an immutable Message to a mutable JSON representation.
10
+ * Creates deep copies of all nested objects.
11
+ */
12
+ export declare function messageToJSON(message: Message): MessageJSON;
13
+ /**
14
+ * Extracts the content parts from a message as a multi-modal array.
15
+ * String content is converted to a single text part.
16
+ */
17
+ export declare function messageParts(message: Message): ReadonlyArray<MultiModalContent>;
18
+ /**
19
+ * Extracts all text content from a message, joined by the specified separator.
20
+ * Non-text parts are excluded from the result.
21
+ */
22
+ export declare function messageText(message: Message, joiner?: string): string;
23
+ /**
24
+ * Checks if a message contains any image content.
25
+ */
26
+ export declare function messageHasImages(message: Message): boolean;
27
+ /**
28
+ * Converts a message to a string representation.
29
+ * Images are rendered as markdown image syntax.
30
+ */
31
+ export declare function messageToString(message: Message): string;
32
+ //# sourceMappingURL=message.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src/utilities/message.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG/D,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAGrD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAoBzD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,WAAW,CAc3D;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,aAAa,CAAC,iBAAiB,CAAC,CAO/E;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,GAAE,MAAe,GAAG,MAAM,CAM7E;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAE1D;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CASxD"}
@@ -0,0 +1,33 @@
1
+ import type { MessageJSON, ToolResult } from '../types';
2
+ /**
3
+ * Represents a paired tool call with its optional result.
4
+ */
5
+ export interface ToolCallPair {
6
+ /** The tool call */
7
+ call: {
8
+ id: string;
9
+ name: string;
10
+ arguments: unknown;
11
+ };
12
+ /** The corresponding result, if available */
13
+ result?: ToolResult | undefined;
14
+ }
15
+ /**
16
+ * Pairs tool calls with their corresponding results from a list of messages.
17
+ *
18
+ * This is useful for UI rendering where tool calls and their results need
19
+ * to be displayed together. The function performs two passes:
20
+ * 1. Collects all tool results into a map by their callId
21
+ * 2. Pairs each tool call with its matching result (if any)
22
+ *
23
+ * @param messages - Array of messages that may contain tool calls and results
24
+ * @returns Array of tool call pairs, preserving the order of tool calls
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * const pairs = pairToolCallsWithResults(conversation.messages);
29
+ * // pairs: [{ call: ToolCall, result?: ToolResult }, ...]
30
+ * ```
31
+ */
32
+ export declare function pairToolCallsWithResults(messages: readonly MessageJSON[]): ToolCallPair[];
33
+ //# sourceMappingURL=tool-calls.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-calls.d.ts","sourceRoot":"","sources":["../../src/utilities/tool-calls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,oBAAoB;IACpB,IAAI,EAAE;QACJ,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,OAAO,CAAC;KACpB,CAAC;IACF,6CAA6C;IAC7C,MAAM,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;CACjC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,SAAS,WAAW,EAAE,GAC/B,YAAY,EAAE,CAsBhB"}
@@ -0,0 +1,47 @@
1
+ import type { Conversation } from '../types';
2
+ /**
3
+ * Checks if a metadata key is transient (starts with '_').
4
+ * Transient metadata is intended for temporary UI state and should not be persisted.
5
+ *
6
+ * @param key - The metadata key to check
7
+ * @returns true if the key starts with '_'
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * isTransientKey('_tempId'); // true
12
+ * isTransientKey('__internal'); // true
13
+ * isTransientKey('source'); // false
14
+ * ```
15
+ */
16
+ export declare function isTransientKey(key: string): boolean;
17
+ /**
18
+ * Strips transient metadata (keys starting with '_') from a metadata object.
19
+ *
20
+ * @param metadata - The metadata object to filter
21
+ * @returns A new object with transient keys removed
22
+ *
23
+ * @example
24
+ * ```ts
25
+ * stripTransientFromRecord({ _temp: 1, source: 'web' });
26
+ * // Returns: { source: 'web' }
27
+ * ```
28
+ */
29
+ export declare function stripTransientFromRecord(metadata: Record<string, unknown>): Record<string, unknown>;
30
+ /**
31
+ * Strips all transient metadata from a conversation.
32
+ * Transient metadata is identified by keys starting with '_'.
33
+ * This is useful for persisting conversations without temporary UI state.
34
+ *
35
+ * @param conversation - The conversation to process
36
+ * @returns A new conversation with transient metadata removed from both
37
+ * the conversation and all messages
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * const cleaned = stripTransientMetadata(conversation);
42
+ * // conversation.metadata._tempState is removed
43
+ * // message.metadata._deliveryStatus is removed
44
+ * ```
45
+ */
46
+ export declare function stripTransientMetadata(conversation: Conversation): Conversation;
47
+ //# sourceMappingURL=transient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transient.d.ts","sourceRoot":"","sources":["../../src/utilities/transient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAW,MAAM,UAAU,CAAC;AAGtD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEnD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAQzB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,sBAAsB,CAAC,YAAY,EAAE,YAAY,GAAG,YAAY,CA4B/E"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Type-safe hasOwnProperty check.
3
+ * Narrows the type to include the checked property.
4
+ */
5
+ export declare function hasOwnProperty<X extends object, Y extends PropertyKey>(obj: X, prop: Y): obj is X & Record<Y, unknown>;
6
+ /**
7
+ * Casts a value to its readonly variant.
8
+ * Used to enforce immutability at the type level.
9
+ */
10
+ export declare function toReadonly<T>(value: T): Readonly<T>;
11
+ //# sourceMappingURL=type-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-helpers.d.ts","sourceRoot":"","sources":["../../src/utilities/type-helpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,WAAW,EACpE,GAAG,EAAE,CAAC,EACN,IAAI,EAAE,CAAC,GACN,GAAG,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,CAE/B;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAEnD"}
@@ -1,153 +1,21 @@
1
- import type { MultiModalContent } from '@lasercat/homogenaize';
2
- import type { Conversation, Message, MessageJSON, ToolCall, ToolResult } from './types';
3
1
  /**
4
- * Represents a paired tool call with its optional result.
5
- */
6
- export interface ToolCallPair {
7
- /** The tool call */
8
- call: ToolCall;
9
- /** The corresponding result, if available */
10
- result?: ToolResult | undefined;
11
- }
12
- /**
13
- * Pairs tool calls with their corresponding results from a list of messages.
14
- *
15
- * This is useful for UI rendering where tool calls and their results need
16
- * to be displayed together. The function performs two passes:
17
- * 1. Collects all tool results into a map by their callId
18
- * 2. Pairs each tool call with its matching result (if any)
19
- *
20
- * @param messages - Array of messages that may contain tool calls and results
21
- * @returns Array of tool call pairs, preserving the order of tool calls
22
- *
23
- * @example
24
- * ```ts
25
- * const pairs = pairToolCallsWithResults(conversation.messages);
26
- * // pairs: [{ call: ToolCall, result?: ToolResult }, ...]
27
- * ```
28
- */
29
- export declare function pairToolCallsWithResults(messages: readonly MessageJSON[]): ToolCallPair[];
30
- /**
31
- * Type-safe hasOwnProperty check.
32
- * Narrows the type to include the checked property.
33
- */
34
- export declare function hasOwnProperty<X extends object, Y extends PropertyKey>(obj: X, prop: Y): obj is X & Record<Y, unknown>;
35
- /**
36
- * Casts a value to its readonly variant.
37
- * Used to enforce immutability at the type level.
38
- */
39
- export declare function toReadonly<T>(value: T): Readonly<T>;
40
- /**
41
- * Creates an immutable Message from a JSON representation.
42
- * Deep copies nested objects and arrays to ensure immutability.
43
- */
44
- export declare function createMessage(props: MessageJSON): Message;
45
- /**
46
- * Converts content to a multi-modal array format.
47
- * Wraps strings in a text content object, normalizes single items to arrays.
48
- */
49
- export declare function toMultiModalArray(input: string | MultiModalContent | MultiModalContent[]): MultiModalContent[];
50
- /**
51
- * Normalizes content to either a string or multi-modal array.
52
- * Single MultiModalContent items are wrapped in an array.
53
- */
54
- export declare function normalizeContent(content?: string | MultiModalContent | MultiModalContent[]): string | MultiModalContent[] | undefined;
55
- /**
56
- * Converts an immutable Message to a mutable JSON representation.
57
- * Creates deep copies of all nested objects.
58
- */
59
- export declare function messageToJSON(message: Message): MessageJSON;
60
- /**
61
- * Extracts the content parts from a message as a multi-modal array.
62
- * String content is converted to a single text part.
63
- */
64
- export declare function messageParts(message: Message): ReadonlyArray<MultiModalContent>;
65
- /**
66
- * Extracts all text content from a message, joined by the specified separator.
67
- * Non-text parts are excluded from the result.
68
- */
69
- export declare function messageText(message: Message, joiner?: string): string;
70
- /**
71
- * Checks if a message contains any image content.
72
- */
73
- export declare function messageHasImages(message: Message): boolean;
74
- /**
75
- * Converts a message to a string representation.
76
- * Images are rendered as markdown image syntax.
77
- */
78
- export declare function messageToString(message: Message): string;
79
- /**
80
- * Options for the toMarkdown function.
81
- */
82
- export interface ToMarkdownOptions {
83
- /**
84
- * Whether to include metadata (YAML frontmatter with message metadata)
85
- * for lossless round-trip conversion.
86
- *
87
- * When `true`:
88
- * - Includes YAML frontmatter with conversation and message metadata
89
- * - Headers include message ID: `### Role (msg-id)`
90
- * - Supports lossless round-trip via `fromMarkdown`
91
- *
92
- * When `false` (default):
93
- * - Outputs clean, human-readable markdown
94
- * - Headers only include role: `### Role`
95
- *
96
- * @default false
97
- */
98
- includeMetadata?: boolean;
99
- }
100
- /**
101
- * Converts a conversation to a Markdown string representation.
102
- *
103
- * By default, outputs clean, human-readable markdown with:
104
- * - Each message with a header containing only the role: `### Role`
105
- * - Message content rendered as markdown
106
- *
107
- * When `options.includeMetadata` is `true`, outputs markdown with full metadata
108
- * for lossless round-trip conversion:
109
- * - YAML frontmatter with conversation metadata and all message metadata keyed by message ID
110
- * - Headers include message ID: `### Role (msg-id)`
111
- * - Full content array preserved for multi-modal messages
112
- *
113
- * For multi-modal content:
114
- * - Text parts are appended in order
115
- * - Image parts are rendered as `![alt]({url})` on their own line
116
- *
117
- * @param conversation - The conversation to convert
118
- * @param options - Options for markdown output
119
- * @returns A Markdown string representation of the conversation
120
- */
121
- export declare function toMarkdown(conversation: Conversation, options?: ToMarkdownOptions): string;
122
- /**
123
- * Error thrown when markdown parsing fails.
124
- */
125
- export declare class MarkdownParseError extends Error {
126
- constructor(message: string);
127
- }
128
- /**
129
- * Parses a Markdown string back into a Conversation object.
130
- *
131
- * This is the inverse of `toMarkdown` and supports both:
132
- * - Lossless round-trip conversion when markdown includes metadata
133
- * (generated by `toMarkdown` with `includeMetadata: true`)
134
- * - Best-effort parsing of simple markdown without metadata
135
- * (generated by `toMarkdown` with `includeMetadata: false` or hand-written)
136
- *
137
- * When metadata is present:
138
- * - YAML frontmatter provides conversation and message metadata
139
- * - Headers include message ID: `### Role (msg-id)`
140
- * - Full fidelity is preserved
141
- *
142
- * When metadata is absent:
143
- * - Conversation ID and timestamps are generated
144
- * - Message IDs are generated, positions are inferred from order
145
- * - Content is parsed from markdown body
146
- * - Defaults: status='active', hidden=false, empty metadata/tags
147
- *
148
- * @param markdown - The markdown string to parse
149
- * @returns A Conversation object
150
- * @throws {MarkdownParseError} If the markdown format is invalid (e.g., unknown role)
151
- */
152
- export declare function fromMarkdown(markdown: string): Conversation;
2
+ * This file re-exports all utilities from the utilities/ directory.
3
+ * For new code, prefer importing directly from the specific modules:
4
+ * - './utilities/content' for content normalization
5
+ * - './utilities/deterministic' for deterministic output
6
+ * - './utilities/markdown' for markdown conversion
7
+ * - './utilities/message' for message utilities
8
+ * - './utilities/tool-calls' for tool call pairing
9
+ * - './utilities/transient' for transient metadata handling
10
+ * - './utilities/type-helpers' for type guard helpers
11
+ */
12
+ export type { ToMarkdownOptions } from './types';
13
+ export { normalizeContent, toMultiModalArray } from './utilities/content';
14
+ export { sortMessagesByPosition, sortObjectKeys } from './utilities/deterministic';
15
+ export { fromMarkdown, getRoleFromLabel, getRoleLabel, LABEL_TO_ROLE, MarkdownParseError, ROLE_LABELS, toMarkdown, } from './utilities/markdown';
16
+ export { createMessage, messageHasImages, messageParts, messageText, messageToJSON, messageToString, } from './utilities/message';
17
+ export type { ToolCallPair } from './utilities/tool-calls';
18
+ export { pairToolCallsWithResults } from './utilities/tool-calls';
19
+ export { isTransientKey, stripTransientFromRecord, stripTransientMetadata, } from './utilities/transient';
20
+ export { hasOwnProperty, toReadonly } from './utilities/type-helpers';
153
21
  //# sourceMappingURL=utilities.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utilities.d.ts","sourceRoot":"","sources":["../src/utilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAI/D,OAAO,KAAK,EACV,YAAY,EAEZ,OAAO,EACP,WAAW,EAGX,QAAQ,EACR,UAAU,EACX,MAAM,SAAS,CAAC;AAEjB;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,oBAAoB;IACpB,IAAI,EAAE,Q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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "conversationalist",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "A TypeScript library for managing AI conversation state",
5
5
  "keywords": [
6
6
  "conversation",