chatroom-cli 1.4.2 → 1.4.3
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/index.js +21 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10613,6 +10613,7 @@ class PiRpcReader {
|
|
|
10613
10613
|
thinkingDeltaCallbacks = [];
|
|
10614
10614
|
agentEndCallbacks = [];
|
|
10615
10615
|
toolCallCallbacks = [];
|
|
10616
|
+
toolResultCallbacks = [];
|
|
10616
10617
|
anyEventCallbacks = [];
|
|
10617
10618
|
constructor(stream) {
|
|
10618
10619
|
const rl = createInterface({ input: stream, crlfDelay: Infinity });
|
|
@@ -10630,6 +10631,9 @@ class PiRpcReader {
|
|
|
10630
10631
|
onToolCall(cb) {
|
|
10631
10632
|
this.toolCallCallbacks.push(cb);
|
|
10632
10633
|
}
|
|
10634
|
+
onToolResult(cb) {
|
|
10635
|
+
this.toolResultCallbacks.push(cb);
|
|
10636
|
+
}
|
|
10633
10637
|
onAnyEvent(cb) {
|
|
10634
10638
|
this.anyEventCallbacks.push(cb);
|
|
10635
10639
|
}
|
|
@@ -10677,6 +10681,15 @@ class PiRpcReader {
|
|
|
10677
10681
|
}
|
|
10678
10682
|
return;
|
|
10679
10683
|
}
|
|
10684
|
+
if (type === "tool_execution_end") {
|
|
10685
|
+
const toolName = event["toolName"];
|
|
10686
|
+
const toolResult = event["toolResult"] ?? event["output"] ?? event;
|
|
10687
|
+
if (typeof toolName === "string") {
|
|
10688
|
+
for (const cb of this.toolResultCallbacks)
|
|
10689
|
+
cb(toolName, toolResult);
|
|
10690
|
+
}
|
|
10691
|
+
return;
|
|
10692
|
+
}
|
|
10680
10693
|
}
|
|
10681
10694
|
}
|
|
10682
10695
|
var init_pi_rpc_reader = () => {};
|
|
@@ -10813,10 +10826,16 @@ var init_pi_agent_service = __esm(() => {
|
|
|
10813
10826
|
process.stdout.write(`${logPrefix} agent_end]
|
|
10814
10827
|
`);
|
|
10815
10828
|
});
|
|
10816
|
-
reader.onToolCall((name) => {
|
|
10829
|
+
reader.onToolCall((name, args2) => {
|
|
10817
10830
|
flushText();
|
|
10818
10831
|
flushThinking();
|
|
10819
|
-
|
|
10832
|
+
const argsStr = args2 != null ? ` args: ${JSON.stringify(args2)}` : "";
|
|
10833
|
+
process.stdout.write(`${logPrefix} tool: ${name}${argsStr}]
|
|
10834
|
+
`);
|
|
10835
|
+
});
|
|
10836
|
+
reader.onToolResult((name, result) => {
|
|
10837
|
+
const resultStr = typeof result === "string" ? result : JSON.stringify(result);
|
|
10838
|
+
process.stdout.write(`${logPrefix} tool_result: ${name} result: ${resultStr}]
|
|
10820
10839
|
`);
|
|
10821
10840
|
});
|
|
10822
10841
|
if (childProcess.stderr) {
|