typeclaw 0.42.0 → 0.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/auth.schema.json +16 -0
- package/package.json +3 -3
- package/secrets.schema.json +16 -0
- package/src/agent/adaptive-thinking-compat.ts +79 -0
- package/src/agent/index.ts +79 -101
- package/src/agent/live-subagents.ts +4 -4
- package/src/agent/plugin-tools.ts +85 -132
- package/src/agent/provider-error.ts +37 -0
- package/src/agent/reload-tool.ts +1 -1
- package/src/agent/session-origin.ts +6 -3
- package/src/agent/subagents.ts +2 -2
- package/src/agent/system-prompt.ts +24 -8
- package/src/agent/tool-result-budget.ts +1 -1
- package/src/agent/tools/channel-react.ts +5 -4
- package/src/agent/tools/spawn-subagent.ts +80 -24
- package/src/agent/tools/stream-snapshot.ts +8 -3
- package/src/bundled-plugins/agent-browser/index.ts +18 -8
- package/src/bundled-plugins/memory/README.md +4 -1
- package/src/bundled-plugins/memory/belief-sentence.ts +50 -0
- package/src/bundled-plugins/memory/dreaming.ts +13 -6
- package/src/bundled-plugins/memory/load-memory.ts +22 -2
- package/src/bundled-plugins/memory/memory-logger.ts +1 -1
- package/src/bundled-plugins/planner/planner.ts +1 -1
- package/src/bundled-plugins/researcher/researcher.ts +2 -2
- package/src/bundled-plugins/reviewer/reviewer.ts +1 -1
- package/src/capabilities/control-plane.ts +24 -0
- package/src/capabilities/index.ts +2 -0
- package/src/capabilities/runtime.ts +30 -0
- package/src/channels/adapters/discord-bot-thread-room.ts +73 -0
- package/src/channels/adapters/discord-bot.ts +9 -1
- package/src/channels/adapters/slack-bot-classify.ts +1 -0
- package/src/channels/adapters/slack-classify.ts +1 -0
- package/src/channels/engagement.ts +33 -0
- package/src/channels/manager.ts +41 -47
- package/src/channels/router.ts +150 -21
- package/src/channels/types.ts +10 -0
- package/src/cli/channel.ts +49 -12
- package/src/cli/command-meta.ts +2 -0
- package/src/cli/hostd.ts +4 -3
- package/src/cli/index.ts +1 -0
- package/src/cli/logs.ts +2 -2
- package/src/cli/mcp.ts +233 -0
- package/src/cli/restart.ts +5 -3
- package/src/cli/shell.ts +2 -2
- package/src/cli/start.ts +2 -2
- package/src/cli/status.ts +2 -2
- package/src/cli/stop.ts +2 -2
- package/src/compose/restart.ts +4 -3
- package/src/compose/start.ts +2 -2
- package/src/compose/stop.ts +2 -2
- package/src/config/config.ts +10 -1
- package/src/config/providers.ts +61 -9
- package/src/container/controller.ts +104 -0
- package/src/container/index.ts +9 -0
- package/src/hostd/daemon.ts +28 -9
- package/src/hostd/protocol.ts +12 -9
- package/src/init/index.ts +1 -1
- package/src/init/instagram-auth.ts +189 -34
- package/src/inspect/logs-item.ts +2 -2
- package/src/mcp/client.ts +16 -6
- package/src/mcp/index.ts +12 -0
- package/src/mcp/manager.ts +9 -4
- package/src/mcp/oauth.ts +212 -0
- package/src/run/index.ts +36 -11
- package/src/run/{codex-fetch-observer.ts → llm-fetch-observer.ts} +182 -82
- package/src/sandbox/availability.ts +2 -2
- package/src/sandbox/build.ts +1 -1
- package/src/sandbox/hidden-paths.ts +59 -0
- package/src/sandbox/index.ts +1 -1
- package/src/sandbox/policy.ts +2 -2
- package/src/secrets/discord-store.ts +4 -13
- package/src/secrets/index.ts +1 -1
- package/src/secrets/instagram-store.ts +4 -13
- package/src/secrets/kakao-store.ts +4 -13
- package/src/secrets/line-store.ts +4 -13
- package/src/secrets/schema.ts +13 -0
- package/src/secrets/secrets-provider.ts +86 -0
- package/src/secrets/slack-store.ts +4 -13
- package/src/secrets/storage.ts +108 -1
- package/src/secrets/webex-store.ts +4 -13
- package/src/server/index.ts +2 -2
- package/src/skills/typeclaw-channel-github/SKILL.md +2 -2
- package/src/skills/typeclaw-channel-instagram/SKILL.md +1 -1
- package/src/skills/typeclaw-config/SKILL.md +5 -3
- package/src/skills/typeclaw-plugins/SKILL.md +1 -1
- package/src/skills/typeclaw-troubleshooting/SKILL.md +1 -1
- package/src/stream/broker.ts +4 -3
- package/src/stream/types.ts +1 -0
- package/typeclaw.schema.json +14 -0
package/src/mcp/oauth.ts
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto'
|
|
2
|
+
|
|
3
|
+
import type { OAuthClientProvider, OAuthDiscoveryState } from '@modelcontextprotocol/sdk/client/auth.js'
|
|
4
|
+
import type {
|
|
5
|
+
OAuthClientInformationMixed,
|
|
6
|
+
OAuthClientMetadata,
|
|
7
|
+
OAuthTokens,
|
|
8
|
+
} from '@modelcontextprotocol/sdk/shared/auth.js'
|
|
9
|
+
|
|
10
|
+
import { sendHttp } from '@/hostd/client'
|
|
11
|
+
import type { Request } from '@/hostd/protocol'
|
|
12
|
+
import type { McpCredential, McpSlice } from '@/secrets/schema'
|
|
13
|
+
import { SecretsBackend } from '@/secrets/storage'
|
|
14
|
+
|
|
15
|
+
export type McpOAuthInvalidateScope = Parameters<NonNullable<OAuthClientProvider['invalidateCredentials']>>[0]
|
|
16
|
+
|
|
17
|
+
export interface McpOAuthStore {
|
|
18
|
+
get(server: string): McpCredential | undefined | Promise<McpCredential | undefined>
|
|
19
|
+
saveClient(server: string, client: OAuthClientInformationMixed): Promise<void>
|
|
20
|
+
saveTokens(server: string, tokens: OAuthTokens): Promise<void>
|
|
21
|
+
saveDiscovery(server: string, state: OAuthDiscoveryState): Promise<void>
|
|
22
|
+
invalidate(server: string, scope: McpOAuthInvalidateScope): Promise<void>
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export type TypeClawMcpOAuthProviderOptions = {
|
|
26
|
+
mode: 'host' | 'container'
|
|
27
|
+
redirectUrl: string
|
|
28
|
+
clientName: string
|
|
29
|
+
scope?: string
|
|
30
|
+
onRedirect?: (url: URL) => void
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export class TypeClawMcpOAuthProvider implements OAuthClientProvider {
|
|
34
|
+
private verifier: string | undefined
|
|
35
|
+
private oauthState: string | undefined
|
|
36
|
+
|
|
37
|
+
constructor(
|
|
38
|
+
private readonly serverName: string,
|
|
39
|
+
private readonly store: McpOAuthStore,
|
|
40
|
+
private readonly opts: TypeClawMcpOAuthProviderOptions,
|
|
41
|
+
) {}
|
|
42
|
+
|
|
43
|
+
get redirectUrl(): string {
|
|
44
|
+
return this.opts.redirectUrl
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
get clientMetadata(): OAuthClientMetadata {
|
|
48
|
+
return {
|
|
49
|
+
client_name: this.opts.clientName,
|
|
50
|
+
redirect_uris: [this.opts.redirectUrl],
|
|
51
|
+
grant_types: ['authorization_code', 'refresh_token'],
|
|
52
|
+
response_types: ['code'],
|
|
53
|
+
token_endpoint_auth_method: 'none',
|
|
54
|
+
...(this.opts.scope === undefined ? {} : { scope: this.opts.scope }),
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async clientInformation(): Promise<OAuthClientInformationMixed | undefined> {
|
|
59
|
+
return (await this.store.get(this.serverName))?.client as OAuthClientInformationMixed | undefined
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
async saveClientInformation(info: OAuthClientInformationMixed): Promise<void> {
|
|
63
|
+
await this.store.saveClient(this.serverName, info)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async tokens(): Promise<OAuthTokens | undefined> {
|
|
67
|
+
return (await this.store.get(this.serverName))?.tokens as OAuthTokens | undefined
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
async saveTokens(tokens: OAuthTokens): Promise<void> {
|
|
71
|
+
await this.store.saveTokens(this.serverName, tokens)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
async discoveryState(): Promise<OAuthDiscoveryState | undefined> {
|
|
75
|
+
return (await this.store.get(this.serverName))?.discovery as OAuthDiscoveryState | undefined
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
async saveDiscoveryState(state: OAuthDiscoveryState): Promise<void> {
|
|
79
|
+
await this.store.saveDiscovery(this.serverName, state)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
async saveCodeVerifier(verifier: string): Promise<void> {
|
|
83
|
+
this.verifier = verifier
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
async codeVerifier(): Promise<string> {
|
|
87
|
+
if (this.verifier === undefined) throw new Error(`MCP server "${this.serverName}" OAuth verifier is missing`)
|
|
88
|
+
return this.verifier
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
async state(): Promise<string> {
|
|
92
|
+
this.oauthState ??= randomUUID()
|
|
93
|
+
return this.oauthState
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
async redirectToAuthorization(url: URL): Promise<void> {
|
|
97
|
+
if (this.opts.mode === 'container') {
|
|
98
|
+
throw new Error(
|
|
99
|
+
`MCP server "${this.serverName}" needs OAuth. Run on the host: typeclaw mcp auth ${this.serverName}`,
|
|
100
|
+
)
|
|
101
|
+
}
|
|
102
|
+
this.opts.onRedirect?.(url)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
async invalidateCredentials(scope: McpOAuthInvalidateScope): Promise<void> {
|
|
106
|
+
await this.store.invalidate(this.serverName, scope)
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export function createFileMcpOAuthStore(secretsPath: string): McpOAuthStore {
|
|
111
|
+
const backend = new SecretsBackend(secretsPath)
|
|
112
|
+
return {
|
|
113
|
+
get(server) {
|
|
114
|
+
return backend.readMcpCredentialSync(server)
|
|
115
|
+
},
|
|
116
|
+
async saveClient(server, client) {
|
|
117
|
+
await patchMcp(backend, server, { client })
|
|
118
|
+
},
|
|
119
|
+
async saveTokens(server, tokens) {
|
|
120
|
+
await patchMcp(backend, server, { tokens })
|
|
121
|
+
},
|
|
122
|
+
async saveDiscovery(server, discovery) {
|
|
123
|
+
await patchMcp(backend, server, { discovery })
|
|
124
|
+
},
|
|
125
|
+
async invalidate(server, scope) {
|
|
126
|
+
await invalidateMcp(backend, server, scope)
|
|
127
|
+
},
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export type HostdMcpOAuthStoreOptions = {
|
|
132
|
+
hostdUrl: string
|
|
133
|
+
restartToken: string
|
|
134
|
+
containerName: string
|
|
135
|
+
secretsPath: string
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export function createHostdMcpOAuthStore(options: HostdMcpOAuthStoreOptions): McpOAuthStore {
|
|
139
|
+
const backend = new SecretsBackend(options.secretsPath)
|
|
140
|
+
const write = async (server: string, credential: McpCredential): Promise<void> => {
|
|
141
|
+
const request: Extract<Request, { kind: 'secrets-patch' }> = {
|
|
142
|
+
kind: 'secrets-patch',
|
|
143
|
+
containerName: options.containerName,
|
|
144
|
+
patch: { mcp: { server, credential } },
|
|
145
|
+
}
|
|
146
|
+
const response = await sendHttp(request, { url: options.hostdUrl, token: options.restartToken })
|
|
147
|
+
if (!response.ok) throw new Error(`secrets-patch failed: ${response.reason}`)
|
|
148
|
+
}
|
|
149
|
+
const patch = async (server: string, fieldPatch: McpCredential): Promise<void> => {
|
|
150
|
+
await write(server, { ...backend.readMcpCredentialSync(server), ...fieldPatch })
|
|
151
|
+
}
|
|
152
|
+
return {
|
|
153
|
+
get(server) {
|
|
154
|
+
return backend.readMcpCredentialSync(server)
|
|
155
|
+
},
|
|
156
|
+
async saveClient(server, client) {
|
|
157
|
+
await patch(server, { client })
|
|
158
|
+
},
|
|
159
|
+
async saveTokens(server, tokens) {
|
|
160
|
+
await patch(server, { tokens })
|
|
161
|
+
},
|
|
162
|
+
async saveDiscovery(server, discovery) {
|
|
163
|
+
await patch(server, { discovery })
|
|
164
|
+
},
|
|
165
|
+
async invalidate(server, scope) {
|
|
166
|
+
const credential = invalidateCredential(backend.readMcpCredentialSync(server), scope)
|
|
167
|
+
if (credential === undefined) return
|
|
168
|
+
await write(server, credential)
|
|
169
|
+
},
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
async function patchMcp(backend: SecretsBackend, server: string, fieldPatch: McpCredential): Promise<void> {
|
|
174
|
+
await backend.updateMcpAsync(async (mcp) => ({
|
|
175
|
+
result: undefined,
|
|
176
|
+
next: { ...mcp, [server]: { ...mcp[server], ...fieldPatch } },
|
|
177
|
+
}))
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
async function invalidateMcp(backend: SecretsBackend, server: string, scope: McpOAuthInvalidateScope): Promise<void> {
|
|
181
|
+
await backend.updateMcpAsync(async (mcp) => {
|
|
182
|
+
const credential = invalidateCredential(mcp[server], scope)
|
|
183
|
+
if (credential === undefined) return { result: undefined }
|
|
184
|
+
return { result: undefined, next: { ...mcp, [server]: credential } }
|
|
185
|
+
})
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function invalidateCredential(
|
|
189
|
+
credential: McpCredential | undefined,
|
|
190
|
+
scope: McpOAuthInvalidateScope,
|
|
191
|
+
): McpCredential | undefined {
|
|
192
|
+
if (credential === undefined) return undefined
|
|
193
|
+
const next: McpCredential = { ...credential }
|
|
194
|
+
if (scope === 'tokens' || scope === 'all') delete next.tokens
|
|
195
|
+
if (scope === 'client' || scope === 'all') delete next.client
|
|
196
|
+
if (scope === 'all') delete next.discovery
|
|
197
|
+
return next
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export function resolveContainerMcpOAuthStore(env: NodeJS.ProcessEnv, secretsPath: string): McpOAuthStore {
|
|
201
|
+
const hostdUrl = env.TYPECLAW_HOSTD_URL
|
|
202
|
+
const restartToken = env.TYPECLAW_HOSTD_TOKEN
|
|
203
|
+
const containerName = env.TYPECLAW_CONTAINER_NAME
|
|
204
|
+
if (hostdUrl && restartToken && containerName) {
|
|
205
|
+
return createHostdMcpOAuthStore({ hostdUrl, restartToken, containerName, secretsPath })
|
|
206
|
+
}
|
|
207
|
+
return createFileMcpOAuthStore(secretsPath)
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export function listMcpCredentials(secretsPath: string): McpSlice {
|
|
211
|
+
return new SecretsBackend(secretsPath).tryReadMcpSync()
|
|
212
|
+
}
|
package/src/run/index.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { join } from 'node:path'
|
|
2
|
+
|
|
1
3
|
import { SessionManager } from '@mariozechner/pi-coding-agent'
|
|
2
4
|
|
|
3
5
|
import { createSession, createSessionWithDispose } from '@/agent'
|
|
@@ -24,6 +26,7 @@ import { clearTodosForOrigin, markRestartAbortPendingForOrigin } from '@/agent/t
|
|
|
24
26
|
import { embed, warmEmbedder } from '@/bundled-plugins/memory/vector/embedder'
|
|
25
27
|
import { buildStartupVectorIndex } from '@/bundled-plugins/memory/vector/startup'
|
|
26
28
|
import { resolveCapOptionsFromConfig } from '@/bundled-plugins/tool-result-cap'
|
|
29
|
+
import { createRuntimeCapabilities, type RuntimeCapabilities } from '@/capabilities'
|
|
27
30
|
import {
|
|
28
31
|
createChannelManager,
|
|
29
32
|
createChannelsReloadable,
|
|
@@ -51,7 +54,7 @@ import {
|
|
|
51
54
|
type Scheduler,
|
|
52
55
|
} from '@/cron'
|
|
53
56
|
import { CLI_VERSION } from '@/init/cli-version'
|
|
54
|
-
import { createMcpManager } from '@/mcp'
|
|
57
|
+
import { createMcpManager, resolveContainerMcpOAuthStore, TypeClawMcpOAuthProvider } from '@/mcp'
|
|
55
58
|
import { runStartupMigrations } from '@/migrations'
|
|
56
59
|
import { loadPlugins, type LoadPluginsResult, pluginCronJobs, type PluginRegistry, summarizeLoaded } from '@/plugin'
|
|
57
60
|
import { createPluginLogger } from '@/plugin/context'
|
|
@@ -79,8 +82,8 @@ import { createTunnelManager, type TunnelManager, type TunnelManagerOptions } fr
|
|
|
79
82
|
|
|
80
83
|
import { BUNDLED_PLUGINS } from './bundled-plugins'
|
|
81
84
|
import { buildChannelSessionFactory } from './channel-session-factory'
|
|
82
|
-
import { installCodexFetchObserver } from './codex-fetch-observer'
|
|
83
85
|
import { installFatalGuard } from './fatal-guard'
|
|
86
|
+
import { installLlmFetchObserver } from './llm-fetch-observer'
|
|
84
87
|
import { createPluginRuntime, type PluginRuntime, type PluginSubagentEntry } from './plugin-runtime'
|
|
85
88
|
|
|
86
89
|
type BunServer = ReturnType<Server['start']>
|
|
@@ -109,6 +112,10 @@ export type StartAgentOptions = {
|
|
|
109
112
|
stream?: Stream
|
|
110
113
|
createChannelManager?: ChannelManagerFactory
|
|
111
114
|
createTunnelManager?: TunnelManagerFactory
|
|
115
|
+
// The container-stage capability bag. Defaults to createRuntimeCapabilities()
|
|
116
|
+
// over the real env + <cwd>/secrets.json. Injectable so tests can supply a
|
|
117
|
+
// fake secrets provider without touching process.env.
|
|
118
|
+
caps?: RuntimeCapabilities
|
|
112
119
|
}
|
|
113
120
|
|
|
114
121
|
export type StartAgentResult = {
|
|
@@ -126,7 +133,7 @@ export type StartAgentResult = {
|
|
|
126
133
|
}
|
|
127
134
|
|
|
128
135
|
// Owns boot-failure cleanup for everything installed before `startAgentRuntime`
|
|
129
|
-
// returns a `StartAgentResult`. `
|
|
136
|
+
// returns a `StartAgentResult`. `installLlmFetchObserver`/`installFatalGuard`
|
|
130
137
|
// attach process-wide listeners, and `loadPlugins` opens plugin-lifetime
|
|
131
138
|
// resources (the memory plugin's sqlite handle); if any boot step throws before
|
|
132
139
|
// the result exists, the caller never receives `stop()`, so each of those would
|
|
@@ -168,18 +175,22 @@ async function startAgentRuntime(
|
|
|
168
175
|
stream = createStream(),
|
|
169
176
|
createChannelManager: createChannelManagerFor = createChannelManager,
|
|
170
177
|
createTunnelManager: createTunnelManagerFor = createTunnelManager,
|
|
178
|
+
caps = createRuntimeCapabilities(process.env, join(cwd, 'secrets.json')),
|
|
171
179
|
}: StartAgentOptions,
|
|
172
180
|
registerBootCleanup: (cleanup: () => void | Promise<void>) => void,
|
|
173
181
|
): Promise<StartAgentResult> {
|
|
174
182
|
const reloadRegistry = new ReloadRegistry()
|
|
175
183
|
|
|
176
184
|
// Wrap globalThis.fetch BEFORE any plugin/session/manager construction so
|
|
177
|
-
// every
|
|
178
|
-
//
|
|
179
|
-
//
|
|
180
|
-
//
|
|
181
|
-
//
|
|
182
|
-
|
|
185
|
+
// every LLM provider stream from anywhere in the container is guarded. Logs
|
|
186
|
+
// one `[llm-fetch]` line per matched request with phase timings and applies
|
|
187
|
+
// TTFB/idle/overall deadlines that abort a stalled stream — turning a silent
|
|
188
|
+
// infinite hang (e.g. a rate-limited proxy holding the SSE connection open
|
|
189
|
+
// with zero bytes) into a retryable error the fallback path can surface.
|
|
190
|
+
// Covers Codex, Anthropic (`/v1/messages`), and OpenAI-compatible endpoints
|
|
191
|
+
// regardless of host, since base URLs are user-configured. Opt out with
|
|
192
|
+
// TYPECLAW_LLM_FETCH_OBSERVER=off.
|
|
193
|
+
const uninstallLlmFetchObserver = installLlmFetchObserver()
|
|
183
194
|
|
|
184
195
|
// The host CLI sets TYPECLAW_CONTAINER_NAME when it `docker run`s us. When
|
|
185
196
|
// running outside a typeclaw container (tests, ad-hoc `bun run typeclaw run`
|
|
@@ -217,7 +228,7 @@ async function startAgentRuntime(
|
|
|
217
228
|
const disposeProcessGlobals = (): void => {
|
|
218
229
|
if (processGlobalsDisposed) return
|
|
219
230
|
processGlobalsDisposed = true
|
|
220
|
-
|
|
231
|
+
uninstallLlmFetchObserver()
|
|
221
232
|
fatalGuard.dispose()
|
|
222
233
|
// onSigterm is defined later in this scope but only ever invoked after init;
|
|
223
234
|
// removing it here keeps a restarted startAgent() from stacking listeners.
|
|
@@ -228,8 +239,21 @@ async function startAgentRuntime(
|
|
|
228
239
|
|
|
229
240
|
const { config: cwdConfig, pluginConfigs: pluginConfigsByName } = loadConfigBundleSync(cwd)
|
|
230
241
|
const githubTokenBridge = createGithubTokenBridge()
|
|
242
|
+
const mcpOAuthStore = resolveContainerMcpOAuthStore(process.env, join(cwd, 'secrets.json'))
|
|
231
243
|
const mcpManager =
|
|
232
|
-
cwdConfig.mcpServers.length > 0
|
|
244
|
+
cwdConfig.mcpServers.length > 0
|
|
245
|
+
? createMcpManager(cwdConfig.mcpServers, {
|
|
246
|
+
env: process.env,
|
|
247
|
+
authProvider: (server) =>
|
|
248
|
+
server.url === undefined
|
|
249
|
+
? undefined
|
|
250
|
+
: new TypeClawMcpOAuthProvider(server.name, mcpOAuthStore, {
|
|
251
|
+
mode: 'container',
|
|
252
|
+
redirectUrl: 'http://localhost:1456/callback',
|
|
253
|
+
clientName: 'typeclaw',
|
|
254
|
+
}),
|
|
255
|
+
})
|
|
256
|
+
: null
|
|
233
257
|
const mcpManagerOpt = mcpManager !== null ? { mcpManager } : {}
|
|
234
258
|
|
|
235
259
|
// Warm up MCP connections in the BACKGROUND so boot doesn't block on each
|
|
@@ -365,6 +389,7 @@ async function startAgentRuntime(
|
|
|
365
389
|
|
|
366
390
|
const channelManager = createChannelManagerFor({
|
|
367
391
|
agentDir: cwd,
|
|
392
|
+
secretsProvider: caps.secrets,
|
|
368
393
|
channelsConfigRef: () => getConfig().channels,
|
|
369
394
|
aliasesRef: () => getConfig().alias,
|
|
370
395
|
tunnelUrlForChannel: (name) => resolveTunnelUrlForChannel(name, tunnelManager),
|