@thehammer/danx-session-telemetry 0.1.21 → 0.1.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.
@@ -56,7 +56,8 @@ export const ISSUE_ID_MAX_LENGTH = 32;
56
56
  const CLAIM_ACTION = "pickup";
57
57
  /** The transitions that end a sub-agent's hold on a card. */
58
58
  const RELEASE_ACTIONS = new Set(["complete", "cancel", "block", "rollback_pickup"]);
59
- const TRANSITION_PATH = /^\/api\/issues\/([A-Za-z][A-Za-z0-9]*-[0-9]+)\/transition$/;
59
+ // DX-3962: built from ISSUE_ID_PATTERN so the card-id shape lives in one place.
60
+ const TRANSITION_PATH = new RegExp(`^/api/issues/(${ISSUE_ID_PATTERN.source.slice(1, -1)})/transition$`);
60
61
  /**
61
62
  * Bounds that keep one source's persisted state, and the stats write that carries
62
63
  * it, bounded. A real sub-agent holds one or two cards, so neither is reachable;
@@ -219,6 +219,11 @@ export declare const CURSOR_BATCH_CAP = 500;
219
219
  * still-running report queued after a finish must not un-finish the row.
220
220
  */
221
221
  export declare function collapseActivityChanges(changes: readonly ActivityChange[]): ActivityChange[];
222
+ /**
223
+ * DX-3962 - whether `raw` is a well-formed claim state. A STORED cursor from a server that predates attribution has
224
+ * none, and a collector must refuse such an answer instead of dereferencing it.
225
+ */
226
+ export declare function isClaimState(raw: unknown): raw is ClaimState;
222
227
  /**
223
228
  * Strict parse of a stats body (fail loud — a malformed entry is a worker
224
229
  * bug, never coerced). Refuses more than {@link STATS_BATCH_CAP} entries, and
@@ -117,6 +117,21 @@ const PENDING_KEYS = new Set(["op", "issueId"]);
117
117
  function isIssueId(v) {
118
118
  return typeof v === "string" && v.length <= ISSUE_ID_MAX_LENGTH && ISSUE_ID_PATTERN.test(v);
119
119
  }
120
+ /**
121
+ * DX-3962 - whether `raw` is a well-formed claim state. A STORED cursor from a server that predates attribution has
122
+ * none, and a collector must refuse such an answer instead of dereferencing it.
123
+ */
124
+ export function isClaimState(raw) {
125
+ try {
126
+ parseClaimState(raw, "claims");
127
+ return true;
128
+ }
129
+ catch (err) {
130
+ if (err instanceof StatsPayloadError)
131
+ return false;
132
+ throw err;
133
+ }
134
+ }
120
135
  /** DX-3962 - strict parse of one source's claim state (a collector bug, never coerced). */
121
136
  function parseClaimState(raw, where) {
122
137
  if (!raw || typeof raw !== "object" || Array.isArray(raw))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thehammer/danx-session-telemetry",
3
- "version": "0.1.21",
3
+ "version": "0.1.22",
4
4
  "description": "Shared Claude Code transcript collector (DX-2962) — incremental JSONL tailing for the danxbot worker and the danx-dashboard-mcp desktop bridge, so both run identical collector code.",
5
5
  "license": "MIT",
6
6
  "type": "module",