@springbrand/message-panel 0.1.3-alpha.23 → 0.1.3-alpha.25

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.
@@ -18,6 +18,7 @@ export interface ComposerCommandLike {
18
18
  }
19
19
  const demoCompletedAt = Date.now() - 1_000;
20
20
  const demoTurnStartedAt = demoCompletedAt - 18_000;
21
+ const demoTurnId = "camel-demo-research-turn";
21
22
  export const defaultPrompt =
22
23
  "请调研 2026 年 AI Agent 产品的交互趋势,并给出可落地的消息 UI 建议。";
23
24
  export const demoModels = [
@@ -37,6 +38,8 @@ export type DemoScenario =
37
38
  | "temporary_agent"
38
39
  | "agent_tools"
39
40
  | "background_agent"
41
+ | "action_loading"
42
+ | "action_files"
40
43
  | "schedule_create"
41
44
  | "schedule"
42
45
  | "schedule_cancel"
@@ -119,6 +122,18 @@ export const scenarios: Record<DemoScenario, DemoScenarioMeta> = {
119
122
  status: "ready",
120
123
  flowStep: 3,
121
124
  },
125
+ action_loading: {
126
+ label: "Action product loading",
127
+ description: "Preview loading UI for every Action product type.",
128
+ status: "streaming",
129
+ flowStep: 2,
130
+ },
131
+ action_files: {
132
+ label: "Action file results",
133
+ description: "Preview image, audio, video, document, spreadsheet, archive, and unknown files.",
134
+ status: "ready",
135
+ flowStep: 3,
136
+ },
122
137
  schedule_create: {
123
138
  label: "Create scheduled task",
124
139
  description: "Review the task, cadence, and timezone before creating the schedule.",
@@ -246,6 +261,11 @@ function userMessage(prompt: string): UIMessage {
246
261
  } as UIMessage;
247
262
  }
248
263
 
264
+ function actionUserMessage(prompt: string): UIMessage {
265
+ const message = userMessage(prompt);
266
+ return { ...message, parts: message.parts.filter((part) => part.type === "text") };
267
+ }
268
+
249
269
  export interface DemoAskUserResponse {
250
270
  answers: Array<{ selections: string[]; text?: string }>;
251
271
  }
@@ -503,6 +523,95 @@ const backgroundResult = {
503
523
  ],
504
524
  } as unknown as UIMessage;
505
525
 
