refactor(agents): hide settings helper types · openclaw/openclaw@e2fa4f3
vincentkoc
·
2026-06-17
·
via Recent Commits to openclaw:main
File tree
agent-hooks/context-pruning
| Original file line number | Diff line number | Diff line change |
|---|
@@ -3,7 +3,7 @@ import { createSessionManagerRuntimeRegistry } from "../session-manager-runtime-
|
3 | 3 | import type { EffectiveContextPruningSettings } from "./settings.js"; |
4 | 4 | |
5 | 5 | /** Runtime inputs consumed by the context-pruning extension. */ |
6 | | -export type ContextPruningRuntimeValue = { |
| 6 | +type ContextPruningRuntimeValue = { |
7 | 7 | settings: EffectiveContextPruningSettings; |
8 | 8 | contextWindowTokens?: number | null; |
9 | 9 | isToolPrunable: (toolName: string) => boolean; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -6,10 +6,10 @@ export type ContextPruningToolMatch = {
|
6 | 6 | allow?: string[]; |
7 | 7 | deny?: string[]; |
8 | 8 | }; |
9 | | -export type ContextPruningMode = "off" | "cache-ttl"; |
| 9 | +type ContextPruningMode = "off" | "cache-ttl"; |
10 | 10 | |
11 | 11 | /** Raw context-pruning config as read from agent settings. */ |
12 | | -export type ContextPruningConfig = { |
| 12 | +type ContextPruningConfig = { |
13 | 13 | mode?: ContextPruningMode; |
14 | 14 | /** TTL to consider cache expired (duration string, default unit: minutes). */ |
15 | 15 | ttl?: string; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -27,10 +27,10 @@ export const DEFAULT_EMBEDDED_AGENT_PROJECT_SETTINGS_POLICY = "sanitize";
|
27 | 27 | const SANITIZED_PROJECT_AGENT_KEYS = ["shellPath", "shellCommandPrefix"] as const; |
28 | 28 | |
29 | 29 | /** Policy for whether workspace project settings can influence embedded-agent behavior. */ |
30 | | -export type EmbeddedAgentProjectSettingsPolicy = "trusted" | "sanitize" | "ignore"; |
| 30 | +type EmbeddedAgentProjectSettingsPolicy = "trusted" | "sanitize" | "ignore"; |
31 | 31 | |
32 | 32 | /** Merged settings snapshot consumed by embedded agent settings managers. */ |
33 | | -export type AgentSettingsSnapshot = ReturnType<SettingsManager["getGlobalSettings"]> & { |
| 33 | +type AgentSettingsSnapshot = ReturnType<SettingsManager["getGlobalSettings"]> & { |
34 | 34 | mcpServers?: Record<string, BundleMcpServerConfig>; |
35 | 35 | }; |
36 | 36 | |
@@ -188,7 +188,6 @@ export function loadEnabledBundleAgentSettingsSnapshot(params: {
|
188 | 188 | return snapshot; |
189 | 189 | } |
190 | 190 | |
191 | | -/** Resolve how project-local embedded-agent settings should be applied. */ |
192 | 191 | /** Resolves the configured project-settings trust policy for embedded agents. */ |
193 | 192 | export function resolveEmbeddedAgentProjectSettingsPolicy( |
194 | 193 | cfg?: OpenClawConfig, |
@@ -200,7 +199,6 @@ export function resolveEmbeddedAgentProjectSettingsPolicy(
|
200 | 199 | return DEFAULT_EMBEDDED_AGENT_PROJECT_SETTINGS_POLICY; |
201 | 200 | } |
202 | 201 | |
203 | | -/** Build the final embedded-agent settings snapshot in merge-precedence order. */ |
204 | 202 | /** Merges global, plugin, and project settings according to the selected trust policy. */ |
205 | 203 | export function buildEmbeddedAgentSettingsSnapshot(params: { |
206 | 204 | globalSettings: AgentSettingsSnapshot; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -15,7 +15,7 @@ import { resolveEffectiveToolFsWorkspaceOnly } from "./tool-fs-policy.js";
|
15 | 15 | type AgentSystemPromptRenderParams = Parameters<typeof buildAgentSystemPrompt>[0]; |
16 | 16 | |
17 | 17 | /** Config-derived system prompt fields passed into the prompt renderer. */ |
18 | | -export type ResolvedAgentSystemPromptConfig = Pick< |
| 18 | +type ResolvedAgentSystemPromptConfig = Pick< |
19 | 19 | AgentSystemPromptRenderParams, |
20 | 20 | | "ownerDisplay" |
21 | 21 | | "ownerDisplaySecret" |
@@ -26,7 +26,7 @@ export type ResolvedAgentSystemPromptConfig = Pick<
|
26 | 26 | | "fsWorkspaceOnly" |
27 | 27 | >; |
28 | 28 | |
29 | | -export type ConfiguredAgentSystemPromptParams = AgentSystemPromptRenderParams & { |
| 29 | +type ConfiguredAgentSystemPromptParams = AgentSystemPromptRenderParams & { |
30 | 30 | config?: OpenClawConfig; |
31 | 31 | agentId?: string; |
32 | 32 | }; |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。