All files / src/constants hands.ts

0% Statements 0/45
100% Branches 1/1
100% Functions 1/1
0% Lines 0/45

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80                                                                                                                                                               
/**
 * Hand ID Constants - Single Source of Truth
 *
 * All Hand-related constants should reference this file.
 * Do NOT hardcode Hand IDs elsewhere.
 */
 
// === Hand IDs (must match backend zclaw-hands) ===
 
export const HAND_IDS = {
  BROWSER: 'browser',
  RESEARCHER: 'researcher',
  COLLECTOR: 'collector',
  PREDICTOR: 'predictor',
  LEAD: 'lead',
  TRADER: 'trader',
  CLIP: 'clip',
  TWITTER: 'twitter',
  // Additional hands from backend
  SLIDESHOW: 'slideshow',
  SPEECH: 'speech',
  QUIZ: 'quiz',
  WHITEBOARD: 'whiteboard',
} as const;
 
export type HandIdType = typeof HAND_IDS[keyof typeof HAND_IDS];
 
// === Hand Categories ===
 
export const HAND_CATEGORIES = {
  RESEARCH: 'research',
  DATA: 'data',
  AUTOMATION: 'automation',
  COMMUNICATION: 'communication',
  CONTENT: 'content',
  PRODUCTIVITY: 'productivity',
} as const;
 
export type HandCategoryType = typeof HAND_CATEGORIES[keyof typeof HAND_CATEGORIES];
 
// === Hand ID to Category Mapping ===
 
export const HAND_CATEGORY_MAP: Record<string, HandCategoryType> = {
  [HAND_IDS.BROWSER]: HAND_CATEGORIES.RESEARCH,
  [HAND_IDS.RESEARCHER]: HAND_CATEGORIES.RESEARCH,
  [HAND_IDS.COLLECTOR]: HAND_CATEGORIES.DATA,
  [HAND_IDS.PREDICTOR]: HAND_CATEGORIES.DATA,
  [HAND_IDS.TRADER]: HAND_CATEGORIES.DATA,
  [HAND_IDS.LEAD]: HAND_CATEGORIES.COMMUNICATION,
  [HAND_IDS.TWITTER]: HAND_CATEGORIES.COMMUNICATION,
  [HAND_IDS.CLIP]: HAND_CATEGORIES.CONTENT,
  [HAND_IDS.SLIDESHOW]: HAND_CATEGORIES.CONTENT,
  [HAND_IDS.SPEECH]: HAND_CATEGORIES.CONTENT,
  [HAND_IDS.QUIZ]: HAND_CATEGORIES.PRODUCTIVITY,
  [HAND_IDS.WHITEBOARD]: HAND_CATEGORIES.PRODUCTIVITY,
};
 
// === Helper Functions ===
 
/**
 * Get the category for a Hand ID
 */
export function getHandCategory(handId: string): HandCategoryType {
  return HAND_CATEGORY_MAP[handId] || HAND_CATEGORIES.PRODUCTIVITY;
}
 
/**
 * Check if a Hand ID is valid
 */
export function isValidHandId(id: string): id is HandIdType {
  return Object.values(HAND_IDS).includes(id as HandIdType);
}
 
/**
 * Get all Hand IDs as an array
 */
export function getAllHandIds(): string[] {
  return Object.values(HAND_IDS);
}