@thehammer/danx-session-telemetry 0.1.45 → 0.1.47

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/.source-hash CHANGED
@@ -1 +1 @@
1
- 3d2e532980e05f6c38b15f2a85eca3c84c3488c2afec7c285c5ac8a5c20ee254
1
+ ecc5da92c3cb5fcb4ef6668b9d9307de4f31ba3665c1d9437fdc1f45bd6f8b06
@@ -12,8 +12,8 @@
12
12
  * Claude Code's `SubagentStart` / `SubagentStop` hooks carry an `agent_type`
13
13
  * before the sub-agent has written anything and a FINISH for every sub-agent,
14
14
  * foreground or background. They ship from the danxbot plugin in the
15
- * claude-plugins repo (DX-3284, `danxbot/scripts/activity-report.mjs`), run the
16
- * `activity` subcommand of `@thehammer/danx-dashboard-mcp`, and reach the server
15
+ * claude-plugins repo (DX-3284; DX-4235 moved them into the plugin's hooks module), which calls
16
+ * `danxbot_api`, and reach the server
17
17
  * through `POST /api/plan-sessions/me/activity` — which writes the SAME
18
18
  * `dispatch_activities` rows through the same one server writer.
19
19
  *
@@ -50,12 +50,12 @@
50
50
  * Every row is an upsert keyed `(dispatch_id, kind, activity_id)`, and BOTH
51
51
  * producers derive `activity_id` from the same thing: the sub-agent's transcript
52
52
  * file basename, `agent-<agent_id>`. The watcher has it directly; a hook has the
53
- * `agent_id` and builds the same basename from it (`subagentActivityId` in
54
- * danx-dashboard-mcp's `activity.ts`, which also strips an `agent-` prefix the hooks docs show
55
- * on some `agent_id`s so both forms reach this key). A hook's `transcript_path` is NOT the
53
+ * `agent_id` and builds the same basename from it: `agent-` plus the id with one leading `agent-` stripped (the hooks docs
54
+ * show the prefix on some `agent_id`s), so both forms reach this key. That rule lives in the danxbot plugin's hooks module
55
+ * (claude-plugins repo). A hook's `transcript_path` is NOT the
56
56
  * sub-agent's file — on these events it is the MAIN session's transcript, and only
57
57
  * `SubagentStop` also carries the sub-agent's own as `agent_transcript_path`,
58
- * which the subcommand uses to refuse a key that disagrees. That basename is also
58
+ * which the plugin uses to refuse a key that disagrees. That basename is also
59
59
  * the key the ledger credits the sub-agent's tokens under, which is how
60
60
  * per-sub-agent tokens join to the running set without this table carrying a
61
61
  * token column. A task notification names the sub-agent by its bare id
@@ -12,8 +12,8 @@
12
12
  * Claude Code's `SubagentStart` / `SubagentStop` hooks carry an `agent_type`
13
13
  * before the sub-agent has written anything and a FINISH for every sub-agent,
14
14
  * foreground or background. They ship from the danxbot plugin in the
15
- * claude-plugins repo (DX-3284, `danxbot/scripts/activity-report.mjs`), run the
16
- * `activity` subcommand of `@thehammer/danx-dashboard-mcp`, and reach the server
15
+ * claude-plugins repo (DX-3284; DX-4235 moved them into the plugin's hooks module), which calls
16
+ * `danxbot_api`, and reach the server
17
17
  * through `POST /api/plan-sessions/me/activity` — which writes the SAME
18
18
  * `dispatch_activities` rows through the same one server writer.
19
19
  *
@@ -50,12 +50,12 @@
50
50
  * Every row is an upsert keyed `(dispatch_id, kind, activity_id)`, and BOTH
51
51
  * producers derive `activity_id` from the same thing: the sub-agent's transcript
52
52
  * file basename, `agent-<agent_id>`. The watcher has it directly; a hook has the
53
- * `agent_id` and builds the same basename from it (`subagentActivityId` in
54
- * danx-dashboard-mcp's `activity.ts`, which also strips an `agent-` prefix the hooks docs show
55
- * on some `agent_id`s so both forms reach this key). A hook's `transcript_path` is NOT the
53
+ * `agent_id` and builds the same basename from it: `agent-` plus the id with one leading `agent-` stripped (the hooks docs
54
+ * show the prefix on some `agent_id`s), so both forms reach this key. That rule lives in the danxbot plugin's hooks module
55
+ * (claude-plugins repo). A hook's `transcript_path` is NOT the
56
56
  * sub-agent's file — on these events it is the MAIN session's transcript, and only
57
57
  * `SubagentStop` also carries the sub-agent's own as `agent_transcript_path`,
58
- * which the subcommand uses to refuse a key that disagrees. That basename is also
58
+ * which the plugin uses to refuse a key that disagrees. That basename is also
59
59
  * the key the ledger credits the sub-agent's tokens under, which is how
60
60
  * per-sub-agent tokens join to the running set without this table carrying a
61
61
  * token column. A task notification names the sub-agent by its bare id
@@ -13,7 +13,7 @@ function emit(level, component, message, error) {
13
13
  entry.error = String(error);
14
14
  }
15
15
  // DX-2954 — every level goes to STDERR. The MCP server's
16
- // relay and the one-shot subcommands run this collector; the subcommands' STDOUT is a protocol
16
+ // relay and the `subagents-live` subcommand run this collector; the subcommand's STDOUT is a protocol
17
17
  // channel the plugin parses (and the MCP server's is JSON-RPC), so a log line there
18
18
  // would corrupt it. The worker captures both streams.
19
19
  console.error(JSON.stringify(entry));
@@ -135,20 +135,6 @@ export type ActivityEndStatus = (typeof ACTIVITY_END_STATUSES)[number];
135
135
  export declare const CURRENT_ACTIVITY_MAX_CHARS = 120;
136
136
  export interface StatsPayload {
137
137
  entries: LedgerEntry[];
138
- /**
139
- * DX-2963 — the worker applied the end-of-file rule (its own row or its
140
- * predecessor's is pre-card), so the dispatch inherits pre-card lineage.
141
- *
142
- * DX-2954 RETIRED this field (DX-3286 removes it): the cursor start order replaces the rule it
143
- * carried. It is still ACCEPTED, and ignored, for exactly one release — a
144
- * deploy restarts the dashboard before it relaunches the workers, so for a
145
- * window old workers send it to the new server, and refusing it would throw
146
- * away their terminal status. A payload carrying it records one visible
147
- * `stats_field_ignored` event per dispatch. The release after this one drops
148
- * the field, the `usage_pre_card_lineage` column and the two
149
- * `handleReadDispatch` fields together.
150
- */
151
- preCardLineage?: true;
152
138
  /**
153
139
  * DX-2954 — this collector's cursors for every source it has opened. Optional
154
140
  * because an old worker in the deploy window sends none; absent means
@@ -46,13 +46,10 @@ const USAGE_KEYS = ["input", "output", "cacheRead", "cacheWrite5m", "cacheWrite1
46
46
  * consumer) fails loud instead of being silently dropped — the pre-DX-2954
47
47
  * parser rebuilt the object field by field and swallowed every extra key.
48
48
  *
49
- * `preCardLineage` is on this list for exactly one release, until DX-3286 (see its doc on
50
- * {@link StatsPayload}); `transcriptPath` is the ONE key allowed to carry a
51
- * filesystem path.
49
+ * `transcriptPath` is the ONE key allowed to carry a filesystem path.
52
50
  */
53
51
  const STATS_PAYLOAD_KEYS = new Set([
54
52
  "entries",
55
- "preCardLineage",
56
53
  "sourceCursors",
57
54
  "activities",
58
55
  "transcriptPath",
@@ -364,9 +361,6 @@ export function parseStatsPayload(body) {
364
361
  if (b.entries.length > STATS_BATCH_CAP) {
365
362
  throw new StatsPayloadError(`entries exceeds the cap of ${STATS_BATCH_CAP}`);
366
363
  }
367
- if (b.preCardLineage !== undefined && b.preCardLineage !== true) {
368
- throw new StatsPayloadError("preCardLineage must be true when present");
369
- }
370
364
  if (b.transcriptPath !== undefined && (typeof b.transcriptPath !== "string" || !b.transcriptPath)) {
371
365
  throw new StatsPayloadError("transcriptPath must be a non-empty string when present");
372
366
  }
@@ -427,8 +421,6 @@ export function parseStatsPayload(body) {
427
421
  };
428
422
  });
429
423
  const payload = { entries };
430
- if (b.preCardLineage === true)
431
- payload.preCardLineage = true;
432
424
  if (b.sourceCursors !== undefined)
433
425
  payload.sourceCursors = parseSourceCursors(b.sourceCursors);
434
426
  if (b.activities !== undefined)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thehammer/danx-session-telemetry",
3
- "version": "0.1.45",
3
+ "version": "0.1.47",
4
4
  "description": "Shared Claude Code transcript collector (DX-2962) — incremental JSONL tailing for the danxbot worker and the danx-dashboard-mcp MCP server's relay, so both run identical collector code.",
5
5
  "license": "MIT",
6
6
  "type": "module",