From 9c3f0db5fce09de86489f37e9ca7b77305217796 Mon Sep 17 00:00:00 2001 From: Yaroslav Lapin Date: Fri, 31 Jul 2026 12:38:10 -0600 Subject: [PATCH 1/2] Show session ID on parked pages --- apps/server/src/http.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/server/src/http.ts b/apps/server/src/http.ts index 660d80aeda64..e8878a9fba3a 100644 --- a/apps/server/src/http.ts +++ b/apps/server/src/http.ts @@ -62,8 +62,10 @@ function parkedPageHtml(url: URL): string { const project = url.searchParams.get("project"); const cwd = url.searchParams.get("cwd"); const branch = url.searchParams.get("branch"); + const sessionId = threadId ? `say-to-me(t3_${threadId})` : null; const fields = [ parkedPageField("Title", title), + parkedPageField("Session ID", sessionId), parkedPageField("Project", project), parkedPageField("Directory", cwd), parkedPageField("Branch", branch), From 9d38377926fd7abdc35a429516cac8ca06beedc4 Mon Sep 17 00:00:00 2001 From: Yaroslav Lapin Date: Fri, 31 Jul 2026 12:43:12 -0600 Subject: [PATCH 2/2] Move parked page into Say To Me module --- apps/server/src/http.ts | 63 +---------------------------- apps/server/src/say-to-me/parked.ts | 61 ++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 62 deletions(-) create mode 100644 apps/server/src/say-to-me/parked.ts diff --git a/apps/server/src/http.ts b/apps/server/src/http.ts index e8878a9fba3a..6bdd2ae31351 100644 --- a/apps/server/src/http.ts +++ b/apps/server/src/http.ts @@ -37,73 +37,12 @@ import { } from "./auth/http.ts"; import * as ServerEnvironment from "./environment/ServerEnvironment.ts"; import { browserApiCorsAllowedHeaders, browserApiCorsAllowedMethods } from "./httpCors.ts"; +import { parkedPageHtml } from "./say-to-me/parked.ts"; const OTLP_TRACES_PROXY_PATH = "/api/observability/v1/traces"; const LOOPBACK_HOSTNAMES = new Set(["127.0.0.1", "::1", "localhost"]); const DESKTOP_RENDERER_ORIGINS = ["t3code://app", "t3code-dev://app"]; -function escapeHtml(value: string): string { - return value.replace( - /[&<>\"']/g, - (character) => - ({ "&": "&", "<": "<", ">": ">", '\"': """, "'": "'" })[character] ?? - character, - ); -} - -function parkedPageField(label: string, value: string | null): string { - return value ? `
${label}
${escapeHtml(value)}
` : ""; -} - -function parkedPageHtml(url: URL): string { - const environmentId = url.searchParams.get("environmentId"); - const threadId = url.searchParams.get("threadId"); - const title = url.searchParams.get("title"); - const project = url.searchParams.get("project"); - const cwd = url.searchParams.get("cwd"); - const branch = url.searchParams.get("branch"); - const sessionId = threadId ? `say-to-me(t3_${threadId})` : null; - const fields = [ - parkedPageField("Title", title), - parkedPageField("Session ID", sessionId), - parkedPageField("Project", project), - parkedPageField("Directory", cwd), - parkedPageField("Branch", branch), - ].join(""); - const returnHref = - environmentId && threadId - ? `/${encodeURIComponent(environmentId)}/${encodeURIComponent(threadId)}` - : null; - - return ` - - - - - Session parked - - - -
- T3 Code -

session parked

- ${fields ? `
${fields}
` : ""} - ${returnHref ? `Return to session` : ""} -
- -`; -} - export const browserApiCorsLayer = Layer.unwrap( Effect.gen(function* () { const config = yield* ServerConfig.ServerConfig; diff --git a/apps/server/src/say-to-me/parked.ts b/apps/server/src/say-to-me/parked.ts new file mode 100644 index 000000000000..94a7b3f631ff --- /dev/null +++ b/apps/server/src/say-to-me/parked.ts @@ -0,0 +1,61 @@ +function escapeHtml(value: string): string { + return value.replace( + /[&<>\"']/g, + (character) => + ({ "&": "&", "<": "<", ">": ">", '\"': """, "'": "'" })[character] ?? + character, + ); +} + +function parkedPageField(label: string, value: string | null): string { + return value ? `
${label}
${escapeHtml(value)}
` : ""; +} + +export function parkedPageHtml(url: URL): string { + const environmentId = url.searchParams.get("environmentId"); + const threadId = url.searchParams.get("threadId"); + const title = url.searchParams.get("title"); + const project = url.searchParams.get("project"); + const cwd = url.searchParams.get("cwd"); + const branch = url.searchParams.get("branch"); + const sessionId = threadId ? `say-to-me(t3_${threadId})` : null; + const fields = [ + parkedPageField("Title", title), + parkedPageField("Session ID", sessionId), + parkedPageField("Project", project), + parkedPageField("Directory", cwd), + parkedPageField("Branch", branch), + ].join(""); + const returnHref = + environmentId && threadId + ? `/${encodeURIComponent(environmentId)}/${encodeURIComponent(threadId)}` + : null; + + return ` + + + + + Session parked + + + +
+ T3 Code +

session parked

+ ${fields ? `
${fields}
` : ""} + ${returnHref ? `Return to session` : ""} +
+ +`; +}