kimaki 0.4.90 → 0.4.92
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 +80 -2
- package/dist/anthropic-auth-plugin.js +246 -195
- package/dist/anthropic-auth-plugin.test.js +125 -0
- package/dist/anthropic-auth-state.js +231 -0
- package/dist/bin.js +6 -3
- package/dist/cli-parsing.test.js +23 -0
- package/dist/cli-send-thread.e2e.test.js +78 -3
- package/dist/cli.js +72 -46
- package/dist/commands/merge-worktree.js +6 -3
- package/dist/commands/new-worktree.js +18 -7
- package/dist/commands/worktrees.js +71 -7
- package/dist/context-awareness-plugin.js +52 -50
- package/dist/context-awareness-plugin.test.js +68 -1
- package/dist/discord-bot.js +126 -54
- package/dist/discord-utils.test.js +19 -0
- package/dist/errors.js +0 -5
- package/dist/exec-async.js +26 -0
- package/dist/external-opencode-sync.js +37 -72
- package/dist/forum-sync/config.js +2 -2
- package/dist/forum-sync/markdown.js +4 -8
- package/dist/hrana-server.js +11 -3
- package/dist/image-optimizer-plugin.js +153 -0
- package/dist/ipc-tools-plugin.js +11 -4
- package/dist/kimaki-opencode-plugin.js +1 -0
- package/dist/logger.js +0 -1
- package/dist/markdown.js +2 -2
- package/dist/message-preprocessing.js +100 -16
- package/dist/onboarding-tutorial.js +1 -1
- package/dist/opencode-command-detection.js +65 -0
- package/dist/opencode-command-detection.test.js +240 -0
- package/dist/opencode-interrupt-plugin.js +64 -8
- package/dist/opencode-interrupt-plugin.test.js +23 -39
- package/dist/opencode.js +16 -20
- package/dist/pkce.js +23 -0
- package/dist/plugin-logger.js +59 -0
- package/dist/queue-advanced-permissions-typing.e2e.test.js +1 -1
- package/dist/queue-advanced-question.e2e.test.js +127 -42
- package/dist/sentry.js +7 -114
- package/dist/session-handler/event-stream-state.js +1 -1
- package/dist/session-handler/thread-runtime-state.js +9 -0
- package/dist/session-handler/thread-session-runtime.js +205 -48
- package/dist/session-title-rename.test.js +80 -0
- package/dist/store.js +1 -2
- package/dist/system-message.js +118 -49
- package/dist/system-message.test.js +611 -15
- package/dist/task-runner.js +7 -4
- package/dist/task-schedule.js +2 -0
- package/dist/thread-message-queue.e2e.test.js +18 -11
- package/dist/unnest-code-blocks.js +11 -1
- package/dist/unnest-code-blocks.test.js +32 -0
- package/dist/voice-handler.js +15 -5
- package/dist/voice.js +53 -23
- package/dist/voice.test.js +2 -0
- package/dist/worktrees.js +111 -120
- package/package.json +15 -19
- package/skills/lintcn/SKILL.md +6 -1
- package/skills/new-skill/SKILL.md +211 -0
- package/skills/npm-package/SKILL.md +3 -2
- package/skills/spiceflow/SKILL.md +1 -1
- package/skills/usecomputer/SKILL.md +174 -249
- package/src/agent-model.e2e.test.ts +95 -2
- package/src/anthropic-auth-plugin.test.ts +159 -0
- package/src/anthropic-auth-plugin.ts +474 -403
- package/src/anthropic-auth-state.ts +282 -0
- package/src/bin.ts +6 -3
- package/src/cli-parsing.test.ts +32 -0
- package/src/cli-send-thread.e2e.test.ts +100 -3
- package/src/cli.ts +93 -62
- package/src/commands/merge-worktree.ts +8 -3
- package/src/commands/new-worktree.ts +22 -10
- package/src/commands/worktrees.ts +86 -5
- package/src/context-awareness-plugin.test.ts +77 -1
- package/src/context-awareness-plugin.ts +85 -64
- package/src/discord-bot.ts +135 -56
- package/src/discord-utils.test.ts +21 -0
- package/src/errors.ts +0 -6
- package/src/exec-async.ts +35 -0
- package/src/external-opencode-sync.ts +43 -85
- package/src/forum-sync/config.ts +2 -2
- package/src/forum-sync/markdown.ts +5 -9
- package/src/hrana-server.ts +15 -3
- package/src/image-optimizer-plugin.ts +194 -0
- package/src/ipc-tools-plugin.ts +16 -8
- package/src/kimaki-opencode-plugin.ts +1 -0
- package/src/logger.ts +0 -1
- package/src/markdown.ts +2 -2
- package/src/message-preprocessing.ts +117 -16
- package/src/onboarding-tutorial.ts +1 -1
- package/src/opencode-command-detection.test.ts +307 -0
- package/src/opencode-command-detection.ts +76 -0
- package/src/opencode-interrupt-plugin.test.ts +93 -50
- package/src/opencode-interrupt-plugin.ts +86 -9
- package/src/opencode.ts +16 -22
- package/src/plugin-logger.ts +68 -0
- package/src/queue-advanced-permissions-typing.e2e.test.ts +1 -1
- package/src/queue-advanced-question.e2e.test.ts +243 -158
- package/src/sentry.ts +7 -120
- package/src/session-handler/event-stream-state.ts +1 -1
- package/src/session-handler/thread-runtime-state.ts +17 -0
- package/src/session-handler/thread-session-runtime.ts +240 -49
- package/src/session-title-rename.test.ts +112 -0
- package/src/store.ts +3 -8
- package/src/system-message.test.ts +625 -0
- package/src/system-message.ts +149 -63
- package/src/task-runner.ts +7 -4
- package/src/task-schedule.ts +3 -0
- package/src/thread-message-queue.e2e.test.ts +22 -11
- package/src/undici.d.ts +12 -0
- package/src/unnest-code-blocks.test.ts +34 -0
- package/src/unnest-code-blocks.ts +18 -1
- package/src/voice-handler.ts +18 -4
- package/src/voice.test.ts +2 -0
- package/src/voice.ts +68 -23
- package/src/worktrees.ts +152 -156
|
@@ -68,7 +68,7 @@ function createDeterministicMatchers() {
|
|
|
68
68
|
when: {
|
|
69
69
|
lastMessageRole: 'user',
|
|
70
70
|
latestUserTextIncludes: 'Reply with exactly: system-context-check',
|
|
71
|
-
|
|
71
|
+
promptTextIncludes: `<discord-user name="agent-model-tester" user-id="${TEST_USER_ID}"`,
|
|
72
72
|
},
|
|
73
73
|
then: {
|
|
74
74
|
parts: [
|
|
@@ -89,6 +89,33 @@ function createDeterministicMatchers() {
|
|
|
89
89
|
partDelaysMs: [0, 100, 0, 0, 0],
|
|
90
90
|
},
|
|
91
91
|
};
|
|
92
|
+
const replyContextMatcher = {
|
|
93
|
+
id: 'reply-context-check',
|
|
94
|
+
priority: 15,
|
|
95
|
+
when: {
|
|
96
|
+
lastMessageRole: 'user',
|
|
97
|
+
latestUserTextIncludes: 'Reply with exactly: reply-context-check',
|
|
98
|
+
promptTextIncludes: 'This message was a reply to message\n\n<replied-message author="agent-model-tester">\nfirst message in thread\n</replied-message>',
|
|
99
|
+
},
|
|
100
|
+
then: {
|
|
101
|
+
parts: [
|
|
102
|
+
{ type: 'stream-start', warnings: [] },
|
|
103
|
+
{ type: 'text-start', id: 'reply-context-reply' },
|
|
104
|
+
{
|
|
105
|
+
type: 'text-delta',
|
|
106
|
+
id: 'reply-context-reply',
|
|
107
|
+
delta: 'reply-context-ok',
|
|
108
|
+
},
|
|
109
|
+
{ type: 'text-end', id: 'reply-context-reply' },
|
|
110
|
+
{
|
|
111
|
+
type: 'finish',
|
|
112
|
+
finishReason: 'stop',
|
|
113
|
+
usage: { inputTokens: 1, outputTokens: 1, totalTokens: 2 },
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
partDelaysMs: [0, 100, 0, 0, 0],
|
|
117
|
+
},
|
|
118
|
+
};
|
|
92
119
|
const userReplyMatcher = {
|
|
93
120
|
id: 'user-reply',
|
|
94
121
|
priority: 10,
|
|
@@ -111,7 +138,7 @@ function createDeterministicMatchers() {
|
|
|
111
138
|
partDelaysMs: [0, 100, 0, 0, 0],
|
|
112
139
|
},
|
|
113
140
|
};
|
|
114
|
-
return [systemContextMatcher, userReplyMatcher];
|
|
141
|
+
return [systemContextMatcher, replyContextMatcher, userReplyMatcher];
|
|
115
142
|
}
|
|
116
143
|
/**
|
|
117
144
|
* Create an opencode agent .md file that uses a specific model.
|
|
@@ -349,6 +376,57 @@ describe('agent model resolution', () => {
|
|
|
349
376
|
*project ⋅ main ⋅ Ns ⋅ N% ⋅ agent-model-v2 ⋅ **test-agent***"
|
|
350
377
|
`);
|
|
351
378
|
}, 15_000);
|
|
379
|
+
test('reply message injects replied-message context', async () => {
|
|
380
|
+
await discord.channel(TEXT_CHANNEL_ID).user(TEST_USER_ID).sendMessage({
|
|
381
|
+
content: 'first message in thread',
|
|
382
|
+
});
|
|
383
|
+
const thread = await discord.channel(TEXT_CHANNEL_ID).waitForThread({
|
|
384
|
+
timeout: 4_000,
|
|
385
|
+
predicate: (t) => {
|
|
386
|
+
return t.name === 'first message in thread';
|
|
387
|
+
},
|
|
388
|
+
});
|
|
389
|
+
const threadMessagesBeforeReply = await discord.thread(thread.id).getMessages();
|
|
390
|
+
const firstUserMessage = threadMessagesBeforeReply.find((message) => {
|
|
391
|
+
return (message.author.id === TEST_USER_ID
|
|
392
|
+
&& message.content === 'first message in thread');
|
|
393
|
+
});
|
|
394
|
+
expect(firstUserMessage).toBeDefined();
|
|
395
|
+
if (!firstUserMessage) {
|
|
396
|
+
throw new Error('Expected first user message in thread');
|
|
397
|
+
}
|
|
398
|
+
await discord.thread(thread.id).user(TEST_USER_ID).sendMessage({
|
|
399
|
+
content: 'Reply with exactly: reply-context-check',
|
|
400
|
+
messageReference: {
|
|
401
|
+
message_id: firstUserMessage.id,
|
|
402
|
+
channel_id: thread.id,
|
|
403
|
+
guild_id: discord.guildId,
|
|
404
|
+
},
|
|
405
|
+
});
|
|
406
|
+
await waitForBotMessageContaining({
|
|
407
|
+
discord,
|
|
408
|
+
threadId: thread.id,
|
|
409
|
+
userId: TEST_USER_ID,
|
|
410
|
+
text: 'reply-context-ok',
|
|
411
|
+
timeout: 4_000,
|
|
412
|
+
});
|
|
413
|
+
await waitForFooterMessage({
|
|
414
|
+
discord,
|
|
415
|
+
threadId: thread.id,
|
|
416
|
+
timeout: 4_000,
|
|
417
|
+
afterMessageIncludes: 'reply-context-ok',
|
|
418
|
+
afterAuthorId: discord.botUserId,
|
|
419
|
+
});
|
|
420
|
+
expect(await discord.thread(thread.id).text()).toMatchInlineSnapshot(`
|
|
421
|
+
"--- from: user (agent-model-tester)
|
|
422
|
+
first message in thread
|
|
423
|
+
Reply with exactly: reply-context-check
|
|
424
|
+
--- from: assistant (TestBot)
|
|
425
|
+
⬥ ok
|
|
426
|
+
⬥ reply-context-ok
|
|
427
|
+
*project ⋅ main ⋅ Ns ⋅ N% ⋅ agent-model-v2 ⋅ **test-agent***"
|
|
428
|
+
`);
|
|
429
|
+
}, 15_000);
|
|
352
430
|
test('new thread uses channel model when channel model preference is set', async () => {
|
|
353
431
|
// Clear channel agent so model resolution falls through to channel model
|
|
354
432
|
const prisma = await getPrisma();
|