Download src/agents/embedded-agent-runner/context-engine-capabilities.ts from SaylorTwift/openclaw: direct link, hf CLI and curl.
- Browser
- Download file 1.95 kB
-
https://huggingface.co/SaylorTwift/openclaw/resolve/main/src/agents/embedded-agent-runner/context-engine-capabilities.ts
- Command line
-
hf download hf://SaylorTwift/openclaw/src/agents/embedded-agent-runner/context-engine-capabilities.ts
-
curl -L -o context-engine-capabilities.ts https://huggingface.co/SaylorTwift/openclaw/resolve/main/src/agents/embedded-agent-runner/context-engine-capabilities.ts
1.95 kB
| /** | |
| * Builds host capabilities passed into context-engine runtime calls. | |
| */ | |
| import { normalizeOptionalString } from "@openclaw/normalization-core/string-coerce"; | |
| import type { OpenClawConfig } from "../../config/types.openclaw.js"; | |
| import type { ContextEngineRuntimeContext } from "../../context-engine/types.js"; | |
| import { resolveBoundAgentIdForSession } from "../session-agent-binding.js"; | |
| type ResolveContextEngineCapabilitiesParams = { | |
| config?: OpenClawConfig; | |
| sessionKey?: string; | |
| explicitAgentId?: string; | |
| authProfileId?: string; | |
| contextEnginePluginId?: string; | |
| purpose: string; | |
| }; | |
| /** | |
| * Build host-owned capabilities that are bound to one context-engine runtime call. | |
| */ | |
| export function resolveContextEngineCapabilities( | |
| params: ResolveContextEngineCapabilitiesParams, | |
| ): Pick<ContextEngineRuntimeContext, "llm"> { | |
| const sessionKey = normalizeOptionalString(params.sessionKey); | |
| const agentId = resolveBoundAgentIdForSession({ | |
| config: params.config, | |
| sessionKey, | |
| agentId: params.explicitAgentId, | |
| }); | |
| const contextEnginePluginId = normalizeOptionalString(params.contextEnginePluginId); | |
| return { | |
| llm: { | |
| complete: async (request) => { | |
| const { createRuntimeLlm } = await import("../../plugins/runtime/runtime-llm.runtime.js"); | |
| return await createRuntimeLlm({ | |
| getConfig: () => params.config, | |
| authority: { | |
| caller: { kind: "context-engine", id: params.purpose }, | |
| requiresBoundAgent: true, | |
| ...(sessionKey ? { sessionKey } : {}), | |
| ...(agentId ? { agentId } : {}), | |
| ...(params.authProfileId ? { preferredProfile: params.authProfileId } : {}), | |
| ...(contextEnginePluginId ? { pluginIdForPolicy: contextEnginePluginId } : {}), | |
| allowAgentIdOverride: false, | |
| allowModelOverride: false, | |
| allowComplete: true, | |
| }, | |
| }).complete(request); | |
| }, | |
| }, | |
| }; | |
| } | |