@narumitw/pi-inspect 0.0.0-stage → 0.1.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 (49) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +107 -2
  3. package/dist/app.css +1 -0
  4. package/dist/app.js +129 -0
  5. package/dist/index.html +1 -0
  6. package/docs/REVIEW.md +189 -0
  7. package/docs/VERIFICATION.md +186 -0
  8. package/docs/viewer.md +63 -0
  9. package/package.json +67 -4
  10. package/src/ancestry.ts +32 -0
  11. package/src/collector.ts +143 -0
  12. package/src/context.ts +115 -0
  13. package/src/correlation.ts +27 -0
  14. package/src/entry-index.ts +17 -0
  15. package/src/extension.ts +259 -0
  16. package/src/feed.ts +145 -0
  17. package/src/identity.ts +112 -0
  18. package/src/index.ts +1 -0
  19. package/src/model.ts +113 -0
  20. package/src/native-projection.ts +28 -0
  21. package/src/privacy.ts +136 -0
  22. package/src/projection.ts +361 -0
  23. package/src/server.ts +202 -0
  24. package/src/system-message.ts +117 -0
  25. package/src/web/api.ts +137 -0
  26. package/src/web/app.tsx +439 -0
  27. package/src/web/components.css +261 -0
  28. package/src/web/components.tsx +289 -0
  29. package/src/web/composition.css +554 -0
  30. package/src/web/context-composition.tsx +324 -0
  31. package/src/web/entry-calls.ts +14 -0
  32. package/src/web/format.ts +92 -0
  33. package/src/web/hierarchy.ts +117 -0
  34. package/src/web/inline-entry.tsx +124 -0
  35. package/src/web/inspector.tsx +337 -0
  36. package/src/web/json-tree.tsx +74 -0
  37. package/src/web/live-drawer.tsx +175 -0
  38. package/src/web/overview.tsx +67 -0
  39. package/src/web/panels.css +267 -0
  40. package/src/web/panes.tsx +123 -0
  41. package/src/web/search.ts +16 -0
  42. package/src/web/style.css +332 -0
  43. package/src/web/styles.d.ts +1 -0
  44. package/src/web/timeline.tsx +33 -0
  45. package/src/web/timing.ts +26 -0
  46. package/src/web/trace.css +410 -0
  47. package/src/web/trace.tsx +273 -0
  48. package/src/web/tree.tsx +281 -0
  49. package/src/web/virtual-context.ts +138 -0
