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.
Files changed (89) hide show
  1. package/auth.schema.json +16 -0
  2. package/package.json +3 -3
  3. package/secrets.schema.json +16 -0
  4. package/src/agent/adaptive-thinking-compat.ts +79 -0
  5. package/src/agent/index.ts +79 -101
  6. package/src/agent/live-subagents.ts +4 -4
  7. package/src/agent/plugin-tools.ts +85 -132
  8. package/src/agent/provider-error.ts +37 -0
  9. package/src/agent/reload-tool.ts +1 -1
  10. package/src/agent/session-origin.ts +6 -3
  11. package/src/agent/subagents.ts +2 -2
  12. package/src/agent/system-prompt.ts +24 -8
  13. package/src/agent/tool-result-budget.ts +1 -1
  14. package/src/agent/tools/channel-react.ts +5 -4
  15. package/src/agent/tools/spawn-subagent.ts +80 -24
  16. package/src/agent/tools/stream-snapshot.ts +8 -3
  17. package/src/bundled-plugins/agent-browser/index.ts +18 -8
  18. package/src/bundled-plugins/memory/README.md +4 -1
  19. package/src/bundled-plugins/memory/belief-sentence.ts +50 -0
  20. package/src/bundled-plugins/memory/dreaming.ts +13 -6
  21. package/src/bundled-plugins/memory/load-memory.ts +22 -2
  22. package/src/bundled-plugins/memory/memory-logger.ts +1 -1
  23. package/src/bundled-plugins/planner/planner.ts +1 -1
  24. package/src/bundled-plugins/researcher/researcher.ts +2 -2
  25. package/src/bundled-plugins/reviewer/reviewer.ts +1 -1
  26. package/src/capabilities/control-plane.ts +24 -0
  27. package/src/capabilities/index.ts +2 -0
  28. package/src/capabilities/runtime.ts +30 -0
  29. package/src/channels/adapters/discord-bot-thread-room.ts +73 -0
  30. package/src/channels/adapters/discord-bot.ts +9 -1
  31. package/src/channels/adapters/slack-bot-classify.ts +1 -0
  32. package/src/channels/adapters/slack-classify.ts +1 -0
  33. package/src/channels/engagement.ts +33 -0
  34. package/src/channels/manager.ts +41 -47
  35. package/src/channels/router.ts +150 -21
  36. package/src/channels/types.ts +10 -0
  37. package/src/cli/channel.ts +49 -12
  38. package/src/cli/command-meta.ts +2 -0
  39. package/src/cli/hostd.ts +4 -3
  40. package/src/cli/index.ts +1 -0
  41. package/src/cli/logs.ts +2 -2
  42. package/src/cli/mcp.ts +233 -0
  43. package/src/cli/restart.ts +5 -3
  44. package/src/cli/shell.ts +2 -2
  45. package/src/cli/start.ts +2 -2
  46. package/src/cli/status.ts +2 -2
  47. package/src/cli/stop.ts +2 -2
  48. package/src/compose/restart.ts +4 -3
  49. package/src/compose/start.ts +2 -2
  50. package/src/compose/stop.ts +2 -2
  51. package/src/config/config.ts +10 -1
  52. package/src/config/providers.ts +61 -9
  53. package/src/container/controller.ts +104 -0
  54. package/src/container/index.ts +9 -0
  55. package/src/hostd/daemon.ts +28 -9
  56. package/src/hostd/protocol.ts +12 -9
  57. package/src/init/index.ts +1 -1
  58. package/src/init/instagram-auth.ts +189 -34
  59. package/src/inspect/logs-item.ts +2 -2
  60. package/src/mcp/client.ts +16 -6
  61. package/src/mcp/index.ts +12 -0
  62. package/src/mcp/manager.ts +9 -4
  63. package/src/mcp/oauth.ts +212 -0
  64. package/src/run/index.ts +36 -11
  65. package/src/run/{codex-fetch-observer.ts → llm-fetch-observer.ts} +182 -82
  66. package/src/sandbox/availability.ts +2 -2
  67. package/src/sandbox/build.ts +1 -1
  68. package/src/sandbox/hidden-paths.ts +59 -0
  69. package/src/sandbox/index.ts +1 -1
  70. package/src/sandbox/policy.ts +2 -2
  71. package/src/secrets/discord-store.ts +4 -13
  72. package/src/secrets/index.ts +1 -1
  73. package/src/secrets/instagram-store.ts +4 -13
  74. package/src/secrets/kakao-store.ts +4 -13
  75. package/src/secrets/line-store.ts +4 -13
  76. package/src/secrets/schema.ts +13 -0
  77. package/src/secrets/secrets-provider.ts +86 -0
  78. package/src/secrets/slack-store.ts +4 -13
  79. package/src/secrets/storage.ts +108 -1
  80. package/src/secrets/webex-store.ts +4 -13
  81. package/src/server/index.ts +2 -2
  82. package/src/skills/typeclaw-channel-github/SKILL.md +2 -2
  83. package/src/skills/typeclaw-channel-instagram/SKILL.md +1 -1
  84. package/src/skills/typeclaw-config/SKILL.md +5 -3
  85. package/src/skills/typeclaw-plugins/SKILL.md +1 -1
  86. package/src/skills/typeclaw-troubleshooting/SKILL.md +1 -1
  87. package/src/stream/broker.ts +4 -3
  88. package/src/stream/types.ts +1 -0
  89. package/typeclaw.schema.json +14 -0
