writetrack 0.8.0 → 0.9.1

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/README.md CHANGED
@@ -4,7 +4,7 @@ Detect AI-generated and pasted text through keystroke dynamics.
4
4
 
5
5
  WriteTrack analyzes _how_ text was entered, not what was written. Human typing has natural variation in timing, rhythm, and corrections. Pasted or AI-generated text arrives all at once with no behavioral fingerprint. WriteTrack captures the difference.
6
6
 
7
- - **~115KB** gzipped (17KB JS + 94KB WASM)
7
+ - **~118KB** gzipped (18KB JS + 100KB WASM)
8
8
  - **0** runtime dependencies
9
9
  - **<1ms** per keystroke
10
10
  - **100%** client-side
@@ -29,7 +29,7 @@ import { WriteTrack } from 'writetrack';
29
29
  const responseField = document.getElementById('response-field')!;
30
30
  const tracker = new WriteTrack({
31
31
  target: responseField,
32
- license: process.env.WRITETRACK_LICENSE_KEY, // omit for dev/demo mode
32
+ license: process.env.WRITETRACK_LICENSE_KEY, // omit for localhost evaluation
33
33
  });
34
34
 
35
35
  tracker.start();
@@ -107,40 +107,49 @@ new WriteTrack(options: WriteTrackOptions | HTMLElement)
107
107
  ```typescript
108
108
  interface WriteTrackOptions {
109
109
  target: HTMLElement;
110
- license?: string; // Omit for development/demo mode
110
+ license?: string; // Omit for localhost evaluation
111
111
  userId?: string; // Opaque user identifier, included in output metadata
112
112
  contentId?: string; // Opaque document identifier, included in output metadata
113
113
  metadata?: Record<string, unknown>; // Arbitrary metadata, included in output
114
114
  wasmUrl?: string; // Custom URL for the WASM analysis binary
115
115
  persist?: boolean; // Enable IndexedDB persistence (requires contentId)
116
116
  cursorPositionProvider?: () => number; // Custom cursor position for rich-text editors
117
+ inputSourceProvider?: () => InputSource | undefined; // Input source classification (set by editor integrations)
117
118
  }
118
119
  ```
119
120
 
120
121
  ### Methods
121
122
 
