@shumkov/orchestra 0.10.2 → 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
|
|
@@ -941,29 +941,35 @@ class CliProcess extends Process {
|
|
|
941
941
|
`DROPPED — it gets re-sent to you or flagged as a lost message. When unsure,`,
|
|
942
942
|
'include the id.',
|
|
943
943
|
'',
|
|
944
|
-
'### Staying responsive on a long task —
|
|
944
|
+
'### Staying responsive on a long task — HARD CONTRACT',
|
|
945
945
|
'',
|
|
946
946
|
'The user sees NOTHING while you work — no inline text, no tool output reaches',
|
|
947
|
-
'them. A turn that runs long with no
|
|
948
|
-
'
|
|
947
|
+
'them. A turn that runs long with no visible progress looks BROKEN, and',
|
|
948
|
+
'working in silence then dropping a finished result is a CONTRACT VIOLATION,',
|
|
949
|
+
'not a style choice: the user sat staring at a dead chat the whole time.',
|
|
949
950
|
'',
|
|
950
|
-
'So
|
|
951
|
-
'calls
|
|
952
|
-
'
|
|
953
|
-
|
|
954
|
-
'
|
|
951
|
+
'So for any MULTI-STEP task — several steps, research, more than a couple of',
|
|
952
|
+
'tool calls — this is the sequence, every time:',
|
|
953
|
+
'',
|
|
954
|
+
'1. Your FIRST visible action MUST be a `reply` with `interim: true` whose',
|
|
955
|
+
' body is the PLAN as a checklist: one `- [ ] step` line per step, in plain',
|
|
956
|
+
' task language. It returns a `message_id` — keep it.',
|
|
957
|
+
`2. Posting the plan is NOT a stopping point. Do not end the turn to wait`,
|
|
958
|
+
' for approval — the checklist is a progress display, not a proposal. Keep',
|
|
959
|
+
' executing in the SAME turn immediately (ask first only when a step is',
|
|
960
|
+
' destructive or the request is genuinely ambiguous).',
|
|
961
|
+
`3. After EVERY step you complete — not at the end, after each one — you MUST`,
|
|
962
|
+
` call \`mcp__${b}__edit_message\` on that SAME \`message_id\` with the WHOLE`,
|
|
963
|
+
' list again — check items off as you complete them: finished items flip',
|
|
964
|
+
' to `- [x]`. Five steps means the bubble changes five times; the user',
|
|
965
|
+
' watches ONE message fill in, live.',
|
|
966
|
+
'4. Always re-send the WHOLE list — an edit REPLACES the body, so a partial',
|
|
967
|
+
' re-send loses everything you left out.',
|
|
955
968
|
'',
|
|
956
969
|
'An edit re-renders the bubble exactly as the original `reply` did — a chat',
|
|
957
970
|
'that renders rich re-renders an edited checklist, table or heading rich, not',
|
|
958
|
-
'flat.
|
|
959
|
-
'
|
|
960
|
-
'with the list again and `- [x]` on what you have finished. Check items off as',
|
|
961
|
-
'you complete them — the user watches ONE bubble fill in instead of collecting',
|
|
962
|
-
'a trail of status messages. Always re-send the WHOLE list (an edit REPLACES',
|
|
963
|
-
'the body, so a partial re-send loses everything you left out).',
|
|
964
|
-
'',
|
|
965
|
-
'Short one-line status text is still fine for an interim bubble — a checklist',
|
|
966
|
-
'is the better shape when the work has steps worth showing, not a requirement.',
|
|
971
|
+
'flat. A short one-line status bubble is acceptable only when the work',
|
|
972
|
+
'genuinely has no enumerable steps.',
|
|
967
973
|
'',
|
|
968
974
|
'An edit is TEXT-ONLY. Checklists, tables and headings re-render; image',
|
|
969
975
|
'markdown degrades to its caption, and an edit can never ADD media to a',
|
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",
|