@@ -0,0 +1,73 @@
1
+ import type { InboundMessage } from '@/channels/types'
2
+
3
+ const DISCORD_API_BASE = 'https://discord.com/api/v10'
4
+ const DEFAULT_TTL_MS = 24 * 60 * 60 * 1000
5
+
6
+ // Discord channel `type` values that are threads (public, private, announcement
7
+ // threads). A Discord thread is its OWN channel — a thread message arrives with
8
+ // `chat = <thread-channel-id>` and `thread = null`, unlike Slack where the
9
+ // thread ts rides `thread`. So the only way to know an inbound is in a thread
10
+ // room is to look up the channel's type; the gateway MESSAGE_CREATE event
11
+ // carries no thread/parent signal.
12
+ const DISCORD_THREAD_CHANNEL_TYPES: ReadonlySet<number> = new Set([10, 11, 12])
13
+
14
+ export type DiscordChannelMeta = { type?: number; parent_id?: string }
15
+
16
+ // The lookup has THREE outcomes, and the failure case must not be conflated
17
+ // with a confirmed non-thread channel:
18
+ // - a channel object → we know the type (thread or not)
19
+ // - 'unknown' → the fetch failed (network / non-OK / rate limit); we cannot
20
+ // tell, so downstream must fail closed rather than assume "normal channel".
21
+ type ChannelMetaLookup = DiscordChannelMeta | 'unknown'
22
+
23
+ export type DiscordThreadRoomResolverOptions = {
24
+ token: string
25
+ fetchImpl?: typeof fetch
26
+ now?: () => number
27
+ ttlMs?: number
28
+ }
29
+
30
+ // Maps a lookup outcome to the room signal. A confirmed thread carries its
31
+ // parent for membership scoping; a confirmed non-thread returns undefined (the
32
+ // solo fallback may apply). An 'unknown' fetch failure returns a bare thread
33
+ // room WITHOUT parentChat: it fails the engagement gate closed (so the bot
34
+ // won't butt into a possibly-thread it can't classify) while still resolving
35
+ // membership against the thread's own channel — the same conservative posture
36
+ // as a private thread whose parent we can't read.
37
+ export function discordThreadRoom(meta: ChannelMetaLookup): InboundMessage['room'] {
38
+ if (meta === 'unknown') return { kind: 'thread' }
39
+ if (meta.type === undefined || !DISCORD_THREAD_CHANNEL_TYPES.has(meta.type)) return undefined
40
+ return meta.parent_id !== undefined ? { kind: 'thread', parentChat: meta.parent_id } : { kind: 'thread' }
41
+ }
42
+
43
+ export function createDiscordThreadRoomResolver(
44
+ options: DiscordThreadRoomResolverOptions,
45
+ ): (channelId: string) => Promise<InboundMessage['room']> {
46
+ const fetchImpl = options.fetchImpl ?? fetch
47
+ const now = options.now ?? Date.now
48
+ const ttlMs = options.ttlMs ?? DEFAULT_TTL_MS
49
+ const cache = new Map<string, { value: DiscordChannelMeta; expiresAt: number }>()
50
+
51
+ return async (channelId: string): Promise<InboundMessage['room']> => {
52
+ const cached = cache.get(channelId)
53
+ if (cached !== undefined && cached.expiresAt > now()) return discordThreadRoom(cached.value)
54
+ // Only CONFIRMED metadata is cached. A failed lookup ('unknown') is not
55
+ // cached, so the next message on this channel retries rather than pinning
56
+ // the fail-closed state for the whole TTL.
57
+ const meta = await fetchChannelMeta(channelId)
58
+ if (meta !== 'unknown') cache.set(channelId, { value: meta, expiresAt: now() + ttlMs })
59
+ return discordThreadRoom(meta)
60
+ }
61
+
62
+ async function fetchChannelMeta(channelId: string): Promise<ChannelMetaLookup> {
63
+ try {
64
+ const response = await fetchImpl(`${DISCORD_API_BASE}/channels/${encodeURIComponent(channelId)}`, {
65
+ headers: { Authorization: `Bot ${options.token}` },
66
+ })
67
+ if (!response.ok) return 'unknown'
68
+ return (await response.json()) as DiscordChannelMeta
69
+ } catch {
70
+ return 'unknown'
71
+ }
72
+ }
73
+ }
@@ -55,6 +55,7 @@ import {
55
55
  registerCommands,
56
56
  type DiscordCommandDeclaration,
57
57
  } from './discord-bot-slash-commands'