122
- | Method | Returns | Description |
123
- | ---------------------------------- | -------------------------------- | -------------------------------------- |
124
- | `start()` | `void` | Begin capturing events |
125
- | `stop()` | `void` | Stop capturing and clean up |
126
- | `getData()` | `WriteTrackDataSchema` | Export full session data |
127
- | `getText()` | `string` | Current text content |
128
- | `getRawEvents()` | `KeystrokeEvent[]` | All captured keystroke events |
129
- | `getClipboardEvents()` | `ClipboardEvent[]` | Paste/copy/cut events |
130
- | `getSelectionEvents()` | `SelectionEvent[]` | Text selection events |
131
- | `getUndoRedoEvents()` | `UndoRedoEvent[]` | Undo/redo events |
132
- | `getCompositionEvents()` | `CompositionEvent[]` | IME composition events |
133
- | `getProgrammaticInsertionEvents()` | `ProgrammaticInsertionEvent[]` | Programmatic insertion events |
134
- | `getSessionDuration()` | `number` | Session duration in ms |
135
- | `getKeystrokeCount()` | `number` | Total keystrokes captured |
136
- | `getAnalysis()` | `Promise<SessionAnalysis\|null>` | WASM-powered session analysis |
137
- | `getSessionReport()` | `Promise<SessionReport>` | Combined data + analysis |
138
- | `pipe(sink)` | `this` | Register an output sink |
139
- | `on(event, handler)` | `this` | Register an event listener |
140
- | `isLicenseValid()` | `boolean` | Whether license is valid |
141
- | `isLicenseValidated()` | `boolean` | Whether license check has completed |
142
- | `isTargetDetached()` | `boolean` | Whether the target element was removed |
143
- | `clearPersistedData()` | `Promise<void>` | Clear IndexedDB persisted session |
123
+ | Method | Returns | Description |
124
+ | ---------------------------------- | -------------------------------- | ------------------------------------------------- |
125
+ | `start()` | `void` | Begin capturing events |
126
+ | `stop()` | `void` | Stop capturing and clean up |
127
+ | `getData()` | `WriteTrackDataSchema` | Export full session data |
128
+ | `getText()` | `string` | Current text content |
129
+ | `getRawEvents()` | `KeystrokeEvent[]` | All captured keystroke events |
130
+ | `getClipboardEvents()` | `ClipboardEvent[]` | Paste/copy/cut events |
131
+ | `getSelectionEvents()` | `SelectionEvent[]` | Text selection events |
132
+ | `getUndoRedoEvents()` | `UndoRedoEvent[]` | Undo/redo events |
133
+ | `getCompositionEvents()` | `CompositionEvent[]` | IME composition events |
134
+ | `getProgrammaticInsertionEvents()` | `ProgrammaticInsertionEvent[]` | Programmatic insertion events |
135
+ | `getSessionDuration()` | `number` | Session duration in ms |
136
+ | `getActiveTime()` | `number` | Active (visible) session time in ms |
137
+ | `getKeystrokeCount()` | `number` | Total keystrokes captured |
138
+ | `getAnalysis()` | `Promise<SessionAnalysis\|null>` | WASM-powered session analysis |
139
+ | `getSessionReport()` | `Promise<SessionReport>` | Combined data + analysis |
140
+ | `pipe(sink)` | `this` | Register an output sink |
141
+ | `on(event, handler)` | `this` | Register an event listener (`tick`, `pipe:error`) |
142
+ | `isLicenseValid()` | `boolean` | Whether license is valid |
143
+ | `isLicenseValidated()` | `boolean` | Whether license check has completed |
144
+ | `isTargetDetached()` | `boolean` | Whether the target element was removed |
145
+ | `clearPersistedData()` | `Promise<void>` | Clear IndexedDB persisted session |
146
+
147
+ ### Static Methods
148
+
149
+ | Method | Returns | Description |
150
+ | ------------------------------------------------ | --------------------------------- | ---------------------------------------- |
151
+ | `WriteTrack.listPersistedSessions()` | `Promise<PersistedSessionInfo[]>` | List all persisted sessions in IndexedDB |
152
+ | `WriteTrack.deletePersistedSession(key, field?)` | `Promise<void>` | Delete persisted session data |
144
153
 
145
154
  ### Properties
146
155
 
@@ -168,7 +177,7 @@ Full type definitions are included in the package:
168
177
 
169
178
  **Functions:** `analyzeEvents`, `createSessionReport`, `formatIndicator`, `getHighResolutionTime`
170
179
 
171
- **Types:** `KeystrokeEvent`, `ClipboardEvent`, `SelectionEvent`, `UndoRedoEvent`, `CompositionEvent`, `ProgrammaticInsertionEvent`, `ModifierState`, `WriteTrackDataSchema`, `DataQualityMetrics`, `SessionMetadata`, `SessionAnalysis`, `SessionReport`, `IndicatorOutput`, `AnalyzeEventsOptions`, `WriteTrackSink`
180
+ **Types:** `WriteTrackOptions`, `PersistedSessionInfo`, `KeystrokeEvent`, `ClipboardEvent`, `SelectionEvent`, `UndoRedoEvent`, `CompositionEvent`, `ProgrammaticInsertionEvent`, `ModifierState`, `InputSource`, `WriteTrackDataSchema`, `DataQualityMetrics`, `SessionMetadata`, `SessionAnalysis`, `SessionReport`, `IndicatorOutput`, `ContentOriginAnalysis`, `TimingAuthenticityAnalysis`, `SessionContinuityAnalysis`, `PhysicalPlausibilityAnalysis`, `RevisionBehaviorAnalysis`, `TemporalPatternsAnalysis`, `AnalyzeEventsOptions`, `WriteTrackSink`, `WebhookOptions`, `DatadogOptions`, `DatadogClient`, `SegmentOptions`, `SegmentClient`, `OpenTelemetryOptions`, `OTelTracer`, `OTelSpan`
172
181
 
173
182
  ## Browser Support
174
183