526
+ const actionProductHints = [
527
+ { type: "image", mediaType: "image/png" },
528
+ { type: "audio", mediaType: "audio/mpeg" },
529
+ { type: "video", mediaType: "video/mp4" },
530
+ { type: "document", mediaType: "application/pdf" },
531
+ { type: "archive", mediaType: "application/zip" },
532
+ { type: "data", mediaType: "application/json" },
533
+ { type: "other" },
534
+ ] as const;
535
+
536
+ function demoExecutionId(index: number) {
537
+ return `00000000-0000-4000-8000-${String(index + 1).padStart(12, "0")}`;
538
+ }
539
+
540
+ const actionProductLoading = {
541
+ id: "camel-demo-action-product-loading",
542
+ role: "assistant",
543
+ parts: actionProductHints.map((produces, index) => ({
544
+ type: "dynamic-tool",
545
+ toolCallId: `camel-demo-action-loading-${index}`,
546
+ toolName: `action_generate_${produces.type}`,
547
+ state: "output-available",
548
+ input: {},
549
+ output: {
550
+ status: "running",
551
+ executionId: demoExecutionId(index),
552
+ presentation: {
553
+ type: "action-execution",
554
+ executionId: demoExecutionId(index),
555
+ state: "running",
556
+ produces,
557
+ content: [],
558
+ },
559
+ },
560
+ })),
561
+ } as unknown as UIMessage;
562
+
563
+ const actionFileFixtures = [
564
+ {
565
+ name: "image",
566
+ mediaType: "image/png",
567
+ url: "https://images.unsplash.com/photo-1500530855697-b586d89ba3ee?auto=format&fit=crop&w=1024&q=80",
568
+ },
569
+ { name: "audio", mediaType: "audio/mpeg", url: "https://files.example/action-demo/audio.mp3" },
570
+ { name: "video", mediaType: "video/mp4", url: "https://files.example/action-demo/video.mp4" },
571
+ { name: "pdf", mediaType: "application/pdf", url: "https://files.example/action-demo/report.pdf" },
572
+ { name: "markdown", mediaType: "text/markdown", url: "https://files.example/action-demo/report.md" },
573
+ {
574
+ name: "spreadsheet",
575
+ mediaType: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
576
+ url: "https://files.example/action-demo/data.xlsx",
577
+ },
578
+ { name: "archive", mediaType: "application/zip", url: "https://files.example/action-demo/files.zip" },
579
+ {
580
+ name: "unknown",
581
+ mediaType: "application/octet-stream",
582
+ url: "https://files.example/action-demo/result.bin",
583
+ },
584
+ ] as const;
585
+
586
+ const actionFileResults = {
587
+ id: "camel-demo-action-file-results",
588
+ role: "assistant",
589
+ parts: [
590
+ ...actionFileFixtures.map((file, index) => ({
591
+ type: "dynamic-tool",
592
+ toolCallId: `camel-demo-action-file-${index}`,
593
+ toolName: `action_generate_${file.name}`,
594
+ state: "output-available",
595
+ input: {},
596
+ output: {
597
+ status: "succeeded",
598
+ executionId: demoExecutionId(index + actionProductHints.length),
599
+ result: { kind: "file", content_type: file.mediaType, url: file.url },
600
+ presentation: {
601
+ type: "action-execution",
602
+ executionId: demoExecutionId(index + actionProductHints.length),
603
+ state: "ready",
604
+ content: [{ type: "file", url: file.url, mediaType: file.mediaType }],
605
+ },
606
+ },
607
+ })),
608
+ {
609
+ type: "text",
610
+ text: "All Action file result types are rendered above from structured output.",
611
+ },
612
+ ],
613
+ } as unknown as UIMessage;
614
+
506
615
  export const demoScheduleInput = {
507
616
  label: "Weekly competitor report",
508
617
  prompt: "Generate and send this week's competitor report.",
@@ -636,7 +745,7 @@ const commandMessages = [
636
745
  const runningWork = {
637
746
  id: "camel-demo-running-work",
638
747
  role: "assistant",
639
- metadata: { turnStartedAt: demoTurnStartedAt },
748
+ metadata: { turnId: demoTurnId, turnStartedAt: demoTurnStartedAt },
640
749
  parts: [
641
750
  {
642
751
  type: "reasoning",
@@ -663,7 +772,7 @@ const runningWork = {
663
772
  const completedResearch = {
664
773
  id: "camel-demo-completed-research",
665
774
  role: "assistant",
666
- metadata: { turnStartedAt: demoTurnStartedAt },
775
+ metadata: { turnId: demoTurnId, turnStartedAt: demoTurnStartedAt },
667
776
  parts: [
668
777
  {
669
778
  type: "reasoning",
@@ -698,6 +807,7 @@ const completedResearch = {
698
807
  const completedSynthesis = {
699
808
  id: "camel-demo-completed-synthesis",
700
809
  role: "assistant",
810
+ metadata: { turnId: demoTurnId },
701
811
  parts: [
702
812
  {
703
813
  type: "tool-update_plan",
@@ -729,6 +839,7 @@ const completedSynthesis = {
729
839
  const approvalRequest = {
730
840
  id: "camel-demo-approval-request",
731
841
  role: "assistant",
842
+ metadata: { turnId: demoTurnId },
732
843
  parts: [
733
844
  {
734
845
  type: "tool-write_file",
@@ -744,6 +855,7 @@ const approvalRequest = {
744
855
  const collectedAnswer = {
745
856
  id: "camel-demo-collected-answer",
746
857
  role: "assistant",
858
+ metadata: { turnId: demoTurnId },
747
859
  parts: [
748
860
  {
749
861
  type: "text",
@@ -760,6 +872,7 @@ const finalAnswer = {
760
872
  id: "camel-demo-final-answer",
761
873
  role: "assistant",
762
874
  metadata: {
875
+ turnId: demoTurnId,
763
876
  createdAt: demoCompletedAt,
764
877
  completedAt: demoCompletedAt,
765
878
  turnDurationMs: 18_000,
@@ -828,6 +941,7 @@ const interruptedByUser = {
828
941
  id: "camel-demo-interrupted",
829
942
  role: "assistant",
830
943
  metadata: {
944
+ turnId: demoTurnId,
831
945
  createdAt: demoCompletedAt,
832
946
  completedAt: demoCompletedAt + 2_000,
833
947
  turnDurationMs: 2_000,
@@ -857,7 +971,7 @@ const compactSummary = {
857
971
  const failedWork = {
858
972
  id: "camel-demo-failed-work",
859
973
  role: "assistant",
860
- metadata: { turnStartedAt: demoTurnStartedAt },
974
+ metadata: { turnId: demoTurnId, turnStartedAt: demoTurnStartedAt },
861
975
  parts: [
862
976
  ...completedResearch.parts,
863
977
  {
@@ -917,6 +1031,12 @@ export function messagesForScenario(
917
1031
  if (scenario === "background_agent") {
918
1032
  return [...conversation, backgroundDispatch, backgroundResult];
919
1033
  }
1034
+ if (scenario === "action_loading") {
1035
+ return [noticeMessage(scenario), actionUserMessage(prompt), actionProductLoading];
1036
+ }
1037
+ if (scenario === "action_files") {
1038
+ return [noticeMessage(scenario), actionUserMessage(prompt), actionFileResults];
1039
+ }
920
1040
  if (scenario === "schedule_create") {
921
1041
  return [...conversation, scheduleRequest];
922
1042
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@springbrand/message-panel",
3
- "version": "0.1.3-alpha.23",
3
+ "version": "0.1.3-alpha.25",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src",