@firstpick/pi-package-webui 0.6.3 → 0.6.4
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/bin/pi-webui.mjs +449 -13
- package/lib/trust-boundaries.mjs +2 -0
- package/package.json +2 -2
- package/public/app.js +918 -10
- package/public/index.html +66 -2
- package/public/styles.css +450 -2
- package/tests/fixtures/fake-pi.mjs +59 -3
- package/tests/http-endpoints-harness.test.mjs +212 -2
package/public/index.html
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<link rel="manifest" href="/manifest.webmanifest" />
|
|
13
13
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
14
14
|
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
|
|
15
|
-
<link rel="stylesheet" href="/styles.css?v=
|
|
15
|
+
<link rel="stylesheet" href="/styles.css?v=66" />
|
|
16
16
|
</head>
|
|
17
17
|
<body>
|
|
18
18
|
<button id="sidePanelExpandButton" class="side-panel-expand-button" type="button" aria-controls="sidePanel" aria-expanded="false" aria-label="Expand side panel" title="Expand side panel">
|
|
@@ -331,6 +331,39 @@
|
|
|
331
331
|
<iframe id="terminalSplitFrame" class="terminal-split-frame" title="Independent split terminal"></iframe>
|
|
332
332
|
</section>
|
|
333
333
|
|
|
334
|
+
<section id="fileViewerPane" class="file-viewer-pane" aria-label="File viewer and editor" hidden>
|
|
335
|
+
<div id="fileViewerResizeHandle" class="file-viewer-resize-handle" role="separator" aria-orientation="vertical" aria-label="Resize file viewer width" tabindex="0" title="Drag to resize file viewer"></div>
|
|
336
|
+
<header class="file-viewer-header">
|
|
337
|
+
<div class="file-viewer-title-block">
|
|
338
|
+
<span class="file-viewer-kicker">File</span>
|
|
339
|
+
<strong id="fileViewerTitle">No file open</strong>
|
|
340
|
+
<span id="fileViewerMeta" class="file-viewer-meta muted"></span>
|
|
341
|
+
</div>
|
|
342
|
+
<div class="file-viewer-actions">
|
|
343
|
+
<button id="fileViewerOpenDefaultButton" type="button">Open in Default Editor</button>
|
|
344
|
+
<button id="fileViewerSaveButton" class="primary" type="button" disabled>Save</button>
|
|
345
|
+
<button id="fileViewerCloseButton" type="button" aria-label="Close file viewer">Close</button>
|
|
346
|
+
</div>
|
|
347
|
+
</header>
|
|
348
|
+
<p id="fileViewerHelp" class="file-viewer-help muted">Markdown files can be viewed as Preview or Source. Select text in the file, add a one-line comment, then Send to include the selection and surrounding context in this Pi session.</p>
|
|
349
|
+
<div id="fileSelectionBar" class="file-selection-bar" hidden>
|
|
350
|
+
<span id="fileSelectionSummary" class="file-selection-summary">No selection</span>
|
|
351
|
+
<input id="fileSelectionCommentInput" class="file-selection-comment" type="text" placeholder="Comment for Pi about this selection…" autocomplete="off" />
|
|
352
|
+
<button id="fileSelectionSendButton" class="primary" type="button">Send</button>
|
|
353
|
+
</div>
|
|
354
|
+
<div class="file-viewer-mode-row">
|
|
355
|
+
<div class="file-viewer-mode-toggle" role="group" aria-label="File view mode">
|
|
356
|
+
<button id="fileViewerSourceModeButton" type="button" aria-pressed="true">Source</button>
|
|
357
|
+
<button id="fileViewerPreviewModeButton" type="button" aria-pressed="false">Preview</button>
|
|
358
|
+
</div>
|
|
359
|
+
</div>
|
|
360
|
+
<div class="file-viewer-content">
|
|
361
|
+
<textarea id="fileViewerEditor" class="file-viewer-editor" spellcheck="false" aria-label="File contents"></textarea>
|
|
362
|
+
<div id="fileViewerPreview" class="file-viewer-preview markdown-body" tabindex="0" hidden></div>
|
|
363
|
+
</div>
|
|
364
|
+
<p id="fileViewerStatus" class="file-viewer-status muted" role="status" aria-live="polite"></p>
|
|
365
|
+
</section>
|
|
366
|
+
|
|
334
367
|
<button id="sidePanelBackdrop" class="side-panel-backdrop" type="button" aria-label="Close side panel" hidden></button>
|
|
335
368
|
<aside id="sidePanel" class="side-panel">
|
|
336
369
|
<div class="side-panel-header">
|
|
@@ -458,6 +491,32 @@
|
|
|
458
491
|
</div>
|
|
459
492
|
</div>
|
|
460
493
|
</section>
|
|
494
|
+
<section class="side-panel-section collapsed" data-side-panel-section="files">
|
|
495
|
+
<h2>
|
|
496
|
+
<button id="sidePanelSectionToggleFiles" class="side-panel-section-toggle" type="button" aria-expanded="false" aria-controls="sidePanelSectionFiles" aria-label="Expand Files section" title="Expand Files section" data-side-panel-section-toggle="files">
|
|
497
|
+
<span class="side-panel-section-label">Files</span>
|
|
498
|
+
<span class="side-panel-section-chevron" aria-hidden="true">›</span>
|
|
499
|
+
</button>
|
|
500
|
+
</h2>
|
|
501
|
+
<div id="sidePanelSectionFiles" class="side-panel-section-content" hidden>
|
|
502
|
+
<div class="file-tree-panel">
|
|
503
|
+
<div class="file-tree-toolbar">
|
|
504
|
+
<div>
|
|
505
|
+
<strong>Workspace files</strong>
|
|
506
|
+
<p id="fileTreeCwd" class="file-tree-cwd muted"></p>
|
|
507
|
+
</div>
|
|
508
|
+
<button id="fileTreeRefreshButton" type="button">Refresh</button>
|
|
509
|
+
</div>
|
|
510
|
+
<div class="file-tree-search" role="search">
|
|
511
|
+
<input id="fileTreeSearchInput" class="file-tree-search-input" type="search" placeholder="Search files and folders…" autocomplete="off" spellcheck="false" aria-label="Search workspace files and folders" />
|
|
512
|
+
<button id="fileTreeSearchClearButton" type="button" aria-label="Clear file search" hidden disabled>Clear</button>
|
|
513
|
+
</div>
|
|
514
|
+
<p class="file-tree-hint muted">Double-click a file to open it in WebUI. Right-click files or folders for WebUI/default-editor actions. Folders expand lazily and start collapsed.</p>
|
|
515
|
+
<div id="fileTreeRoot" class="file-tree" role="tree" aria-label="Workspace file tree"></div>
|
|
516
|
+
<p id="fileTreeStatus" class="file-tree-status muted" role="status" aria-live="polite"></p>
|
|
517
|
+
</div>
|
|
518
|
+
</div>
|
|
519
|
+
</section>
|
|
461
520
|
<section class="side-panel-section collapsed" data-side-panel-section="optional-features">
|
|
462
521
|
<h2>
|
|
463
522
|
<button id="sidePanelSectionToggleOptionalFeatures" class="side-panel-section-toggle" type="button" aria-expanded="false" aria-controls="sidePanelSectionOptionalFeatures" aria-label="Expand Optional features section" title="Expand Optional features section" data-side-panel-section-toggle="optional-features">
|
|
@@ -562,6 +621,11 @@
|
|
|
562
621
|
</aside>
|
|
563
622
|
</main>
|
|
564
623
|
|
|
624
|
+
<div id="fileContextMenu" class="file-context-menu" role="menu" hidden>
|
|
625
|
+
<button type="button" role="menuitem" data-file-menu-action="open-default">Open in Default Editor</button>
|
|
626
|
+
<button type="button" role="menuitem" data-file-menu-action="open-webui">Open in WebUI</button>
|
|
627
|
+
</div>
|
|
628
|
+
|
|
565
629
|
<dialog id="extensionDialog" class="extension-dialog">
|
|
566
630
|
<form id="dialogForm" method="dialog">
|
|
567
631
|
<h2 id="dialogTitle">Pi request</h2>
|
|
@@ -794,6 +858,6 @@
|
|
|
794
858
|
</form>
|
|
795
859
|
</dialog>
|
|
796
860
|
|
|
797
|
-
<script type="module" src="/app.js?v=
|
|
861
|
+
<script type="module" src="/app.js?v=66"></script>
|
|
798
862
|
</body>
|
|
799
863
|
</html>
|
package/public/styles.css
CHANGED
|
@@ -70,6 +70,7 @@
|
|
|
70
70
|
--tooltip-hover-delay: 500ms;
|
|
71
71
|
--tooltip-blend-duration: 160ms;
|
|
72
72
|
--tooltip-blend-ease: ease;
|
|
73
|
+
--file-viewer-width: 520px;
|
|
73
74
|
|
|
74
75
|
font-size: 80%;
|
|
75
76
|
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
@@ -315,6 +316,18 @@ body.terminal-split-open .layout {
|
|
|
315
316
|
body.terminal-split-open.side-panel-collapsed .layout {
|
|
316
317
|
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
|
|
317
318
|
}
|
|
319
|
+
body.file-viewer-open .layout {
|
|
320
|
+
grid-template-columns: minmax(0, 1fr) minmax(24rem, var(--file-viewer-width)) minmax(20rem, 24rem);
|
|
321
|
+
}
|
|
322
|
+
body.file-viewer-open.side-panel-collapsed .layout {
|
|
323
|
+
grid-template-columns: minmax(0, 1fr) minmax(24rem, var(--file-viewer-width));
|
|
324
|
+
}
|
|
325
|
+
body.terminal-split-open.file-viewer-open .layout {
|
|
326
|
+
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(24rem, var(--file-viewer-width)) minmax(20rem, 24rem);
|
|
327
|
+
}
|
|
328
|
+
body.terminal-split-open.file-viewer-open.side-panel-collapsed .layout {
|
|
329
|
+
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(24rem, var(--file-viewer-width));
|
|
330
|
+
}
|
|
318
331
|
body.side-panel-collapsed .side-panel {
|
|
319
332
|
display: none;
|
|
320
333
|
}
|
|
@@ -707,6 +720,234 @@ body.side-panel-collapsed .terminal-tabs-shell {
|
|
|
707
720
|
border: 0;
|
|
708
721
|
background: var(--ctp-crust);
|
|
709
722
|
}
|
|
723
|
+
.file-viewer-pane {
|
|
724
|
+
position: relative;
|
|
725
|
+
display: flex;
|
|
726
|
+
flex-direction: column;
|
|
727
|
+
min-width: 0;
|
|
728
|
+
min-height: 0;
|
|
729
|
+
height: 100%;
|
|
730
|
+
overflow: hidden;
|
|
731
|
+
border: 1px solid rgba(137, 180, 250, 0.26);
|
|
732
|
+
border-radius: 1.1rem;
|
|
733
|
+
background: var(--panel-gradient);
|
|
734
|
+
box-shadow: 0 1rem 3rem var(--shadow), 0 0 2rem rgba(137, 180, 250, 0.10), inset 0 1px 0 rgba(255,255,255,0.06);
|
|
735
|
+
}
|
|
736
|
+
.file-viewer-resize-handle {
|
|
737
|
+
position: absolute;
|
|
738
|
+
top: 50%;
|
|
739
|
+
left: -0.78rem;
|
|
740
|
+
z-index: 8;
|
|
741
|
+
display: grid;
|
|
742
|
+
place-items: center;
|
|
743
|
+
width: 1.35rem;
|
|
744
|
+
height: 5.2rem;
|
|
745
|
+
padding: 0;
|
|
746
|
+
cursor: col-resize;
|
|
747
|
+
touch-action: none;
|
|
748
|
+
transform: translateY(-50%);
|
|
749
|
+
border: 1px solid rgba(148, 226, 213, 0.36);
|
|
750
|
+
border-radius: 999px;
|
|
751
|
+
background:
|
|
752
|
+
linear-gradient(180deg, rgba(var(--ctp-surface-rgb), 0.82), rgba(var(--ctp-crust-rgb), 0.90)),
|
|
753
|
+
var(--neon-gradient);
|
|
754
|
+
box-shadow: 0 0 1rem rgba(148, 226, 213, 0.22), 0 0.7rem 1.4rem rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255,255,255,0.08);
|
|
755
|
+
}
|
|
756
|
+
.file-viewer-resize-handle::before {
|
|
757
|
+
content: "";
|
|
758
|
+
width: 0.28rem;
|
|
759
|
+
height: 3.1rem;
|
|
760
|
+
border-radius: 999px;
|
|
761
|
+
background: linear-gradient(180deg, var(--ctp-pink), var(--ctp-blue), var(--ctp-teal));
|
|
762
|
+
box-shadow: 0 0 0.75rem rgba(137, 180, 250, 0.48);
|
|
763
|
+
}
|
|
764
|
+
.file-viewer-resize-handle:hover,
|
|
765
|
+
.file-viewer-resize-handle:focus-visible,
|
|
766
|
+
body.file-viewer-resizing .file-viewer-resize-handle {
|
|
767
|
+
border-color: rgba(148, 226, 213, 0.72);
|
|
768
|
+
box-shadow: 0 0 1.35rem rgba(148, 226, 213, 0.34), 0 0.9rem 1.7rem rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255,255,255,0.11);
|
|
769
|
+
outline: none;
|
|
770
|
+
}
|
|
771
|
+
.file-viewer-resize-handle[hidden] {
|
|
772
|
+
display: none;
|
|
773
|
+
}
|
|
774
|
+
body.file-viewer-resizing {
|
|
775
|
+
cursor: col-resize;
|
|
776
|
+
user-select: none;
|
|
777
|
+
}
|
|
778
|
+
body.file-viewer-resizing * {
|
|
779
|
+
cursor: col-resize !important;
|
|
780
|
+
}
|
|
781
|
+
.file-viewer-header {
|
|
782
|
+
flex: 0 0 auto;
|
|
783
|
+
display: flex;
|
|
784
|
+
align-items: center;
|
|
785
|
+
justify-content: space-between;
|
|
786
|
+
gap: 0.75rem;
|
|
787
|
+
min-width: 0;
|
|
788
|
+
padding: 0.58rem 0.72rem;
|
|
789
|
+
border-bottom: 1px solid rgba(180, 190, 254, 0.16);
|
|
790
|
+
background:
|
|
791
|
+
linear-gradient(90deg, rgba(var(--ctp-crust-rgb), 0.96), rgba(var(--ctp-base-rgb), 0.82), rgba(var(--ctp-mantle-rgb), 0.92)),
|
|
792
|
+
radial-gradient(circle at 0% 0%, rgba(137, 180, 250, 0.14), transparent 16rem);
|
|
793
|
+
}
|
|
794
|
+
.file-viewer-title-block {
|
|
795
|
+
display: grid;
|
|
796
|
+
gap: 0.08rem;
|
|
797
|
+
min-width: 0;
|
|
798
|
+
}
|
|
799
|
+
.file-viewer-kicker {
|
|
800
|
+
color: var(--ctp-blue);
|
|
801
|
+
font-size: 0.62rem;
|
|
802
|
+
font-weight: 900;
|
|
803
|
+
letter-spacing: 0.12em;
|
|
804
|
+
text-transform: uppercase;
|
|
805
|
+
}
|
|
806
|
+
.file-viewer-title-block strong,
|
|
807
|
+
.file-viewer-meta {
|
|
808
|
+
min-width: 0;
|
|
809
|
+
overflow: hidden;
|
|
810
|
+
text-overflow: ellipsis;
|
|
811
|
+
white-space: nowrap;
|
|
812
|
+
}
|
|
813
|
+
.file-viewer-meta {
|
|
814
|
+
max-width: min(34rem, 42vw);
|
|
815
|
+
color: rgba(var(--ctp-subtext-rgb), 0.70);
|
|
816
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
|
|
817
|
+
font-size: 0.66rem;
|
|
818
|
+
}
|
|
819
|
+
.file-viewer-actions {
|
|
820
|
+
display: flex;
|
|
821
|
+
flex: 0 0 auto;
|
|
822
|
+
flex-wrap: wrap;
|
|
823
|
+
justify-content: flex-end;
|
|
824
|
+
gap: 0.42rem;
|
|
825
|
+
}
|
|
826
|
+
.file-viewer-actions button,
|
|
827
|
+
.file-viewer-mode-toggle button,
|
|
828
|
+
.file-selection-bar button {
|
|
829
|
+
min-height: 2.2rem;
|
|
830
|
+
padding: 0.34rem 0.62rem;
|
|
831
|
+
font-size: 0.76rem;
|
|
832
|
+
}
|
|
833
|
+
.file-viewer-help {
|
|
834
|
+
flex: 0 0 auto;
|
|
835
|
+
margin: 0;
|
|
836
|
+
padding: 0.58rem 0.72rem 0;
|
|
837
|
+
font-size: 0.78rem;
|
|
838
|
+
line-height: 1.35;
|
|
839
|
+
}
|
|
840
|
+
.file-selection-bar {
|
|
841
|
+
flex: 0 0 auto;
|
|
842
|
+
display: grid;
|
|
843
|
+
grid-template-columns: auto minmax(0, 1fr) auto;
|
|
844
|
+
gap: 0.45rem;
|
|
845
|
+
align-items: center;
|
|
846
|
+
margin: 0.58rem 0.72rem 0;
|
|
847
|
+
padding: 0.48rem;
|
|
848
|
+
border: 1px solid rgba(148, 226, 213, 0.28);
|
|
849
|
+
border-radius: 0.78rem;
|
|
850
|
+
background: rgba(var(--ctp-crust-rgb), 0.46);
|
|
851
|
+
}
|
|
852
|
+
.file-selection-summary {
|
|
853
|
+
color: var(--ctp-teal);
|
|
854
|
+
font-size: 0.72rem;
|
|
855
|
+
font-weight: 900;
|
|
856
|
+
white-space: nowrap;
|
|
857
|
+
}
|
|
858
|
+
.file-selection-comment {
|
|
859
|
+
width: 100%;
|
|
860
|
+
min-width: 0;
|
|
861
|
+
min-height: 2.2rem;
|
|
862
|
+
padding: 0.34rem 0.55rem;
|
|
863
|
+
}
|
|
864
|
+
.file-viewer-mode-row {
|
|
865
|
+
flex: 0 0 auto;
|
|
866
|
+
display: flex;
|
|
867
|
+
justify-content: flex-end;
|
|
868
|
+
padding: 0.58rem 0.72rem 0;
|
|
869
|
+
}
|
|
870
|
+
.file-viewer-mode-toggle {
|
|
871
|
+
display: inline-flex;
|
|
872
|
+
gap: 2px;
|
|
873
|
+
padding: 2px;
|
|
874
|
+
border: 1px solid rgba(180, 190, 254, 0.18);
|
|
875
|
+
border-radius: 0.72rem;
|
|
876
|
+
background: rgba(var(--ctp-crust-rgb), 0.42);
|
|
877
|
+
}
|
|
878
|
+
.file-viewer-mode-toggle button {
|
|
879
|
+
border: 0;
|
|
880
|
+
background: transparent;
|
|
881
|
+
color: rgba(var(--ctp-text-rgb), 0.72);
|
|
882
|
+
box-shadow: none;
|
|
883
|
+
}
|
|
884
|
+
.file-viewer-mode-toggle button.active,
|
|
885
|
+
.file-viewer-mode-toggle button[aria-pressed="true"] {
|
|
886
|
+
color: var(--ctp-text);
|
|
887
|
+
background: rgba(var(--ctp-surface-rgb), 0.62);
|
|
888
|
+
box-shadow: inset 0 0 0 1px rgba(137, 180, 250, 0.42);
|
|
889
|
+
}
|
|
890
|
+
.file-viewer-content {
|
|
891
|
+
flex: 1 1 auto;
|
|
892
|
+
display: grid;
|
|
893
|
+
min-width: 0;
|
|
894
|
+
min-height: 0;
|
|
895
|
+
padding: 0.58rem 0.72rem;
|
|
896
|
+
}
|
|
897
|
+
.file-viewer-editor,
|
|
898
|
+
.file-viewer-preview {
|
|
899
|
+
width: 100%;
|
|
900
|
+
height: 100%;
|
|
901
|
+
min-width: 0;
|
|
902
|
+
min-height: 0;
|
|
903
|
+
overflow: auto;
|
|
904
|
+
border: 1px solid rgba(180, 190, 254, 0.16);
|
|
905
|
+
border-radius: 0.86rem;
|
|
906
|
+
background: rgba(var(--ctp-crust-rgb), 0.64);
|
|
907
|
+
}
|
|
908
|
+
.file-viewer-editor {
|
|
909
|
+
resize: none;
|
|
910
|
+
padding: 0.72rem;
|
|
911
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
|
|
912
|
+
font-size: 0.82rem;
|
|
913
|
+
line-height: 1.45;
|
|
914
|
+
white-space: pre;
|
|
915
|
+
}
|
|
916
|
+
.file-viewer-preview {
|
|
917
|
+
padding: 0.85rem;
|
|
918
|
+
line-height: 1.55;
|
|
919
|
+
}
|
|
920
|
+
.file-viewer-status {
|
|
921
|
+
flex: 0 0 auto;
|
|
922
|
+
min-height: 1.1rem;
|
|
923
|
+
margin: 0;
|
|
924
|
+
padding: 0 0.72rem 0.58rem;
|
|
925
|
+
font-size: 0.72rem;
|
|
926
|
+
font-weight: 760;
|
|
927
|
+
}
|
|
928
|
+
.file-viewer-status.warn { color: var(--ctp-yellow); }
|
|
929
|
+
.file-viewer-status.error { color: var(--ctp-red); }
|
|
930
|
+
.file-viewer-status.success { color: var(--ctp-green); }
|
|
931
|
+
.file-context-menu {
|
|
932
|
+
position: fixed;
|
|
933
|
+
z-index: 220;
|
|
934
|
+
display: grid;
|
|
935
|
+
gap: 0.25rem;
|
|
936
|
+
min-width: 13rem;
|
|
937
|
+
padding: 0.35rem;
|
|
938
|
+
border: 1px solid rgba(180, 190, 254, 0.28);
|
|
939
|
+
border-radius: 0.76rem;
|
|
940
|
+
background: linear-gradient(145deg, rgba(var(--ctp-base-rgb), 0.98), rgba(var(--ctp-crust-rgb), 0.98));
|
|
941
|
+
box-shadow: 0 1rem 2.6rem rgba(var(--ctp-crust-rgb), 0.72), 0 0 1.2rem rgba(137, 180, 250, 0.14);
|
|
942
|
+
}
|
|
943
|
+
.file-context-menu button {
|
|
944
|
+
justify-content: start;
|
|
945
|
+
width: 100%;
|
|
946
|
+
min-height: 2.25rem;
|
|
947
|
+
padding: 0.42rem 0.58rem;
|
|
948
|
+
text-align: left;
|
|
949
|
+
box-shadow: none;
|
|
950
|
+
}
|
|
710
951
|
body.embedded-split .layout,
|
|
711
952
|
body.embedded-split.side-panel-collapsed .layout {
|
|
712
953
|
grid-template-columns: minmax(0, 1fr);
|
|
@@ -910,6 +1151,170 @@ body.embedded-split .side-panel-backdrop {
|
|
|
910
1151
|
.side-panel-section-content[hidden] {
|
|
911
1152
|
display: none;
|
|
912
1153
|
}
|
|
1154
|
+
.file-tree-panel {
|
|
1155
|
+
display: grid;
|
|
1156
|
+
gap: 0.58rem;
|
|
1157
|
+
padding: 0.72rem;
|
|
1158
|
+
border: 1px solid rgba(180, 190, 254, 0.16);
|
|
1159
|
+
border-radius: 0.85rem;
|
|
1160
|
+
background: rgba(var(--ctp-crust-rgb), 0.46);
|
|
1161
|
+
box-shadow: inset 0 1px 0 rgba(255,255,255,0.035), 0 0 1rem rgba(137, 180, 250, 0.06);
|
|
1162
|
+
}
|
|
1163
|
+
.file-tree-toolbar {
|
|
1164
|
+
display: grid;
|
|
1165
|
+
grid-template-columns: minmax(0, 1fr) auto;
|
|
1166
|
+
gap: 0.55rem;
|
|
1167
|
+
align-items: start;
|
|
1168
|
+
}
|
|
1169
|
+
.file-tree-toolbar strong {
|
|
1170
|
+
display: block;
|
|
1171
|
+
color: var(--ctp-text);
|
|
1172
|
+
font-size: 0.8rem;
|
|
1173
|
+
}
|
|
1174
|
+
.file-tree-toolbar button {
|
|
1175
|
+
width: auto;
|
|
1176
|
+
min-height: 2.2rem;
|
|
1177
|
+
padding: 0.35rem 0.62rem;
|
|
1178
|
+
font-size: 0.74rem;
|
|
1179
|
+
}
|
|
1180
|
+
.file-tree-search {
|
|
1181
|
+
display: grid;
|
|
1182
|
+
grid-template-columns: minmax(0, 1fr) auto;
|
|
1183
|
+
gap: 0.42rem;
|
|
1184
|
+
align-items: center;
|
|
1185
|
+
}
|
|
1186
|
+
.file-tree-search-input {
|
|
1187
|
+
width: 100%;
|
|
1188
|
+
min-width: 0;
|
|
1189
|
+
min-height: 2.2rem;
|
|
1190
|
+
padding: 0.36rem 0.62rem;
|
|
1191
|
+
font-size: 0.74rem;
|
|
1192
|
+
}
|
|
1193
|
+
.file-tree-search button {
|
|
1194
|
+
width: auto;
|
|
1195
|
+
min-height: 2.2rem;
|
|
1196
|
+
padding: 0.35rem 0.62rem;
|
|
1197
|
+
font-size: 0.74rem;
|
|
1198
|
+
}
|
|
1199
|
+
.file-tree-search button[hidden] {
|
|
1200
|
+
display: none;
|
|
1201
|
+
}
|
|
1202
|
+
.file-tree-cwd {
|
|
1203
|
+
margin: 0.16rem 0 0;
|
|
1204
|
+
overflow-wrap: anywhere;
|
|
1205
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
|
|
1206
|
+
font-size: 0.66rem;
|
|
1207
|
+
line-height: 1.3;
|
|
1208
|
+
}
|
|
1209
|
+
.file-tree-hint {
|
|
1210
|
+
margin: 0;
|
|
1211
|
+
font-size: 0.72rem;
|
|
1212
|
+
line-height: 1.35;
|
|
1213
|
+
}
|
|
1214
|
+
.file-tree {
|
|
1215
|
+
max-height: min(34rem, 48vh);
|
|
1216
|
+
min-height: 5rem;
|
|
1217
|
+
overflow: auto;
|
|
1218
|
+
padding: 0.32rem;
|
|
1219
|
+
border: 1px solid rgba(180, 190, 254, 0.14);
|
|
1220
|
+
border-radius: 0.74rem;
|
|
1221
|
+
background: rgba(var(--ctp-crust-rgb), 0.46);
|
|
1222
|
+
}
|
|
1223
|
+
.file-tree-list {
|
|
1224
|
+
display: grid;
|
|
1225
|
+
gap: 0.12rem;
|
|
1226
|
+
margin: 0;
|
|
1227
|
+
padding: 0;
|
|
1228
|
+
list-style: none;
|
|
1229
|
+
}
|
|
1230
|
+
.file-tree-list .file-tree-list {
|
|
1231
|
+
margin-top: 0.12rem;
|
|
1232
|
+
}
|
|
1233
|
+
.file-tree-node {
|
|
1234
|
+
min-width: 0;
|
|
1235
|
+
}
|
|
1236
|
+
.file-tree-item {
|
|
1237
|
+
display: grid;
|
|
1238
|
+
grid-template-columns: auto minmax(0, 1fr) auto;
|
|
1239
|
+
gap: 0.36rem;
|
|
1240
|
+
align-items: center;
|
|
1241
|
+
width: 100%;
|
|
1242
|
+
min-height: 2rem;
|
|
1243
|
+
padding: 0.22rem 0.42rem 0.22rem calc(0.42rem + (var(--file-tree-depth, 0) * 0.86rem));
|
|
1244
|
+
color: rgba(var(--ctp-text-rgb), 0.88);
|
|
1245
|
+
text-align: left;
|
|
1246
|
+
border-color: transparent;
|
|
1247
|
+
border-radius: 0.5rem;
|
|
1248
|
+
background: transparent;
|
|
1249
|
+
box-shadow: none;
|
|
1250
|
+
}
|
|
1251
|
+
.file-tree-item:hover,
|
|
1252
|
+
.file-tree-item:focus-visible,
|
|
1253
|
+
.file-tree-node.selected > .file-tree-item {
|
|
1254
|
+
transform: none;
|
|
1255
|
+
border-color: rgba(137, 180, 250, 0.30);
|
|
1256
|
+
background: rgba(var(--ctp-surface-rgb), 0.34);
|
|
1257
|
+
box-shadow: inset 2px 0 0 var(--ctp-blue);
|
|
1258
|
+
}
|
|
1259
|
+
.file-tree-icon {
|
|
1260
|
+
display: inline-grid;
|
|
1261
|
+
place-items: center;
|
|
1262
|
+
min-width: 1.55rem;
|
|
1263
|
+
color: var(--ctp-teal);
|
|
1264
|
+
font-size: 0.68rem;
|
|
1265
|
+
font-weight: 900;
|
|
1266
|
+
transition: transform 120ms ease;
|
|
1267
|
+
}
|
|
1268
|
+
.file-tree-icon.expanded {
|
|
1269
|
+
transform: rotate(90deg);
|
|
1270
|
+
}
|
|
1271
|
+
.file-tree-name {
|
|
1272
|
+
min-width: 0;
|
|
1273
|
+
overflow: hidden;
|
|
1274
|
+
text-overflow: ellipsis;
|
|
1275
|
+
white-space: nowrap;
|
|
1276
|
+
}
|
|
1277
|
+
.file-tree-search-label {
|
|
1278
|
+
display: grid;
|
|
1279
|
+
gap: 0.08rem;
|
|
1280
|
+
min-width: 0;
|
|
1281
|
+
}
|
|
1282
|
+
.file-tree-search-path {
|
|
1283
|
+
min-width: 0;
|
|
1284
|
+
overflow: hidden;
|
|
1285
|
+
color: rgba(var(--ctp-subtext-rgb), 0.68);
|
|
1286
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
|
|
1287
|
+
font-size: 0.62rem;
|
|
1288
|
+
text-overflow: ellipsis;
|
|
1289
|
+
white-space: nowrap;
|
|
1290
|
+
}
|
|
1291
|
+
.file-tree-search-item {
|
|
1292
|
+
grid-template-columns: auto minmax(0, 1fr) auto;
|
|
1293
|
+
}
|
|
1294
|
+
.file-tree-kind {
|
|
1295
|
+
color: rgba(var(--ctp-subtext-rgb), 0.64);
|
|
1296
|
+
font-size: 0.64rem;
|
|
1297
|
+
font-weight: 800;
|
|
1298
|
+
text-transform: lowercase;
|
|
1299
|
+
}
|
|
1300
|
+
.file-tree-error,
|
|
1301
|
+
.file-tree-loading,
|
|
1302
|
+
.file-tree-empty {
|
|
1303
|
+
padding: 0.3rem 0.45rem;
|
|
1304
|
+
font-size: 0.7rem;
|
|
1305
|
+
}
|
|
1306
|
+
.file-tree-error { color: var(--ctp-red); }
|
|
1307
|
+
.file-tree-status {
|
|
1308
|
+
min-height: 1rem;
|
|
1309
|
+
margin: 0;
|
|
1310
|
+
color: rgba(var(--ctp-subtext-rgb), 0.72);
|
|
1311
|
+
font-size: 0.7rem;
|
|
1312
|
+
font-weight: 750;
|
|
1313
|
+
line-height: 1.35;
|
|
1314
|
+
}
|
|
1315
|
+
.file-tree-status.warn { color: var(--ctp-yellow); }
|
|
1316
|
+
.file-tree-status.error { color: var(--ctp-red); }
|
|
1317
|
+
.file-tree-status.success { color: var(--ctp-green); }
|
|
913
1318
|
.side-panel-controls {
|
|
914
1319
|
display: grid;
|
|
915
1320
|
gap: 0.75rem;
|
|
@@ -7989,7 +8394,11 @@ button.composer-skill-tag:focus-visible {
|
|
|
7989
8394
|
@media (max-width: 1050px) {
|
|
7990
8395
|
body { overflow: auto; }
|
|
7991
8396
|
.layout,
|
|
7992
|
-
body.side-panel-collapsed .layout
|
|
8397
|
+
body.side-panel-collapsed .layout,
|
|
8398
|
+
body.file-viewer-open .layout,
|
|
8399
|
+
body.file-viewer-open.side-panel-collapsed .layout,
|
|
8400
|
+
body.terminal-split-open.file-viewer-open .layout,
|
|
8401
|
+
body.terminal-split-open.file-viewer-open.side-panel-collapsed .layout {
|
|
7993
8402
|
grid-template-columns: 1fr;
|
|
7994
8403
|
height: auto;
|
|
7995
8404
|
min-height: 100dvh;
|
|
@@ -8004,6 +8413,13 @@ button.composer-skill-tag:focus-visible {
|
|
|
8004
8413
|
.terminal-split-button {
|
|
8005
8414
|
display: none !important;
|
|
8006
8415
|
}
|
|
8416
|
+
.file-viewer-pane {
|
|
8417
|
+
height: calc(var(--visual-viewport-height, 100dvh) - 2rem);
|
|
8418
|
+
min-height: 28rem;
|
|
8419
|
+
}
|
|
8420
|
+
.file-viewer-resize-handle {
|
|
8421
|
+
display: none;
|
|
8422
|
+
}
|
|
8007
8423
|
.chat { flex-basis: 0; }
|
|
8008
8424
|
body:not(.side-panel-collapsed) { overflow: hidden; }
|
|
8009
8425
|
body:not(.side-panel-collapsed) .chat-panel {
|
|
@@ -8071,7 +8487,12 @@ button.composer-skill-tag:focus-visible {
|
|
|
8071
8487
|
@media (max-width: 720px), (max-device-width: 720px), (pointer: coarse) and (hover: none) {
|
|
8072
8488
|
body { overflow: hidden; }
|
|
8073
8489
|
.layout,
|
|
8074
|
-
body.side-panel-collapsed .layout
|
|
8490
|
+
body.side-panel-collapsed .layout,
|
|
8491
|
+
body.file-viewer-open .layout,
|
|
8492
|
+
body.file-viewer-open.side-panel-collapsed .layout,
|
|
8493
|
+
body.terminal-split-open.file-viewer-open .layout,
|
|
8494
|
+
body.terminal-split-open.file-viewer-open.side-panel-collapsed .layout {
|
|
8495
|
+
grid-template-columns: 1fr;
|
|
8075
8496
|
gap: 0;
|
|
8076
8497
|
height: 100vh;
|
|
8077
8498
|
height: var(--visual-viewport-height, 100dvh);
|
|
@@ -8086,6 +8507,33 @@ button.composer-skill-tag:focus-visible {
|
|
|
8086
8507
|
min-height: 0;
|
|
8087
8508
|
border-radius: 0;
|
|
8088
8509
|
}
|
|
8510
|
+
body.file-viewer-open .chat-panel {
|
|
8511
|
+
display: none;
|
|
8512
|
+
}
|
|
8513
|
+
body.file-viewer-open .file-viewer-pane {
|
|
8514
|
+
position: fixed;
|
|
8515
|
+
inset: 0;
|
|
8516
|
+
z-index: 109;
|
|
8517
|
+
height: var(--visual-viewport-height, 100dvh);
|
|
8518
|
+
min-height: 0;
|
|
8519
|
+
border-radius: 0;
|
|
8520
|
+
}
|
|
8521
|
+
.file-viewer-resize-handle {
|
|
8522
|
+
display: none;
|
|
8523
|
+
}
|
|
8524
|
+
.file-viewer-header,
|
|
8525
|
+
.file-selection-bar {
|
|
8526
|
+
grid-template-columns: 1fr;
|
|
8527
|
+
}
|
|
8528
|
+
.file-viewer-header,
|
|
8529
|
+
.file-viewer-actions,
|
|
8530
|
+
.file-selection-bar {
|
|
8531
|
+
align-items: stretch;
|
|
8532
|
+
}
|
|
8533
|
+
.file-viewer-actions,
|
|
8534
|
+
.file-selection-bar {
|
|
8535
|
+
display: grid;
|
|
8536
|
+
}
|
|
8089
8537
|
.terminal-tabs-shell {
|
|
8090
8538
|
position: relative;
|
|
8091
8539
|
align-items: center;
|
|
@@ -29,9 +29,47 @@ let conversationEnabled = false;
|
|
|
29
29
|
|
|
30
30
|
const voiceScriptsEnabled = process.env.FAKE_PI_VOICE_SCRIPTS === "1";
|
|
31
31
|
const commandLogFile = process.env.FAKE_PI_LOG_FILE || "";
|
|
32
|
+
const staticEntries = [
|
|
33
|
+
{ type: "message", id: "u0000001", parentId: null, timestamp: new Date(1000).toISOString(), message: { role: "user", content: "fake prompt", timestamp: 1000 } },
|
|
34
|
+
{ type: "message", id: "a0000001", parentId: "u0000001", timestamp: new Date(2000).toISOString(), message: { role: "assistant", content: [{ type: "text", text: "fake answer" }], timestamp: 2000 } },
|
|
35
|
+
{ type: "message", id: "u0000002", parentId: "a0000001", timestamp: new Date(3000).toISOString(), message: { role: "user", content: "fake follow-up", timestamp: 3000 } },
|
|
36
|
+
];
|
|
37
|
+
const dynamicEntries = [];
|
|
32
38
|
const dynamicMessages = [];
|
|
39
|
+
let dynamicLeafId = "u0000002";
|
|
33
40
|
let scriptedStreaming = false;
|
|
34
41
|
|
|
42
|
+
function allSessionEntries() {
|
|
43
|
+
return [...staticEntries, ...dynamicEntries];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function messageText(content) {
|
|
47
|
+
if (typeof content === "string") return content;
|
|
48
|
+
if (!Array.isArray(content)) return "";
|
|
49
|
+
return content.map((part) => typeof part === "string" ? part : part?.type === "text" ? part.text || "" : "").filter(Boolean).join(" ");
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function forkMessages() {
|
|
53
|
+
return allSessionEntries()
|
|
54
|
+
.filter((entry) => entry.type === "message" && entry.message?.role === "user")
|
|
55
|
+
.map((entry) => ({ entryId: entry.id, text: messageText(entry.message.content) }));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function appendDynamicMessage(message) {
|
|
59
|
+
const prefix = message.role === "assistant" ? "a" : "u";
|
|
60
|
+
const entry = {
|
|
61
|
+
type: "message",
|
|
62
|
+
id: `${prefix}${randomUUID().replace(/-/g, "").slice(0, 7)}`,
|
|
63
|
+
parentId: dynamicLeafId,
|
|
64
|
+
timestamp: new Date().toISOString(),
|
|
65
|
+
message,
|
|
66
|
+
};
|
|
67
|
+
dynamicEntries.push(entry);
|
|
68
|
+
dynamicMessages.push(message);
|
|
69
|
+
dynamicLeafId = entry.id;
|
|
70
|
+
return entry;
|
|
71
|
+
}
|
|
72
|
+
|
|
35
73
|
function logJsonLine(entry) {
|
|
36
74
|
if (!commandLogFile) return;
|
|
37
75
|
try {
|
|
@@ -91,8 +129,9 @@ function runVoiceScriptFlow({ text, chunks, chunkSpacingMs = 60, toolPhase = fal
|
|
|
91
129
|
steps.push({
|
|
92
130
|
afterMs: chunkSpacingMs,
|
|
93
131
|
run: () => {
|
|
94
|
-
|
|
95
|
-
|
|
132
|
+
const message = { role: "assistant", content: [{ type: "text", text }], timestamp: Date.now() };
|
|
133
|
+
appendDynamicMessage(message);
|
|
134
|
+
emitScriptedEvent({ type: "message_end", message });
|
|
96
135
|
},
|
|
97
136
|
});
|
|
98
137
|
steps.push({
|
|
@@ -110,7 +149,7 @@ function handleVoiceScriptPrompt(command, base) {
|
|
|
110
149
|
const message = String(command.message || "");
|
|
111
150
|
const marker = ["voice test say", "voice test question", "voice test tool", "voice test slow"].find((item) => message.includes(item));
|
|
112
151
|
if (!marker) return false;
|
|
113
|
-
|
|
152
|
+
appendDynamicMessage({ role: "user", content: message, timestamp: Date.now() });
|
|
114
153
|
respond({ ...base, data: { output: "voice scripted prompt accepted" } });
|
|
115
154
|
if (marker === "voice test say") {
|
|
116
155
|
runVoiceScriptFlow({ text: "Okay, this is the spoken answer." });
|
|
@@ -257,6 +296,23 @@ rl.on("line", (line) => {
|
|
|
257
296
|
},
|
|
258
297
|
});
|
|
259
298
|
return;
|
|
299
|
+
case "get_fork_messages":
|
|
300
|
+
respond({ ...base, data: { messages: forkMessages() } });
|
|
301
|
+
return;
|
|
302
|
+
case "get_entries": {
|
|
303
|
+
const entries = allSessionEntries();
|
|
304
|
+
if (command.since !== undefined) {
|
|
305
|
+
const sinceIndex = entries.findIndex((entry) => entry.id === command.since);
|
|
306
|
+
if (sinceIndex === -1) {
|
|
307
|
+
respond({ ...base, success: false, error: `Entry not found: ${command.since}` });
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
respond({ ...base, data: { entries: entries.slice(sinceIndex + 1), leafId: dynamicLeafId } });
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
respond({ ...base, data: { entries, leafId: dynamicLeafId } });
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
260
316
|
case "prompt":
|
|
261
317
|
if (handleWebuiHelperPrompt(command, base)) return;
|
|
262
318
|
if (handleTalkPrompt(command, base)) return;
|