typeclaw 0.37.7 → 0.38.1

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 (44) hide show
  1. package/README.md +2 -2
  2. package/auth.schema.json +109 -0
  3. package/package.json +2 -2
  4. package/secrets.schema.json +109 -0
  5. package/src/agent/session-origin.ts +16 -2
  6. package/src/bundled-plugins/memory/README.md +12 -1
  7. package/src/bundled-plugins/memory/index.ts +39 -2
  8. package/src/channels/adapters/kakaotalk.ts +1 -1
  9. package/src/channels/adapters/webex-bot-channel-resolver.ts +29 -0
  10. package/src/channels/adapters/webex-bot-classify.ts +98 -0
  11. package/src/channels/adapters/webex-bot-reference.ts +49 -0
  12. package/src/channels/adapters/webex-bot.ts +462 -0
  13. package/src/channels/adapters/webex-channel-resolver.ts +29 -0
  14. package/src/channels/adapters/webex-classify.ts +104 -0
  15. package/src/channels/adapters/webex-format.ts +53 -0
  16. package/src/channels/adapters/webex-id-ref.ts +32 -0
  17. package/src/channels/adapters/webex-reference.ts +49 -0
  18. package/src/channels/adapters/webex.ts +493 -0
  19. package/src/channels/manager.ts +75 -4
  20. package/src/channels/persistence.ts +67 -5
  21. package/src/channels/router.ts +9 -0
  22. package/src/channels/schema.ts +17 -1
  23. package/src/cli/channel.ts +155 -8
  24. package/src/cli/init.ts +129 -6
  25. package/src/config/channels-mutation.ts +11 -2
  26. package/src/doctor/channel-checks.ts +56 -1
  27. package/src/hostd/daemon.ts +7 -5
  28. package/src/hostd/protocol.ts +2 -2
  29. package/src/init/checkpoint.ts +1 -1
  30. package/src/init/index.ts +97 -17
  31. package/src/init/run-owner-claim.ts +2 -0
  32. package/src/init/webex-auth.ts +68 -0
  33. package/src/inspect/label.ts +13 -2
  34. package/src/inspect/render.ts +5 -3
  35. package/src/permissions/match-rule.ts +7 -3
  36. package/src/permissions/resolve.ts +44 -5
  37. package/src/role-claim/match-rule.ts +7 -2
  38. package/src/secrets/codex-auth-json.ts +52 -17
  39. package/src/secrets/defaults.ts +1 -0
  40. package/src/secrets/encryption.ts +5 -1
  41. package/src/secrets/export-codex-auth-file.ts +26 -3
  42. package/src/secrets/schema.ts +35 -0
  43. package/src/secrets/webex-store.ts +113 -0
  44. package/typeclaw.schema.json +321 -1
package/src/cli/init.ts CHANGED
@@ -66,6 +66,7 @@ import {
66
66
  validateApiKey,
67
67
  type KeyValidationResult,
68
68
  } from '@/init/validate-api-key'
69
+ import { runWebexBootstrap } from '@/init/webex-auth'
69
70
 
70
71
  import { fuzzyMatch } from './fuzzy-filter'
71
72
  import { buildOAuthCallbacks } from './oauth-callbacks'
