@cohortapp/agent-sdk 2.18.25 → 2.18.28

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.
@@ -0,0 +1,132 @@
1
+ #!/bin/bash
2
+ # record-no-send.sh — witness a reply that did NOT go out, and say which kind of
3
+ # not-going-out it was.
4
+ #
5
+ # WHY THIS EXISTS
6
+ #
7
+ # `record-receipt.sh` is the positive half: it proves a session spoke. Its
8
+ # absence was being read as one thing — "the session finished and its reply
9
+ # never sent" — and on 2026-09-30 that reading put 188 recovery notices into the
10
+ # org in a day. Of the 46 seed notices that day, 32 carried the session's own
11
+ # words saying it had DECIDED, correctly, that no reply was owed ("Logged and
12
+ # archived — no response needed." "I marked it processed and sent no reply,
13
+ # since it closes the thread."). The other 14 carried a real composed answer
14
+ # that never got out, and four notices in the window named their own blocked
15
+ # send lane in prose because they had no other way to report it.
16
+ #
17
+ # Silence has two causes and they need opposite treatment:
18
+ #
19
+ # declined — nothing tried to send, because nothing was owed. Close quietly.
20
+ # Say nothing. This is the design working.
21
+ # refused — something tried and was stopped: the outbound gate, a transport
22
+ # error, an ACL, a pre-tool hook with no fallback lane. The work is
23
+ # done and the human has nothing. This is a fault, it should be
24
+ # NAMED, and where the cause is transient it should be retried.
25
+ #
26
+ # Nothing downstream can tell those apart from an absence, so whoever makes the
27
+ # decision records it, at the moment it is made.
28
+ #
29
+ # ── EXIT CODES, AND WHY THIS SCRIPT IS NOT "ALWAYS 0" ────────────────────────
30
+ #
31
+ # The first cut exited 0 on every path including a misspelt decision, a missing
32
+ # node and a missing receipts module, writing nothing and printing nothing. A
33
+ # session following the documented invocation exactly could believe it had
34
+ # recorded a reason that no reader would ever find — which is the same class of
35
+ # defect as the one this script exists to fix, one layer down.
36
+ #
37
+ # `record-receipt.sh` is right to swallow everything: it runs AFTER a successful
38
+ # send and a non-zero there could be read as a failed send. Here the send has
39
+ # already not happened, so there is nothing left to break and a loud failure is
40
+ # strictly better than a quiet one.
41
+ #
42
+ # 0 the row was written, and a reader can attribute it
43
+ # 3 the row was written but NOTHING DOWNSTREAM CAN READ IT — no obligation
44
+ # attribution was available (see below). Fix the caller, not this script.
45
+ # 4 the recorder could not run at all (no node, no receipts module, node
46
+ # exited non-zero). Environment, not your invocation.
47
+ # 64 your invocation was wrong (EX_USAGE). Nothing was written.
48
+ #
49
+ # ── ATTRIBUTION ─────────────────────────────────────────────────────────────
50
+ #
51
+ # A row is found by `noSendFor` only if it carries this obligation's key or this
52
+ # obligation's session id; a row with neither is invisible to every reader, by
53
+ # design (borrowing another debt's row would silence a real fault). The values
54
+ # ride in on the env the dispatcher stamps on the child —
55
+ # MAESTRO_OBLIGATION_KEY / MAESTRO_SESSION_ID — exactly as they do for a
56
+ # receipt, and are passed explicitly below so that the case where they are
57
+ # ABSENT is visible instead of silently producing a dead row.
58
+ #
59
+ # Usage: record-no-send.sh <declined|refused> <service> <channel> [reason] [code]
60
+ set +e
61
+
62
+ say() { printf 'record-no-send: %s\n' "$1" >&2; }
63
+
64
+ usage() {
65
+ say "$1"
66
+ say "usage: record-no-send.sh <declined|refused> <service> <channel> [reason] [code]"
67
+ exit 64
68
+ }
69
+
70
+ DECISION="$1"
71
+ SERVICE="$2"
72
+ CHANNEL="$3"
73
+ REASON="${4:-}"
74
+ CODE="${5:-}"
75
+
76
+ case "$DECISION" in
77
+ declined|refused) ;;
78
+ "") usage "no decision given — nothing was recorded" ;;
79
+ *) usage "unknown decision '$DECISION' — it must be exactly 'declined' or 'refused'; nothing was recorded" ;;
80
+ esac
81
+ [ -n "$SERVICE" ] || usage "no service given (cohort, gmail, slack, …) — nothing was recorded"
82
+ [ -n "$CHANNEL" ] || usage "no channel given — nothing was recorded"
83
+
84
+ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
85
+
86
+ # Two different roots, deliberately kept apart — see record-receipt.sh for why
87
+ # collapsing them silently writes nothing whenever an agent's root is not also a
88
+ # maestro checkout.
89
+ CODE_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
90
+ AGENT_REPO_DIR="${AGENT_DIR:-$CODE_DIR}"
91
+
92
+ RECEIPTS=""
93
+ for CAND in \
94
+ "$CODE_DIR/lib/comms/receipts.mjs" \
95
+ "$AGENT_REPO_DIR/lib/comms/receipts.mjs" \
96
+ "$AGENT_REPO_DIR/node_modules/@cohortapp/agent-sdk/lib/comms/receipts.mjs"
97
+ do
98
+ if [ -f "$CAND" ]; then RECEIPTS="$CAND"; break; fi
99
+ done
100
+ if [ -z "$RECEIPTS" ]; then
101
+ say "cannot find lib/comms/receipts.mjs under $CODE_DIR or $AGENT_REPO_DIR — nothing was recorded"
102
+ exit 4
103
+ fi
104
+
105
+ NODE_BIN="${MAESTRO_NODE_BIN:-/opt/homebrew/bin/node}"
106
+ command -v "$NODE_BIN" >/dev/null 2>&1 || NODE_BIN="node"
107
+ if ! command -v "$NODE_BIN" >/dev/null 2>&1; then
108
+ say "no usable node on PATH (tried ${MAESTRO_NODE_BIN:-/opt/homebrew/bin/node} and node) — nothing was recorded"
109
+ exit 4
110
+ fi
111
+
112
+ OBLIGATION_KEY="${MAESTRO_OBLIGATION_KEY:-}"
113
+ SESSION_ID="${MAESTRO_SESSION_ID:-${AGENT_SESSION_ID:-}}"
114
+
115
+ AGENT_DIR="$AGENT_REPO_DIR" "$NODE_BIN" "$RECEIPTS" no-send \
116
+ --decision "$DECISION" --service "$SERVICE" --channel "$CHANNEL" \
117
+ ${REASON:+--reason "$REASON"} ${CODE:+--code "$CODE"} \
118
+ ${OBLIGATION_KEY:+--obligation-key "$OBLIGATION_KEY"} \
119
+ ${SESSION_ID:+--session-id "$SESSION_ID"} \
120
+ --surface session --agent-root "$AGENT_REPO_DIR" >/dev/null 2>&1
121
+ RC=$?
122
+ if [ "$RC" -ne 0 ]; then
123
+ say "the recorder exited $RC — nothing was recorded"
124
+ exit 4
125
+ fi
126
+
127
+ if [ -z "$OBLIGATION_KEY" ] && [ -z "$SESSION_ID" ]; then
128
+ say "recorded, but with NO OBLIGATION ATTRIBUTION: neither MAESTRO_OBLIGATION_KEY nor MAESTRO_SESSION_ID is set in this environment, so no reader can match this row to the ask it belongs to. If you are in a dispatched session this is a bug worth reporting; if you started this session by hand, export MAESTRO_OBLIGATION_KEY and run it again."
129
+ exit 3
130
+ fi
131
+
132
+ exit 0
@@ -371,6 +371,31 @@ mkdir -p "$CLAUDE_SETTINGS_DIR"
371
371
  # RCE vector — and have been removed entirely. Collective-memory hooks are
