@lostgradient/cinder 0.9.0 → 0.12.0

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 (169) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/components.json +82 -4
  3. package/dist/components/access-gate/index.js +381 -239
  4. package/dist/components/chat/builders.d.ts +17 -8
  5. package/dist/components/chat/conversation-model.d.ts +1 -1
  6. package/dist/components/chat/index.d.ts +1 -1
  7. package/dist/components/chat/index.js +300 -17
  8. package/dist/components/chat/utilities/conversation.d.ts +6 -6
  9. package/dist/components/chat-conversation-header/index.js +19 -6
  10. package/dist/components/chat-conversation-list/index.js +19 -6
  11. package/dist/components/code-block/code-block.css +15 -9
  12. package/dist/components/code-block/code-block.variables.js +8 -2
  13. package/dist/components/confirm-dialog/confirm-dialog.css +2 -0
  14. package/dist/components/confirm-dialog/confirm-dialog.schema.js +10 -1
  15. package/dist/components/confirm-dialog/confirm-dialog.types.d.ts +7 -0
  16. package/dist/components/confirm-dialog/index.js +478 -106
  17. package/dist/components/connection-indicator/connection-indicator.css +136 -0
  18. package/dist/components/connection-indicator/connection-indicator.css.d.ts +1 -0
  19. package/dist/components/connection-indicator/connection-indicator.schema.d.ts +3 -0
  20. package/dist/components/connection-indicator/connection-indicator.schema.js +89 -0
  21. package/dist/components/connection-indicator/connection-indicator.svelte.d.ts +21 -0
  22. package/dist/components/connection-indicator/connection-indicator.types.d.ts +46 -0
  23. package/dist/components/connection-indicator/connection-indicator.variables.d.ts +2 -0
  24. package/dist/components/connection-indicator/connection-indicator.variables.js +61 -0
  25. package/dist/components/connection-indicator/index.d.ts +5 -0
  26. package/dist/components/connection-indicator/index.js +409 -0
  27. package/dist/components/container/container.schema.js +4 -4
  28. package/dist/components/faceted-filter-bar/faceted-filter-bar.schema.js +5 -1
  29. package/dist/components/faceted-filter-bar/faceted-filter-bar.types.d.ts +2 -0
  30. package/dist/components/faceted-filter-bar/index.js +40 -31
  31. package/dist/components/invocation-rule-builder/index.d.ts +1 -1
  32. package/dist/components/invocation-rule-builder/index.js +305 -150
  33. package/dist/components/invocation-rule-builder/invocation-rule-builder.css +28 -0
  34. package/dist/components/invocation-rule-builder/invocation-rule-builder.schema.js +89 -5
  35. package/dist/components/invocation-rule-builder/invocation-rule-builder.svelte.d.ts +2 -1
  36. package/dist/components/invocation-rule-builder/invocation-rule-builder.types.d.ts +114 -16
  37. package/dist/components/navigation-bar/index.js +11 -17
  38. package/dist/components/run-step-timeline/index.d.ts +1 -1
  39. package/dist/components/run-step-timeline/index.js +1052 -560
  40. package/dist/components/run-step-timeline/run-step-branch-disclosure.svelte.d.ts +17 -0
  41. package/dist/components/run-step-timeline/run-step-timeline.css +124 -0
  42. package/dist/components/run-step-timeline/run-step-timeline.schema.js +873 -350
  43. package/dist/components/run-step-timeline/run-step-timeline.svelte.d.ts +1 -15
  44. package/dist/components/run-step-timeline/run-step-timeline.types.d.ts +182 -5
  45. package/dist/components/run-step-timeline/run-step-timeline.utilities.d.ts +60 -0
  46. package/dist/components/schedule-builder/index.d.ts +5 -0
  47. package/dist/components/schedule-builder/index.js +3176 -0
  48. package/dist/components/schedule-builder/schedule-builder.css +121 -0
  49. package/dist/components/schedule-builder/schedule-builder.css.d.ts +1 -0
  50. package/dist/components/schedule-builder/schedule-builder.schema.d.ts +3 -0
  51. package/dist/components/schedule-builder/schedule-builder.schema.js +141 -0
  52. package/dist/components/schedule-builder/schedule-builder.svelte.d.ts +22 -0
  53. package/dist/components/schedule-builder/schedule-builder.types.d.ts +130 -0
  54. package/dist/components/schedule-builder/schedule-builder.utilities.d.ts +78 -0
  55. package/dist/components/schedule-builder/schedule-builder.variables.d.ts +2 -0
  56. package/dist/components/schedule-builder/schedule-builder.variables.js +61 -0
  57. package/dist/components/tag-input/index.js +22 -4
  58. package/dist/components/tag-input/tag-input.schema.js +5 -1
  59. package/dist/components/tag-input/tag-input.types.d.ts +4 -0
  60. package/dist/index.d.ts +6 -2
  61. package/dist/index.js +23069 -20833
  62. package/dist/server/components/access-gate/index.js +2 -1
  63. package/dist/server/components/chat/index.js +4 -4
  64. package/dist/server/components/chat-conversation-header/index.js +5 -5
  65. package/dist/server/components/chat-conversation-list/index.js +3 -3
  66. package/dist/server/components/color-field/index.js +2 -2
  67. package/dist/server/components/confirm-dialog/index.js +7 -2
  68. package/dist/server/components/connection-indicator/index.js +16 -0
  69. package/dist/server/components/data-table/index.js +3 -3
  70. package/dist/server/components/diff-viewer/index.js +4 -3
  71. package/dist/server/components/faceted-filter-bar/index.js +1 -1
  72. package/dist/server/components/invocation-rule-builder/index.js +1 -1
  73. package/dist/server/components/json-schema-editor/index.js +4 -3
  74. package/dist/server/components/navigation-bar/index.js +1 -1
  75. package/dist/server/components/review-editor/index.js +4 -3
  76. package/dist/server/components/run-step-timeline/index.js +1 -1
  77. package/dist/server/components/schedule-builder/index.js +30 -0
  78. package/dist/server/components/side-navigation/index.js +2 -2
  79. package/dist/server/components/table/index.js +3 -3
  80. package/dist/server/components/tag-input/index.js +1 -1
  81. package/dist/server/components/time-field/index.js +5 -3
  82. package/dist/server/index.js +105 -92
  83. package/dist/server/index.server-0sx92swg.js +9 -0
  84. package/dist/server/{index.server-mzzb7dnm.js → index.server-2bbwajb2.js} +1 -1
  85. package/dist/server/{index.server-q7w4jw89.js → index.server-2s5h1d05.js} +2 -2
  86. package/dist/server/{index.server-dg83ke3k.js → index.server-2zdbz3rj.js} +1 -1
  87. package/dist/server/{index.server-0jhra85x.js → index.server-3w72dxz7.js} +4 -4
  88. package/dist/server/{index.server-5tf22d6e.js → index.server-4wx0qven.js} +3 -3
  89. package/dist/server/{index.server-qh9qzd5t.js → index.server-4x4hgvqe.js} +283 -13
  90. package/dist/server/{index.server-c6pe4kaf.js → index.server-5gzyqv78.js} +1 -1
  91. package/dist/server/{index.server-mqt1ngqw.js → index.server-6hnfzc7f.js} +19 -6
  92. package/dist/server/{index.server-894t97kv.js → index.server-7yvpb6z7.js} +4 -4
  93. package/dist/server/index.server-be9bpqeh.js +93 -0
  94. package/dist/server/{index.server-f3z7tpxr.js → index.server-c42b462p.js} +2 -4
  95. package/dist/server/{index.server-7vyzen5x.js → index.server-c5qv3p61.js} +171 -63
  96. package/dist/server/index.server-cch0eed5.js +144 -0
  97. package/dist/server/{index.server-btgb3d56.js → index.server-d5a5ccz7.js} +18 -12
  98. package/dist/server/index.server-g5jgq3jp.js +793 -0
  99. package/dist/server/index.server-gmh5ar16.js +2 -0
  100. package/dist/server/{index.server-0atyznp7.js → index.server-h89zk5ev.js} +7 -7
  101. package/dist/server/{index.server-jxg42jpz.js → index.server-jdcq5zza.js} +7 -7
  102. package/dist/server/{index.server-2dga5yzr.js → index.server-jfrssta6.js} +1 -1
  103. package/dist/server/{index.server-fy068yne.js → index.server-jj76374p.js} +1 -1
  104. package/dist/server/{index.server-39ne5cd1.js → index.server-pxq277t5.js} +32 -1
  105. package/dist/server/index.server-qbkxz7r2.js +750 -0
  106. package/dist/server/{index.server-marjz8ps.js → index.server-tcay903b.js} +3 -2
  107. package/dist/server/{index.server-yz4k36cw.js → index.server-z7hxtqs1.js} +1 -1
  108. package/package.json +87 -97
  109. package/src/components/chat/builders.ts +445 -14
  110. package/src/components/chat/conversation-model.ts +1 -0
  111. package/src/components/chat/index.ts +1 -0
  112. package/src/components/chat/utilities/conversation.ts +33 -15
  113. package/src/components/code-block/code-block.css +15 -9
  114. package/src/components/code-block/code-block.variables.json +7 -1
  115. package/src/components/code-block/code-block.variables.ts +7 -1
  116. package/src/components/confirm-dialog/confirm-dialog.css +2 -0
  117. package/src/components/confirm-dialog/confirm-dialog.schema.json +8 -0
  118. package/src/components/confirm-dialog/confirm-dialog.schema.ts +10 -0
  119. package/src/components/confirm-dialog/confirm-dialog.svelte +31 -3
  120. package/src/components/confirm-dialog/confirm-dialog.types.ts +7 -0
  121. package/src/components/connection-indicator/connection-indicator.css +136 -0
  122. package/src/components/connection-indicator/connection-indicator.examples.json +31 -0
  123. package/src/components/connection-indicator/connection-indicator.schema.json +29 -0
  124. package/src/components/connection-indicator/connection-indicator.schema.ts +36 -0
  125. package/src/components/connection-indicator/connection-indicator.svelte +63 -0
  126. package/src/components/connection-indicator/connection-indicator.types.ts +58 -0
  127. package/src/components/connection-indicator/connection-indicator.variables.json +1 -0
  128. package/src/components/connection-indicator/connection-indicator.variables.ts +3 -0
  129. package/src/components/connection-indicator/index.ts +10 -0
  130. package/src/components/container/container.schema.json +3 -3
  131. package/src/components/container/container.schema.ts +3 -3
  132. package/src/components/faceted-filter-bar/faceted-filter-bar.schema.json +4 -0
  133. package/src/components/faceted-filter-bar/faceted-filter-bar.schema.ts +4 -0
  134. package/src/components/faceted-filter-bar/faceted-filter-bar.svelte +13 -11
  135. package/src/components/faceted-filter-bar/faceted-filter-bar.types.ts +2 -0
  136. package/src/components/invocation-rule-builder/index.ts +4 -0
  137. package/src/components/invocation-rule-builder/invocation-rule-builder.css +28 -0
  138. package/src/components/invocation-rule-builder/invocation-rule-builder.examples.json +6 -0
  139. package/src/components/invocation-rule-builder/invocation-rule-builder.schema.json +76 -3
  140. package/src/components/invocation-rule-builder/invocation-rule-builder.schema.ts +83 -3
  141. package/src/components/invocation-rule-builder/invocation-rule-builder.svelte +326 -113
  142. package/src/components/invocation-rule-builder/invocation-rule-builder.types.ts +157 -43
  143. package/src/components/navigation-bar/navigation-bar.svelte +2 -2
  144. package/src/components/run-step-timeline/index.ts +8 -0
  145. package/src/components/run-step-timeline/run-step-branch-disclosure.svelte +16 -0
  146. package/src/components/run-step-timeline/run-step-timeline.css +124 -0
  147. package/src/components/run-step-timeline/run-step-timeline.examples.json +18 -0
  148. package/src/components/run-step-timeline/run-step-timeline.schema.json +872 -349
  149. package/src/components/run-step-timeline/run-step-timeline.schema.ts +931 -349
  150. package/src/components/run-step-timeline/run-step-timeline.svelte +388 -269
  151. package/src/components/run-step-timeline/run-step-timeline.types.ts +192 -5
  152. package/src/components/run-step-timeline/run-step-timeline.utilities.ts +310 -0
  153. package/src/components/schedule-builder/index.ts +14 -0
  154. package/src/components/schedule-builder/schedule-builder.css +121 -0
  155. package/src/components/schedule-builder/schedule-builder.examples.json +31 -0
  156. package/src/components/schedule-builder/schedule-builder.schema.json +78 -0
  157. package/src/components/schedule-builder/schedule-builder.schema.ts +86 -0
  158. package/src/components/schedule-builder/schedule-builder.svelte +629 -0
  159. package/src/components/schedule-builder/schedule-builder.types.ts +137 -0
  160. package/src/components/schedule-builder/schedule-builder.utilities.ts +344 -0
  161. package/src/components/schedule-builder/schedule-builder.variables.json +1 -0
  162. package/src/components/schedule-builder/schedule-builder.variables.ts +3 -0
  163. package/src/components/tag-input/tag-input.schema.json +4 -0
  164. package/src/components/tag-input/tag-input.schema.ts +4 -0
  165. package/src/components/tag-input/tag-input.svelte +20 -3
  166. package/src/components/tag-input/tag-input.types.ts +4 -0
  167. package/src/index.ts +23 -0
  168. package/src/styles/components.css +2 -0
  169. package/dist/server/index.server-qk1h0n02.js +0 -393
