Files
openclaw/ui/src/app-session-path-builder.ts
T
Peter Steinberger 27b77a901e feat(ui): make session references first-class links with titled chips and hovercards (#125014)
* feat(sessions): teach session tools the Control UI link rule

Gate guidance on publicOrigin plus enabled Control UI, with exact literal-URL fallback after short-link misses.

* feat(ui): linkify session keys in chat markdown

Match agent session keys structurally in plain text and inline code, then delegate canonical chat navigation.

Allowlist data-session-key through markdown sanitization.

Pathfinder: keep internal Control UI route anchors in-app by removing target="_blank" and external-link rel attributes while preserving external link behavior.

* feat(ui): session hovercard + titled session chips backed by controlUi.sessionPreview

* fix(gateway): scope controlUi.sessionPreview to caller-visible sessions

Hover previews now apply the same createSessionListEntryFilter predicate as
sessions.list, so identity-bearing non-admin callers cannot preview-by-key
incognito rows or non-owner drafts the sidebar hides. Regression test proves
the viewer/admin split; pre-fix run leaked ok-status metadata.

* feat(sessions): carry the session-link rule in tool result envelopes

Deferred-description mode hides prose tool descriptions at decision time. Carry the shared Control UI session-link sentence in successful session lookup result envelopes so every tool mode sees the rule.

* fix(ui): upgrade session chips on appearance, not first pointer event

* fix(android): regenerate gateway protocol methods

* test(gateway): track session preview release train

* perf(ui): lazy-load session hovercard registration

* fix(ui): keep session hovercards off sidebar navigation

* fix(ui): cancel routed session-link navigation

* fix(sessions): advertise forced-literal ~key URLs so short-ID collisions cannot misroute

* test(sessions): update forced-literal guidance expectation

* fix(ui): collision-proof raw-key navigation and SPA-route internal session URLs

* perf(ui): preserve session route lazy boundary

* fix(ui): defer unseeded session-preview fetches to hover intent

* fix(sessions): hard-cap the model-visible session-link base
2026-08-17 04:05:02 -07:00

38 lines
955 B
TypeScript

import type { ControlUiSessionNamespace } from "@openclaw/session-url-contract";
type SessionPathDetails = {
displayName?: string | null;
exactKey?: boolean;
mainKey?: string | null;
shortIdLength?: number;
};
type SessionPathBuilder = typeof import("@openclaw/session-url-contract").buildControlUiSessionPath;
let builder: SessionPathBuilder | undefined;
export function setSessionPathBuilder(next: SessionPathBuilder): void {
builder = next;
}
export function pathForSession(
face: ControlUiSessionNamespace,
agentId: string,
sessionKey: string,
basePath = "",
details: SessionPathDetails = {},
): string | null {
return (
builder?.({
namespace: face,
sessionKey,
fallbackAgentId: agentId,
basePath,
displayName: details.displayName ?? undefined,
exactKey: details.exactKey,
mainKey: details.mainKey ?? undefined,
shortIdLength: details.shortIdLength,
}) ?? null
);
}