372
372
  # wired separately and idempotently by `maestro global-setup` below, which
373
373
  # deep-merges its own hooks.)
374
+ # NO OUTPUT-STYLE PLUGINS ON A SEAT.
375
+ #
376
+ # explanatory-output-style and learning-output-style were both enabled in the
377
+ # enabledPlugins block below, and both are wrong for an agent seat: a seat does
378
+ # not write for a developer at a terminal, it posts to colleagues in a room.
379
+ #
380
+ # explanatory instructs the model to wrap its work in decorative teaching
381
+ # blocks. Observed 2026-09-30 20:12:55Z: a seat posted one verbatim into a
382
+ # shared engineering channel, backticks and box-drawing rules included, in the
383
+ # middle of a status message.
384
+ #
385
+ # learning instructs the model to stop and ask the reader to write 5-10 lines
386
+ # of code, marked with a TODO. A seat answering a colleague must never hand
387
+ # back homework.
388
+ #
389
+ # Enabling the plugin is what turns the style ON, not merely what makes it
390
+ # available: the machines exhibiting this carry no separate outputStyle key, and
391
+ # a session on a box with both enabled reports itself in learning mode. So
392
+ # listing them here was a fleet-wide activation.
393
+ #
394
+ # This fixes seats provisioned from here on. An existing seat still carries the
395
+ # flags in its own global settings file and has to be cleaned there. The upgrade
396
+ # path deliberately does not rewrite a machine global settings file, because
397
+ # silently editing 16 operator configs is not a repair an upgrade is entitled to
398
+ # make; the remediation is a one-line edit the operator runs.
374
399
  MAESTRO_SETTINGS_ADDITIONS='{
375
400
  "$schema": "https://json.schemastore.org/claude-code-settings.json",
376
401
  "enabledPlugins": {
@@ -398,8 +423,6 @@ MAESTRO_SETTINGS_ADDITIONS='{
398
423
  "remember@claude-plugins-official": true,
399
424
  "mcp-server-dev@claude-plugins-official": true,
400
425
  "zapier@claude-plugins-official": true,
401
- "explanatory-output-style@claude-plugins-official": true,
402
- "learning-output-style@claude-plugins-official": true,
403
426
  "claude-mem": true,
404
427
  "claude-pace": true
405
428
  },