@pactor-app/chat 1.16.0 → 1.17.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pactor-app/chat",
3
- "version": "1.16.0",
3
+ "version": "1.17.0",
4
4
  "description": "Pactor chat: AI message rendering protocol (message model, streaming reducer, safe registry, capability action) and chat runtime view (ChatView / MessageBubble / PartRenderer / Composer / chat layout)",
5
5
  "keywords": [
6
6
  "pactor",
@@ -49,11 +49,11 @@
49
49
  "access": "public"
50
50
  },
51
51
  "dependencies": {
52
- "@pactor-app/core": "1.16.0",
53
- "@pactor-app/permission": "1.16.0",
54
- "@pactor-app/runtime": "1.16.0",
55
- "@pactor-app/markdown": "1.16.0",
56
- "@pactor-app/ui": "1.16.0"
52
+ "@pactor-app/core": "1.17.0",
53
+ "@pactor-app/runtime": "1.17.0",
54
+ "@pactor-app/markdown": "1.17.0",
55
+ "@pactor-app/permission": "1.17.0",
56
+ "@pactor-app/ui": "1.17.0"
57
57
  },
58
58
  "peerDependencies": {
59
59
  "react": ">=18"
package/styles.css CHANGED
@@ -54,6 +54,17 @@
54
54
  transparent
55
55
  );
56
56
  --pactor-chat-code-bg: var(--muted, #f6f7f9);
57
+ /* 产出物卡片图标盒 tone 配色(表格 green / 数据 amber / 代码 blue /
58
+ 图片 violet;文档与兜底走 --pactor-chat-muted(-fg) 不入列)。
59
+ 暗色值见下方 [data-pactor-theme='dark'] 载体块 */
60
+ --pactor-chat-artifact-tone-green-fg: #16a34a;
61
+ --pactor-chat-artifact-tone-green-bg: #dcfce7;
62
+ --pactor-chat-artifact-tone-blue-fg: #2563eb;
63
+ --pactor-chat-artifact-tone-blue-bg: #dbeafe;
64
+ --pactor-chat-artifact-tone-amber-fg: #d97706;
65
+ --pactor-chat-artifact-tone-amber-bg: #fef3c7;
66
+ --pactor-chat-artifact-tone-violet-fg: #7c3aed;
67
+ --pactor-chat-artifact-tone-violet-bg: #ede9fe;
57
68
  /* 旧通用圆角令牌(保留兼容);新组件改用下方圆角阶梯 */
58
69
  --pactor-chat-radius: 12px;
59
70
  /* 圆角阶梯:sm 控件 / md 卡片 / lg 气泡 / xl composer */
@@ -77,10 +88,10 @@
77
88
  --pactor-chat-shell-scrim: rgb(0 0 0 / 40%);
78
89
  /* 产出物面板(spec: chat-artifact-panel):桌面固定宽右栏。
79
90
  默认宽与对话列一致(--pactor-chat-content-width),
80
- 拖拽调宽下限为 --pactor-chat-inspector-min-width;
91
+ 宽度夹取 [--pactor-chat-inspector-min-width, host 宽 2/3];
81
92
  背景略深于聊天区底色,视觉上与消息流区分 */
82
93
  --pactor-chat-inspector-width: var(--pactor-chat-content-width);
83
- --pactor-chat-inspector-min-width: 320px;
94
+ --pactor-chat-inspector-min-width: 480px;
84
95
  --pactor-chat-inspector-bg: color-mix(
85
96
  in srgb,
86
97
  var(--pactor-chat-bg) 96%,
@@ -115,6 +126,15 @@
115
126
  0 1px 2px rgb(0 0 0 / 4%),
116
127
  0 12px 32px -10px rgb(0 0 0 / 55%);
117
128
  --pactor-chat-shell-scrim: rgb(0 0 0 / 55%);
129
+ /* 产出物卡片图标盒 tone 配色(暗色) */
130
+ --pactor-chat-artifact-tone-green-fg: #4ade80;
131
+ --pactor-chat-artifact-tone-green-bg: #14532d;
132
+ --pactor-chat-artifact-tone-blue-fg: #93c5fd;
133
+ --pactor-chat-artifact-tone-blue-bg: #1e3a8a;
134
+ --pactor-chat-artifact-tone-amber-fg: #fbbf24;
135
+ --pactor-chat-artifact-tone-amber-bg: #451a03;
136
+ --pactor-chat-artifact-tone-violet-fg: #c4b5fd;
137
+ --pactor-chat-artifact-tone-violet-bg: #2e1065;
118
138
  }
119
139
 
120
140
  /* 系统偏好暗色兜底:未显式设置 data-pactor-theme 时跟随系统
@@ -127,6 +147,15 @@
127
147
  0 1px 2px rgb(0 0 0 / 4%),
128
148
  0 12px 32px -10px rgb(0 0 0 / 55%);
129
149
  --pactor-chat-shell-scrim: rgb(0 0 0 / 55%);
150
+ /* 产出物卡片图标盒 tone 配色(暗色) */
151
+ --pactor-chat-artifact-tone-green-fg: #4ade80;
152
+ --pactor-chat-artifact-tone-green-bg: #14532d;
153
+ --pactor-chat-artifact-tone-blue-fg: #93c5fd;
154
+ --pactor-chat-artifact-tone-blue-bg: #1e3a8a;
155
+ --pactor-chat-artifact-tone-amber-fg: #fbbf24;
156
+ --pactor-chat-artifact-tone-amber-bg: #451a03;
157
+ --pactor-chat-artifact-tone-violet-fg: #c4b5fd;
158
+ --pactor-chat-artifact-tone-violet-bg: #2e1065;
130
159
  }
