openrune 0.3.4 → 0.3.5
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/bin/rune.js +36 -15
- package/package.json +1 -1
package/bin/rune.js
CHANGED
|
@@ -765,31 +765,52 @@ function runRune(file, restArgs) {
|
|
|
765
765
|
|
|
766
766
|
let fullOutput = ''
|
|
767
767
|
|
|
768
|
+
let buffer = ''
|
|
768
769
|
child.stdout.on('data', (data) => {
|
|
769
|
-
|
|
770
|
+
buffer += data.toString()
|
|
771
|
+
const lines = buffer.split('\n')
|
|
772
|
+
buffer = lines.pop() // keep incomplete line in buffer
|
|
770
773
|
for (const line of lines) {
|
|
774
|
+
if (!line.trim()) continue
|
|
771
775
|
try {
|
|
772
776
|
const event = JSON.parse(line)
|
|
773
777
|
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
const
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
778
|
+
// Tool use events
|
|
779
|
+
if (event.type === 'assistant' && event.message && event.message.content) {
|
|
780
|
+
for (const block of event.message.content) {
|
|
781
|
+
if (block.type === 'tool_use') {
|
|
782
|
+
const tool = block.name || 'unknown'
|
|
783
|
+
const input = block.input || {}
|
|
784
|
+
if (tool === 'Bash') {
|
|
785
|
+
console.log(` ▶ Bash: ${(input.command || '').slice(0, 120)}`)
|
|
786
|
+
} else if (tool === 'Write') {
|
|
787
|
+
console.log(` ▶ Write: ${input.file_path || ''}`)
|
|
788
|
+
} else if (tool === 'Edit') {
|
|
789
|
+
console.log(` ▶ Edit: ${input.file_path || ''}`)
|
|
790
|
+
} else if (tool === 'Read') {
|
|
791
|
+
console.log(` ▶ Read: ${input.file_path || ''}`)
|
|
792
|
+
} else if (tool === 'Grep') {
|
|
793
|
+
console.log(` ▶ Grep: ${input.pattern || ''}`)
|
|
794
|
+
} else if (tool === 'Glob') {
|
|
795
|
+
console.log(` ▶ Glob: ${input.pattern || ''}`)
|
|
796
|
+
} else {
|
|
797
|
+
console.log(` ▶ ${tool}`)
|
|
798
|
+
}
|
|
799
|
+
} else if (block.type === 'text' && block.text && block.text.trim()) {
|
|
800
|
+
console.log(` 💬 ${block.text.trim().slice(0, 200)}`)
|
|
801
|
+
}
|
|
787
802
|
}
|
|
788
803
|
}
|
|
789
804
|
|
|
805
|
+
// Tool results
|
|
806
|
+
if (event.type === 'user' && event.tool_use_result) {
|
|
807
|
+
// silently track tool results
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
// Final result
|
|
790
811
|
if (event.type === 'result') {
|
|
791
812
|
fullOutput = event.result || ''
|
|
792
|
-
console.log(`\n${fullOutput}`)
|
|
813
|
+
if (fullOutput) console.log(`\n${fullOutput}`)
|
|
793
814
|
}
|
|
794
815
|
} catch {}
|
|
795
816
|
}
|
package/package.json
CHANGED