@groundnuty/macf 0.2.27 → 0.2.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.
@@ -1,4 +1,4 @@
1
1
  {
2
- "commit": "64a19a66cf1c80b5ecd8dcd0d1b3249d0676a220",
3
- "built_at": "2026-05-19T08:02:20.141Z"
2
+ "commit": "928c95482ebb793cb87bf567687f616210ec55f1",
3
+ "built_at": "2026-05-19T10:58:05.072Z"
4
4
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@groundnuty/macf",
3
- "version": "0.2.27",
3
+ "version": "0.2.28",
4
4
  "description": "Multi-Agent Coordination Framework CLI — coordinate Claude Code agents via GitHub. Installs as `macf` binary; use `macf init` to set up an agent workspace, `macf update` to refresh rules + version pins.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -35,7 +35,7 @@
35
35
  "test:watch": "vitest"
36
36
  },
37
37
  "dependencies": {
38
- "@groundnuty/macf-core": "0.2.27",
38
+ "@groundnuty/macf-core": "0.2.28",
39
39
  "commander": "^14.0.3",
40
40
  "reflect-metadata": "^0.2.2",
41
41
  "zod": "^4.0.0"
@@ -237,6 +237,40 @@ _macf_audit_parse_workflow() {
237
237
  echo ""
238
238
  }
239
239
 
240
+ _macf_audit_build_resource_attrs_json() {
241
+ # Build OTLP-shape resource.attributes JSON array from the canonical
242
+ # claude.sh-exported OTel env vars (`OTEL_SERVICE_NAME` +
243
+ # `OTEL_RESOURCE_ATTRIBUTES`). Per macf#388 / observability-wiring.md:
244
+ # claude.sh exports these at session bootstrap as the single source
245
+ # of truth for the agent's identity attrs. The hook silent-skips
246
+ # service.name + gen_ai.* attrs when emitting outside a claude.sh-
247
+ # wrapped session (graceful degradation; returns the empty array).
248
+ #
249
+ # OTEL_RESOURCE_ATTRIBUTES format per OTel spec: comma-separated
250
+ # `key=value` pairs, no quoting. Canonical export:
251
+ # gen_ai.agent.name=<name>,gen_ai.agent.role=<role>,service.namespace=macf
252
+ local service_name="${OTEL_SERVICE_NAME:-}"
253
+ local resource_attrs="${OTEL_RESOURCE_ATTRIBUTES:-}"
254
+ jq -n \
255
+ --arg service_name "$service_name" \
256
+ --arg resource_attrs "$resource_attrs" \
257
+ '
258
+ (
259
+ if $service_name != ""
260
+ then [{key: "service.name", value: {stringValue: $service_name}}]
261
+ else []
262
+ end
263
+ )
264
+ +
265
+ (
266
+ $resource_attrs
267
+ | split(",")
268
+ | map(select(length > 0))
269
+ | map(split("=") | select(length >= 2 and .[0] != "") | {key: .[0], value: {stringValue: (.[1] // "")}})
270
+ )
271
+ ' 2>/dev/null || echo "[]"
272
+ }
273
+
240
274
  _macf_audit_emit() {
241
275
  # Emit span + counter for an actions:write-scoped invocation.
242
276
  # Observational only — every emission path is best-effort. Failures
@@ -370,6 +404,14 @@ _macf_audit_emit_curl_span() {
370
404
  + ( if $url_full != "" then [{key: "url.full", value: {stringValue: $url_full}}] else [] end )' 2>/dev/null
371
405
  )" || return 1
372
406
 
407
+ # macf#388: populate resource.attributes from claude.sh's exported
408
+ # OTel env vars so hook-emitted spans match the rest of the MACF
409
+ # stack's service.name / gen_ai.* attrs (instead of falling under
410
+ # `rootServiceName=<root span not yet received>` in Tempo).
411
+ # Graceful degradation: empty array when env unset.
412
+ local resource_attrs_json
413
+ resource_attrs_json="$(_macf_audit_build_resource_attrs_json)"
414
+
373
415
  local body
374
416
  body="$(
375
417
  jq -n \
@@ -378,9 +420,10 @@ _macf_audit_emit_curl_span() {
378
420
  --arg name "macf.app.gh_api_call" \
379
421
  --arg ts_ns "$ts_ns" \
380
422
  --argjson attrs "$attrs_json" \
423
+ --argjson resource_attrs "$resource_attrs_json" \
381
424
  '{
382
425
  resourceSpans: [{
383
- resource: { attributes: [] },
426
+ resource: { attributes: $resource_attrs },
384
427
  scopeSpans: [{
385
428
  scope: { name: "macf" },
386
429
  spans: [{
@@ -425,15 +468,22 @@ _macf_audit_emit_curl_metric() {
425
468
  + ( if $workflow != "" then [{key: "workflow", value: {stringValue: $workflow}}] else [] end )' 2>/dev/null
426
469
  )" || return 1
427
470
 
471
+ # macf#388: same resource-attrs population as the span side, for
472
+ # cross-signal consistency on Tempo / Prometheus aggregation by
473
+ # service.name / gen_ai.* dimensions.
474
+ local resource_attrs_json
475
+ resource_attrs_json="$(_macf_audit_build_resource_attrs_json)"
476
+
428
477
  local body
429
478
  body="$(
430
479
  jq -n \
431
480
  --arg name "macf.app.gh_actions_write_total" \
432
481
  --arg ts_ns "$ts_ns" \
433
482
  --argjson attrs "$attrs_json" \
483
+ --argjson resource_attrs "$resource_attrs_json" \
434
484
  '{
435
485
  resourceMetrics: [{
436
- resource: { attributes: [] },
486
+ resource: { attributes: $resource_attrs },
437
487
  scopeMetrics: [{
438
488
  scope: { name: "macf" },
439
489
  metrics: [{