@nonoun/native-chat 0.5.16 → 0.5.21
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 +51 -0
- package/dist/adapter-mock-DQ_CxuNu.js +845 -0
- package/dist/avatar/chat-avatar-element.d.ts +18 -0
- package/dist/avatar/chat-avatar-element.d.ts.map +1 -0
- package/dist/avatar/index.d.ts +2 -0
- package/dist/avatar/index.d.ts.map +1 -0
- package/dist/avatar/n-chat-avatar.d.ts +2 -0
- package/dist/avatar/n-chat-avatar.d.ts.map +1 -0
- package/dist/chat-input-element.d.ts +32 -0
- package/dist/chat-input-element.d.ts.map +1 -0
- package/dist/{chat-input-structured-element-C_5MDbpb.js → chat-input-structured-element-Xm4nCA2K.js} +508 -241
- package/dist/chat-panel-element.d.ts +100 -0
- package/dist/chat-panel-element.d.ts.map +1 -0
- package/dist/feed/chat-feed-element.d.ts +48 -0
- package/dist/feed/chat-feed-element.d.ts.map +1 -0
- package/dist/feed/index.d.ts +2 -0
- package/dist/feed/index.d.ts.map +1 -0
- package/dist/feed/n-chat-feed.d.ts +2 -0
- package/dist/feed/n-chat-feed.d.ts.map +1 -0
- package/dist/gateway/adapter-chatgpt.d.ts +67 -0
- package/dist/gateway/adapter-chatgpt.d.ts.map +1 -0
- package/dist/gateway/adapter-claude.d.ts +68 -0
- package/dist/gateway/adapter-claude.d.ts.map +1 -0
- package/dist/gateway/adapter-mock.d.ts +3 -0
- package/dist/gateway/adapter-mock.d.ts.map +1 -0
- package/dist/gateway/adapter.d.ts +71 -0
- package/dist/gateway/adapter.d.ts.map +1 -0
- package/dist/gateway/controller.d.ts +46 -0
- package/dist/gateway/controller.d.ts.map +1 -0
- package/dist/gateway/index.d.ts +10 -0
- package/dist/gateway/index.d.ts.map +1 -0
- package/dist/gateway/runtime.d.ts +53 -0
- package/dist/gateway/runtime.d.ts.map +1 -0
- package/dist/gateway/types.d.ts +73 -0
- package/dist/gateway/types.d.ts.map +1 -0
- package/dist/gateway.d.ts +2 -0
- package/dist/gateway.d.ts.map +1 -0
- package/dist/gateway.js +33 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/message/chat-input-structured-element.d.ts +43 -0
- package/dist/message/chat-input-structured-element.d.ts.map +1 -0
- package/dist/message/chat-message-activity-element.d.ts +32 -0
- package/dist/message/chat-message-activity-element.d.ts.map +1 -0
- package/dist/message/chat-message-element.d.ts +44 -0
- package/dist/message/chat-message-element.d.ts.map +1 -0
- package/dist/message/chat-message-genui-element.d.ts +45 -0
- package/dist/message/chat-message-genui-element.d.ts.map +1 -0
- package/dist/message/chat-message-seed-element.d.ts +33 -0
- package/dist/message/chat-message-seed-element.d.ts.map +1 -0
- package/dist/message/chat-message-text-element.d.ts +37 -0
- package/dist/message/chat-message-text-element.d.ts.map +1 -0
- package/dist/message/chat-messages-element.d.ts +39 -0
- package/dist/message/chat-messages-element.d.ts.map +1 -0
- package/dist/message/index.d.ts +8 -0
- package/dist/message/index.d.ts.map +1 -0
- package/dist/message/n-chat-message.d.ts +2 -0
- package/dist/message/n-chat-message.d.ts.map +1 -0
- package/dist/native-chat.css +116 -48
- package/dist/native-chat.js +1 -1
- package/dist/register.d.ts +13 -0
- package/dist/register.d.ts.map +1 -0
- package/dist/register.js +3 -3
- package/dist/stream/classify.d.ts +19 -0
- package/dist/stream/classify.d.ts.map +1 -0
- package/dist/stream/create-transport.d.ts +19 -0
- package/dist/stream/create-transport.d.ts.map +1 -0
- package/dist/stream/index.d.ts +9 -0
- package/dist/stream/index.d.ts.map +1 -0
- package/dist/stream/parse-json.d.ts +9 -0
- package/dist/stream/parse-json.d.ts.map +1 -0
- package/dist/stream/parse-ndjson.d.ts +9 -0
- package/dist/stream/parse-ndjson.d.ts.map +1 -0
- package/dist/stream/parse-sse.d.ts +9 -0
- package/dist/stream/parse-sse.d.ts.map +1 -0
- package/dist/stream/types.d.ts +42 -0
- package/dist/stream/types.d.ts.map +1 -0
- package/dist/telemetry/emitter.d.ts +20 -0
- package/dist/telemetry/emitter.d.ts.map +1 -0
- package/dist/telemetry/events.d.ts +11 -0
- package/dist/telemetry/events.d.ts.map +1 -0
- package/dist/telemetry/index.d.ts +5 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/redactor.d.ts +17 -0
- package/dist/telemetry/redactor.d.ts.map +1 -0
- package/dist/telemetry/types.d.ts +27 -0
- package/dist/telemetry/types.d.ts.map +1 -0
- package/package.json +5 -1
package/dist/native-chat.css
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
/* ════════════════════════════════════════════════════
|
|
2
2
|
native-chat — Chat component styles
|
|
3
|
+
════════════════════════════════════════════════════
|
|
4
|
+
|
|
5
|
+
CSS Override Policy
|
|
6
|
+
───────────────────
|
|
7
|
+
chat.css specializes core native-ui components for chat contexts.
|
|
8
|
+
All overrides use zero-specificity :where() selectors or properly
|
|
9
|
+
scoped attribute selectors per the CSS Single-Owner Principle.
|
|
10
|
+
|
|
11
|
+
1. n-textarea (inside n-chat-input):
|
|
12
|
+
Transparent background/borders — composer field should not
|
|
13
|
+
show control chrome. Overrides textarea.css via source order
|
|
14
|
+
(both :where(), chat loads later).
|
|
15
|
+
|
|
16
|
+
2. Sub-containers (n-header, n-body, n-footer):
|
|
17
|
+
Context-specific backgrounds and borders via --n-chat-panel-*
|
|
18
|
+
tokens. Overrides panel.css border pattern via source order.
|
|
19
|
+
|
|
20
|
+
3. Aside overflow:
|
|
21
|
+
overflow: visible instead of panel.css's overflow-y: auto.
|
|
22
|
+
Chat panel delegates scrolling to its n-body sub-container.
|
|
23
|
+
|
|
24
|
+
4. n-button gap (model picker):
|
|
25
|
+
Tighter gap via [justify="spread"] attribute selector (0,1,0)
|
|
26
|
+
beating button.css zero-specificity base rule.
|
|
27
|
+
|
|
3
28
|
════════════════════════════════════════════════════ */
|
|
4
29
|
|
|
5
30
|
@layer ui {
|
|
@@ -47,8 +72,23 @@
|
|
|
47
72
|
/* Activity */
|
|
48
73
|
--n-chat-activity-color: var(--n-ink-muted);
|
|
49
74
|
|
|
75
|
+
/* Seed */
|
|
76
|
+
--n-chat-seed-gap: var(--n-space);
|
|
77
|
+
--n-chat-seed-padding-block: var(--n-space);
|
|
78
|
+
--n-chat-seed-padding-inline: var(--n-chat-bubble-padding-inline);
|
|
79
|
+
|
|
80
|
+
/* Structured input */
|
|
81
|
+
--n-chat-structured-gap: calc(var(--n-space) * 2);
|
|
82
|
+
--n-chat-structured-padding: calc(var(--n-space) * 3);
|
|
83
|
+
|
|
50
84
|
/* Prose */
|
|
51
85
|
--n-chat-prose-gap: calc(var(--n-space) * 2);
|
|
86
|
+
|
|
87
|
+
/* Component-local tokens (magic number extraction) */
|
|
88
|
+
--n-chat-model-picker-max-width: 12rem;
|
|
89
|
+
--n-chat-activity-max-height: 20rem;
|
|
90
|
+
--n-chat-streaming-opacity: 0.85;
|
|
91
|
+
--n-chat-dot-pulse-duration: 1.2s;
|
|
52
92
|
}
|
|
53
93
|
|
|
54
94
|
/* ╭──────────────────────────────────────────────────────────╮
|
|
@@ -91,6 +131,15 @@
|
|
|
91
131
|
line-height: var(--n-line-height);
|
|
92
132
|
}
|
|
93
133
|
|
|
134
|
+
/* ── Aside mode (collapsible side panel) ──
|
|
135
|
+
Base [aside] rule (panel.css) handles: display, width, min-width,
|
|
136
|
+
max-width, overflow, padding, transition + @starting-style.
|
|
137
|
+
Only override what chat-panel needs differently. */
|
|
138
|
+
|
|
139
|
+
:where(native-chat-panel)[aside][open] {
|
|
140
|
+
overflow: visible;
|
|
141
|
+
}
|
|
142
|
+
|
|
94
143
|
/* ── Sub-container integration ── */
|
|
95
144
|
|
|
96
145
|
:where(native-chat-panel) > :where(n-header) {
|
|
@@ -103,6 +152,12 @@
|
|
|
103
152
|
letter-spacing: var(--n-chat-panel-header-label-letter-spacing);
|
|
104
153
|
}
|
|
105
154
|
|
|
155
|
+
:where(native-chat-panel) :where(.n-chat-panel-header-trailing) {
|
|
156
|
+
display: inline-flex;
|
|
157
|
+
align-items: center;
|
|
158
|
+
gap: calc(var(--n-space) * 2);
|
|
159
|
+
}
|
|
160
|
+
|
|
106
161
|
:where(native-chat-panel) > :where(n-body) {
|
|
107
162
|
background: var(--n-chat-panel-body-background);
|
|
108
163
|
}
|
|
@@ -114,39 +169,20 @@
|
|
|
114
169
|
|
|
115
170
|
/* ── Model picker ── */
|
|
116
171
|
|
|
117
|
-
:where(native-chat-panel) :where(n-
|
|
172
|
+
:where(native-chat-panel) :where(n-select[data-role="model-picker"]) {
|
|
173
|
+
max-width: var(--n-chat-model-picker-max-width);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
:where(native-chat-panel) :where(n-select[data-role="model-picker"]) :where(n-button[justify="spread"]) {
|
|
118
177
|
gap: calc(var(--n-space) * 0.5);
|
|
119
|
-
max-width: 12rem;
|
|
120
178
|
}
|
|
121
179
|
|
|
122
|
-
:where(native-chat-panel) :where(n-
|
|
180
|
+
:where(native-chat-panel) :where(n-select[data-role="model-picker"]) :where([slot="label"]) {
|
|
123
181
|
overflow: hidden;
|
|
124
182
|
text-overflow: ellipsis;
|
|
125
183
|
white-space: nowrap;
|
|
126
184
|
}
|
|
127
185
|
|
|
128
|
-
:where(native-chat-panel) :where(n-listbox[data-role="model-listbox"][popover]) {
|
|
129
|
-
position: fixed;
|
|
130
|
-
position-area: block-end span-inline-end;
|
|
131
|
-
position-try-fallbacks: flip-block;
|
|
132
|
-
margin: 0.25rem 0 0;
|
|
133
|
-
min-width: anchor-size(inline);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/* WHY: Wide padding only above 22rem — asides (280–480px) keep compact defaults. */
|
|
137
|
-
@container (min-width: 22rem) {
|
|
138
|
-
:where(native-chat-panel) > :where(n-header) {
|
|
139
|
-
padding-inline: calc(var(--n-space) * 8);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
:where(native-chat-panel) > :where(n-body) {
|
|
143
|
-
padding-inline: calc(var(--n-space) * 8);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
:where(native-chat-panel) > :where(n-footer) {
|
|
147
|
-
padding-inline: calc(var(--n-space) * 8);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
186
|
|
|
151
187
|
/* ── n-chat-content ── */
|
|
152
188
|
|
|
@@ -274,22 +310,22 @@
|
|
|
274
310
|
}
|
|
275
311
|
|
|
276
312
|
/* User messages: right-aligned, avatar on right */
|
|
277
|
-
[role="user"]:where(n-chat-messages) {
|
|
313
|
+
[data-role="user"]:where(n-chat-messages) {
|
|
278
314
|
grid-template-columns: 1fr auto;
|
|
279
315
|
align-self: flex-end;
|
|
280
316
|
}
|
|
281
317
|
|
|
282
|
-
[role="user"]:where(n-chat-messages) > :where(n-chat-avatar) {
|
|
318
|
+
[data-role="user"]:where(n-chat-messages) > :where(n-chat-avatar) {
|
|
283
319
|
grid-column: 2;
|
|
284
320
|
}
|
|
285
321
|
|
|
286
|
-
[role="user"]:where(n-chat-messages) > :where(.n-chat-context),
|
|
287
|
-
[role="user"]:where(n-chat-messages) > :where(.n-chat-bubbles) {
|
|
322
|
+
[data-role="user"]:where(n-chat-messages) > :where(.n-chat-context),
|
|
323
|
+
[data-role="user"]:where(n-chat-messages) > :where(.n-chat-bubbles) {
|
|
288
324
|
grid-column: 1;
|
|
289
325
|
}
|
|
290
326
|
|
|
291
327
|
/* User bubbles align to the right edge */
|
|
292
|
-
[role="user"]:where(n-chat-messages) :where(.n-chat-bubbles) > :where(n-chat-message) {
|
|
328
|
+
[data-role="user"]:where(n-chat-messages) :where(.n-chat-bubbles) > :where(n-chat-message) {
|
|
293
329
|
align-self: flex-end;
|
|
294
330
|
}
|
|
295
331
|
|
|
@@ -312,7 +348,7 @@
|
|
|
312
348
|
color: var(--n-chat-avatar-color);
|
|
313
349
|
|
|
314
350
|
font-size: calc(var(--n-chat-avatar-size) * 0.4);
|
|
315
|
-
font-weight:
|
|
351
|
+
font-weight: var(--n-button-font-weight);
|
|
316
352
|
line-height: 1;
|
|
317
353
|
overflow: hidden;
|
|
318
354
|
user-select: none;
|
|
@@ -356,7 +392,7 @@
|
|
|
356
392
|
}
|
|
357
393
|
|
|
358
394
|
/* User bubble: avatar on right — flip avatar-side / far-side corners */
|
|
359
|
-
[role="user"]:where(n-chat-message) {
|
|
395
|
+
[data-role="user"]:where(n-chat-message) {
|
|
360
396
|
border-radius:
|
|
361
397
|
var(--n-chat-bubble-radius-far-side)
|
|
362
398
|
var(--n-chat-bubble-radius-avatar-side)
|
|
@@ -369,7 +405,7 @@
|
|
|
369
405
|
|
|
370
406
|
/* Streaming status */
|
|
371
407
|
[status="streaming"]:where(n-chat-message) {
|
|
372
|
-
opacity:
|
|
408
|
+
opacity: var(--n-chat-streaming-opacity);
|
|
373
409
|
}
|
|
374
410
|
|
|
375
411
|
/* Error status */
|
|
@@ -382,6 +418,19 @@
|
|
|
382
418
|
border-bottom: 2px dashed var(--n-border-muted);
|
|
383
419
|
}
|
|
384
420
|
|
|
421
|
+
/* Typing status — waiting for first stream chunk */
|
|
422
|
+
[status="typing"]:where(n-chat-message) :where(n-chat-message-text) :where(.n-chat-prose):empty::before {
|
|
423
|
+
content: '\25CF\25CF\25CF';
|
|
424
|
+
letter-spacing: 0.25em;
|
|
425
|
+
color: var(--n-ink-muted);
|
|
426
|
+
animation: n-chat-typing-dots var(--n-chat-dot-pulse-duration, 1.4s) ease-in-out infinite;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
@keyframes n-chat-typing-dots {
|
|
430
|
+
0%, 100% { opacity: 0.3; }
|
|
431
|
+
50% { opacity: 1; }
|
|
432
|
+
}
|
|
433
|
+
|
|
385
434
|
/* ── Message actions toolbar ── */
|
|
386
435
|
|
|
387
436
|
:where(n-chat-message) > :where(n-toolbar[data-role="actions"]) {
|
|
@@ -477,7 +526,7 @@
|
|
|
477
526
|
}
|
|
478
527
|
|
|
479
528
|
:where(n-chat-message-text) :where(h1, h2, h3, h4, h5, h6) {
|
|
480
|
-
font-weight:
|
|
529
|
+
font-weight: var(--n-button-font-weight);
|
|
481
530
|
line-height: 1.3;
|
|
482
531
|
}
|
|
483
532
|
|
|
@@ -509,7 +558,8 @@
|
|
|
509
558
|
}
|
|
510
559
|
|
|
511
560
|
:where(n-chat-message-text) :where(pre) {
|
|
512
|
-
padding: calc(var(--n-space) * 2);
|
|
561
|
+
padding-block: calc(var(--n-space) * 2);
|
|
562
|
+
padding-inline: calc(var(--n-space) * 2);
|
|
513
563
|
background: var(--n-control);
|
|
514
564
|
border-radius: calc(var(--n-radius) * 0.5);
|
|
515
565
|
overflow-x: auto;
|
|
@@ -517,7 +567,8 @@
|
|
|
517
567
|
}
|
|
518
568
|
|
|
519
569
|
:where(n-chat-message-text) :where(pre) :where(code) {
|
|
520
|
-
padding: 0;
|
|
570
|
+
padding-block: 0;
|
|
571
|
+
padding-inline: 0;
|
|
521
572
|
background: transparent;
|
|
522
573
|
border-radius: 0;
|
|
523
574
|
}
|
|
@@ -528,6 +579,10 @@
|
|
|
528
579
|
text-underline-offset: 0.15em;
|
|
529
580
|
}
|
|
530
581
|
|
|
582
|
+
:where(n-chat-message-text) :where(a):hover {
|
|
583
|
+
color: var(--n-ink-hover);
|
|
584
|
+
}
|
|
585
|
+
|
|
531
586
|
:where(n-chat-message-text) :where(hr) {
|
|
532
587
|
border: none;
|
|
533
588
|
border-top: 1px solid var(--n-border-muted);
|
|
@@ -578,7 +633,7 @@
|
|
|
578
633
|
height: 0.25em;
|
|
579
634
|
border-radius: 50%;
|
|
580
635
|
background: currentColor;
|
|
581
|
-
animation: n-chat-dot-pulse
|
|
636
|
+
animation: n-chat-dot-pulse var(--n-chat-dot-pulse-duration) ease-in-out infinite;
|
|
582
637
|
}
|
|
583
638
|
|
|
584
639
|
:where(n-chat-message-activity) :where(.n-chat-activity-dots) > :where(i:nth-child(2)) {
|
|
@@ -617,7 +672,7 @@
|
|
|
617
672
|
padding-inline-start: calc(var(--n-space) * 3);
|
|
618
673
|
font-family: var(--n-font-mono);
|
|
619
674
|
font-size: var(--n-font-size-sm);
|
|
620
|
-
max-height:
|
|
675
|
+
max-height: var(--n-chat-activity-max-height);
|
|
621
676
|
overflow-y: auto;
|
|
622
677
|
scrollbar-width: thin;
|
|
623
678
|
}
|
|
@@ -636,13 +691,19 @@
|
|
|
636
691
|
|
|
637
692
|
:where(n-chat-message-seed) {
|
|
638
693
|
display: block;
|
|
639
|
-
padding-block: var(--n-
|
|
640
|
-
padding-inline: var(--n-chat-
|
|
694
|
+
padding-block: var(--n-chat-seed-padding-block);
|
|
695
|
+
padding-inline: var(--n-chat-seed-padding-inline);
|
|
641
696
|
align-self: flex-start;
|
|
642
697
|
}
|
|
643
698
|
|
|
699
|
+
:where(n-chat-message-seed) > :where(n-stack) {
|
|
700
|
+
gap: var(--n-chat-seed-gap);
|
|
701
|
+
}
|
|
702
|
+
|
|
644
703
|
:where(n-chat-message-seed)[aria-disabled="true"] {
|
|
645
704
|
pointer-events: none;
|
|
705
|
+
color: var(--n-color-disabled);
|
|
706
|
+
cursor: not-allowed;
|
|
646
707
|
}
|
|
647
708
|
|
|
648
709
|
:where(n-chat-message-seed[hidden]) { display: none; }
|
|
@@ -663,7 +724,8 @@
|
|
|
663
724
|
}
|
|
664
725
|
|
|
665
726
|
:where(n-chat-message-genui) :where(.n-chat-genui-error) {
|
|
666
|
-
padding: var(--n-space);
|
|
727
|
+
padding-block: var(--n-space);
|
|
728
|
+
padding-inline: var(--n-space);
|
|
667
729
|
color: var(--n-ink-danger);
|
|
668
730
|
font-size: var(--n-font-size-sm);
|
|
669
731
|
}
|
|
@@ -684,19 +746,22 @@
|
|
|
684
746
|
:where(n-chat-input-structured) {
|
|
685
747
|
display: flex;
|
|
686
748
|
flex-direction: column;
|
|
687
|
-
gap:
|
|
688
|
-
padding:
|
|
689
|
-
|
|
749
|
+
gap: var(--n-chat-structured-gap);
|
|
750
|
+
padding-block: var(--n-chat-structured-padding);
|
|
751
|
+
padding-inline: var(--n-chat-structured-padding);
|
|
752
|
+
--n-background: var(--n-card);
|
|
753
|
+
background: var(--n-background);
|
|
690
754
|
border-radius: var(--n-chat-bubble-radius);
|
|
691
755
|
align-self: stretch;
|
|
692
756
|
}
|
|
693
757
|
|
|
694
758
|
:where(n-chat-input-structured) > :where(.n-chat-structured-question) {
|
|
695
|
-
font-weight:
|
|
759
|
+
font-weight: var(--n-button-font-weight);
|
|
696
760
|
}
|
|
697
761
|
|
|
698
762
|
:where(n-chat-input-structured) > :where(n-stack) {
|
|
699
763
|
flex: 0 0 auto;
|
|
764
|
+
gap: var(--n-chat-seed-gap);
|
|
700
765
|
}
|
|
701
766
|
|
|
702
767
|
:where(n-chat-input-structured) > :where(.n-chat-structured-actions) {
|
|
@@ -708,6 +773,8 @@
|
|
|
708
773
|
|
|
709
774
|
:where(n-chat-input-structured)[aria-disabled="true"] {
|
|
710
775
|
pointer-events: none;
|
|
776
|
+
color: var(--n-color-disabled);
|
|
777
|
+
cursor: not-allowed;
|
|
711
778
|
}
|
|
712
779
|
|
|
713
780
|
:where(n-chat-input-structured[hidden]) { display: none; }
|
|
@@ -724,7 +791,7 @@
|
|
|
724
791
|
}
|
|
725
792
|
|
|
726
793
|
/* Compact: single row */
|
|
727
|
-
:where(n-chat-input
|
|
794
|
+
[compact]:where(n-chat-input) {
|
|
728
795
|
flex-direction: row;
|
|
729
796
|
align-items: center;
|
|
730
797
|
}
|
|
@@ -738,7 +805,8 @@
|
|
|
738
805
|
--n-border-color-hover: transparent;
|
|
739
806
|
--n-border-color-active: transparent;
|
|
740
807
|
|
|
741
|
-
padding: 0;
|
|
808
|
+
padding-block: 0;
|
|
809
|
+
padding-inline: 0;
|
|
742
810
|
border: none;
|
|
743
811
|
border-radius: 0;
|
|
744
812
|
resize: none;
|
|
@@ -773,7 +841,7 @@
|
|
|
773
841
|
min-width: 0;
|
|
774
842
|
}
|
|
775
843
|
|
|
776
|
-
:where(n-chat-input
|
|
844
|
+
[compact]:where(n-chat-input) > :where(n-chat-input-actions) {
|
|
777
845
|
flex: none;
|
|
778
846
|
}
|
|
779
847
|
|
package/dist/native-chat.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as e, c as t, d as n, f as r, g as i, h as a, i as o, l as s, m as c, n as l, o as u, p as d, r as f, s as p, t as m, u as h } from "./chat-input-structured-element-
|
|
1
|
+
import { a as e, c as t, d as n, f as r, g as i, h as a, i as o, l as s, m as c, n as l, o as u, p as d, r as f, s as p, t as m, u as h } from "./chat-input-structured-element-Xm4nCA2K.js";
|
|
2
2
|
/**
|
|
3
3
|
* Parse a Server-Sent Events (SSE) response stream into ChatStreamChunk values.
|
|
4
4
|
*
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { NChatInput } from './chat-input-element.ts';
|
|
2
|
+
import { NChatPanel } from './chat-panel-element.ts';
|
|
3
|
+
import { NChatFeed } from './feed/chat-feed-element.ts';
|
|
4
|
+
import { NChatAvatar } from './avatar/chat-avatar-element.ts';
|
|
5
|
+
import { NChatMessage } from './message/chat-message-element.ts';
|
|
6
|
+
import { NChatMessages } from './message/chat-messages-element.ts';
|
|
7
|
+
import { NChatMessageText } from './message/chat-message-text-element.ts';
|
|
8
|
+
import { NChatMessageActivity } from './message/chat-message-activity-element.ts';
|
|
9
|
+
import { NChatMessageSeed } from './message/chat-message-seed-element.ts';
|
|
10
|
+
import { NChatMessageGenUI } from './message/chat-message-genui-element.ts';
|
|
11
|
+
import { NChatInputStructured } from './message/chat-input-structured-element.ts';
|
|
12
|
+
export { NChatInput, NChatPanel, NChatFeed, NChatAvatar, NChatMessage, NChatMessages, NChatMessageText, NChatMessageActivity, NChatMessageSeed, NChatMessageGenUI, NChatInputStructured, };
|
|
13
|
+
//# sourceMappingURL=register.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../src/register.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AAmDlF,OAAO,EACL,UAAU,EACV,UAAU,EACV,SAAS,EACT,WAAW,EACX,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,GACrB,CAAC"}
|
package/dist/register.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as e, d as t, g as n, h as r, i, l as a, m as o, n as s, p as c, r as l, t as u } from "./chat-input-structured-element-
|
|
2
|
-
import { NButton as d, NCard as f, NDialog as p, NIcon as m, NListbox as h, NOption as g,
|
|
3
|
-
|
|
1
|
+
import { a as e, d as t, g as n, h as r, i, l as a, m as o, n as s, p as c, r as l, t as u } from "./chat-input-structured-element-Xm4nCA2K.js";
|
|
2
|
+
import { NButton as d, NCard as f, NDialog as p, NIcon as m, NListbox as h, NOption as g, NOptionGroup as _, NOptionGroupHeader as v, NSelect as y, NTextarea as b, NToolbar as x, define as S, registerIcon as C } from "@nonoun/native-ui";
|
|
3
|
+
S("n-chat-input", n), S("native-chat-panel", r), S("n-chat-feed", o), S("n-chat-avatar", c), S("n-chat-message", t), S("n-chat-messages", a), S("n-chat-message-text", e), S("n-chat-message-activity", i), S("n-chat-message-seed", l), S("n-chat-message-genui", s), S("n-chat-input-structured", u), S("n-textarea", b), S("n-button", d), S("n-icon", m), S("n-toolbar", x), S("n-dialog", p), S("n-card", f), S("n-listbox", h), S("n-option", g), S("n-option-group", _), S("n-option-group-header", v), S("n-select", y), C("chat-dots", "<svg viewBox=\"0 0 256 256\" fill=\"currentColor\"><path d=\"M116,128a12,12,0,1,1,12,12A12,12,0,0,1,116,128ZM84,140a12,12,0,1,0-12-12A12,12,0,0,0,84,140Zm88,0a12,12,0,1,0-12-12A12,12,0,0,0,172,140Zm60-76V192a16,16,0,0,1-16,16H83l-32.6,28.16-.09.07A15.89,15.89,0,0,1,40,240a16.13,16.13,0,0,1-6.8-1.52A15.85,15.85,0,0,1,24,224V64A16,16,0,0,1,40,48H216A16,16,0,0,1,232,64ZM40,224h0ZM216,64H40V224l34.77-30A8,8,0,0,1,80,192H216Z\"/></svg>"), C("user", "<svg viewBox=\"0 0 256 256\" fill=\"currentColor\"><path d=\"M230.92,212c-15.23-26.33-38.7-45.21-66.09-54.16a72,72,0,1,0-73.66,0C63.78,166.78,40.31,185.66,25.08,212a8,8,0,1,0,13.85,8C55.71,194.74,89.05,176,128,176s72.29,18.74,89.07,44a8,8,0,0,0,13.85-8ZM72,96a56,56,0,1,1,56,56A56.06,56.06,0,0,1,72,96Z\"/></svg>"), C("stop", "<svg viewBox=\"0 0 256 256\" fill=\"currentColor\"><path d=\"M200,40H56A16,16,0,0,0,40,56V200a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,160H56V56H200V200Z\"/></svg>"), C("arrow-counter-clockwise", "<svg viewBox=\"0 0 256 256\" fill=\"currentColor\"><path d=\"M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z\"/></svg>"), C("caret-up-down", "<svg viewBox=\"0 0 256 256\" fill=\"currentColor\"><path d=\"M181.66,170.34a8,8,0,0,1,0,11.32l-48,48a8,8,0,0,1-11.32,0l-48-48a8,8,0,0,1,11.32-11.32L128,212.69l42.34-42.35A8,8,0,0,1,181.66,170.34Zm-96-84.68L128,43.31l42.34,42.35a8,8,0,0,0,11.32-11.32l-48-48a8,8,0,0,0-11.32,0l-48,48A8,8,0,0,0,85.66,85.66Z\"/></svg>"), C("dots-three-outline-fill", "<svg viewBox=\"0 0 256 256\" fill=\"currentColor\"><path d=\"M156,128a28,28,0,1,1-28-28A28,28,0,0,1,156,128ZM48,100a28,28,0,1,0,28,28A28,28,0,0,0,48,100Zm160,0a28,28,0,1,0,28,28A28,28,0,0,0,208,100Z\"/></svg>"), C("plus", "<svg viewBox=\"0 0 256 256\" fill=\"currentColor\"><path d=\"M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z\"/></svg>"), C("microphone", "<svg viewBox=\"0 0 256 256\" fill=\"currentColor\"><path d=\"M128,176a48.05,48.05,0,0,0,48-48V64a48,48,0,0,0-96,0v64A48.05,48.05,0,0,0,128,176ZM96,64a32,32,0,0,1,64,0v64a32,32,0,0,1-64,0Zm40,143.6V240a8,8,0,0,1-16,0V207.6A80.11,80.11,0,0,1,48,128a8,8,0,0,1,16,0,64,64,0,0,0,128,0,8,8,0,0,1,16,0A80.11,80.11,0,0,1,136,207.6Z\"/></svg>"), C("arrow-up", "<svg viewBox=\"0 0 256 256\" fill=\"currentColor\"><path d=\"M205.66,117.66a8,8,0,0,1-11.32,0L136,59.31V216a8,8,0,0,1-16,0V59.31L61.66,117.66a8,8,0,0,1-11.32-11.32l72-72a8,8,0,0,1,11.32,0l72,72A8,8,0,0,1,205.66,117.66Z\"/></svg>"), C("copy", "<svg viewBox=\"0 0 256 256\" fill=\"currentColor\"><path d=\"M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z\"/></svg>"), C("arrow-clockwise", "<svg viewBox=\"0 0 256 256\" fill=\"currentColor\"><path d=\"M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1,0-16H211.4L184.81,71.64l-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,0,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60L224,85.8V56a8,8,0,1,1,16,0Z\"/></svg>"), C("pencil-simple", "<svg viewBox=\"0 0 256 256\" fill=\"currentColor\"><path d=\"M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z\"/></svg>"), C("thumbs-up", "<svg viewBox=\"0 0 256 256\" fill=\"currentColor\"><path d=\"M234,80.12A24,24,0,0,0,216,72H160V56a40,40,0,0,0-40-40,8,8,0,0,0-7.16,4.42L75.06,96H32a16,16,0,0,0-16,16v88a16,16,0,0,0,16,16H204a24,24,0,0,0,23.82-21l12-96A24,24,0,0,0,234,80.12ZM32,112H72v88H32ZM223.94,97l-12,96a8,8,0,0,1-7.94,7H88V105.89l36.71-73.43A24,24,0,0,1,144,56V80a8,8,0,0,0,8,8h64a8,8,0,0,1,7.94,9Z\"/></svg>"), C("thumbs-down", "<svg viewBox=\"0 0 256 256\" fill=\"currentColor\"><path d=\"M239.82,157l-12-96A24,24,0,0,0,204,40H32A16,16,0,0,0,16,56v88a16,16,0,0,0,16,16H75.06l37.78,75.58A8,8,0,0,0,120,240a40,40,0,0,0,40-40V184h56a24,24,0,0,0,23.82-27ZM72,144H32V56H72Zm150,21.29a7.88,7.88,0,0,1-6,2.71H152a8,8,0,0,0-8,8v24a24,24,0,0,1-19.29,23.54L88,150.11V56H204a8,8,0,0,1,7.94,7l12,96A7.87,7.87,0,0,1,222,165.29Z\"/></svg>"), C("arrow-right", "<svg viewBox=\"0 0 256 256\" fill=\"currentColor\"><path d=\"M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z\"/></svg>");
|
|
4
4
|
export { c as NChatAvatar, o as NChatFeed, n as NChatInput, u as NChatInputStructured, t as NChatMessage, i as NChatMessageActivity, s as NChatMessageGenUI, l as NChatMessageSeed, e as NChatMessageText, a as NChatMessages, r as NChatPanel };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ChatStreamChunk, TransportState } from './types.ts';
|
|
2
|
+
export type StreamEndReason = 'complete' | 'partial' | 'error' | 'stopped';
|
|
3
|
+
/**
|
|
4
|
+
* Classify how a stream ended based on the final chunk and optional error.
|
|
5
|
+
* - `complete` — explicit done signal received (e.g., `[DONE]` sentinel, `finish_reason`)
|
|
6
|
+
* - `partial` — stream ended without explicit completion (truncated)
|
|
7
|
+
* - `error` — an error occurred during streaming
|
|
8
|
+
* - `stopped` — consumer aborted the stream
|
|
9
|
+
*/
|
|
10
|
+
export declare function classifyStreamEnd(chunk: ChatStreamChunk, error?: Error): StreamEndReason;
|
|
11
|
+
/**
|
|
12
|
+
* Classify an HTTP status code into a transport state.
|
|
13
|
+
*/
|
|
14
|
+
export declare function classifyHttpError(status: number): TransportState;
|
|
15
|
+
/**
|
|
16
|
+
* Calculate exponential backoff delay with jitter.
|
|
17
|
+
*/
|
|
18
|
+
export declare function backoffDelay(attempt: number, base?: number, max?: number): number;
|
|
19
|
+
//# sourceMappingURL=classify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classify.d.ts","sourceRoot":"","sources":["../../src/stream/classify.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAElE,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;AAE3E;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,eAAe,EAAE,KAAK,CAAC,EAAE,KAAK,GAAG,eAAe,CAOxF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc,CAKhE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,SAAO,EAAE,GAAG,SAAQ,GAAG,MAAM,CAE9E"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ChatStreamChunk, StreamFormat, ChatTransportOptions } from './types.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Detect the stream format from a Content-Type header value.
|
|
4
|
+
*/
|
|
5
|
+
export declare function detectFormat(contentType: string): StreamFormat;
|
|
6
|
+
/**
|
|
7
|
+
* Create an async generator that yields ChatStreamChunk values from a
|
|
8
|
+
* Response, auto-detecting the format from Content-Type when not specified.
|
|
9
|
+
*/
|
|
10
|
+
export declare function createChatStream(response: Response, format?: StreamFormat): AsyncGenerator<ChatStreamChunk>;
|
|
11
|
+
export interface ChatTransport {
|
|
12
|
+
send(body: unknown): Promise<AsyncGenerator<ChatStreamChunk>>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Create a reusable chat transport that sends requests and returns a
|
|
16
|
+
* streaming async generator. Supports retry/backoff and transport state callbacks.
|
|
17
|
+
*/
|
|
18
|
+
export declare function createChatTransport(options: ChatTransportOptions): ChatTransport;
|
|
19
|
+
//# sourceMappingURL=create-transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-transport.d.ts","sourceRoot":"","sources":["../../src/stream/create-transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,oBAAoB,EAAmB,MAAM,YAAY,CAAC;AAMvG;;GAEG;AACH,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,YAAY,CAK9D;AAED;;;GAGG;AACH,wBAAuB,gBAAgB,CACrC,QAAQ,EAAE,QAAQ,EAClB,MAAM,CAAC,EAAE,YAAY,GACpB,cAAc,CAAC,eAAe,CAAC,CAejC;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC,CAAC;CAC/D;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,oBAAoB,GAC5B,aAAa,CAsGf"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type { ChatStreamChunk, StreamFormat, ChatTransportOptions, ChatStreamEvent, TransportState, TransportStatus, TransportStateCallback, RetryOptions, } from './types.ts';
|
|
2
|
+
export { parseSSE } from './parse-sse.ts';
|
|
3
|
+
export { parseNDJSON } from './parse-ndjson.ts';
|
|
4
|
+
export { parseJSON } from './parse-json.ts';
|
|
5
|
+
export type { ChatTransport } from './create-transport.ts';
|
|
6
|
+
export { detectFormat, createChatStream, createChatTransport, } from './create-transport.ts';
|
|
7
|
+
export type { StreamEndReason } from './classify.ts';
|
|
8
|
+
export { classifyStreamEnd, classifyHttpError, backoffDelay } from './classify.ts';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/stream/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,eAAe,EACf,YAAY,EACZ,oBAAoB,EACpB,eAAe,EACf,cAAc,EACd,eAAe,EACf,sBAAsB,EACtB,YAAY,GACb,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAE/B,YAAY,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ChatStreamChunk } from './types.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Parse a standard JSON response as a single ChatStreamChunk.
|
|
4
|
+
*
|
|
5
|
+
* Reads the entire response body, parses as JSON, and yields one chunk
|
|
6
|
+
* with `done: true`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function parseJSON(response: Response): AsyncGenerator<ChatStreamChunk>;
|
|
9
|
+
//# sourceMappingURL=parse-json.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-json.d.ts","sourceRoot":"","sources":["../../src/stream/parse-json.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD;;;;;GAKG;AACH,wBAAuB,SAAS,CAC9B,QAAQ,EAAE,QAAQ,GACjB,cAAc,CAAC,eAAe,CAAC,CA2BjC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ChatStreamChunk } from './types.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Parse a newline-delimited JSON (NDJSON) response stream into ChatStreamChunk values.
|
|
4
|
+
*
|
|
5
|
+
* Each non-empty line is parsed as a standalone JSON object.
|
|
6
|
+
* Accumulates the full message across chunks.
|
|
7
|
+
*/
|
|
8
|
+
export declare function parseNDJSON(response: Response): AsyncGenerator<ChatStreamChunk>;
|
|
9
|
+
//# sourceMappingURL=parse-ndjson.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-ndjson.d.ts","sourceRoot":"","sources":["../../src/stream/parse-ndjson.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD;;;;;GAKG;AACH,wBAAuB,WAAW,CAChC,QAAQ,EAAE,QAAQ,GACjB,cAAc,CAAC,eAAe,CAAC,CA2FjC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ChatStreamChunk } from './types.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Parse a Server-Sent Events (SSE) response stream into ChatStreamChunk values.
|
|
4
|
+
*
|
|
5
|
+
* Reads `data:` lines from the response body, skips empty lines and comments,
|
|
6
|
+
* handles the `[DONE]` sentinel, and accumulates the full message across chunks.
|
|
7
|
+
*/
|
|
8
|
+
export declare function parseSSE(response: Response): AsyncGenerator<ChatStreamChunk>;
|
|
9
|
+
//# sourceMappingURL=parse-sse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-sse.d.ts","sourceRoot":"","sources":["../../src/stream/parse-sse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD;;;;;GAKG;AACH,wBAAuB,QAAQ,CAC7B,QAAQ,EAAE,QAAQ,GACjB,cAAc,CAAC,eAAe,CAAC,CAmIjC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export interface ChatStreamChunk {
|
|
2
|
+
delta: string;
|
|
3
|
+
fullMessage: string;
|
|
4
|
+
role: 'assistant' | 'user';
|
|
5
|
+
datetime: number;
|
|
6
|
+
done: boolean;
|
|
7
|
+
/** True when stream ended without an explicit completion signal (e.g., no `[DONE]` sentinel). */
|
|
8
|
+
partial?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export type StreamFormat = 'sse' | 'ndjson' | 'json';
|
|
11
|
+
export type TransportState = 'idle' | 'sending' | 'streaming' | 'retrying' | 'rate-limited' | 'auth-required' | 'server-error' | 'offline' | 'ready';
|
|
12
|
+
export interface TransportStatus {
|
|
13
|
+
state: TransportState;
|
|
14
|
+
statusCode?: number;
|
|
15
|
+
retryInMs?: number;
|
|
16
|
+
attempt?: number;
|
|
17
|
+
maxAttempts?: number;
|
|
18
|
+
error?: Error;
|
|
19
|
+
}
|
|
20
|
+
export type TransportStateCallback = (status: TransportStatus) => void;
|
|
21
|
+
export interface RetryOptions {
|
|
22
|
+
maxAttempts?: number;
|
|
23
|
+
baseDelayMs?: number;
|
|
24
|
+
maxDelayMs?: number;
|
|
25
|
+
}
|
|
26
|
+
export interface ChatTransportOptions {
|
|
27
|
+
baseUrl: string;
|
|
28
|
+
clientId?: string;
|
|
29
|
+
format?: StreamFormat;
|
|
30
|
+
headers?: Record<string, string>;
|
|
31
|
+
signal?: AbortSignal;
|
|
32
|
+
onStateChange?: TransportStateCallback;
|
|
33
|
+
retry?: RetryOptions;
|
|
34
|
+
}
|
|
35
|
+
export interface ChatStreamEvent {
|
|
36
|
+
type: 'start' | 'chunk' | 'complete' | 'partial' | 'error' | 'stop';
|
|
37
|
+
chunk?: ChatStreamChunk;
|
|
38
|
+
error?: Error;
|
|
39
|
+
durationMs?: number;
|
|
40
|
+
requestId: string;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/stream/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,WAAW,GAAG,MAAM,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,iGAAiG;IACjG,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;AAIrD,MAAM,MAAM,cAAc,GACtB,MAAM,GACN,SAAS,GACT,WAAW,GACX,UAAU,GACV,cAAc,GACd,eAAe,GACf,cAAc,GACd,SAAS,GACT,OAAO,CAAC;AAEZ,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,cAAc,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED,MAAM,MAAM,sBAAsB,GAAG,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;AAEvE,MAAM,WAAW,YAAY;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,aAAa,CAAC,EAAE,sBAAsB,CAAC;IACvC,KAAK,CAAC,EAAE,YAAY,CAAC;CACtB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;IACpE,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { TelemetryCorrelation, TelemetryEvent, TelemetryLevel, TelemetryRedactor } from './types.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Dispatches telemetry events as `CustomEvent` instances on a given
|
|
4
|
+
* `EventTarget`, applying a configurable redactor before emission.
|
|
5
|
+
*/
|
|
6
|
+
export declare class TelemetryEmitter {
|
|
7
|
+
#private;
|
|
8
|
+
constructor(target: EventTarget, level?: TelemetryLevel);
|
|
9
|
+
/** Change the telemetry level, replacing the redactor. */
|
|
10
|
+
setLevel(level: TelemetryLevel): void;
|
|
11
|
+
/** Replace the redactor with a custom implementation. */
|
|
12
|
+
setRedactor(fn: TelemetryRedactor): void;
|
|
13
|
+
/** Apply the redactor and dispatch the event on the target. */
|
|
14
|
+
emit(event: TelemetryEvent): void;
|
|
15
|
+
emitTransport(correlation: TelemetryCorrelation, mode: string, contentType: string): void;
|
|
16
|
+
emitGenerationStart(correlation: TelemetryCorrelation): void;
|
|
17
|
+
emitGenerationComplete(correlation: TelemetryCorrelation, durationMs: number): void;
|
|
18
|
+
emitWarning(correlation: TelemetryCorrelation, message: string, detail?: Record<string, unknown>): void;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=emitter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emitter.d.ts","sourceRoot":"","sources":["../../src/telemetry/emitter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,cAAc,EACd,cAAc,EACd,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAIpB;;;GAGG;AACH,qBAAa,gBAAgB;;gBAIf,MAAM,EAAE,WAAW,EAAE,KAAK,GAAE,cAA0B;IAKlE,0DAA0D;IAC1D,QAAQ,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI;IAIrC,yDAAyD;IACzD,WAAW,CAAC,EAAE,EAAE,iBAAiB,GAAG,IAAI;IAIxC,+DAA+D;IAC/D,IAAI,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI;IASjC,aAAa,CACX,WAAW,EAAE,oBAAoB,EACjC,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,GAClB,IAAI;IAQP,mBAAmB,CAAC,WAAW,EAAE,oBAAoB,GAAG,IAAI;IAQ5D,sBAAsB,CACpB,WAAW,EAAE,oBAAoB,EACjC,UAAU,EAAE,MAAM,GACjB,IAAI;IAQP,WAAW,CACT,WAAW,EAAE,oBAAoB,EACjC,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,IAAI;CAOR"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const CHAT_EVENTS: {
|
|
2
|
+
readonly TRANSPORT: "native:chat-transport";
|
|
3
|
+
readonly GENERATION_START: "native:generation-start";
|
|
4
|
+
readonly GENERATION_COMPLETE: "native:generation-complete";
|
|
5
|
+
readonly GENERATION_STOP: "native:generation-stop";
|
|
6
|
+
readonly GENERATION_ERROR: "native:generation-error";
|
|
7
|
+
readonly WARNING: "native:chat-warning";
|
|
8
|
+
};
|
|
9
|
+
export declare const SAFE_FIELDS: readonly ["requestId", "sessionId", "conversationId", "messageId", "mode", "contentType", "durationMs", "startedAt", "completedAt", "attempt", "maxAttempts", "chunkIndex"];
|
|
10
|
+
export declare const SENSITIVE_FIELDS: readonly ["query", "message", "delta", "fullMessage", "body", "content", "prompt", "response"];
|
|
11
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/telemetry/events.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW;;;;;;;CAOd,CAAC;AAEX,eAAO,MAAM,WAAW,6KAad,CAAC;AAEX,eAAO,MAAM,gBAAgB,gGASnB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type { TelemetryCorrelation, TelemetryTiming, TelemetryRetry, TelemetryLevel, TelemetryEvent, TelemetryRedactor, } from './types.ts';
|
|
2
|
+
export { CHAT_EVENTS, SAFE_FIELDS, SENSITIVE_FIELDS } from './events.ts';
|
|
3
|
+
export { scrubPII, createDefaultRedactor } from './redactor.ts';
|
|
4
|
+
export { TelemetryEmitter } from './emitter.ts';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/telemetry/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,oBAAoB,EACpB,eAAe,EACf,cAAc,EACd,cAAc,EACd,cAAc,EACd,iBAAiB,GAClB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEzE,OAAO,EAAE,QAAQ,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAEhE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { TelemetryLevel, TelemetryRedactor } from './types.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Scrub common PII patterns from a string.
|
|
4
|
+
*
|
|
5
|
+
* Replaces email addresses, phone-like numbers, and credit-card-like
|
|
6
|
+
* number sequences with `[redacted]` placeholders.
|
|
7
|
+
*/
|
|
8
|
+
export declare function scrubPII(text: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Create a default redactor for the given telemetry level.
|
|
11
|
+
*
|
|
12
|
+
* - **minimal**: Sensitive fields in `detail` are replaced with
|
|
13
|
+
* `[redacted:Nchars]` indicating the original length.
|
|
14
|
+
* - **debug**: All fields pass through unmodified.
|
|
15
|
+
*/
|
|
16
|
+
export declare function createDefaultRedactor(level: TelemetryLevel): TelemetryRedactor;
|
|
17
|
+
//# sourceMappingURL=redactor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redactor.d.ts","sourceRoot":"","sources":["../../src/telemetry/redactor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,cAAc,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AASpF;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAK7C;AAMD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,cAAc,GAAG,iBAAiB,CAmB9E"}
|