@brainervirus/workit-core 0.8.3 → 0.8.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brainervirus/workit-core",
3
- "version": "0.8.3",
3
+ "version": "0.8.5",
4
4
  "private": false,
5
5
  "description": "Workit — workflow rails for agentic coding: specs, plans, YouTrack, CI-gated commits (shared core)",
6
6
  "keywords": [
@@ -1271,9 +1271,20 @@ export class HostReceiptStore {
1271
1271
  }
1272
1272
  }
1273
1273
 
1274
- /** Menu labels compare case-insensitively: the host presents "Inline", the
1275
- * enum stores "inline" (FINDING 3). */
1276
- const sameChoiceLabel = (a: string, b: string): boolean => a.toLowerCase() === b.toLowerCase();
1274
+ /** Menu labels compare semantically: hosts decorate choices with
1275
+ * parenthesized qualifiers ("Handoff (new session only)") that the enum does
1276
+ * not carry, so we strip them, trim, collapse whitespace, and lowercase both
1277
+ * sides before comparing. Only the comparison normalizes — the stored label
1278
+ * and evidence bytes are preserved verbatim. */
1279
+ const sameChoiceLabel = (a: string, b: string): boolean => normalizeLabel(a) === normalizeLabel(b);
1280
+
1281
+ const normalizeLabel = (s: string): string =>
1282
+ s
1283
+ .replace(/\s*\([^)]*\)/g, " ")
1284
+ .replace(/\s*\bfirst\b\s*$/i, " ")
1285
+ .replace(/[^a-z0-9]+/gi, " ")
1286
+ .trim()
1287
+ .toLowerCase();
1277
1288
 
1278
1289
  /** Derive the evidence record from a consumed host receipt (AR-12). */
1279
1290
  export const createOpenCodeEvidence = (receipt: HostReceipt): OpenCodeChoiceEvidence => ({
@@ -4,8 +4,10 @@ import { DESTINATION_MENU_LABELS, HANDOFF_DESTINATION_MARKER, SOURCE_MENU_LABELS
4
4
  // the reminder PROSE like the other source surfaces (bootstrap.ts, session-start,
5
5
  // superpowers-doc-contract.md, ask-question-only.mdc), never in the machine
6
6
  // label tuple `SOURCE_MENU_LABELS` — the receipt label must stay exactly
7
- // `Handoff` for the native-question match (AR-12).
8
- const SOURCE_MENU_LABELS_DISPLAY = SOURCE_MENU_LABELS.map((label) =>
7
+ // `Handoff` for the native-question match (AR-12). Exported so contract tests
8
+ // assert the rendered reminder against this single source of truth instead of
9
+ // re-deriving the mapping.
10
+ export const SOURCE_MENU_LABELS_DISPLAY = SOURCE_MENU_LABELS.map((label) =>
9
11
  label === "Handoff" ? "Handoff (new session only)" : label,
10
12
  );
11
13