From bfd11ee29f23f33cc95c4eafcf325ab0bafa4c84 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Wed, 17 Jun 2026 15:06:19 +0800 Subject: [PATCH] refactor(agents): trim session helper facades --- src/agents/tools/sessions-access.ts | 2 -- src/agents/tools/sessions-helpers.ts | 4 ++-- src/agents/tools/sessions-resolution.ts | 8 ++------ 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/agents/tools/sessions-access.ts b/src/agents/tools/sessions-access.ts index 02bf2c239ac0..892965b03cd2 100644 --- a/src/agents/tools/sessions-access.ts +++ b/src/agents/tools/sessions-access.ts @@ -11,10 +11,8 @@ import { resolveInternalSessionKey, resolveMainSessionAlias } from "./sessions-r export { createAgentToAgentPolicy, - createSessionVisibilityChecker, createSessionVisibilityGuard, createSessionVisibilityRowChecker, - listSpawnedSessionKeys, resolveEffectiveSessionToolsVisibility, } from "../../plugin-sdk/session-visibility.js"; diff --git a/src/agents/tools/sessions-helpers.ts b/src/agents/tools/sessions-helpers.ts index 9cbfe12a3913..94ef8d7f8788 100644 --- a/src/agents/tools/sessions-helpers.ts +++ b/src/agents/tools/sessions-helpers.ts @@ -30,10 +30,10 @@ import { getRuntimeConfig } from "../../config/config.js"; import type { OpenClawConfig } from "../../config/types.openclaw.js"; /** Coarse session category used by session list/status tools. */ -export type SessionKind = "main" | "group" | "cron" | "hook" | "node" | "other"; +type SessionKind = "main" | "group" | "cron" | "hook" | "node" | "other"; /** Delivery target metadata attached to session rows. */ -export type SessionListDeliveryContext = { +type SessionListDeliveryContext = { channel?: string; to?: string; accountId?: string; diff --git a/src/agents/tools/sessions-resolution.ts b/src/agents/tools/sessions-resolution.ts index 1e4ca7df1cde..e49ba5c15835 100644 --- a/src/agents/tools/sessions-resolution.ts +++ b/src/agents/tools/sessions-resolution.ts @@ -88,8 +88,6 @@ export function resolveCurrentSessionClientAlias(params: { return requesterKey; } -export { listSpawnedSessionKeys }; - export async function isRequesterSpawnedSessionVisible(params: { requesterSessionKey: string; targetSessionKey: string; @@ -190,7 +188,7 @@ export function shouldResolveSessionIdInput(value: string): boolean { return looksLikeSessionId(value) || !looksLikeSessionKey(value); } -export type SessionReferenceResolution = +type SessionReferenceResolution = | { ok: true; key: string; @@ -199,7 +197,7 @@ export type SessionReferenceResolution = } | { ok: false; status: "error" | "forbidden"; error: string }; -export type VisibleSessionReferenceResolution = +type VisibleSessionReferenceResolution = | { ok: true; key: string; @@ -508,8 +506,6 @@ export async function resolveVisibleSessionReference(params: { return { ok: true, key: resolvedKey, displayKey }; } -export const normalizeOptionalKey: (value?: string) => string | undefined = normalizeOptionalString; - export const testing = { setDepsForTest(overrides?: Partial<{ callGateway: GatewayCaller }>) { sessionsResolutionDeps = overrides