oysterun 1.6.0-beta.2 → 1.6.0-beta.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/bin/oysterun.mjs +64 -17
- package/dev/client/connectivity/completed-message-neighbor-click.mjs +78 -0
- package/dev/client/connectivity/completed-message-neighbor-contract.mjs +205 -0
- package/dev/client/connectivity/completed-message-visibility.d.mts +4 -4
- package/dev/client/connectivity/completed-message-visibility.mjs +14 -11
- package/dev/client/connectivity/desktop-chat-sidebar-preference.mjs +57 -0
- package/dev/client/connectivity/host-connection-feedback.mjs +12 -1
- package/dev/client/connectivity/managed-host-browser.mjs +10 -0
- package/dev/client/connectivity/session-navigation-intent.mjs +189 -0
- package/dev/client/connectivity/session-transition-state.mjs +18 -6
- package/dev/client/connectivity/test-completed-message-neighbor-click.mjs +180 -0
- package/dev/client/web/index.html +5367 -609
- package/dev/client/web-chat/dist/assets/{ReactPrism-BwJhidYf.js → ReactPrism-C6YiTZTC.js} +1 -1
- package/dev/client/web-chat/dist/assets/{ReactPrism-BwJhidYf.js.map → ReactPrism-C6YiTZTC.js.map} +1 -1
- package/dev/client/web-chat/dist/assets/SessionsSetupApp-CKJOSPFP.js +6442 -0
- package/dev/client/web-chat/dist/assets/SessionsSetupApp-CKJOSPFP.js.map +1 -0
- package/dev/client/web-chat/dist/assets/SessionsSetupApp-Dx09Uz-6.css +1 -0
- package/dev/client/web-chat/dist/assets/index-Ae5I4LHp.js +9 -0
- package/dev/client/web-chat/dist/assets/index-Ae5I4LHp.js.map +1 -0
- package/dev/client/web-chat/dist/assets/index-CN_FoTB1.js +2 -0
- package/dev/client/web-chat/dist/assets/index-CN_FoTB1.js.map +1 -0
- package/dev/client/web-chat/dist/assets/{index--1xmQ99x.js → index-DCQFwgGf.js} +2 -2
- package/dev/client/web-chat/dist/assets/{index--1xmQ99x.js.map → index-DCQFwgGf.js.map} +1 -1
- package/dev/client/web-chat/dist/assets/matrix-entry-BV7G38kH.css +10 -0
- package/dev/client/web-chat/dist/assets/matrix-entry-abAy3aOo.js +594 -0
- package/dev/client/web-chat/dist/assets/matrix-entry-abAy3aOo.js.map +1 -0
- package/dev/client/web-chat/dist/assets/{pdf-ZjtalfgI.js → pdf-DN7oVvM6.js} +5 -5
- package/dev/client/web-chat/dist/assets/pdf-DN7oVvM6.js.map +1 -0
- package/dev/client/web-chat/dist/assets/session-notice-DlyODy1z.css +1 -0
- package/dev/client/web-chat/dist/assets/web-BlYuDlOV.js +1 -0
- package/dev/client/web-chat/dist/assets/{web-c70YaskK.js.map → web-BlYuDlOV.js.map} +1 -1
- package/dev/client/web-chat/dist/assets/web-Dabw6cJi.js +1 -0
- package/dev/client/web-chat/dist/assets/{web-BzHcZK2M.js.map → web-Dabw6cJi.js.map} +1 -1
- package/dev/client/web-chat/dist/index.html +1 -2
- package/docs/routec/dev/cloud_deplyments.md +5 -0
- package/docs/routec/dev/npm_native_dependency_install.md +6 -2
- package/docs/routec/dev/npmjs_publish.md +55 -19
- package/docs/routec/dev/p262_setup_input_file.md +117 -0
- package/docs/routec/host2_turn_started_idempotency_diagnostics.md +8 -7
- package/docs/routec/host_setup.md +39 -10
- package/docs/routec/oysterun_operation_interface_spec.md +78 -2
- package/docs/routec/provider_contract.md +35 -5
- package/host-service/README.md +36 -0
- package/host-service/adapters/claude-code-adapter.mjs +48 -5
- package/host-service/adapters/codex-app-server-adapter.mjs +320 -18
- package/host-service/adapters/debug-fixture-provider-adapter.mjs +102 -1
- package/host-service/adapters/debug-large-tool-spillover-provider-adapter.mjs +2 -0
- package/host-service/adapters/debug-p135-codex-replay-provider-adapter.mjs +2 -0
- package/host-service/adapters/debug-routec-structural-replay-provider-adapter.mjs +2 -0
- package/host-service/agent-config.mjs +16 -5
- package/host-service/agent-folder-availability.mjs +41 -0
- package/host-service/apns-complete-message-dispatcher.mjs +1 -0
- package/host-service/assets/product-skills/Oysterun/modules/oysterun-find-context/SKILL.md +24 -0
- package/host-service/assets/product-skills/Oysterun/modules/oysterun-session-chat/SKILL.md +94 -5
- package/host-service/assets/product-skills/Oysterun/modules/oysterun-sessions/SKILL.md +103 -0
- package/host-service/assets/product-skills/Oysterun/modules/oysterun-website/SKILL.md +7 -0
- package/host-service/assets/product-skills/oysterun-find-context/SKILL.md +24 -0
- package/host-service/assets/product-skills/oysterun-session-chat/SKILL.md +94 -5
- package/host-service/assets/product-skills/oysterun-sessions/SKILL.md +103 -0
- package/host-service/assets/product-skills/oysterun-website/SKILL.md +7 -0
- package/host-service/callback-durable-store.mjs +354 -47
- package/host-service/callback-foundation.mjs +21 -1
- package/host-service/callback-host-integration.mjs +345 -30
- package/host-service/claude-acp-model-discovery.mjs +23 -18
- package/host-service/cli/assert-installer-reinstall-target.mjs +9 -0
- package/host-service/cli/installer-recovery-guidance.mjs +20 -0
- package/host-service/cli/prepare-restart-restore.mjs +2 -0
- package/host-service/cli/product-cli.mjs +34 -33
- package/host-service/cli/reconcile-initial-preflight.mjs +19 -0
- package/host-service/cli/recover-installer-lifecycle.mjs +24 -0
- package/host-service/cli/run-host-lifecycle.mjs +2 -0
- package/host-service/cli/run-staged-lifecycle-recovery.mjs +161 -0
- package/host-service/codex-model-discovery.mjs +23 -18
- package/host-service/complete-cli-uninstall.mjs +176 -0
- package/host-service/complete-message-notification-predicate.mjs +8 -6
- package/host-service/complete-message-notification-title.mjs +4 -0
- package/host-service/completed-session-unread.mjs +425 -42
- package/host-service/completed-turn-navigation.mjs +444 -144
- package/host-service/completed-turn-notification-observer.mjs +116 -0
- package/host-service/completed-turn-service.mjs +445 -0
- package/host-service/config.mjs +115 -9
- package/host-service/desired-open-session-state.mjs +331 -0
- package/host-service/fixtures/p218-completed-turn-notification.json +11 -0
- package/host-service/frp-agent.mjs +9 -9
- package/host-service/grok-acp-model-discovery.mjs +31 -33
- package/host-service/host-lifecycle-recovery.mjs +37 -0
- package/host-service/host-port-resolution.mjs +98 -0
- package/host-service/host-runtime-diagnostics.mjs +18 -1
- package/host-service/initial-preflight-recovery.mjs +71 -0
- package/host-service/installer-recovery-guidance.mjs +85 -0
- package/host-service/installer-reinstall-bindings.mjs +49 -0
- package/host-service/installer-reinstall-target.mjs +49 -0
- package/host-service/legacy-continuity-observation.mjs +33 -0
- package/host-service/lifecycle-compat-cli.mjs +13 -0
- package/host-service/lifecycle-compat-preload.mjs +89 -0
- package/host-service/lifecycle-compatibility.mjs +164 -0
- package/host-service/lifecycle-continuity-assets.mjs +222 -0
- package/host-service/lifecycle-continuity-probe.mjs +97 -0
- package/host-service/lifecycle-continuity-projection.mjs +29 -0
- package/host-service/lifecycle-continuity-runner.mjs +192 -0
- package/host-service/lifecycle-continuity.mjs +493 -0
- package/host-service/lifecycle-service-render-bundle.mjs +120 -0
- package/host-service/lifecycle-user-path.mjs +34 -0
- package/host-service/link-annotations.mjs +10 -0
- package/host-service/matrix-credential-issuer.mjs +32 -1
- package/host-service/matrix-event-correlator.mjs +166 -27
- package/host-service/matrix-facade.mjs +96 -19
- package/host-service/matrix-room-binding.mjs +24 -0
- package/host-service/matrix-transcript-read-adapter.mjs +17 -3
- package/host-service/model-discovery-guardian.mjs +40 -0
- package/host-service/model-discovery-process.mjs +141 -0
- package/host-service/onboard-lifecycle-status.mjs +28 -0
- package/host-service/onboard.mjs +479 -0
- package/host-service/package.json +2 -1
- package/host-service/portable-scheduler-definitions.mjs +28 -0
- package/host-service/product-runtime-host-origin.mjs +22 -0
- package/host-service/provider-model-params.mjs +14 -17
- package/host-service/provider-model-refresh-runner.mjs +124 -169
- package/host-service/provider-model-refresh-schedule.mjs +11 -0
- package/host-service/provider-resume-contract.mjs +9 -3
- package/host-service/restart-restore-state.mjs +25 -0
- package/host-service/retained-host-state-holder.mjs +57 -0
- package/host-service/routec-matrix-sqlite-store.mjs +155 -10
- package/host-service/routec-matrix-storage-adapter.mjs +208 -25
- package/host-service/routec-matrix-storage-paths.mjs +12 -0
- package/host-service/routec-request-delay-window.mjs +55 -0
- package/host-service/scheduler-acp-provider-runner.mjs +2 -1
- package/host-service/scheduler-direct-provider-runner.mjs +71 -9
- package/host-service/scheduler-run-timeout-policy.mjs +85 -0
- package/host-service/scheduler-service.mjs +96 -9
- package/host-service/scheduler-store.mjs +9 -2
- package/host-service/server.mjs +2202 -552
- package/host-service/service-definition-migration.mjs +10 -3
- package/host-service/session-collection-service.mjs +320 -0
- package/host-service/session-history.mjs +99 -15
- package/host-service/session-list-preview-service.mjs +87 -12
- package/host-service/session-list-projection-service.mjs +182 -0
- package/host-service/session-loop-definitions.mjs +702 -75
- package/host-service/session-manager.mjs +473 -38
- package/host-service/session-switcher-projection.mjs +11 -3
- package/host-service/session-tags.mjs +451 -0
- package/host-service/session-transcript-target.mjs +103 -0
- package/host-service/setup-input-file.mjs +91 -0
- package/host-service/setup-provider-model-defaults.mjs +53 -0
- package/host-service/setup.mjs +133 -101
- package/host-service/stopped-user-host-package.mjs +60 -0
- package/host-service/test-fixtures/p236-navigation-original.mjs +500 -0
- package/host-service/update-reminder-state.mjs +7 -0
- package/host-service/voice-input-receipt-store.mjs +60 -0
- package/package.json +1 -1
- package/static/oysterun-social-preview.png +0 -0
- package/static/site/assets/oysterun-social-preview.png +0 -0
- package/static/site/blog/en/index.html +17 -0
- package/static/site/blog/generated_manifest.json +9 -9
- package/static/site/blog/index.html +18 -0
- package/static/site/blog/voice-input-model-experiment/en/index.html +17 -0
- package/static/site/blog/voice-input-model-experiment/zh/index.html +17 -0
- package/static/site/blog/zh/index.html +17 -0
- package/static/site/docs/choose-and-recover-a-provider/en/index.html +17 -0
- package/static/site/docs/choose-and-recover-a-provider/zh/index.html +17 -0
- package/static/site/docs/configure-session-files-and-settings/en/index.html +17 -0
- package/static/site/docs/configure-session-files-and-settings/zh/index.html +17 -0
- package/static/site/docs/en/index.html +17 -0
- package/static/site/docs/generated_manifest.json +60 -60
- package/static/site/docs/host-authentication-and-connection/en/index.html +17 -0
- package/static/site/docs/host-authentication-and-connection/zh/index.html +17 -0
- package/static/site/docs/index.html +18 -0
- package/static/site/docs/install-and-use-a-skill/en/index.html +17 -0
- package/static/site/docs/install-and-use-a-skill/zh/index.html +17 -0
- package/static/site/docs/read-large-tool-results/en/index.html +17 -0
- package/static/site/docs/read-large-tool-results/zh/index.html +17 -0
- package/static/site/docs/recover-from-a-host-runtime-error/en/index.html +17 -0
- package/static/site/docs/recover-from-a-host-runtime-error/zh/index.html +17 -0
- package/static/site/docs/restore-work-after-a-host-restart/en/index.html +17 -0
- package/static/site/docs/restore-work-after-a-host-restart/zh/index.html +17 -0
- package/static/site/docs/send-images-and-media/en/index.html +17 -0
- package/static/site/docs/send-images-and-media/zh/index.html +17 -0
- package/static/site/docs/set-up-and-understand-a-host/en/index.html +17 -0
- package/static/site/docs/set-up-and-understand-a-host/zh/index.html +17 -0
- package/static/site/docs/understand-agent-activity/en/index.html +19 -2
- package/static/site/docs/understand-agent-activity/en/index.md +2 -2
- package/static/site/docs/understand-agent-activity/zh/index.html +19 -2
- package/static/site/docs/understand-agent-activity/zh/index.md +2 -2
- package/static/site/docs/use-the-oysterun-cli-safely/en/index.html +17 -0
- package/static/site/docs/use-the-oysterun-cli-safely/zh/index.html +17 -0
- package/static/site/docs/zh/index.html +17 -0
- package/static/site/en/index.html +18 -1
- package/static/site/en/index.md +1 -1
- package/static/site/faq/en/index.html +17 -0
- package/static/site/faq/index.html +18 -0
- package/static/site/faq/zh/index.html +17 -0
- package/static/site/getting-started/en/index.html +23 -1
- package/static/site/getting-started/en/index.md +7 -1
- package/static/site/getting-started/index.html +18 -0
- package/static/site/getting-started/zh/index.html +23 -1
- package/static/site/getting-started/zh/index.md +7 -1
- package/static/site/index.html +18 -0
- package/static/site/install.sh +676 -127
- package/static/site/overview/en/index.html +18 -1
- package/static/site/overview/en/index.md +2 -2
- package/static/site/overview/index.html +18 -0
- package/static/site/overview/zh/index.html +18 -1
- package/static/site/overview/zh/index.md +2 -2
- package/static/site/privacy/en/index.html +17 -0
- package/static/site/privacy/index.html +18 -0
- package/static/site/privacy/zh/index.html +17 -0
- package/static/site/zh/index.html +18 -1
- package/static/site/zh/index.md +1 -1
- package/static/site_source/content/tutorials/published/understand-agent-activity/en/article.html +2 -2
- package/static/site_source/content/tutorials/published/understand-agent-activity/zh/article.html +2 -2
- package/static/site_source/downloads/install.sh +676 -127
- package/static/site_source/manifests/host_install.json +2 -10
- package/static/site_source/pages/getting-started/en.html +6 -1
- package/static/site_source/pages/getting-started/zh.html +6 -1
- package/static/site_source/pages/home/en.html +1 -1
- package/static/site_source/pages/home/zh.html +1 -1
- package/static/site_source/pages/home_main.html +3 -2
- package/static/site_source/pages/overview/en.html +1 -1
- package/static/site_source/pages/overview/zh.html +1 -1
- package/tool_scripts/install_oysterun_update.mjs +78 -13
- package/tool_scripts/oysterun_continuity_transaction.mjs +438 -0
- package/tool_scripts/oysterun_npm_package_manifest.mjs +32 -0
- package/tool_scripts/oysterun_release_service.sh +5 -0
- package/tool_scripts/oysterun_service_common.sh +59 -24
- package/tool_scripts/oysterun_setup_input.sh +97 -0
- package/tool_scripts/oysterun_update_restart_runner.mjs +19 -3
- package/tool_scripts/p233_legacy_bootstrap.mjs +254 -0
- package/tool_scripts/resolve_user_host_port.mjs +15 -0
- package/tool_scripts/restart_oysterun.sh +8 -2
- package/tool_scripts/stack_dashboard_credentials.mjs +2 -1
- package/tool_scripts/status_oysterun_launch_agents.sh +13 -1
- package/tool_scripts/sync_host_stack_config.mjs +9 -6
- package/tool_scripts/test_environment_remote_cloud_deprovision.mjs +419 -0
- package/tool_scripts/uninstall_oysterun_launch_agents.sh +3 -5
- package/dev/client/web-chat/dist/assets/index-Ce9NZBZf.js +0 -129
- package/dev/client/web-chat/dist/assets/index-Ce9NZBZf.js.map +0 -1
- package/dev/client/web-chat/dist/assets/index-DzIClZ3T.js +0 -2
- package/dev/client/web-chat/dist/assets/index-DzIClZ3T.js.map +0 -1
- package/dev/client/web-chat/dist/assets/index-NYnaSGBb.css +0 -1
- package/dev/client/web-chat/dist/assets/pdf-ZjtalfgI.js.map +0 -1
- package/dev/client/web-chat/dist/assets/web-BzHcZK2M.js +0 -1
- package/dev/client/web-chat/dist/assets/web-c70YaskK.js +0 -1
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { buildSessionSwitcherRows } from "./session-switcher-projection.mjs";
|
|
2
|
+
|
|
3
|
+
// P236 R4: routes own authorization, eligibility and serializers. This service
|
|
4
|
+
// assembles only their selected roster; dependencies retain storage ownership.
|
|
5
|
+
export class SessionListProjectionService {
|
|
6
|
+
constructor({ readBindings, previewService, prepareDecorationRead, readTagLabels = () => new Map() }) {
|
|
7
|
+
this.readTagLabels = readTagLabels;
|
|
8
|
+
this.readBindings = readBindings;
|
|
9
|
+
this.previewService = previewService;
|
|
10
|
+
this.prepareDecorationRead = prepareDecorationRead;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
metadata(liveSessions) {
|
|
14
|
+
const sessionRows = buildSessionSwitcherRows({ liveSessions, metadataOnly: true, tagLabels: this.readTagLabels() });
|
|
15
|
+
return {
|
|
16
|
+
status: "session_list_metadata",
|
|
17
|
+
session_switcher_metadata_contract: "routec.p236_live_session_metadata.v1",
|
|
18
|
+
session_rows: sessionRows,
|
|
19
|
+
session_count: sessionRows.length,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
bindings(entries) {
|
|
24
|
+
const snapshot = this.readBindings(entries.map((entry) => entry.sessionId));
|
|
25
|
+
const selected = new Map();
|
|
26
|
+
for (const entry of entries) {
|
|
27
|
+
const binding = snapshot.get(entry.sessionId);
|
|
28
|
+
if (binding && (!entry.agentId || binding.host_agent_id === entry.agentId)) {
|
|
29
|
+
selected.set(entry.sessionId, binding);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return selected;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
selectLiveBindings(bindingBySessionId, liveSessions) {
|
|
36
|
+
const selected = [];
|
|
37
|
+
for (const session of liveSessions) {
|
|
38
|
+
const sessionId = session.id || session.sessionId;
|
|
39
|
+
const binding = bindingBySessionId.get(sessionId);
|
|
40
|
+
if (!binding) {
|
|
41
|
+
throw new Error(
|
|
42
|
+
`Live Session unread projection requires a current Matrix binding: ${sessionId}`
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
selected.push(binding);
|
|
46
|
+
}
|
|
47
|
+
return selected;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
liveBindings(liveSessions) {
|
|
51
|
+
const entries = liveSessions.map((session) => ({
|
|
52
|
+
sessionId: session.id || session.sessionId,
|
|
53
|
+
agentId: session.agentId || session.agent_id,
|
|
54
|
+
}));
|
|
55
|
+
return this.selectLiveBindings(this.bindings(entries), liveSessions);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
previewOnly(entries) {
|
|
59
|
+
const bindings = this.bindings(entries);
|
|
60
|
+
const byRoom = new Map();
|
|
61
|
+
const bySession = new Map();
|
|
62
|
+
for (const entry of entries) {
|
|
63
|
+
const binding = bindings.get(entry.sessionId);
|
|
64
|
+
if (!binding) { bySession.set(entry.sessionId, null); continue; }
|
|
65
|
+
if (!byRoom.has(binding.matrix_room_id)) {
|
|
66
|
+
// /sessions and /history have always isolated preview failures to null.
|
|
67
|
+
try {
|
|
68
|
+
byRoom.set(binding.matrix_room_id,
|
|
69
|
+
this.previewService.readForBinding(binding).last_message_preview);
|
|
70
|
+
} catch { byRoom.set(binding.matrix_room_id, null); }
|
|
71
|
+
}
|
|
72
|
+
bySession.set(entry.sessionId, byRoom.get(binding.matrix_room_id));
|
|
73
|
+
}
|
|
74
|
+
return bySession;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
decorate(entries, liveSessions, { unreadScope = "all" } = {}) {
|
|
78
|
+
if (unreadScope !== "all" && unreadScope !== "live") {
|
|
79
|
+
throw new Error(`Unsupported Session unread scope: ${unreadScope}`);
|
|
80
|
+
}
|
|
81
|
+
const bindingBySessionId = this.bindings(entries);
|
|
82
|
+
const bindings = [...bindingBySessionId.values()];
|
|
83
|
+
const liveIds = new Set(liveSessions.map((s) => s.id || s.sessionId));
|
|
84
|
+
if (unreadScope === "live") {
|
|
85
|
+
this.selectLiveBindings(bindingBySessionId, liveSessions);
|
|
86
|
+
}
|
|
87
|
+
const rooms = new Map();
|
|
88
|
+
for (const binding of bindings) {
|
|
89
|
+
if (!rooms.has(binding.matrix_room_id)) rooms.set(binding.matrix_room_id, []);
|
|
90
|
+
rooms.get(binding.matrix_room_id).push(binding);
|
|
91
|
+
}
|
|
92
|
+
const reader = this.prepareDecorationRead();
|
|
93
|
+
const resultByRoomId = new Map();
|
|
94
|
+
const unreadBySessionId = new Map();
|
|
95
|
+
// P236 R6: one synchronous read snapshot per room, not a whole-list
|
|
96
|
+
// transaction. Preview shares a raw checkpoint; each cursor stays separate.
|
|
97
|
+
const historyOnlyBindings = [];
|
|
98
|
+
for (const [roomId, roomBindings] of rooms) {
|
|
99
|
+
const hasLiveBinding = roomBindings.some((binding) =>
|
|
100
|
+
liveIds.has(binding.host_session_id)
|
|
101
|
+
);
|
|
102
|
+
// A live-only unread request still returns History previews, but History
|
|
103
|
+
// rooms have no unread cursor to keep consistent with that preview. Avoid
|
|
104
|
+
// holding an otherwise empty SQLite read transaction around those reads;
|
|
105
|
+
// the batched preview read retains fresh per-room checkpoint validation.
|
|
106
|
+
if (unreadScope === "live" && !hasLiveBinding) {
|
|
107
|
+
historyOnlyBindings.push(roomBindings[0]);
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
reader.withRoomRead(roomId, (readContext) => {
|
|
111
|
+
resultByRoomId.set(roomId, this.previewService.readForBinding(roomBindings[0], { readContext }));
|
|
112
|
+
for (const binding of roomBindings) {
|
|
113
|
+
if (unreadScope === "live" && !liveIds.has(binding.host_session_id)) {
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
unreadBySessionId.set(binding.host_session_id, reader.readUnread(binding, readContext));
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
for (const [roomId, result] of this.previewService.readForBindings(
|
|
121
|
+
historyOnlyBindings
|
|
122
|
+
)) {
|
|
123
|
+
resultByRoomId.set(roomId, result);
|
|
124
|
+
}
|
|
125
|
+
const previews = entries.map((entry) => {
|
|
126
|
+
const binding = bindingBySessionId.get(entry.sessionId);
|
|
127
|
+
if (!binding) {
|
|
128
|
+
const missing = {
|
|
129
|
+
session_id: entry.sessionId, status: "no_matrix_binding",
|
|
130
|
+
last_message_preview: null, latest_committed_seq: 0,
|
|
131
|
+
cache_status: "not_applicable", error_code: null,
|
|
132
|
+
};
|
|
133
|
+
return unreadScope === "live"
|
|
134
|
+
? { ...missing, completed_unread_status: "not_applicable" }
|
|
135
|
+
: {
|
|
136
|
+
...missing,
|
|
137
|
+
latest_completed_event_id: null,
|
|
138
|
+
latest_completed_stream_seq: 0,
|
|
139
|
+
read_through_stream_seq: 0,
|
|
140
|
+
has_unread_completed_message: false,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
const result = resultByRoomId.get(binding.matrix_room_id);
|
|
144
|
+
if (unreadScope === "live" && !liveIds.has(entry.sessionId)) {
|
|
145
|
+
return {
|
|
146
|
+
session_id: entry.sessionId,
|
|
147
|
+
status: result.status,
|
|
148
|
+
last_message_preview: result.last_message_preview,
|
|
149
|
+
latest_committed_seq: result.latest_committed_seq,
|
|
150
|
+
completed_unread_status: "not_applicable",
|
|
151
|
+
cache_status: result.cache_status,
|
|
152
|
+
error_code: result.error_code,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
const unread = unreadBySessionId.get(entry.sessionId) || {};
|
|
156
|
+
return {
|
|
157
|
+
session_id: entry.sessionId, status: result.status,
|
|
158
|
+
last_message_preview: result.last_message_preview,
|
|
159
|
+
latest_committed_seq: result.latest_committed_seq,
|
|
160
|
+
...(unreadScope === "live" ? { completed_unread_status: "ready" } : {}),
|
|
161
|
+
latest_completed_event_id: unread.latest_completed_event_id || null,
|
|
162
|
+
latest_completed_stream_seq: Number(unread.latest_completed_stream_seq) || 0,
|
|
163
|
+
read_through_stream_seq: Number(unread.read_through_stream_seq) || 0,
|
|
164
|
+
has_unread_completed_message:
|
|
165
|
+
liveIds.has(entry.sessionId) && unread.has_unread_completed_message === true,
|
|
166
|
+
cache_status: result.cache_status, error_code: result.error_code,
|
|
167
|
+
};
|
|
168
|
+
});
|
|
169
|
+
return {
|
|
170
|
+
previews,
|
|
171
|
+
sessionRows: buildSessionSwitcherRows({
|
|
172
|
+
tagLabels: this.readTagLabels(),
|
|
173
|
+
liveSessions,
|
|
174
|
+
previewBySessionId: new Map(previews.map((preview) => [preview.session_id, preview])),
|
|
175
|
+
bindingBySessionId,
|
|
176
|
+
}),
|
|
177
|
+
uniqueRoomCount: resultByRoomId.size,
|
|
178
|
+
unreadSchemaVersion: reader.schemaVersion,
|
|
179
|
+
liveUnreadSessionCount: previews.filter((p) => p.has_unread_completed_message === true).length,
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
}
|