@mikesaintsg/core 0.0.5 → 0.0.6

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.
Files changed (2) hide show
  1. package/dist/index.d.ts +112 -0
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -3,6 +3,16 @@ export declare interface AbortableOptions {
3
3
  readonly signal?: AbortSignal;
4
4
  }
5
5
 
6
+ /** Activity metrics for a session */
7
+ export declare interface ActivityMetrics {
8
+ readonly activeTimeMs: number;
9
+ readonly idleTimeMs: number;
10
+ readonly awayTimeMs: number;
11
+ readonly interactionCount: number;
12
+ readonly lastInteractionAt: number;
13
+ readonly sessionStartedAt: number;
14
+ }
15
+
6
16
  /**
7
17
  * Activity tracker adapter interface.
8
18
  *
@@ -16,6 +26,12 @@ export declare interface ActivityTrackerInterface extends ActivityTrackerSubscri
16
26
  exitNode(): DwellRecord | undefined;
17
27
  /** Get current engagement state */
18
28
  getEngagementState(): EngagementState;
29
+ /** Get current visibility state */
30
+ getVisibilityState(): VisibilityState;
31
+ /** Get current focus state */
32
+ getFocusState(): FocusState;
33
+ /** Get activity metrics summary */
34
+ getMetrics(): ActivityMetrics;
19
35
  /** Get current node ID being tracked */
20
36
  getCurrentNodeId(): string | undefined;
21
37
  /** Get current incomplete dwell record */
@@ -26,6 +42,10 @@ export declare interface ActivityTrackerInterface extends ActivityTrackerSubscri
26
42
  getTotalActiveTime(): number;
27
43
  /** Get total idle time across all dwells */
28
44
  getTotalIdleTime(): number;
45
+ /** Record an interaction (resets idle timer) */
46
+ recordInteraction(): void;
47
+ /** Reset all tracking state */
48
+ reset(): void;
29
49
  /** Clear dwell history */
30
50
  clearHistory(): void;
31
51
  }
@@ -44,6 +64,12 @@ export declare interface ActivityTrackerOptions extends SubscriptionToHook<Activ
44
64
  export declare interface ActivityTrackerSubscriptions {
45
65
  /** Subscribe to engagement state changes */
46
66
  onEngagementChange(callback: (state: EngagementState, nodeId: string) => void): Unsubscribe;
67
+ /** Subscribe to visibility state changes */
68
+ onVisibilityChange(callback: (state: VisibilityState) => void): Unsubscribe;
69
+ /** Subscribe to focus state changes */
70
+ onFocusChange(callback: (state: FocusState) => void): Unsubscribe;
71
+ /** Subscribe to idle warnings before state changes to away */
72
+ onIdleWarning(callback: (idleTimeMs: number) => void): Unsubscribe;
47
73
  /** Subscribe to completed dwell records */
48
74
  onDwellComplete(callback: (record: DwellRecord) => void): Unsubscribe;
49
75
  }
@@ -284,6 +310,9 @@ export declare interface Destroyable {
284
310
  destroy(): void;
285
311
  }
286
312
 
313
+ /** Detected intent from user input */
314
+ export declare type DetectedIntent = 'search' | 'question' | 'action' | 'navigation' | 'unclear';
315
+
287
316
  /** Dwell record capturing time spent on a node */
