@groundnuty/macf 0.2.38 → 0.2.39
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/.build-info.json +2 -2
- package/dist/cli/claude-sh.d.ts.map +1 -1
- package/dist/cli/claude-sh.js +13 -0
- package/dist/cli/claude-sh.js.map +1 -1
- package/dist/cli/commands/fleet-doctor-inject.d.ts +52 -0
- package/dist/cli/commands/fleet-doctor-inject.d.ts.map +1 -0
- package/dist/cli/commands/fleet-doctor-inject.js +100 -0
- package/dist/cli/commands/fleet-doctor-inject.js.map +1 -0
- package/dist/cli/commands/fleet-doctor.d.ts +236 -0
- package/dist/cli/commands/fleet-doctor.d.ts.map +1 -0
- package/dist/cli/commands/fleet-doctor.js +481 -0
- package/dist/cli/commands/fleet-doctor.js.map +1 -0
- package/dist/cli/commands/fleet.d.ts +83 -0
- package/dist/cli/commands/fleet.d.ts.map +1 -0
- package/dist/cli/commands/fleet.js +225 -0
- package/dist/cli/commands/fleet.js.map +1 -0
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +8 -0
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/migrate.d.ts +1 -0
- package/dist/cli/commands/migrate.d.ts.map +1 -1
- package/dist/cli/commands/registry-prune.d.ts +43 -6
- package/dist/cli/commands/registry-prune.d.ts.map +1 -1
- package/dist/cli/commands/registry-prune.js +53 -14
- package/dist/cli/commands/registry-prune.js.map +1 -1
- package/dist/cli/commands/restart-self.d.ts +111 -0
- package/dist/cli/commands/restart-self.d.ts.map +1 -0
- package/dist/cli/commands/restart-self.js +312 -0
- package/dist/cli/commands/restart-self.js.map +1 -0
- package/dist/cli/commands/routing-doctor-gh.d.ts +29 -0
- package/dist/cli/commands/routing-doctor-gh.d.ts.map +1 -0
- package/dist/cli/commands/routing-doctor-gh.js +103 -0
- package/dist/cli/commands/routing-doctor-gh.js.map +1 -0
- package/dist/cli/commands/routing-doctor.d.ts +183 -0
- package/dist/cli/commands/routing-doctor.d.ts.map +1 -0
- package/dist/cli/commands/routing-doctor.js +504 -0
- package/dist/cli/commands/routing-doctor.js.map +1 -0
- package/dist/cli/commands/update.d.ts.map +1 -1
- package/dist/cli/commands/update.js +9 -0
- package/dist/cli/commands/update.js.map +1 -1
- package/dist/cli/host-prelude.d.ts +50 -0
- package/dist/cli/host-prelude.d.ts.map +1 -0
- package/dist/cli/host-prelude.js +256 -0
- package/dist/cli/host-prelude.js.map +1 -0
- package/dist/cli/index.js +89 -0
- package/dist/cli/index.js.map +1 -1
- package/package.json +2 -2
- package/plugin/rules/coordination.md +10 -0
- package/plugin/rules/silent-fallback-hazards.md +19 -4
- package/scripts/emit-turn-receipt.sh +44 -4
|
@@ -11,6 +11,16 @@
|
|
|
11
11
|
# structurally (closes the #437 send≠receipt gap). A prompt with NO marker
|
|
12
12
|
# (a typed prompt, a non-routed turn) is a no-op — exit 0, emit nothing.
|
|
13
13
|
#
|
|
14
|
+
# DR-030 keystone (groundnuty/macf#568): IN ADDITION to the span, this hook
|
|
15
|
+
# appends one LOCAL turn-receipt line per marker to
|
|
16
|
+
# `$(dirname MACF_LOG_PATH)/processed-receipts.jsonl`
|
|
17
|
+
# (`{"ts":<epoch-ms>,"run_id":"<run_id>","agent":"<agent>"}`). The channel-server
|
|
18
|
+
# reads the most-recent receipt for `/health.last_processed`, making the
|
|
19
|
+
# passive-Processed tier a real LOCAL self-report (no Tempo round-trip). The
|
|
20
|
+
# receipt is ADDITIVE and does NOT depend on curl/openssl or a live OTLP endpoint;
|
|
21
|
+
# it is fail-open + non-blocking like the rest of this async hook (MACF_LOG_PATH
|
|
22
|
+
# unset → receipt skipped, a graceful no-op).
|
|
23
|
+
#
|
|
14
24
|
# Registered `async: true` (settings.json) so it never adds turn latency. It
|
|
15
25
|
# NEVER blocks the turn: any failure path exits 0 (with a stderr WARN on a
|
|
16
26
|
# genuine emit error — fail-loud per silent-fallback-hazards.md Instance 8).
|
|
@@ -39,19 +49,49 @@ fi
|
|
|
39
49
|
MARKERS="$(printf '%s' "$PROMPT" | grep -oE '\[macf-route:[0-9]+:[a-z0-9-]+\]' | sort -u || true)"
|
|
40
50
|
[ -z "$MARKERS" ] && exit 0
|
|
41
51
|
|
|
42
|
-
#
|
|
43
|
-
|
|
44
|
-
|
|
52
|
+
# The OTLP span needs curl + openssl. The LOCAL receipt below does NOT — it must
|
|
53
|
+
# land regardless (DR-030 passive-Processed is a real LOCAL self-report, working
|
|
54
|
+
# even on a host without curl/openssl or without a live OTLP endpoint). So gate
|
|
55
|
+
# ONLY the span on a flag; never exit before writing the receipt.
|
|
56
|
+
CAN_EMIT_SPAN=1
|
|
57
|
+
command -v curl >/dev/null 2>&1 || CAN_EMIT_SPAN=0
|
|
58
|
+
command -v openssl >/dev/null 2>&1 || CAN_EMIT_SPAN=0
|
|
45
59
|
|
|
46
60
|
BASE="${OTEL_EXPORTER_OTLP_ENDPOINT:-http://orzech-dev-agents-monitoring.tail491af.ts.net:4318}"
|
|
47
61
|
BASE="${BASE%/v1/traces}"
|
|
48
62
|
|
|
49
|
-
#
|
|
63
|
+
# DR-030 local turn-receipt sink (groundnuty/macf#568): a sibling of MACF_LOG_PATH.
|
|
64
|
+
# Empty when MACF_LOG_PATH is unset → the receipt write is skipped (graceful no-op).
|
|
65
|
+
RECEIPT_SINK=""
|
|
66
|
+
[ -n "${MACF_LOG_PATH:-}" ] && RECEIPT_SINK="$(dirname "$MACF_LOG_PATH")/processed-receipts.jsonl"
|
|
67
|
+
|
|
68
|
+
# One independent span per distinct marker (own trace/span id + timestamp), plus
|
|
69
|
+
# one local receipt per marker (the receipt lands even when the span can't).
|
|
50
70
|
printf '%s\n' "$MARKERS" | while IFS= read -r MARKER; do
|
|
51
71
|
[ -z "$MARKER" ] && continue
|
|
52
72
|
RUN_ID="$(printf '%s' "$MARKER" | sed -E 's/.*\[macf-route:([0-9]+):([a-z0-9-]+)\].*/\1/')"
|
|
53
73
|
AGENT="$(printf '%s' "$MARKER" | sed -E 's/.*\[macf-route:([0-9]+):([a-z0-9-]+)\].*/\2/')"
|
|
54
74
|
|
|
75
|
+
# DR-030 keystone: append the LOCAL turn-receipt — ADDITIVE to the span — so the
|
|
76
|
+
# agent's own /health.last_processed self-reports "I processed routed traffic at
|
|
77
|
+
# T" without Tempo. Fail-open + non-blocking (any error swallowed; this async
|
|
78
|
+
# hook must NEVER fail a turn). epoch-ms: `date +%s%3N` is GNU; a BSD/mac date
|
|
79
|
+
# leaves a literal `N` → fall back to seconds×1000 (the `*N` glob catches it).
|
|
80
|
+
if [ -n "$RECEIPT_SINK" ]; then
|
|
81
|
+
TS_MS="$(date +%s%3N 2>/dev/null || true)"
|
|
82
|
+
case "$TS_MS" in
|
|
83
|
+
*N|'' ) TS_MS="$(( $(date +%s) * 1000 ))" ;;
|
|
84
|
+
esac
|
|
85
|
+
{
|
|
86
|
+
mkdir -p "$(dirname "$RECEIPT_SINK")" 2>/dev/null &&
|
|
87
|
+
printf '{"ts":%s,"run_id":"%s","agent":"%s"}\n' "$TS_MS" "$RUN_ID" "$AGENT" >> "$RECEIPT_SINK"
|
|
88
|
+
} 2>/dev/null || true
|
|
89
|
+
fi
|
|
90
|
+
|
|
91
|
+
# Span requires curl + openssl; the local receipt above already landed, so just
|
|
92
|
+
# skip the span for this marker when we can't emit it.
|
|
93
|
+
[ "$CAN_EMIT_SPAN" = 1 ] || continue
|
|
94
|
+
|
|
55
95
|
# Nanosecond epoch. `date +%s%N` is GNU-only (substrate is Linux); on a BSD/mac
|
|
56
96
|
# date that prints a literal `N`, fall back to seconds×1e9.
|
|
57
97
|
NOW="$(date +%s%N 2>/dev/null || true)"
|