@shaykec/shared

v0.1.9

Published

Shared protocol definitions and constants for Socrates

Readme

@shaykec/shared

npm version

Zero-dependency package containing shared protocol definitions and constants used by all Socrates packages.

npm install @shaykec/shared

Exports

import { BELTS, TIERS, QUIZ_TYPES, XP_AWARDS } from '@shaykec/shared/constants';
import { MESSAGE_TYPES, createEnvelope } from '@shaykec/shared/protocol';

Constants (src/constants.js)

Belt Definitions

| Belt | Min XP | Badge | |------|--------|-------| | White | 0 | ⬜ | | Yellow | 50 |  | | Green | 150 |  | | Blue | 400 |  | | Purple | 800 |  | | Brown | 1500 |  | | Black | 3000+ | ⬛ |

Tier Enums

  • TIER_FULL (1) -- Extension + Canvas via WebSocket
  • TIER_CANVAS (2) -- Canvas only via SSE + REST
  • TIER_TERMINAL (3) -- CLI only, file-based

Quiz Types

drag-order, matching, fill-blank, timed-choice

XP Awards

Default XP values for quiz completions, walkthrough steps, code exercises, web captures, and daily streaks.

Other Constants

  • DEFAULT_PORT -- Bridge server port (3456)
  • HEARTBEAT_INTERVAL_MS -- WebSocket heartbeat (30s)
  • Celebration types, diagram formats, playground languages

Protocol (src/protocol.js)

Message type enums, event schemas, and the JSON envelope format used for all bridge communication.

See the root README for full documentation.