import type { ChatSystemMessage } from "../../chat/types.js"; import { type HostToolSet, type HostToolTraceAttributes, type ProjectScopedRemoteToolOptions, type RemoteMCPToolSourceConfig, type RemoteToolSource, type ToolSet, type TraceHostToolsOptions } from "../../tool/index.js"; import { type DefaultResearchArtifactContext } from "../artifacts/default-research-artifact-support.js"; import { type AgentServiceMcpServerConfig } from "../service/mcp-server-config.js"; import { type HostedProjectRemoteToolSourceMutationHandler, type HostedProjectRemoteToolSourcePrepareToolInput, type HostedProjectRemoteToolSourceProjectSwitchHandler, type HostedProjectRemoteToolSourceRetryPolicy } from "./project-remote-tool-source.js"; import { type RuntimeClientProfile } from "../runtime/client-profile.js"; import { type HostedRuntimeAllowedToolNames } from "./runtime-essential-tools.js"; import type { HostedSubmittedFormInputResult } from "./chat-runtime-contract.js"; import { type SourceIntegrationPolicyManifest } from "../../integrations/source-policy.js"; import type { RuntimeToolDiscoveryContext } from "../runtime/tool-discovery-context.js"; import type { RuntimeToolLoadingMode } from "../runtime/runtime-tool-config.js"; /** Context for hosted chat runtime tool assembly. */ export type HostedChatRuntimeToolAssemblyContext = DefaultResearchArtifactContext & { authToken: string; agentId?: string; projectId?: string | null; branchId?: string | null; model?: string; clientProfile?: RuntimeClientProfile | null; availableToolNames?: string[]; availableSkillIds?: readonly string[]; userId?: string | null; submittedFormInputResult?: HostedSubmittedFormInputResult; }; /** Public API contract for hosted chat runtime allowed tool names. */ export type HostedChatRuntimeAllowedToolNames = HostedRuntimeAllowedToolNames; /** Service-operator authorization ceiling for Framework-owned host tools. */ export type HostedHostToolPolicy = { readonly allow: readonly string[]; }; /** Result returned from hosted chat runtime tool assembly. */ export type HostedChatRuntimeToolAssemblyResult = { /** Exact project-source restriction captured for this runtime assembly. */ readonly sourceIntegrationPolicy: SourceIntegrationPolicyManifest; runtimeTools: ToolSet; remoteToolSources: RemoteToolSource[]; localToolNames: string[]; remoteToolNames: string[]; providerToolNames: string[]; availableToolNames: string[]; modelVisibleToolNames?: string[]; toolLoadingMode: RuntimeToolLoadingMode; compatibleRemoteToolNames: string[]; systemInstructions: string; /** Structured system messages preserved for provider dispatch. */ systemMessages?: ChatSystemMessage[]; }; /** Input payload for prepare hosted chat runtime tool assembly. */ export type PrepareHostedChatRuntimeToolAssemblyInput = { taskContext: HostedChatRuntimeToolAssemblyContext; instructions: string | readonly ChatSystemMessage[]; /** Re-render instructions after final source/provider tool visibility is known. */ renderInstructions?: (modelVisibleToolNames: readonly string[]) => string | readonly ChatSystemMessage[]; localTools: HostToolSet; hostToolPolicy?: HostedHostToolPolicy; apiUrl: string; apiMcpUrl: string; studioMcpUrl?: string | null; mcpServers?: readonly AgentServiceMcpServerConfig[]; /** * Integration tools the control plane resolved for this run, already verified * upstream. They widen the Veryfront API MCP allowlist for this run only. */ serverResolvedIntegrationToolNames?: readonly string[]; conversationId?: string; allowedToolNames?: HostedChatRuntimeAllowedToolNames; /** * Tool names the agent configuration denied explicitly (`false` entries). * Removed from the host tool set before runtime-essential preservation, so * a denied skill loader cannot be re-added on the hosted path. */ deniedToolNames?: readonly string[]; allowedProviderToolNames?: HostedChatRuntimeAllowedToolNames; /** * Include runtime-essential tools when `allowedToolNames` is an empty set. * Non-empty selectors remain restrictive. */ includeRuntimeEssentialToolsWhenEmpty?: boolean; sourceProviderToolNames?: readonly string[]; projectScopedRemoteToolOptions?: ProjectScopedRemoteToolOptions; createRemoteToolSource?: (config: RemoteMCPToolSourceConfig) => RemoteToolSource; traceLocalTools?: TraceHostToolsOptions; getProjectId?: () => string | null | undefined; getActiveBranchId?: () => string | null | undefined; prepareRemoteToolInput?: HostedProjectRemoteToolSourcePrepareToolInput; shouldRetryWithRemoteTool?: HostedProjectRemoteToolSourceRetryPolicy; onSteeringMutation?: HostedProjectRemoteToolSourceMutationHandler; onStudioProjectSwitch?: HostedProjectRemoteToolSourceProjectSwitchHandler; preloadLatestConversationUserText?: boolean; /** * Per-run tool activation context. When its `activatedRemoteToolNames` Set is * present, it is passed by reference to every remote tool source as the live * execution gate, so growing the Set exposes tools without re-creating the * sources. Deprecated: no framework path populates this. It is retained * because `PrepareHostedChatRuntimeToolAssemblyInput` is public API. * * @deprecated Use `tool_search` deferred loading. See * `docs/architecture/28-model-driven-tool-discovery.md`. */ toolDiscoveryContext?: RuntimeToolDiscoveryContext; /** Exact project-source restriction applied before tool inventory is exposed. */ sourceIntegrationPolicy: SourceIntegrationPolicyManifest; }; /** * Widen the Veryfront API MCP server's allowlist with a run's server-resolved * integration tools. * * The product policy that hosts ship is a static allowlist, so a project's * connected integration tools are absent from it by construction. This adds * exactly the names the control plane resolved for this run, and only to the * `veryfront-api` server. A server that denies a name keeps denying it, and an * unrestricted server (no `allow`) is left alone because it already permits * everything. */ export declare function augmentVeryfrontApiMcpServerPolicy(mcpServers: readonly AgentServiceMcpServerConfig[] | undefined, integrationToolNames: readonly string[] | undefined): readonly AgentServiceMcpServerConfig[] | undefined; /** Filter hosted chat runtime local tools. */ export declare function filterHostedChatRuntimeLocalTools(input: { tools: HostToolSet; allowedToolNames?: HostedChatRuntimeAllowedToolNames; sourceProviderToolNames?: readonly string[]; }): HostToolSet; /** Prepare hosted chat runtime tool assembly. */ export declare function prepareHostedChatRuntimeToolAssembly(input: PrepareHostedChatRuntimeToolAssemblyInput): Promise; /** @internal Prepare an assembly whose selector provenance was verified by the hosted runtime. */ export declare function prepareConfigDerivedHostedChatRuntimeToolAssembly(input: PrepareHostedChatRuntimeToolAssemblyInput): Promise; //# sourceMappingURL=chat-runtime-tool-assembly.d.ts.map