131
160
  }
132
161
 
@@ -191,7 +220,8 @@
191
220
 
192
221
  /* ------------------------------------------------------------
193
222
  * ChatWorkspace(spec: chat-dsl-page):createChatWorkspace 工厂
194
- * 返回组件的外层容器 = 可选头部(title + headerExtra)+ ChatView。
223
+ * 返回组件的外层容器 = 对话列(ChatView);工作区头部(header)
224
+ * 上移为全宽容器的直接子级,不随对话列限宽。
195
225
  * ------------------------------------------------------------ */
196
226
 
197
227
  .pactor-chat-workspace {
@@ -212,6 +242,20 @@
212
242
  line-height: 1.6;
213
243
  }
214
244
 
245
+ /* header 承载容器(无产物面板路径):header 通栏 + 主区填满剩余高度 */
246
+ .pactor-chat-with-header {
247
+ display: flex;
248
+ flex-direction: column;
249
+ height: 100%;
250
+ min-height: 0;
251
+ }
252
+
253
+ .pactor-chat-with-header > .pactor-chat-shell,
254
+ .pactor-chat-with-header > .pactor-chat-workspace {
255
+ flex: 1;
256
+ min-height: 0;
257
+ }
258
+
215
259
  .pactor-chat-workspace__header {
216
260
  display: flex;
217
261
  align-items: center;
@@ -313,10 +357,12 @@
313
357
  * 面板关闭 / 未配置时不渲染 DOM(组合层保证)。
314
358
  * ------------------------------------------------------------ */
315
359
 
316
- /* 面板打开时的同行容器:workspace(或 AppShell)与面板 flex 并排,
317
- * host 在 shell content 内撑满剩余高度与宽度 */
360
+ /* 面板打开时的容器:header 通栏(host 直接子级)+ 行内容器
361
+ * (workspace / AppShell 与面板 flex 并排);host 在 shell content
362
+ * 内撑满剩余高度与宽度 */
318
363
  .pactor-chat-inspector-host {
319
364
  display: flex;
365
+ flex-direction: column;
320
366
  flex: 1;
321
367
  width: 100%;
322
368
  min-height: 0;
@@ -324,14 +370,23 @@
324
370
  background: var(--pactor-chat-bg);
325
371
  }
326
372
 
327
- /* 面板打开时 host 内的直子:AppShell 填满剩余空间;workspace 只缩不伸,
373
+ /* host 行内容器:对话列与面板的 flex 行(gutter 契约挂在行上——
374
+ * host padding 会同时作用于通栏 header) */
375
+ .pactor-chat-inspector-host__row {
376
+ display: flex;
377
+ flex: 1;
378
+ width: 100%;
379
+ min-height: 0;
380
+ }
381
+
382
+ /* 面板打开时行内直子:AppShell 填满剩余空间;workspace 只缩不伸,
328
383
  * 宽度受 --pactor-chat-content-width 限宽,margin auto 在剩余空间内居中 */
329
- .pactor-chat-inspector-host > .pactor-chat-shell {
384
+ .pactor-chat-inspector-host__row > .pactor-chat-shell {
330
385
  flex: 1;
331
386
  min-width: 0;
332
387
  }
333
388
 
334
- .pactor-chat-inspector-host > .pactor-chat-workspace {
389
+ .pactor-chat-inspector-host__row > .pactor-chat-workspace {
335
390
  flex: 0 1 auto;
336
391
  min-width: 0;
337
392
  }
@@ -339,13 +394,13 @@
339
394
  /* 对话列左右最小内间距(gutter 契约,spec: chat-artifact-panel / 拖拽调宽):
340
395
  * 对话列自身的 calc 宽度在 flex 行内会把面板宽度一并计入 100% 基准,
341
396
  * shrink 后 margin auto 塌到 0;因此面板打开时的 gutter 由容器侧保证——
342
- * 左:host padding-left;右:面板 margin-left(对话列与分隔线的间距)。
343
- * 面板关闭(:has 不命中)时不加 host padding,避免与对话列 calc 重复计算 */
344
- .pactor-chat-inspector-host:has(> .pactor-chat-inspector) {
397
+ * 左:row padding-left;右:面板 margin-left(对话列与分隔线的间距)。
398
+ * 面板关闭(:has 不命中)时不加 row padding,避免与对话列 calc 重复计算 */
399
+ .pactor-chat-inspector-host__row:has(> .pactor-chat-inspector) {
345
400
  padding-left: var(--pactor-chat-content-gutter);
346
401
  }
347
402
 
348
- .pactor-chat-inspector-host > .pactor-chat-inspector {
403
+ .pactor-chat-inspector-host__row > .pactor-chat-inspector {
349
404
  margin-left: var(--pactor-chat-content-gutter);
350
405
  }
351
406
 
@@ -353,8 +408,8 @@
353
408
  position: relative;
354
409
  display: flex;
355
410
  flex-direction: column;
356
- /* 默认宽对齐对话列;上限 70% host(与拖拽夹取一致),下限 min-width 令牌 */
357
- width: min(var(--pactor-chat-inspector-width), 70%);
411
+ /* 默认宽对齐对话列;上限 host 宽 2/3(与拖拽夹取一致),下限 min-width 令牌 */
412
+ width: min(var(--pactor-chat-inspector-width), calc(100% * 2 / 3));
358
413
  min-width: var(--pactor-chat-inspector-min-width);
359
414
  flex-shrink: 0;
360
415
  border-left: 1px solid var(--pactor-chat-border);
@@ -398,9 +453,8 @@
398
453
  font-weight: 600;
399
454
  }
400
455
 
401
- /* kind 角标(与产出物卡片角标同款) */
402
- .pactor-chat-inspector__kind,
403
- .pactor-chat-artifact-card__kind {
456
+ /* kind 角标 */
457
+ .pactor-chat-inspector__kind {
404
458
  flex-shrink: 0;
405
459
  padding: 0 6px;
406
460
  border-radius: 999px;
@@ -418,47 +472,32 @@
418
472
  flex-shrink: 0;
419
473
  }
420
474
 
421
- /* 多产物 tab 条(spec: chat-artifact-panel / 多产物切换):
422
- * header 下沿横向滚动条;激活 tab 以底色 + 底部分隔反色标识 */
423
- .pactor-chat-inspector__tabs {
475
+ /* 产物切换下拉(spec: chat-artifact-panel / 多产物切换):
476
+ * header 文件名处触发器(图标 + 名称 + chevron),占用标题区剩余宽度 */
477
+ .pactor-chat-inspector__header .dropdown-menu-trigger-wrap {
478
+ flex: 1;
479
+ min-width: 0;
424
480
  display: flex;
425
- gap: 2px;
426
- padding: 4px 8px 0;
427
- border-bottom: 1px solid var(--pactor-chat-border);
428
- overflow-x: auto;
429
- flex-shrink: 0;
430
481
  }
431
482
 
432
- .pactor-chat-inspector__tab {
433
- display: flex;
483
+ .pactor-chat-inspector__menu-trigger {
484
+ display: inline-flex;
434
485
  align-items: center;
435
486
  gap: 6px;
436
- max-width: 180px;
437
- padding: 6px 10px;
438
- border: none;
439
- border-bottom: 2px solid transparent;
440
- background: transparent;
441
- color: var(--pactor-chat-muted-fg);
442
- font-size: 12px;
443
- line-height: 18px;
487
+ min-width: 0;
488
+ max-width: 100%;
489
+ padding: 3px 6px;
490
+ border-radius: var(--pactor-chat-radius-sm);
444
491
  cursor: pointer;
445
- white-space: nowrap;
446
- flex-shrink: 0;
447
- }
448
-
449
- .pactor-chat-inspector__tab:hover {
450
492
  color: var(--pactor-chat-fg);
451
493
  }
452
494
 
453
- .pactor-chat-inspector__tab[data-active='true'] {
454
- color: var(--pactor-chat-fg);
455
- border-bottom-color: var(--pactor-chat-primary);
456
- font-weight: 600;
495
+ .pactor-chat-inspector__menu-trigger:hover {
496
+ background: var(--pactor-chat-muted);
457
497
  }
458
498
 
459
- .pactor-chat-inspector__tab-title {
460
- overflow: hidden;
461
- text-overflow: ellipsis;
499
+ .pactor-chat-inspector__menu-trigger .pactor-chat-inspector__title {
500
+ min-width: 0;
462
501
  }
463
502
 
464
503
  /* 产物目录列表视图(spec: chat-artifact-panel / 产物目录):
@@ -605,23 +644,79 @@
605
644
 
606
645
  /* ------------------------------------------------------------
607
646
  * 产出物卡片(spec: chat-artifact-panel / artifact 消息 part):
608
- * 消息流内 artifact part 的内联呈现——标题 + kind 角标 + 打开按钮。
647
+ * 消息流内 artifact part 的内联呈现——整卡可点击:着色图标盒
648
+ * (按文件类型 tone 取色)+ 标题 + 元信息行(尺寸 · 类型)+
649
+ * 右上箭头。结构与 ChatArtifactCard 内部组件一一对应。
609
650
  * ------------------------------------------------------------ */
610
651
 
611
652
  .pactor-chat-artifact-card {
612
653
  display: flex;
613
654
  align-items: center;
614
- gap: 8px;
655
+ gap: 10px;
656
+ box-sizing: border-box;
657
+ width: 100%;
615
658
  margin: 8px 0;
616
- padding: 10px 12px;
659
+ padding: 12px 14px;
617
660
  border: 1px solid var(--pactor-chat-border);
618
661
  border-radius: var(--pactor-chat-radius-md);
619
662
  background: var(--pactor-chat-card);
663
+ color: var(--pactor-chat-fg);
620
664
  box-shadow: var(--pactor-chat-shadow-sm);
665
+ font: inherit;
666
+ cursor: pointer;
667
+ text-align: left;
668
+ transition: background-color 0.15s ease;
669
+ }
670
+
671
+ .pactor-chat-artifact-card:hover {
672
+ background: var(--pactor-chat-muted);
673
+ }
674
+
675
+ /* 着色图标盒(36px 圆角盒;tone 着色,暗色值见下方覆盖块) */
676
+ .pactor-chat-artifact-card__icon {
677
+ display: inline-flex;
678
+ align-items: center;
679
+ justify-content: center;
680
+ flex: none;
681
+ width: 36px;
682
+ height: 36px;
683
+ border-radius: var(--pactor-chat-radius-sm);
684
+ background: var(--pactor-chat-muted);
685
+ color: var(--pactor-chat-muted-fg);
686
+ }
687
+
688
+ /* 按文件类型着色(tone 见 artifact.ts resolveArtifactIcon;色值走
689
+ * --pactor-chat-artifact-tone-* 令牌,暗色经载体块覆盖、皮肤可精调):
690
+ * 表格 green / 数据 amber / 代码 blue / 图片 violet / 文档与兜底 slate */
691
+ .pactor-chat-artifact-card--green .pactor-chat-artifact-card__icon {
692
+ color: var(--pactor-chat-artifact-tone-green-fg);
693
+ background: var(--pactor-chat-artifact-tone-green-bg);
694
+ }
695
+
696
+ .pactor-chat-artifact-card--blue .pactor-chat-artifact-card__icon {
697
+ color: var(--pactor-chat-artifact-tone-blue-fg);
698
+ background: var(--pactor-chat-artifact-tone-blue-bg);
699
+ }
700
+
701
+ .pactor-chat-artifact-card--amber .pactor-chat-artifact-card__icon {
702
+ color: var(--pactor-chat-artifact-tone-amber-fg);
703
+ background: var(--pactor-chat-artifact-tone-amber-bg);
704
+ }
705
+
706
+ .pactor-chat-artifact-card--violet .pactor-chat-artifact-card__icon {
707
+ color: var(--pactor-chat-artifact-tone-violet-fg);
708
+ background: var(--pactor-chat-artifact-tone-violet-bg);
709
+ }
710
+
711
+ .pactor-chat-artifact-card__text {
712
+ display: flex;
713
+ flex-direction: column;
714
+ gap: 2px;
715
+ flex: 1 1 auto;
716
+ min-width: 0;
621
717
  }
622
718
 
623
719
  .pactor-chat-artifact-card__title {
624
- flex: 1;
625
720
  min-width: 0;
626
721
  overflow: hidden;
627
722
  text-overflow: ellipsis;
@@ -630,23 +725,45 @@
630
725
  font-size: 13px;
631
726
  }
632
727
 
633
- .pactor-chat-artifact-card__open {
634
- flex-shrink: 0;
728
+ /* 元信息行(尺寸 · 类型标签) */
729
+ .pactor-chat-artifact-card__meta {
730
+ font-size: 11px;
731
+ color: var(--pactor-chat-muted-fg);
732
+ }
733
+
734
+ /* 右上箭头(打开面板暗示) */
735
+ .pactor-chat-artifact-card__arrow {
736
+ flex: none;
737
+ color: var(--pactor-chat-muted-fg);
738
+ }
739
+
740
+ /* 连续产物卡片组(spec: chat-artifact-panel / 卡片区收起):
741
+ * 同一消息内连续 artifact part 合组;超 4 个收起,footer 右端
742
+ * 「展开 / 收起」+「查看所有产物(n) ›」(打开面板产物目录视图) */
743
+ .pactor-chat-artifact-group__footer {
744
+ display: flex;
745
+ justify-content: flex-end;
746
+ align-items: center;
747
+ gap: 12px;
748
+ margin: -2px 0 8px;
749
+ }
750
+
751
+ .pactor-chat-artifact-group__toggle,
752
+ .pactor-chat-artifact-group__all {
635
753
  display: inline-flex;
636
754
  align-items: center;
637
- gap: 4px;
638
- white-space: nowrap;
639
- padding: 4px 10px;
640
- border: 1px solid var(--pactor-chat-border);
755
+ gap: 3px;
756
+ padding: 2px 4px;
757
+ border: none;
641
758
  border-radius: var(--pactor-chat-radius-sm);
642
759
  background: transparent;
643
760
  color: var(--pactor-chat-primary);
644
761
  font-size: 12px;
645
762
  cursor: pointer;
646
- transition: background 0.15s ease;
647
763
  }
648
764
 
649
- .pactor-chat-artifact-card__open:hover {
765
+ .pactor-chat-artifact-group__toggle:hover,
766
+ .pactor-chat-artifact-group__all:hover {
650
767
  background: var(--pactor-chat-muted);
651
768
  }
652
769
 
@@ -948,6 +1065,7 @@
948
1065
  .pactor-chat-message__actions {
949
1066
  display: flex;
950
1067
  gap: 4px;
1068
+
951
1069
  opacity: 0;
952
1070
  transition: opacity 0.15s ease;
953
1071
  }
@@ -962,6 +1080,20 @@
962
1080
  opacity: 1;
963
1081
  }
964
1082
 
1083
+ /* assistant 终态消息底部行:操作条 + 常显时间戳 */
1084
+ .pactor-chat-message__footer {
1085
+ display: flex;
1086
+ align-items: center;
1087
+ gap: 8px;
1088
+ }
1089
+
1090
+ .pactor-chat-message__time {
1091
+ flex-shrink: 0;
1092
+ color: var(--pactor-chat-muted-fg);
1093
+ font-size: 11px;
1094
+ line-height: 18px;
1095
+ }
1096
+
965
1097
  /* user 消息内联编辑框(编辑重发) */
966
1098
  .pactor-chat-message__edit {
967
1099
  display: flex;