@meetopenbot/pi 0.1.2 → 0.1.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/stream.js +19 -2
- package/package.json +2 -2
package/dist/stream.js
CHANGED
|
@@ -2,6 +2,23 @@ import { createTextReplyBuffer, textReply, yieldFromBackgroundQueue, } from '@me
|
|
|
2
2
|
import { remapPiError } from './credits.js';
|
|
3
3
|
const isAssistantMessage = (message) => message.role === 'assistant';
|
|
4
4
|
export const classifyPiEvent = (event) => {
|
|
5
|
+
if (event.type === 'tool_execution_start') {
|
|
6
|
+
return {
|
|
7
|
+
type: 'tool_call',
|
|
8
|
+
id: event.toolCallId,
|
|
9
|
+
name: event.toolName,
|
|
10
|
+
input: event.args,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
if (event.type === 'tool_execution_end') {
|
|
14
|
+
return {
|
|
15
|
+
type: 'tool_result',
|
|
16
|
+
id: event.toolCallId,
|
|
17
|
+
name: event.toolName,
|
|
18
|
+
output: event.result,
|
|
19
|
+
error: event.isError,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
5
22
|
if (event.type === 'message_update') {
|
|
6
23
|
const assistantEvent = event.assistantMessageEvent;
|
|
7
24
|
if (assistantEvent.type === 'text_delta')
|
|
@@ -23,9 +40,9 @@ function* consumePiEvent(event, replies) {
|
|
|
23
40
|
}
|
|
24
41
|
yield* replies.apply(classifyPiEvent(event));
|
|
25
42
|
}
|
|
26
|
-
/** Run a Pi prompt and yield each completed assistant turn. */
|
|
43
|
+
/** Run a Pi prompt and yield each completed assistant turn and tool widget. */
|
|
27
44
|
export async function* runPiPrompt(session, prompt, options) {
|
|
28
|
-
const replies = createTextReplyBuffer();
|
|
45
|
+
const replies = createTextReplyBuffer({ groupId: 'pi:tools' });
|
|
29
46
|
yield* yieldFromBackgroundQueue(async (enqueue) => {
|
|
30
47
|
const unsubscribe = session.subscribe((event) => {
|
|
31
48
|
for (const item of consumePiEvent(event, replies))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meetopenbot/pi",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "OpenBot agent plugin powered by the Pi coding agent SDK.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@earendil-works/pi-ai": "^0.79.1",
|
|
23
23
|
"@earendil-works/pi-coding-agent": "^0.79.1",
|
|
24
|
-
"@meetopenbot/plugin-sdk": "^0.
|
|
24
|
+
"@meetopenbot/plugin-sdk": "^0.5.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/node": "^25.9.2",
|