typeclaw 0.43.1 → 0.45.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 +1 -1
- package/auth.schema.json +92 -0
- package/package.json +7 -6
- package/secrets.schema.json +92 -0
- package/src/agent/index.ts +25 -2
- package/src/agent/model-fallback.ts +59 -40
- package/src/agent/multimodal/look-at.ts +29 -10
- package/src/agent/plugin-tools.ts +9 -4
- package/src/agent/provider-error.ts +71 -18
- package/src/agent/retry-same-ref.ts +139 -0
- package/src/agent/session-origin.ts +1 -0
- package/src/agent/subagents.ts +6 -2
- package/src/agent/tools/channel-edit.ts +144 -0
- package/src/agent/tools/channel-fetch-attachment.ts +51 -8
- package/src/agent/tools/channel-reply.ts +41 -18
- package/src/agent/tools/channel-send.ts +82 -13
- package/src/agent/tools/curl-impersonate.ts +40 -1
- package/src/agent/tools/webfetch/fetch.ts +86 -3
- package/src/agent/tools/webfetch/tool.ts +26 -3
- package/src/agent/tools/webfetch/types.ts +8 -0
- package/src/agent/turn-runner.ts +65 -36
- package/src/bundled-plugins/agent-browser/skills/agent-browser/SKILL.md +28 -11
- package/src/bundled-plugins/github-cli-auth/gh-review-detect.ts +101 -1
- package/src/bundled-plugins/github-cli-auth/review-recorder.ts +44 -3
- package/src/bundled-plugins/guard/policies/managed-config.ts +20 -4
- package/src/bundled-plugins/memory/README.md +9 -9
- package/src/bundled-plugins/memory/index.ts +40 -9
- package/src/bundled-plugins/reviewer/skills/code-review.ts +22 -2
- package/src/channels/adapters/discord-bot-edit.ts +49 -0
- package/src/channels/adapters/discord-bot.ts +5 -0
- package/src/channels/adapters/discord-edit.ts +51 -0
- package/src/channels/adapters/discord.ts +4 -0
- package/src/channels/adapters/github/inbound.ts +20 -14
- package/src/channels/adapters/github/review-thread-resolver.ts +38 -4
- package/src/channels/adapters/slack-bot-edit.ts +58 -0
- package/src/channels/adapters/slack-bot.ts +18 -6
- package/src/channels/adapters/slack-edit.ts +47 -0
- package/src/channels/adapters/slack.ts +5 -0
- package/src/channels/adapters/teams-classify.ts +144 -0
- package/src/channels/adapters/teams-edit.ts +61 -0
- package/src/channels/adapters/teams-id-token.ts +112 -0
- package/src/channels/adapters/teams-key.ts +32 -0
- package/src/channels/adapters/teams.ts +523 -0
- package/src/channels/adapters/telegram-bot-edit.ts +51 -0
- package/src/channels/adapters/telegram-bot.ts +5 -0
- package/src/channels/adapters/webex-bot.ts +5 -0
- package/src/channels/adapters/webex-edit.ts +47 -0
- package/src/channels/adapters/webex.ts +5 -0
- package/src/channels/continuation-willingness.ts +227 -35
- package/src/channels/github-review-turn-ledger.ts +43 -0
- package/src/channels/index.ts +1 -1
- package/src/channels/manager.ts +54 -1
- package/src/channels/router.ts +482 -53
- package/src/channels/schema.ts +33 -0
- package/src/channels/types.ts +36 -0
- package/src/cli/channel.ts +92 -4
- package/src/cli/hostd.ts +41 -0
- package/src/cli/init.ts +58 -1
- package/src/config/channels-mutation.ts +9 -1
- package/src/cron/index.ts +16 -4
- package/src/cron/reloadable.ts +25 -7
- package/src/cron/scheduler.ts +4 -0
- package/src/cron/schema.ts +143 -35
- package/src/doctor/channel-checks.ts +27 -0
- package/src/hostd/daemon.ts +23 -3
- package/src/hostd/protocol.ts +2 -0
- package/src/hostd/teams-renewal-manager.ts +212 -0
- package/src/init/checkpoint.ts +1 -1
- package/src/init/index.ts +68 -1
- package/src/init/run-owner-claim.ts +1 -0
- package/src/init/teams-auth.ts +111 -0
- package/src/inspect/label.ts +4 -0
- package/src/permissions/match-rule.ts +11 -1
- package/src/permissions/resolve.ts +1 -0
- package/src/role-claim/match-rule.ts +2 -1
- package/src/run/index.ts +35 -8
- package/src/run/llm-fetch-observer.ts +27 -5
- package/src/sandbox/build.ts +12 -0
- package/src/sandbox/policy.ts +13 -0
- package/src/sandbox/writable-zones.ts +46 -10
- package/src/secrets/schema.ts +32 -0
- package/src/secrets/teams-renewal.ts +229 -0
- package/src/secrets/teams-store.ts +108 -0
- package/src/server/command-runner.ts +2 -1
- package/src/server/index.ts +2 -1
- package/typeclaw.schema.json +163 -3
package/src/channels/schema.ts
CHANGED
|
@@ -9,6 +9,7 @@ export const ADAPTER_IDS = [
|
|
|
9
9
|
'kakaotalk',
|
|
10
10
|
'slack',
|
|
11
11
|
'slack-bot',
|
|
12
|
+
'teams',
|
|
12
13
|
'telegram-bot',
|
|
13
14
|
'webex',
|
|
14
15
|
'webex-bot',
|
|
@@ -35,11 +36,36 @@ export const ADAPTER_READ_CAPABILITIES: Record<AdapterId, readonly ReadCapabilit
|
|
|
35
36
|
kakaotalk: ['history'],
|
|
36
37
|
slack: ['history'],
|
|
37
38
|
'slack-bot': ['history', 'message-get', 'list'],
|
|
39
|
+
teams: ['history'],
|
|
38
40
|
'telegram-bot': [],
|
|
39
41
|
webex: ['history'],
|
|
40
42
|
'webex-bot': ['history'],
|
|
41
43
|
}
|
|
42
44
|
|
|
45
|
+
export type WriteCapability = 'message-edit'
|
|
46
|
+
|
|
47
|
+
// Mirror of ADAPTER_READ_CAPABILITIES for write-side capabilities that must
|
|
48
|
+
// survive a failed start(). Only adapters whose underlying SDK exposes a
|
|
49
|
+
// message-edit primitive appear here; the router uses this to answer
|
|
50
|
+
// `adapter-unavailable` (configured but not running — re-auth may help) vs
|
|
51
|
+
// `not-supported` (this adapter never edits) for a missing callback. The
|
|
52
|
+
// schema.test.ts guard re-derives each entry from the adapter's
|
|
53
|
+
// `.registerEditMessage(` call and fails if the table drifts.
|
|
54
|
+
export const ADAPTER_WRITE_CAPABILITIES: Record<AdapterId, readonly WriteCapability[]> = {
|
|
55
|
+
discord: ['message-edit'],
|
|
56
|
+
'discord-bot': ['message-edit'],
|
|
57
|
+
github: [],
|
|
58
|
+
instagram: [],
|
|
59
|
+
line: [],
|
|
60
|
+
kakaotalk: [],
|
|
61
|
+
slack: ['message-edit'],
|
|
62
|
+
'slack-bot': ['message-edit'],
|
|
63
|
+
teams: ['message-edit'],
|
|
64
|
+
'telegram-bot': ['message-edit'],
|
|
65
|
+
webex: ['message-edit'],
|
|
66
|
+
'webex-bot': ['message-edit'],
|
|
67
|
+
}
|
|
68
|
+
|
|
43
69
|
const engagementTriggerSchema = z.enum(['mention', 'reply', 'dm'])
|
|
44
70
|
|
|
45
71
|
const stickinessSchema = z.union([
|
|
@@ -303,6 +329,13 @@ export const channelsSchema = z
|
|
|
303
329
|
kakaotalk: adapterSchema.optional(),
|
|
304
330
|
slack: adapterSchema.optional(),
|
|
305
331
|
'slack-bot': adapterSchema.optional(),
|
|
332
|
+
// Teams is a personal-account channel: user-account auth (no bot token),
|
|
333
|
+
// credentials in secrets.json#channels.teams. v1 is chat-only (1:1/group/
|
|
334
|
+
// self chats) driven by agent-messenger's TeamsListener (trouter
|
|
335
|
+
// WebSocket); Teams team/channel messaging is out of scope because the
|
|
336
|
+
// realtime event carries only a chatId, no team/channel id. Plain-text
|
|
337
|
+
// sends only; standard adapterSchema (engagement + history + enabled).
|
|
338
|
+
teams: adapterSchema.optional(),
|
|
306
339
|
'telegram-bot': adapterSchema.optional(),
|
|
307
340
|
webex: adapterSchema.optional(),
|
|
308
341
|
// Webex bots receive messages in real time over a Mercury WebSocket
|
package/src/channels/types.ts
CHANGED
|
@@ -272,6 +272,42 @@ export type SendResult =
|
|
|
272
272
|
|
|
273
273
|
export type OutboundCallback = (msg: OutboundMessage) => Promise<SendResult>
|
|
274
274
|
|
|
275
|
+
// A request to edit (replace the text of) a message the bot already posted.
|
|
276
|
+
// `messageId` is the platform-native id the send handed back as
|
|
277
|
+
// `SendResult.messageId` (Slack `ts`, Discord snowflake, Telegram `message_id`,
|
|
278
|
+
// Webex message id) — the same id shape an inbound carries as
|
|
279
|
+
// `externalMessageId`. `thread` is context only: none of the supported SDK edit
|
|
280
|
+
// calls require it (Slack/Discord/Telegram/Webex address the message by
|
|
281
|
+
// channel+id or room+id), so adapters may ignore it. Editing is opt-in per
|
|
282
|
+
// adapter — only adapters whose SDK exposes an edit primitive register a
|
|
283
|
+
// callback; the rest resolve to `code: 'not-supported'`.
|
|
284
|
+
export type EditMessageRequest = {
|
|
285
|
+
adapter: AdapterId
|
|
286
|
+
workspace: string
|
|
287
|
+
chat: string
|
|
288
|
+
thread?: string | null
|
|
289
|
+
messageId: string
|
|
290
|
+
text: string
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
// `not-found` is an expected miss (message deleted, wrong id, or too old to
|
|
294
|
+
// edit) the tool surfaces as a soft error. `not-supported` means the adapter
|
|
295
|
+
// does not implement editing at all. `adapter-unavailable` means the adapter IS
|
|
296
|
+
// configured and DOES implement editing, but currently has no live callback
|
|
297
|
+
// (e.g. it failed to start), mirroring `getMessage`'s three-way distinction so
|
|
298
|
+
// the agent only sees the actionable re-auth hint when re-auth would help.
|
|
299
|
+
// `permission-denied` is a hard refusal from the platform (e.g. editing a
|
|
300
|
+
// message the bot does not own).
|
|
301
|
+
export type EditMessageResult =
|
|
302
|
+
| { ok: true }
|
|
303
|
+
| {
|
|
304
|
+
ok: false
|
|
305
|
+
error: string
|
|
306
|
+
code?: 'not-found' | 'not-supported' | 'adapter-unavailable' | 'permission-denied'
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
export type EditMessageCallback = (req: EditMessageRequest) => Promise<EditMessageResult>
|
|
310
|
+
|
|
275
311
|
export type TypingTarget = {
|
|
276
312
|
adapter: AdapterId
|
|
277
313
|
workspace: string
|
package/src/cli/channel.ts
CHANGED
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
type KakaotalkAuthResult,
|
|
35
35
|
type LineAuthResult,
|
|
36
36
|
type SlackAuthResult,
|
|
37
|
+
type TeamsAuthResult,
|
|
37
38
|
type WebexAuthResult,
|
|
38
39
|
} from '@/init'
|
|
39
40
|
import { runDiscordBootstrap } from '@/init/discord-auth'
|
|
@@ -41,8 +42,10 @@ import { runInstagramBootstrap, type InstagramLoginCallbacks } from '@/init/inst
|
|
|
41
42
|
import { runKakaotalkBootstrap } from '@/init/kakaotalk-auth'
|
|
42
43
|
import { runLineBootstrap } from '@/init/line-auth'
|
|
43
44
|
import { runSlackBootstrap } from '@/init/slack-auth'
|
|
45
|
+
import { runTeamsBootstrap, type TeamsDeviceCodeCallbacks } from '@/init/teams-auth'
|
|
44
46
|
import { runWebexBootstrap } from '@/init/webex-auth'
|
|
45
47
|
import { SecretsKakaoCredentialStore } from '@/secrets/kakao-store'
|
|
48
|
+
import type { TeamsAccountType } from '@/secrets/schema'
|
|
46
49
|
import { SecretsWebexCredentialStore } from '@/secrets/webex-store'
|
|
47
50
|
|
|
48
51
|
import { CANCEL_SYMBOL, promptPrivateKeyPem } from './prompt-pem'
|
|
@@ -57,12 +60,15 @@ const CHANNEL_LABELS: Record<ChannelKind, string> = {
|
|
|
57
60
|
'telegram-bot': 'Telegram',
|
|
58
61
|
webex: 'Webex (User)',
|
|
59
62
|
'webex-bot': 'Webex',
|
|
63
|
+
teams: 'Teams',
|
|
60
64
|
instagram: 'Instagram',
|
|
61
65
|
line: 'LINE',
|
|
62
66
|
kakaotalk: 'KakaoTalk',
|
|
63
67
|
github: 'GitHub',
|
|
64
68
|
}
|
|
65
69
|
|
|
70
|
+
const ADDABLE_CHANNEL_KINDS = CHANNEL_KINDS
|
|
71
|
+
|
|
66
72
|
const addSub = defineCommand({
|
|
67
73
|
meta: {
|
|
68
74
|
name: 'add',
|
|
@@ -71,7 +77,7 @@ const addSub = defineCommand({
|
|
|
71
77
|
args: {
|
|
72
78
|
adapter: {
|
|
73
79
|
type: 'positional',
|
|
74
|
-
description: `which adapter to add (${
|
|
80
|
+
description: `which adapter to add (${ADDABLE_CHANNEL_KINDS.join(' | ')}); omit to pick interactively`,
|
|
75
81
|
required: false,
|
|
76
82
|
},
|
|
77
83
|
},
|
|
@@ -187,7 +193,7 @@ const setSub = defineCommand({
|
|
|
187
193
|
// than a token-field rotation (`channel set`). Discord (User) belongs here — its
|
|
188
194
|
// unofficial QR session expires and is refreshed by replaying the QR login, the
|
|
189
195
|
// same shape as LINE's QR flow. `discord-bot` stays in SETTABLE_ADAPTERS.
|
|
190
|
-
const REAUTHABLE_ADAPTERS = ['line', 'instagram', 'kakaotalk', 'webex', 'discord'] as const
|
|
196
|
+
const REAUTHABLE_ADAPTERS = ['line', 'instagram', 'kakaotalk', 'webex', 'discord', 'teams'] as const
|
|
191
197
|
type ReauthableAdapter = (typeof REAUTHABLE_ADAPTERS)[number]
|
|
192
198
|
|
|
193
199
|
const reauthSub = defineCommand({
|
|
@@ -475,9 +481,24 @@ async function runReauth(cwd: string, adapter: ReauthableAdapter): Promise<void>
|
|
|
475
481
|
case 'discord':
|
|
476
482
|
await runDiscordReauth(cwd)
|
|
477
483
|
return
|
|
484
|
+
case 'teams':
|
|
485
|
+
await runTeamsReauth(cwd)
|
|
486
|
+
return
|
|
478
487
|
}
|
|
479
488
|
}
|
|
480
489
|
|
|
490
|
+
async function runTeamsReauth(cwd: string): Promise<void> {
|
|
491
|
+
const accountType = await promptTeamsAccountType()
|
|
492
|
+
const result = await runTeamsBootstrap({ agentDir: cwd, accountType, callbacks: teamsDeviceCodeCallbacks() })
|
|
493
|
+
if (!result.ok) {
|
|
494
|
+
console.error(errorLine(`Teams login failed: ${result.reason}`))
|
|
495
|
+
process.exit(1)
|
|
496
|
+
}
|
|
497
|
+
process.stdout.write(`${successLine('Teams credentials refreshed in secrets.json.')}\n`)
|
|
498
|
+
|
|
499
|
+
await maybePromptReauthRefresh(cwd, 'teams')
|
|
500
|
+
}
|
|
501
|
+
|
|
481
502
|
async function runInstagramReauth(cwd: string): Promise<void> {
|
|
482
503
|
const creds = await promptInstagramCredentials()
|
|
483
504
|
const s = spinner()
|
|
@@ -654,7 +675,15 @@ async function maybePromptCredentialRefresh(
|
|
|
654
675
|
|
|
655
676
|
function validateAdapterArg(adapter: string, configured: Set<ChannelKind>): ChannelKind {
|
|
656
677
|
if (!isChannelKind(adapter)) {
|
|
657
|
-
console.error(errorLine(`Unknown adapter "${adapter}". Expected one of: ${
|
|
678
|
+
console.error(errorLine(`Unknown adapter "${adapter}". Expected one of: ${ADDABLE_CHANNEL_KINDS.join(', ')}.`))
|
|
679
|
+
process.exit(1)
|
|
680
|
+
}
|
|
681
|
+
if (!(ADDABLE_CHANNEL_KINDS as ReadonlyArray<string>).includes(adapter)) {
|
|
682
|
+
console.error(
|
|
683
|
+
errorLine(
|
|
684
|
+
`${CHANNEL_LABELS[adapter]} ("${adapter}") has no interactive auth yet. Populate secrets.json#channels.${adapter} manually.`,
|
|
685
|
+
),
|
|
686
|
+
)
|
|
658
687
|
process.exit(1)
|
|
659
688
|
}
|
|
660
689
|
if (configured.has(adapter)) {
|
|
@@ -673,7 +702,7 @@ function isChannelKind(value: string): value is ChannelKind {
|
|
|
673
702
|
}
|
|
674
703
|
|
|
675
704
|
async function pickChannel(configured: Set<ChannelKind>): Promise<ChannelKind> {
|
|
676
|
-
const available =
|
|
705
|
+
const available = ADDABLE_CHANNEL_KINDS.filter((kind) => !configured.has(kind))
|
|
677
706
|
if (available.length === 0) {
|
|
678
707
|
console.error(errorLine('All supported channel adapters are already configured in typeclaw.json. Nothing to add.'))
|
|
679
708
|
process.exit(0)
|
|
@@ -1002,6 +1031,7 @@ type CollectedCredentials =
|
|
|
1002
1031
|
| { channel: 'telegram-bot'; telegramBotToken: string }
|
|
1003
1032
|
| { channel: 'webex'; runWebexAuth: (options: { cwd: string }) => Promise<WebexAuthResult> }
|
|
1004
1033
|
| { channel: 'webex-bot'; webexBotToken: string }
|
|
1034
|
+
| { channel: 'teams'; runTeamsAuth: (options: { cwd: string }) => Promise<TeamsAuthResult> }
|
|
1005
1035
|
| { channel: 'instagram'; runInstagramAuth: (options: { cwd: string }) => Promise<InstagramAuthResult> }
|
|
1006
1036
|
| { channel: 'line'; runLineAuth: (options: { cwd: string }) => Promise<LineAuthResult> }
|
|
1007
1037
|
| { channel: 'kakaotalk'; runKakaotalkAuth: (options: { cwd: string }) => Promise<KakaotalkAuthResult> }
|
|
@@ -1049,6 +1079,14 @@ async function collectCredentials(
|
|
|
1049
1079
|
}
|
|
1050
1080
|
case 'webex-bot':
|
|
1051
1081
|
return { channel, webexBotToken: await promptWebexToken() }
|
|
1082
|
+
case 'teams': {
|
|
1083
|
+
const accountType = await promptTeamsAccountType()
|
|
1084
|
+
return {
|
|
1085
|
+
channel,
|
|
1086
|
+
runTeamsAuth: ({ cwd: agentDir }) =>
|
|
1087
|
+
runTeamsBootstrap({ agentDir, accountType, callbacks: teamsDeviceCodeCallbacks() }),
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1052
1090
|
case 'instagram': {
|
|
1053
1091
|
const creds = await promptInstagramCredentials()
|
|
1054
1092
|
const callbacks = instagramLoginCallbacks(lineSpinnerHolder ? holderSpinnerControl(lineSpinnerHolder) : undefined)
|
|
@@ -1522,6 +1560,47 @@ async function promptWebexToken(): Promise<string> {
|
|
|
1522
1560
|
return token
|
|
1523
1561
|
}
|
|
1524
1562
|
|
|
1563
|
+
async function promptTeamsAccountType(): Promise<TeamsAccountType> {
|
|
1564
|
+
note(
|
|
1565
|
+
[
|
|
1566
|
+
'Teams signs in as your own Microsoft account via device-code login —',
|
|
1567
|
+
'no bot registration. You get a short code to enter at',
|
|
1568
|
+
'microsoft.com/devicelogin, then approve the sign-in.',
|
|
1569
|
+
].join('\n'),
|
|
1570
|
+
'About to log in to Teams',
|
|
1571
|
+
)
|
|
1572
|
+
const accountType = await select<TeamsAccountType>({
|
|
1573
|
+
message: 'Which kind of Microsoft account?',
|
|
1574
|
+
options: [
|
|
1575
|
+
{ value: 'work', label: 'Work or school (Microsoft 365 / Azure AD)' },
|
|
1576
|
+
{ value: 'personal', label: 'Personal Microsoft account (outlook.com, live.com, …)' },
|
|
1577
|
+
],
|
|
1578
|
+
initialValue: 'work',
|
|
1579
|
+
})
|
|
1580
|
+
if (isCancel(accountType)) {
|
|
1581
|
+
cancel('Aborted.')
|
|
1582
|
+
process.exit(0)
|
|
1583
|
+
}
|
|
1584
|
+
return accountType
|
|
1585
|
+
}
|
|
1586
|
+
|
|
1587
|
+
export function teamsDeviceCodeCallbacks(): TeamsDeviceCodeCallbacks {
|
|
1588
|
+
return {
|
|
1589
|
+
onCode: (prompt) => {
|
|
1590
|
+
note(
|
|
1591
|
+
[
|
|
1592
|
+
`Open ${prompt.verificationUri}`,
|
|
1593
|
+
`Enter code: ${prompt.userCode}`,
|
|
1594
|
+
'',
|
|
1595
|
+
'Then approve the sign-in in your browser. Waiting for approval…',
|
|
1596
|
+
].join('\n'),
|
|
1597
|
+
'Teams device-code login',
|
|
1598
|
+
)
|
|
1599
|
+
},
|
|
1600
|
+
onPending: () => log.info('Approved — minting the Teams token…'),
|
|
1601
|
+
}
|
|
1602
|
+
}
|
|
1603
|
+
|
|
1525
1604
|
async function promptKakaotalkCredentials(
|
|
1526
1605
|
opts: { defaultEmail?: string } = {},
|
|
1527
1606
|
): Promise<{ email: string; password: string }> {
|
|
@@ -1819,6 +1898,9 @@ function reportProgress(
|
|
|
1819
1898
|
case 'webex-auth':
|
|
1820
1899
|
s.stop(reportWebexAuth(event.result))
|
|
1821
1900
|
break
|
|
1901
|
+
case 'teams-auth':
|
|
1902
|
+
s.stop(reportTeamsAuth(event.result))
|
|
1903
|
+
break
|
|
1822
1904
|
case 'discord-auth':
|
|
1823
1905
|
s.stop(reportDiscordAuth(event.result))
|
|
1824
1906
|
break
|
|
@@ -1843,6 +1925,7 @@ const START_MESSAGES: Record<AddChannelStepEvent['step'], string> = {
|
|
|
1843
1925
|
'instagram-auth': 'Logging in to Instagram...',
|
|
1844
1926
|
'kakaotalk-auth': 'Logging in to KakaoTalk...',
|
|
1845
1927
|
'webex-auth': 'Logging in to Webex...',
|
|
1928
|
+
'teams-auth': 'Logging in to Teams...',
|
|
1846
1929
|
'discord-auth': 'Logging in to Discord...',
|
|
1847
1930
|
'slack-auth': 'Logging in to Slack...',
|
|
1848
1931
|
config: 'Updating typeclaw.json...',
|
|
@@ -1870,6 +1953,11 @@ function reportWebexAuth(result: WebexAuthResult): string {
|
|
|
1870
1953
|
return `Webex login failed: ${result.reason}`
|
|
1871
1954
|
}
|
|
1872
1955
|
|
|
1956
|
+
function reportTeamsAuth(result: TeamsAuthResult): string {
|
|
1957
|
+
if (result.ok) return 'Teams credentials saved to secrets.json.'
|
|
1958
|
+
return `Teams login failed: ${result.reason}`
|
|
1959
|
+
}
|
|
1960
|
+
|
|
1873
1961
|
function reportLineAuth(result: LineAuthResult): string {
|
|
1874
1962
|
if (result.ok) return 'LINE credentials saved to secrets.json.'
|
|
1875
1963
|
return `LINE login failed: ${result.reason}`
|
package/src/cli/hostd.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { startDaemon, type DaemonLogEvent, type RestartPreflight } from '@/hostd
|
|
|
7
7
|
import { createKakaoRenewalManager } from '@/hostd/kakao-renewal-manager'
|
|
8
8
|
import { createPortbrokerManager } from '@/hostd/portbroker-manager'
|
|
9
9
|
import type { SupervisorLogEvent, SupervisorRestart } from '@/hostd/supervisor'
|
|
10
|
+
import { createTeamsRenewalManager } from '@/hostd/teams-renewal-manager'
|
|
10
11
|
import { computeSourceVersion, resolveSrcRoot, UNVERSIONED_SENTINEL } from '@/hostd/version'
|
|
11
12
|
import { createWebexRenewalManager } from '@/hostd/webex-renewal-manager'
|
|
12
13
|
import { validateRestartDeps, type RestartDepsPreflightResult } from '@/init/restart-deps-preflight'
|
|
@@ -57,6 +58,19 @@ export const hostdCommand = defineCommand({
|
|
|
57
58
|
},
|
|
58
59
|
shouldRenew: ({ cwd }) => webexChannelConfigured(cwd),
|
|
59
60
|
})
|
|
61
|
+
const teamsRenewal = createTeamsRenewalManager({
|
|
62
|
+
onLog: (event) => writeLogLine(formatLog(event)),
|
|
63
|
+
onRenewalOk: async ({ containerName, cwd }) => {
|
|
64
|
+
// Restart so the in-memory TeamsClient picks up the renewed token from
|
|
65
|
+
// secrets.json. Without this, the cron writes a fresh token but the
|
|
66
|
+
// running adapter keeps the old token in its login closure and still
|
|
67
|
+
// cannot obtain an id_token for the realtime listener.
|
|
68
|
+
const currentHostDaemon = await currentHostDaemonHolder.ready()
|
|
69
|
+
const result = await hostdRestart({ containerName, cwd, currentHostDaemon })
|
|
70
|
+
if (!result.ok) throw new Error(result.reason)
|
|
71
|
+
},
|
|
72
|
+
shouldRenew: ({ cwd }) => teamsChannelConfigured(cwd),
|
|
73
|
+
})
|
|
60
74
|
|
|
61
75
|
const daemon = await startDaemon({
|
|
62
76
|
onLog: (e) => writeLogLine(formatLog(e)),
|
|
@@ -65,6 +79,7 @@ export const hostdCommand = defineCommand({
|
|
|
65
79
|
portbroker,
|
|
66
80
|
kakaoRenewal,
|
|
67
81
|
webexRenewal,
|
|
82
|
+
teamsRenewal,
|
|
68
83
|
currentHostDaemonHolder,
|
|
69
84
|
restartPreflight: buildHostdRestartPreflight(cliEntry, version, defaultPreflightDeps),
|
|
70
85
|
restart: hostdRestart,
|
|
@@ -76,6 +91,7 @@ export const hostdCommand = defineCommand({
|
|
|
76
91
|
.then(() => portbroker.drain())
|
|
77
92
|
.then(() => kakaoRenewal.drain())
|
|
78
93
|
.then(() => webexRenewal.drain())
|
|
94
|
+
.then(() => teamsRenewal.drain())
|
|
79
95
|
.then(() => process.exit(0))
|
|
80
96
|
}
|
|
81
97
|
process.on('SIGTERM', shutdown)
|
|
@@ -242,6 +258,22 @@ function formatLog(event: DaemonLogEvent | SupervisorLogEvent): string {
|
|
|
242
258
|
return `[hostd] webex renewal scheduled container restart for ${event.containerName} account=${event.accountId}`
|
|
243
259
|
case 'webex-renewal-restart-failed':
|
|
244
260
|
return `[hostd] webex renewal container restart FAILED for ${event.containerName} account=${event.accountId}: ${event.reason}`
|
|
261
|
+
case 'teams-renewal-tick-start':
|
|
262
|
+
return `[hostd] teams renewal tick started for ${event.containerName}`
|
|
263
|
+
case 'teams-renewal-tick-skipped':
|
|
264
|
+
return `[hostd] teams renewal skipped for ${event.containerName}: ${event.reason}${event.expiresInMs !== undefined ? ` (expires in ${Math.round(event.expiresInMs / 1000 / 60)}m)` : ''}`
|
|
265
|
+
case 'teams-renewal-tick-ok':
|
|
266
|
+
return `[hostd] teams renewal OK for ${event.containerName} account=${event.accountId} (new token expires ${new Date(event.nextExpiresAt).toISOString()})`
|
|
267
|
+
case 'teams-renewal-tick-reauth-required':
|
|
268
|
+
return `[hostd] teams renewal REAUTH REQUIRED for ${event.containerName} account=${event.accountId} reason=${event.reason} — ${event.message}`
|
|
269
|
+
case 'teams-renewal-tick-transient-failure':
|
|
270
|
+
return `[hostd] teams renewal transient failure for ${event.containerName} account=${event.accountId}: ${event.reason}`
|
|
271
|
+
case 'teams-renewal-tick-error':
|
|
272
|
+
return `[hostd] teams renewal ERROR for ${event.containerName}: ${event.error}`
|
|
273
|
+
case 'teams-renewal-restart-scheduled':
|
|
274
|
+
return `[hostd] teams renewal scheduled container restart for ${event.containerName} account=${event.accountId}`
|
|
275
|
+
case 'teams-renewal-restart-failed':
|
|
276
|
+
return `[hostd] teams renewal container restart FAILED for ${event.containerName} account=${event.accountId}: ${event.reason}`
|
|
245
277
|
}
|
|
246
278
|
}
|
|
247
279
|
|
|
@@ -269,6 +301,15 @@ function webexChannelConfigured(cwd: string): boolean {
|
|
|
269
301
|
}
|
|
270
302
|
}
|
|
271
303
|
|
|
304
|
+
function teamsChannelConfigured(cwd: string): boolean {
|
|
305
|
+
try {
|
|
306
|
+
const cfg = loadConfigSync(cwd)
|
|
307
|
+
return cfg.channels?.teams !== undefined
|
|
308
|
+
} catch {
|
|
309
|
+
return false
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
272
313
|
function formatPortForwardEvent(event: import('@/portbroker').PortForwardEvent): string {
|
|
273
314
|
switch (event.kind) {
|
|
274
315
|
case 'port-forward-opened':
|
package/src/cli/init.ts
CHANGED
|
@@ -67,6 +67,7 @@ import { runKakaotalkBootstrap } from '@/init/kakaotalk-auth'
|
|
|
67
67
|
import { customModelMetaFromOption, fetchModelOptions, type ModelOption } from '@/init/models-dev'
|
|
68
68
|
import { makeOAuthLoginRunner, type OAuthLoginResult } from '@/init/oauth-login'
|
|
69
69
|
import { detectInitProgress } from '@/init/progress'
|
|
70
|
+
import { runTeamsBootstrap } from '@/init/teams-auth'
|
|
70
71
|
import {
|
|
71
72
|
API_KEY_DASHBOARD_URL,
|
|
72
73
|
MINIMAX_TOKEN_PLAN_DASHBOARD_URL,
|
|
@@ -74,7 +75,9 @@ import {
|
|
|
74
75
|
type KeyValidationResult,
|
|
75
76
|
} from '@/init/validate-api-key'
|
|
76
77
|
import { runWebexBootstrap } from '@/init/webex-auth'
|
|
78
|
+
import type { TeamsAccountType } from '@/secrets/schema'
|
|
77
79
|
|
|
80
|
+
import { teamsDeviceCodeCallbacks } from './channel'
|
|
78
81
|
import { fuzzyMatch } from './fuzzy-filter'
|
|
79
82
|
import { buildOAuthCallbacks } from './oauth-callbacks'
|
|
80
83
|
import { CANCEL_SYMBOL, promptPrivateKeyPem } from './prompt-pem'
|
|
@@ -225,6 +228,7 @@ export const init = defineCommand({
|
|
|
225
228
|
kakaotalkPassword,
|
|
226
229
|
webexEmail,
|
|
227
230
|
webexPassword,
|
|
231
|
+
teamsAccountType,
|
|
228
232
|
github: githubCredentials,
|
|
229
233
|
} = channelSecrets
|
|
230
234
|
const modelMeta = customModelMetaFromOption(model)
|
|
@@ -244,9 +248,11 @@ export const init = defineCommand({
|
|
|
244
248
|
const reuseTelegram = reuseExistingChannel && channelChoice === 'telegram'
|
|
245
249
|
const reuseKakaotalk = reuseExistingChannel && channelChoice === 'kakaotalk'
|
|
246
250
|
const reuseWebex = reuseExistingChannel && channelChoice === 'webex'
|
|
251
|
+
const reuseTeams = reuseExistingChannel && channelChoice === 'teams'
|
|
247
252
|
const reuseGithub = reuseExistingChannel && channelChoice === 'github'
|
|
248
253
|
const wantsKakaotalk = (kakaotalkEmail !== undefined && kakaotalkPassword !== undefined) || reuseKakaotalk
|
|
249
254
|
const wantsWebex = (webexEmail !== undefined && webexPassword !== undefined) || reuseWebex
|
|
255
|
+
const wantsTeams = teamsAccountType !== undefined || reuseTeams
|
|
250
256
|
const wantsGithub = githubCredentials !== undefined || reuseGithub
|
|
251
257
|
let hatchingOk = false
|
|
252
258
|
let preflightFailure: Extract<DockerAvailability, { ok: false }> | null = null
|
|
@@ -299,6 +305,21 @@ export const init = defineCommand({
|
|
|
299
305
|
}),
|
|
300
306
|
}
|
|
301
307
|
: {}),
|
|
308
|
+
...(wantsTeams
|
|
309
|
+
? {
|
|
310
|
+
withTeams: true,
|
|
311
|
+
...(reuseTeams
|
|
312
|
+
? {}
|
|
313
|
+
: {
|
|
314
|
+
runTeamsAuth: ({ cwd: agentDir }) =>
|
|
315
|
+
runTeamsBootstrap({
|
|
316
|
+
agentDir,
|
|
317
|
+
accountType: teamsAccountType!,
|
|
318
|
+
callbacks: teamsDeviceCodeCallbacks(),
|
|
319
|
+
}),
|
|
320
|
+
}),
|
|
321
|
+
}
|
|
322
|
+
: {}),
|
|
302
323
|
...(wantsGithub
|
|
303
324
|
? {
|
|
304
325
|
withGithub: true,
|
|
@@ -407,7 +428,7 @@ interface WizardState {
|
|
|
407
428
|
channelReuseExisting?: boolean
|
|
408
429
|
}
|
|
409
430
|
|
|
410
|
-
type ChannelChoice = 'slack' | 'discord' | 'telegram' | 'webex' | 'kakaotalk' | 'github' | 'none'
|
|
431
|
+
type ChannelChoice = 'slack' | 'discord' | 'telegram' | 'webex' | 'teams' | 'kakaotalk' | 'github' | 'none'
|
|
411
432
|
|
|
412
433
|
interface CollectedInputs {
|
|
413
434
|
model: ModelOption
|
|
@@ -429,6 +450,7 @@ interface CollectedInputs {
|
|
|
429
450
|
telegramBotToken?: string
|
|
430
451
|
webexEmail?: string
|
|
431
452
|
webexPassword?: string
|
|
453
|
+
teamsAccountType?: TeamsAccountType
|
|
432
454
|
kakaotalkEmail?: string
|
|
433
455
|
kakaotalkPassword?: string
|
|
434
456
|
// Structured (auth union + webhook + repo allowlist) rather than flat
|
|
@@ -1141,6 +1163,8 @@ function channelDisplayName(choice: Exclude<ChannelChoice, 'none'>): string {
|
|
|
1141
1163
|
return 'Telegram'
|
|
1142
1164
|
case 'webex':
|
|
1143
1165
|
return 'Webex (User)'
|
|
1166
|
+
case 'teams':
|
|
1167
|
+
return 'Teams (User)'
|
|
1144
1168
|
case 'kakaotalk':
|
|
1145
1169
|
return 'KakaoTalk'
|
|
1146
1170
|
case 'github':
|
|
@@ -1483,6 +1507,7 @@ async function pickChannel(initial: ChannelChoice | undefined): Promise<StepResu
|
|
|
1483
1507
|
{ value: 'discord', label: 'Discord' },
|
|
1484
1508
|
{ value: 'telegram', label: 'Telegram' },
|
|
1485
1509
|
{ value: 'webex', label: 'Webex (User)' },
|
|
1510
|
+
{ value: 'teams', label: 'Teams (User)' },
|
|
1486
1511
|
{ value: 'kakaotalk', label: 'KakaoTalk' },
|
|
1487
1512
|
{ value: 'github', label: 'GitHub' },
|
|
1488
1513
|
{ value: 'none', label: 'Skip — no channel right now' },
|
|
@@ -1510,11 +1535,34 @@ async function runChannelFlow(
|
|
|
1510
1535
|
return runTelegramFlow()
|
|
1511
1536
|
case 'webex':
|
|
1512
1537
|
return runWebexUserFlow()
|
|
1538
|
+
case 'teams':
|
|
1539
|
+
return runTeamsFlow()
|
|
1513
1540
|
case 'github':
|
|
1514
1541
|
return runGithubFlow(cwd)
|
|
1515
1542
|
}
|
|
1516
1543
|
}
|
|
1517
1544
|
|
|
1545
|
+
async function runTeamsFlow(): Promise<StepResult<CollectedInputs['channelSecrets']>> {
|
|
1546
|
+
note(
|
|
1547
|
+
[
|
|
1548
|
+
'Teams signs in as your own Microsoft account via device-code login —',
|
|
1549
|
+
'you get a short code to enter at microsoft.com/devicelogin, then approve.',
|
|
1550
|
+
'The sign-in itself runs after scaffolding, not now.',
|
|
1551
|
+
].join('\n'),
|
|
1552
|
+
'About to log in to Teams',
|
|
1553
|
+
)
|
|
1554
|
+
const accountType = await select<TeamsAccountType>({
|
|
1555
|
+
message: 'Which kind of Microsoft account?',
|
|
1556
|
+
options: [
|
|
1557
|
+
{ value: 'work', label: 'Work or school (Microsoft 365 / Azure AD)' },
|
|
1558
|
+
{ value: 'personal', label: 'Personal Microsoft account (outlook.com, live.com, …)' },
|
|
1559
|
+
],
|
|
1560
|
+
initialValue: 'work',
|
|
1561
|
+
})
|
|
1562
|
+
if (isCancel(accountType)) return back()
|
|
1563
|
+
return value({ teamsAccountType: accountType })
|
|
1564
|
+
}
|
|
1565
|
+
|
|
1518
1566
|
async function runDiscordFlow(): Promise<StepResult<CollectedInputs['channelSecrets']>> {
|
|
1519
1567
|
note(
|
|
1520
1568
|
[
|
|
@@ -1903,6 +1951,9 @@ function reportProgress(
|
|
|
1903
1951
|
case 'webex-auth':
|
|
1904
1952
|
s.stop(reportWebexAuth(event.result))
|
|
1905
1953
|
break
|
|
1954
|
+
case 'teams-auth':
|
|
1955
|
+
s.stop(reportTeamsAuth(event.result))
|
|
1956
|
+
break
|
|
1906
1957
|
case 'github-webhooks':
|
|
1907
1958
|
s.stop(formatEagerGithubWebhookInstallResult(event.result))
|
|
1908
1959
|
break
|
|
@@ -1967,6 +2018,11 @@ function reportWebexAuth(result: { ok: true } | { ok: false; reason: string }):
|
|
|
1967
2018
|
return `Webex login failed: ${result.reason}`
|
|
1968
2019
|
}
|
|
1969
2020
|
|
|
2021
|
+
function reportTeamsAuth(result: { ok: true } | { ok: false; reason: string }): string {
|
|
2022
|
+
if (result.ok) return 'Teams credentials saved to secrets.json.'
|
|
2023
|
+
return `Teams login failed: ${result.reason}`
|
|
2024
|
+
}
|
|
2025
|
+
|
|
1970
2026
|
// Hatching launches the container and foregrounds the TUI, so it steals stdin
|
|
1971
2027
|
// and cannot share the spinner lifecycle with the other steps. Print plain
|
|
1972
2028
|
// lines instead.
|
|
@@ -2050,6 +2106,7 @@ const START_MESSAGES: Record<Exclude<InitStep, 'hatching'>, string> = {
|
|
|
2050
2106
|
'instagram-auth': 'Logging in to Instagram...',
|
|
2051
2107
|
'kakaotalk-auth': 'Logging in to KakaoTalk...',
|
|
2052
2108
|
'webex-auth': 'Logging in to Webex...',
|
|
2109
|
+
'teams-auth': 'Logging in to Teams...',
|
|
2053
2110
|
'github-webhooks': 'Installing GitHub repository webhooks...',
|
|
2054
2111
|
install: 'Installing dependencies with bun...',
|
|
2055
2112
|
dockerfile: 'Writing Dockerfile...',
|
|
@@ -15,6 +15,7 @@ export const CHANNEL_KINDS = [
|
|
|
15
15
|
'telegram-bot',
|
|
16
16
|
'webex',
|
|
17
17
|
'webex-bot',
|
|
18
|
+
'teams',
|
|
18
19
|
'instagram',
|
|
19
20
|
'line',
|
|
20
21
|
'kakaotalk',
|
|
@@ -190,7 +191,14 @@ function buildDetail(kind: ChannelKind, channelConfig: unknown, secretsBlock: un
|
|
|
190
191
|
const repos = isObjectRecord(channelConfig) && Array.isArray(channelConfig.repos) ? channelConfig.repos.length : 0
|
|
191
192
|
return { detail: `${repos} repo${repos === 1 ? '' : 's'}` }
|
|
192
193
|
}
|
|
193
|
-
if (
|
|
194
|
+
if (
|
|
195
|
+
kind === 'line' ||
|
|
196
|
+
kind === 'instagram' ||
|
|
197
|
+
kind === 'kakaotalk' ||
|
|
198
|
+
kind === 'webex' ||
|
|
199
|
+
kind === 'discord' ||
|
|
200
|
+
kind === 'teams'
|
|
201
|
+
) {
|
|
194
202
|
if (!isObjectRecord(secretsBlock)) return {}
|
|
195
203
|
const accounts = isObjectRecord(secretsBlock.accounts) ? Object.keys(secretsBlock.accounts).length : 0
|
|
196
204
|
const current = typeof secretsBlock.currentAccount === 'string' ? secretsBlock.currentAccount : undefined
|
package/src/cron/index.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { join } from 'node:path'
|
|
|
4
4
|
|
|
5
5
|
import type { SubagentRegistry } from '@/agent/subagents'
|
|
6
6
|
|
|
7
|
-
import { type CronFile, parseCronFile } from './schema'
|
|
7
|
+
import { type CronFile, type CronParseWarning, type ParseCronMode, parseCronFile } from './schema'
|
|
8
8
|
|
|
9
9
|
export { type CountStore, createCountStore } from './count-state'
|
|
10
10
|
export { createCronReloadable } from './reloadable'
|
|
@@ -16,20 +16,29 @@ export {
|
|
|
16
16
|
cronJobSchema,
|
|
17
17
|
type CronFile,
|
|
18
18
|
type CronJob,
|
|
19
|
+
type CronParseWarning,
|
|
19
20
|
type ExecJob,
|
|
20
21
|
type HandlerJob,
|
|
21
22
|
parseCronJson,
|
|
23
|
+
type ParseCronMode,
|
|
22
24
|
type ParseCronResult,
|
|
23
25
|
type ParsedCronJob,
|
|
24
26
|
type PromptJob,
|
|
27
|
+
validateCronEdit,
|
|
25
28
|
} from './schema'
|
|
26
29
|
|
|
27
30
|
const CRON_FILE = 'cron.json'
|
|
28
31
|
|
|
29
|
-
export type LoadCronResult =
|
|
32
|
+
export type LoadCronResult =
|
|
33
|
+
| { ok: true; file: CronFile | null; warnings?: CronParseWarning[] }
|
|
34
|
+
| { ok: false; reason: string }
|
|
30
35
|
|
|
31
36
|
export type LoadCronOptions = {
|
|
32
37
|
subagents?: SubagentRegistry
|
|
38
|
+
// Defaults to strict `load` so inspection/security callers surface bad jobs
|
|
39
|
+
// as a whole-file error. Only the scheduler boot path passes `boot` to
|
|
40
|
+
// isolate individual bad jobs and keep the rest runnable.
|
|
41
|
+
mode?: ParseCronMode
|
|
33
42
|
}
|
|
34
43
|
|
|
35
44
|
export async function loadCron(agentDir: string, options: LoadCronOptions = {}): Promise<LoadCronResult> {
|
|
@@ -50,10 +59,13 @@ export async function loadCron(agentDir: string, options: LoadCronOptions = {}):
|
|
|
50
59
|
return { ok: false, reason: `cron.json is not valid JSON: ${errorMessage(err)}` }
|
|
51
60
|
}
|
|
52
61
|
|
|
53
|
-
const result = parseCronFile(parsed,
|
|
62
|
+
const result = parseCronFile(parsed, {
|
|
63
|
+
mode: options.mode ?? 'load',
|
|
64
|
+
...(options.subagents !== undefined ? { subagents: options.subagents } : {}),
|
|
65
|
+
})
|
|
54
66
|
if (!result.ok) return { ok: false, reason: result.reason }
|
|
55
67
|
|
|
56
|
-
return { ok: true, file: result.file }
|
|
68
|
+
return { ok: true, file: result.file, ...(result.warnings ? { warnings: result.warnings } : {}) }
|
|
57
69
|
}
|
|
58
70
|
|
|
59
71
|
function errorMessage(err: unknown): string {
|
package/src/cron/reloadable.ts
CHANGED
|
@@ -36,11 +36,34 @@ async function doReload({
|
|
|
36
36
|
getSubagents,
|
|
37
37
|
}: CreateCronReloadableOptions): Promise<ReloadResult> {
|
|
38
38
|
const subagents = getSubagents?.()
|
|
39
|
-
const loaded = await loadCron(cwd, subagents !== undefined ? { subagents } : {})
|
|
39
|
+
const loaded = await loadCron(cwd, { mode: 'boot', ...(subagents !== undefined ? { subagents } : {}) })
|
|
40
40
|
if (!loaded.ok) {
|
|
41
41
|
return { scope: 'cron', ok: false, reason: loaded.reason }
|
|
42
42
|
}
|
|
43
|
+
const warnings = loaded.warnings ?? []
|
|
44
|
+
for (const warning of warnings) {
|
|
45
|
+
console.error(`[cron] skipped invalid job on reload: ${warning.reason}`)
|
|
46
|
+
}
|
|
43
47
|
const userJobs = loaded.file?.jobs ?? []
|
|
48
|
+
|
|
49
|
+
// Wipe-guard: refuse a reload that would drop every user job *because they
|
|
50
|
+
// failed to parse* (not because the file was intentionally emptied) while a
|
|
51
|
+
// schedule is live, so a fat-fingered edit can't silently wipe running crons.
|
|
52
|
+
// A valid empty file has no warnings and passes through as intentional
|
|
53
|
+
// deletion. The live user-job baseline comes from the scheduler (single
|
|
54
|
+
// source of truth) minus the internal/plugin jobs, which are always present
|
|
55
|
+
// and must not count as "user jobs exist".
|
|
56
|
+
const internalIds = new Set((internalJobs?.() ?? []).map((job) => job.id))
|
|
57
|
+
const liveUserJobCount = scheduler.currentJobs().filter((job) => !internalIds.has(job.id)).length
|
|
58
|
+
if (warnings.length > 0 && userJobs.length === 0 && liveUserJobCount > 0) {
|
|
59
|
+
const reason = warnings.map((w) => w.reason).join('; ')
|
|
60
|
+
return {
|
|
61
|
+
scope: 'cron',
|
|
62
|
+
ok: false,
|
|
63
|
+
reason: `every configured user cron job is invalid; live schedule preserved: ${reason}`,
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
44
67
|
const nextJobs: CronJob[] = [...userJobs, ...(internalJobs?.() ?? [])]
|
|
45
68
|
|
|
46
69
|
let diff: JobDiff
|
|
@@ -51,12 +74,7 @@ async function doReload({
|
|
|
51
74
|
return { scope: 'cron', ok: false, reason: `apply failed (schedule unchanged): ${message}` }
|
|
52
75
|
}
|
|
53
76
|
|
|
54
|
-
return {
|
|
55
|
-
scope: 'cron',
|
|
56
|
-
ok: true,
|
|
57
|
-
summary: formatSummary(diff, nextJobs.length),
|
|
58
|
-
details: diff,
|
|
59
|
-
}
|
|
77
|
+
return { scope: 'cron', ok: true, summary: formatSummary(diff, nextJobs.length), details: diff }
|
|
60
78
|
}
|
|
61
79
|
|
|
62
80
|
function formatSummary(diff: JobDiff, total: number): string {
|