@@ -1,16 +1,25 @@
1
1
  /**
2
2
  * Conversation builders for the Chat component.
3
3
  *
4
- * Chat renders a {@link ConversationHistory} snapshot. These are thin aliases
5
- * over the published `conversationalist` builders so examples, demos, tests, and
6
- * simple apps construct the same transcript shape Chat consumes.
4
+ * Chat renders a {@link ConversationHistory} snapshot. These helpers construct
5
+ * the published Conversationalist shape without importing the package runtime
6
+ * into Cinder's browser graph.
7
7
  */
8
- import { appendAssistantMessage as appendConversationalistAssistantMessage, appendUserMessage as appendConversationalistUserMessage, createConversationHistory } from 'conversationalist';
9
- import type { ConversationHistory, MessageInput } from './conversation-model.ts';
8
+ import type { ConversationEnvironment, ConversationHistory, ConversationStatus, JSONValue, MessageInput } from './conversation-model.ts';
9
+ type CreateConversationOptions = {
10
+ id?: string;
11
+ title?: string;
12
+ status?: ConversationStatus;
13
+ metadata?: Record<string, JSONValue>;
14
+ };
15
+ type ConversationEnvironmentInput = Partial<ConversationEnvironment>;
10
16
  /** Creates a new empty conversation snapshot. */
