@ouro.bot/cli 0.1.0-alpha.565 → 0.1.0-alpha.566
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/changelog.json +7 -0
- package/dist/senses/shared-turn.js +23 -6
- package/package.json +1 -1
package/changelog.json
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"_note": "This changelog is maintained as part of the PR/version-bump workflow. Agent-curated, not auto-generated. Agents read this file directly via read_file to understand what changed between versions.",
|
|
3
3
|
"versions": [
|
|
4
|
+
{
|
|
5
|
+
"version": "0.1.0-alpha.566",
|
|
6
|
+
"changes": [
|
|
7
|
+
"Shared sense delivery recovery is now an exported contract so replaying transports such as Voice/Twilio recover tool-required `settle`/`speak` output only after outward delivery acknowledgements.",
|
|
8
|
+
"Sense development docs now spell out the sense/transport boundary and the tool-required delivery rules for future Voice, meeting, Twilio, and other adapter work."
|
|
9
|
+
]
|
|
10
|
+
},
|
|
4
11
|
{
|
|
5
12
|
"version": "0.1.0-alpha.565",
|
|
6
13
|
"changes": [
|
|
@@ -40,6 +40,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
40
40
|
})();
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
42
|
exports.stripThinkBlocks = stripThinkBlocks;
|
|
43
|
+
exports.extractOutwardSenseDeliveryText = extractOutwardSenseDeliveryText;
|
|
43
44
|
exports.runSenseTurn = runSenseTurn;
|
|
44
45
|
const os = __importStar(require("os"));
|
|
45
46
|
const path = __importStar(require("path"));
|
|
@@ -61,7 +62,7 @@ const pipeline_1 = require("./pipeline");
|
|
|
61
62
|
const mcp_manager_1 = require("../repertoire/mcp-manager");
|
|
62
63
|
const runtime_1 = require("../nerves/runtime");
|
|
63
64
|
const RESPONSE_CAP = 50_000;
|
|
64
|
-
const
|
|
65
|
+
const OUTWARD_DELIVERY_TOOL_ACKS = new Map([
|
|
65
66
|
["settle", "(delivered)"],
|
|
66
67
|
["speak", "(spoken)"],
|
|
67
68
|
]);
|
|
@@ -117,7 +118,7 @@ function parseToolStringArg(toolCall, toolName, argName) {
|
|
|
117
118
|
function hasDeliveredToolResult(messages, assistantIndex, toolCallId, toolName) {
|
|
118
119
|
if (typeof toolCallId !== "string" || !toolCallId.trim())
|
|
119
120
|
return false;
|
|
120
|
-
const expectedAck =
|
|
121
|
+
const expectedAck = OUTWARD_DELIVERY_TOOL_ACKS.get(toolName);
|
|
121
122
|
for (let index = assistantIndex + 1; index < messages.length; index++) {
|
|
122
123
|
const message = messages[index];
|
|
123
124
|
if (message.role !== "tool")
|
|
@@ -130,7 +131,7 @@ function hasDeliveredToolResult(messages, assistantIndex, toolCallId, toolName)
|
|
|
130
131
|
}
|
|
131
132
|
return false;
|
|
132
133
|
}
|
|
133
|
-
function
|
|
134
|
+
function outwardDeliveryTextFromAssistantTools(messages, assistantIndex) {
|
|
134
135
|
const assistant = messages[assistantIndex];
|
|
135
136
|
if (!Array.isArray(assistant.tool_calls))
|
|
136
137
|
return null;
|
|
@@ -152,13 +153,29 @@ function deliveredTextFromAssistantTools(messages, assistantIndex) {
|
|
|
152
153
|
}
|
|
153
154
|
return delivered.length > 0 ? delivered.join("\n") : null;
|
|
154
155
|
}
|
|
155
|
-
|
|
156
|
+
/**
|
|
157
|
+
* Recover the text that actually reached a friend in an outward sense turn.
|
|
158
|
+
*
|
|
159
|
+
* Ouro runs outward channels in tool-required mode. That means the visible
|
|
160
|
+
* response may be a `settle({ answer })` or `speak({ message })` tool call
|
|
161
|
+
* whose assistant message has `content: null`. The authoritative delivery
|
|
162
|
+
* signal is the following tool ack:
|
|
163
|
+
*
|
|
164
|
+
* - `(delivered)` for `settle.answer`
|
|
165
|
+
* - `(spoken)` for `speak.message`
|
|
166
|
+
*
|
|
167
|
+
* Inner-dialog `(settled)`, malformed tool arguments, rejected tools, and
|
|
168
|
+
* interrupted tool-call sequences are not outward speech. Sense transports
|
|
169
|
+
* that need to replay the turn later (Voice/Twilio TTS, future meeting audio)
|
|
170
|
+
* should use this helper instead of reading `assistant.content` directly.
|
|
171
|
+
*/
|
|
172
|
+
function extractOutwardSenseDeliveryText(messages) {
|
|
156
173
|
const assistantIndex = messages.findLastIndex((message) => message.role === "assistant");
|
|
157
174
|
if (assistantIndex < 0)
|
|
158
175
|
return null;
|
|
159
176
|
const assistant = messages[assistantIndex];
|
|
160
177
|
return assistantContentText(assistant.content)
|
|
161
|
-
??
|
|
178
|
+
?? outwardDeliveryTextFromAssistantTools(messages, assistantIndex);
|
|
162
179
|
}
|
|
163
180
|
/**
|
|
164
181
|
* Run a single agent turn through the inbound pipeline.
|
|
@@ -279,7 +296,7 @@ async function runSenseTurn(options) {
|
|
|
279
296
|
await persistPromise;
|
|
280
297
|
const postTurnSession = (0, context_1.loadSession)(sessPath);
|
|
281
298
|
if (postTurnSession?.messages) {
|
|
282
|
-
finalResponse =
|
|
299
|
+
finalResponse = extractOutwardSenseDeliveryText(postTurnSession.messages)
|
|
283
300
|
?? "(agent responded but response was empty)";
|
|
284
301
|
}
|
|
285
302
|
else {
|