AgentConfigService
katanakit-js / AgentConfigService
Class: AgentConfigService
Section titled “Class: AgentConfigService”Defined in: core/services/agentconfig.service.ts:77
AgentConfigService — Singleton facade for per-agent configuration emission.
Applies the Singleton pattern (one shared instance via
AgentConfigService.getInstance) and the Facade pattern: unknown
agents and invalid input resolve to { data, error, ok }, nothing throws.
The emitters mirror the two boxes every agent-setup UI shows: auto
configuration (AgentConfigFile — the file the tool reads) and
manual connection (AgentConfigManualEntry — the env names and
endpoint to paste by hand). Secret masking is policy, not presentation:
emitted values are masked unless the caller passes reveal: true, so a
preview can be logged or pasted into a chat without leaking anything.
Example
Section titled “Example”import { useEmitAgentConfig } from "katanakit-js";
const result = useEmitAgentConfig("opencode", { provider: "openai", secret: "sk-…", mcpServers: [],});if (result.ok) console.log(result.data.files[0].content);Methods
Section titled “Methods”useAgentDefinitions()
Section titled “useAgentDefinitions()”useAgentDefinitions(): AgentDefinition[];Defined in: core/services/agentconfig.service.ts:96
Lists the supported agents.
Returns
Section titled “Returns”The agent registry.
useEmitAgentConfig()
Section titled “useEmitAgentConfig()”useEmitAgentConfig(agentId, input): SafeResult<AgentConfigOutput>;Defined in: core/services/agentconfig.service.ts:118
Emits the auto-configuration file and the manual connection entries for one agent.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
agentId |
string |
The agent to configure. |
input |
AgentConfigInput |
Provider, secret, optional env var name, base URL and MCP servers. |
Returns
Section titled “Returns”{ data, error, ok } — error.status = 404 for unknown agents.
useFindAgent()
Section titled “useFindAgent()”useFindAgent(agentId): AgentDefinition | undefined;Defined in: core/services/agentconfig.service.ts:106
Finds an agent definition by id.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
agentId |
string |
The agent id, e.g. opencode. |
Returns
Section titled “Returns”AgentDefinition | undefined
The definition, or undefined.
getInstance()
Section titled “getInstance()”static getInstance(): AgentConfigService;Defined in: core/services/agentconfig.service.ts:84
Returns the shared instance (Singleton).
Returns
Section titled “Returns”AgentConfigService