11
- declare const createConversation: typeof createConversationHistory;
17
+ declare function createConversation(options?: CreateConversationOptions, environment?: ConversationEnvironmentInput): ConversationHistory;
12
18
  /** Appends one or more messages, preserving the previous no-op identity contract. */
13
19
  declare function appendMessages(conversation: ConversationHistory, ...inputs: MessageInput[]): ConversationHistory;
14
- declare const appendUserMessage: typeof appendConversationalistUserMessage;
15
- declare const appendAssistantMessage: typeof appendConversationalistAssistantMessage;
20
+ declare function appendMessages(conversation: ConversationHistory, ...inputsAndEnvironment: [...MessageInput[], ConversationEnvironmentInput | undefined]): ConversationHistory;
21
+ declare function appendUserMessage(conversation: ConversationHistory, content: MessageInput['content'], metadata?: Record<string, JSONValue>, environment?: ConversationEnvironmentInput): ConversationHistory;
22
+ declare function appendUserMessage(conversation: ConversationHistory, content: MessageInput['content'], environment?: ConversationEnvironmentInput): ConversationHistory;
23
+ declare function appendAssistantMessage(conversation: ConversationHistory, content: MessageInput['content'], metadata?: Record<string, JSONValue>, environment?: ConversationEnvironmentInput): ConversationHistory;
24
+ declare function appendAssistantMessage(conversation: ConversationHistory, content: MessageInput['content'], environment?: ConversationEnvironmentInput): ConversationHistory;
16
25
  export { appendAssistantMessage, appendMessages, appendUserMessage, createConversation };
@@ -8,7 +8,7 @@
8
8
  * @module
9
9
  */
10
10
  import type { ToMarkdownOptions as ConversationalistToMarkdownOptions } from 'conversationalist/markdown';
11
- export type { AssistantMessage, ContainerUploadContent, ConversationHistory, ConversationStatus, ImageContent, JSONValue, Message, MessageInput, MessageRole, MultiModalContent, RedactedThinkingContent, ServerToolResultContent, ServerToolResultType, ServerToolUseContent, TextContent, ThinkingContent, TokenUsage, ToolAction, ToolCall, ToolError, ToolErrorCategory, ToolResult, WebSearchToolResultContent, } from 'conversationalist';
11
+ export type { AssistantMessage, ContainerUploadContent, ConversationEnvironment, ConversationHistory, ConversationStatus, ImageContent, JSONValue, Message, MessageInput, MessageRole, MultiModalContent, RedactedThinkingContent, ServerToolResultContent, ServerToolResultType, ServerToolUseContent, TextContent, ThinkingContent, TokenUsage, ToolAction, ToolCall, ToolError, ToolErrorCategory, ToolResult, WebSearchToolResultContent, } from 'conversationalist';
12
12
  export type { ToolCallPair } from 'conversationalist/utilities';
13
13
  /** Base options shared by all transcript export operations. */
14
14
  export type ExportOptions = Omit<ConversationalistToMarkdownOptions, 'includeMetadata'>;
