typeclaw 0.37.6 → 0.38.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/README.md +2 -2
- package/package.json +2 -2
- package/src/agent/attention-escalation.ts +590 -0
- package/src/agent/session-origin.ts +11 -7
- package/src/agent/subagents.ts +2 -0
- package/src/agent/system-prompt.ts +2 -2
- package/src/channels/adapters/webex-bot-channel-resolver.ts +29 -0
- package/src/channels/adapters/webex-bot-classify.ts +92 -0
- package/src/channels/adapters/webex-bot-reference.ts +47 -0
- package/src/channels/adapters/webex-bot.ts +395 -0
- package/src/channels/manager.ts +15 -0
- package/src/channels/router.ts +10 -1
- package/src/channels/schema.ts +15 -1
- package/src/cli/channel.ts +38 -2
- package/src/cli/init.ts +67 -6
- package/src/cli/restart.ts +1 -0
- package/src/cli/start.ts +1 -0
- package/src/config/channels-mutation.ts +9 -1
- package/src/config/config.ts +12 -10
- package/src/container/start.ts +17 -4
- package/src/cron/consumer.ts +7 -0
- package/src/doctor/channel-checks.ts +13 -1
- package/src/doctor/checks.ts +13 -1
- package/src/init/dockerfile.ts +51 -3
- package/src/init/index.ts +39 -16
- package/src/init/run-owner-claim.ts +1 -0
- package/src/permissions/match-rule.ts +7 -3
- package/src/permissions/resolve.ts +6 -4
- package/src/role-claim/match-rule.ts +2 -1
- package/src/secrets/defaults.ts +1 -0
- package/src/server/command-runner.ts +2 -0
- package/src/server/index.ts +9 -0
- package/typeclaw.schema.json +161 -1
package/src/init/index.ts
CHANGED
|
@@ -199,6 +199,7 @@ export type InitOptions = {
|
|
|
199
199
|
slackBotToken?: string
|
|
200
200
|
slackAppToken?: string
|
|
201
201
|
telegramBotToken?: string
|
|
202
|
+
webexBotToken?: string
|
|
202
203
|
// When reusing existing channel credentials from a pre-init `secrets.json`,
|
|
203
204
|
// the CLI passes `with<Adapter>: true` without a corresponding token so the
|
|
204
205
|
// scaffolded `typeclaw.json` wires the adapter while `writeSecrets` leaves
|
|
@@ -207,6 +208,7 @@ export type InitOptions = {
|
|
|
207
208
|
withDiscord?: boolean
|
|
208
209
|
withSlack?: boolean
|
|
209
210
|
withTelegram?: boolean
|
|
211
|
+
withWebex?: boolean
|
|
210
212
|
withKakaotalk?: boolean
|
|
211
213
|
withGithub?: boolean
|
|
212
214
|
runKakaotalkAuth?: KakaotalkAuthRunner
|
|
@@ -243,9 +245,11 @@ export async function runInit({
|
|
|
243
245
|
slackBotToken,
|
|
244
246
|
slackAppToken,
|
|
245
247
|
telegramBotToken,
|
|
248
|
+
webexBotToken,
|
|
246
249
|
withDiscord,
|
|
247
250
|
withSlack,
|
|
248
251
|
withTelegram,
|
|
252
|
+
withWebex,
|
|
249
253
|
withKakaotalk = false,
|
|
250
254
|
withGithub = false,
|
|
251
255
|
runKakaotalkAuth,
|
|
@@ -314,6 +318,7 @@ export async function runInit({
|
|
|
314
318
|
const wantsDiscord = withDiscord ?? (discordBotToken !== undefined && discordBotToken !== '')
|
|
315
319
|
const wantsSlack = withSlack ?? (slackBotToken !== undefined && slackBotToken !== '')
|
|
316
320
|
const wantsTelegram = withTelegram ?? (telegramBotToken !== undefined && telegramBotToken !== '')
|
|
321
|
+
const wantsWebex = withWebex ?? (webexBotToken !== undefined && webexBotToken !== '')
|
|
317
322
|
emit({ step: 'scaffold', phase: 'start' })
|
|
318
323
|
await scaffold(cwd, {
|
|
319
324
|
model,
|
|
@@ -323,6 +328,7 @@ export async function runInit({
|
|
|
323
328
|
withDiscord: wantsDiscord,
|
|
324
329
|
withSlack: wantsSlack,
|
|
325
330
|
withTelegram: wantsTelegram,
|
|
331
|
+
withWebex: wantsWebex,
|
|
326
332
|
withKakaotalk,
|
|
327
333
|
})
|
|
328
334
|
// Only write the LLM API key on the api-key path. OAuth providers persist
|
|
@@ -338,6 +344,7 @@ export async function runInit({
|
|
|
338
344
|
slackBotToken,
|
|
339
345
|
slackAppToken,
|
|
340
346
|
telegramBotToken,
|
|
347
|
+
webexBotToken,
|
|
341
348
|
})
|
|
342
349
|
emit({ step: 'scaffold', phase: 'done' })
|
|
343
350
|
|
|
@@ -398,6 +405,7 @@ export async function runInit({
|
|
|
398
405
|
if (wantsDiscord) configuredChannels.push('discord-bot')
|
|
399
406
|
if (wantsSlack) configuredChannels.push('slack-bot')
|
|
400
407
|
if (wantsTelegram) configuredChannels.push('telegram-bot')
|
|
408
|
+
if (wantsWebex) configuredChannels.push('webex-bot')
|
|
401
409
|
if (withKakaotalk) configuredChannels.push('kakaotalk')
|
|
402
410
|
if (withGithub) configuredChannels.push('github')
|
|
403
411
|
|
|
@@ -551,6 +559,7 @@ export type ScaffoldOptions = {
|
|
|
551
559
|
withDiscord?: boolean
|
|
552
560
|
withSlack?: boolean
|
|
553
561
|
withTelegram?: boolean
|
|
562
|
+
withWebex?: boolean
|
|
554
563
|
withKakaotalk?: boolean
|
|
555
564
|
}
|
|
556
565
|
|
|
@@ -583,6 +592,7 @@ export async function scaffold(root: string, options: ScaffoldOptions = {}): Pro
|
|
|
583
592
|
if (options.withDiscord) channels['discord-bot'] = {}
|
|
584
593
|
if (options.withSlack) channels['slack-bot'] = {}
|
|
585
594
|
if (options.withTelegram) channels['telegram-bot'] = {}
|
|
595
|
+
if (options.withWebex) channels['webex-bot'] = {}
|
|
586
596
|
if (options.withKakaotalk) channels.kakaotalk = {}
|
|
587
597
|
if (Object.keys(channels).length > 0) config.channels = channels
|
|
588
598
|
// No default `member` match is seeded. A fresh chat agent starts with every
|
|
@@ -796,6 +806,7 @@ export async function writeSecrets(
|
|
|
796
806
|
slackBotToken,
|
|
797
807
|
slackAppToken,
|
|
798
808
|
telegramBotToken,
|
|
809
|
+
webexBotToken,
|
|
799
810
|
}: {
|
|
800
811
|
model?: ModelRef | string
|
|
801
812
|
// Omitted on the OAuth path — credentials live in secrets.json via the OAuth runner.
|
|
@@ -806,6 +817,7 @@ export async function writeSecrets(
|
|
|
806
817
|
slackBotToken?: string
|
|
807
818
|
slackAppToken?: string
|
|
808
819
|
telegramBotToken?: string
|
|
820
|
+
webexBotToken?: string
|
|
809
821
|
},
|
|
810
822
|
): Promise<void> {
|
|
811
823
|
const providerId = providerForModelRef(model)
|
|
@@ -839,6 +851,9 @@ export async function writeSecrets(
|
|
|
839
851
|
if (telegramBotToken !== undefined && telegramBotToken !== '') {
|
|
840
852
|
channelTokens['telegram-bot'] = { token: { value: telegramBotToken } }
|
|
841
853
|
}
|
|
854
|
+
if (webexBotToken !== undefined && webexBotToken !== '') {
|
|
855
|
+
channelTokens['webex-bot'] = { token: { value: webexBotToken } }
|
|
856
|
+
}
|
|
842
857
|
if (Object.keys(channelTokens).length === 0) return
|
|
843
858
|
|
|
844
859
|
const backend = new SecretsBackend(join(root, 'secrets.json'))
|
|
@@ -865,18 +880,19 @@ export async function readExistingProviderApiKey(root: string, providerId: Known
|
|
|
865
880
|
// browser login entirely instead of dragging them through a second OAuth
|
|
866
881
|
// flow.
|
|
867
882
|
//
|
|
868
|
-
// Mirrors `readExistingProviderApiKey`'s contract — returns `false` when
|
|
869
|
-
//
|
|
870
|
-
//
|
|
871
|
-
//
|
|
872
|
-
//
|
|
873
|
-
//
|
|
883
|
+
// Mirrors `readExistingProviderApiKey`'s contract — returns `false` when the
|
|
884
|
+
// provider has no OAuth support, the file is missing, the slot is api-key
|
|
885
|
+
// shaped, or the access token is absent/blank.
|
|
886
|
+
//
|
|
887
|
+
// The token lives under `access` — pi-ai's secrets.json shape (`{ type:
|
|
888
|
+
// 'oauth', access, refresh, expires, accountId }`), the same field
|
|
889
|
+
// `export-codex-auth-file.ts` reads. NOT `access_token`: that key belongs to
|
|
890
|
+
// the unrelated `~/.codex/auth.json` export (`{ tokens: { access_token } }`).
|
|
891
|
+
// Reading `access_token` here silently returned false for every real
|
|
892
|
+
// credential, re-running the browser login on resume instead of reusing it.
|
|
874
893
|
//
|
|
875
|
-
//
|
|
876
|
-
//
|
|
877
|
-
// and surfacing an "expired token" check at init-time would require a
|
|
878
|
-
// network call we'd rather not run during a wizard. The runtime will fall
|
|
879
|
-
// back to OAuth login on use if refresh fails; that's a separate UX path.
|
|
894
|
+
// Freshness is intentionally not checked: pi-ai refreshes on first use, and a
|
|
895
|
+
// network call mid-wizard isn't worth it.
|
|
880
896
|
export async function hasExistingOAuthCredentials(root: string, providerId: KnownProviderId): Promise<boolean> {
|
|
881
897
|
const provider = KNOWN_PROVIDERS[providerId]
|
|
882
898
|
if (provider.oauthProviderId === null) return false
|
|
@@ -885,8 +901,8 @@ export async function hasExistingOAuthCredentials(root: string, providerId: Know
|
|
|
885
901
|
const credential = providers[provider.oauthProviderId]
|
|
886
902
|
if (credential === undefined) return false
|
|
887
903
|
if (credential.type !== 'oauth') return false
|
|
888
|
-
const
|
|
889
|
-
return typeof
|
|
904
|
+
const access = (credential as { access?: unknown }).access
|
|
905
|
+
return typeof access === 'string' && access.trim().length > 0
|
|
890
906
|
}
|
|
891
907
|
|
|
892
908
|
// Detects whether the requested channel already has usable credentials in
|
|
@@ -908,7 +924,7 @@ export async function hasExistingOAuthCredentials(root: string, providerId: Know
|
|
|
908
924
|
// kakaotalk` anyway — better to re-auth now during init.
|
|
909
925
|
export async function hasExistingChannelSecrets(
|
|
910
926
|
root: string,
|
|
911
|
-
channel: 'discord' | 'slack' | 'telegram' | 'line' | 'kakaotalk' | 'github',
|
|
927
|
+
channel: 'discord' | 'slack' | 'telegram' | 'webex' | 'line' | 'kakaotalk' | 'github',
|
|
912
928
|
): Promise<boolean> {
|
|
913
929
|
const channels = new SecretsBackend(join(root, 'secrets.json')).tryReadChannelsSync()
|
|
914
930
|
if (channels === null) return false
|
|
@@ -919,6 +935,8 @@ export async function hasExistingChannelSecrets(
|
|
|
919
935
|
return hasSecretField(channels['slack-bot'], 'botToken') && hasSecretField(channels['slack-bot'], 'appToken')
|
|
920
936
|
case 'telegram':
|
|
921
937
|
return hasSecretField(channels['telegram-bot'], 'token')
|
|
938
|
+
case 'webex':
|
|
939
|
+
return hasSecretField(channels['webex-bot'], 'token')
|
|
922
940
|
case 'github':
|
|
923
941
|
// GitHub credentials alone are not enough to scaffold a working
|
|
924
942
|
// channel: typeclaw.json#channels.github also needs webhookUrl and
|
|
@@ -1013,7 +1031,7 @@ function ignoreExists(error: NodeJS.ErrnoException): void {
|
|
|
1013
1031
|
// scaffold-test cases above demonstrates how easy it is to lose a single
|
|
1014
1032
|
// behavior under a mode flag.
|
|
1015
1033
|
|
|
1016
|
-
export type ChannelKind = 'discord-bot' | 'slack-bot' | 'telegram-bot' | 'line' | 'kakaotalk' | 'github'
|
|
1034
|
+
export type ChannelKind = 'discord-bot' | 'slack-bot' | 'telegram-bot' | 'webex-bot' | 'line' | 'kakaotalk' | 'github'
|
|
1017
1035
|
|
|
1018
1036
|
// Public adapter names match the typeclaw.json `channels.*` keys exactly.
|
|
1019
1037
|
// The CLI takes these as the optional positional arg, the picker shows
|
|
@@ -1023,6 +1041,7 @@ export const CHANNEL_KINDS: ReadonlyArray<ChannelKind> = [
|
|
|
1023
1041
|
'slack-bot',
|
|
1024
1042
|
'discord-bot',
|
|
1025
1043
|
'telegram-bot',
|
|
1044
|
+
'webex-bot',
|
|
1026
1045
|
'line',
|
|
1027
1046
|
'kakaotalk',
|
|
1028
1047
|
'github',
|
|
@@ -1052,6 +1071,7 @@ export type AddChannelOptions = {
|
|
|
1052
1071
|
| { channel: 'discord-bot'; discordBotToken: string }
|
|
1053
1072
|
| { channel: 'slack-bot'; slackBotToken: string; slackAppToken: string }
|
|
1054
1073
|
| { channel: 'telegram-bot'; telegramBotToken: string }
|
|
1074
|
+
| { channel: 'webex-bot'; webexBotToken: string }
|
|
1055
1075
|
| { channel: 'line'; runLineAuth: LineAuthRunner }
|
|
1056
1076
|
| { channel: 'kakaotalk'; runKakaotalkAuth: KakaotalkAuthRunner }
|
|
1057
1077
|
| {
|
|
@@ -1165,6 +1185,8 @@ function channelSecretsFromOptions(options: AddChannelOptions): ChannelSecrets {
|
|
|
1165
1185
|
return { botToken: options.slackBotToken, appToken: options.slackAppToken }
|
|
1166
1186
|
case 'telegram-bot':
|
|
1167
1187
|
return { token: options.telegramBotToken }
|
|
1188
|
+
case 'webex-bot':
|
|
1189
|
+
return { token: options.webexBotToken }
|
|
1168
1190
|
case 'line':
|
|
1169
1191
|
// LINE auth writes its structured account block directly to
|
|
1170
1192
|
// secrets.json#channels.line before config mutation.
|
|
@@ -1448,7 +1470,7 @@ async function appendChannelSecrets(cwd: string, channel: ChannelKind, tokens: C
|
|
|
1448
1470
|
|
|
1449
1471
|
export type SetChannelTokensResult = { ok: true } | { ok: false; reason: string }
|
|
1450
1472
|
|
|
1451
|
-
type BotTokenAdapter = 'discord-bot' | 'slack-bot' | 'telegram-bot'
|
|
1473
|
+
type BotTokenAdapter = 'discord-bot' | 'slack-bot' | 'telegram-bot' | 'webex-bot'
|
|
1452
1474
|
|
|
1453
1475
|
// Required credential fields per adapter. Used post-merge to refuse a
|
|
1454
1476
|
// rotation that would leave the adapter half-configured — e.g. rotating
|
|
@@ -1459,6 +1481,7 @@ const REQUIRED_CHANNEL_FIELDS: Record<BotTokenAdapter, readonly string[]> = {
|
|
|
1459
1481
|
'discord-bot': ['token'],
|
|
1460
1482
|
'slack-bot': ['botToken', 'appToken'],
|
|
1461
1483
|
'telegram-bot': ['token'],
|
|
1484
|
+
'webex-bot': ['token'],
|
|
1462
1485
|
}
|
|
1463
1486
|
|
|
1464
1487
|
// Preserve a user-authored `{ env: 'CUSTOM_NAME' }` rebinding when rotating
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
// error messages with typo suggestions; a single big regex would only ever
|
|
17
17
|
// say "didn't match".
|
|
18
18
|
|
|
19
|
-
export const PLATFORMS = ['slack', 'discord', 'telegram', 'line', 'kakao', 'github'] as const
|
|
19
|
+
export const PLATFORMS = ['slack', 'discord', 'telegram', 'webex', 'line', 'kakao', 'github'] as const
|
|
20
20
|
export type Platform = (typeof PLATFORMS)[number]
|
|
21
21
|
|
|
22
22
|
const SUBAGENT_NAME = /^[a-z][a-z0-9-]*$/
|
|
@@ -50,8 +50,12 @@ export type ParseMatchRuleResult = { ok: true; value: MatchRule } | { ok: false;
|
|
|
50
50
|
// run and emit typo suggestions like `autor:` -> `author:`. If we tightened
|
|
51
51
|
// this to `author:` only, the JSON schema would reject typos with a generic
|
|
52
52
|
// "did not match pattern" error and the user would lose the actionable hint.
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
//
|
|
54
|
+
// The platform alternation is derived from PLATFORMS so a newly added
|
|
55
|
+
// platform can never validate at the parser but be rejected by this schema
|
|
56
|
+
// regex (the bug that shipped when 'webex' was added to PLATFORMS but not
|
|
57
|
+
// here).
|
|
58
|
+
export const MATCH_RULE_REGEX_SOURCE = `^(tui|cron|subagent(:[a-z][a-z0-9-]*)?|\\*|(${PLATFORMS.join('|')}):[^\\s]+)(\\s+[a-zA-Z][a-zA-Z0-9_]*:[^\\s]+)*$`
|
|
55
59
|
|
|
56
60
|
export function parseMatchRule(input: string): ParseMatchRuleResult {
|
|
57
61
|
if (input !== input.trim() || input.length === 0) {
|
|
@@ -7,6 +7,7 @@ const ADAPTER_TO_PLATFORM: Record<AdapterId, Platform> = {
|
|
|
7
7
|
'discord-bot': 'discord',
|
|
8
8
|
github: 'github',
|
|
9
9
|
'telegram-bot': 'telegram',
|
|
10
|
+
'webex-bot': 'webex',
|
|
10
11
|
line: 'line',
|
|
11
12
|
kakaotalk: 'kakao',
|
|
12
13
|
}
|
|
@@ -57,12 +58,12 @@ function matchesChannel(rule: Extract<MatchRule, { kind: 'channel' }>, origin: M
|
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
// DM and group buckets are inferred from the workspace/chat shape of the
|
|
60
|
-
// inbound origin. Different adapters mark DMs differently — Slack
|
|
61
|
-
// `@dm` workspace marker
|
|
61
|
+
// inbound origin. Different adapters mark DMs differently — Slack and Webex
|
|
62
|
+
// use an `@dm` workspace marker, Discord uses a `dm` workspace marker, and
|
|
62
63
|
// KakaoTalk preserves group/open/dm explicitly in its workspace field. We
|
|
63
64
|
// keep the heuristic narrow: a rule that says `slack:dm/*` matches only when
|
|
64
|
-
// the origin's workspace is `@dm` (Slack) or `dm` (Discord). KakaoTalk
|
|
65
|
-
// the workspace prefix itself.
|
|
65
|
+
// the origin's workspace is `@dm` (Slack/Webex) or `dm` (Discord). KakaoTalk
|
|
66
|
+
// uses the workspace prefix itself.
|
|
66
67
|
function matchesBucket(
|
|
67
68
|
bucket: 'dm' | 'group' | 'open' | 'square',
|
|
68
69
|
origin: Extract<MatchableOrigin, { kind: 'channel' }>,
|
|
@@ -84,6 +85,7 @@ function matchesBucket(
|
|
|
84
85
|
if (platform === 'slack') return origin.workspace === '@dm'
|
|
85
86
|
if (platform === 'discord') return origin.workspace === 'dm' || origin.workspace === '@dm'
|
|
86
87
|
if (platform === 'telegram') return origin.workspace === 'dm' || origin.workspace.startsWith('@')
|
|
88
|
+
if (platform === 'webex') return origin.workspace === '@dm'
|
|
87
89
|
return false
|
|
88
90
|
}
|
|
89
91
|
|
|
@@ -27,12 +27,13 @@ export type PartialChannelOrigin = {
|
|
|
27
27
|
|
|
28
28
|
const ADAPTER_TO_PLATFORM: Record<
|
|
29
29
|
ChannelKey['adapter'],
|
|
30
|
-
'slack' | 'discord' | 'telegram' | 'kakao' | 'line' | 'github'
|
|
30
|
+
'slack' | 'discord' | 'telegram' | 'webex' | 'kakao' | 'line' | 'github'
|
|
31
31
|
> = {
|
|
32
32
|
'slack-bot': 'slack',
|
|
33
33
|
'discord-bot': 'discord',
|
|
34
34
|
github: 'github',
|
|
35
35
|
'telegram-bot': 'telegram',
|
|
36
|
+
'webex-bot': 'webex',
|
|
36
37
|
line: 'line',
|
|
37
38
|
kakaotalk: 'kakao',
|
|
38
39
|
}
|
package/src/secrets/defaults.ts
CHANGED
|
@@ -19,6 +19,7 @@ export const CHANNEL_FIELD_ENV = {
|
|
|
19
19
|
'discord-bot': { token: 'DISCORD_BOT_TOKEN' },
|
|
20
20
|
'slack-bot': { botToken: 'SLACK_BOT_TOKEN', appToken: 'SLACK_APP_TOKEN' },
|
|
21
21
|
'telegram-bot': { token: 'TELEGRAM_BOT_TOKEN' },
|
|
22
|
+
'webex-bot': { token: 'WEBEX_BOT_TOKEN' },
|
|
22
23
|
} as const satisfies Record<string, Record<string, string>>
|
|
23
24
|
|
|
24
25
|
export type KnownAdapterId = keyof typeof CHANNEL_FIELD_ENV
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
type CreateSessionResult,
|
|
6
6
|
type SessionOrigin,
|
|
7
7
|
} from '@/agent'
|
|
8
|
+
import { applyTurnThinkingLevel } from '@/agent/attention-escalation'
|
|
8
9
|
import type { ChannelRouter } from '@/channels/router'
|
|
9
10
|
import type { McpManager } from '@/mcp'
|
|
10
11
|
import type { PermissionService } from '@/permissions'
|
|
@@ -431,6 +432,7 @@ export async function runPromptForCommand(args: {
|
|
|
431
432
|
retrievalContext.results.length > 0
|
|
432
433
|
? `${renderTurnTimeAnchor()}\n\n${args.text}\n\n${retrievalContext.results}`
|
|
433
434
|
: `${renderTurnTimeAnchor()}\n\n${args.text}`
|
|
435
|
+
applyTurnThinkingLevel(session, args.text, session.thinkingLevel)
|
|
434
436
|
try {
|
|
435
437
|
await session.prompt(turnText)
|
|
436
438
|
} finally {
|
package/src/server/index.ts
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
type CreateSessionOptions,
|
|
9
9
|
type CreateSessionResult,
|
|
10
10
|
} from '@/agent'
|
|
11
|
+
import { applyTurnThinkingLevel } from '@/agent/attention-escalation'
|
|
11
12
|
import { runPluginDoctorChecks, runPluginDoctorFix } from '@/agent/doctor'
|
|
12
13
|
import type { LiveSessionRegistry } from '@/agent/live-sessions'
|
|
13
14
|
import type { LiveSubagentRegistry } from '@/agent/live-subagents'
|
|
@@ -174,6 +175,11 @@ type QueuedPrompt = {
|
|
|
174
175
|
|
|
175
176
|
type SessionState = {
|
|
176
177
|
session: AgentSession
|
|
178
|
+
// The session's creation-time thinking level, captured once. An escalated turn
|
|
179
|
+
// moves `session.thinkingLevel` to `high`, so neither turn-driving path (drain
|
|
180
|
+
// loop, no-stream fallback) can use the live getter as the reset target — both
|
|
181
|
+
// read this captured default instead.
|
|
182
|
+
turnThinkingDefault: AgentSession['thinkingLevel']
|
|
177
183
|
sessionFileId: string
|
|
178
184
|
origin: SessionOrigin
|
|
179
185
|
sessionManager: { getSessionFile: () => string | undefined } | undefined
|
|
@@ -518,6 +524,7 @@ export function createServer({
|
|
|
518
524
|
|
|
519
525
|
const state: SessionState = {
|
|
520
526
|
session,
|
|
527
|
+
turnThinkingDefault: session.thinkingLevel,
|
|
521
528
|
sessionFileId,
|
|
522
529
|
origin,
|
|
523
530
|
sessionManager,
|
|
@@ -782,6 +789,7 @@ export function createServer({
|
|
|
782
789
|
retrievalContext.results.length > 0
|
|
783
790
|
? `${renderTurnTimeAnchor()}\n\n${msg.text}\n\n${retrievalContext.results}`
|
|
784
791
|
: `${renderTurnTimeAnchor()}\n\n${msg.text}`
|
|
792
|
+
applyTurnThinkingLevel(state.session, msg.text, state.turnThinkingDefault)
|
|
785
793
|
await state.session.prompt(turnText)
|
|
786
794
|
send(ws, doneMessage(state))
|
|
787
795
|
} catch (err) {
|
|
@@ -1086,6 +1094,7 @@ async function drain(
|
|
|
1086
1094
|
retrievalContext.results.length > 0
|
|
1087
1095
|
? `${renderTurnTimeAnchor()}\n\n${item.text}\n\n${retrievalContext.results}`
|
|
1088
1096
|
: `${renderTurnTimeAnchor()}\n\n${item.text}`
|
|
1097
|
+
applyTurnThinkingLevel(state.session, item.text, state.turnThinkingDefault)
|
|
1089
1098
|
await state.session.prompt(turnText)
|
|
1090
1099
|
send(ws, doneMessage(state))
|
|
1091
1100
|
} catch (err) {
|
package/typeclaw.schema.json
CHANGED
|
@@ -1319,6 +1319,166 @@
|
|
|
1319
1319
|
}
|
|
1320
1320
|
}
|
|
1321
1321
|
}
|
|
1322
|
+
},
|
|
1323
|
+
"webex-bot": {
|
|
1324
|
+
"type": "object",
|
|
1325
|
+
"properties": {
|
|
1326
|
+
"engagement": {
|
|
1327
|
+
"default": {
|
|
1328
|
+
"trigger": [
|
|
1329
|
+
"mention",
|
|
1330
|
+
"reply",
|
|
1331
|
+
"dm"
|
|
1332
|
+
],
|
|
1333
|
+
"stickiness": {
|
|
1334
|
+
"perReply": {
|
|
1335
|
+
"window": 900000
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
},
|
|
1339
|
+
"type": "object",
|
|
1340
|
+
"properties": {
|
|
1341
|
+
"trigger": {
|
|
1342
|
+
"default": [
|
|
1343
|
+
"mention",
|
|
1344
|
+
"reply",
|
|
1345
|
+
"dm"
|
|
1346
|
+
],
|
|
1347
|
+
"type": "array",
|
|
1348
|
+
"items": {
|
|
1349
|
+
"type": "string",
|
|
1350
|
+
"enum": [
|
|
1351
|
+
"mention",
|
|
1352
|
+
"reply",
|
|
1353
|
+
"dm"
|
|
1354
|
+
]
|
|
1355
|
+
}
|
|
1356
|
+
},
|
|
1357
|
+
"stickiness": {
|
|
1358
|
+
"default": {
|
|
1359
|
+
"perReply": {
|
|
1360
|
+
"window": 900000
|
|
1361
|
+
}
|
|
1362
|
+
},
|
|
1363
|
+
"anyOf": [
|
|
1364
|
+
{
|
|
1365
|
+
"type": "string",
|
|
1366
|
+
"const": "off"
|
|
1367
|
+
},
|
|
1368
|
+
{
|
|
1369
|
+
"type": "object",
|
|
1370
|
+
"properties": {
|
|
1371
|
+
"perReply": {
|
|
1372
|
+
"type": "object",
|
|
1373
|
+
"properties": {
|
|
1374
|
+
"window": {
|
|
1375
|
+
"type": "integer",
|
|
1376
|
+
"minimum": 1,
|
|
1377
|
+
"maximum": 86400000
|
|
1378
|
+
}
|
|
1379
|
+
},
|
|
1380
|
+
"required": [
|
|
1381
|
+
"window"
|
|
1382
|
+
]
|
|
1383
|
+
}
|
|
1384
|
+
},
|
|
1385
|
+
"required": [
|
|
1386
|
+
"perReply"
|
|
1387
|
+
]
|
|
1388
|
+
}
|
|
1389
|
+
]
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
},
|
|
1393
|
+
"history": {
|
|
1394
|
+
"default": {
|
|
1395
|
+
"prefetch": {
|
|
1396
|
+
"thread": {
|
|
1397
|
+
"head": 3,
|
|
1398
|
+
"tail": 10
|
|
1399
|
+
},
|
|
1400
|
+
"channel": {
|
|
1401
|
+
"tail": 10
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
},
|
|
1405
|
+
"type": "object",
|
|
1406
|
+
"properties": {
|
|
1407
|
+
"prefetch": {
|
|
1408
|
+
"default": {
|
|
1409
|
+
"thread": {
|
|
1410
|
+
"head": 3,
|
|
1411
|
+
"tail": 10
|
|
1412
|
+
},
|
|
1413
|
+
"channel": {
|
|
1414
|
+
"tail": 10
|
|
1415
|
+
}
|
|
1416
|
+
},
|
|
1417
|
+
"type": "object",
|
|
1418
|
+
"properties": {
|
|
1419
|
+
"thread": {
|
|
1420
|
+
"default": {
|
|
1421
|
+
"head": 3,
|
|
1422
|
+
"tail": 10
|
|
1423
|
+
},
|
|
1424
|
+
"type": "object",
|
|
1425
|
+
"properties": {
|
|
1426
|
+
"head": {
|
|
1427
|
+
"default": 3,
|
|
1428
|
+
"type": "integer",
|
|
1429
|
+
"minimum": 0,
|
|
1430
|
+
"maximum": 200
|
|
1431
|
+
},
|
|
1432
|
+
"tail": {
|
|
1433
|
+
"default": 10,
|
|
1434
|
+
"type": "integer",
|
|
1435
|
+
"minimum": 0,
|
|
1436
|
+
"maximum": 200
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1439
|
+
},
|
|
1440
|
+
"channel": {
|
|
1441
|
+
"default": {
|
|
1442
|
+
"tail": 10
|
|
1443
|
+
},
|
|
1444
|
+
"type": "object",
|
|
1445
|
+
"properties": {
|
|
1446
|
+
"tail": {
|
|
1447
|
+
"default": 10,
|
|
1448
|
+
"type": "integer",
|
|
1449
|
+
"minimum": 0,
|
|
1450
|
+
"maximum": 200
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
}
|
|
1454
|
+
}
|
|
1455
|
+
}
|
|
1456
|
+
}
|
|
1457
|
+
},
|
|
1458
|
+
"enabled": {
|
|
1459
|
+
"default": true,
|
|
1460
|
+
"type": "boolean"
|
|
1461
|
+
},
|
|
1462
|
+
"quotedReply": {
|
|
1463
|
+
"default": {
|
|
1464
|
+
"enabled": true,
|
|
1465
|
+
"queueDelayMs": 10000
|
|
1466
|
+
},
|
|
1467
|
+
"type": "object",
|
|
1468
|
+
"properties": {
|
|
1469
|
+
"enabled": {
|
|
1470
|
+
"default": true,
|
|
1471
|
+
"type": "boolean"
|
|
1472
|
+
},
|
|
1473
|
+
"queueDelayMs": {
|
|
1474
|
+
"default": 10000,
|
|
1475
|
+
"type": "integer",
|
|
1476
|
+
"minimum": 0,
|
|
1477
|
+
"maximum": 9007199254740991
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1322
1482
|
}
|
|
1323
1483
|
}
|
|
1324
1484
|
},
|
|
@@ -1573,7 +1733,7 @@
|
|
|
1573
1733
|
"type": "array",
|
|
1574
1734
|
"items": {
|
|
1575
1735
|
"type": "string",
|
|
1576
|
-
"pattern": "^(tui|cron|subagent(:[a-z][a-z0-9-]*)?|\\*|(slack|discord|telegram|line|kakao|github):[^\\s]+)(\\s+[a-zA-Z][a-zA-Z0-9_]*:[^\\s]+)*$"
|
|
1736
|
+
"pattern": "^(tui|cron|subagent(:[a-z][a-z0-9-]*)?|\\*|(slack|discord|telegram|webex|line|kakao|github):[^\\s]+)(\\s+[a-zA-Z][a-zA-Z0-9_]*:[^\\s]+)*$"
|
|
1577
1737
|
}
|
|
1578
1738
|
},
|
|
1579
1739
|
"permissions": {
|