@kybernesis/buzz 0.11.0 → 0.12.1
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/extension/_manifest.json +2 -2
- package/dist/hitl.d.ts +6 -1
- package/dist/hitl.js +9 -2
- package/dist/turn.js +13 -3
- package/package.json +5 -4
package/dist/hitl.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { type ClientSession, type InputRequest, type InputResponse } from "eve/client";
|
|
2
2
|
import type { StoredSession } from "./sessions.js";
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* Render pending Eve input in a text-only Buzz channel.
|
|
5
|
+
*
|
|
6
|
+
* A Kybernesis tool may put a `[kyb:…] {json}` marker on a question's first
|
|
7
|
+
* line for apps that draw it as a card. Buzz shows only the sentence after it.
|
|
8
|
+
*/
|
|
4
9
|
export declare function formatInputRequests(requests: readonly InputRequest[]): string;
|
|
5
10
|
/** Resolve a Buzz text reply using Eve's certified matching semantics. */
|
|
6
11
|
export declare function resolveInputReply(text: string, requests: readonly InputRequest[]): readonly InputResponse[] | null;
|
package/dist/hitl.js
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import { resolveTextToResponses, } from "eve/client";
|
|
2
|
-
|
|
2
|
+
import { promptText } from "@kybernesis/cards";
|
|
3
|
+
/**
|
|
4
|
+
* Render pending Eve input in a text-only Buzz channel.
|
|
5
|
+
*
|
|
6
|
+
* A Kybernesis tool may put a `[kyb:…] {json}` marker on a question's first
|
|
7
|
+
* line for apps that draw it as a card. Buzz shows only the sentence after it.
|
|
8
|
+
*/
|
|
3
9
|
export function formatInputRequests(requests) {
|
|
4
10
|
return requests.map((request, requestIndex) => {
|
|
11
|
+
const prompt = promptText(request.prompt);
|
|
5
12
|
const lines = [
|
|
6
|
-
requests.length > 1 ? `Question ${requestIndex + 1}: ${
|
|
13
|
+
requests.length > 1 ? `Question ${requestIndex + 1}: ${prompt}` : prompt,
|
|
7
14
|
];
|
|
8
15
|
if (request.options?.length) {
|
|
9
16
|
lines.push("", ...request.options.map((option, optionIndex) => {
|
package/dist/turn.js
CHANGED
|
@@ -196,6 +196,15 @@ async function drainUnread(stream, timeouts) {
|
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
198
|
const isTurnBoundary = (type) => type === "session.waiting" || type === "session.completed" || type === "session.failed";
|
|
199
|
+
/**
|
|
200
|
+
* eve ≥0.69 no longer ends a turn at a question or sign-in from inside a tool:
|
|
201
|
+
* it emits `turn.waiting` with `on: "input"` and holds the turn open, and the
|
|
202
|
+
* answer resumes that same turn. For the bridge that is where this send stops,
|
|
203
|
+
* as `session.waiting` did before, with the questions to relay. eve's own
|
|
204
|
+
* `result()` stops at the same event. `on: "tasks"` is not a stop: delegated
|
|
205
|
+
* work is running and the reply is still to come.
|
|
206
|
+
*/
|
|
207
|
+
const isHeldForInput = (event) => event.type === "turn.waiting" && event.data?.on === "input";
|
|
199
208
|
async function collectResponse(response, watchdog, phase, streamIndex, continueStream, log = () => { }) {
|
|
200
209
|
let message = "";
|
|
201
210
|
let status = "completed";
|
|
@@ -242,7 +251,7 @@ async function collectResponse(response, watchdog, phase, streamIndex, continueS
|
|
|
242
251
|
else if (event.type === "input.requested") {
|
|
243
252
|
inputRequests.push(...event.data.requests);
|
|
244
253
|
}
|
|
245
|
-
else if (event.type === "session.waiting") {
|
|
254
|
+
else if (event.type === "session.waiting" || isHeldForInput(event)) {
|
|
246
255
|
status = "waiting";
|
|
247
256
|
}
|
|
248
257
|
else if (event.type === "session.failed") {
|
|
@@ -251,11 +260,12 @@ async function collectResponse(response, watchdog, phase, streamIndex, continueS
|
|
|
251
260
|
else if (event.type === "session.completed") {
|
|
252
261
|
status = "completed";
|
|
253
262
|
}
|
|
254
|
-
|
|
263
|
+
const ends = isTurnBoundary(event.type) || isHeldForInput(event);
|
|
264
|
+
if (ends && !staleBoundaryFirst) {
|
|
255
265
|
endedAtOwnBoundary = true;
|
|
256
266
|
return true;
|
|
257
267
|
}
|
|
258
|
-
if (
|
|
268
|
+
if (ends && staleBoundaryFirst && sawTurnStart) {
|
|
259
269
|
endedAtOwnBoundary = true;
|
|
260
270
|
return true;
|
|
261
271
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kybernesis/buzz",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.1",
|
|
4
4
|
"description": "Put an eve agent in a Buzz workspace as a member: per-speaker verified identity resolved through the control plane, self-service identity linking, presence, typing and seen signals.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -44,17 +44,18 @@
|
|
|
44
44
|
"test": "node --test \"test/**/*.test.mjs\""
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@kybernesis/
|
|
47
|
+
"@kybernesis/cards": "^0.1.1",
|
|
48
|
+
"@kybernesis/enterprise": "^0.10.0",
|
|
48
49
|
"nostr-tools": "^2.10.0",
|
|
49
50
|
"zod": "^4"
|
|
50
51
|
},
|
|
51
52
|
"devDependencies": {
|
|
52
53
|
"@types/node": "24.x",
|
|
53
|
-
"eve": "0.
|
|
54
|
+
"eve": "0.81.1",
|
|
54
55
|
"typescript": "7.0.2"
|
|
55
56
|
},
|
|
56
57
|
"peerDependencies": {
|
|
57
|
-
"eve": ">=0.
|
|
58
|
+
"eve": ">=0.81.1 <0.82.0"
|
|
58
59
|
},
|
|
59
60
|
"engines": {
|
|
60
61
|
"node": ">=20"
|