@@ -12,7 +12,7 @@ export type { ChatAnnounceLevel, ChatCapabilities, ChatProps, ReadReceipt, Typin
12
12
  export { Chat };
13
13
  export type { ChatAdapter, ChatAdapterErrorEvent, ChatCommand, ChatPushHandlers, ChatReadReceiptEvent, } from './adapter';
14
14
  export { appendAssistantMessage, appendMessages, appendUserMessage, createConversation, } from './builders.ts';
15
- export type { AssistantMessage, ContainerUploadContent, ConversationHistory, ConversationStatus, ExportOptions, ImageContent, JSONValue, Message, MessageInput, MessageRole, MultiModalContent, RedactedThinkingContent, ServerToolResultContent, ServerToolResultType, ServerToolUseContent, TextContent, ThinkingContent, ToMarkdownOptions, TokenUsage, ToolAction, ToolCall, ToolCallPair, ToolError, ToolErrorCategory, ToolResult, WebSearchToolResultContent, } from './conversation-model.ts';
15
+ export type { AssistantMessage, ContainerUploadContent, ConversationEnvironment, ConversationHistory, ConversationStatus, ExportOptions, ImageContent, JSONValue, Message, MessageInput, MessageRole, MultiModalContent, RedactedThinkingContent, ServerToolResultContent, ServerToolResultType, ServerToolUseContent, TextContent, ThinkingContent, ToMarkdownOptions, TokenUsage, ToolAction, ToolCall, ToolCallPair, ToolError, ToolErrorCategory, ToolResult, WebSearchToolResultContent, } from './conversation-model.ts';
16
16
  export { formatMessageAsMarkdown, getMessageRoleLabel, getMessageText, messagesToMarkdown, type ChatExportOptions, type DeliveryStatus, } from './utilities';
17
17
  export { ChatAttachmentPreview, ChatInput, deriveAttachmentKind, serializeChatAttachment, serializeChatAttachments, } from './input';
18
18
  export type { AttachmentKind, ChatAttachment, SerializedChatAttachment } from './input';
@@ -2489,13 +2489,26 @@ import * as $65 from "svelte/internal/client";
2489
2489
  import { tick as tick2, untrack as untrack3 } from "svelte";
2490
2490
 
2491
2491
  // src/components/chat/utilities/conversation.ts
2492
- import { getMessages } from "conversationalist";
2493
- import { pairToolCallsWithResults as pairConversationalistToolCallsWithResults } from "conversationalist/utilities";
2494
- function hasPairableToolField(message) {
2495
- return message.role === "tool-call" && message.toolCall !== undefined || message.role === "tool-result" && message.toolResult !== undefined;
2492
+ function getMessages(conversation, options = {}) {
2493
+ return conversation.ids.map((id) => conversation.messages[id]).filter((message) => message !== undefined).filter((message) => options.includeHidden === true || !message.hidden);
2496
2494
  }
2497
2495
  function pairToolCallsWithResults(messages) {
2498
- return pairConversationalistToolCallsWithResults(messages.filter(hasPairableToolField));
2496
+ const resultsByCallId = new Map;
2497
+ for (const message of messages) {
2498
+ if (message.role === "tool-result" && message.toolResult !== undefined) {
2499
+ resultsByCallId.set(message.toolResult.callId, message.toolResult);
2500
+ }
2501
+ }
2502
+ const pairs = [];
2503
+ for (const message of messages) {
2504
+ if (message.role === "tool-call" && message.toolCall !== undefined) {
2505
+ pairs.push({
2506
+ call: message.toolCall,
2507
+ result: resultsByCallId.get(message.toolCall.id)
2508
+ });
2509
+ }
2510
+ }
2511
+ return pairs;
2499
2512
  }
2500
2513
  // src/components/chat/utilities/utilities.ts
2501
2514
  var CINDER_REASONING_METADATA_KEY = "cinder:reasoning";
@@ -9521,20 +9534,290 @@ function Chat2($$anchor, $$props) {
9521
9534
  }
9522
9535
 
9523
9536
  // src/components/chat/builders.ts
9524
- import {
9525
- appendAssistantMessage as appendConversationalistAssistantMessage,
9526
- appendMessages as appendConversationalistMessages,
9527
- appendUserMessage as appendConversationalistUserMessage,
9528
- createConversationHistory
9529
- } from "conversationalist";
9530
- var createConversation = createConversationHistory;
9531
- function appendMessages(conversation, ...inputs) {
9537
+ var MESSAGE_ROLES = new Set([
9538
+ "user",
9539
+ "assistant",
9540
+ "system",
9541
+ "developer",
9542
+ "tool-call",
9543
+ "tool-result",
9544
+ "snapshot"
9545
+ ]);
9546
+ var CONVERSATION_STATUSES = new Set(["active", "archived", "deleted"]);
9547
+ function createId() {
9548
+ return globalThis.crypto?.randomUUID?.() ?? `message-${Date.now()}-${Math.random()}`;
9549
+ }
9550
+ function isRecord(value) {
9551
+ return typeof value === "object" && value !== null;
9552
+ }
9553
+ function isJsonObject(value) {
9554
+ if (!isRecord(value) || Array.isArray(value))
9555
+ return false;
9556
+ const prototype = Object.getPrototypeOf(value);
9557
+ return prototype === Object.prototype || prototype === null;
9558
+ }
9559
+ function isJsonValue(value) {
9560
+ if (value === null)
9561
+ return true;
9562
+ switch (typeof value) {
9563
+ case "string":
9564
+ case "boolean":
9565
+ return true;
9566
+ case "number":
9567
+ return Number.isFinite(value);
9568
+ case "object":
9569
+ if (Array.isArray(value))
9570
+ return value.every(isJsonValue);
9571
+ return isJsonObject(value) && Object.values(value).every(isJsonValue);
9572
+ default:
9573
+ return false;
9574
+ }
9575
+ }
9576
+ function assertJsonObject(value, label) {
9577
+ if (!isJsonObject(value) || !Object.values(value).every(isJsonValue)) {
9578
+ throw new Error(`${label} must be a JSON-compatible object`);
9579
+ }
9580
+ }
9581
+ function isConversationEnvironmentParameter(value) {
9582
+ if (!isRecord(value) || "role" in value)
9583
+ return false;
9584
+ return typeof value["now"] === "function" || typeof value["randomId"] === "function" || typeof value["estimateTokens"] === "function" || Array.isArray(value["plugins"]) && value["plugins"].every((plugin) => typeof plugin === "function");
9585
+ }
9586
+ function isRoleHelperEnvironmentParameter(value) {
9587
+ if (!isRecord(value) || "role" in value)
9588
+ return false;
9589
+ return typeof value["now"] === "function" || typeof value["randomId"] === "function" || typeof value["estimateTokens"] === "function" || Array.isArray(value["plugins"]) && value["plugins"].length > 0 && value["plugins"].every((plugin) => typeof plugin === "function");
9590
+ }
9591
+ function isMultiModalContentPart(value) {
9592
+ if (!isJsonObject(value) || typeof value["type"] !== "string")
9593
+ return false;
9594
+ if (!Object.values(value).every(isJsonValue))
9595
+ return false;
9596
+ switch (value["type"]) {
9597
+ case "text":
9598
+ return typeof value["text"] === "string";
9599
+ case "image":
9600
+ return typeof value["url"] === "string";
9601
+ case "thinking":
9602
+ return typeof value["thinking"] === "string";
9603
+ case "redacted_thinking":
9604
+ return typeof value["data"] === "string";
9605
+ case "server_tool_use":
9606
+ return typeof value["id"] === "string" && typeof value["name"] === "string";
9607
+ case "web_search_tool_result":
9608
+ return typeof value["tool_use_id"] === "string" && "content" in value;
9609
+ case "container_upload":
9610
+ return typeof value["file_id"] === "string";
9611
+ default:
9612
+ return false;
9613
+ }
9614
+ }
9615
+ function isMessageContentInput(value) {
9616
+ return typeof value === "string" || Array.isArray(value) && value.every(isMultiModalContentPart) || isMultiModalContentPart(value);
9617
+ }
9618
+ function isLooseMessageInput(value) {
9619
+ return isRecord(value) && typeof value["role"] === "string" && MESSAGE_ROLES.has(value["role"]) && isMessageContentInput(value["content"]) && (value["hidden"] === undefined || typeof value["hidden"] === "boolean") && (value["goalCompleted"] === undefined || typeof value["goalCompleted"] === "boolean");
9620
+ }
9621
+ function isMetadataRecord(value) {
9622
+ return isJsonObject(value);
9623
+ }
9624
+ function resolveEnvironment(environment) {
9625
+ const plugins = environment?.plugins ?? [];
9626
+ if (!Array.isArray(plugins) || plugins.some((plugin) => typeof plugin !== "function")) {
9627
+ throw new Error("conversation environment plugins must be functions");
9628
+ }
9629
+ return {
9630
+ now: environment?.now ?? (() => new Date().toISOString()),
9631
+ randomId: environment?.randomId ?? createId,
9632
+ plugins: [...plugins]
9633
+ };
9634
+ }
9635
+ function cloneStructuredValue(value) {
9636
+ return structuredClone(value);
9637
+ }
9638
+ function cloneMetadata(metadata) {
9639
+ if (metadata === undefined)
9640
+ return {};
9641
+ assertJsonObject(metadata, "metadata");
9642
+ return cloneStructuredValue(metadata);
9643
+ }
9644
+ function normalizeContent(content) {
9645
+ if (typeof content === "string")
9646
+ return content;
9647
+ return Array.isArray(content) ? cloneStructuredValue(content) : [cloneStructuredValue(content)];
9648
+ }
9649
+ function cloneTokenUsage(tokenUsage) {
9650
+ assertJsonObject(tokenUsage, "tokenUsage");
9651
+ const values = Object.values(tokenUsage);
9652
+ if (values.some((value) => typeof value !== "number")) {
9653
+ throw new Error("tokenUsage values must be numbers");
9654
+ }
9655
+ if (values.some((value) => typeof value === "number" && (!Number.isInteger(value) || value < 0))) {
9656
+ throw new Error("tokenUsage values must be non-negative integers");
9657
+ }
9658
+ return cloneStructuredValue(tokenUsage);
9659
+ }
9660
+ function cloneToolCall(toolCall) {
9661
+ assertJsonObject(toolCall, "toolCall");
9662
+ if (typeof toolCall.id !== "string" || typeof toolCall.name !== "string" || !("arguments" in toolCall) || !isJsonValue(toolCall.arguments)) {
9663
+ throw new Error("toolCall must include string id, string name, and JSON arguments");
9664
+ }
9665
+ return cloneStructuredValue(toolCall);
9666
+ }
9667
+ function cloneToolResult(toolResult) {
9668
+ assertJsonObject(toolResult, "toolResult");
9669
+ if (typeof toolResult.callId !== "string" || !["success", "error", "action_required"].includes(String(toolResult.outcome)) || !("content" in toolResult) || !isJsonValue(toolResult.content)) {
9670
+ throw new Error("toolResult must include string callId, valid outcome, and JSON content");
9671
+ }
9672
+ return cloneStructuredValue(toolResult);
9673
+ }
9674
+ function getOrderedMessages(conversation) {
9675
+ return conversation.ids.map((id) => conversation.messages[id]).filter((message) => message !== undefined);
9676
+ }
9677
+ function buildToolCallIds(messages) {
9678
+ const toolCallIds = new Set;
9679
+ for (const message of messages) {
9680
+ if (message.role === "tool-call" && message.toolCall !== undefined) {
9681
+ if (toolCallIds.has(message.toolCall.id)) {
9682
+ throw new Error(`duplicate toolCall.id in conversation: ${message.toolCall.id}`);
9683
+ }
9684
+ toolCallIds.add(message.toolCall.id);
9685
+ }
9686
+ }
9687
+ return toolCallIds;
9688
+ }
9689
+ function assertValidToolMessage(input, toolCallIds) {
9690
+ if (input.role === "tool-result" && input.toolResult !== undefined) {
9691
+ if (!toolCallIds.has(input.toolResult.callId)) {
9692
+ throw new Error(`tool result references non-existent tool-call: ${input.toolResult.callId}`);
9693
+ }
9694
+ }
9695
+ if (input.role === "tool-call" && input.toolCall !== undefined) {
9696
+ if (toolCallIds.has(input.toolCall.id)) {
9697
+ throw new Error(`duplicate toolCall.id in conversation: ${input.toolCall.id}`);
9698
+ }
9699
+ toolCallIds.add(input.toolCall.id);
9700
+ }
9701
+ }
9702
+ function createConversation(options = {}, environment) {
9703
+ const resolvedEnvironment = resolveEnvironment(environment);
9704
+ const createdAt = resolvedEnvironment.now();
9705
+ const conversationId = options.id ?? resolvedEnvironment.randomId();
9706
+ if (typeof conversationId !== "string") {
9707
+ throw new Error("conversation id must be a string");
9708
+ }
9709
+ if (typeof createdAt !== "string") {
9710
+ throw new Error("conversation timestamp must be a string");
9711
+ }
9712
+ if (options.title !== undefined && typeof options.title !== "string") {
9713
+ throw new Error("conversation title must be a string");
9714
+ }
9715
+ if (options.status !== undefined && !CONVERSATION_STATUSES.has(options.status)) {
9716
+ throw new Error("conversation status must be active, archived, or deleted");
9717
+ }
9718
+ return {
9719
+ schemaVersion: 4,
9720
+ id: conversationId,
9721
+ ...options.title !== undefined ? { title: options.title } : {},
9722
+ status: options.status ?? "active",
9723
+ metadata: cloneMetadata(options.metadata),
9724
+ ids: [],
9725
+ messages: {},
9726
+ createdAt,
9727
+ updatedAt: createdAt
9728
+ };
9729
+ }
9730
+ function materializeMessage(input, position, createdAt, id) {
9731
+ return {
9732
+ id,
9733
+ role: input.role,
9734
+ content: normalizeContent(input.content),
9735
+ position,
9736
+ createdAt,
9737
+ metadata: cloneMetadata(input.metadata),
9738
+ hidden: input.hidden ?? false,
9739
+ ...input.toolCall !== undefined ? { toolCall: cloneToolCall(input.toolCall) } : {},
9740
+ ...input.toolResult !== undefined ? { toolResult: cloneToolResult(input.toolResult) } : {},
9741
+ ...input.tokenUsage !== undefined ? { tokenUsage: cloneTokenUsage(input.tokenUsage) } : {},
9742
+ ...input.role === "assistant" && input.goalCompleted !== undefined ? { goalCompleted: input.goalCompleted } : {}
9743
+ };
9744
+ }
9745
+ function partitionAppendArguments(args) {
9746
+ const filteredArguments = args.at(-1) === undefined ? args.slice(0, -1) : args;
9747
+ if (filteredArguments.some((argument) => argument === undefined)) {
9748
+ throw new Error("appendMessages expected MessageInput arguments before the optional environment");
9749
+ }
9750
+ const lastArgument = filteredArguments.at(-1);
9751
+ const inputArguments = isConversationEnvironmentParameter(lastArgument) ? filteredArguments.slice(0, -1) : filteredArguments;
9752
+ const inputs = [];
9753
+ for (const argument of inputArguments) {
9754
+ if (!isLooseMessageInput(argument)) {
9755
+ throw new Error("appendMessages expected MessageInput arguments before the optional environment");
9756
+ }
9757
+ inputs.push(argument);
9758
+ }
9759
+ if (isConversationEnvironmentParameter(lastArgument)) {
9760
+ return { inputs, environment: lastArgument };
9761
+ }
9762
+ return { inputs };
9763
+ }
9764
+ function appendMessages(conversation, ...args) {
9765
+ const { inputs, environment } = partitionAppendArguments(args);
9532
9766
  if (inputs.length === 0)
9533
9767
  return conversation;
9534
- return appendConversationalistMessages(conversation, ...inputs);
9768
+ const resolvedEnvironment = resolveEnvironment(environment);
9769
+ const updatedAt = resolvedEnvironment.now();
9770
+ if (typeof updatedAt !== "string") {
9771
+ throw new Error("conversation timestamp must be a string");
9772
+ }
9773
+ const nextIds = [...conversation.ids];
9774
+ const nextMessages = { ...conversation.messages };
9775
+ const toolCallIds = buildToolCallIds(getOrderedMessages(conversation));
9776
+ inputs.forEach((input, index3) => {
9777
+ const normalizedInput = { ...input, content: normalizeContent(input.content) };
9778
+ const processedInput = resolvedEnvironment.plugins.reduce((current, plugin) => plugin(current), normalizedInput);
9779
+ if (!isLooseMessageInput(processedInput)) {
9780
+ throw new Error("conversation plugin returned an invalid MessageInput");
9781
+ }
9782
+ assertValidToolMessage(processedInput, toolCallIds);
9783
+ const messageId = resolvedEnvironment.randomId();
9784
+ if (typeof messageId !== "string") {
9785
+ throw new Error("generated message id must be a string");
9786
+ }
9787
+ if (nextMessages[messageId] !== undefined || nextIds.includes(messageId)) {
9788
+ throw new Error(`duplicate message id in conversation: ${messageId}`);
9789
+ }
9790
+ const message = materializeMessage(processedInput, conversation.ids.length + index3, updatedAt, messageId);
9791
+ nextIds.push(message.id);
9792
+ nextMessages[message.id] = message;
9793
+ });
9794
+ return {
9795
+ ...conversation,
9796
+ ids: nextIds,
9797
+ messages: nextMessages,
9798
+ updatedAt
9799
+ };
9800
+ }
9801
+ function appendUserMessage(conversation, content, metadataOrEnvironment, environment) {
9802
+ const metadata = resolveRoleHelperMetadata(metadataOrEnvironment, environment);
9803
+ const resolvedEnvironment = environment ?? (isRoleHelperEnvironmentParameter(metadataOrEnvironment) ? metadataOrEnvironment : undefined);
9804
+ return appendMessages(conversation, { role: "user", content, metadata }, resolvedEnvironment);
9805
+ }
9806
+ function appendAssistantMessage(conversation, content, metadataOrEnvironment, environment) {
9807
+ const metadata = resolveRoleHelperMetadata(metadataOrEnvironment, environment);
9808
+ const resolvedEnvironment = environment ?? (isRoleHelperEnvironmentParameter(metadataOrEnvironment) ? metadataOrEnvironment : undefined);
9809
+ return appendMessages(conversation, { role: "assistant", content, metadata }, resolvedEnvironment);
9810
+ }
9811
+ function resolveRoleHelperMetadata(metadataOrEnvironment, environment) {
9812
+ if (metadataOrEnvironment === undefined)
9813
+ return;
9814
+ if (environment === undefined && isRoleHelperEnvironmentParameter(metadataOrEnvironment)) {
9815
+ return;
9816
+ }
9817
+ if (isMetadataRecord(metadataOrEnvironment))
9818
+ return metadataOrEnvironment;
9819
+ throw new Error("metadata must be a JSON-compatible object");
9535
9820
  }
9536
- var appendUserMessage = appendConversationalistUserMessage;
9537
- var appendAssistantMessage = appendConversationalistAssistantMessage;
9538
9821
  // src/components/chat/export/conversation-export-actions.svelte
9539
9822
  import"svelte/internal/disclose-version";
9540
9823
  import * as $73 from "svelte/internal/client";
@@ -11019,4 +11302,4 @@ export {
11019
11302
  Artifact_panel as ArtifactPanel
11020
11303
  };
11021
11304
 
11022
- //# debugId=39AB4E5BB8E0D1BE64756E2164756E21
11305
+ //# debugId=58C35D46F786E29A64756E2164756E21
@@ -1,12 +1,12 @@
1
1
  /**
2
2
  * Conversation-reading helpers for Chat.
3
3
  *
4
- * These delegate to `conversationalist` so message ordering stays aligned with
5
- * the published conversation package. Tool pairing keeps Chat's role gate so an
6
- * incidental tool-shaped field on a non-tool message never renders as a pair.
4
+ * These helpers operate on the Conversationalist transcript shape while keeping
5
+ * Cinder's browser runtime free of the full conversation package.
7
6
  */
8
- import { getMessages } from 'conversationalist';
9
- import type { Message, ToolCallPair } from '../conversation-model.ts';
7
+ import type { ConversationHistory, Message, ToolCallPair } from '../conversation-model.ts';
8
+ export declare function getMessages(conversation: ConversationHistory, options?: {
9
+ includeHidden?: boolean;
10
+ }): Message[];
10
11
  /** Pairs tool calls with role-valid tool results from an already-ordered message array. */
11
12
  export declare function pairToolCallsWithResults(messages: ReadonlyArray<Message>): ToolCallPair[];
12
- export { getMessages };
@@ -3666,13 +3666,26 @@ function File_text($$anchor, $$props) {
3666
3666
  }));
3667
3667
  }
