@voicethere/agent 0.30.0 → 0.31.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/README.md +2 -0
- package/dist/agent.js +15 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/protocol.d.ts +20 -0
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js.map +1 -1
- package/dist/runtime.d.ts +26 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +28 -0
- package/dist/runtime.js.map +1 -1
- package/dist/templates/echo/agent.js +15 -1
- package/dist/templates/echo-dc/agent.js +15 -1
- package/dist/templates/flow-agent/agent.js +15 -1
- package/dist/templates/game-sync/agent.js +15 -1
- package/dist/templates/language-switch/agent.js +15 -1
- package/dist/templates/llm-agent/agent.js +15 -1
- package/dist/templates/llm-board/agent.js +69 -30
- package/dist/templates/llm-docs-rag/agent.js +15 -1
- package/dist/templates/llm-language-tutor/agent.js +16 -2
- package/dist/templates/llm-mcp-service/agent.js +15 -1
- package/dist/templates/llm-support-sticky-user/agent.js +15 -1
- package/dist/templates/positional-tts/agent.js +15 -1
- package/dist/templates/recording-consent/agent.js +15 -1
- package/dist/templates/registry.d.ts.map +1 -1
- package/dist/templates/registry.js +1 -0
- package/dist/templates/registry.js.map +1 -1
- package/dist/templates/spatial-showcase/agent.js +15 -1
- package/dist/templates/speaker-gate/agent.js +15 -1
- package/dist/templates/voice-showcase/agent.js +15 -1
- package/dist/templates/voice-starter/agent.js +15 -1
- package/dist/templates/webhooks/agent.js +15 -1
- package/dist/templates/webhooks-redis/agent.js +15 -1
- package/dist/templates/world-sync/agent.js +15 -1
- package/dist/templates/world-sync-binary/agent.js +15 -1
- package/eject/llm/loop.ts +1 -1
- package/package.json +1 -1
- package/templates/llm-board/README.md +1 -1
- package/templates/llm-board/agent.ts +4 -29
- package/templates/llm-board/prompt.md +10 -2
- package/templates/llm-board/tool-specs.ts +43 -0
- package/templates/llm-board/voicethere.llm.json +1 -1
- package/templates/llm-language-tutor/prompt.md +1 -1
|
@@ -840,7 +840,8 @@ function speakerFieldsOf(event) {
|
|
|
840
840
|
...typeof e.speaker === "string" && SPEAKER_VERDICTS.includes(e.speaker) ? { speaker: e.speaker } : {},
|
|
841
841
|
...typeof e.speakerUnknownReason === "string" ? { speakerUnknownReason: e.speakerUnknownReason } : {},
|
|
842
842
|
...typeof e.speakerCheckWindows === "number" ? { speakerCheckWindows: e.speakerCheckWindows } : {},
|
|
843
|
-
...typeof e.speakerRechecked === "boolean" ? { speakerRechecked: e.speakerRechecked } : {}
|
|
843
|
+
...typeof e.speakerRechecked === "boolean" ? { speakerRechecked: e.speakerRechecked } : {},
|
|
844
|
+
...e.reason === "speaker_split" || e.reason === "speaker_split_redecode_timeout" ? { reason: e.reason } : {}
|
|
844
845
|
};
|
|
845
846
|
}
|
|
846
847
|
function resolveUserLanguageCode(event) {
|
|
@@ -949,6 +950,19 @@ async function handleParentMessage(message, handlers) {
|
|
|
949
950
|
});
|
|
950
951
|
}
|
|
951
952
|
}
|
|
953
|
+
if (message.event.type === "user_utterance_split") {
|
|
954
|
+
const split = message.event;
|
|
955
|
+
if (typeof split.fromUtteranceId === "string" && split.fromUtteranceId && typeof split.toUtteranceId === "string" && split.toUtteranceId) {
|
|
956
|
+
await handlers.onUserUtteranceSplit?.({
|
|
957
|
+
sessionId: message.sessionId,
|
|
958
|
+
fromUtteranceId: split.fromUtteranceId,
|
|
959
|
+
toUtteranceId: split.toUtteranceId,
|
|
960
|
+
...typeof split.splitAtMs === "number" ? { splitAtMs: split.splitAtMs } : {},
|
|
961
|
+
...typeof split.from === "string" && SPEAKER_VERDICTS.includes(split.from) ? { from: split.from } : {},
|
|
962
|
+
...typeof split.to === "string" && SPEAKER_VERDICTS.includes(split.to) ? { to: split.to } : {}
|
|
963
|
+
});
|
|
964
|
+
}
|
|
965
|
+
}
|
|
952
966
|
if (message.event.type === "user_language") {
|
|
953
967
|
const language = resolveUserLanguageCode(message.event);
|
|
954
968
|
if (language) {
|
package/eject/llm/loop.ts
CHANGED
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@ A project secret named `AGENT_OPENROUTER_API_KEY` (a key from openrouter.ai). No
|
|
|
10
10
|
|
|
11
11
|
- `agent.ts` routes board messages first and passes everything else to the LLM as chat. It also defines the tools `list_notes`, `add_note` and `update_note`.
|
|
12
12
|
- `board.ts` is the board itself and the message parser, with no VoiceThere imports.
|
|
13
|
-
- `voicethere.llm.json` holds the model (`
|
|
13
|
+
- `voicethere.llm.json` holds the model (`anthropic/claude-haiku-5.5` on OpenRouter), greeting and settings. Knowledge is off.
|
|
14
14
|
- `prompt.md` is the facilitator's system prompt.
|
|
15
15
|
- `md.d.ts` lets TypeScript accept `import x from "./x.md"`.
|
|
16
16
|
|
|
@@ -9,11 +9,11 @@ import config from "./voicethere.llm.json";
|
|
|
9
9
|
import systemPrompt from "./prompt.md";
|
|
10
10
|
import {
|
|
11
11
|
Board,
|
|
12
|
-
NOTE_COLORS,
|
|
13
12
|
parseBoardMessage,
|
|
14
13
|
type BoardMessage,
|
|
15
14
|
type NoteColor,
|
|
16
15
|
} from "./board";
|
|
16
|
+
import { BOARD_TOOL_SPECS } from "./tool-specs";
|
|
17
17
|
|
|
18
18
|
// Boards are room-scoped. A client joins a room with { type: "board.join",
|
|
19
19
|
// room }; every session in the room sees the same board. A session that never
|
|
@@ -130,12 +130,8 @@ function apply(sessionId: string, m: BoardMessage): void {
|
|
|
130
130
|
broadcast(sessionId);
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
const colorSchema = { type: "string", enum: [...NOTE_COLORS] };
|
|
134
|
-
|
|
135
133
|
const listNotes = defineTool({
|
|
136
|
-
|
|
137
|
-
description: "List every note on the shared board.",
|
|
138
|
-
inputSchema: { type: "object", properties: {}, additionalProperties: false },
|
|
134
|
+
...BOARD_TOOL_SPECS.list_notes,
|
|
139
135
|
handler: (_args, ctx) => {
|
|
140
136
|
const board = boardFor(ctx.sessionId);
|
|
141
137
|
if (!board) return SESSION_ENDED;
|
|
@@ -148,14 +144,7 @@ const listNotes = defineTool({
|
|
|
148
144
|
});
|
|
149
145
|
|
|
150
146
|
const addNote = defineTool<{ text: string; color?: NoteColor }>({
|
|
151
|
-
|
|
152
|
-
description: "Add a note to the shared board. Text is 1 to 200 characters.",
|
|
153
|
-
inputSchema: {
|
|
154
|
-
type: "object",
|
|
155
|
-
properties: { text: { type: "string" }, color: colorSchema },
|
|
156
|
-
required: ["text"],
|
|
157
|
-
additionalProperties: false,
|
|
158
|
-
},
|
|
147
|
+
...BOARD_TOOL_SPECS.add_note,
|
|
159
148
|
handler: ({ text, color }, ctx) => {
|
|
160
149
|
const board = boardFor(ctx.sessionId);
|
|
161
150
|
if (!board) return SESSION_ENDED;
|
|
@@ -173,21 +162,7 @@ const updateNote = defineTool<{
|
|
|
173
162
|
x?: number;
|
|
174
163
|
y?: number;
|
|
175
164
|
}>({
|
|
176
|
-
|
|
177
|
-
description:
|
|
178
|
-
"Change a note's text, color or position (x and y between 0 and 1).",
|
|
179
|
-
inputSchema: {
|
|
180
|
-
type: "object",
|
|
181
|
-
properties: {
|
|
182
|
-
id: { type: "string" },
|
|
183
|
-
text: { type: "string" },
|
|
184
|
-
color: colorSchema,
|
|
185
|
-
x: { type: "number" },
|
|
186
|
-
y: { type: "number" },
|
|
187
|
-
},
|
|
188
|
-
required: ["id"],
|
|
189
|
-
additionalProperties: false,
|
|
190
|
-
},
|
|
165
|
+
...BOARD_TOOL_SPECS.update_note,
|
|
191
166
|
handler: ({ id, ...patch }, ctx) => {
|
|
192
167
|
const board = boardFor(ctx.sessionId);
|
|
193
168
|
if (!board) return SESSION_ENDED;
|
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
You are the facilitator of a shared brainstorming board. The people in the room put sticky notes on it, and you can read, add and change notes with your tools. People talk to you by voice, so everything you say is read aloud.
|
|
1
|
+
You are the facilitator of a shared brainstorming board. The people in the room put sticky notes on it, and you can read, add and change notes with your tools. People talk to you by voice, so everything you say is read aloud. What they say reaches you as a transcript that can mishear words, for example "node" for "note"; when the board makes the meaning clear, write the word they meant.
|
|
2
2
|
|
|
3
3
|
Keep spoken replies to one or two short sentences. Do not use markdown, lists, emoji or special characters.
|
|
4
4
|
|
|
5
|
+
A note has only its text, a color and a position. It has no separate title or name, so naming, renaming or rewording a note means changing its text.
|
|
6
|
+
|
|
5
7
|
Call list_notes before you group, compare or summarise notes, and before you change one. Never guess what is on the board.
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
To change a note that is already on the board, use update_note with that note's id. That covers new wording, a new name, a fix, a new color or a move. Never use add_note to change a note: it would leave the old note and a second one.
|
|
10
|
+
|
|
11
|
+
Use add_note only for a note that is not on the board yet: when someone asks you to add one, or when you summarise. When you summarise, write one short note per theme yourself; do not ask anyone to name or word it.
|
|
12
|
+
|
|
13
|
+
If you asked a question about a note that is on the board, such as "What should I call it?", the answer is meant for that note, even in the middle of a summary: put it on that note with update_note and do not add a new note.
|
|
14
|
+
|
|
15
|
+
After a change, say briefly what you did, for example "I renamed the note to Basic note." Ask a follow-up question only when you need the answer to finish the request.
|
|
8
16
|
|
|
9
17
|
If a tool says the board is full or a note does not exist, say so plainly and suggest what to do next.
|
|
10
18
|
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { NOTE_COLORS } from "./board.js";
|
|
2
|
+
|
|
3
|
+
const colorSchema = { type: "string", enum: [...NOTE_COLORS] };
|
|
4
|
+
|
|
5
|
+
export const BOARD_TOOL_SPECS = {
|
|
6
|
+
list_notes: {
|
|
7
|
+
name: "list_notes",
|
|
8
|
+
description: "List every note on the shared board.",
|
|
9
|
+
inputSchema: {
|
|
10
|
+
type: "object",
|
|
11
|
+
properties: {},
|
|
12
|
+
additionalProperties: false,
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
add_note: {
|
|
16
|
+
name: "add_note",
|
|
17
|
+
description:
|
|
18
|
+
"Add a new note to the shared board. Only for a note that is not on the board yet; to rename, reword, recolor or move an existing note use update_note. Text is 1 to 200 characters.",
|
|
19
|
+
inputSchema: {
|
|
20
|
+
type: "object",
|
|
21
|
+
properties: { text: { type: "string" }, color: colorSchema },
|
|
22
|
+
required: ["text"],
|
|
23
|
+
additionalProperties: false,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
update_note: {
|
|
27
|
+
name: "update_note",
|
|
28
|
+
description:
|
|
29
|
+
"Change an existing note by id: its text (also to rename or reword it), color or position (x and y between 0 and 1). Get the id from list_notes.",
|
|
30
|
+
inputSchema: {
|
|
31
|
+
type: "object",
|
|
32
|
+
properties: {
|
|
33
|
+
id: { type: "string" },
|
|
34
|
+
text: { type: "string" },
|
|
35
|
+
color: colorSchema,
|
|
36
|
+
x: { type: "number" },
|
|
37
|
+
y: { type: "number" },
|
|
38
|
+
},
|
|
39
|
+
required: ["id"],
|
|
40
|
+
additionalProperties: false,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
} as const;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "./node_modules/@voicethere/agent/schema/voicethere.llm.schema.json",
|
|
3
3
|
"version": 1,
|
|
4
4
|
"provider": "openrouter",
|
|
5
|
-
"model": "
|
|
5
|
+
"model": "anthropic/claude-haiku-5.5",
|
|
6
6
|
"apiKeySecret": "AGENT_OPENROUTER_API_KEY",
|
|
7
7
|
"maxOutputTokens": 512,
|
|
8
8
|
"greeting": {
|
|
@@ -4,6 +4,6 @@ Speak English only, even if the learner switches to another language. Keep repli
|
|
|
4
4
|
|
|
5
5
|
Correct at most one mistake per turn. Say the learner's sentence again the correct way, then give the reason in a few words. If there is no mistake, say something encouraging in a few words instead. Then ask one follow-up question that keeps the conversation going.
|
|
6
6
|
|
|
7
|
-
When the learner asks about a phrase, an idiom or a lesson topic, call search_knowledge first and answer from what it returns. Never make up the meaning of an idiom that the search did not return. If the search has nothing, say you are not sure and offer a different phrase to practice.
|
|
7
|
+
When the learner asks about a phrase, an idiom or a lesson topic, call search_knowledge first and answer from what it returns. Call it before you say anything on such a question: do not give a meaning, a guess or a filler sentence first. Never make up the meaning of an idiom that the search did not return. If the search has nothing, say you are not sure and offer a different phrase to practice.
|
|
8
8
|
|
|
9
9
|
Be patient and friendly. Let the learner finish their thought before you correct anything.
|