@@ -215,6 +216,8 @@ export const init = defineCommand({
215
216
  telegramBotToken,
216
217
  kakaotalkEmail,
217
218
  kakaotalkPassword,
219
+ webexEmail,
220
+ webexPassword,
218
221
  github: githubCredentials,
219
222
  } = channelSecrets
220
223
  const modelMeta = customModelMetaFromOption(model)
@@ -233,8 +236,10 @@ export const init = defineCommand({
233
236
  const reuseSlack = reuseExistingChannel && channelChoice === 'slack'
234
237
  const reuseTelegram = reuseExistingChannel && channelChoice === 'telegram'
235
238
  const reuseKakaotalk = reuseExistingChannel && channelChoice === 'kakaotalk'
239
+ const reuseWebex = reuseExistingChannel && channelChoice === 'webex'
236
240
  const reuseGithub = reuseExistingChannel && channelChoice === 'github'
237
241
  const wantsKakaotalk = (kakaotalkEmail !== undefined && kakaotalkPassword !== undefined) || reuseKakaotalk
242
+ const wantsWebex = (webexEmail !== undefined && webexPassword !== undefined) || reuseWebex
238
243
  const wantsGithub = githubCredentials !== undefined || reuseGithub
239
244
  let hatchingOk = false
240
245
  let preflightFailure: Extract<DockerAvailability, { ok: false }> | null = null
@@ -276,6 +281,17 @@ export const init = defineCommand({
276
281
  }),
277
282
  }
278
283
  : {}),
284
+ ...(wantsWebex
285
+ ? {
286
+ withWebexUser: true,
287
+ ...(reuseWebex
288
+ ? {}
289
+ : {
290
+ runWebexAuth: ({ cwd: agentDir }) =>
291
+ runWebexBootstrap({ email: webexEmail!, password: webexPassword!, agentDir }),
292
+ }),
293
+ }
294
+ : {}),
279
295
  ...(wantsGithub
280
296
  ? {
281
297
  withGithub: true,
@@ -384,7 +400,7 @@ interface WizardState {
384
400
  channelReuseExisting?: boolean
385
401
  }
386
402
 
387
- type ChannelChoice = 'slack' | 'discord' | 'telegram' | 'kakaotalk' | 'github' | 'none'
403
+ type ChannelChoice = 'slack' | 'discord' | 'telegram' | 'webex' | 'kakaotalk' | 'github' | 'none'
388
404
 
389
405
  interface CollectedInputs {
390
406
  model: ModelOption
@@ -404,6 +420,8 @@ interface CollectedInputs {
404
420
  slackBotToken?: string
405
421
  slackAppToken?: string
406
422
  telegramBotToken?: string
423
+ webexEmail?: string
424
+ webexPassword?: string
407
425
  kakaotalkEmail?: string
408
426
  kakaotalkPassword?: string
409
427
  // Structured (auth union + webhook + repo allowlist) rather than flat
@@ -532,6 +550,15 @@ export async function collectWizardInputs(
532
550
  let pendingBackOrigin: StepId | null = null
533
551
  let oauthCredentialsSaved = false
534
552
 
553
+ // One-shot replay of checkpoint answers: while active, choice steps whose
554
+ // answer was seeded auto-advance (running their normal tail) instead of
555
+ // re-prompting. The first interactive prompt or any Back ends the replay
556
+ // (cleared in `onResult`), so back-navigation behaves like a fresh wizard.
557
+ // Secret-entry steps are never in `resumeCovered`, so a checkpointed
558
+ // `authMethod` still drops to its key/login prompt when nothing is on disk.
559
+ const resumeReplay = { active: false }
560
+ const resumeCovered = new Set<StepId>()
561
+
535
562
  // Resume saved wizard answers from a prior unfinished init. `--reset` skips
536
563
  // this entirely (the user asked to re-answer everything). Route through the
537
564
  // shared detectInitProgress() predicate so init/start/restart classify a
@@ -555,6 +582,8 @@ export async function collectWizardInputs(
555
582
  if (decision === 'resume') {
556
583
  seedWizardState(state, sanitized)
557
584
  step = resumeStep(state)
585
+ resumeReplay.active = true
586
+ for (const covered of resumeCoveredSteps(state)) resumeCovered.add(covered)
558
587
  } else {
559
588
  await checkpointStore.clear(cwd)
560
589
  }
@@ -571,6 +600,11 @@ export async function collectWizardInputs(
571
600
  }
572
601
 
573
602
  const onResult = <T>(currentStep: StepId, result: StepResult<T>): StepResult<T> => {
603
+ // Any Back, or any non-auto (interactive) answer, ends the resume replay:
604
+ // from here on the user is driving, so downstream seeded steps prompt
605
+ // normally. Synthesized auto-skips keep replay alive and, as before, leave
606
+ // `pendingBackOrigin` untouched so they never affect double-back abort.
607
+ if (result.kind === 'back' || !result.auto) resumeReplay.active = false
574
608
  if (result.kind === 'back') {
575
609
  if (pendingBackOrigin === currentStep) abort()
576
610
  pendingBackOrigin = currentStep
@@ -580,6 +614,16 @@ export async function collectWizardInputs(
580
614
  return result
581
615
  }
582
616
 
617
+ // Synthesize a step's seeded answer as an auto-advance result during resume
618
+ // replay, so the step runs its normal tail (state assignment, on-disk
619
+ // credential reconstruction, routing) without re-prompting. Returns
620
+ // undefined when replay is off, this step isn't checkpoint-covered, or the
621
+ // value is unset — callers fall back to the real prompt.
622
+ const resumeSkip = <T>(currentStep: StepId, value: T | undefined): StepResult<T> | undefined => {
623
+ if (!resumeReplay.active || !resumeCovered.has(currentStep) || value === undefined) return undefined
624
+ return { kind: 'value', value, auto: true }
625
+ }
626
+
583
627
  const readExistingApiKey = async (providerId: KnownProviderId): Promise<string | null> => {
584
628
  if (reset) return null
585
629
  return await prompts.readExistingApiKey(cwd, providerId)
@@ -725,7 +769,11 @@ export async function collectWizardInputs(
725
769
  }
726
770
 
727
771
  case 'pick-model': {
728
- const result = onResult(step, await prompts.pickModel(catalog.options, state.providerId!, state.model?.ref))
772
+ const result = onResult(
773
+ step,
774
+ resumeSkip(step, state.model) ??
775
+ (await prompts.pickModel(catalog.options, state.providerId!, state.model?.ref)),
776
+ )
729
777
  if (result.kind === 'back') {
730
778
  step = stepBeforeModel(state)
731
779
  break
@@ -758,7 +806,11 @@ export async function collectWizardInputs(
758
806
 
759
807
  case 'pick-vision-vendor': {
760
808
  const visionOptions = catalog.options.filter((o) => o.supportsVision)
761
- const result = onResult(step, await prompts.pickVisionVendor(visionOptions, state.visionVendorId))
809
+ const result: StepResult<KnownProviderVendorId | 'skip'> = onResult(
810
+ step,
811
+ resumeSkip<KnownProviderVendorId | 'skip'>(step, state.visionVendorId) ??
812
+ (await prompts.pickVisionVendor(visionOptions, state.visionVendorId)),
813
+ )
762
814
  if (result.kind === 'back') {
763
815
  step = stepBeforeVision(state)
764
816
  break
@@ -789,7 +841,8 @@ export async function collectWizardInputs(
789
841
  const visionOptions = catalog.options.filter((o) => o.supportsVision)
790
842
  const result = onResult(
791
843
  step,
792
- await prompts.pickVisionProviderVariant(state.visionVendorId!, visionOptions, state.visionProviderId),
844
+ resumeSkip(step, state.visionProviderId) ??
845
+ (await prompts.pickVisionProviderVariant(state.visionVendorId!, visionOptions, state.visionProviderId)),
793
846
  )
794
847
  if (result.kind === 'back') {
795
848
  step = 'pick-vision-vendor'
@@ -810,7 +863,8 @@ export async function collectWizardInputs(
810
863
  const visionOptions = catalog.options.filter((o) => o.supportsVision)
811
864
  const result = onResult(
812
865
  step,
813
- await prompts.pickVisionModel(visionOptions, state.visionProviderId!, state.visionModel?.ref),
866
+ resumeSkip(step, state.visionModel) ??
867
+ (await prompts.pickVisionModel(visionOptions, state.visionProviderId!, state.visionModel?.ref)),
814
868
  )
815
869
  if (result.kind === 'back') {
816
870
  step = 'pick-vision-provider-variant'
@@ -902,7 +956,10 @@ export async function collectWizardInputs(
902
956
  }
903
957
 
904
958
  case 'pick-channel': {
905
- const result: StepResult<ChannelChoice> = onResult(step, await prompts.pickChannel(state.channelChoice))
959
+ const result: StepResult<ChannelChoice> = onResult(
960
+ step,
961
+ resumeSkip(step, state.channelChoice) ?? (await prompts.pickChannel(state.channelChoice)),
962
+ )
906
963
  if (result.kind === 'back') {
907
964
  step = stepBeforePickChannel(state)
908
965
  break
@@ -1037,6 +1094,21 @@ function resumeStep(state: WizardState): StepId {
1037
1094
  return 'pick-vendor'
1038
1095
  }
1039
1096
 
1097
+ // Choice steps whose seeded answer lets resume replay auto-advance them. Only
1098
+ // non-secret picks the checkpoint actually carries — never `enter-api-key` /
1099
+ // `enter-vision-api-key` (key values aren't checkpointed) and never the
1100
+ // reuse-* / channel-flow steps (those reconstruct from disk or collect secrets,
1101
+ // so they must run their own logic, not replay a stored answer).
1102
+ function resumeCoveredSteps(state: WizardState): StepId[] {
1103
+ const covered: StepId[] = []
1104
+ if (state.model !== undefined) covered.push('pick-model')
1105
+ if (state.visionVendorId !== undefined) covered.push('pick-vision-vendor')
1106
+ if (state.visionProviderId !== undefined) covered.push('pick-vision-provider-variant')
1107
+ if (state.visionModel !== undefined) covered.push('pick-vision-model')
1108
+ if (state.channelChoice !== undefined) covered.push('pick-channel')
1109
+ return covered
1110
+ }
1111
+
1040
1112
  function projectCheckpoint(cwd: string, state: WizardState): WizardAnswerCheckpointV1 {
1041
1113
  return checkpointFromSelections({
1042
1114
  cwd,
@@ -1060,6 +1132,8 @@ function channelDisplayName(choice: Exclude<ChannelChoice, 'none'>): string {
1060
1132
  return 'Discord'
1061
1133
  case 'telegram':
1062
1134
  return 'Telegram'
1135
+ case 'webex':
1136
+ return 'Webex (User)'
1063
1137
  case 'kakaotalk':
1064
1138
  return 'KakaoTalk'
1065
1139
  case 'github':
@@ -1401,6 +1475,7 @@ async function pickChannel(initial: ChannelChoice | undefined): Promise<StepResu
1401
1475
  { value: 'slack', label: 'Slack' },
1402
1476
  { value: 'discord', label: 'Discord' },
1403
1477
  { value: 'telegram', label: 'Telegram' },
1478
+ { value: 'webex', label: 'Webex (User)' },
1404
1479
  { value: 'kakaotalk', label: 'KakaoTalk' },
1405
1480
  { value: 'github', label: 'GitHub' },
1406
1481
  { value: 'none', label: 'Skip — no channel right now' },
@@ -1426,6 +1501,8 @@ async function runChannelFlow(
1426
1501
  return runSlackFlow()
1427
1502
  case 'telegram':
1428
1503
  return runTelegramFlow()
1504
+ case 'webex':
1505
+ return runWebexUserFlow()
1429
1506
  case 'github':
1430
1507
  return runGithubFlow(cwd)
1431
1508
  }
@@ -1495,6 +1572,43 @@ async function runKakaotalkFlow(): Promise<StepResult<CollectedInputs['channelSe
1495
1572
  }
1496
1573
  }
1497
1574
 
1575
+ async function runWebexUserFlow(): Promise<StepResult<CollectedInputs['channelSecrets']>> {
1576
+ type SubStep = 'email' | 'password'
1577
+ let sub: SubStep = 'email'
1578
+ let email: string | undefined
1579
+
1580
+ note(
1581
+ [
1582
+ 'Logs in headlessly with your Webex email/password.',
1583
+ 'SSO/MFA accounts are not supported. Messages will be sent and received under this account.',
1584
+ ].join('\n'),
1585
+ 'About to log in to Webex',
1586
+ )
1587
+
1588
+ while (true) {
1589
+ if (sub === 'email') {
1590
+ const input = await text({
1591
+ message: 'Webex email',
1592
+ ...(email !== undefined ? { initialValue: email } : {}),
1593
+ validate: (v) => (v && v.length > 0 ? undefined : 'Email is required'),
1594
+ })
1595
+ if (isCancel(input)) return back()
1596
+ email = input
1597
+ sub = 'password'
1598
+ continue
1599
+ }
1600
+ const input = await password({
1601
+ message: 'Webex password',
1602
+ validate: (v) => (v && v.length > 0 ? undefined : 'Password is required'),
1603
+ })
1604
+ if (isCancel(input)) {
1605
+ sub = 'email'
1606
+ continue
1607
+ }
1608
+ return value({ webexEmail: email, webexPassword: input })
1609
+ }
1610
+ }
1611
+
1498
1612
  async function runSlackFlow(): Promise<StepResult<CollectedInputs['channelSecrets']>> {
1499
1613
  type SubStep = 'bot' | 'app'
1500
1614
  let sub: SubStep = 'bot'
@@ -1780,6 +1894,9 @@ function reportProgress(
1780
1894
  case 'kakaotalk-auth':
1781
1895
  s.stop(reportKakaotalkAuth(event.result))
1782
1896
  break
1897
+ case 'webex-auth':
1898
+ s.stop(reportWebexAuth(event.result))
1899
+ break
1783
1900
  case 'github-webhooks':
1784
1901
  s.stop(formatEagerGithubWebhookInstallResult(event.result))
1785
1902
  break
@@ -1843,6 +1960,11 @@ function reportKakaotalkAuth(result: KakaotalkAuthResult): string {
1843
1960
  return `KakaoTalk login failed: ${result.reason}`
1844
1961
  }
1845
1962
 
1963
+ function reportWebexAuth(result: { ok: true } | { ok: false; reason: string }): string {
1964
+ if (result.ok) return 'Webex credentials saved to secrets.json.'
1965
+ return `Webex login failed: ${result.reason}`
1966
+ }
1967
+
1846
1968
  // Hatching launches the container and foregrounds the TUI, so it steals stdin
1847
1969
  // and cannot share the spinner lifecycle with the other steps. Print plain
1848
1970
  // lines instead.
@@ -1922,6 +2044,7 @@ const START_MESSAGES: Record<Exclude<InitStep, 'hatching'>, string> = {
1922
2044
  'oauth-login': 'Waiting for browser login...',
1923
2045
  scaffold: 'Laying the egg...',
1924
2046
  'kakaotalk-auth': 'Logging in to KakaoTalk...',
2047
+ 'webex-auth': 'Logging in to Webex...',
1925
2048
  'github-webhooks': 'Installing GitHub repository webhooks...',
1926
2049
  install: 'Installing dependencies with bun...',
1927
2050
  dockerfile: 'Writing Dockerfile...',
@@ -7,7 +7,16 @@ import { SecretsBackend } from '@/secrets'
7
7
  const CONFIG_FILE = 'typeclaw.json'
8
8
  const SECRETS_FILE = 'secrets.json'
9
9
 
10
- export const CHANNEL_KINDS = ['slack-bot', 'discord-bot', 'telegram-bot', 'line', 'kakaotalk', 'github'] as const
10
+ export const CHANNEL_KINDS = [
11
+ 'slack-bot',
12
+ 'discord-bot',
13
+ 'telegram-bot',
14
+ 'webex',
15
+ 'webex-bot',
16
+ 'line',
17
+ 'kakaotalk',
18
+ 'github',
19
+ ] as const
11
20
 
12
21
  export type ChannelKind = (typeof CHANNEL_KINDS)[number]
13
22
 
@@ -178,7 +187,7 @@ function buildDetail(kind: ChannelKind, channelConfig: unknown, secretsBlock: un
178
187
  const repos = isObjectRecord(channelConfig) && Array.isArray(channelConfig.repos) ? channelConfig.repos.length : 0
179
188
  return { detail: `${repos} repo${repos === 1 ? '' : 's'}` }
180
189
  }
181
- if (kind === 'line' || kind === 'kakaotalk') {
190
+ if (kind === 'line' || kind === 'kakaotalk' || kind === 'webex') {
182
191
  if (!isObjectRecord(secretsBlock)) return {}
183
192
  const accounts = isObjectRecord(secretsBlock.accounts) ? Object.keys(secretsBlock.accounts).length : 0
184
193
  const current = typeof secretsBlock.currentAccount === 'string' ? secretsBlock.currentAccount : undefined
@@ -28,6 +28,8 @@ export function buildChannelChecks(): DoctorCheck[] {
28
28
  slackBotCredentials(),
29
29
  discordBotCredentials(),
30
30
  telegramBotCredentials(),
31
+ webexBotCredentials(),
32
+ webexUserCredentials(),
31
33
  lineCredentials(),
32
34
  kakaotalkCredentials(),
33
35
  githubCredentials(),
@@ -65,6 +67,42 @@ function telegramBotCredentials(): DoctorCheck {
65
67
  }
66
68
  }
67
69
 
70
+ function webexBotCredentials(): DoctorCheck {
71
+ return {
72
+ name: 'channel.webex-bot.credentials',
73
+ category: 'channels',
74
+ description: 'webex-bot adapter has WEBEX_BOT_TOKEN',
75
+ applies: (ctx) => ctx.hasAgentFolder,
76
+ run: (ctx) => runTokenAdapterCheck(ctx, 'webex-bot', ['WEBEX_BOT_TOKEN']),
77
+ }
78
+ }
79
+
80
+ function webexUserCredentials(): DoctorCheck {
81
+ return {
82
+ name: 'channel.webex.credentials',
83
+ category: 'channels',
84
+ description: 'webex adapter has a current account with an access token in secrets.json',
85
+ applies: (ctx) => ctx.hasAgentFolder,
86
+ async run(ctx) {
87
+ const channels = readDeclaredChannels(ctx)
88
+ if (channels === null) return configInvalidResult()
89
+ if (!isAdapterActive(channels, 'webex')) {
90
+ return { status: 'skipped', message: 'webex not configured' }
91
+ }
92
+ const block = readChannelsSecrets(ctx)?.webex
93
+ if (!hasCurrentAccountToken(block)) {
94
+ return {
95
+ status: 'warning',
96
+ message: 'webex has no current account access_token in secrets.json',
97
+ details: ['Adapter will start but fail authentication and stay disconnected.'],
98
+ fix: { description: 'Run `typeclaw channel add webex` to log in an account.' },
99
+ }
100
+ }
101
+ return { status: 'ok', message: 'webex has a current account access_token' }
102
+ },
103
+ }
104
+ }
105
+
68
106
  function lineCredentials(): DoctorCheck {
69
107
  return {
70
108
  name: 'channel.line.credentials',
@@ -216,7 +254,7 @@ function githubWebhookDelivery(): DoctorCheck {
216
254
 
217
255
  async function runTokenAdapterCheck(
218
256
  ctx: CheckContext,
219
- adapter: Extract<AdapterId, 'slack-bot' | 'discord-bot' | 'telegram-bot'>,
257
+ adapter: Extract<AdapterId, 'slack-bot' | 'discord-bot' | 'telegram-bot' | 'webex-bot'>,
220
258
  envNames: readonly string[],
221
259
  ): Promise<CheckResult> {
222
260
  const channels = readDeclaredChannels(ctx)
@@ -297,6 +335,7 @@ function fieldNameForEnv(adapter: AdapterId, envName: string): string | undefine
297
335
  'slack-bot': ['botToken', 'appToken'],
298
336
  'discord-bot': ['token'],
299
337
  'telegram-bot': ['token'],
338
+ 'webex-bot': ['token'],
300
339
  }
301
340
  const fields = candidates[adapter]
302
341
  if (!fields) return undefined
@@ -314,6 +353,22 @@ function isSecretShape(value: unknown): value is { value?: string; env?: string
314
353
  return hasValue || hasEnv
315
354
  }
316
355
 
356
+ function hasCurrentAccountToken(block: unknown): boolean {
357
+ if (!isObjectRecord(block)) return false
358
+ const current = (block as { currentAccount?: unknown }).currentAccount
359
+ if (typeof current !== 'string' || current.length === 0) return false
360
+ const accounts = (block as { accounts?: unknown }).accounts
361
+ if (!isObjectRecord(accounts)) return false
362
+ const account = accounts[current]
363
+ if (!isObjectRecord(account)) return false
364
+ const token = (account as { access_token?: unknown }).access_token
365
+ return typeof token === 'string' && token.length > 0
366
+ }
367
+
368
+ function isObjectRecord(value: unknown): value is Record<string, unknown> {
369
+ return typeof value === 'object' && value !== null && !Array.isArray(value)
370
+ }
371
+
317
372
  function readDeclaredChannels(ctx: CheckContext): ChannelsConfig | null {
318
373
  const cfg = safeLoadConfig(ctx)
319
374
  return cfg?.channels ?? null
@@ -6,7 +6,7 @@ import { join } from 'node:path'
6
6
  import type { PortForward } from '@/config'
7
7
  import { defaultDockerExec, type DockerExec } from '@/container'
8
8
  import type { PortForwardEvent } from '@/portbroker'
9
- import { kakaoChannelBlockSchema, lineChannelBlockSchema } from '@/secrets/schema'
9
+ import { kakaoChannelBlockSchema, lineChannelBlockSchema, webexChannelBlockSchema } from '@/secrets/schema'
10
10
  import { SecretsBackend } from '@/secrets/storage'
11
11
  import { isWindows } from '@/shared'
12
12
 
@@ -450,19 +450,21 @@ export async function startDaemon(opts: DaemonOptions = {}): Promise<Daemon> {
450
450
 
451
451
  const handleSecretsPatch = async (req: {
452
452
  containerName: string
453
- patch: { channels: { kakaotalk: unknown } | { line: unknown } }
453
+ patch: { channels: { kakaotalk: unknown } | { line: unknown } | { webex: unknown } }
454
454
  }): Promise<RpcResponse> =>
455
455
  runSerially(req.containerName, async () => {
456
456
  const cwd = cwds.get(req.containerName)
457
457
  if (!cwd) return { ok: false, reason: `not registered: ${req.containerName}` }
458
458
  const channelsPatch = req.patch?.channels
459
- // Exactly one personal-account channel block per patch. KakaoTalk and
460
- // LINE both write their structured account block through this RPC; the
459
+ // Exactly one personal-account channel block per patch. KakaoTalk, LINE,
460
+ // and Webex write their structured account block through this RPC; the
461
461
  // key present in the patch selects which block to validate and merge.
462
462
  const patch =
463
463
  'line' in channelsPatch
464
464
  ? { key: 'line' as const, parsed: lineChannelBlockSchema.safeParse(channelsPatch.line) }
465
- : { key: 'kakaotalk' as const, parsed: kakaoChannelBlockSchema.safeParse(channelsPatch.kakaotalk) }
465
+ : 'webex' in channelsPatch
466
+ ? { key: 'webex' as const, parsed: webexChannelBlockSchema.safeParse(channelsPatch.webex) }
467
+ : { key: 'kakaotalk' as const, parsed: kakaoChannelBlockSchema.safeParse(channelsPatch.kakaotalk) }
466
468
  if (!patch.parsed.success) {
467
469
  return { ok: false, reason: patch.parsed.error.issues.map((issue) => issue.message).join('; ') }
468
470
  }
@@ -1,5 +1,5 @@
1
1
  import type { PortForward } from '@/config'
2
- import type { KakaoChannelBlock, LineChannelBlock } from '@/secrets/schema'
2
+ import type { KakaoChannelBlock, LineChannelBlock, WebexChannelBlock } from '@/secrets/schema'
3
3
 
4
4
  export type Request =
5
5
  | {
@@ -18,7 +18,7 @@ export type Request =
18
18
  | {
19
19
  kind: 'secrets-patch'
20
20
  containerName: string
21
- patch: { channels: { kakaotalk: KakaoChannelBlock } | { line: LineChannelBlock } }
21
+ patch: { channels: { kakaotalk: KakaoChannelBlock } | { line: LineChannelBlock } | { webex: WebexChannelBlock } }
22
22
  }
23
23
  | { kind: 'http-info' }
24
24
  | { kind: 'version' }
@@ -21,7 +21,7 @@ export const INIT_CHECKPOINT_PATH = join('.typeclaw', 'init-progress.json')
21
21
 
22
22
  export const WIZARD_CHECKPOINT_VERSION = 1
23
23
 
24
- export type WizardChannelChoice = 'slack' | 'discord' | 'telegram' | 'kakaotalk' | 'github' | 'none'
24
+ export type WizardChannelChoice = 'slack' | 'discord' | 'telegram' | 'webex' | 'kakaotalk' | 'github' | 'none'
25
25
 
26
26
  export type AuthMethod = 'api-key' | 'oauth'
27
27