3668
3668
  // src/components/chat/utilities/conversation.ts
3669
- import { getMessages } from "conversationalist";
3670
- import { pairToolCallsWithResults as pairConversationalistToolCallsWithResults } from "conversationalist/utilities";
3671
- function hasPairableToolField(message) {
3672
- return message.role === "tool-call" && message.toolCall !== undefined || message.role === "tool-result" && message.toolResult !== undefined;
3669
+ function getMessages(conversation, options = {}) {
3670
+ return conversation.ids.map((id) => conversation.messages[id]).filter((message) => message !== undefined).filter((message) => options.includeHidden === true || !message.hidden);
3673
3671
  }
3674
3672
  function pairToolCallsWithResults(messages) {
3675
- return pairConversationalistToolCallsWithResults(messages.filter(hasPairableToolField));
3673
+ const resultsByCallId = new Map;
3674
+ for (const message of messages) {
3675
+ if (message.role === "tool-result" && message.toolResult !== undefined) {
3676
+ resultsByCallId.set(message.toolResult.callId, message.toolResult);
3677
+ }
3678
+ }
3679
+ const pairs = [];
3680
+ for (const message of messages) {
3681
+ if (message.role === "tool-call" && message.toolCall !== undefined) {
3682
+ pairs.push({
3683
+ call: message.toolCall,
3684
+ result: resultsByCallId.get(message.toolCall.id)
3685
+ });
3686
+ }
3687
+ }
3688
+ return pairs;
3676
3689
  }
3677
3690
  // src/components/chat/utilities/utilities.ts
3678
3691
  var CINDER_REASONING_METADATA_KEY = "cinder:reasoning";
@@ -4262,4 +4275,4 @@ export {
4262
4275
  Chat_conversation_header as ChatConversationHeader
4263
4276
  };
4264
4277
 
4265
- //# debugId=3FF39ABB234DF4E864756E2164756E21
4278
+ //# debugId=B66F016402C32A4164756E2164756E21
@@ -64,13 +64,26 @@ function classNames(...parts) {
64
64
  }
65
65
 
66
66
  // src/components/chat/utilities/conversation.ts
67
- import { getMessages } from "conversationalist";
68
- import { pairToolCallsWithResults as pairConversationalistToolCallsWithResults } from "conversationalist/utilities";
69
- function hasPairableToolField(message) {
70
- return message.role === "tool-call" && message.toolCall !== undefined || message.role === "tool-result" && message.toolResult !== undefined;
67
+ function getMessages(conversation, options = {}) {
68
+ return conversation.ids.map((id) => conversation.messages[id]).filter((message) => message !== undefined).filter((message) => options.includeHidden === true || !message.hidden);
71
69
  }
72
70
  function pairToolCallsWithResults(messages) {
73
- return pairConversationalistToolCallsWithResults(messages.filter(hasPairableToolField));
71
+ const resultsByCallId = new Map;
72
+ for (const message of messages) {
73
+ if (message.role === "tool-result" && message.toolResult !== undefined) {
74
+ resultsByCallId.set(message.toolResult.callId, message.toolResult);
75
+ }
76
+ }
77
+ const pairs = [];
78
+ for (const message of messages) {
79
+ if (message.role === "tool-call" && message.toolCall !== undefined) {
80
+ pairs.push({
81
+ call: message.toolCall,
82
+ result: resultsByCallId.get(message.toolCall.id)
83
+ });
84
+ }
85
+ }
86
+ return pairs;
74
87
  }
75
88
  // src/components/chat/utilities/utilities.ts
76
89
  var CINDER_REASONING_METADATA_KEY = "cinder:reasoning";
@@ -520,4 +533,4 @@ export {
520
533
  Chat_conversation_list as ChatConversationList
521
534
  };
522
535
 
523
- //# debugId=FA6DE2C72C326CFB64756E2164756E21
536
+ //# debugId=ADE11286DEEAF0C664756E2164756E21
@@ -9,12 +9,17 @@
9
9
  * ======================================== */
10
10
 
11
11
  .cinder-code-block {
12
+ --cinder-code-block-background: var(--_cinder-code-block-code-surface);
13
+ --cinder-code-block-font-size: var(--cinder-text-sm);
14
+ --cinder-code-block-height: auto;
15
+ --cinder-code-block-line-height: var(--cinder-leading-relaxed);
16
+ --cinder-code-block-padding: var(--cinder-space-4);
12
17
  --_cinder-code-block-code-surface: light-dark(
13
18
  var(--cinder-surface-raised),
14
19
  var(--cinder-surface-inset)
15
20
  );
16
21
 
17
- background: var(--cinder-surface-inset);
22
+ background: var(--cinder-code-block-background);
18
23
  border: 1px solid var(--cinder-border);
19
24
  border-radius: var(--cinder-radius-md);
20
25
  overflow: hidden;
@@ -44,33 +49,34 @@
44
49
  * inner pre elements can stay metrically identical. */
45
50
  .cinder-code-block__viewport {
46
51
  display: block;
47
- overflow-x: auto;
48
- background: var(--_cinder-code-block-code-surface);
52
+ block-size: var(--cinder-code-block-height);
53
+ overflow: auto;
54
+ background: var(--cinder-code-block-background);
49
55
  }
50
56
 
51
57
  .cinder-code-block__pre,
52
58
  .cinder-code-block :where(pre.shiki) {
53
59
  margin: 0;
54
- padding: var(--cinder-space-4);
60
+ padding: var(--cinder-code-block-padding);
55
61
  width: max-content;
56
62
  min-width: 100%;
57
63
  overflow-x: clip;
58
64
  font-family: var(--cinder-font-mono);
59
- font-size: var(--cinder-text-sm);
60
- line-height: var(--cinder-leading-relaxed);
65
+ font-size: var(--cinder-code-block-font-size);
66
+ line-height: var(--cinder-code-block-line-height);
61
67
  color: var(--cinder-text);
62
68
  /* Use near-white in light mode so github-light token colors (e.g. #d73a49
63
69
  * keyword red) clear 4.5:1 WCAG AA. In dark mode keep the deep inset so
64
70
  * github-dark tokens maintain contrast on a very dark surface. */
65
- background: var(--_cinder-code-block-code-surface);
71
+ background: var(--cinder-code-block-background);
66
72
  }
67
73
 
68
74
  /* Shiki writes inline background styles on its generated <pre>; keep the
69
75
  * highlighted state visually and metrically identical to the plain fallback. */
70
76
  .cinder-code-block :where(pre.shiki) {
71
77
  margin: 0 !important;
72
- padding: var(--cinder-space-4) !important;
73
- background: var(--_cinder-code-block-code-surface) !important;
78
+ padding: var(--cinder-code-block-padding) !important;
79
+ background: var(--cinder-code-block-background) !important;
74
80
  }
75
81
 
76
82
  .cinder-code-block__code,
@@ -52,10 +52,16 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
52
52
  });
53
53
 
54
54
  // src/components/code-block/code-block.variables.ts
55
- var variables = [];
55
+ var variables = [
56
+ "--cinder-code-block-background",
57
+ "--cinder-code-block-font-size",
58
+ "--cinder-code-block-height",
59
+ "--cinder-code-block-line-height",
60
+ "--cinder-code-block-padding"
61
+ ];
56
62
  var code_block_variables_default = variables;
57
63
  export {
58
64
  code_block_variables_default as default
59
65
  };
60
66
 
61
- //# debugId=28C5BF47C17214D064756E2164756E21
67
+ //# debugId=78150DCF4A1748A164756E2164756E21
@@ -1,4 +1,6 @@
1
1
  @layer cinder.tokens, cinder.foundation, cinder.components, cinder.utilities;
2
+ @import '../input/input.css';
3
+
2
4
  @layer cinder.components {
3
5
  .cinder-confirm-dialog__description {
4
6
  margin: 0;
@@ -87,6 +87,15 @@ Never use "OK" or "Confirm" in production — they don't describe the action.`
87
87
  description: `When true, the confirm button uses variant="danger". The cancel button still
88
88
  receives default focus regardless — color is never the sole destructive signal.`
89
89
  },
90
+ typeToConfirm: {
91
+ type: "string",
92
+ description: `When set, renders a labelled text input and disables the confirm button until the
93
+ trimmed input matches this value case-insensitively.`
94
+ },
95
+ typeToConfirmLabel: {
96
+ type: "string",
97
+ description: 'Visible label for the typed-confirmation input. Defaults to `Type "<value>" to confirm`.'
98
+ },
90
99
  class: {
91
100
  type: "string",
92
101
  description: "Optional extra class on the underlying <Modal>. Destructured as `class: className` per repo convention."
@@ -123,4 +132,4 @@ export {
123
132
  confirm_dialog_schema_default as default
124
133
  };
125
134
 
126
- //# debugId=A7F3FC6EA5DCEDE864756E2164756E21
135
+ //# debugId=9E452C902BC5550F64756E2164756E21
@@ -36,6 +36,13 @@ export type ConfirmDialogProps = {
36
36
  * receives default focus regardless — color is never the sole destructive signal.
37
37
  */
38
38
  destructive?: boolean;
39
+ /**
40
+ * When set, renders a labelled text input and disables the confirm button until the
41
+ * trimmed input matches this value case-insensitively.
42
+ */
43
+ typeToConfirm?: string;
44
+ /** Visible label for the typed-confirmation input. Defaults to `Type "<value>" to confirm`. */
45
+ typeToConfirmLabel?: string;
39
46
  /** Fired when the user activates the confirm button. Required. Component closes itself after. */
40
47
  onconfirm: () => void;
41
48
  /**