kimaki 0.3.2 → 0.4.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.
@@ -718,7 +718,6 @@ function formatPart(part) {
718
718
  return `▪︎ thinking: ${escapeDiscordFormatting(part.text || '')}`;
719
719
  case 'tool':
720
720
  if (part.state.status === 'completed' || part.state.status === 'error') {
721
- let language = '';
722
721
  let outputToDisplay = '';
723
722
  let summaryText = '';
724
723
  if (part.tool === 'bash') {
@@ -740,6 +739,23 @@ function formatPart(part) {
740
739
  const lines = content.split('\n').length;
741
740
  summaryText = `(${lines} line${lines === 1 ? '' : 's'})`;
742
741
  }
742
+ else if (part.tool === 'read') {
743
+ }
744
+ else if (part.tool === 'write') {
745
+ }
746
+ else if (part.tool === 'edit') {
747
+ }
748
+ else if (part.tool === 'list') {
749
+ }
750
+ else if (part.tool === 'glob') {
751
+ }
752
+ else if (part.tool === 'grep') {
753
+ }
754
+ else if (part.tool === 'task') {
755
+ }
756
+ else if (part.tool === 'todoread') {
757
+ // Special handling for read - don't show arguments
758
+ }
743
759
  else if (part.tool === 'todowrite') {
744
760
  const todos = part.state.input?.todos || [];
745
761
  outputToDisplay = todos
@@ -775,12 +791,14 @@ function formatPart(part) {
775
791
  if (value === null || value === undefined)
776
792
  return null;
777
793
  const stringValue = typeof value === 'string' ? value : JSON.stringify(value);
778
- const truncatedValue = stringValue.length > 100 ? stringValue.slice(0, 100) + '…' : stringValue;
794
+ const truncatedValue = stringValue.length > 100
795
+ ? stringValue.slice(0, 100) + '…'
796
+ : stringValue;
779
797
  return `${key}: ${truncatedValue}`;
780
798
  })
781
799
  .filter(Boolean);
782
800
  if (inputFields.length > 0) {
783
- outputToDisplay = inputFields.join('\n');
801
+ outputToDisplay = inputFields.join(', ');
784
802
  }
785
803
  }
786
804
  let toolTitle = part.state.status === 'completed' ? part.state.title || '' : 'error';
@@ -1174,12 +1192,14 @@ async function handleOpencodeSession(prompt, thread, projectDirectory, originalM
1174
1192
  }
1175
1193
  }
1176
1194
  // Always log the error's constructor name (if any) and make error reporting more readable
1177
- const errorName = error && typeof error === 'object' && 'constructor' in error && error.constructor && typeof error.constructor.name === 'string'
1195
+ const errorName = error &&
1196
+ typeof error === 'object' &&
1197
+ 'constructor' in error &&
1198
+ error.constructor &&
1199
+ typeof error.constructor.name === 'string'
1178
1200
  ? error.constructor.name
1179
1201
  : typeof error;
1180
- const errorMsg = error instanceof Error
1181
- ? (error.stack || error.message)
1182
- : String(error);
1202
+ const errorMsg = error instanceof Error ? error.stack || error.message : String(error);
1183
1203
  await sendThreadMessage(thread, `✗ Unexpected bot Error: [${errorName}]\n${errorMsg}`);
1184
1204
  }
1185
1205
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "kimaki",
3
3
  "module": "index.ts",
4
4
  "type": "module",
5
- "version": "0.3.2",
5
+ "version": "0.4.0",
6
6
  "repository": "https://github.com/remorses/kimaki",
7
7
  "bin": "bin.js",
8
8
  "files": [
package/src/discordBot.ts CHANGED
@@ -945,6 +945,7 @@ export async function initializeOpencodeForDirectory(directory: string) {
945
945
  }
946
946
  }
947
947
 
948
+
948
949
  function formatPart(part: Part): string {
949
950
  switch (part.type) {
950
951
  case 'text':
@@ -954,7 +955,6 @@ function formatPart(part: Part): string {
954
955
  return `▪︎ thinking: ${escapeDiscordFormatting(part.text || '')}`
955
956
  case 'tool':
956
957
  if (part.state.status === 'completed' || part.state.status === 'error') {
957
- let language = ''
958
958
  let outputToDisplay = ''
959
959
  let summaryText = ''
960
960
 
@@ -975,6 +975,15 @@ function formatPart(part: Part): string {
975
975
  const content = (part.state.input?.content as string) || ''
976
976
  const lines = content.split('\n').length
977
977
  summaryText = `(${lines} line${lines === 1 ? '' : 's'})`
978
+ } else if (part.tool === 'read') {
979
+ } else if (part.tool === 'write') {
980
+ } else if (part.tool === 'edit') {
981
+ } else if (part.tool === 'list') {
982
+ } else if (part.tool === 'glob') {
983
+ } else if (part.tool === 'grep') {
984
+ } else if (part.tool === 'task') {
985
+ } else if (part.tool === 'todoread') {
986
+ // Special handling for read - don't show arguments
978
987
  } else if (part.tool === 'todowrite') {
979
988
  const todos =
980
989
  (part.state.input?.todos as {
@@ -1010,13 +1019,17 @@ function formatPart(part: Part): string {
1010
1019
  const inputFields = Object.entries(part.state.input)
1011
1020
  .map(([key, value]) => {
1012
1021
  if (value === null || value === undefined) return null
1013
- const stringValue = typeof value === 'string' ? value : JSON.stringify(value)
1014
- const truncatedValue = stringValue.length > 100 ? stringValue.slice(0, 100) + '…' : stringValue
1022
+ const stringValue =
1023
+ typeof value === 'string' ? value : JSON.stringify(value)
1024
+ const truncatedValue =
1025
+ stringValue.length > 100
1026
+ ? stringValue.slice(0, 100) + '…'
1027
+ : stringValue
1015
1028
  return `${key}: ${truncatedValue}`
1016
1029
  })
1017
1030
  .filter(Boolean)
1018
1031
  if (inputFields.length > 0) {
1019
- outputToDisplay = inputFields.join('\n')
1032
+ outputToDisplay = inputFields.join(', ')
1020
1033
  }
1021
1034
  }
1022
1035
 
@@ -1515,12 +1528,16 @@ async function handleOpencodeSession(
1515
1528
  }
1516
1529
  }
1517
1530
  // Always log the error's constructor name (if any) and make error reporting more readable
1518
- const errorName = error && typeof error === 'object' && 'constructor' in error && error.constructor && typeof error.constructor.name === 'string'
1519
- ? error.constructor.name
1520
- : typeof error
1521
- const errorMsg = error instanceof Error
1522
- ? (error.stack || error.message)
1523
- : String(error)
1531
+ const errorName =
1532
+ error &&
1533
+ typeof error === 'object' &&
1534
+ 'constructor' in error &&
1535
+ error.constructor &&
1536
+ typeof error.constructor.name === 'string'
1537
+ ? error.constructor.name
1538
+ : typeof error
1539
+ const errorMsg =
1540
+ error instanceof Error ? error.stack || error.message : String(error)
1524
1541
  await sendThreadMessage(
1525
1542
  thread,
1526
1543
  `✗ Unexpected bot Error: [${errorName}]\n${errorMsg}`,