@@ -0,0 +1,554 @@
1
+ /* Composition owns the editorial presentation; existing diagnostic controls remain secondary. */
2
+ .inspector-app.light {
3
+ --app-bg: #f5f2eb;
4
+ --panel-bg: #faf8f3;
5
+ --panel-raised: #eeebe4;
6
+ --surface-hover: #e9e6de;
7
+ --panel-border: #dedbd4;
8
+ --secondary: #63676e;
9
+ --muted: #676b72;
10
+ --code-bg: #eeebe4;
11
+ --selected-bg: #638dd119;
12
+ --gray-12: #343741;
13
+ }
14
+ .inspector-app.dark {
15
+ --app-bg: #202327;
16
+ --panel-bg: #26292e;
17
+ --panel-raised: #30343a;
18
+ --surface-hover: #353a41;
19
+ --panel-border: #41454d;
20
+ --secondary: #c0c3ca;
21
+ --muted: #a0a4ad;
22
+ --code-bg: #2e3237;
23
+ --selected-bg: #638dd124;
24
+ }
25
+ .inspector-app {
26
+ --system-bg: #e6deeb;
27
+ --system-fg: #705487;
28
+ --user-bg: #dee8f5;
29
+ --user-fg: #355f98;
30
+ --assistant-bg: #e0e9df;
31
+ --assistant-fg: #466b52;
32
+ --tool-call-bg: #f4e5d6;
33
+ --tool-call-fg: #946035;
34
+ --tool-result-bg: #e2e7ea;
35
+ --tool-result-fg: #4c6371;
36
+ --other-bg: #eeebe4;
37
+ --other-fg: #696d73;
38
+ --default-font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
39
+ font: 13px / 1.5 var(--default-font-family);
40
+ }
41
+ .inspector-app.dark {
42
+ --system-bg: #393440;
43
+ --system-fg: #c6afd8;
44
+ --user-bg: #2d394c;
45
+ --user-fg: #a7bfdf;
46
+ --assistant-bg: #313f34;
47
+ --assistant-fg: #b1cdb4;
48
+ --tool-call-bg: #47392f;
49
+ --tool-call-fg: #dfb58a;
50
+ --tool-result-bg: #333d43;
51
+ --tool-result-fg: #b7cbd4;
52
+ --other-bg: #35383d;
53
+ --other-fg: #c0c3ca;
54
+ }
55
+ .app-header {
56
+ height: 64px;
57
+ padding: 0 28px;
58
+ }
59
+ .brand-logo {
60
+ width: 36px;
61
+ height: 36px;
62
+ background: #b7cbea;
63
+ color: #343741;
64
+ border-radius: 8px;
65
+ }
66
+ .brand .rt-Heading {
67
+ font-size: 18px;
68
+ font-weight: 600;
69
+ }
70
+ .header-context {
71
+ border-left: 1px solid var(--panel-border);
72
+ padding-left: 20px;
73
+ font-size: 12px;
74
+ }
75
+ .header-actions .rt-Badge {
76
+ border-radius: 20px;
77
+ padding: 6px 12px;
78
+ }
79
+ .app-grid {
80
+ padding: 18px 28px 6px;
81
+ }
82
+ .app-footer {
83
+ height: 34px;
84
+ font-size: 11px;
85
+ padding: 0 28px;
86
+ }
87
+ .surface-switch,
88
+ .context-filters {
89
+ padding: 0;
90
+ margin: 0;
91
+ border: 0;
92
+ min-width: 0;
93
+ }
94
+ .surface-switch {
95
+ display: flex;
96
+ gap: 4px;
97
+ }
98
+ .surface-switch button,
99
+ .context-filters button {
100
+ border: 1px solid var(--panel-border);
101
+ background: var(--panel-bg);
102
+ color: var(--secondary);
103
+ border-radius: 6px;
104
+ padding: 7px 10px;
105
+ font-size: 11px;
106
+ white-space: nowrap;
107
+ }
108
+ .surface-switch button[aria-pressed="true"],
109
+ .context-filters button[aria-pressed="true"] {
110
+ background: var(--user-bg);
111
+ color: var(--gray-12);
112
+ }
113
+ .context-surface,
114
+ .events-surface {
115
+ display: flex;
116
+ flex-direction: column;
117
+ min-height: 0;
118
+ flex: 1;
119
+ }
120
+ .context-surface[hidden],
121
+ .events-surface[hidden] {
122
+ display: none;
123
+ }
124
+ .context-composition {
125
+ flex: 1;
126
+ min-height: 0;
127
+ display: flex;
128
+ flex-direction: column;
129
+ }
130
+ .composition-heading {
131
+ display: flex;
132
+ align-items: center;
133
+ gap: 18px;
134
+ padding-bottom: 9px;
135
+ flex-wrap: wrap;
136
+ flex-shrink: 0;
137
+ }
138
+ .composition-heading > div:first-child {
139
+ margin-right: auto;
140
+ }
141
+ .composition-heading .rt-Heading {
142
+ font-size: 23px;
143
+ font-weight: 600;
144
+ letter-spacing: -0.5px;
145
+ }
146
+ .composition-count {
147
+ display: block;
148
+ color: var(--muted);
149
+ font-size: 11px;
150
+ margin-top: 2px;
151
+ }
152
+ .composition-heading .rt-TextFieldRoot {
153
+ width: 240px;
154
+ background: var(--panel-bg);
155
+ box-shadow: none;
156
+ border: 1px solid var(--panel-border);
157
+ }
158
+ .context-filters {
159
+ display: flex;
160
+ gap: 5px;
161
+ flex-wrap: wrap;
162
+ }
163
+ .context-provenance {
164
+ color: var(--secondary);
165
+ font-size: 10px;
166
+ padding-bottom: 12px;
167
+ max-width: 100%;
168
+ flex-shrink: 0;
169
+ }
170
+ .context-provenance strong {
171
+ font-weight: 500;
172
+ color: var(--amber-11);
173
+ }
174
+ .composition-body {
175
+ display: flex;
176
+ gap: 12px;
177
+ flex: 1;
178
+ min-height: 0;
179
+ }
180
+ .context-scroll {
181
+ overflow-anchor: none;
182
+ overflow: auto;
183
+ flex: 1;
184
+ min-height: 0;
185
+ min-width: 0;
186
+ scrollbar-width: thin;
187
+ scrollbar-color: var(--panel-border) transparent;
188
+ }
189
+ .virtual-segments {
190
+ position: relative;
191
+ min-width: 0;
192
+ }
193
+ .context-segment {
194
+ position: absolute;
195
+ width: 100%;
196
+ padding: 0 2px 8px 25px;
197
+ --role-bg: var(--other-bg);
198
+ --role-fg: var(--other-fg);
199
+ }
200
+ [data-category="system"] {
201
+ --role-bg: var(--system-bg);
202
+ --role-fg: var(--system-fg);
203
+ }
204
+ [data-category="user"] {
205
+ --role-bg: var(--user-bg);
206
+ --role-fg: var(--user-fg);
207
+ }
208
+ [data-category="assistant"] {
209
+ --role-bg: var(--assistant-bg);
210
+ --role-fg: var(--assistant-fg);
211
+ }
212
+ [data-category="toolCall"] {
213
+ --role-bg: var(--tool-call-bg);
214
+ --role-fg: var(--tool-call-fg);
215
+ }
216
+ [data-category="toolResult"] {
217
+ --role-bg: var(--tool-result-bg);
218
+ --role-fg: var(--tool-result-fg);
219
+ }
220
+ [data-category="other"] {
221
+ --role-bg: var(--other-bg);
222
+ --role-fg: var(--other-fg);
223
+ }
224
+ .context-segment::before {
225
+ content: "";
226
+ position: absolute;
227
+ left: 10px;
228
+ top: 0;
229
+ bottom: 0;
230
+ border-left: 1px solid var(--panel-border);
231
+ }
232
+ .context-segment::after {
233
+ content: "";
234
+ position: absolute;
235
+ left: 6px;
236
+ top: 20px;
237
+ width: 7px;
238
+ height: 7px;
239
+ border-radius: 50%;
240
+ background: var(--role-fg);
241
+ opacity: 0.65;
242
+ }
243
+ .segment-row {
244
+ width: 100%;
245
+ text-align: left;
246
+ display: flex;
247
+ align-items: center;
248
+ gap: 16px;
249
+ min-height: 44px;
250
+ padding: 8px 13px;
251
+ background: var(--role-bg);
252
+ border: 1px solid transparent;
253
+ border-radius: 7px;
254
+ color: var(--gray-12);
255
+ cursor: pointer;
256
+ }
257
+ .segment-row:hover {
258
+ border-color: color-mix(in srgb, var(--role-fg), transparent 55%);
259
+ }
260
+ .segment-row.selected {
261
+ border-color: #638dd1;
262
+ }
263
+ .segment-row:focus-visible {
264
+ outline: 2px solid #426fa9;
265
+ outline-offset: -2px;
266
+ }
267
+ .segment-position {
268
+ width: 44px;
269
+ font-size: 11px;
270
+ color: var(--secondary);
271
+ border-right: 1px solid color-mix(in srgb, var(--role-fg), transparent 80%);
272
+ flex-shrink: 0;
273
+ }
274
+ .segment-row .event-glyph {
275
+ color: var(--role-fg);
276
+ width: 23px;
277
+ }
278
+ .segment-row .event-glyph svg {
279
+ width: 21px;
280
+ height: 21px;
281
+ }
282
+ .segment-row strong {
283
+ text-transform: uppercase;
284
+ width: 172px;
285
+ flex-shrink: 0;
286
+ font-size: 11px;
287
+ font-weight: 500;
288
+ overflow: hidden;
289
+ text-overflow: ellipsis;
290
+ white-space: nowrap;
291
+ }
292
+ .segment-preview {
293
+ flex: 1;
294
+ min-width: 0;
295
+ white-space: nowrap;
296
+ text-overflow: ellipsis;
297
+ overflow: hidden;
298
+ }
299
+ .segment-row time {
300
+ color: var(--secondary);
301
+ font-size: 11px;
302
+ width: 72px;
303
+ flex-shrink: 0;
304
+ }
305
+ .segment-chevron {
306
+ display: grid;
307
+ place-items: center;
308
+ flex-shrink: 0;
309
+ }
310
+ .segment-details {
311
+ display: grid;
312
+ grid-template-columns: minmax(230px, 28%) minmax(0, 1fr);
313
+ gap: 18px;
314
+ padding: 16px;
315
+ background: var(--panel-bg);
316
+ border: 1px solid var(--panel-border);
317
+ border-top: 0;
318
+ border-radius: 0 0 7px 7px;
319
+ }
320
+ .message-details {
321
+ border-right: 1px solid var(--panel-border);
322
+ padding-right: 16px;
323
+ min-width: 0;
324
+ }
325
+ .message-details h3 {
326
+ font-size: 12px;
327
+ font-weight: 600;
328
+ margin: 0 0 14px;
329
+ }
330
+ .message-details .metadata {
331
+ font-size: 12px;
332
+ line-height: 20px;
333
+ }
334
+ .message-details .metadata > div {
335
+ grid-template-columns: 94px minmax(0, 1fr);
336
+ gap: 10px;
337
+ padding: 6px 0;
338
+ }
339
+ .segment-content {
340
+ min-width: 0;
341
+ }
342
+ .segment-content .data {
343
+ border: 0;
344
+ border-radius: 5px;
345
+ background: var(--panel-raised);
346
+ margin: 0 0 8px;
347
+ padding: 5px 10px;
348
+ }
349
+ .segment-content .data:first-child {
350
+ background: transparent;
351
+ border: 1px solid var(--panel-border);
352
+ }
353
+ .segment-content .code-preview {
354
+ background: var(--panel-raised);
355
+ font-size: 12px;
356
+ }
357
+ .segment-content .section-toggle {
358
+ font-size: 12px;
359
+ }
360
+ .segment-content .data:has(.section-toggle[aria-expanded="false"]) .copy-button {
361
+ display: none;
362
+ }
363
+ .segment-content .data-mode {
364
+ font-size: 10px;
365
+ }
366
+ .context-minimap {
367
+ width: 24px;
368
+ padding: 5px;
369
+ border: 1px solid var(--panel-border);
370
+ border-radius: 7px;
371
+ display: flex;
372
+ flex-direction: column;
373
+ gap: 3px;
374
+ overflow-y: auto;
375
+ flex-shrink: 0;
376
+ align-self: stretch;
377
+ scrollbar-width: none;
378
+ }
379
+ .context-minimap button {
380
+ display: flex;
381
+ min-height: 5px;
382
+ flex: 1;
383
+ width: 100%;
384
+ padding: 0;
385
+ border: 0;
386
+ border-radius: 1px;
387
+ background: var(--other-bg);
388
+ }
389
+ .context-minimap button span {
390
+ display: block;
391
+ align-self: stretch;
392
+ background: var(--role-bg);
393
+ min-width: 1px;
394
+ }
395
+ .context-minimap button[aria-current="true"] {
396
+ outline: 1px solid #638dd1;
397
+ outline-offset: 1px;
398
+ }
399
+ .composition-footer {
400
+ display: flex;
401
+ justify-content: space-between;
402
+ color: var(--muted);
403
+ font-size: 10px;
404
+ padding: 10px 0 5px 25px;
405
+ flex-shrink: 0;
406
+ gap: 12px;
407
+ }
408
+ .provider-observation {
409
+ flex-shrink: 0;
410
+ font-size: 10px;
411
+ color: var(--secondary);
412
+ max-height: 25vh;
413
+ overflow: auto;
414
+ padding: 5px;
415
+ }
416
+ .provider-observation summary {
417
+ cursor: pointer;
418
+ }
419
+ .live-drawer {
420
+ border: 0;
421
+ border-top: 1px solid var(--panel-border);
422
+ border-radius: 0;
423
+ background: transparent;
424
+ }
425
+ .live-drawer-toggle {
426
+ padding: 6px 5px;
427
+ }
428
+ @media (max-width: 1100px) {
429
+ .app-header {
430
+ padding: 0 16px;
431
+ }
432
+ .app-grid {
433
+ padding: 14px 16px 5px;
434
+ }
435
+ .composition-heading {
436
+ gap: 10px;
437
+ }
438
+ .composition-heading .rt-TextFieldRoot {
439
+ width: 210px;
440
+ }
441
+ .segment-row {
442
+ gap: 10px;
443
+ }
444
+ .segment-row strong {
445
+ width: 135px;
446
+ }
447
+ .segment-details {
448
+ grid-template-columns: minmax(180px, 30%) minmax(0, 1fr);
449
+ gap: 12px;
450
+ }
451
+ }
452
+ @media (max-width: 680px) {
453
+ .app-header {
454
+ height: 80px;
455
+ padding: 6px 8px;
456
+ gap: 3px;
457
+ flex-wrap: wrap;
458
+ }
459
+ .app-header .brand {
460
+ width: 100%;
461
+ }
462
+ .header-actions {
463
+ width: 100%;
464
+ justify-content: flex-end;
465
+ }
466
+ .brand .rt-Heading {
467
+ font-size: 12px;
468
+ }
469
+ .brand-logo {
470
+ width: 24px;
471
+ height: 24px;
472
+ font-size: 21px;
473
+ }
474
+ .surface-switch button {
475
+ font-size: 9px;
476
+ padding: 5px;
477
+ }
478
+ .header-actions {
479
+ gap: 2px;
480
+ }
481
+ .header-actions .rt-Badge:first-of-type {
482
+ display: inline-flex;
483
+ font-size: 9px;
484
+ padding: 3px 6px;
485
+ }
486
+ .app-grid {
487
+ padding: 12px 8px 4px;
488
+ }
489
+ .composition-heading .rt-Heading {
490
+ font-size: 19px;
491
+ }
492
+ .composition-heading .rt-TextFieldRoot {
493
+ width: 100%;
494
+ }
495
+ .context-provenance {
496
+ font-size: 9px;
497
+ }
498
+ .context-segment {
499
+ padding-left: 12px;
500
+ }
501
+ .context-segment::before {
502
+ left: 3px;
503
+ }
504
+ .context-segment::after {
505
+ left: 0;
506
+ width: 6px;
507
+ height: 6px;
508
+ }
509
+ .segment-row {
510
+ display: grid;
511
+ grid-template-columns: 28px 20px minmax(0, 1fr) 14px;
512
+ gap: 6px;
513
+ }
514
+ .segment-row strong {
515
+ width: auto;
516
+ font-size: 10px;
517
+ }
518
+ .segment-position {
519
+ width: 28px;
520
+ }
521
+ .segment-preview {
522
+ grid-column: 3;
523
+ font-size: 11px;
524
+ }
525
+ .segment-chevron {
526
+ grid-column: 4;
527
+ grid-row: 1;
528
+ }
529
+ .segment-row time {
530
+ display: none;
531
+ }
532
+ .segment-details {
533
+ display: block;
534
+ padding: 10px;
535
+ }
536
+ .message-details {
537
+ border: 0;
538
+ padding: 0 0 10px;
539
+ }
540
+ .context-minimap {
541
+ width: 18px;
542
+ padding: 3px;
543
+ }
544
+ .composition-footer {
545
+ font-size: 9px;
546
+ padding-left: 12px;
547
+ }
548
+ .composition-footer span:first-child {
549
+ display: none;
550
+ }
551
+ .app-footer {
552
+ padding: 0 8px;
553
+ }
554
+ }