58
+ import { createDiscordThreadRoomResolver } from './discord-bot-thread-room'
58
59
  import { addDiscordMentionHints, type DiscordMentionUser } from './mention-hints'
59
60
 
60
61
  // One declared slash command per logical agent gesture. /stop maps to the
@@ -954,6 +955,7 @@ export function createDiscordBotAdapter(options: DiscordBotAdapterOptions): Disc
954
955
  let stopWaiters: Array<() => void> = []
955
956
 
956
957
  const channelResolver = createDiscordChannelResolver({ token: options.token })
958
+ const threadRoomResolver = createDiscordThreadRoomResolver({ token: options.token, fetchImpl })
957
959
 
958
960
  // Discord mentions by snowflake id (`<@id>`/`<@!id>`), so no username form.
959
961
  const selfIdentityResolver: ChannelSelfIdentityResolver = () => (botUserId !== null ? { id: botUserId } : null)
@@ -1061,10 +1063,16 @@ export function createDiscordBotAdapter(options: DiscordBotAdapterOptions): Disc
1061
1063
  }
1062
1064
  },
1063
1065
  })
1064
- const payload =
1066
+ // Discord threads are their own channels (`chat = thread id`, `thread`
1067
+ // stays null), so the engagement gate cannot see "this is a thread" from
1068
+ // the payload alone. Resolve the channel's type/parent and stamp the
1069
+ // structural `room` signal for guild inbounds; DMs are never thread rooms.
1070
+ const room = event.guild_id !== undefined ? await threadRoomResolver(event.channel_id) : undefined
1071
+ const basePayload =
1065
1072
  referenceResult.referenceContext === undefined
1066
1073
  ? { ...verdict.payload, text: hintedText }
1067
1074
  : { ...verdict.payload, text: hintedText, referenceContext: referenceResult.referenceContext }
1075
+ const payload = room !== undefined ? { ...basePayload, room } : basePayload
1068
1076
 
1069
1077
  const routedTag = await formatChannelTag(payload.workspace, payload.chat)
