pi-pocket 0.28.2 → 0.29.0-beta.2
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/docs/architecture.md +4 -3
- package/docs/customizing.md +1 -1
- package/docs/extensions/linked-sessions.md +2 -0
- package/docs/extensions/policies/api-stability.md +1 -1
- package/docs/extensions/reference/api-versions.md +3 -0
- package/docs/extensions/reference/host.md +18 -4
- package/docs/extensions/reference/pocket.md +12 -1
- package/docs/extensions/reference/types.md +19 -1
- package/docs/extensions/tools.md +18 -0
- package/docs/features.md +5 -5
- package/docs/map.md +6 -4
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/src/server/app.ts +2 -7
- package/src/server/browser/cdp.ts +6 -0
- package/src/server/browser/identity.ts +55 -0
- package/src/server/browser/page.ts +12 -1
- package/src/server/browser.ts +1 -0
- package/src/server/commands.ts +26 -5
- package/src/server/config.ts +10 -0
- package/src/server/custom-providers.ts +304 -23
- package/src/server/docs.ts +10 -3
- package/src/server/extensions/agent-teams.ts +9 -1
- package/src/server/extensions/subagents.ts +51 -3
- package/src/server/host.ts +13 -4
- package/src/server/http/assets.ts +26 -3
- package/src/server/http/io.ts +11 -1
- package/src/server/http/link-routes.ts +4 -1
- package/src/server/http.ts +29 -3
- package/src/server/linked-sessions.ts +92 -9
- package/src/server/project-model.ts +17 -1
- package/types/pocket.d.ts +40 -6
- package/web/app.js +3 -2
- package/web/back.js +27 -6
- package/web/browser-panel.js +23 -12
- package/web/browser-paste.js +13 -0
- package/web/composer.js +7 -3
- package/web/extension-ui.js +17 -2
- package/web/index.html +2 -0
- package/web/pip.js +65 -0
- package/web/running-board.js +38 -36
- package/web/sheets/custom-providers.js +420 -21
- package/web/sheets/memory.js +76 -40
- package/web/store.js +117 -22
- package/web/style.css +176 -13
- package/web/transcript.js +57 -11
package/web/store.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// App state, the server connection, and API calls. Components read `store.state` and re-render on `store.subscribe`.
|
|
2
|
-
import { onRoute, popRoute, pushRoute, routeState } from "./back.js";
|
|
2
|
+
import { onRoute, popRoute, pushRoute, routeState, routeUnder } from "./back.js";
|
|
3
3
|
import { hostCan, onPageVisibility, pageVisible } from "./host.js";
|
|
4
4
|
import { sessionForest, unfolded } from "./session-tree.js";
|
|
5
5
|
import { liveMessage } from "./live.js";
|
|
@@ -305,6 +305,8 @@ export const store = {
|
|
|
305
305
|
* server's view of it comes (Appearance's Wait for updates, `holdsFor`): its id, or null.
|
|
306
306
|
*/
|
|
307
307
|
holding: null,
|
|
308
|
+
/** A session opened without a tab-memory view: its pane waits for the device or server, not a boot screen. */
|
|
309
|
+
pending: null,
|
|
308
310
|
missing: null,
|
|
309
311
|
connection: "connecting",
|
|
310
312
|
notices: [],
|
|
@@ -1182,10 +1184,36 @@ function forgetKept() {
|
|
|
1182
1184
|
|
|
1183
1185
|
// ─── Sessions kept on the device ───────────────────────────────────────────────────────────────────────────────────
|
|
1184
1186
|
|
|
1185
|
-
/**
|
|
1187
|
+
/**
|
|
1188
|
+
* Who is signed in, and this server's build, as the page carries them (`serveApp`): `{ user, build }`, the same shape
|
|
1189
|
+
* `hello` sends, so a session the device kept can be checked (`usable`) before `/api/me` answers. Null when the page
|
|
1190
|
+
* names neither, as for a signed-out request.
|
|
1191
|
+
*/
|
|
1192
|
+
function knownFromPage() {
|
|
1193
|
+
const text = document.getElementById("pocket-known")?.textContent;
|
|
1194
|
+
|
|
1195
|
+
if (!text) {
|
|
1196
|
+
return null;
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
try {
|
|
1200
|
+
const known = JSON.parse(text);
|
|
1201
|
+
|
|
1202
|
+
return known?.user?.id && typeof known.build === "string" ? known : null;
|
|
1203
|
+
} catch {
|
|
1204
|
+
return null;
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
/**
|
|
1209
|
+
* Whether this browser keeps sessions on the device: the server allows it (`PI_POCKET_SESSION_CACHE`), and it can.
|
|
1210
|
+
* Before `/api/me` answers, the page saying who is signed in (`knownFromPage`) says the server allows it: a server
|
|
1211
|
+
* that does not sends no such page, and what it kept is checked again once the answer comes.
|
|
1212
|
+
*/
|
|
1186
1213
|
const onDevice = () =>
|
|
1187
1214
|
!deviceCacheStopped &&
|
|
1188
|
-
store.state.server?.deviceCache === true
|
|
1215
|
+
(store.state.server?.deviceCache === true ||
|
|
1216
|
+
(store.state.me === undefined && store.state.server == null && knownFromPage() !== null)) &&
|
|
1189
1217
|
typeof indexedDB !== "undefined";
|
|
1190
1218
|
|
|
1191
1219
|
/** Set at sign-out, in this tab or another: the device keeps nothing more. */
|
|
@@ -1291,10 +1319,11 @@ function readDevice(id) {
|
|
|
1291
1319
|
: disk.read(id).catch(() => undefined);
|
|
1292
1320
|
}
|
|
1293
1321
|
|
|
1294
|
-
/**
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1322
|
+
/**
|
|
1323
|
+
* Whether what the device kept of session `id` may be used: this person's, with the same rights, of this build. Before
|
|
1324
|
+
* `/api/me` answers, the page's own word of who and which build (`knownFromPage`) stands in for the store's.
|
|
1325
|
+
*/
|
|
1326
|
+
function usable(found, id, { me, server } = store.state) {
|
|
1298
1327
|
return (
|
|
1299
1328
|
found !== undefined &&
|
|
1300
1329
|
onDevice() &&
|
|
@@ -1307,9 +1336,9 @@ function usable(found, id) {
|
|
|
1307
1336
|
}
|
|
1308
1337
|
|
|
1309
1338
|
/** A session the device kept (`readDevice`), as `deviceView` gives it, once it is checked. */
|
|
1310
|
-
function adopt(id, found) {
|
|
1339
|
+
function adopt(id, found, identity = store.state) {
|
|
1311
1340
|
if (
|
|
1312
|
-
!usable(found, id) ||
|
|
1341
|
+
!usable(found, id, identity) ||
|
|
1313
1342
|
store.state.conversationId !== id ||
|
|
1314
1343
|
store.state.view.conversation != null
|
|
1315
1344
|
) {
|
|
@@ -1498,7 +1527,15 @@ function keptView(id) {
|
|
|
1498
1527
|
shownSeen = kept?.seen ?? null;
|
|
1499
1528
|
|
|
1500
1529
|
if (kept === undefined) {
|
|
1501
|
-
|
|
1530
|
+
// Not in memory: the device may have it (`showKept` reads it). Until that read, or the server's view, the
|
|
1531
|
+
// transcript shows the session's header and a quiet loader, not the full-page boot screen (`pending`).
|
|
1532
|
+
return {
|
|
1533
|
+
view: emptyView(),
|
|
1534
|
+
transcriptFrom: null,
|
|
1535
|
+
transcriptPlace: null,
|
|
1536
|
+
holding: null,
|
|
1537
|
+
pending: id,
|
|
1538
|
+
};
|
|
1502
1539
|
}
|
|
1503
1540
|
|
|
1504
1541
|
const hold = holdsFor(kept);
|
|
@@ -1509,6 +1546,8 @@ function keptView(id) {
|
|
|
1509
1546
|
transcriptFrom: place?.from ?? null,
|
|
1510
1547
|
transcriptPlace: place === null ? null : { keep: place.keep },
|
|
1511
1548
|
holding: hold ? id : null,
|
|
1549
|
+
// In hand: its quiet loader, from a switch that found nothing in memory, goes.
|
|
1550
|
+
pending: null,
|
|
1512
1551
|
};
|
|
1513
1552
|
}
|
|
1514
1553
|
|
|
@@ -1567,8 +1606,13 @@ function applyView(data) {
|
|
|
1567
1606
|
synced = data.conversation.id;
|
|
1568
1607
|
}
|
|
1569
1608
|
|
|
1570
|
-
// A session held for its changes (`holdsFor`) shows with them.
|
|
1571
|
-
store.set((state) => ({
|
|
1609
|
+
// A session held for its changes (`holdsFor`) shows with them. Its quiet loader (`pending`) goes with the view.
|
|
1610
|
+
store.set((state) => ({
|
|
1611
|
+
view: mergeView(state.view, data),
|
|
1612
|
+
missing: null,
|
|
1613
|
+
holding: null,
|
|
1614
|
+
pending: null,
|
|
1615
|
+
}));
|
|
1572
1616
|
}
|
|
1573
1617
|
|
|
1574
1618
|
/**
|
|
@@ -1937,7 +1981,7 @@ const handlers = {
|
|
|
1937
1981
|
store.set((state) => ({
|
|
1938
1982
|
// Said of a session this tab has since left (`show`), it is not what the tab shows.
|
|
1939
1983
|
...(state.conversationId === data.conversationId
|
|
1940
|
-
? { missing: data.message, holding: null }
|
|
1984
|
+
? { missing: data.message, holding: null, pending: null }
|
|
1941
1985
|
: {}),
|
|
1942
1986
|
...(state.view.conversation?.id === data.conversationId ? { view: emptyView() } : {}),
|
|
1943
1987
|
}));
|
|
@@ -2529,6 +2573,18 @@ export function navigate(
|
|
|
2529
2573
|
showKept(conversationId);
|
|
2530
2574
|
}
|
|
2531
2575
|
|
|
2576
|
+
/**
|
|
2577
|
+
* Go up to the session this one belongs to (a subagent's parent). Opened over it, back to its entry, as a swipe back
|
|
2578
|
+
* goes; reached another way (the list, a notification), in this route's place. Either way no entry of this route stays
|
|
2579
|
+
* above the parent's, for back to open again.
|
|
2580
|
+
*/
|
|
2581
|
+
export function navigateUp(conversationId) {
|
|
2582
|
+
navigate(
|
|
2583
|
+
conversationId,
|
|
2584
|
+
routeUnder() === `/s/${conversationId}` ? { back: true } : { replace: true },
|
|
2585
|
+
);
|
|
2586
|
+
}
|
|
2587
|
+
|
|
2532
2588
|
/** The number of the last session gone to, so a read of the device that comes late does not show an older one. */
|
|
2533
2589
|
let going = 0;
|
|
2534
2590
|
|
|
@@ -2551,7 +2607,8 @@ function showKept(id) {
|
|
|
2551
2607
|
}
|
|
2552
2608
|
|
|
2553
2609
|
if (found !== undefined) {
|
|
2554
|
-
|
|
2610
|
+
// In hand from the device: its quiet loader, shown while the read ran, goes.
|
|
2611
|
+
store.set({ ...found, pending: null });
|
|
2555
2612
|
}
|
|
2556
2613
|
|
|
2557
2614
|
show();
|
|
@@ -2588,15 +2645,36 @@ onRoute(() => {
|
|
|
2588
2645
|
}
|
|
2589
2646
|
});
|
|
2590
2647
|
|
|
2648
|
+
// A failed `/api/me` leaves this device snapshot on screen; its original provenance follows the next attempt.
|
|
2649
|
+
let shownEarly = null;
|
|
2650
|
+
|
|
2591
2651
|
export async function start() {
|
|
2592
2652
|
const generation = accountGeneration;
|
|
2653
|
+
const retained = shownEarly;
|
|
2593
2654
|
|
|
2594
2655
|
try {
|
|
2595
2656
|
const asked = moment();
|
|
2596
|
-
//
|
|
2657
|
+
// Read the device while asking who this is. The signed-in page supplies the same identity and build for
|
|
2658
|
+
// `usable`, never a browser-stored guess. Apply a checked copy as soon as the read finishes.
|
|
2597
2659
|
const id = store.state.conversationId;
|
|
2598
2660
|
const onDisk = id === null ? undefined : readDevice(id);
|
|
2599
|
-
const
|
|
2661
|
+
const answer = api("me");
|
|
2662
|
+
|
|
2663
|
+
// The request may fail before IndexedDB answers; it is handled by the await below.
|
|
2664
|
+
void answer.catch(() => {});
|
|
2665
|
+
const cached = await onDisk;
|
|
2666
|
+
const known = knownFromPage();
|
|
2667
|
+
const early =
|
|
2668
|
+
known === null ? undefined : adopt(id, cached, { me: known.user, server: known });
|
|
2669
|
+
|
|
2670
|
+
if (early !== undefined) {
|
|
2671
|
+
shownEarly = { id, cached };
|
|
2672
|
+
}
|
|
2673
|
+
|
|
2674
|
+
store.set(early ?? {});
|
|
2675
|
+
// Let App's queued render replace the static boot screen before revealing a checked transcript.
|
|
2676
|
+
queueMicrotask(() => document.getElementById("app")?.removeAttribute("hidden"));
|
|
2677
|
+
const hello = await answer;
|
|
2600
2678
|
|
|
2601
2679
|
if (!acceptPerson(hello.user, generation)) {
|
|
2602
2680
|
return;
|
|
@@ -2612,15 +2690,30 @@ export async function start() {
|
|
|
2612
2690
|
});
|
|
2613
2691
|
store.set(layoutPatch(firstLayout()));
|
|
2614
2692
|
|
|
2615
|
-
if (
|
|
2616
|
-
|
|
2693
|
+
if (generation !== accountGeneration || changingAccount) {
|
|
2694
|
+
reloadAccount();
|
|
2617
2695
|
|
|
2618
|
-
|
|
2619
|
-
|
|
2696
|
+
return;
|
|
2697
|
+
}
|
|
2620
2698
|
|
|
2621
|
-
|
|
2622
|
-
|
|
2699
|
+
// Recheck the original record, including its owner, against `/api/me`. A changed sign-in, rights, build, or
|
|
2700
|
+
// device-cache policy must remove the early view, and must not keep it for a later switch, including on retry.
|
|
2701
|
+
const shown = early !== undefined ? { id, cached } : retained;
|
|
2623
2702
|
|
|
2703
|
+
if (
|
|
2704
|
+
shown !== null &&
|
|
2705
|
+
store.state.view.conversation?.id === shown.id &&
|
|
2706
|
+
!usable(shown.cached, shown.id)
|
|
2707
|
+
) {
|
|
2708
|
+
forgetKept();
|
|
2709
|
+
store.set({
|
|
2710
|
+
view: emptyView(),
|
|
2711
|
+
transcriptFrom: null,
|
|
2712
|
+
transcriptPlace: null,
|
|
2713
|
+
holding: null,
|
|
2714
|
+
pending: shown.id,
|
|
2715
|
+
});
|
|
2716
|
+
} else if (store.state.view.conversation == null) {
|
|
2624
2717
|
const found = adopt(id, cached);
|
|
2625
2718
|
|
|
2626
2719
|
if (found !== undefined) {
|
|
@@ -2628,6 +2721,7 @@ export async function start() {
|
|
|
2628
2721
|
}
|
|
2629
2722
|
}
|
|
2630
2723
|
|
|
2724
|
+
shownEarly = null;
|
|
2631
2725
|
connect();
|
|
2632
2726
|
} catch (error) {
|
|
2633
2727
|
if (generation !== accountGeneration || changingAccount) {
|
|
@@ -2641,6 +2735,7 @@ export async function start() {
|
|
|
2641
2735
|
}
|
|
2642
2736
|
|
|
2643
2737
|
store.set({ me: error.status === 401 ? null : undefined });
|
|
2738
|
+
queueMicrotask(() => document.getElementById("app")?.removeAttribute("hidden"));
|
|
2644
2739
|
|
|
2645
2740
|
if (error.status !== 401) {
|
|
2646
2741
|
notify("error", `Server unreachable: ${error.message}`);
|
package/web/style.css
CHANGED
|
@@ -8791,23 +8791,136 @@ div.group-head {
|
|
|
8791
8791
|
.custom-endpoint-models {
|
|
8792
8792
|
display: flex;
|
|
8793
8793
|
flex-direction: column;
|
|
8794
|
-
max-height:
|
|
8794
|
+
max-height: 420px;
|
|
8795
8795
|
overflow-y: auto;
|
|
8796
8796
|
border: 1px solid var(--hair);
|
|
8797
8797
|
border-radius: var(--r-control);
|
|
8798
8798
|
background: var(--bg);
|
|
8799
8799
|
}
|
|
8800
8800
|
|
|
8801
|
-
.custom-endpoint-model.
|
|
8801
|
+
.custom-endpoint-model + .custom-endpoint-model {
|
|
8802
|
+
border-top: 1px solid var(--hair);
|
|
8803
|
+
}
|
|
8804
|
+
|
|
8805
|
+
/* A model: its checkbox and id, then, once chosen, Images, its thinking levels, and its context and price on the right. */
|
|
8806
|
+
.custom-endpoint-model-row {
|
|
8807
|
+
display: flex;
|
|
8808
|
+
flex-wrap: wrap;
|
|
8809
|
+
align-items: center;
|
|
8810
|
+
justify-content: space-between;
|
|
8811
|
+
gap: 4px 12px;
|
|
8802
8812
|
min-height: 40px;
|
|
8813
|
+
padding: 4px 12px;
|
|
8814
|
+
}
|
|
8815
|
+
|
|
8816
|
+
.custom-endpoint-model-name.check {
|
|
8817
|
+
flex: 1 1 200px;
|
|
8818
|
+
min-width: 0;
|
|
8803
8819
|
margin: 0;
|
|
8804
|
-
padding: 0 12px;
|
|
8805
8820
|
color: var(--text);
|
|
8806
8821
|
overflow-wrap: anywhere;
|
|
8807
8822
|
}
|
|
8808
8823
|
|
|
8809
|
-
.custom-endpoint-model
|
|
8810
|
-
|
|
8824
|
+
.custom-endpoint-model-caps {
|
|
8825
|
+
display: flex;
|
|
8826
|
+
flex-wrap: wrap;
|
|
8827
|
+
justify-content: flex-end;
|
|
8828
|
+
align-items: center;
|
|
8829
|
+
gap: 6px 12px;
|
|
8830
|
+
margin-left: auto;
|
|
8831
|
+
}
|
|
8832
|
+
|
|
8833
|
+
.custom-endpoint-model-caps .check {
|
|
8834
|
+
margin: 0;
|
|
8835
|
+
}
|
|
8836
|
+
|
|
8837
|
+
.model-thinking-button {
|
|
8838
|
+
gap: 6px;
|
|
8839
|
+
white-space: nowrap;
|
|
8840
|
+
}
|
|
8841
|
+
|
|
8842
|
+
.model-thinking-button.on {
|
|
8843
|
+
color: var(--accent);
|
|
8844
|
+
border-color: var(--accent-line);
|
|
8845
|
+
}
|
|
8846
|
+
|
|
8847
|
+
.model-thinking-button.bad {
|
|
8848
|
+
color: var(--warn);
|
|
8849
|
+
border-color: var(--warn-line);
|
|
8850
|
+
}
|
|
8851
|
+
|
|
8852
|
+
/* A model's thinking levels, or its context and price, opened under its row. */
|
|
8853
|
+
.model-thinking,
|
|
8854
|
+
.model-limits {
|
|
8855
|
+
display: flex;
|
|
8856
|
+
flex-direction: column;
|
|
8857
|
+
gap: 8px;
|
|
8858
|
+
margin: 0 12px 12px;
|
|
8859
|
+
padding: 12px;
|
|
8860
|
+
border: 1px solid var(--hair);
|
|
8861
|
+
border-radius: var(--r-control);
|
|
8862
|
+
background: var(--card);
|
|
8863
|
+
}
|
|
8864
|
+
|
|
8865
|
+
.model-thinking p,
|
|
8866
|
+
.model-limits p {
|
|
8867
|
+
margin: 0;
|
|
8868
|
+
}
|
|
8869
|
+
|
|
8870
|
+
.model-limits-grid {
|
|
8871
|
+
display: grid;
|
|
8872
|
+
grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
|
|
8873
|
+
gap: 8px;
|
|
8874
|
+
}
|
|
8875
|
+
|
|
8876
|
+
.model-limits input {
|
|
8877
|
+
min-width: 0;
|
|
8878
|
+
}
|
|
8879
|
+
|
|
8880
|
+
.model-thinking-on.check {
|
|
8881
|
+
margin: 0;
|
|
8882
|
+
color: var(--text);
|
|
8883
|
+
}
|
|
8884
|
+
|
|
8885
|
+
.model-tiers {
|
|
8886
|
+
display: flex;
|
|
8887
|
+
flex-direction: column;
|
|
8888
|
+
gap: 6px;
|
|
8889
|
+
}
|
|
8890
|
+
|
|
8891
|
+
.model-tier {
|
|
8892
|
+
display: grid;
|
|
8893
|
+
grid-template-columns: minmax(0, 9rem) minmax(0, 1fr) auto;
|
|
8894
|
+
align-items: center;
|
|
8895
|
+
gap: 8px;
|
|
8896
|
+
}
|
|
8897
|
+
|
|
8898
|
+
.model-tier select,
|
|
8899
|
+
.model-tier input {
|
|
8900
|
+
min-width: 0;
|
|
8901
|
+
}
|
|
8902
|
+
|
|
8903
|
+
/* On a phone the value goes under the level: side by side, the value had no room left to show. */
|
|
8904
|
+
@media (max-width: 480px) {
|
|
8905
|
+
.model-tier {
|
|
8906
|
+
grid-template-columns: minmax(0, 1fr) auto;
|
|
8907
|
+
}
|
|
8908
|
+
|
|
8909
|
+
.model-tier select {
|
|
8910
|
+
grid-area: 1 / 1;
|
|
8911
|
+
}
|
|
8912
|
+
|
|
8913
|
+
.model-tier button {
|
|
8914
|
+
grid-area: 1 / 2;
|
|
8915
|
+
}
|
|
8916
|
+
|
|
8917
|
+
.model-tier input {
|
|
8918
|
+
grid-area: 2 / 1 / 3 / 3;
|
|
8919
|
+
}
|
|
8920
|
+
}
|
|
8921
|
+
|
|
8922
|
+
.model-tier-buttons {
|
|
8923
|
+
gap: 8px;
|
|
8811
8924
|
}
|
|
8812
8925
|
|
|
8813
8926
|
.custom-endpoint-buttons {
|
|
@@ -10476,20 +10589,46 @@ textarea.notes {
|
|
|
10476
10589
|
}
|
|
10477
10590
|
|
|
10478
10591
|
.lesson-add > .row {
|
|
10479
|
-
|
|
10592
|
+
justify-content: flex-end;
|
|
10480
10593
|
}
|
|
10481
10594
|
|
|
10482
|
-
|
|
10483
|
-
|
|
10484
|
-
flex: 1
|
|
10595
|
+
/* Where the lesson goes: the scope chosen above. */
|
|
10596
|
+
.lesson-add-for {
|
|
10597
|
+
flex: 1;
|
|
10598
|
+
min-width: 0;
|
|
10599
|
+
padding: 0 4px;
|
|
10600
|
+
overflow: hidden;
|
|
10601
|
+
text-overflow: ellipsis;
|
|
10602
|
+
white-space: nowrap;
|
|
10603
|
+
}
|
|
10604
|
+
|
|
10605
|
+
/* Memory's scope: which lessons the sheet lists, and where one added goes; each half a thumb's tap, with its count. */
|
|
10606
|
+
.memory-scope {
|
|
10607
|
+
align-self: stretch;
|
|
10485
10608
|
flex-wrap: nowrap;
|
|
10486
10609
|
}
|
|
10487
10610
|
|
|
10488
|
-
.
|
|
10611
|
+
.memory-scope button {
|
|
10489
10612
|
flex: 1;
|
|
10613
|
+
display: flex;
|
|
10614
|
+
align-items: center;
|
|
10615
|
+
justify-content: center;
|
|
10616
|
+
gap: 6px;
|
|
10617
|
+
min-width: 0;
|
|
10618
|
+
min-height: 36px;
|
|
10490
10619
|
white-space: nowrap;
|
|
10491
10620
|
}
|
|
10492
10621
|
|
|
10622
|
+
.memory-scope-count {
|
|
10623
|
+
color: var(--muted);
|
|
10624
|
+
font: 11.5px var(--mono);
|
|
10625
|
+
font-variant-numeric: tabular-nums;
|
|
10626
|
+
}
|
|
10627
|
+
|
|
10628
|
+
.memory-scope button.on .memory-scope-count {
|
|
10629
|
+
color: var(--muted);
|
|
10630
|
+
}
|
|
10631
|
+
|
|
10493
10632
|
/* Done when: a goal met, or one Pi gave up on. */
|
|
10494
10633
|
.goal-bar.met {
|
|
10495
10634
|
--tone: var(--ok);
|
|
@@ -11602,9 +11741,29 @@ textarea.notes {
|
|
|
11602
11741
|
font-size: 12px;
|
|
11603
11742
|
}
|
|
11604
11743
|
|
|
11744
|
+
/* A phone's picked schedule: its title and its buttons stay put, and only the message and its facts scroll. */
|
|
11605
11745
|
.rb-bar {
|
|
11606
11746
|
max-height: 70dvh;
|
|
11747
|
+
overflow: hidden;
|
|
11748
|
+
}
|
|
11749
|
+
|
|
11750
|
+
.rb-bar .rb-detail {
|
|
11751
|
+
display: flex;
|
|
11752
|
+
flex-direction: column;
|
|
11753
|
+
min-height: 0;
|
|
11754
|
+
}
|
|
11755
|
+
|
|
11756
|
+
.rb-bar .rb-detail-head,
|
|
11757
|
+
.rb-bar .rb-actions {
|
|
11758
|
+
flex: none;
|
|
11759
|
+
}
|
|
11760
|
+
|
|
11761
|
+
.rb-bar .rb-detail-body {
|
|
11762
|
+
flex: 1 1 auto;
|
|
11763
|
+
min-height: 0;
|
|
11607
11764
|
overflow-y: auto;
|
|
11765
|
+
overscroll-behavior: contain;
|
|
11766
|
+
scrollbar-width: thin;
|
|
11608
11767
|
}
|
|
11609
11768
|
}
|
|
11610
11769
|
|
|
@@ -17940,7 +18099,7 @@ textarea.notes {
|
|
|
17940
18099
|
left: calc(8px + var(--inset-l));
|
|
17941
18100
|
right: calc(8px + var(--inset-r));
|
|
17942
18101
|
bottom: 8px;
|
|
17943
|
-
z-index:
|
|
18102
|
+
z-index: 5;
|
|
17944
18103
|
display: flex;
|
|
17945
18104
|
flex-direction: column;
|
|
17946
18105
|
gap: 8px;
|
|
@@ -18814,9 +18973,13 @@ textarea.notes {
|
|
|
18814
18973
|
display: block;
|
|
18815
18974
|
}
|
|
18816
18975
|
|
|
18817
|
-
/* Above the message box and the jump to the newest message, both at the bottom right.
|
|
18976
|
+
/* Above the message box and the jump to the newest message, both at the bottom right. The message box grows with
|
|
18977
|
+
* what it holds (a held-messages bar, a queue): its height is measured, and the mark keeps above it. */
|
|
18818
18978
|
.pip-bubble {
|
|
18819
|
-
bottom:
|
|
18979
|
+
bottom: max(
|
|
18980
|
+
calc(176px + env(safe-area-inset-bottom)),
|
|
18981
|
+
calc(var(--composer-rise, 0px) + 56px)
|
|
18982
|
+
);
|
|
18820
18983
|
}
|
|
18821
18984
|
|
|
18822
18985
|
.pip-scrim {
|
package/web/transcript.js
CHANGED
|
@@ -3442,8 +3442,9 @@ function windowStart(rows, from) {
|
|
|
3442
3442
|
}
|
|
3443
3443
|
|
|
3444
3444
|
/**
|
|
3445
|
-
* How long
|
|
3446
|
-
*
|
|
3445
|
+
* How long what comes for a session is its catch-up, from the server's first view after the session showed from what
|
|
3446
|
+
* the tab or the device kept, or after a reconnect (`due`): it glides in at the bottom, or arrives below the reader
|
|
3447
|
+
* without moving what they read.
|
|
3447
3448
|
*/
|
|
3448
3449
|
const CATCH_UP_MS = 3000;
|
|
3449
3450
|
/** How long a session held for its changes (Appearance's Wait for updates) waits for them before it shows anyway. */
|
|
@@ -3584,11 +3585,12 @@ export function Transcript() {
|
|
|
3584
3585
|
entrance.current = routeSliding() ? "" : "rising";
|
|
3585
3586
|
}
|
|
3586
3587
|
|
|
3587
|
-
// When
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3588
|
+
// When the catch-up began, or 0. It begins with the first view after `due`, however late that view comes.
|
|
3589
|
+
const keptAt = useRef(0);
|
|
3590
|
+
// The view on screen as a catch-up became due (rows from what was kept, or a reconnect), until the next view comes.
|
|
3591
|
+
const due = useRef(null);
|
|
3592
|
+
const open = store.state.connection === "open";
|
|
3593
|
+
const wasOpen = useRef(open);
|
|
3592
3594
|
const catching = () => keptAt.current > 0 && performance.now() - keptAt.current < CATCH_UP_MS;
|
|
3593
3595
|
/** The row the reader looks at, as this draw began, while the session catches up (`anchorOf`). */
|
|
3594
3596
|
const anchor = useRef(null);
|
|
@@ -3654,6 +3656,24 @@ export function Transcript() {
|
|
|
3654
3656
|
// Rows of the catch-up about to be drawn: where the reader looks, before Preact changes the page (it does after this
|
|
3655
3657
|
// function returns), to keep it there after.
|
|
3656
3658
|
const drawnRows = useRef(rows);
|
|
3659
|
+
// A draw has put rows on screen.
|
|
3660
|
+
const shown = useRef(false);
|
|
3661
|
+
|
|
3662
|
+
// Back from a reconnect, with rows on screen: what the server sends now is a catch-up.
|
|
3663
|
+
if (open && !wasOpen.current && shown.current) {
|
|
3664
|
+
due.current = view;
|
|
3665
|
+
}
|
|
3666
|
+
|
|
3667
|
+
wasOpen.current = open;
|
|
3668
|
+
|
|
3669
|
+
// The first view after one that was due is the catch-up: with new rows, they glide, however late they come.
|
|
3670
|
+
if (due.current !== null && view !== due.current) {
|
|
3671
|
+
due.current = null;
|
|
3672
|
+
|
|
3673
|
+
if (rows !== drawnRows.current && shown.current && view.conversation && !held) {
|
|
3674
|
+
keptAt.current = performance.now();
|
|
3675
|
+
}
|
|
3676
|
+
}
|
|
3657
3677
|
|
|
3658
3678
|
if (rows !== drawnRows.current) {
|
|
3659
3679
|
drawnRows.current = rows;
|
|
@@ -3700,6 +3720,13 @@ export function Transcript() {
|
|
|
3700
3720
|
place(element);
|
|
3701
3721
|
counted.current = rows.length;
|
|
3702
3722
|
|
|
3723
|
+
// The first rows on screen are what the tab or the device kept: the server's view of them is still to come.
|
|
3724
|
+
if (!shown.current && rows.length > 0 && !viewSynced(view.conversation?.id)) {
|
|
3725
|
+
due.current = view;
|
|
3726
|
+
}
|
|
3727
|
+
|
|
3728
|
+
shown.current = rows.length > 0;
|
|
3729
|
+
|
|
3703
3730
|
if (rows.length === 0) {
|
|
3704
3731
|
return;
|
|
3705
3732
|
}
|
|
@@ -3735,8 +3762,12 @@ export function Transcript() {
|
|
|
3735
3762
|
}
|
|
3736
3763
|
|
|
3737
3764
|
// The row measured from was drawn again (or folded away): the glide goes by what came below, from where the end
|
|
3738
|
-
// of the column was.
|
|
3739
|
-
|
|
3765
|
+
// of the column was. It also goes by that when the row is still there and rows came after it, which a bottom
|
|
3766
|
+
// anchor's own edge does not include. Without this a catch-up jumped there in one frame.
|
|
3767
|
+
const now =
|
|
3768
|
+
placed === null || (before.bottom && addedBelow(column.current, before) > 0)
|
|
3769
|
+
? before.at - addedBelow(column.current, before)
|
|
3770
|
+
: placed;
|
|
3740
3771
|
|
|
3741
3772
|
if (!before.bottom) {
|
|
3742
3773
|
// A browser that keeps the row in place by itself (scroll anchoring) has: then this moves nothing.
|
|
@@ -3811,7 +3842,8 @@ export function Transcript() {
|
|
|
3811
3842
|
return;
|
|
3812
3843
|
}
|
|
3813
3844
|
|
|
3814
|
-
|
|
3845
|
+
// A kept session's rows are on screen: what mounts after them, its catch-up first, is new.
|
|
3846
|
+
if (due.current !== null || keptAt.current > 0) {
|
|
3815
3847
|
settledFor = conversationId;
|
|
3816
3848
|
|
|
3817
3849
|
return;
|
|
@@ -4003,8 +4035,22 @@ export function Transcript() {
|
|
|
4003
4035
|
}
|
|
4004
4036
|
|
|
4005
4037
|
if (!view.conversation || held) {
|
|
4006
|
-
const { connection, sessions, conversationId } = store.state;
|
|
4038
|
+
const { connection, sessions, conversationId, pending } = store.state;
|
|
4007
4039
|
const title = sessions.find((session) => session.id === conversationId)?.title;
|
|
4040
|
+
|
|
4041
|
+
// Nothing kept anywhere: the session's own pane, its title, and a quiet loader, not the full-page boot screen.
|
|
4042
|
+
// A session held for its changes keeps that screen, as before.
|
|
4043
|
+
if (pending === conversationId && !held) {
|
|
4044
|
+
return html`<main class="scroller">
|
|
4045
|
+
<div class="transcript" data-part="transcript">
|
|
4046
|
+
<div class="loader" role="status">
|
|
4047
|
+
<${Spinner} label="Loading" />
|
|
4048
|
+
<span>${title ? `Loading ${title}` : "Loading"}…</span>
|
|
4049
|
+
</div>
|
|
4050
|
+
</div>
|
|
4051
|
+
</main>`;
|
|
4052
|
+
}
|
|
4053
|
+
|
|
4008
4054
|
const caption =
|
|
4009
4055
|
connection === "connecting"
|
|
4010
4056
|
? "connecting"
|