@shumkov/orchestra 0.10.3 → 0.10.4
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.
|
@@ -243,6 +243,13 @@ function handleDaemonMessage(msg) {
|
|
|
243
243
|
|
|
244
244
|
case 'user_msg':
|
|
245
245
|
log('user_msg-rx', { text_len: msg.text?.length, turn_id: msg.turn_id, chat_id: msg.chat_id })
|
|
246
|
+
// Remembered so a `stream` call that omits turn_id (a frequent model
|
|
247
|
+
// error — the schema marks it required, models drop it anyway) can be
|
|
248
|
+
// stamped with the turn it is almost certainly about. The daemon still
|
|
249
|
+
// verifies the id against its live head turn, so a stale or foreign
|
|
250
|
+
// stamp is dropped there exactly like any other mismatch — stamping
|
|
251
|
+
// widens nothing, it only rescues the ordinary case.
|
|
252
|
+
if (msg.turn_id) lastUserTurnId = msg.turn_id
|
|
246
253
|
mcp.notification({
|
|
247
254
|
method: 'notifications/claude/channel',
|
|
248
255
|
params: {
|
|
@@ -460,6 +467,8 @@ mcp.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
460
467
|
}
|
|
461
468
|
})
|
|
462
469
|
|
|
470
|
+
let lastUserTurnId = null
|
|
471
|
+
|
|
463
472
|
const CALLABLE_TOOLS = new Set(
|
|
464
473
|
['reply', 'ask', 'edit_message', ...(STREAM_TOOL_ENABLED ? ['stream'] : [])],
|
|
465
474
|
)
|
|
@@ -486,13 +495,18 @@ mcp.setRequestHandler(CallToolRequestSchema, async req => {
|
|
|
486
495
|
return { content: [{ type: 'text', text: JSON.stringify(result) }] }
|
|
487
496
|
}
|
|
488
497
|
|
|
498
|
+
let args = req.params.arguments
|
|
499
|
+
if (req.params.name === 'stream' && !args?.turn_id && lastUserTurnId) {
|
|
500
|
+
args = { ...args, turn_id: lastUserTurnId }
|
|
501
|
+
log('stream-turn-id-stamped', { turn_id: lastUserTurnId })
|
|
502
|
+
}
|
|
489
503
|
const ackP = awaitToolAck(toolCallId)
|
|
490
504
|
sock.write(JSON.stringify({
|
|
491
505
|
kind: 'tool',
|
|
492
506
|
session: SESSION_KEY,
|
|
493
507
|
tool_call_id: toolCallId,
|
|
494
508
|
name: req.params.name,
|
|
495
|
-
args
|
|
509
|
+
args,
|
|
496
510
|
}) + '\n')
|
|
497
511
|
try {
|
|
498
512
|
const ack = await ackP
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shumkov/orchestra",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.4",
|
|
4
4
|
"description": "Transport-agnostic session engine for Claude Code and the native Codex app-server: spawn, steer, supervise, observe turns, and recover.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "index.js",
|