@theronap/agnoclast-mcp 0.9.316 → 0.9.317
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/lib/turn_check.mjs +6 -1
- package/package.json +1 -1
package/lib/turn_check.mjs
CHANGED
|
@@ -28,8 +28,13 @@ const textOf = (content) =>
|
|
|
28
28
|
typeof content === 'string' ? content : Array.isArray(content) ? content.filter((b) => b?.type === 'text').map((b) => b.text).join('\n') : ''
|
|
29
29
|
|
|
30
30
|
/** PURE. A user entry that starts a turn: something the person (or the app) sent, not a tool result or this hook's own feedback. */
|
|
31
|
+
// A hand-back from a subagent or another session ("peer") and a background-task notification are stored as meta entries,
|
|
32
|
+
// but each brings in new information and starts work of its own. Counting them as turn starts gives every such stretch
|
|
33
|
+
// its own check and its own MAX_BLOCKS, instead of one long autonomous turn spending two send-backs and running unchecked.
|
|
34
|
+
const WAKING_ORIGINS = new Set(['peer', 'task-notification'])
|
|
31
35
|
export function isTurnStart(d) {
|
|
32
|
-
if (d?.type !== 'user' || d.
|
|
36
|
+
if (d?.type !== 'user' || d.isCompactSummary || d.isSidechain) return false
|
|
37
|
+
if (d.isMeta && !WAKING_ORIGINS.has(d.origin?.kind)) return false
|
|
33
38
|
const c = d.message?.content
|
|
34
39
|
if (Array.isArray(c) && c.some((b) => b?.type === 'tool_result')) return false
|
|
35
40
|
const t = textOf(c)
|
package/package.json
CHANGED