@cohortapp/agent-sdk 2.18.21 → 2.18.22
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/org/messaging.mjs
CHANGED
|
@@ -349,6 +349,14 @@ export async function fetchHistory(params = {}, o = {}) {
|
|
|
349
349
|
channelId: channel,
|
|
350
350
|
channel,
|
|
351
351
|
...(params.since != null ? { since: params.since } : {}),
|
|
352
|
+
// `before` (an id: the oldest row of the page you have) is how a reader
|
|
353
|
+
// pages BACK past the newest window. Without it every page is page 0 and
|
|
354
|
+
// an older human post reads as never having existed — the seat-local
|
|
355
|
+
// 8a109a3 fix, carried here so an upgrade cannot clobber it again.
|
|
356
|
+
...(params.before != null ? { before: params.before } : {}),
|
|
357
|
+
// A thread reply lives only in its thread: a room-level read never
|
|
358
|
+
// shows it, so a reader (or a readback of its own send) needs the id.
|
|
359
|
+
...(params.threadId != null ? { threadId: params.threadId } : {}),
|
|
352
360
|
...(params.cursor != null ? { cursor: params.cursor } : {}),
|
|
353
361
|
...(Number.isFinite(params.limit) ? { limit: params.limit } : {}),
|
|
354
362
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cohortapp/agent-sdk",
|
|
3
|
-
"version": "2.18.
|
|
3
|
+
"version": "2.18.22",
|
|
4
4
|
"description": "Cohort Agent SDK — autonomous AI colleague runtime. Deploy senior AI colleagues on dedicated Mac minis, wired to the Cohort operating surface.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -98,7 +98,7 @@ import {
|
|
|
98
98
|
noticeRejection,
|
|
99
99
|
fallbackNotice,
|
|
100
100
|
} from "../../lib/assurance/notice-voice.mjs";
|
|
101
|
-
import { isRetiredFirstReply, firstReplyShape } from "../../lib/assurance/first-reply.mjs";
|
|
101
|
+
import { isRetiredFirstReply, firstReplyShape, REACTIONS } from "../../lib/assurance/first-reply.mjs";
|
|
102
102
|
// The unit of acknowledgement is the CONVERSATION, not the message: four
|
|
103
103
|
// messages in a row earn ONE first response that was written with all four in
|
|
104
104
|
// front of it. `groupIntoBatches` + `batchVerdict` decide WHEN and WHICH;
|
|
@@ -227,12 +227,17 @@ export const INTERRUPT_GRACE_MS = num(process.env.ASSURANCE_INTERRUPT_GRACE_MS,
|
|
|
227
227
|
/**
|
|
228
228
|
* Budget for generating the ONE-LINE contextual acknowledgement. Tight on
|
|
229
229
|
* purpose: an ack that arrives a minute late has already failed at its job,
|
|
230
|
-
* and the fallback
|
|
231
|
-
*
|
|
232
|
-
*
|
|
233
|
-
* "reliably canned"
|
|
230
|
+
* and the fallback after ACK_GEN_MAX_FAILURES is a REACTION where the surface
|
|
231
|
+
* has one, and only then silence (the sweep retries generation once past
|
|
232
|
+
* ACK_AFTER_MS, then stops). The CEO chose "occasionally silent" over
|
|
233
|
+
* "reliably canned"; he did not choose "reliably silent". At 5s a cold
|
|
234
|
+
* `claude --print` spawn timed out 13 times on one seat on 2026-09-30 and
|
|
235
|
+
* every one of those asks read, from the room, as the person being ignored —
|
|
236
|
+
* the exact symptom the owner raised at 14:18Z that day. 20s keeps the line
|
|
237
|
+
* contextual (it is still generated from the thread, never canned) and lets a
|
|
238
|
+
* cold spawn finish. Operators can widen or narrow it via env.
|
|
234
239
|
*/
|
|
235
|
-
export const ACK_GEN_TIMEOUT_MS = num(process.env.ASSURANCE_ACK_GEN_TIMEOUT_MS,
|
|
240
|
+
export const ACK_GEN_TIMEOUT_MS = num(process.env.ASSURANCE_ACK_GEN_TIMEOUT_MS, 20_000);
|
|
236
241
|
|
|
237
242
|
/**
|
|
238
243
|
* How many failed GENERATIONS (distinct from failed SENDS, which
|
|
@@ -2537,8 +2542,33 @@ async function _sweepObligations(a = {}) {
|
|
|
2537
2542
|
if (text == null) {
|
|
2538
2543
|
rec.ackGenFailures = (rec.ackGenFailures || 0) + 1;
|
|
2539
2544
|
if (rec.ackGenFailures >= ACK_GEN_MAX_FAILURES) {
|
|
2545
|
+
// A LINE THAT COULD NOT BE GENERATED IS NOT A REASON TO SAY NOTHING.
|
|
2546
|
+
// The directive forbids a CANNED line, not a reaction: "sometimes the
|
|
2547
|
+
// initial response can be an emoji response". A "seen" reaction says
|
|
2548
|
+
// exactly what is true here — the person was seen and the answer is
|
|
2549
|
+
// coming — without composing a sentence nothing generated. Only a
|
|
2550
|
+
// surface with no reactions falls through to silence, and that
|
|
2551
|
+
// silence is now logged with its cause rather than chosen quietly.
|
|
2552
|
+
if (canReactTo(item)) {
|
|
2553
|
+
const reactAfterFailure = (a.deps && a.deps.reactImpl) || deliverReaction;
|
|
2554
|
+
const rres = await reactAfterFailure(item, REACTIONS.seen);
|
|
2555
|
+
if (rres && rres.sent) {
|
|
2556
|
+
budgetOf({ service: rec.service, channel: rec.channel, now, agentRoot: AGENT_REPO_DIR, commit: true });
|
|
2557
|
+
rec.acknowledged = true;
|
|
2558
|
+
rec.ackAt = now;
|
|
2559
|
+
rec.interimSaid = true;
|
|
2560
|
+
rec.interimAt = now;
|
|
2561
|
+
rec.ackShape = "react-after-gen-failure";
|
|
2562
|
+
writeRecord(rec);
|
|
2563
|
+
counters.bump("assurance.interim_reaction_after_gen_failure", { failures: rec.ackGenFailures });
|
|
2564
|
+
console.warn(`[assurance] interim for ${rec.key}: line generation failed ${rec.ackGenFailures}x — acknowledged with a reaction instead of silence`);
|
|
2565
|
+
stats.acked++;
|
|
2566
|
+
continue;
|
|
2567
|
+
}
|
|
2568
|
+
counters.bump("assurance.interim_reaction_failed", { reason: (rres && rres.error) || "unknown", after: "gen-failure" });
|
|
2569
|
+
}
|
|
2540
2570
|
rec.ackSuppressed = true;
|
|
2541
|
-
console.warn(`[assurance] interim for ${rec.key} suppressed after ${rec.ackGenFailures} failed generations —
|
|
2571
|
+
console.warn(`[assurance] interim for ${rec.key} suppressed after ${rec.ackGenFailures} failed generations — silent, no reaction surface, never a canned line`);
|
|
2542
2572
|
}
|
|
2543
2573
|
writeRecord(rec);
|
|
2544
2574
|
continue; // nothing to send; one decision per obligation per tick
|