switchroom 0.13.58 → 0.13.59
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/cli/switchroom.js +451 -343
- package/package.json +1 -1
- package/telegram-plugin/dist/gateway/gateway.js +252 -310
- package/telegram-plugin/gateway/gateway.ts +0 -35
|
@@ -86,7 +86,6 @@ import { classifyInbound } from '../inbound-classifier.js'
|
|
|
86
86
|
import * as silencePoke from '../silence-poke.js'
|
|
87
87
|
import * as pendingProgress from '../pending-work-progress.js'
|
|
88
88
|
import { writeSilentEndState, clearSilentEndState, recordUndeliveredTurnEnd } from '../silent-end.js'
|
|
89
|
-
import { markAckSent, clearAckSent } from '../ack-flag.js'
|
|
90
89
|
import { isFinalAnswerReply } from '../final-answer-detect.js'
|
|
91
90
|
import { createAnswerStream, type AnswerStreamHandle } from '../answer-stream.js'
|
|
92
91
|
import { type SessionEvent } from '../session-tail.js'
|
|
@@ -4984,16 +4983,6 @@ async function executeReply(args: Record<string, unknown>): Promise<{ content: A
|
|
|
4984
4983
|
// silence-poke clock so the next poke is measured from this send.
|
|
4985
4984
|
signalTracker.noteOutbound(statusKey(chat_id, threadId), Date.now())
|
|
4986
4985
|
silencePoke.noteOutbound(statusKey(chat_id, threadId), Date.now())
|
|
4987
|
-
// Ack-first gate (`reference/conversational-pacing.md` beat 1):
|
|
4988
|
-
// touch the state-dir flag so the ack-first-pretool hook lets
|
|
4989
|
-
// subsequent non-reply tool calls through this turn. Cleared at
|
|
4990
|
-
// turn_started. Best-effort — a write failure shouldn't break
|
|
4991
|
-
// reply, and the hook is kill-switched anyway.
|
|
4992
|
-
try {
|
|
4993
|
-
markAckSent()
|
|
4994
|
-
} catch (err) {
|
|
4995
|
-
process.stderr.write(`telegram gateway: markAckSent failed: ${err}\n`)
|
|
4996
|
-
}
|
|
4997
4986
|
// #1741 — only clear silent-end state on a plausibly-final reply.
|
|
4998
4987
|
// An interim ack (disable_notification:true, short text, no done)
|
|
4999
4988
|
// must NOT clear the state file; otherwise a turn that ends with
|
|
@@ -5589,13 +5578,6 @@ async function executeStreamReply(args: Record<string, unknown>): Promise<unknow
|
|
|
5589
5578
|
const sKey = statusKey(streamChatId, streamThreadId)
|
|
5590
5579
|
signalTracker.noteOutbound(sKey, Date.now())
|
|
5591
5580
|
silencePoke.noteOutbound(sKey, Date.now())
|
|
5592
|
-
// Ack-first gate: stream_reply's first emit also unlocks subsequent
|
|
5593
|
-
// tool calls. See ack-flag.ts + ack-first-pretool.ts.
|
|
5594
|
-
try {
|
|
5595
|
-
markAckSent()
|
|
5596
|
-
} catch (err) {
|
|
5597
|
-
process.stderr.write(`telegram gateway: markAckSent (stream_reply) failed: ${err}\n`)
|
|
5598
|
-
}
|
|
5599
5581
|
// #1741 — see executeReply for the rationale: only a plausibly-
|
|
5600
5582
|
// final stream_reply clears the silent-end state. An interim
|
|
5601
5583
|
// ack via stream_reply must NOT clear; the Stop hook needs
|
|
@@ -6944,14 +6926,6 @@ function handleSessionEvent(ev: SessionEvent): void {
|
|
|
6944
6926
|
statusKey(ev.chatId, enqThreadId),
|
|
6945
6927
|
'handback',
|
|
6946
6928
|
)
|
|
6947
|
-
// Ack-first gate (`reference/conversational-pacing.md` beat 1):
|
|
6948
|
-
// wipe the prior turn's `ack-sent.flag` so the ack-first-
|
|
6949
|
-
// pretool hook re-arms for this fresh turn. Centralised HERE
|
|
6950
|
-
// (not in handleInbound) because `enqueue` is the single
|
|
6951
|
-
// canonical fresh-turn atom — fires for real inbounds, cron
|
|
6952
|
-
// fires, subagent-handback channel wakes, vault-grant resumes,
|
|
6953
|
-
// and restart markers alike. Best-effort — see ack-flag.ts.
|
|
6954
|
-
clearAckSent()
|
|
6955
6929
|
}
|
|
6956
6930
|
if (ev.chatId) {
|
|
6957
6931
|
// Issue #195: if a previous turn left an answer-lane stream open
|
|
@@ -7139,15 +7113,6 @@ function handleSessionEvent(ev: SessionEvent): void {
|
|
|
7139
7113
|
if (!turn.replyCalled && !isTelegramSurfaceTool(name)) {
|
|
7140
7114
|
const rendered = registerAndRender(turn.toolActivity, name)
|
|
7141
7115
|
if (rendered != null) {
|
|
7142
|
-
// Mark the ack-flag synchronously so a PreToolUse hook firing
|
|
7143
|
-
// concurrently for THIS tool call (#1921) sees the flag set
|
|
7144
|
-
// and allows the tool through. The drain runs async; failure
|
|
7145
|
-
// is logged but does not block the model.
|
|
7146
|
-
try {
|
|
7147
|
-
markAckSent()
|
|
7148
|
-
} catch (err) {
|
|
7149
|
-
process.stderr.write(`telegram gateway: activity-summary markAckSent failed: ${err}\n`)
|
|
7150
|
-
}
|
|
7151
7116
|
turn.activityPendingRender = rendered
|
|
7152
7117
|
if (turn.activityInFlight == null) {
|
|
7153
7118
|
turn.activityInFlight = drainActivitySummary(turn)
|