@pactor-app/chat 1.15.6 → 1.16.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/README.md +7 -3
- package/dist/index.cjs +490 -22
- package/dist/index.d.cts +147 -37
- package/dist/index.d.ts +147 -37
- package/dist/index.js +481 -22
- package/package.json +6 -6
- package/styles.css +169 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pactor-app/chat",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.16.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.
|
|
53
|
-
"@pactor-app/
|
|
54
|
-
"@pactor-app/
|
|
55
|
-
"@pactor-app/
|
|
56
|
-
"@pactor-app/
|
|
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"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"react": ">=18"
|
package/styles.css
CHANGED
|
@@ -75,10 +75,22 @@
|
|
|
75
75
|
默认 3rem),theme-studio 生成的皮肤可直接覆盖两者 */
|
|
76
76
|
--pactor-chat-shell-topbar-height: 44px;
|
|
77
77
|
--pactor-chat-shell-scrim: rgb(0 0 0 / 40%);
|
|
78
|
-
/* 产出物面板(spec: chat-artifact-panel
|
|
79
|
-
|
|
78
|
+
/* 产出物面板(spec: chat-artifact-panel):桌面固定宽右栏。
|
|
79
|
+
默认宽与对话列一致(--pactor-chat-content-width),
|
|
80
|
+
拖拽调宽下限为 --pactor-chat-inspector-min-width;
|
|
81
|
+
背景略深于聊天区底色,视觉上与消息流区分 */
|
|
82
|
+
--pactor-chat-inspector-width: var(--pactor-chat-content-width);
|
|
83
|
+
--pactor-chat-inspector-min-width: 320px;
|
|
84
|
+
--pactor-chat-inspector-bg: color-mix(
|
|
85
|
+
in srgb,
|
|
86
|
+
var(--pactor-chat-bg) 96%,
|
|
87
|
+
black
|
|
88
|
+
);
|
|
80
89
|
/* 对话列限宽居中(spec: chat-app-shell 嵌入契约):置 none 关闭限宽 */
|
|
81
90
|
--pactor-chat-content-width: 768px;
|
|
91
|
+
/* 对话列左右最小内间距(spec: chat-artifact-panel / 拖拽调宽):
|
|
92
|
+
面板调宽挤压剩余空间时,对话列左右始终保留该间距 */
|
|
93
|
+
--pactor-chat-content-gutter: 16px;
|
|
82
94
|
}
|
|
83
95
|
|
|
84
96
|
.pactor-chat-view {
|
|
@@ -188,8 +200,11 @@
|
|
|
188
200
|
height: 100%;
|
|
189
201
|
min-height: 0;
|
|
190
202
|
/* 对话列缺省限宽居中(spec: chat-app-shell 嵌入契约):
|
|
191
|
-
* shell content / 面板 host /
|
|
192
|
-
|
|
203
|
+
* shell content / 面板 host / 独立块级容器三场景统一生效。
|
|
204
|
+
* width 用 calc 预留 gutter——产物栏调宽挤压时,max-width 限宽
|
|
205
|
+
* 失效(剩余空间不足)后左右仍恒保留 --pactor-chat-content-gutter
|
|
206
|
+
* 内间距,不会贴到容器边缘或面板分隔线 */
|
|
207
|
+
width: calc(100% - 2 * var(--pactor-chat-content-gutter));
|
|
193
208
|
max-width: var(--pactor-chat-content-width);
|
|
194
209
|
margin-inline: auto;
|
|
195
210
|
color: var(--pactor-chat-fg);
|
|
@@ -321,14 +336,29 @@
|
|
|
321
336
|
min-width: 0;
|
|
322
337
|
}
|
|
323
338
|
|
|
339
|
+
/* 对话列左右最小内间距(gutter 契约,spec: chat-artifact-panel / 拖拽调宽):
|
|
340
|
+
* 对话列自身的 calc 宽度在 flex 行内会把面板宽度一并计入 100% 基准,
|
|
341
|
+
* 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) {
|
|
345
|
+
padding-left: var(--pactor-chat-content-gutter);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
.pactor-chat-inspector-host > .pactor-chat-inspector {
|
|
349
|
+
margin-left: var(--pactor-chat-content-gutter);
|
|
350
|
+
}
|
|
351
|
+
|
|
324
352
|
.pactor-chat-inspector {
|
|
325
353
|
position: relative;
|
|
326
354
|
display: flex;
|
|
327
355
|
flex-direction: column;
|
|
328
|
-
|
|
356
|
+
/* 默认宽对齐对话列;上限 70% host(与拖拽夹取一致),下限 min-width 令牌 */
|
|
357
|
+
width: min(var(--pactor-chat-inspector-width), 70%);
|
|
358
|
+
min-width: var(--pactor-chat-inspector-min-width);
|
|
329
359
|
flex-shrink: 0;
|
|
330
360
|
border-left: 1px solid var(--pactor-chat-border);
|
|
331
|
-
background: var(--pactor-chat-bg);
|
|
361
|
+
background: var(--pactor-chat-inspector-bg);
|
|
332
362
|
color: var(--pactor-chat-fg);
|
|
333
363
|
font-size: 14px;
|
|
334
364
|
line-height: 1.6;
|
|
@@ -384,6 +414,107 @@
|
|
|
384
414
|
flex-shrink: 0;
|
|
385
415
|
}
|
|
386
416
|
|
|
417
|
+
.pactor-chat-inspector__list-toggle {
|
|
418
|
+
flex-shrink: 0;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
/* 多产物 tab 条(spec: chat-artifact-panel / 多产物切换):
|
|
422
|
+
* header 下沿横向滚动条;激活 tab 以底色 + 底部分隔反色标识 */
|
|
423
|
+
.pactor-chat-inspector__tabs {
|
|
424
|
+
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
|
+
}
|
|
431
|
+
|
|
432
|
+
.pactor-chat-inspector__tab {
|
|
433
|
+
display: flex;
|
|
434
|
+
align-items: center;
|
|
435
|
+
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;
|
|
444
|
+
cursor: pointer;
|
|
445
|
+
white-space: nowrap;
|
|
446
|
+
flex-shrink: 0;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
.pactor-chat-inspector__tab:hover {
|
|
450
|
+
color: var(--pactor-chat-fg);
|
|
451
|
+
}
|
|
452
|
+
|
|
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;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
.pactor-chat-inspector__tab-title {
|
|
460
|
+
overflow: hidden;
|
|
461
|
+
text-overflow: ellipsis;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
/* 产物目录列表视图(spec: chat-artifact-panel / 产物目录):
|
|
465
|
+
* 目录(可折叠)+ 产物行(kind 图标 + 名称 + kind 角标) */
|
|
466
|
+
.pactor-chat-inspector__list {
|
|
467
|
+
list-style: none;
|
|
468
|
+
margin: 0;
|
|
469
|
+
padding: 0;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
.pactor-chat-inspector__list-children {
|
|
473
|
+
padding-left: 18px;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
.pactor-chat-inspector__list-folder,
|
|
477
|
+
.pactor-chat-inspector__list-item {
|
|
478
|
+
display: flex;
|
|
479
|
+
align-items: center;
|
|
480
|
+
gap: 8px;
|
|
481
|
+
width: 100%;
|
|
482
|
+
padding: 7px 8px;
|
|
483
|
+
border: none;
|
|
484
|
+
border-radius: var(--pactor-chat-radius-sm);
|
|
485
|
+
background: transparent;
|
|
486
|
+
color: var(--pactor-chat-fg);
|
|
487
|
+
font-size: 13px;
|
|
488
|
+
text-align: left;
|
|
489
|
+
cursor: pointer;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
.pactor-chat-inspector__list-folder {
|
|
493
|
+
color: var(--pactor-chat-muted-fg);
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
.pactor-chat-inspector__list-folder:hover,
|
|
497
|
+
.pactor-chat-inspector__list-item:hover {
|
|
498
|
+
background: var(--pactor-chat-muted);
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
.pactor-chat-inspector__list-item[data-active='true'] {
|
|
502
|
+
background: var(--pactor-chat-muted);
|
|
503
|
+
font-weight: 600;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
.pactor-chat-inspector__list-folder[data-open='true'] .pactor-chat-trace__chevron {
|
|
507
|
+
transform: rotate(90deg);
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
.pactor-chat-inspector__list-item-title {
|
|
511
|
+
flex: 1;
|
|
512
|
+
min-width: 0;
|
|
513
|
+
overflow: hidden;
|
|
514
|
+
text-overflow: ellipsis;
|
|
515
|
+
white-space: nowrap;
|
|
516
|
+
}
|
|
517
|
+
|
|
387
518
|
.pactor-chat-inspector__body {
|
|
388
519
|
flex: 1;
|
|
389
520
|
min-height: 0;
|
|
@@ -396,6 +527,20 @@
|
|
|
396
527
|
position: relative;
|
|
397
528
|
}
|
|
398
529
|
|
|
530
|
+
/* 图片类产出物(spec: chat-artifact-panel / 常见文件预览):
|
|
531
|
+
* 居中自适应面板宽;svg 原始标记经 data URL 呈现 */
|
|
532
|
+
.pactor-chat-inspector__image {
|
|
533
|
+
display: flex;
|
|
534
|
+
justify-content: center;
|
|
535
|
+
align-items: flex-start;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
.pactor-chat-inspector__image img {
|
|
539
|
+
max-width: 100%;
|
|
540
|
+
height: auto;
|
|
541
|
+
border-radius: var(--pactor-chat-radius-sm);
|
|
542
|
+
}
|
|
543
|
+
|
|
399
544
|
.pactor-chat-inspector__code pre {
|
|
400
545
|
margin: 0;
|
|
401
546
|
padding: 10px 12px;
|
|
@@ -443,6 +588,9 @@
|
|
|
443
588
|
right: 0;
|
|
444
589
|
z-index: 50;
|
|
445
590
|
box-shadow: var(--pactor-chat-shadow-composer);
|
|
591
|
+
/* 抽屉形态:宽度不超出视口,下限令牌不适用 */
|
|
592
|
+
width: min(var(--pactor-chat-inspector-width), 92vw);
|
|
593
|
+
min-width: 0;
|
|
446
594
|
}
|
|
447
595
|
|
|
448
596
|
/* 窄屏覆盖抽屉形态:不显示拖拽手柄(spec scenario: 窄屏无拖拽手柄) */
|
|
@@ -1725,14 +1873,27 @@ button.pactor-chat-trace__header:hover,
|
|
|
1725
1873
|
margin: 1em 0;
|
|
1726
1874
|
}
|
|
1727
1875
|
|
|
1876
|
+
.pactor-markdown h3 {
|
|
1877
|
+
font-size: 1.1em;
|
|
1878
|
+
}
|
|
1879
|
+
|
|
1728
1880
|
.pactor-markdown h2 {
|
|
1729
|
-
font-size: 1.
|
|
1730
|
-
font-weight: 600;
|
|
1881
|
+
font-size: 1.2em;
|
|
1731
1882
|
}
|
|
1732
1883
|
|
|
1733
1884
|
.pactor-markdown h1 {
|
|
1734
1885
|
font-size: 1.3rem;
|
|
1886
|
+
}
|
|
1887
|
+
|
|
1888
|
+
.pactor-markdown h1,
|
|
1889
|
+
.pactor-markdown h2,
|
|
1890
|
+
.pactor-markdown h3,
|
|
1891
|
+
.pactor-markdown h4,
|
|
1892
|
+
.pactor-markdown h5,
|
|
1893
|
+
.pactor-markdown h6 {
|
|
1735
1894
|
font-weight: 600;
|
|
1895
|
+
margin-top: .5em;
|
|
1896
|
+
margin-bottom: .5em;
|
|
1736
1897
|
}
|
|
1737
1898
|
|
|
1738
1899
|
.pactor-chat-thinking {
|