288
317
  export declare interface DwellRecord {
289
318
  readonly nodeId: string;
@@ -466,6 +495,9 @@ export declare interface ExportedWeight {
466
495
  /** Generation finish reason */
467
496
  export declare type FinishReason = 'stop' | 'length' | 'tool_calls' | 'content_filter' | 'error';
468
497
 
498
+ /** Focus state for activity tracking */
499
+ export declare type FocusState = 'focused' | 'blurred';
500
+
469
501
  /** Default form dirty guard message */
470
502
  export declare const FORM_DIRTY_DEFAULT_MESSAGE = "You have unsaved changes. Are you sure you want to leave?";
471
503
 
@@ -567,6 +599,22 @@ export declare interface GenerationResult {
567
599
  readonly aborted: boolean;
568
600
  }
569
601
 
602
+ /** Intent detection result */
603
+ export declare interface IntentDetectionResult {
604
+ readonly original: string;
605
+ readonly intent: DetectedIntent;
606
+ readonly confidence: number;
607
+ readonly refinedPrompt: string;
608
+ readonly processingTimeMs: number;
609
+ readonly modelTier: ModelTier;
610
+ }
611
+
612
+ /** Intent detector interface */
613
+ export declare interface IntentDetectorInterface {
614
+ detect(input: string, options?: AbortableOptions): Promise<IntentDetectionResult>;
615
+ refine(input: string, intent: DetectedIntent, options?: AbortableOptions): Promise<string>;
616
+ }
617
+
570
618
  /**
571
619
  * Type guard for ecosystem errors.
572
620
  *
@@ -750,6 +798,46 @@ export declare interface MinimalStoreAccess<T> {
750
798
  clear(): Promise<void>;
751
799
  }
752
800
 
801
+ /** Model info for orchestration */
802
+ export declare interface ModelInfo {
803
+ readonly tier: ModelTier;
804
+ readonly modelId: string;
805
+ readonly state: ModelLoadingState;
806
+ readonly loadProgress?: number;
807
+ readonly sizeBytes?: number;
808
+ readonly loadedAt?: number;
809
+ }
810
+
811
+ /** Model loading state */
812
+ export declare type ModelLoadingState = 'idle' | 'loading' | 'ready' | 'error';
813
+
814
+ /** Model orchestrator interface */
815
+ export declare interface ModelOrchestratorInterface extends ModelOrchestratorSubscriptions, Destroyable {
816
+ getModelInfo(tier: ModelTier): ModelInfo | undefined;
817
+ isReady(tier: ModelTier): boolean;
818
+ getReadyTiers(): readonly ModelTier[];
819
+ getActiveTier(): ModelTier | undefined;
820
+ getBestAvailableTier(): ModelTier | undefined;
821
+ preload(tier: ModelTier): Promise<void>;
822
+ preloadAll(): Promise<void>;
823
+ estimateComplexity(prompt: string): number;
824
+ selectTier(complexity: number): ModelTier;
825
+ generate(prompt: string, options?: OrchestratorGenerateOptions): Promise<OrchestratorGenerateResult>;
826
+ }
827
+
828
+ /** Model orchestrator subscriptions */
829
+ export declare interface ModelOrchestratorSubscriptions {
830
+ onModelStateChange(callback: (tier: ModelTier, state: ModelLoadingState) => void): Unsubscribe;
831
+ onModelSwitch(callback: (from: ModelTier, to: ModelTier, reason: string) => void): Unsubscribe;
832
+ onLoadProgress(callback: (tier: ModelTier, progress: number) => void): Unsubscribe;
833
+ }
834
+
835
+ /** Model selection strategy */
836
+ export declare type ModelSelectionStrategy = 'auto' | 'local-only' | 'api-only' | 'local-first';
837
+
838
+ /** Model tier for progressive loading */
839
+ export declare type ModelTier = 'fast' | 'balanced' | 'powerful';
840
+
753
841
  /**
754
842
  * Navigation guard function type.
755
843
  * Returns true to allow navigation, false to block.
@@ -777,6 +865,27 @@ export declare interface Ok<T> {
777
865
  */
778
866
  export declare function ok<T>(value: T): Ok<T>;
779
867
 
868
+ /** Model orchestrator generate options */
869
+ export declare interface OrchestratorGenerateOptions extends AbortableOptions {
870
+ readonly forceTier?: ModelTier;
871
+ readonly system?: string;
872
+ readonly tools?: readonly ToolSchema[];
873
+ readonly maxTokens?: number;
874
+ readonly temperature?: number;
875
+ }
876
+
877
+ /** Model orchestrator generate result */
878
+ export declare interface OrchestratorGenerateResult {
879
+ readonly text: string;
880
+ readonly tier: ModelTier;
881
+ readonly modelId: string;
882
+ readonly latencyMs: number;
883
+ readonly tokenCount?: number;
884
+ readonly toolCalls?: readonly ToolCall[];
885
+ readonly escalated?: boolean;
886
+ readonly escalationReason?: string;
887
+ }
888
+
780
889
  /**
781
890
  * Generic error data interface for package-specific errors.
782
891
  * Packages extend this to define their error structure.
@@ -1488,6 +1597,9 @@ export declare interface VectorStoreSearchOptions<TMetadata = unknown> {
1488
1597
  readonly filter?: TMetadata;
1489
1598
  }
1490
1599
 
1600
+ /** Visibility state for activity tracking */
1601
+ export declare type VisibilityState = 'visible' | 'hidden' | 'prerender';
1602
+
1491
1603
  /**
1492
1604
  * Weight persistence adapter interface.
1493
1605
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikesaintsg/core",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "type": "module",
5
5
  "description": "Shared types, contracts, and bridge functions for the @mikesaintsg ecosystem. Zero runtime dependencies.",
6
6
  "keywords": [