kimaki 0.26.0 → 0.27.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/dist/agent-model.e2e.test.js +25 -122
- package/dist/anthropic-account-identity.js +1 -0
- package/dist/anthropic-auth-plugin.js +1 -0
- package/dist/anthropic-auth-state.js +1 -0
- package/dist/bin.js +73 -19
- package/dist/cli-commands/maintenance.js +46 -7
- package/dist/cli-commands/send.js +24 -0
- package/dist/cli-commands/session.js +183 -8
- package/dist/cli-commands/task.js +13 -1
- package/dist/cli-parsing.test.js +59 -3
- package/dist/cli-runner.js +28 -4
- package/dist/cli-runner.test.js +27 -0
- package/dist/cli-send-thread.e2e.test.js +1 -1
- package/dist/cli.js +32 -0
- package/dist/commands/abort.js +5 -1
- package/dist/commands/agent.js +6 -8
- package/dist/commands/ask-question.js +21 -32
- package/dist/commands/ask-question.test.js +43 -1
- package/dist/commands/login.js +6 -0
- package/dist/commands/merge-worktree.js +36 -10
- package/dist/commands/model-variant.js +7 -1
- package/dist/commands/model.js +14 -8
- package/dist/commands/multioauth.js +1 -0
- package/dist/commands/new-worktree.js +170 -102
- package/dist/commands/user-command.js +6 -8
- package/dist/commands/worktrees.js +5 -13
- package/dist/config.js +16 -1
- package/dist/database.js +124 -3
- package/dist/db.js +22 -0
- package/dist/db.test.js +167 -1
- package/dist/discord-bot.js +34 -32
- package/dist/discord-command-registration.js +9 -1
- package/dist/discord-utils.js +13 -5
- package/dist/discord-utils.test.js +17 -1
- package/dist/errors.js +5 -0
- package/dist/exec-async.js +17 -5
- package/dist/external-directory-permissions.e2e.test.js +2 -2
- package/dist/file-edit-log.js +197 -0
- package/dist/file-edit-log.test.js +258 -0
- package/dist/format-tables.js +52 -0
- package/dist/format-tables.test.js +93 -0
- package/dist/gateway-proxy-reconnect.e2e.test.js +28 -8
- package/dist/gateway-proxy.e2e.test.js +5 -5
- package/dist/git-worktree-core.js +182 -17
- package/dist/ipc-tools-plugin.js +63 -3
- package/dist/kimaki-opencode-plugin-loading.e2e.test.js +122 -58
- package/dist/kimaki-opencode-plugin.js +7 -3
- package/dist/kimaki-workspace-adaptor.js +33 -10
- package/dist/logger.js +10 -1
- package/dist/markdown.js +3 -1
- package/dist/markdown.test.js +11 -3
- package/dist/message-formatting.js +18 -7
- package/dist/message-formatting.test.js +56 -9
- package/dist/oauth-rotation-shared.js +10 -0
- package/dist/openai-auth-plugin.js +1 -0
- package/dist/openai-auth-state.js +1 -0
- package/dist/opencode-command.test.js +60 -0
- package/dist/opencode.js +53 -12
- package/dist/question-abort-clears-dropdown.e2e.test.js +89 -0
- package/dist/question-text-before-dropdown.e2e.test.js +52 -0
- package/dist/queue-advanced-abort.e2e.test.js +1 -1
- package/dist/queue-advanced-action-buttons.e2e.test.js +3 -3
- package/dist/queue-advanced-e2e-setup.js +78 -5
- package/dist/queue-advanced-footer.e2e.test.js +40 -246
- package/dist/queue-advanced-model-switch.e2e.test.js +2 -2
- package/dist/queue-advanced-permissions-typing.e2e.test.js +7 -9
- package/dist/queue-advanced-question.e2e.test.js +31 -26
- package/dist/queue-advanced-typing-interrupt.e2e.test.js +2 -2
- package/dist/queue-delete-message.e2e.test.js +1 -1
- package/dist/queue-drain-after-interactive-ui.e2e.test.js +2 -2
- package/dist/queue-interrupt-drain.e2e.test.js +112 -2
- package/dist/queue-question-select-drain.e2e.test.js +30 -128
- package/dist/runtime-lifecycle.e2e.test.js +10 -37
- package/dist/schema.js +34 -0
- package/dist/session-handler/event-stream-state.js +267 -50
- package/dist/session-handler/event-stream-state.test.js +415 -8
- package/dist/session-handler/model-utils.js +159 -5
- package/dist/session-handler/model-utils.test.js +345 -0
- package/dist/session-handler/thread-session-runtime.js +252 -182
- package/dist/session-sleep.test.js +224 -0
- package/dist/session-title-rename.test.js +7 -39
- package/dist/sleep.e2e.test.js +491 -0
- package/dist/startup-time.e2e.test.js +2 -1
- package/dist/store.js +3 -0
- package/dist/system-message.js +59 -6
- package/dist/system-message.test.js +76 -6
- package/dist/task-runner.js +94 -4
- package/dist/task-schedule.js +56 -0
- package/dist/task-schedule.test.js +71 -1
- package/dist/thread-message-queue.e2e.test.js +10 -169
- package/dist/undo-redo.e2e.test.js +2 -2
- package/dist/voice-attachment.js +23 -1
- package/dist/voice-message.e2e.test.js +10 -10
- package/dist/voice.test.js +55 -29
- package/dist/worktree-clone-isolation.e2e.test.js +188 -0
- package/dist/worktree-lifecycle.e2e.test.js +29 -10
- package/dist/worktrees.js +226 -443
- package/dist/worktrees.test.js +435 -58
- package/dist/xai-auth-plugin.js +1 -0
- package/dist/xai-auth-state.js +1 -0
- package/package.json +8 -6
- package/skills/errore/SKILL.md +18 -0
- package/skills/goke/SKILL.md +150 -10
- package/skills/holocron/SKILL.md +37 -0
- package/skills/npm-package/SKILL.md +55 -35
- package/skills/profano/SKILL.md +17 -2
- package/skills/spiceflow/SKILL.md +39 -3
- package/skills/strada/SKILL.md +39 -0
- package/skills/zele/SKILL.md +19 -0
- package/src/agent-model.e2e.test.ts +25 -151
- package/src/anthropic-account-identity.ts +1 -0
- package/src/anthropic-auth-plugin.ts +1 -0
- package/src/anthropic-auth-state.ts +1 -0
- package/src/bin.ts +78 -26
- package/src/cli-commands/maintenance.ts +59 -13
- package/src/cli-commands/send.ts +25 -0
- package/src/cli-commands/session.ts +203 -9
- package/src/cli-commands/task.ts +13 -1
- package/src/cli-parsing.test.ts +69 -3
- package/src/cli-runner.test.ts +49 -0
- package/src/cli-runner.ts +28 -4
- package/src/cli-send-thread.e2e.test.ts +1 -1
- package/src/cli.ts +53 -0
- package/src/commands/abort.ts +6 -1
- package/src/commands/agent.ts +6 -6
- package/src/commands/ask-question.test.ts +48 -1
- package/src/commands/ask-question.ts +21 -32
- package/src/commands/login.ts +6 -0
- package/src/commands/merge-worktree.ts +43 -12
- package/src/commands/model-variant.ts +8 -1
- package/src/commands/model.ts +18 -8
- package/src/commands/multioauth.ts +1 -0
- package/src/commands/new-worktree.ts +138 -55
- package/src/commands/user-command.ts +6 -6
- package/src/commands/worktrees.ts +5 -12
- package/src/config.ts +18 -1
- package/src/database.ts +195 -3
- package/src/db.test.ts +188 -0
- package/src/db.ts +26 -0
- package/src/discord-bot.ts +35 -29
- package/src/discord-command-registration.ts +15 -1
- package/src/discord-utils.test.ts +19 -0
- package/src/discord-utils.ts +21 -6
- package/src/errors.ts +5 -0
- package/src/exec-async.ts +20 -11
- package/src/external-directory-permissions.e2e.test.ts +2 -2
- package/src/file-edit-log.test.ts +287 -0
- package/src/file-edit-log.ts +283 -0
- package/src/format-tables.test.ts +101 -0
- package/src/format-tables.ts +75 -0
- package/src/gateway-proxy-reconnect.e2e.test.ts +38 -8
- package/src/gateway-proxy.e2e.test.ts +5 -5
- package/src/git-worktree-core.ts +247 -20
- package/src/ipc-tools-plugin.ts +75 -5
- package/src/kimaki-opencode-plugin-loading.e2e.test.ts +188 -97
- package/src/kimaki-opencode-plugin.ts +7 -3
- package/src/kimaki-workspace-adaptor.ts +40 -11
- package/src/logger.ts +13 -4
- package/src/markdown.test.ts +13 -3
- package/src/markdown.ts +4 -1
- package/src/message-formatting.test.ts +86 -12
- package/src/message-formatting.ts +19 -7
- package/src/oauth-rotation-shared.ts +10 -0
- package/src/openai-auth-plugin.ts +1 -0
- package/src/openai-auth-state.ts +1 -0
- package/src/opencode-command.test.ts +81 -0
- package/src/opencode.ts +71 -11
- package/src/question-abort-clears-dropdown.e2e.test.ts +109 -0
- package/src/question-text-before-dropdown.e2e.test.ts +67 -0
- package/src/queue-advanced-abort.e2e.test.ts +1 -1
- package/src/queue-advanced-action-buttons.e2e.test.ts +3 -3
- package/src/queue-advanced-e2e-setup.ts +83 -4
- package/src/queue-advanced-footer.e2e.test.ts +47 -294
- package/src/queue-advanced-model-switch.e2e.test.ts +2 -2
- package/src/queue-advanced-permissions-typing.e2e.test.ts +7 -9
- package/src/queue-advanced-question.e2e.test.ts +35 -29
- package/src/queue-advanced-typing-interrupt.e2e.test.ts +2 -2
- package/src/queue-delete-message.e2e.test.ts +1 -1
- package/src/queue-drain-after-interactive-ui.e2e.test.ts +2 -2
- package/src/queue-interrupt-drain.e2e.test.ts +123 -2
- package/src/queue-question-select-drain.e2e.test.ts +32 -157
- package/src/runtime-lifecycle.e2e.test.ts +10 -41
- package/src/schema.sql +14 -1
- package/src/schema.ts +36 -0
- package/src/session-handler/event-stream-state.test.ts +437 -7
- package/src/session-handler/event-stream-state.ts +389 -53
- package/src/session-handler/model-utils.test.ts +415 -0
- package/src/session-handler/model-utils.ts +249 -5
- package/src/session-handler/thread-session-runtime.ts +300 -215
- package/src/session-sleep.test.ts +294 -0
- package/src/session-title-rename.test.ts +9 -48
- package/src/sleep.e2e.test.ts +562 -0
- package/src/startup-time.e2e.test.ts +5 -1
- package/src/store.ts +21 -0
- package/src/system-message.test.ts +86 -6
- package/src/system-message.ts +66 -7
- package/src/task-runner.ts +136 -2
- package/src/task-schedule.test.ts +76 -0
- package/src/task-schedule.ts +95 -0
- package/src/thread-message-queue.e2e.test.ts +10 -202
- package/src/undo-redo.e2e.test.ts +2 -2
- package/src/voice-attachment.ts +29 -1
- package/src/voice-message.e2e.test.ts +10 -10
- package/src/voice.test.ts +63 -29
- package/src/worktree-clone-isolation.e2e.test.ts +213 -0
- package/src/worktree-lifecycle.e2e.test.ts +29 -9
- package/src/worktrees.test.ts +505 -64
- package/src/worktrees.ts +257 -603
- package/src/xai-auth-plugin.ts +1 -0
- package/src/xai-auth-state.ts +1 -0
- package/dist/message-finish-field.e2e.test.js +0 -169
- package/dist/subagent-rate-limit-plugin.js +0 -184
- package/src/message-finish-field.e2e.test.ts +0 -196
- package/src/subagent-rate-limit-plugin.ts +0 -228
|
@@ -510,7 +510,7 @@ describe('agent model resolution', () => {
|
|
|
510
510
|
--- from: assistant (TestBot)
|
|
511
511
|
*using deterministic-provider/agent-model-v2 ⋅ test-agent*
|
|
512
512
|
⬥ ok
|
|
513
|
-
*project ⋅ main ⋅ Ns ⋅ N% ⋅ agent-model-v2 ⋅ **test-agent***"
|
|
513
|
+
*project ⋅ main ⋅ Ns ⋅ N% ⋅ agent-model-v2 ⋅ **test-agent*** <@200000000000000920>"
|
|
514
514
|
`)
|
|
515
515
|
expect(footerMessage).toBeDefined()
|
|
516
516
|
if (!footerMessage) {
|
|
@@ -567,7 +567,7 @@ describe('agent model resolution', () => {
|
|
|
567
567
|
--- from: assistant (TestBot)
|
|
568
568
|
*using deterministic-provider/agent-model-v2 ⋅ test-agent*
|
|
569
569
|
⬥ system-context-ok
|
|
570
|
-
*project ⋅ main ⋅ Ns ⋅ N% ⋅ agent-model-v2 ⋅ **test-agent***"
|
|
570
|
+
*project ⋅ main ⋅ Ns ⋅ N% ⋅ agent-model-v2 ⋅ **test-agent*** <@200000000000000920>"
|
|
571
571
|
`)
|
|
572
572
|
},
|
|
573
573
|
15_000,
|
|
@@ -710,7 +710,7 @@ describe('agent model resolution', () => {
|
|
|
710
710
|
--- from: assistant (TestBot)
|
|
711
711
|
*using deterministic-provider/channel-model-v2*
|
|
712
712
|
⬥ ok
|
|
713
|
-
*project ⋅ main ⋅ Ns ⋅ N% ⋅ channel-model-v2*"
|
|
713
|
+
*project ⋅ main ⋅ Ns ⋅ N% ⋅ channel-model-v2* <@200000000000000920>"
|
|
714
714
|
`)
|
|
715
715
|
expect(footerMessage).toBeDefined()
|
|
716
716
|
if (!footerMessage) {
|
|
@@ -730,48 +730,32 @@ describe('agent model resolution', () => {
|
|
|
730
730
|
)
|
|
731
731
|
|
|
732
732
|
test(
|
|
733
|
-
'channel model
|
|
733
|
+
'unsupported channel model variant falls back to the selected model',
|
|
734
734
|
async () => {
|
|
735
|
-
// Clear channel agent so model resolution falls through to channel model
|
|
736
735
|
const db = await getDb()
|
|
737
736
|
await db.delete(schema.channel_agents).where(orm.eq(schema.channel_agents.channel_id, TEXT_CHANNEL_ID))
|
|
738
|
-
|
|
739
|
-
// Set channel model with a variant (thinking level)
|
|
740
|
-
// The deterministic provider doesn't support thinking, so the variant
|
|
741
|
-
// is resolved but silently dropped (no matching thinking values).
|
|
742
|
-
// This test verifies the variant cascade code path runs without crashing
|
|
743
|
-
// and the correct model still appears in the footer.
|
|
744
737
|
await setChannelModel({
|
|
745
738
|
channelId: TEXT_CHANNEL_ID,
|
|
746
739
|
modelId: `${PROVIDER_NAME}/${CHANNEL_MODEL}`,
|
|
747
740
|
variant: 'high',
|
|
748
741
|
})
|
|
749
742
|
|
|
743
|
+
const prompt = 'Reply with exactly: variant-check'
|
|
750
744
|
await discord.channel(TEXT_CHANNEL_ID).user(TEST_USER_ID).sendMessage({
|
|
751
|
-
content:
|
|
745
|
+
content: prompt,
|
|
752
746
|
})
|
|
753
|
-
|
|
754
747
|
const thread = await discord.channel(TEXT_CHANNEL_ID).waitForThread({
|
|
755
748
|
timeout: 4_000,
|
|
756
|
-
predicate: (
|
|
757
|
-
return t.name === 'Reply with exactly: variant-check'
|
|
758
|
-
},
|
|
749
|
+
predicate: (candidate) => candidate.name === prompt,
|
|
759
750
|
})
|
|
760
|
-
|
|
761
|
-
await waitForBotMessageContaining({
|
|
751
|
+
const messages = await waitForFooterMessage({
|
|
762
752
|
discord,
|
|
763
753
|
threadId: thread.id,
|
|
764
|
-
userId: TEST_USER_ID,
|
|
765
|
-
text: '*project',
|
|
766
754
|
timeout: 4_000,
|
|
767
755
|
})
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
return (
|
|
772
|
-
message.author.id === discord.botUserId &&
|
|
773
|
-
message.content.startsWith('*')
|
|
774
|
-
)
|
|
756
|
+
const footer = messages.find((message) => {
|
|
757
|
+
return message.author.id === discord.botUserId
|
|
758
|
+
&& message.content.startsWith('*')
|
|
775
759
|
})
|
|
776
760
|
|
|
777
761
|
expect(await discord.thread(thread.id).text()).toMatchInlineSnapshot(`
|
|
@@ -780,21 +764,10 @@ describe('agent model resolution', () => {
|
|
|
780
764
|
--- from: assistant (TestBot)
|
|
781
765
|
*using deterministic-provider/channel-model-v2*
|
|
782
766
|
⬥ ok
|
|
783
|
-
*project ⋅ main ⋅ Ns ⋅ N% ⋅ channel-model-v2*"
|
|
767
|
+
*project ⋅ main ⋅ Ns ⋅ N% ⋅ channel-model-v2* <@200000000000000920>"
|
|
784
768
|
`)
|
|
785
|
-
expect(
|
|
786
|
-
|
|
787
|
-
throw new Error(
|
|
788
|
-
`Expected footer message but none found. Bot messages: ${messages
|
|
789
|
-
.filter((m) => m.author.id === discord.botUserId)
|
|
790
|
-
.map((m) => m.content.slice(0, 150))
|
|
791
|
-
.join(' | ')}`,
|
|
792
|
-
)
|
|
793
|
-
}
|
|
794
|
-
|
|
795
|
-
// Footer should still contain the channel model (variant doesn't crash)
|
|
796
|
-
expect(footerMessage.content).toContain(CHANNEL_MODEL)
|
|
797
|
-
expect(footerMessage.content).not.toContain(DEFAULT_MODEL)
|
|
769
|
+
expect(footer?.content).toContain(CHANNEL_MODEL)
|
|
770
|
+
expect(footer?.content).not.toContain(DEFAULT_MODEL)
|
|
798
771
|
},
|
|
799
772
|
15_000,
|
|
800
773
|
)
|
|
@@ -877,7 +850,7 @@ describe('agent model resolution', () => {
|
|
|
877
850
|
Reusing context from <#SOURCE_THREAD> to answer prompt...
|
|
878
851
|
Reply with exactly: btw-model-check
|
|
879
852
|
⬥ ok
|
|
880
|
-
*project ⋅ main ⋅ Ns ⋅ N% ⋅ plan-model-v2*"
|
|
853
|
+
*project ⋅ main ⋅ Ns ⋅ N% ⋅ plan-model-v2* <@200000000000000920>"
|
|
881
854
|
`)
|
|
882
855
|
expect(forkedSessionModel).toMatchInlineSnapshot(`
|
|
883
856
|
{
|
|
@@ -958,12 +931,12 @@ describe('agent model resolution', () => {
|
|
|
958
931
|
--- from: assistant (TestBot)
|
|
959
932
|
*using deterministic-provider/agent-model-v2 ⋅ test-agent*
|
|
960
933
|
⬥ ok
|
|
961
|
-
*project ⋅ main ⋅ Ns ⋅ N% ⋅ agent-model-v2 ⋅ **test-agent***
|
|
934
|
+
*project ⋅ main ⋅ Ns ⋅ N% ⋅ agent-model-v2 ⋅ **test-agent*** <@200000000000000920>
|
|
962
935
|
--- from: user (agent-model-tester)
|
|
963
936
|
Reply with exactly: second-thread-msg
|
|
964
937
|
--- from: assistant (TestBot)
|
|
965
938
|
⬥ ok
|
|
966
|
-
*project ⋅ main ⋅ Ns ⋅ N% ⋅ agent-model-v2 ⋅ **test-agent***"
|
|
939
|
+
*project ⋅ main ⋅ Ns ⋅ N% ⋅ agent-model-v2 ⋅ **test-agent*** <@200000000000000920>"
|
|
967
940
|
`)
|
|
968
941
|
|
|
969
942
|
const secondMessages = await discord.thread(thread.id).getMessages()
|
|
@@ -984,105 +957,6 @@ describe('agent model resolution', () => {
|
|
|
984
957
|
20_000,
|
|
985
958
|
)
|
|
986
959
|
|
|
987
|
-
test(
|
|
988
|
-
'thread created with no agent keeps default model after channel agent is set',
|
|
989
|
-
async () => {
|
|
990
|
-
// Clear any channel agent — thread starts with default (no agent)
|
|
991
|
-
const db = await getDb()
|
|
992
|
-
await db.delete(schema.channel_agents).where(orm.eq(schema.channel_agents.channel_id, TEXT_CHANNEL_ID))
|
|
993
|
-
// Also clear channel model so we get the pure default
|
|
994
|
-
await db.delete(schema.channel_models).where(orm.eq(schema.channel_models.channel_id, TEXT_CHANNEL_ID))
|
|
995
|
-
|
|
996
|
-
// 1. Send a message to create a thread (no channel agent set)
|
|
997
|
-
await discord.channel(TEXT_CHANNEL_ID).user(TEST_USER_ID).sendMessage({
|
|
998
|
-
content: 'Reply with exactly: default-thread-msg',
|
|
999
|
-
})
|
|
1000
|
-
|
|
1001
|
-
const thread = await discord.channel(TEXT_CHANNEL_ID).waitForThread({
|
|
1002
|
-
timeout: 4_000,
|
|
1003
|
-
predicate: (t) => {
|
|
1004
|
-
return t.name === 'Reply with exactly: default-thread-msg'
|
|
1005
|
-
},
|
|
1006
|
-
})
|
|
1007
|
-
|
|
1008
|
-
// Wait for footer — should show the default model
|
|
1009
|
-
await waitForFooterMessage({
|
|
1010
|
-
discord,
|
|
1011
|
-
threadId: thread.id,
|
|
1012
|
-
timeout: 4_000,
|
|
1013
|
-
afterMessageIncludes: 'ok',
|
|
1014
|
-
afterAuthorId: discord.botUserId,
|
|
1015
|
-
})
|
|
1016
|
-
|
|
1017
|
-
const firstMessages = await discord.thread(thread.id).getMessages()
|
|
1018
|
-
const firstFooter = firstMessages.find((m) => {
|
|
1019
|
-
return (
|
|
1020
|
-
m.author.id === discord.botUserId && m.content.startsWith('*')
|
|
1021
|
-
)
|
|
1022
|
-
})
|
|
1023
|
-
expect(firstFooter).toBeDefined()
|
|
1024
|
-
// First run uses the default model (no agent set)
|
|
1025
|
-
expect(firstFooter!.content).toContain(DEFAULT_MODEL)
|
|
1026
|
-
expect(firstFooter!.content).not.toContain(AGENT_MODEL)
|
|
1027
|
-
|
|
1028
|
-
// 2. Set channel agent to test-agent via /test-agent-agent in the CHANNEL
|
|
1029
|
-
const { id: interactionId } = await discord
|
|
1030
|
-
.channel(TEXT_CHANNEL_ID)
|
|
1031
|
-
.user(TEST_USER_ID)
|
|
1032
|
-
.runSlashCommand({ name: 'test-agent-agent' })
|
|
1033
|
-
|
|
1034
|
-
await discord
|
|
1035
|
-
.channel(TEXT_CHANNEL_ID)
|
|
1036
|
-
.waitForInteractionAck({ interactionId, timeout: 4_000 })
|
|
1037
|
-
|
|
1038
|
-
// 3. Send a second message in the EXISTING thread
|
|
1039
|
-
await discord
|
|
1040
|
-
.thread(thread.id)
|
|
1041
|
-
.user(TEST_USER_ID)
|
|
1042
|
-
.sendMessage({
|
|
1043
|
-
content: 'Reply with exactly: default-second-msg',
|
|
1044
|
-
})
|
|
1045
|
-
|
|
1046
|
-
await waitForFooterMessage({
|
|
1047
|
-
discord,
|
|
1048
|
-
threadId: thread.id,
|
|
1049
|
-
timeout: 4_000,
|
|
1050
|
-
afterMessageIncludes: 'default-second-msg',
|
|
1051
|
-
afterAuthorId: TEST_USER_ID,
|
|
1052
|
-
})
|
|
1053
|
-
|
|
1054
|
-
expect(await discord.thread(thread.id).text()).toMatchInlineSnapshot(`
|
|
1055
|
-
"--- from: user (agent-model-tester)
|
|
1056
|
-
Reply with exactly: default-thread-msg
|
|
1057
|
-
--- from: assistant (TestBot)
|
|
1058
|
-
*using deterministic-provider/deterministic-v2*
|
|
1059
|
-
⬥ ok
|
|
1060
|
-
*project ⋅ main ⋅ Ns ⋅ N% ⋅ deterministic-v2*
|
|
1061
|
-
--- from: user (agent-model-tester)
|
|
1062
|
-
Reply with exactly: default-second-msg
|
|
1063
|
-
--- from: assistant (TestBot)
|
|
1064
|
-
⬥ ok
|
|
1065
|
-
*project ⋅ main ⋅ Ns ⋅ N% ⋅ deterministic-v2*"
|
|
1066
|
-
`)
|
|
1067
|
-
|
|
1068
|
-
const secondMessages = await discord.thread(thread.id).getMessages()
|
|
1069
|
-
const secondFooter = [...secondMessages]
|
|
1070
|
-
.reverse()
|
|
1071
|
-
.find((m) => {
|
|
1072
|
-
return (
|
|
1073
|
-
m.author.id === discord.botUserId && m.content.startsWith('*')
|
|
1074
|
-
)
|
|
1075
|
-
})
|
|
1076
|
-
expect(secondFooter).toBeDefined()
|
|
1077
|
-
|
|
1078
|
-
// The existing thread should still use the DEFAULT model,
|
|
1079
|
-
// NOT the test-agent's model (AGENT_MODEL)
|
|
1080
|
-
expect(secondFooter!.content).toContain(DEFAULT_MODEL)
|
|
1081
|
-
expect(secondFooter!.content).not.toContain(AGENT_MODEL)
|
|
1082
|
-
},
|
|
1083
|
-
20_000,
|
|
1084
|
-
)
|
|
1085
|
-
|
|
1086
960
|
test(
|
|
1087
961
|
'/plan-agent with prompt starts a session with the plan agent',
|
|
1088
962
|
async () => {
|
|
@@ -1125,7 +999,7 @@ describe('agent model resolution', () => {
|
|
|
1125
999
|
» **agent-model-tester** (plan): Reply with exactly: inline-plan-agent-msg
|
|
1126
1000
|
*using deterministic-provider/plan-model-v2 ⋅ plan*
|
|
1127
1001
|
⬥ ok
|
|
1128
|
-
*project ⋅ main ⋅ Ns ⋅ N% ⋅ plan-model-v2 ⋅ **plan***"
|
|
1002
|
+
*project ⋅ main ⋅ Ns ⋅ N% ⋅ plan-model-v2 ⋅ **plan*** <@200000000000000920>"
|
|
1129
1003
|
`)
|
|
1130
1004
|
},
|
|
1131
1005
|
20_000,
|
|
@@ -1182,10 +1056,10 @@ describe('agent model resolution', () => {
|
|
|
1182
1056
|
--- from: assistant (TestBot)
|
|
1183
1057
|
*using deterministic-provider/agent-model-v2 ⋅ test-agent*
|
|
1184
1058
|
⬥ ok
|
|
1185
|
-
*project ⋅ main ⋅ Ns ⋅ N% ⋅ agent-model-v2 ⋅ **test-agent***
|
|
1059
|
+
*project ⋅ main ⋅ Ns ⋅ N% ⋅ agent-model-v2 ⋅ **test-agent*** <@200000000000000920>
|
|
1186
1060
|
» **agent-model-tester** (plan): Reply with exactly: inline-existing-plan-msg
|
|
1187
1061
|
⬥ ok
|
|
1188
|
-
*project ⋅ main ⋅ Ns ⋅ N% ⋅ plan-model-v2 ⋅ **plan***"
|
|
1062
|
+
*project ⋅ main ⋅ Ns ⋅ N% ⋅ plan-model-v2 ⋅ **plan*** <@200000000000000920>"
|
|
1189
1063
|
`)
|
|
1190
1064
|
},
|
|
1191
1065
|
20_000,
|
|
@@ -1254,7 +1128,7 @@ describe('agent model resolution', () => {
|
|
|
1254
1128
|
--- from: assistant (TestBot)
|
|
1255
1129
|
*using deterministic-provider/agent-model-v2 ⋅ test-agent*
|
|
1256
1130
|
⬥ ok
|
|
1257
|
-
*project ⋅ main ⋅ Ns ⋅ N% ⋅ agent-model-v2 ⋅ **test-agent***
|
|
1131
|
+
*project ⋅ main ⋅ Ns ⋅ N% ⋅ agent-model-v2 ⋅ **test-agent*** <@200000000000000920>
|
|
1258
1132
|
Switched to **plan** agent for this session (was **test-agent**)
|
|
1259
1133
|
Model: *deterministic-provider/plan-model-v2* (agent "plan")
|
|
1260
1134
|
The agent will change on the next message.
|
|
@@ -1262,7 +1136,7 @@ describe('agent model resolution', () => {
|
|
|
1262
1136
|
Reply with exactly: after-switch-msg
|
|
1263
1137
|
--- from: assistant (TestBot)
|
|
1264
1138
|
⬥ ok
|
|
1265
|
-
*project ⋅ main ⋅ Ns ⋅ N% ⋅ plan-model-v2 ⋅ **plan***"
|
|
1139
|
+
*project ⋅ main ⋅ Ns ⋅ N% ⋅ plan-model-v2 ⋅ **plan*** <@200000000000000920>"
|
|
1266
1140
|
`)
|
|
1267
1141
|
|
|
1268
1142
|
const secondFooter = [...(await discord.thread(thread.id).getMessages())]
|
|
@@ -1327,7 +1201,7 @@ describe('agent model resolution', () => {
|
|
|
1327
1201
|
--- from: assistant (TestBot)
|
|
1328
1202
|
*using deterministic-provider/plan-model-v2 ⋅ plan*
|
|
1329
1203
|
⬥ ok
|
|
1330
|
-
*project ⋅ main ⋅ Ns ⋅ N% ⋅ plan-model-v2 ⋅ **plan***
|
|
1204
|
+
*project ⋅ main ⋅ Ns ⋅ N% ⋅ plan-model-v2 ⋅ **plan*** <@200000000000000920>
|
|
1331
1205
|
Using **plan** agent for this session
|
|
1332
1206
|
Model: *deterministic-provider/plan-model-v2* (agent "plan")
|
|
1333
1207
|
The agent will change on the next message."
|
|
@@ -1380,7 +1254,7 @@ describe('agent model resolution', () => {
|
|
|
1380
1254
|
--- from: assistant (TestBot)
|
|
1381
1255
|
*using deterministic-provider/agent-model-v2 ⋅ test-agent*
|
|
1382
1256
|
⬥ ok
|
|
1383
|
-
*project ⋅ main ⋅ Ns ⋅ N% ⋅ agent-model-v2 ⋅ **test-agent***
|
|
1257
|
+
*project ⋅ main ⋅ Ns ⋅ N% ⋅ agent-model-v2 ⋅ **test-agent*** <@200000000000000920>
|
|
1384
1258
|
Switched to **plan** agent for this session (was **test-agent**)
|
|
1385
1259
|
Model: *deterministic-provider/plan-model-v2* (agent "plan")
|
|
1386
1260
|
The agent will change on the next message."
|
|
@@ -1435,7 +1309,7 @@ describe('agent model resolution', () => {
|
|
|
1435
1309
|
--- from: assistant (TestBot)
|
|
1436
1310
|
*using deterministic-provider/channel-model-v2*
|
|
1437
1311
|
⬥ ok
|
|
1438
|
-
*project ⋅ main ⋅ Ns ⋅ N% ⋅ channel-model-v2*
|
|
1312
|
+
*project ⋅ main ⋅ Ns ⋅ N% ⋅ channel-model-v2* <@200000000000000920>
|
|
1439
1313
|
Switched to **plain** agent for this session
|
|
1440
1314
|
Model: *deterministic-provider/channel-model-v2* (channel override)
|
|
1441
1315
|
This model comes from a channel override. Use /model and press Clear override if you want this agent's model.
|
package/src/bin.ts
CHANGED
|
@@ -35,16 +35,61 @@ if (process.env.__KIMAKI_CHILD || isSubcommand || isHelpFlag) {
|
|
|
35
35
|
console.error('no subcommand detected. kimaki will automatically restart on crash')
|
|
36
36
|
console.error()
|
|
37
37
|
const EXIT_NO_RESTART = 64
|
|
38
|
+
// Keep in sync with EXIT_TEMPFAIL in cli-runner.ts. Network-down login
|
|
39
|
+
// failures use this so a long outage cannot trip the crash-loop detector.
|
|
40
|
+
const EXIT_TEMPFAIL = 75
|
|
38
41
|
const MAX_RAPID_RESTARTS = 5
|
|
39
42
|
const RAPID_RESTART_WINDOW_MS = 60_000
|
|
40
43
|
const RESTART_DELAY_MS = 2_000
|
|
41
44
|
|
|
45
|
+
const CHILD_EXIT_DEADLINE_MS = 15_000
|
|
42
46
|
const restartTimestamps: number[] = []
|
|
47
|
+
let tempFailAttempts = 0
|
|
43
48
|
let child: ReturnType<typeof spawn> | null = null
|
|
44
49
|
// Track when we forwarded a termination signal so we don't restart after graceful shutdown
|
|
45
50
|
let shutdownRequested = false
|
|
51
|
+
let forceKillTimer: ReturnType<typeof setTimeout> | null = null
|
|
52
|
+
let scheduledRestart: ReturnType<typeof setTimeout> | null = null
|
|
53
|
+
|
|
54
|
+
function clearForceKillTimer() {
|
|
55
|
+
if (!forceKillTimer) return
|
|
56
|
+
clearTimeout(forceKillTimer)
|
|
57
|
+
forceKillTimer = null
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function clearScheduledRestart() {
|
|
61
|
+
if (!scheduledRestart) return
|
|
62
|
+
clearTimeout(scheduledRestart)
|
|
63
|
+
scheduledRestart = null
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function killChild(signal: NodeJS.Signals) {
|
|
67
|
+
const target = child
|
|
68
|
+
if (!target) {
|
|
69
|
+
if (shutdownRequested) {
|
|
70
|
+
clearScheduledRestart()
|
|
71
|
+
process.exit(0)
|
|
72
|
+
}
|
|
73
|
+
return
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const sent = target.kill(signal)
|
|
77
|
+
if (!sent || forceKillTimer) return
|
|
78
|
+
|
|
79
|
+
forceKillTimer = setTimeout(() => {
|
|
80
|
+
forceKillTimer = null
|
|
81
|
+
if (child !== target) return
|
|
82
|
+
console.error(
|
|
83
|
+
`[kimaki] Child did not exit within ${CHILD_EXIT_DEADLINE_MS / 1000}s, force-killing it`,
|
|
84
|
+
)
|
|
85
|
+
target.kill('SIGKILL')
|
|
86
|
+
}, CHILD_EXIT_DEADLINE_MS)
|
|
87
|
+
forceKillTimer.unref()
|
|
88
|
+
}
|
|
46
89
|
|
|
47
90
|
function start() {
|
|
91
|
+
if (shutdownRequested) return
|
|
92
|
+
scheduledRestart = null
|
|
48
93
|
if (!fs.existsSync(HEAP_SNAPSHOT_DIR)) {
|
|
49
94
|
fs.mkdirSync(HEAP_SNAPSHOT_DIR, { recursive: true })
|
|
50
95
|
}
|
|
@@ -53,7 +98,7 @@ if (process.env.__KIMAKI_CHILD || isSubcommand || isHelpFlag) {
|
|
|
53
98
|
`--diagnostic-dir=${HEAP_SNAPSHOT_DIR}`,
|
|
54
99
|
]
|
|
55
100
|
const args = [...heapArgs, ...process.execArgv, ...process.argv.slice(1)]
|
|
56
|
-
|
|
101
|
+
const currentChild = spawn(
|
|
57
102
|
process.argv[0]!,
|
|
58
103
|
args,
|
|
59
104
|
{
|
|
@@ -61,41 +106,47 @@ if (process.env.__KIMAKI_CHILD || isSubcommand || isHelpFlag) {
|
|
|
61
106
|
env: { ...process.env, __KIMAKI_CHILD: '1' },
|
|
62
107
|
},
|
|
63
108
|
)
|
|
109
|
+
child = currentChild
|
|
64
110
|
|
|
65
|
-
|
|
111
|
+
currentChild.on('exit', (code, signal) => {
|
|
112
|
+
if (child === currentChild) child = null
|
|
113
|
+
clearForceKillTimer()
|
|
66
114
|
if (code === 0 || code === EXIT_NO_RESTART || shutdownRequested) {
|
|
67
115
|
process.exit(code ?? 0)
|
|
68
116
|
return
|
|
69
117
|
}
|
|
70
118
|
|
|
71
119
|
const now = Date.now()
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
restartTimestamps.
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
120
|
+
const isTempFail = code === EXIT_TEMPFAIL
|
|
121
|
+
if (!isTempFail) {
|
|
122
|
+
restartTimestamps.push(now)
|
|
123
|
+
while (
|
|
124
|
+
restartTimestamps.length > 0 &&
|
|
125
|
+
restartTimestamps[0]! < now - RAPID_RESTART_WINDOW_MS
|
|
126
|
+
) {
|
|
127
|
+
restartTimestamps.shift()
|
|
128
|
+
}
|
|
79
129
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
130
|
+
if (restartTimestamps.length > MAX_RAPID_RESTARTS) {
|
|
131
|
+
console.error(
|
|
132
|
+
`[kimaki] Crash loop detected (${MAX_RAPID_RESTARTS} crashes in ${RAPID_RESTART_WINDOW_MS / 1000}s), exiting`,
|
|
133
|
+
)
|
|
134
|
+
process.exit(1)
|
|
135
|
+
return
|
|
136
|
+
}
|
|
86
137
|
}
|
|
87
138
|
|
|
88
139
|
const reason = signal ? `signal ${signal}` : `code ${code}`
|
|
89
140
|
// Progressive backoff: 2s, 4s, 8s, 16s, capped at 30s.
|
|
90
141
|
// Prevents hammering DNS/gateway during sustained network outages.
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
)
|
|
142
|
+
const backoffStep = isTempFail
|
|
143
|
+
? Math.min(tempFailAttempts++, 4)
|
|
144
|
+
: restartTimestamps.length - 1
|
|
145
|
+
const delay = Math.min(RESTART_DELAY_MS * 2 ** backoffStep, 30_000)
|
|
95
146
|
console.error(
|
|
96
147
|
`[kimaki] Process exited with ${reason}, restarting in ${(delay / 1000).toFixed(0)}s...`,
|
|
97
148
|
)
|
|
98
|
-
setTimeout(start, delay)
|
|
149
|
+
scheduledRestart = setTimeout(start, delay)
|
|
99
150
|
})
|
|
100
151
|
}
|
|
101
152
|
|
|
@@ -104,14 +155,15 @@ if (process.env.__KIMAKI_CHILD || isSubcommand || isHelpFlag) {
|
|
|
104
155
|
for (const sig of ['SIGTERM', 'SIGINT'] as const) {
|
|
105
156
|
process.on(sig, () => {
|
|
106
157
|
shutdownRequested = true
|
|
107
|
-
|
|
108
|
-
})
|
|
109
|
-
}
|
|
110
|
-
for (const sig of ['SIGUSR1', 'SIGUSR2'] as const) {
|
|
111
|
-
process.on(sig, () => {
|
|
112
|
-
child?.kill(sig)
|
|
158
|
+
killChild(sig)
|
|
113
159
|
})
|
|
114
160
|
}
|
|
161
|
+
process.on('SIGUSR1', () => {
|
|
162
|
+
child?.kill('SIGUSR1')
|
|
163
|
+
})
|
|
164
|
+
process.on('SIGUSR2', () => {
|
|
165
|
+
killChild('SIGUSR2')
|
|
166
|
+
})
|
|
115
167
|
|
|
116
168
|
start()
|
|
117
169
|
}
|
|
@@ -87,8 +87,8 @@ cli
|
|
|
87
87
|
|
|
88
88
|
cli
|
|
89
89
|
.command(
|
|
90
|
-
'worktree
|
|
91
|
-
'Merge worktree
|
|
90
|
+
'merge-worktree',
|
|
91
|
+
'Merge the current worktree into a target branch',
|
|
92
92
|
)
|
|
93
93
|
.option('-d, --directory <path>', 'Worktree directory (defaults to cwd)')
|
|
94
94
|
.option(
|
|
@@ -99,14 +99,30 @@ cli
|
|
|
99
99
|
'-n, --name <name>',
|
|
100
100
|
'Worktree/branch name (auto-detected from branch)',
|
|
101
101
|
)
|
|
102
|
+
.option(
|
|
103
|
+
'--strategy [strategy]',
|
|
104
|
+
z.enum(['rebase', 'squash'])
|
|
105
|
+
.default('rebase')
|
|
106
|
+
.describe('Keep commits or squash them into one'),
|
|
107
|
+
)
|
|
108
|
+
.option(
|
|
109
|
+
'--target-branch [branch]',
|
|
110
|
+
z.string()
|
|
111
|
+
.optional()
|
|
112
|
+
.describe('Branch to merge into (defaults to origin/HEAD or main)'),
|
|
113
|
+
)
|
|
114
|
+
.option(
|
|
115
|
+
'--thread [threadId]',
|
|
116
|
+
z.string().optional().describe('Discord thread to mark as merged'),
|
|
117
|
+
)
|
|
118
|
+
.option(
|
|
119
|
+
'--thread-name [name]',
|
|
120
|
+
z.string().optional().describe('Discord thread name after merging'),
|
|
121
|
+
)
|
|
102
122
|
.action(
|
|
103
|
-
async (options
|
|
104
|
-
directory?: string
|
|
105
|
-
mainRepo?: string
|
|
106
|
-
name?: string
|
|
107
|
-
}) => {
|
|
123
|
+
async (options) => {
|
|
108
124
|
try {
|
|
109
|
-
const { mergeWorktree } = await import('../worktrees.js')
|
|
125
|
+
const { formatMergeWorktreeError, mergeWorktree } = await import('../worktrees.js')
|
|
110
126
|
const worktreeDir = path.resolve(options.directory || '.')
|
|
111
127
|
|
|
112
128
|
// Auto-detect main repo: find the main worktree's toplevel.
|
|
@@ -119,7 +135,10 @@ cli
|
|
|
119
135
|
try {
|
|
120
136
|
// `git worktree list --porcelain` first line is always the main worktree
|
|
121
137
|
const { stdout } = await execAsync(
|
|
122
|
-
|
|
138
|
+
{
|
|
139
|
+
command: 'git',
|
|
140
|
+
args: ['-C', worktreeDir, 'worktree', 'list', '--porcelain'],
|
|
141
|
+
},
|
|
123
142
|
)
|
|
124
143
|
const firstLine = stdout.split('\n')[0] || ''
|
|
125
144
|
// Format: "worktree /path/to/main"
|
|
@@ -127,7 +146,10 @@ cli
|
|
|
127
146
|
} catch {
|
|
128
147
|
// Fallback: derive from git common dir
|
|
129
148
|
const { stdout: commonDir } = await execAsync(
|
|
130
|
-
|
|
149
|
+
{
|
|
150
|
+
command: 'git',
|
|
151
|
+
args: ['-C', worktreeDir, 'rev-parse', '--git-common-dir'],
|
|
152
|
+
},
|
|
131
153
|
)
|
|
132
154
|
const resolved = path.isAbsolute(commonDir.trim())
|
|
133
155
|
? commonDir.trim()
|
|
@@ -141,7 +163,10 @@ cli
|
|
|
141
163
|
if (!worktreeName) {
|
|
142
164
|
try {
|
|
143
165
|
const { stdout } = await execAsync(
|
|
144
|
-
|
|
166
|
+
{
|
|
167
|
+
command: 'git',
|
|
168
|
+
args: ['-C', worktreeDir, 'symbolic-ref', '--short', 'HEAD'],
|
|
169
|
+
},
|
|
145
170
|
)
|
|
146
171
|
worktreeName = stdout.trim()
|
|
147
172
|
} catch {
|
|
@@ -159,13 +184,15 @@ cli
|
|
|
159
184
|
worktreeDir,
|
|
160
185
|
mainRepoDir,
|
|
161
186
|
worktreeName,
|
|
187
|
+
strategy: options.strategy,
|
|
188
|
+
targetBranch: options.targetBranch,
|
|
162
189
|
onProgress: (msg) => {
|
|
163
190
|
cliLogger.log(msg)
|
|
164
191
|
},
|
|
165
192
|
})
|
|
166
193
|
|
|
167
194
|
if (result instanceof Error) {
|
|
168
|
-
cliLogger.error(
|
|
195
|
+
cliLogger.error(formatMergeWorktreeError(result, { maxLength: 8000 }))
|
|
169
196
|
if (result instanceof RebaseConflictError) {
|
|
170
197
|
cliLogger.log(
|
|
171
198
|
'Resolve the rebase conflicts, then run this command again.',
|
|
@@ -174,9 +201,28 @@ cli
|
|
|
174
201
|
process.exit(1)
|
|
175
202
|
}
|
|
176
203
|
|
|
204
|
+
const action = options.strategy === 'squash' ? 'Squashed' : 'Merged'
|
|
177
205
|
cliLogger.log(
|
|
178
|
-
|
|
206
|
+
`${action} ${result.branchName} into ${result.defaultBranch} @ ${result.shortSha} (${result.commitCount} source commit${result.commitCount === 1 ? '' : 's'})`,
|
|
179
207
|
)
|
|
208
|
+
if (options.thread && options.threadName) {
|
|
209
|
+
const credentials = await resolveBotCredentials().catch((e) => {
|
|
210
|
+
return new Error('Failed to resolve Discord credentials', { cause: e })
|
|
211
|
+
})
|
|
212
|
+
if (credentials instanceof Error) {
|
|
213
|
+
cliLogger.warn(`Could not update the thread title: ${credentials.message}`)
|
|
214
|
+
} else {
|
|
215
|
+
const rest = createDiscordRest(credentials.token)
|
|
216
|
+
const renameResult = await rest
|
|
217
|
+
.patch(Routes.channel(options.thread), {
|
|
218
|
+
body: { name: options.threadName },
|
|
219
|
+
})
|
|
220
|
+
.catch((e) => new Error('Discord rejected the thread rename', { cause: e }))
|
|
221
|
+
if (renameResult instanceof Error) {
|
|
222
|
+
cliLogger.warn(`Could not update the thread title: ${renameResult.message}`)
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
180
226
|
process.exit(0)
|
|
181
227
|
} catch (error) {
|
|
182
228
|
cliLogger.error(
|
package/src/cli-commands/send.ts
CHANGED
|
@@ -47,6 +47,7 @@ import {
|
|
|
47
47
|
resolveDiscordUserOption,
|
|
48
48
|
sendDiscordMessageWithOptionalAttachment,
|
|
49
49
|
} from '../cli-runner.js'
|
|
50
|
+
import { validateCliModelOption } from '../session-handler/model-utils.js'
|
|
50
51
|
|
|
51
52
|
const cliLogger = createLogger(LogPrefix.CLI)
|
|
52
53
|
const cli = goke()
|
|
@@ -178,6 +179,14 @@ cli
|
|
|
178
179
|
process.exit(EXIT_NO_RESTART)
|
|
179
180
|
}
|
|
180
181
|
|
|
182
|
+
const earlyModelCheck = await validateCliModelOption({
|
|
183
|
+
model: options.model,
|
|
184
|
+
})
|
|
185
|
+
if (earlyModelCheck instanceof Error) {
|
|
186
|
+
cliLogger.error(earlyModelCheck.message)
|
|
187
|
+
process.exit(EXIT_NO_RESTART)
|
|
188
|
+
}
|
|
189
|
+
|
|
181
190
|
const filePaths = options.file?.length
|
|
182
191
|
? options.file.map((f: string) => path.resolve(f))
|
|
183
192
|
: undefined
|
|
@@ -485,6 +494,14 @@ cli
|
|
|
485
494
|
// We only require it for features that genuinely need a local directory
|
|
486
495
|
// (scheduled tasks and --wait).
|
|
487
496
|
const channelConfig = await getChannelDirectory(threadData.parent_id)
|
|
497
|
+
const threadModelCheck = await validateCliModelOption({
|
|
498
|
+
model: options.model,
|
|
499
|
+
directory: channelConfig?.directory,
|
|
500
|
+
})
|
|
501
|
+
if (threadModelCheck instanceof Error) {
|
|
502
|
+
cliLogger.error(threadModelCheck.message)
|
|
503
|
+
process.exit(EXIT_NO_RESTART)
|
|
504
|
+
}
|
|
488
505
|
|
|
489
506
|
// Guard early: fail before sending the message if a feature that
|
|
490
507
|
// needs local project directory mapping is requested.
|
|
@@ -624,6 +641,14 @@ cli
|
|
|
624
641
|
// (--send-at, --wait, --cwd).
|
|
625
642
|
const channelConfig = await getChannelDirectory(channelData.id)
|
|
626
643
|
const projectDirectory = channelConfig?.directory
|
|
644
|
+
const channelModelCheck = await validateCliModelOption({
|
|
645
|
+
model: options.model,
|
|
646
|
+
directory: projectDirectory,
|
|
647
|
+
})
|
|
648
|
+
if (channelModelCheck instanceof Error) {
|
|
649
|
+
cliLogger.error(channelModelCheck.message)
|
|
650
|
+
process.exit(EXIT_NO_RESTART)
|
|
651
|
+
}
|
|
627
652
|
|
|
628
653
|
// Features that require a local project directory mapping
|
|
629
654
|
const needsProjectDirectory = Boolean(parsedSchedule || options.wait || options.cwd)
|