kimaki 0.4.31 → 0.4.32
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/session-handler.js +30 -0
- package/package.json +12 -11
- package/src/cli.ts +0 -0
- package/src/session-handler.ts +31 -0
- package/LICENSE +0 -21
package/dist/session-handler.js
CHANGED
|
@@ -313,8 +313,38 @@ export async function handleOpencodeSession({ prompt, thread, projectDirectory,
|
|
|
313
313
|
stopTyping = startTyping();
|
|
314
314
|
}
|
|
315
315
|
if (part.type === 'tool' && part.state.status === 'running') {
|
|
316
|
+
// Flush any pending text/reasoning parts before showing the tool
|
|
317
|
+
// This ensures text the LLM generated before the tool call is shown first
|
|
318
|
+
for (const p of currentParts) {
|
|
319
|
+
if (p.type !== 'step-start' && p.type !== 'step-finish' && p.id !== part.id) {
|
|
320
|
+
await sendPartMessage(p);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
316
323
|
await sendPartMessage(part);
|
|
317
324
|
}
|
|
325
|
+
// Show token usage for completed tools with large output (>5k tokens)
|
|
326
|
+
if (part.type === 'tool' && part.state.status === 'completed') {
|
|
327
|
+
const output = part.state.output || '';
|
|
328
|
+
const outputTokens = Math.ceil(output.length / 4);
|
|
329
|
+
const LARGE_OUTPUT_THRESHOLD = 3000;
|
|
330
|
+
if (outputTokens >= LARGE_OUTPUT_THRESHOLD) {
|
|
331
|
+
const formattedTokens = outputTokens >= 1000
|
|
332
|
+
? `${(outputTokens / 1000).toFixed(1)}k`
|
|
333
|
+
: String(outputTokens);
|
|
334
|
+
const percentageSuffix = (() => {
|
|
335
|
+
if (!modelContextLimit) {
|
|
336
|
+
return '';
|
|
337
|
+
}
|
|
338
|
+
const pct = (outputTokens / modelContextLimit) * 100;
|
|
339
|
+
if (pct < 1) {
|
|
340
|
+
return '';
|
|
341
|
+
}
|
|
342
|
+
return ` (${pct.toFixed(1)}%)`;
|
|
343
|
+
})();
|
|
344
|
+
const chunk = `⬦ ${part.tool} returned ${formattedTokens} tokens${percentageSuffix}`;
|
|
345
|
+
await thread.send({ content: chunk, flags: SILENT_MESSAGE_FLAGS });
|
|
346
|
+
}
|
|
347
|
+
}
|
|
318
348
|
if (part.type === 'reasoning') {
|
|
319
349
|
await sendPartMessage(part);
|
|
320
350
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,17 @@
|
|
|
2
2
|
"name": "kimaki",
|
|
3
3
|
"module": "index.ts",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "0.4.
|
|
5
|
+
"version": "0.4.32",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "tsx --env-file .env src/cli.ts",
|
|
8
|
+
"prepublishOnly": "pnpm tsc",
|
|
9
|
+
"dev:bun": "DEBUG=1 bun --env-file .env src/cli.ts",
|
|
10
|
+
"watch": "tsx scripts/watch-session.ts",
|
|
11
|
+
"test:events": "tsx test-events.ts",
|
|
12
|
+
"pcm-to-mp3": "bun scripts/pcm-to-mp3",
|
|
13
|
+
"test:send": "tsx send-test-message.ts",
|
|
14
|
+
"register-commands": "tsx scripts/register-commands.ts"
|
|
15
|
+
},
|
|
6
16
|
"repository": "https://github.com/remorses/kimaki",
|
|
7
17
|
"bin": "bin.js",
|
|
8
18
|
"files": [
|
|
@@ -45,14 +55,5 @@
|
|
|
45
55
|
"string-dedent": "^3.0.2",
|
|
46
56
|
"undici": "^7.16.0",
|
|
47
57
|
"zod": "^4.2.1"
|
|
48
|
-
},
|
|
49
|
-
"scripts": {
|
|
50
|
-
"dev": "tsx --env-file .env src/cli.ts",
|
|
51
|
-
"dev:bun": "DEBUG=1 bun --env-file .env src/cli.ts",
|
|
52
|
-
"watch": "tsx scripts/watch-session.ts",
|
|
53
|
-
"test:events": "tsx test-events.ts",
|
|
54
|
-
"pcm-to-mp3": "bun scripts/pcm-to-mp3",
|
|
55
|
-
"test:send": "tsx send-test-message.ts",
|
|
56
|
-
"register-commands": "tsx scripts/register-commands.ts"
|
|
57
58
|
}
|
|
58
|
-
}
|
|
59
|
+
}
|
package/src/cli.ts
CHANGED
|
File without changes
|
package/src/session-handler.ts
CHANGED
|
@@ -437,9 +437,40 @@ export async function handleOpencodeSession({
|
|
|
437
437
|
}
|
|
438
438
|
|
|
439
439
|
if (part.type === 'tool' && part.state.status === 'running') {
|
|
440
|
+
// Flush any pending text/reasoning parts before showing the tool
|
|
441
|
+
// This ensures text the LLM generated before the tool call is shown first
|
|
442
|
+
for (const p of currentParts) {
|
|
443
|
+
if (p.type !== 'step-start' && p.type !== 'step-finish' && p.id !== part.id) {
|
|
444
|
+
await sendPartMessage(p)
|
|
445
|
+
}
|
|
446
|
+
}
|
|
440
447
|
await sendPartMessage(part)
|
|
441
448
|
}
|
|
442
449
|
|
|
450
|
+
// Show token usage for completed tools with large output (>5k tokens)
|
|
451
|
+
if (part.type === 'tool' && part.state.status === 'completed') {
|
|
452
|
+
const output = part.state.output || ''
|
|
453
|
+
const outputTokens = Math.ceil(output.length / 4)
|
|
454
|
+
const LARGE_OUTPUT_THRESHOLD = 3000
|
|
455
|
+
if (outputTokens >= LARGE_OUTPUT_THRESHOLD) {
|
|
456
|
+
const formattedTokens = outputTokens >= 1000
|
|
457
|
+
? `${(outputTokens / 1000).toFixed(1)}k`
|
|
458
|
+
: String(outputTokens)
|
|
459
|
+
const percentageSuffix = (() => {
|
|
460
|
+
if (!modelContextLimit) {
|
|
461
|
+
return ''
|
|
462
|
+
}
|
|
463
|
+
const pct = (outputTokens / modelContextLimit) * 100
|
|
464
|
+
if (pct < 1) {
|
|
465
|
+
return ''
|
|
466
|
+
}
|
|
467
|
+
return ` (${pct.toFixed(1)}%)`
|
|
468
|
+
})()
|
|
469
|
+
const chunk = `⬦ ${part.tool} returned ${formattedTokens} tokens${percentageSuffix}`
|
|
470
|
+
await thread.send({ content: chunk, flags: SILENT_MESSAGE_FLAGS })
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
|
|
443
474
|
if (part.type === 'reasoning') {
|
|
444
475
|
await sendPartMessage(part)
|
|
445
476
|
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Kimaki
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|