@semiont/core 0.2.34-build.90 → 0.2.34-build.92

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/dist/index.d.ts CHANGED
@@ -1157,7 +1157,7 @@ interface paths {
1157
1157
  patch?: never;
1158
1158
  trace?: never;
1159
1159
  };
1160
- "/resources/{id}/detect-annotations-stream": {
1160
+ "/resources/{id}/annotate-references-stream": {
1161
1161
  parameters: {
1162
1162
  query?: never;
1163
1163
  header?: never;
@@ -1167,8 +1167,8 @@ interface paths {
1167
1167
  get?: never;
1168
1168
  put?: never;
1169
1169
  /**
1170
- * Detect Annotations with Progress (SSE)
1171
- * @description Stream real-time entity detection progress via Server-Sent Events
1170
+ * Annotate References with Progress (SSE)
1171
+ * @description Stream real-time reference annotation progress via Server-Sent Events
1172
1172
  */
1173
1173
  post: {
1174
1174
  parameters: {
@@ -1181,7 +1181,7 @@ interface paths {
1181
1181
  };
1182
1182
  requestBody?: {
1183
1183
  content: {
1184
- "application/json": components["schemas"]["DetectReferencesStreamRequest"];
1184
+ "application/json": components["schemas"]["AnnotateReferencesStreamRequest"];
1185
1185
  };
1186
1186
  };
1187
1187
  responses: {
@@ -1216,7 +1216,7 @@ interface paths {
1216
1216
  patch?: never;
1217
1217
  trace?: never;
1218
1218
  };
1219
- "/resources/{id}/detect-highlights-stream": {
1219
+ "/resources/{id}/annotate-highlights-stream": {
1220
1220
  parameters: {
1221
1221
  query?: never;
1222
1222
  header?: never;
@@ -1226,8 +1226,8 @@ interface paths {
1226
1226
  get?: never;
1227
1227
  put?: never;
1228
1228
  /**
1229
- * Detect Highlights with Progress (SSE)
1230
- * @description Stream real-time highlight detection progress via Server-Sent Events
1229
+ * Annotate Highlights with Progress (SSE)
1230
+ * @description Stream real-time highlight annotation progress via Server-Sent Events
1231
1231
  */
1232
1232
  post: {
1233
1233
  parameters: {
@@ -1240,7 +1240,7 @@ interface paths {
1240
1240
  };
1241
1241
  requestBody?: {
1242
1242
  content: {
1243
- "application/json": components["schemas"]["DetectHighlightsStreamRequest"];
1243
+ "application/json": components["schemas"]["AnnotateHighlightsStreamRequest"];
1244
1244
  };
1245
1245
  };
1246
1246
  responses: {
@@ -1275,7 +1275,7 @@ interface paths {
1275
1275
  patch?: never;
1276
1276
  trace?: never;
1277
1277
  };
1278
- "/resources/{id}/detect-assessments-stream": {
1278
+ "/resources/{id}/annotate-assessments-stream": {
1279
1279
  parameters: {
1280
1280
  query?: never;
1281
1281
  header?: never;
@@ -1285,8 +1285,8 @@ interface paths {
1285
1285
  get?: never;
1286
1286
  put?: never;
1287
1287
  /**
1288
- * Detect Assessments with Progress (SSE)
1289
- * @description Stream real-time assessment detection progress via Server-Sent Events
1288
+ * Annotate Assessments with Progress (SSE)
1289
+ * @description Stream real-time assessment annotation progress via Server-Sent Events
1290
1290
  */
1291
1291
  post: {
1292
1292
  parameters: {
@@ -1299,7 +1299,7 @@ interface paths {
1299
1299
  };
1300
1300
  requestBody?: {
1301
1301
  content: {
1302
- "application/json": components["schemas"]["DetectAssessmentsStreamRequest"];
1302
+ "application/json": components["schemas"]["AnnotateAssessmentsStreamRequest"];
1303
1303
  };
1304
1304
  };
1305
1305
  responses: {
@@ -1334,7 +1334,7 @@ interface paths {
1334
1334
  patch?: never;
1335
1335
  trace?: never;
1336
1336
  };
1337
- "/resources/{id}/detect-comments-stream": {
1337
+ "/resources/{id}/annotate-comments-stream": {
1338
1338
  parameters: {
1339
1339
  query?: never;
1340
1340
  header?: never;
@@ -1344,8 +1344,8 @@ interface paths {
1344
1344
  get?: never;
1345
1345
  put?: never;
1346
1346
  /**
1347
- * Detect Comments with Progress (SSE)
1348
- * @description Stream real-time comment detection progress via Server-Sent Events
1347
+ * Annotate Comments with Progress (SSE)
1348
+ * @description Stream real-time comment annotation progress via Server-Sent Events
1349
1349
  */
1350
1350
  post: {
1351
1351
  parameters: {
@@ -1358,7 +1358,7 @@ interface paths {
1358
1358
  };
1359
1359
  requestBody?: {
1360
1360
  content: {
1361
- "application/json": components["schemas"]["DetectCommentsStreamRequest"];
1361
+ "application/json": components["schemas"]["AnnotateCommentsStreamRequest"];
1362
1362
  };
1363
1363
  };
1364
1364
  responses: {
@@ -1393,7 +1393,7 @@ interface paths {
1393
1393
  patch?: never;
1394
1394
  trace?: never;
1395
1395
  };
1396
- "/resources/{id}/detect-tags-stream": {
1396
+ "/resources/{id}/annotate-tags-stream": {
1397
1397
  parameters: {
1398
1398
  query?: never;
1399
1399
  header?: never;
@@ -1403,8 +1403,8 @@ interface paths {
1403
1403
  get?: never;
1404
1404
  put?: never;
1405
1405
  /**
1406
- * Detect Tags with Progress (SSE)
1407
- * @description Stream real-time tag detection progress via Server-Sent Events. Identifies passages serving specific structural roles (IRAC, IMRAD, Toulmin frameworks).
1406
+ * Annotate Tags with Progress (SSE)
1407
+ * @description Stream real-time tag annotation progress via Server-Sent Events. Identifies passages serving specific structural roles (IRAC, IMRAD, Toulmin frameworks).
1408
1408
  */
1409
1409
  post: {
1410
1410
  parameters: {
@@ -1417,7 +1417,7 @@ interface paths {
1417
1417
  };
1418
1418
  requestBody?: {
1419
1419
  content: {
1420
- "application/json": components["schemas"]["DetectTagsStreamRequest"];
1420
+ "application/json": components["schemas"]["AnnotateTagsStreamRequest"];
1421
1421
  };
1422
1422
  };
1423
1423
  responses: {
@@ -2440,7 +2440,7 @@ interface components {
2440
2440
  /** @enum {string} */
2441
2441
  status: "pending" | "running" | "complete" | "failed" | "cancelled";
2442
2442
  /** @enum {string} */
2443
- type: "detection" | "generation";
2443
+ type: "reference-annotation" | "generation";
2444
2444
  created: string;
2445
2445
  };
2446
2446
  AuthResponse: {
@@ -2547,7 +2547,7 @@ interface components {
2547
2547
  CreateJobResponse: {
2548
2548
  jobId: string;
2549
2549
  /** @enum {string} */
2550
- type: "detection" | "generation";
2550
+ type: "reference-annotation" | "generation";
2551
2551
  /** @enum {string} */
2552
2552
  status: "pending" | "running" | "complete" | "failed" | "cancelled";
2553
2553
  created: string;
@@ -2613,20 +2613,20 @@ interface components {
2613
2613
  success: boolean;
2614
2614
  message: string;
2615
2615
  };
2616
- DetectReferencesStreamRequest: {
2617
- /** @description Entity types to detect (e.g., 'Person', 'Organization', 'Location') */
2616
+ AnnotateReferencesStreamRequest: {
2617
+ /** @description Entity types to annotate (e.g., 'Person', 'Organization', 'Location') */
2618
2618
  entityTypes: string[];
2619
2619
  /** @description Include anaphoric/cataphoric references (e.g., 'the CEO', 'the tech giant') in addition to direct mentions */
2620
2620
  includeDescriptiveReferences?: boolean;
2621
2621
  };
2622
- DetectHighlightsStreamRequest: {
2623
- /** @description Optional instructions to guide AI highlight detection */
2622
+ AnnotateHighlightsStreamRequest: {
2623
+ /** @description Optional instructions to guide AI highlight annotation */
2624
2624
  instructions?: string;
2625
2625
  /** @description Optional density: desired number of highlights per 2000 words of text (1-15) */
2626
2626
  density?: number;
2627
2627
  };
2628
- DetectAssessmentsStreamRequest: {
2629
- /** @description Optional instructions to guide AI assessment detection */
2628
+ AnnotateAssessmentsStreamRequest: {
2629
+ /** @description Optional instructions to guide AI assessment annotation */
2630
2630
  instructions?: string;
2631
2631
  /**
2632
2632
  * @description Optional tone/style for generated assessments
@@ -2636,8 +2636,8 @@ interface components {
2636
2636
  /** @description Optional density: desired number of assessments per 2000 words of text (1-10) */
2637
2637
  density?: number;
2638
2638
  };
2639
- DetectCommentsStreamRequest: {
2640
- /** @description Optional instructions to guide AI comment detection */
2639
+ AnnotateCommentsStreamRequest: {
2640
+ /** @description Optional instructions to guide AI comment annotation */
2641
2641
  instructions?: string;
2642
2642
  /**
2643
2643
  * @description Optional tone/style for generated comments
@@ -2647,10 +2647,10 @@ interface components {
2647
2647
  /** @description Optional density: desired number of comments per 2000 words of text (2-12) */
2648
2648
  density?: number;
2649
2649
  };
2650
- DetectTagsStreamRequest: {
2650
+ AnnotateTagsStreamRequest: {
2651
2651
  /** @description Tag schema ID (e.g., 'legal-irac', 'scientific-imrad', 'argument-toulmin') */
2652
2652
  schemaId: string;
2653
- /** @description Categories to detect from the selected schema (e.g., ['Issue', 'Rule', 'Application', 'Conclusion']) */
2653
+ /** @description Categories to annotate from the selected schema (e.g., ['Issue', 'Rule', 'Application', 'Conclusion']) */
2654
2654
  categories: string[];
2655
2655
  };
2656
2656
  ErrorResponse: {
@@ -2835,7 +2835,7 @@ interface components {
2835
2835
  JobStatusResponse: {
2836
2836
  jobId: string;
2837
2837
  /** @enum {string} */
2838
- type: "detection" | "generation" | "highlight-detection" | "assessment-detection" | "comment-detection" | "tag-detection";
2838
+ type: "reference-annotation" | "generation" | "highlight-annotation" | "assessment-annotation" | "comment-annotation" | "tag-annotation";
2839
2839
  /** @enum {string} */
2840
2840
  status: "pending" | "running" | "complete" | "failed" | "cancelled";
2841
2841
  userId: string;
@@ -3550,7 +3550,7 @@ interface JobStartedEvent extends BaseEvent {
3550
3550
  resourceId: ResourceId;
3551
3551
  payload: {
3552
3552
  jobId: JobId;
3553
- jobType: 'detection' | 'generation' | 'highlight-detection' | 'assessment-detection' | 'comment-detection' | 'tag-detection';
3553
+ jobType: 'reference-annotation' | 'generation' | 'highlight-annotation' | 'assessment-annotation' | 'comment-annotation' | 'tag-annotation';
3554
3554
  totalSteps?: number;
3555
3555
  };
3556
3556
  }
@@ -3559,7 +3559,7 @@ interface JobProgressEvent extends BaseEvent {
3559
3559
  resourceId: ResourceId;
3560
3560
  payload: {
3561
3561
  jobId: JobId;
3562
- jobType: 'detection' | 'generation' | 'highlight-detection' | 'assessment-detection' | 'comment-detection' | 'tag-detection';
3562
+ jobType: 'reference-annotation' | 'generation' | 'highlight-annotation' | 'assessment-annotation' | 'comment-annotation' | 'tag-annotation';
3563
3563
  percentage: number;
3564
3564
  currentStep?: string;
3565
3565
  processedSteps?: number;
@@ -3574,7 +3574,7 @@ interface JobCompletedEvent extends BaseEvent {
3574
3574
  resourceId: ResourceId;
3575
3575
  payload: {
3576
3576
  jobId: JobId;
3577
- jobType: 'detection' | 'generation' | 'highlight-detection' | 'assessment-detection' | 'comment-detection' | 'tag-detection';
3577
+ jobType: 'reference-annotation' | 'generation' | 'highlight-annotation' | 'assessment-annotation' | 'comment-annotation' | 'tag-annotation';
3578
3578
  totalSteps?: number;
3579
3579
  foundCount?: number;
3580
3580
  resultResourceId?: ResourceId;
@@ -3588,7 +3588,7 @@ interface JobFailedEvent extends BaseEvent {
3588
3588
  resourceId: ResourceId;
3589
3589
  payload: {
3590
3590
  jobId: JobId;
3591
- jobType: 'detection' | 'generation' | 'highlight-detection' | 'assessment-detection' | 'comment-detection' | 'tag-detection';
3591
+ jobType: 'reference-annotation' | 'generation' | 'highlight-annotation' | 'assessment-annotation' | 'comment-annotation' | 'tag-annotation';
3592
3592
  error: string;
3593
3593
  details?: string;
3594
3594
  };
@@ -3691,21 +3691,17 @@ declare function isResourceEvent(event: any): event is StoredEvent;
3691
3691
  /**
3692
3692
  * Event Protocol Types
3693
3693
  *
3694
- * Unified event map for all application events.
3695
- * This is the single source of truth for event types across backend, frontend, and CLI.
3696
- *
3697
- * Consolidates events from:
3698
- * - Backend events (SSE streams, job progress, resource operations)
3699
- * - User interaction events (selection, annotation hover/click, panels, toolbar)
3700
- * - Navigation events (sidebar, routing, links)
3701
- * - Settings events (theme, line numbers, locale)
3702
- * - API operation events (CRUD, detection, generation)
3694
+ * Type definitions for the application's event-driven architecture.
3695
+ * Single source of truth for all EventBus event types.
3703
3696
  */
3704
3697
 
3705
3698
  type Selector = components['schemas']['TextPositionSelector'] | components['schemas']['TextQuoteSelector'] | components['schemas']['SvgSelector'] | components['schemas']['FragmentSelector'];
3706
3699
  type GenerationContext = components['schemas']['GenerationContext'];
3707
3700
  type Annotation$2 = components['schemas']['Annotation'];
3708
3701
  type Motivation = components['schemas']['Motivation'];
3702
+ /**
3703
+ * Progress state for resource generation workflow
3704
+ */
3709
3705
  interface GenerationProgress {
3710
3706
  status: 'started' | 'fetching' | 'generating' | 'creating' | 'complete' | 'error';
3711
3707
  referenceId: string;
@@ -3729,19 +3725,18 @@ interface SelectionData {
3729
3725
  suffix?: string;
3730
3726
  }
3731
3727
  /**
3732
- * Common detection progress fields shared across all motivation types.
3728
+ * Progress state for annotation workflows (manual and assisted)
3733
3729
  *
3734
- * The five motivations have different SSE progress shapes
3735
- * (ReferenceDetectionProgress uses entity-type steps; the others use percentage).
3736
- * This type captures the subset of fields used by the detection UI
3737
- * (DetectionProgressWidget, useDetectionFlow).
3730
+ * Unified progress interface supporting different annotation strategies:
3731
+ * - Reference annotation: entity-type steps
3732
+ * - Other motivations: percentage-based progress
3738
3733
  */
3739
- interface DetectionProgress {
3734
+ interface AnnotationProgress {
3740
3735
  status: string;
3741
3736
  message?: string;
3742
- /** Reference detection: currently scanning entity type */
3737
+ /** Reference annotation: currently scanning entity type */
3743
3738
  currentEntityType?: string;
3744
- /** Reference detection: completed entity types with counts (frontend-only) */
3739
+ /** Reference annotation: completed entity types with counts (frontend-only) */
3745
3740
  completedEntityTypes?: Array<{
3746
3741
  entityType: string;
3747
3742
  foundCount: number;
@@ -3760,150 +3755,131 @@ interface DetectionProgress {
3760
3755
  }
3761
3756
  /**
3762
3757
  * Unified event map for all application events
3758
+ *
3759
+ * Organized by workflow ("flows"):
3760
+ * 1. Attention Flow - Annotation hover/focus/sparkle coordination
3761
+ * 2. Annotation Flow - Manual + AI-assisted annotation (all motivations)
3762
+ * 3. Context Retrieval Flow - LLM context fetching from annotations
3763
+ * 4. Generation Flow - Resource generation from references
3764
+ * 5. Resolution Flow - Reference linking/resolution (search modal)
3765
+ *
3766
+ * Plus infrastructure events (domain events, SSE, resource operations, navigation, settings)
3763
3767
  */
3764
3768
  type EventMap = {
3765
3769
  'make-meaning:event': ResourceEvent;
3766
- 'detection:started': Extract<ResourceEvent, {
3767
- type: 'job.started';
3768
- }>;
3769
- 'detection:entity-found': Extract<ResourceEvent, {
3770
- type: 'annotation.added';
3771
- }>;
3772
- 'detection:completed': Extract<ResourceEvent, {
3773
- type: 'job.completed';
3774
- }>;
3775
- 'detection:failed': Extract<ResourceEvent, {
3776
- type: 'job.failed';
3777
- }>;
3778
- 'detection:progress': DetectionProgress;
3779
- 'annotation:added': Extract<ResourceEvent, {
3780
- type: 'annotation.added';
3781
- }>;
3782
- 'annotation:removed': Extract<ResourceEvent, {
3783
- type: 'annotation.removed';
3784
- }>;
3785
- 'annotation:updated': Extract<ResourceEvent, {
3786
- type: 'annotation.body.updated';
3787
- }>;
3788
- 'entity-tag:added': Extract<ResourceEvent, {
3789
- type: 'entitytag.added';
3790
- }>;
3791
- 'entity-tag:removed': Extract<ResourceEvent, {
3792
- type: 'entitytag.removed';
3793
- }>;
3794
- 'resource:archived': Extract<ResourceEvent, {
3795
- type: 'resource.archived';
3796
- }>;
3797
- 'resource:unarchived': Extract<ResourceEvent, {
3798
- type: 'resource.unarchived';
3799
- }>;
3800
- 'job:queued': {
3801
- jobId: string;
3802
- jobType: string;
3803
- resourceId: string;
3804
- };
3805
- 'selection:comment-requested': SelectionData;
3806
- 'selection:tag-requested': SelectionData;
3807
- 'selection:assessment-requested': SelectionData;
3808
- 'selection:reference-requested': SelectionData;
3809
- 'annotation:requested': {
3810
- selector: Selector | Selector[];
3811
- motivation: Motivation;
3812
- };
3813
- 'annotation:cancel-pending': void;
3814
- 'annotation:hover': {
3770
+ 'attend:hover': {
3815
3771
  annotationId: string | null;
3816
3772
  };
3817
- 'annotation:click': {
3773
+ 'attend:click': {
3818
3774
  annotationId: string;
3819
3775
  motivation: Motivation;
3820
3776
  };
3821
- 'annotation:focus': {
3777
+ 'attend:focus': {
3822
3778
  annotationId: string | null;
3823
3779
  };
3824
- 'annotation:sparkle': {
3780
+ 'attend:sparkle': {
3825
3781
  annotationId: string;
3826
3782
  };
3827
- 'panel:toggle': {
3783
+ 'attend:panel-toggle': {
3828
3784
  panel: string;
3829
3785
  };
3830
- 'panel:open': {
3786
+ 'attend:panel-open': {
3831
3787
  panel: string;
3832
3788
  scrollToAnnotationId?: string;
3833
3789
  motivation?: string;
3834
3790
  };
3835
- 'panel:close': void;
3836
- 'view:mode-toggled': void;
3837
- 'toolbar:selection-changed': {
3838
- motivation: string | null;
3839
- };
3840
- 'toolbar:click-changed': {
3841
- action: string;
3842
- };
3843
- 'toolbar:shape-changed': {
3844
- shape: string;
3845
- };
3846
- 'navigation:sidebar-toggle': void;
3847
- 'navigation:resource-close': {
3848
- resourceId: string;
3849
- };
3850
- 'navigation:resource-reorder': {
3851
- oldIndex: number;
3852
- newIndex: number;
3853
- };
3854
- 'navigation:link-clicked': {
3855
- href: string;
3856
- label?: string;
3857
- };
3858
- 'navigation:router-push': {
3859
- path: string;
3860
- reason?: string;
3861
- };
3862
- 'navigation:external-navigate': {
3863
- url: string;
3864
- resourceId?: string;
3865
- cancelFallback: () => void;
3866
- };
3867
- 'navigation:reference-navigate': {
3868
- documentId: string;
3869
- };
3870
- 'navigation:entity-type-clicked': {
3871
- entityType: string;
3872
- };
3873
- 'settings:theme-changed': {
3874
- theme: 'light' | 'dark' | 'system';
3875
- };
3876
- 'settings:line-numbers-toggled': void;
3877
- 'settings:locale-changed': {
3878
- locale: string;
3879
- };
3880
- 'resource:archive': void;
3881
- 'resource:unarchive': void;
3882
- 'resource:clone': void;
3883
- 'job:cancel-requested': {
3884
- jobType: 'detection' | 'generation';
3791
+ 'attend:panel-close': void;
3792
+ 'annotate:select-comment': SelectionData;
3793
+ 'annotate:select-tag': SelectionData;
3794
+ 'annotate:select-assessment': SelectionData;
3795
+ 'annotate:select-reference': SelectionData;
3796
+ 'annotate:requested': {
3797
+ selector: Selector | Selector[];
3798
+ motivation: Motivation;
3885
3799
  };
3886
- 'annotation:create': {
3800
+ 'annotate:cancel-pending': void;
3801
+ 'annotate:create': {
3887
3802
  motivation: Motivation;
3888
3803
  selector: Selector | Selector[];
3889
3804
  body: components['schemas']['AnnotationBody'][];
3890
3805
  };
3891
- 'annotation:created': {
3806
+ 'annotate:created': {
3892
3807
  annotation: Annotation$2;
3893
3808
  };
3894
- 'annotation:create-failed': {
3809
+ 'annotate:create-failed': {
3895
3810
  error: Error;
3896
3811
  };
3897
- 'annotation:delete': {
3812
+ 'annotate:delete': {
3898
3813
  annotationId: string;
3899
3814
  };
3900
- 'annotation:deleted': {
3815
+ 'annotate:deleted': {
3901
3816
  annotationId: string;
3902
3817
  };
3903
- 'annotation:delete-failed': {
3818
+ 'annotate:delete-failed': {
3904
3819
  error: Error;
3905
3820
  };
3906
- 'annotation:update-body': {
3821
+ 'annotate:assist-request': {
3822
+ motivation: Motivation;
3823
+ options: {
3824
+ instructions?: string;
3825
+ tone?: 'scholarly' | 'explanatory' | 'conversational' | 'technical' | 'analytical' | 'critical' | 'balanced' | 'constructive';
3826
+ density?: number;
3827
+ entityTypes?: string[];
3828
+ includeDescriptiveReferences?: boolean;
3829
+ schemaId?: string;
3830
+ categories?: string[];
3831
+ };
3832
+ };
3833
+ 'annotate:progress': AnnotationProgress;
3834
+ 'annotate:assist-finished': {
3835
+ motivation?: Motivation;
3836
+ resourceUri?: ResourceUri;
3837
+ progress?: AnnotationProgress;
3838
+ };
3839
+ 'annotate:assist-failed': Extract<ResourceEvent, {
3840
+ type: 'job.failed';
3841
+ }>;
3842
+ 'annotate:assist-cancelled': void;
3843
+ 'annotate:progress-dismiss': void;
3844
+ 'annotate:mode-toggled': void;
3845
+ 'annotate:selection-changed': {
3846
+ motivation: string | null;
3847
+ };
3848
+ 'annotate:click-changed': {
3849
+ action: string;
3850
+ };
3851
+ 'annotate:shape-changed': {
3852
+ shape: string;
3853
+ };
3854
+ 'annotate:added': Extract<ResourceEvent, {
3855
+ type: 'annotation.added';
3856
+ }>;
3857
+ 'annotate:removed': Extract<ResourceEvent, {
3858
+ type: 'annotation.removed';
3859
+ }>;
3860
+ 'annotate:body-updated': Extract<ResourceEvent, {
3861
+ type: 'annotation.body.updated';
3862
+ }>;
3863
+ 'annotate:entity-tag-added': Extract<ResourceEvent, {
3864
+ type: 'entitytag.added';
3865
+ }>;
3866
+ 'annotate:entity-tag-removed': Extract<ResourceEvent, {
3867
+ type: 'entitytag.removed';
3868
+ }>;
3869
+ 'resolve:create-manual': {
3870
+ annotationUri: string;
3871
+ title: string;
3872
+ entityTypes: string[];
3873
+ };
3874
+ 'resolve:link': {
3875
+ annotationUri: string;
3876
+ searchTerm: string;
3877
+ };
3878
+ 'resolve:search-requested': {
3879
+ referenceId: string;
3880
+ searchTerm: string;
3881
+ };
3882
+ 'resolve:update-body': {
3907
3883
  annotationUri: string;
3908
3884
  resourceId: string;
3909
3885
  operations: Array<{
@@ -3913,33 +3889,30 @@ type EventMap = {
3913
3889
  newItem?: components['schemas']['AnnotationBody'];
3914
3890
  }>;
3915
3891
  };
3916
- 'annotation:body-updated': {
3892
+ 'resolve:body-updated': {
3917
3893
  annotationUri: string;
3918
3894
  };
3919
- 'annotation:body-update-failed': {
3895
+ 'resolve:body-update-failed': {
3920
3896
  error: Error;
3921
3897
  };
3922
- 'detection:start': {
3923
- motivation: Motivation;
3924
- options: {
3925
- instructions?: string;
3926
- /** Comment tone */
3927
- tone?: 'scholarly' | 'explanatory' | 'conversational' | 'technical' | 'analytical' | 'critical' | 'balanced' | 'constructive';
3928
- density?: number;
3929
- entityTypes?: string[];
3930
- includeDescriptiveReferences?: boolean;
3931
- schemaId?: string;
3932
- categories?: string[];
3933
- };
3898
+ 'correlate:requested': {
3899
+ annotationUri: string;
3900
+ resourceUri: string;
3934
3901
  };
3935
- 'detection:complete': {
3936
- motivation?: Motivation;
3937
- resourceUri?: ResourceUri;
3938
- progress?: DetectionProgress;
3902
+ 'correlate:complete': {
3903
+ annotationUri: string;
3904
+ context: GenerationContext;
3905
+ };
3906
+ 'correlate:failed': {
3907
+ annotationUri: string;
3908
+ error: Error;
3939
3909
  };
3940
- 'detection:cancelled': void;
3941
- 'detection:dismiss-progress': void;
3942
- 'generation:start': {
3910
+ 'generate:modal-open': {
3911
+ annotationUri: string;
3912
+ resourceUri: string;
3913
+ defaultTitle: string;
3914
+ };
3915
+ 'generate:request': {
3943
3916
  annotationUri: string;
3944
3917
  resourceUri: string;
3945
3918
  options: {
@@ -3951,51 +3924,86 @@ type EventMap = {
3951
3924
  context: GenerationContext;
3952
3925
  };
3953
3926
  };
3954
- 'generation:started': Extract<ResourceEvent, {
3927
+ 'generate:progress': GenerationProgress;
3928
+ 'generate:finished': GenerationProgress;
3929
+ 'generate:failed': {
3930
+ error: Error;
3931
+ };
3932
+ 'generate:representation-added': Extract<ResourceEvent, {
3933
+ type: 'representation.added';
3934
+ }>;
3935
+ 'generate:representation-removed': Extract<ResourceEvent, {
3936
+ type: 'representation.removed';
3937
+ }>;
3938
+ 'generate:clone': void;
3939
+ 'resource:archive': void;
3940
+ 'resource:archived': Extract<ResourceEvent, {
3941
+ type: 'resource.archived';
3942
+ }>;
3943
+ 'resource:unarchive': void;
3944
+ 'resource:unarchived': Extract<ResourceEvent, {
3945
+ type: 'resource.unarchived';
3946
+ }>;
3947
+ 'job:started': Extract<ResourceEvent, {
3955
3948
  type: 'job.started';
3956
3949
  }>;
3957
- 'generation:progress': GenerationProgress;
3958
- 'generation:completed': Extract<ResourceEvent, {
3950
+ 'job:completed': Extract<ResourceEvent, {
3959
3951
  type: 'job.completed';
3960
3952
  }>;
3961
- 'generation:complete': {
3962
- annotationUri: string;
3963
- progress: GenerationProgress;
3953
+ 'job:failed': Extract<ResourceEvent, {
3954
+ type: 'job.failed';
3955
+ }>;
3956
+ 'job:queued': {
3957
+ jobId: string;
3958
+ jobType: string;
3959
+ resourceId: string;
3964
3960
  };
3965
- 'generation:failed': {
3966
- error: Error;
3961
+ 'job:cancel-requested': {
3962
+ jobType: 'annotation' | 'generation';
3967
3963
  };
3968
- 'generation:modal-open': {
3969
- annotationUri: string;
3970
- resourceUri: string;
3971
- defaultTitle: string;
3964
+ 'navigation:sidebar-toggle': void;
3965
+ 'navigation:resource-close': {
3966
+ resourceId: string;
3972
3967
  };
3973
- 'reference:create-manual': {
3974
- annotationUri: string;
3975
- title: string;
3976
- entityTypes: string[];
3968
+ 'navigation:resource-reorder': {
3969
+ oldIndex: number;
3970
+ newIndex: number;
3977
3971
  };
3978
- 'reference:link': {
3979
- annotationUri: string;
3980
- searchTerm: string;
3972
+ 'navigation:link-clicked': {
3973
+ href: string;
3974
+ label?: string;
3981
3975
  };
3982
- 'resolution:search-requested': {
3983
- referenceId: string;
3984
- searchTerm: string;
3976
+ 'navigation:router-push': {
3977
+ path: string;
3978
+ reason?: string;
3985
3979
  };
3986
- 'context:retrieval-requested': {
3987
- annotationUri: string;
3988
- resourceUri: string;
3980
+ 'navigation:external-navigate': {
3981
+ url: string;
3982
+ resourceId?: string;
3983
+ cancelFallback: () => void;
3989
3984
  };
3990
- 'context:retrieval-complete': {
3991
- annotationUri: string;
3992
- context: GenerationContext;
3985
+ 'navigation:reference-navigate': {
3986
+ documentId: string;
3993
3987
  };
3994
- 'context:retrieval-failed': {
3995
- annotationUri: string;
3996
- error: Error;
3988
+ 'navigation:entity-type-clicked': {
3989
+ entityType: string;
3990
+ };
3991
+ 'settings:theme-changed': {
3992
+ theme: 'light' | 'dark' | 'system';
3993
+ };
3994
+ 'settings:line-numbers-toggled': void;
3995
+ 'settings:locale-changed': {
3996
+ locale: string;
3997
+ };
3998
+ 'settings:hover-delay-changed': {
3999
+ hoverDelayMs: number;
3997
4000
  };
3998
4001
  };
4002
+ /**
4003
+ * Union type of all valid event names
4004
+ * Use this to enforce compile-time checking of event names
4005
+ */
4006
+ type EventName = keyof EventMap;
3999
4007
 
4000
4008
  /**
4001
4009
  * RxJS-based Event Bus
@@ -4016,16 +4024,16 @@ type EventMap = {
4016
4024
  * const eventBus = new EventBus();
4017
4025
  *
4018
4026
  * // Emit events
4019
- * eventBus.get('annotation:hover').next({ annotationId: 'ann-1' });
4027
+ * eventBus.get('attend:hover').next({ annotationId: 'ann-1' });
4020
4028
  *
4021
4029
  * // Subscribe to events
4022
- * const subscription = eventBus.get('annotation:hover').subscribe(({ annotationId }) => {
4030
+ * const subscription = eventBus.get('attend:hover').subscribe(({ annotationId }) => {
4023
4031
  * console.log('Hover:', annotationId);
4024
4032
  * });
4025
4033
  *
4026
4034
  * // Use RxJS operators
4027
4035
  * import { debounceTime } from 'rxjs/operators';
4028
- * eventBus.get('annotation:hover')
4036
+ * eventBus.get('attend:hover')
4029
4037
  * .pipe(debounceTime(100))
4030
4038
  * .subscribe(handleHover);
4031
4039
  *
@@ -4050,13 +4058,13 @@ declare class EventBus {
4050
4058
  * @example
4051
4059
  * ```typescript
4052
4060
  * // Emit
4053
- * eventBus.get('annotation:hover').next({ annotationId: 'ann-1' });
4061
+ * eventBus.get('attend:hover').next({ annotationId: 'ann-1' });
4054
4062
  *
4055
4063
  * // Subscribe
4056
- * const sub = eventBus.get('annotation:hover').subscribe(handleHover);
4064
+ * const sub = eventBus.get('attend:hover').subscribe(handleHover);
4057
4065
  *
4058
4066
  * // With operators
4059
- * eventBus.get('annotation:hover')
4067
+ * eventBus.get('attend:hover')
4060
4068
  * .pipe(debounceTime(100), distinctUntilChanged())
4061
4069
  * .subscribe(handleHover);
4062
4070
  * ```
@@ -4125,6 +4133,32 @@ declare class ScopedEventBus {
4125
4133
  scope(subScope: string): ScopedEventBus;
4126
4134
  }
4127
4135
 
4136
+ /**
4137
+ * Logger interface for observability
4138
+ *
4139
+ * This interface is intentionally framework-agnostic to work with any logger
4140
+ * (winston, pino, bunyan, or simple console).
4141
+ *
4142
+ * Example usage:
4143
+ * ```typescript
4144
+ * import winston from 'winston';
4145
+ *
4146
+ * const logger = winston.createLogger({
4147
+ * level: 'debug',
4148
+ * transports: [new winston.transports.Console()]
4149
+ * });
4150
+ *
4151
+ * const service = new MyService(logger);
4152
+ * ```
4153
+ */
4154
+ interface Logger {
4155
+ debug(message: string, meta?: any): void;
4156
+ info(message: string, meta?: any): void;
4157
+ warn(message: string, meta?: any): void;
4158
+ error(message: string, meta?: any): void;
4159
+ child(meta: Record<string, any>): Logger;
4160
+ }
4161
+
4128
4162
  /**
4129
4163
  * Backend-specific annotation utility functions
4130
4164
  */
@@ -5167,4 +5201,4 @@ declare class ConfigurationError extends Error {
5167
5201
  declare const CORE_TYPES_VERSION = "0.1.0";
5168
5202
  declare const SDK_VERSION = "0.1.0";
5169
5203
 
5170
- export { APIError, type AWSConfig, type AccessToken, type AnnotationAddedEvent, type AnnotationBodyUpdatedEvent, type AnnotationCategory, type AnnotationId, type AnnotationRemovedEvent, type AnnotationUri, type AppConfig, type AuthCode, type BackendServiceConfig, type BaseEvent, type BaseUrl, type BodyItem, type BodyOperation, CORE_TYPES_VERSION, CREATION_METHODS, type CloneToken, type ConfigFileReader, ConfigurationError, ConflictError, type ContentFormat$1 as ContentFormat, type CreateAnnotationInternal, type CreationMethod, type DatabaseServiceConfig, type DetectionProgress, type Email, type EntityTagAddedEvent, type EntityTagRemovedEvent, type EntityType, type EntityTypeStats, type Environment, type EnvironmentConfig, EventBus, type EventMap, type EventMetadata, type EventQuery, type EventSignature, type FilesystemServiceConfig, type FrontendServiceConfig, type GenerationContext, type GenerationProgress, type GoogleAuthRequest, type GoogleCredential, type GraphConnection, type GraphDatabaseType, type GraphPath, type GraphServiceConfig, type InferenceServiceConfig, type JobCompletedEvent, type JobFailedEvent, type JobId, type JobProgressEvent, type JobStartedEvent, type MCPToken, type McpServiceConfig, type Motivation$2 as Motivation, NotFoundError, type PlatformType, type ProxyServiceConfig, type RefreshToken, type RepresentationAddedEvent, type RepresentationRemovedEvent, type ResourceAnnotationUri, type ResourceAnnotations, type ResourceArchivedEvent, type ResourceClonedEvent, type ResourceCreatedEvent, type ResourceEvent, type ResourceEventType, type ResourceFilter, type ResourceId, type ResourceScopedEvent, type ResourceUnarchivedEvent, type ResourceUri, SDK_VERSION, ScopedEventBus, ScriptError, type SearchQuery, type SelectionData, type Selector, type SemiontConfig, SemiontError, type ServiceConfig, type ServicePlatformConfig, type ServicesConfig, type SiteConfig, type StoredEvent, type SystemEvent, UnauthorizedError, type UpdateResourceInput, type UserDID, type UserId, ValidationError, type ValidationResult, accessToken, annotationId, annotationIdToURI, annotationUri, authCode, baseUrl, cloneToken, type components, createConfigLoader, deepMerge, didToAgent, displayConfiguration, email, entityType, extractResourceUriFromAnnotationUri, findBodyItem, formatErrors, getAllPlatformTypes, getAnnotationUriFromEvent, getEventType, getNodeEnvForEnvironment, googleCredential, hasAWSConfig, isAnnotationId, isArray, isBoolean, isDefined, isEventRelatedToAnnotation, isFunction, isNull, isNullish, isNumber, isObject, isResourceEvent$1 as isResourceEvent, isResourceId, isResourceScopedEvent, isResourceEvent as isStoredEvent, isString, isSystemEvent, isUndefined, isValidPlatformType, jobId, listEnvironmentNames, mcpToken, type operations, parseAndMergeConfigs, parseEnvironment, type paths, refreshToken, resolveEnvVars, resourceAnnotationUri, resourceId, resourceIdToURI, resourceUri, searchQuery, uriToAnnotationId, uriToAnnotationIdOrPassthrough, uriToResourceId, userDID, userId, userToAgent, userToDid, validateEnvironment, validateEnvironmentConfig, validateSemiontConfig, validateSiteConfig };
5204
+ export { APIError, type AWSConfig, type AccessToken, type AnnotationAddedEvent, type AnnotationBodyUpdatedEvent, type AnnotationCategory, type AnnotationId, type AnnotationProgress, type AnnotationRemovedEvent, type AnnotationUri, type AppConfig, type AuthCode, type BackendServiceConfig, type BaseEvent, type BaseUrl, type BodyItem, type BodyOperation, CORE_TYPES_VERSION, CREATION_METHODS, type CloneToken, type ConfigFileReader, ConfigurationError, ConflictError, type ContentFormat$1 as ContentFormat, type CreateAnnotationInternal, type CreationMethod, type DatabaseServiceConfig, type Email, type EntityTagAddedEvent, type EntityTagRemovedEvent, type EntityType, type EntityTypeStats, type Environment, type EnvironmentConfig, EventBus, type EventMap, type EventMetadata, type EventName, type EventQuery, type EventSignature, type FilesystemServiceConfig, type FrontendServiceConfig, type GenerationContext, type GenerationProgress, type GoogleAuthRequest, type GoogleCredential, type GraphConnection, type GraphDatabaseType, type GraphPath, type GraphServiceConfig, type InferenceServiceConfig, type JobCompletedEvent, type JobFailedEvent, type JobId, type JobProgressEvent, type JobStartedEvent, type Logger, type MCPToken, type McpServiceConfig, type Motivation$2 as Motivation, NotFoundError, type PlatformType, type ProxyServiceConfig, type RefreshToken, type RepresentationAddedEvent, type RepresentationRemovedEvent, type ResourceAnnotationUri, type ResourceAnnotations, type ResourceArchivedEvent, type ResourceClonedEvent, type ResourceCreatedEvent, type ResourceEvent, type ResourceEventType, type ResourceFilter, type ResourceId, type ResourceScopedEvent, type ResourceUnarchivedEvent, type ResourceUri, SDK_VERSION, ScopedEventBus, ScriptError, type SearchQuery, type SelectionData, type Selector, type SemiontConfig, SemiontError, type ServiceConfig, type ServicePlatformConfig, type ServicesConfig, type SiteConfig, type StoredEvent, type SystemEvent, UnauthorizedError, type UpdateResourceInput, type UserDID, type UserId, ValidationError, type ValidationResult, accessToken, annotationId, annotationIdToURI, annotationUri, authCode, baseUrl, cloneToken, type components, createConfigLoader, deepMerge, didToAgent, displayConfiguration, email, entityType, extractResourceUriFromAnnotationUri, findBodyItem, formatErrors, getAllPlatformTypes, getAnnotationUriFromEvent, getEventType, getNodeEnvForEnvironment, googleCredential, hasAWSConfig, isAnnotationId, isArray, isBoolean, isDefined, isEventRelatedToAnnotation, isFunction, isNull, isNullish, isNumber, isObject, isResourceEvent$1 as isResourceEvent, isResourceId, isResourceScopedEvent, isResourceEvent as isStoredEvent, isString, isSystemEvent, isUndefined, isValidPlatformType, jobId, listEnvironmentNames, mcpToken, type operations, parseAndMergeConfigs, parseEnvironment, type paths, refreshToken, resolveEnvVars, resourceAnnotationUri, resourceId, resourceIdToURI, resourceUri, searchQuery, uriToAnnotationId, uriToAnnotationIdOrPassthrough, uriToResourceId, userDID, userId, userToAgent, userToDid, validateEnvironment, validateEnvironmentConfig, validateSemiontConfig, validateSiteConfig };