1070
1078
  logger.info(
@@ -143,6 +143,7 @@ export function classifyInbound(
143
143
  workspace,
144
144
  chat: event.channel,
145
145
  thread,
146
+ ...(thread !== null ? { room: { kind: 'thread' as const } } : {}),
146
147
  ...(typingThread !== undefined ? { typingThread } : {}),
147
148
  text,
148
149
  ...(attachments.length > 0 ? { attachments } : {}),
@@ -49,6 +49,7 @@ export function classifyInbound(
49
49
  workspace,
50
50
  chat: event.channel,
51
51
  thread,
52
+ ...(thread !== null ? { room: { kind: 'thread' as const } } : {}),
52
53
  text: rawText,
53
54
  externalMessageId: event.ts,
54
55
  reactionRef: encodeSlackReactionRef({ channel: event.channel, ts: event.ts }),
@@ -216,11 +216,44 @@ export function decideEngagement(input: EngagementInput): EngagementDecision {
216
216
  // fallback fix.
217
217
  if (targetsSomeoneElse(message, participants, botInThread)) return 'observe'
218
218
 
219
+ // Thread solo-fallback fail-closed gate. A thread is a SEPARATE live session
220
+ // from its parent channel (the participant/membership key carries the thread
221
+ // suffix — see `channelKeyId`), so a freshly-opened thread starts with one
222
+ // known speaker and a cold membership cache. That collapses `effectiveHumans`
223
+ // to ≤1 and would trip the solo-human fallback below, making the bot butt
224
+ // into a thread it was never part of in a busy multi-human channel. Membership
225
+ // is a room property, not a thread property, so a thread may ride the fallback
226
+ // ONLY on a fresh, complete membership read that itself proves ≤1 human; null
227
+ // / truncated / stale reads fail closed to `observe`. Exemptions: DMs (solo by
228
+ // construction) and threads the bot ALREADY participates in (`botInThread` —
229
+ // an established conversation, not an un-addressed intrusion; this is the same
230
+ // escape hatch the `replyToOtherMessageId` suppressor uses). Non-thread solo
231
+ // channels keep the legacy answer-everything fallback untouched.
232
+ //
233
+ // `isThreadRoom` reads the structural `room` signal FIRST so this fires for
234
+ // Discord threads too (their `thread` is null — the thread id lives in
235
+ // `chat`), falling back to `thread !== null` for Slack-shaped inbounds.
236
+ if (isThreadRoom(message) && !botInThread && !isFreshCompleteSoloRoom(input.membership, now)) {
237
+ return 'observe'
238
+ }
239
+
219
240
  if (effectiveHumans <= 1 && !message.authorIsBot) return 'engage'
220
241
 
221
242
  return 'observe'
222
243
  }
223
244
 
245
+ function isThreadRoom(message: InboundMessage): boolean {
246
+ if (message.isDm) return false
247
+ return message.room?.kind === 'thread' || message.thread !== null
248
+ }
249
+
250
+ function isFreshCompleteSoloRoom(membership: MembershipCount | null, now: number): boolean {
251
+ if (membership === null) return false
252
+ if (membership.truncated) return false
253
+ if (now - membership.fetchedAt >= MEMBERSHIP_FRESHNESS_MS) return false
254
+ return membership.humans <= 1
255
+ }
256
+
224
257
  // Structural "this message is addressed to someone other than us" test. Pure
225
258
  // over adapter-classified booleans + observed peer names — no semantic text
226
259
  // interpretation, so it is safe for the content-blind engagement gate. Shared
@@ -7,6 +7,7 @@ import { SecretsDiscordCredentialStore } from '@/secrets/discord-store'
7
7
  import { SecretsInstagramCredentialStore } from '@/secrets/instagram-store'
8
8
  import { SecretsKakaoCredentialStore } from '@/secrets/kakao-store'
9
9
  import { SecretsLineCredentialStore } from '@/secrets/line-store'
10
+ import type { RuntimeSecretsProvider } from '@/secrets/secrets-provider'
10
11
  import { SecretsSlackCredentialStore } from '@/secrets/slack-store'
11
12
  import { SecretsBackend } from '@/secrets/storage'
12
13
  import { SecretsWebexCredentialStore } from '@/secrets/webex-store'
@@ -66,6 +67,13 @@ export type ChannelManagerOptions = {
66
67
  aliasesRef?: () => readonly string[]
67
68
  logger?: ChannelManagerLogger
68
69
  env?: NodeJS.ProcessEnv
70
+ // The container-stage secrets provider for personal-account adapters
71
+ // (line/kakaotalk/slack/discord/webex/instagram write-back + read). Resolved
72
+ // ONCE at the composition root (createRuntimeCapabilities in src/run/index.ts)
73
+ // and threaded in here — the manager never resolves it from env itself. Null
74
+ // (or omitted) skips those adapters; see the note above the
75
+ // createContainer*CredentialStore factories.
76
+ secretsProvider?: RuntimeSecretsProvider | null
69
77
  // Production wiring passes a factory that builds sessions with the full
70
78
  // runtime plumbing (channelRouter, stream, plugins, reloadRegistry). When
71
79
  // omitted, the router falls back to a hollow factory that creates sessions
@@ -267,7 +275,7 @@ export function createChannelManager(options: ChannelManagerOptions): ChannelMan
267
275
  })
268
276
  }
269
277
  if (name === 'line') {
270
- const credentialsStore = createContainerLineCredentialStore(options.agentDir, env)
278
+ const credentialsStore = createContainerLineCredentialStore(options.agentDir, options.secretsProvider ?? null)
271
279
  if (credentialsStore === null) return null
272
280
  return createLine({
273
281
  router,
@@ -278,7 +286,10 @@ export function createChannelManager(options: ChannelManagerOptions): ChannelMan
278
286
  })
279
287
  }
280
288
  if (name === 'instagram') {
281
- const credentialsStore = createContainerInstagramCredentialStore(options.agentDir, env)
289
+ const credentialsStore = createContainerInstagramCredentialStore(
290
+ options.agentDir,
291
+ options.secretsProvider ?? null,
292
+ )
282
293
  if (credentialsStore === null) return null
283
294
  return createInstagram({
284
295
  router,
@@ -289,7 +300,7 @@ export function createChannelManager(options: ChannelManagerOptions): ChannelMan
289
300
  })
290
301
  }
291
302
  if (name === 'kakaotalk') {
292
- const credentialsStore = createContainerKakaoCredentialStore(options.agentDir, env)
303
+ const credentialsStore = createContainerKakaoCredentialStore(options.agentDir, options.secretsProvider ?? null)
293
304
  if (credentialsStore === null) return null
294
305
  return createKakaotalk({
295
306
  router,
@@ -300,7 +311,7 @@ export function createChannelManager(options: ChannelManagerOptions): ChannelMan
300
311
  })
301
312
  }
302
313
  if (name === 'slack') {
303
- const credentialsStore = createContainerSlackCredentialStore(options.agentDir, env)
314
+ const credentialsStore = createContainerSlackCredentialStore(options.agentDir, options.secretsProvider ?? null)
304
315
  if (credentialsStore === null) return null
305
316
  return createSlackUser({
306
317
  router,
@@ -311,7 +322,7 @@ export function createChannelManager(options: ChannelManagerOptions): ChannelMan
311
322
  })
312
323
  }
313
324
  if (name === 'discord') {
314
- const credentialsStore = createContainerDiscordCredentialStore(options.agentDir, env)
325
+ const credentialsStore = createContainerDiscordCredentialStore(options.agentDir, options.secretsProvider ?? null)
315
326
  if (credentialsStore === null) return null
316
327
  return createDiscordUser({
317
328
  router,
@@ -322,7 +333,7 @@ export function createChannelManager(options: ChannelManagerOptions): ChannelMan
322
333
  })
323
334
  }
324
335
  if (name === 'webex') {
325
- const credentialsStore = createContainerWebexCredentialStore(options.agentDir, env)
336
+ const credentialsStore = createContainerWebexCredentialStore(options.agentDir, options.secretsProvider ?? null)
326
337
  if (credentialsStore === null) return null
327
338
  return createWebex({
328
339
  router,
@@ -570,33 +581,21 @@ const TOKEN_ENV: Record<
570
581
  'webex-bot': ['WEBEX_BOT_TOKEN'],
571
582
  }
572
583
 
573
- // Personal-account adapters (line/kakaotalk/slack/discord/webex) need the hostd
574
- // triple the host CLI injects at `docker run` time, gated on a successful daemon
575
- // registration (src/container/start.ts). If the daemon wasn't reachable at
576
- // launch (e.g. a lost first-boot spawn race) the triple is absent; null lets
577
- // buildAdapter skip the adapter instead of throwing and crashing the whole
578
- // channel manager. startAdapter's signature pre-check only reads secrets.json,
579
- // so this is the only place the missing triple is caught.
580
- type HostdContainerCredentials = { hostdUrl: string; restartToken: string; containerName: string }
581
-
582
- function resolveHostdContainerCredentials(env: NodeJS.ProcessEnv): HostdContainerCredentials | null {
583
- const hostdUrl = env.TYPECLAW_HOSTD_URL
584
- const restartToken = env.TYPECLAW_HOSTD_TOKEN
585
- const containerName = env.TYPECLAW_CONTAINER_NAME
586
- if (!hostdUrl || !restartToken || !containerName) return null
587
- return { hostdUrl, restartToken, containerName }
588
- }
589
-
584
+ // Personal-account adapters (line/kakaotalk/slack/discord/webex) need a
585
+ // container-stage secrets provider. It's resolved ONCE at the composition root
586
+ // (createRuntimeCapabilities in src/run/index.ts) and threaded in via
587
+ // `secretsProvider`; a null value (hostd triple absent — e.g. a lost first-boot
588
+ // spawn race, or a managed profile with no write-back wired) lets buildAdapter
589
+ // skip the adapter instead of crashing the whole channel manager.
590
590
  function createContainerDiscordCredentialStore(
591
591
  agentDir: string,
592
- env: NodeJS.ProcessEnv,
592
+ secretsProvider: RuntimeSecretsProvider | null,
593
593
  ): SecretsDiscordCredentialStore | null {
594
- const creds = resolveHostdContainerCredentials(env)
595
- if (creds === null) return null
594
+ if (secretsProvider === null) return null
596
595
  return new SecretsDiscordCredentialStore({
597
596
  mode: 'container',
598
597
  secretsPath: join(agentDir, 'secrets.json'),
599
- ...creds,
598
+ hostProvider: secretsProvider,
600
599
  })
601
600
  }
602
601
 
@@ -616,14 +615,13 @@ function buildDiscordSignature(agentDir: string): { signature: string; missing:
616
615
 
617
616
  function createContainerSlackCredentialStore(
618
617
  agentDir: string,
619
- env: NodeJS.ProcessEnv,
618
+ secretsProvider: RuntimeSecretsProvider | null,
620
619
  ): SecretsSlackCredentialStore | null {
621
- const creds = resolveHostdContainerCredentials(env)
622
- if (creds === null) return null
620
+ if (secretsProvider === null) return null
623
621
  return new SecretsSlackCredentialStore({
624
622
  mode: 'container',
625
623
  secretsPath: join(agentDir, 'secrets.json'),
626
- ...creds,
624
+ hostProvider: secretsProvider,
627
625
  })
628
626
  }
629
627
 
@@ -643,14 +641,13 @@ function buildSlackSignature(agentDir: string): { signature: string; missing: st
643
641
 
644
642
  function createContainerWebexCredentialStore(
645
643
  agentDir: string,
646
- env: NodeJS.ProcessEnv,
644
+ secretsProvider: RuntimeSecretsProvider | null,
647
645
  ): SecretsWebexCredentialStore | null {
648
- const creds = resolveHostdContainerCredentials(env)
649
- if (creds === null) return null
646
+ if (secretsProvider === null) return null
650
647
  return new SecretsWebexCredentialStore({
651
648
  mode: 'container',
652
649
  secretsPath: join(agentDir, 'secrets.json'),
653
- ...creds,
650
+ hostProvider: secretsProvider,
654
651
  })
655
652
  }
656
653
 
@@ -670,14 +667,13 @@ function buildWebexSignature(agentDir: string): { signature: string; missing: st
670
667
 
671
668
  function createContainerKakaoCredentialStore(
672
669
  agentDir: string,
673
- env: NodeJS.ProcessEnv,
670
+ secretsProvider: RuntimeSecretsProvider | null,
674
671
  ): SecretsKakaoCredentialStore | null {
675
- const creds = resolveHostdContainerCredentials(env)
676
- if (creds === null) return null
672
+ if (secretsProvider === null) return null
677
673
  return new SecretsKakaoCredentialStore({
678
674
  mode: 'container',
679
675
  secretsPath: join(agentDir, 'secrets.json'),
680
- ...creds,
676
+ hostProvider: secretsProvider,
681
677
  })
682
678
  }
683
679
 
@@ -697,14 +693,13 @@ function buildKakaotalkSignature(agentDir: string): { signature: string; missing
697
693
 
698
694
  function createContainerLineCredentialStore(
699
695
  agentDir: string,
700
- env: NodeJS.ProcessEnv,
696
+ secretsProvider: RuntimeSecretsProvider | null,
701
697
  ): SecretsLineCredentialStore | null {
702
- const creds = resolveHostdContainerCredentials(env)
703
- if (creds === null) return null
698
+ if (secretsProvider === null) return null
704
699
  return new SecretsLineCredentialStore({
705
700
  mode: 'container',
706
701
  secretsPath: join(agentDir, 'secrets.json'),
707
- ...creds,
702
+ hostProvider: secretsProvider,
708
703
  })
709
704
  }
710
705
 
@@ -724,14 +719,13 @@ function buildLineSignature(agentDir: string): { signature: string; missing: str
724
719
 
725
720
  function createContainerInstagramCredentialStore(
726
721
  agentDir: string,
727
- env: NodeJS.ProcessEnv,
722
+ secretsProvider: RuntimeSecretsProvider | null,
728
723
  ): SecretsInstagramCredentialStore | null {
729
- const creds = resolveHostdContainerCredentials(env)
730
- if (creds === null) return null
724
+ if (secretsProvider === null) return null
731
725
  return new SecretsInstagramCredentialStore({
732
726
  mode: 'container',
733
727
  secretsPath: join(agentDir, 'secrets.json'),
734
- ...creds,
728
+ hostProvider: secretsProvider,
735
729
  })
736
730
  }
737
731