@semiont/core 0.4.21 → 0.5.0

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
@@ -1,4 +1,4 @@
1
- import { Subject, OperatorFunction } from 'rxjs';
1
+ import { Subject, OperatorFunction, Observable } from 'rxjs';
2
2
  import { E as EnvironmentConfig, P as PlatformType$1 } from './config.types-oPv3Ajk-.js';
3
3
  export { A as AnthropicProviderConfig, a as AppConfig, B as BackendServiceConfig, D as DatabaseServiceConfig, b as EmbeddingServiceConfig, F as FrontendServiceConfig, G as GraphDatabaseType, c as GraphServiceConfig, I as InferenceProvidersConfig, M as McpServiceConfig, O as OllamaProviderConfig, S as SemiontConfig, d as ServicePlatformConfig, e as ServicesConfig, f as SiteConfig, V as VectorsServiceConfig } from './config.types-oPv3Ajk-.js';
4
4
 
@@ -200,7 +200,7 @@ interface paths {
200
200
  [name: string]: unknown;
201
201
  };
202
202
  content: {
203
- "application/json": components["schemas"]["GoogleAuthRequest"];
203
+ "application/json": components["schemas"]["TokenRefreshResponse"];
204
204
  };
205
205
  };
206
206
  /** @description Invalid or expired refresh token */
@@ -1664,52 +1664,7 @@ interface paths {
1664
1664
  delete?: never;
1665
1665
  options?: never;
1666
1666
  head?: never;
1667
- /**
1668
- * Update resource metadata
1669
- * @description Archive/unarchive or update entity types. Emits mark:archive / mark:unarchive / mark:update-entity-types on the bus; returns 202 immediately. Frontend reconciles state via SSE domain events.
1670
- */
1671
- patch: {
1672
- parameters: {
1673
- query?: never;
1674
- header?: never;
1675
- path: {
1676
- id: string;
1677
- };
1678
- cookie?: never;
1679
- };
1680
- requestBody: {
1681
- content: {
1682
- "application/json": components["schemas"]["UpdateResourceRequest"];
1683
- };
1684
- };
1685
- responses: {
1686
- /** @description Update accepted */
1687
- 202: {
1688
- headers: {
1689
- [name: string]: unknown;
1690
- };
1691
- content?: never;
1692
- };
1693
- /** @description Authentication required */
1694
- 401: {
1695
- headers: {
1696
- [name: string]: unknown;
1697
- };
1698
- content: {
1699
- "application/json": components["schemas"]["ErrorResponse"];
1700
- };
1701
- };
1702
- /** @description Resource not found */
1703
- 404: {
1704
- headers: {
1705
- [name: string]: unknown;
1706
- };
1707
- content: {
1708
- "application/json": components["schemas"]["ErrorResponse"];
1709
- };
1710
- };
1711
- };
1712
- };
1667
+ patch?: never;
1713
1668
  trace?: never;
1714
1669
  };
1715
1670
  "/api/resources/{id}": {
@@ -2040,14 +1995,6 @@ interface components {
2040
1995
  oldItem: components["schemas"]["TextualBody"] | components["schemas"]["SpecificResource"];
2041
1996
  newItem: components["schemas"]["TextualBody"] | components["schemas"]["SpecificResource"];
2042
1997
  };
2043
- BeckonResponse: {
2044
- /** @description Username or agent identifier that was beckoned */
2045
- participant: string;
2046
- /** @description Resource the attention was directed at */
2047
- resourceId: string;
2048
- /** @description Annotation the attention was directed at (if provided) */
2049
- annotationId?: string;
2050
- };
2051
1998
  CloneResourceWithTokenResponse: {
2052
1999
  /** @description Generated clone token */
2053
2000
  token: string;
@@ -2690,10 +2637,6 @@ interface components {
2690
2637
  /** @description Array of body modification operations to apply */
2691
2638
  operations: (components["schemas"]["BodyOperationAdd"] | components["schemas"]["BodyOperationRemove"] | components["schemas"]["BodyOperationReplace"])[];
2692
2639
  };
2693
- UpdateResourceRequest: {
2694
- entityTypes?: string[];
2695
- archived?: boolean;
2696
- };
2697
2640
  UpdateUserRequest: {
2698
2641
  isAdmin?: boolean;
2699
2642
  isActive?: boolean;
@@ -2764,14 +2707,14 @@ interface components {
2764
2707
  };
2765
2708
  /** @description Command payload sent on the bind:update-body bus channel to modify annotation bodies. */
2766
2709
  BindUpdateBodyCommand: {
2710
+ /** @description Authenticated user's DID, injected by the /bus/emit gateway. Clients do not set this. */
2711
+ _userId?: string;
2767
2712
  /** @description Client-supplied id used to match this command to its result event(s) on the events-stream. Generated by the route handler if absent. */
2768
2713
  correlationId: string;
2769
2714
  /** @description Branded AnnotationId of the annotation whose body is being updated */
2770
2715
  annotationId: string;
2771
2716
  /** @description Branded ResourceId of the resource the annotation belongs to */
2772
2717
  resourceId: string;
2773
- /** @description Branded UserId of the user performing the update */
2774
- userId?: string;
2775
2718
  /** @description List of body mutation operations to apply */
2776
2719
  operations: {
2777
2720
  /**
@@ -3126,8 +3069,9 @@ interface components {
3126
3069
  };
3127
3070
  /** @description Command to mark a job as complete */
3128
3071
  JobCompleteCommand: {
3072
+ /** @description Authenticated user's DID, injected by the /bus/emit gateway. Clients do not set this. */
3073
+ _userId?: string;
3129
3074
  resourceId: string;
3130
- userId: string;
3131
3075
  jobId: string;
3132
3076
  jobType: components["schemas"]["JobType"];
3133
3077
  /** @description Annotation this job is attached to, when applicable. Lets the UI route completion feedback (toast, resolve state) to a specific annotation. */
@@ -3136,8 +3080,9 @@ interface components {
3136
3080
  };
3137
3081
  /** @description Command to mark a job as failed */
3138
3082
  JobFailCommand: {
3083
+ /** @description Authenticated user's DID, injected by the /bus/emit gateway. Clients do not set this. */
3084
+ _userId?: string;
3139
3085
  resourceId: string;
3140
- userId: string;
3141
3086
  jobId: string;
3142
3087
  jobType: components["schemas"]["JobType"];
3143
3088
  /** @description Annotation this job is attached to, when applicable. Lets the UI route failure feedback (error toast, revert state) to a specific annotation. */
@@ -3198,6 +3143,8 @@ interface components {
3198
3143
  jobId: string;
3199
3144
  jobType: string;
3200
3145
  resourceId: string;
3146
+ /** @description DID of the user who initiated the job (audit). */
3147
+ userId: string;
3201
3148
  };
3202
3149
  /** @description Result of a completed reference-annotation job. */
3203
3150
  JobReferenceAnnotationResult: {
@@ -3210,8 +3157,9 @@ interface components {
3210
3157
  };
3211
3158
  /** @description Command to report progress on a job */
3212
3159
  JobReportProgressCommand: {
3160
+ /** @description Authenticated user's DID, injected by the /bus/emit gateway. Clients do not set this. */
3161
+ _userId?: string;
3213
3162
  resourceId: string;
3214
- userId: string;
3215
3163
  jobId: string;
3216
3164
  jobType: components["schemas"]["JobType"];
3217
3165
  /** @description Annotation this job is attached to, when applicable. Lets the UI attach progress visuals to a specific annotation (e.g. a reference whose generation is running). */
@@ -3223,8 +3171,9 @@ interface components {
3223
3171
  JobResult: components["schemas"]["JobGenerationResult"] | components["schemas"]["JobReferenceAnnotationResult"] | components["schemas"]["JobHighlightAnnotationResult"] | components["schemas"]["JobAssessmentAnnotationResult"] | components["schemas"]["JobCommentAnnotationResult"] | components["schemas"]["JobTagAnnotationResult"];
3224
3172
  /** @description Command to start a job */
3225
3173
  JobStartCommand: {
3174
+ /** @description Authenticated user's DID, injected by the /bus/emit gateway. Clients do not set this. */
3175
+ _userId?: string;
3226
3176
  resourceId: string;
3227
- userId: string;
3228
3177
  jobId: string;
3229
3178
  jobType: components["schemas"]["JobType"];
3230
3179
  /** @description Annotation this job is attached to, when applicable. Set for annotation-scoped jobs like generation (from a specific reference). Unset for resource-scoped jobs like bulk reference/tag/highlight detection. */
@@ -3252,11 +3201,13 @@ interface components {
3252
3201
  /** @description Bus command to add a new entity type tag. */
3253
3202
  MarkAddEntityTypeCommand: {
3254
3203
  tag: string;
3255
- userId: string;
3204
+ /** @description Authenticated user's DID, injected by the /bus/emit gateway. Clients do not set this. */
3205
+ _userId?: string;
3256
3206
  };
3257
3207
  /** @description Bus command to archive a resource and optionally remove its file. */
3258
3208
  MarkArchiveCommand: {
3259
- userId?: string;
3209
+ /** @description Authenticated user's DID, injected by the /bus/emit gateway. Clients do not set this. */
3210
+ _userId?: string;
3260
3211
  resourceId: string;
3261
3212
  storageUri?: string;
3262
3213
  keepFile?: boolean;
@@ -3285,10 +3236,11 @@ interface components {
3285
3236
  };
3286
3237
  /** @description Bus command to create an annotation on a resource. */
3287
3238
  MarkCreateCommand: {
3239
+ /** @description Authenticated user's DID, injected by the /bus/emit gateway. Clients do not set this. */
3240
+ _userId?: string;
3288
3241
  /** @description Optional correlation id threaded from the originating mark:create-request. Propagated into event metadata by Stower so annotation-assembly can emit mark:create-ok after persistence completes. */
3289
3242
  correlationId?: string;
3290
3243
  annotation: components["schemas"]["Annotation"];
3291
- userId: string;
3292
3244
  resourceId: string;
3293
3245
  };
3294
3246
  /** @description Success response after creating an annotation. */
@@ -3303,8 +3255,9 @@ interface components {
3303
3255
  };
3304
3256
  /** @description Bus command to delete an annotation. */
3305
3257
  MarkDeleteCommand: {
3258
+ /** @description Authenticated user's DID, injected by the /bus/emit gateway. Clients do not set this. */
3259
+ _userId?: string;
3306
3260
  annotationId: string;
3307
- userId?: string;
3308
3261
  resourceId?: string;
3309
3262
  };
3310
3263
  /** @description Success response after deleting an annotation. */
@@ -3335,23 +3288,26 @@ interface components {
3335
3288
  };
3336
3289
  /** @description Bus command to unarchive a previously archived resource. */
3337
3290
  MarkUnarchiveCommand: {
3338
- userId?: string;
3291
+ /** @description Authenticated user's DID, injected by the /bus/emit gateway. Clients do not set this. */
3292
+ _userId?: string;
3339
3293
  resourceId: string;
3340
3294
  storageUri?: string;
3341
3295
  };
3342
3296
  /** @description Bus command to update an annotation's body with patch operations. */
3343
3297
  MarkUpdateBodyCommand: {
3298
+ /** @description Authenticated user's DID, injected by the /bus/emit gateway. Clients do not set this. */
3299
+ _userId?: string;
3344
3300
  /** @description Correlation id threaded from the originating route through to event metadata. Lets the events-stream deliver matched results to the client that initiated the bind. */
3345
3301
  correlationId?: string;
3346
3302
  annotationId: string;
3347
- userId: string;
3348
3303
  resourceId: string;
3349
3304
  operations: (components["schemas"]["BodyOperationAdd"] | components["schemas"]["BodyOperationRemove"] | components["schemas"]["BodyOperationReplace"])[];
3350
3305
  };
3351
3306
  /** @description Bus command to replace the entity types on a resource. */
3352
3307
  MarkUpdateEntityTypesCommand: {
3353
3308
  resourceId: string;
3354
- userId: string;
3309
+ /** @description Authenticated user's DID, injected by the /bus/emit gateway. Clients do not set this. */
3310
+ _userId?: string;
3355
3311
  currentEntityTypes: string[];
3356
3312
  updatedEntityTypes: string[];
3357
3313
  };
@@ -3425,12 +3381,13 @@ interface components {
3425
3381
  };
3426
3382
  /** @description Bus command to create a yielded resource in the knowledge base. */
3427
3383
  YieldCreateCommand: {
3384
+ /** @description Authenticated user's DID, injected by the /bus/emit gateway. Clients do not set this. */
3385
+ _userId?: string;
3428
3386
  name: string;
3429
3387
  storageUri: string;
3430
3388
  contentChecksum: string;
3431
3389
  byteSize: number;
3432
3390
  format: components["schemas"]["ContentFormat"];
3433
- userId: string;
3434
3391
  language?: string;
3435
3392
  entityTypes?: string[];
3436
3393
  creationMethod?: string;
@@ -3454,9 +3411,10 @@ interface components {
3454
3411
  };
3455
3412
  /** @description Bus command to move (rename) a yielded resource. */
3456
3413
  YieldMvCommand: {
3414
+ /** @description Authenticated user's DID, injected by the /bus/emit gateway. Clients do not set this. */
3415
+ _userId?: string;
3457
3416
  fromUri: string;
3458
3417
  toUri: string;
3459
- userId: string;
3460
3418
  noGit?: boolean;
3461
3419
  };
3462
3420
  /** @description Bus command to request yield (generation) of a new resource from an annotation. */
@@ -3477,11 +3435,12 @@ interface components {
3477
3435
  };
3478
3436
  /** @description Bus command to update a yielded resource's storage content. */
3479
3437
  YieldUpdateCommand: {
3438
+ /** @description Authenticated user's DID, injected by the /bus/emit gateway. Clients do not set this. */
3439
+ _userId?: string;
3480
3440
  resourceId: string;
3481
3441
  storageUri: string;
3482
3442
  contentChecksum: string;
3483
3443
  byteSize: number;
3484
- userId: string;
3485
3444
  noGit?: boolean;
3486
3445
  };
3487
3446
  /** @description Success response after updating a yielded resource. */
@@ -3611,18 +3570,57 @@ declare function resourceId(id: string): ResourceId;
3611
3570
  declare function annotationId(id: string): AnnotationId;
3612
3571
  declare function userId(id: string): UserId;
3613
3572
 
3573
+ /**
3574
+ * Annotation types
3575
+ */
3576
+
3577
+ type RawAnnotation = components['schemas']['Annotation'];
3578
+ /**
3579
+ * Domain-level Annotation type. Same shape as the OpenAPI-generated
3580
+ * `components['schemas']['Annotation']`, but with a branded `AnnotationId`
3581
+ * for the `id` field. Use this import everywhere the codebase refers to
3582
+ * "an annotation"; the raw OpenAPI type is only used inside
3583
+ * `@semiont/api-client` at the HTTP boundary.
3584
+ *
3585
+ * Implemented by intersection (not `Omit`) to be robust against generator
3586
+ * drift — if the OpenAPI schema gets `additionalProperties: true` added,
3587
+ * `Omit` on the resulting intersection type silently drops named fields.
3588
+ */
3589
+ type Annotation = RawAnnotation & {
3590
+ id: AnnotationId;
3591
+ };
3592
+ type AnnotationCategory = 'highlight' | 'reference';
3593
+ interface CreateAnnotationInternal {
3594
+ id: AnnotationId;
3595
+ motivation: Annotation['motivation'];
3596
+ target: Annotation['target'];
3597
+ body?: Annotation['body'];
3598
+ creator: components['schemas']['Agent'];
3599
+ }
3600
+
3614
3601
  /**
3615
3602
  * Graph types - Models for graph connections and relationships
3616
3603
  */
3617
3604
 
3618
- type ResourceDescriptor = components['schemas']['ResourceDescriptor'];
3619
- type Annotation$4 = components['schemas']['Annotation'];
3605
+ type RawResourceDescriptor = components['schemas']['ResourceDescriptor'];
3606
+ /**
3607
+ * Domain-level ResourceDescriptor type. Same shape as the OpenAPI-generated
3608
+ * `components['schemas']['ResourceDescriptor']`, but with a branded `ResourceId`
3609
+ * for the `@id` field.
3610
+ *
3611
+ * Implemented by intersection (not `Omit`) because the generated raw type
3612
+ * ends in `& { [key: string]: unknown }` — `Omit` on an intersection with
3613
+ * an index signature drops almost all named fields.
3614
+ */
3615
+ type ResourceDescriptor = RawResourceDescriptor & {
3616
+ '@id': ResourceId;
3617
+ };
3620
3618
  /**
3621
3619
  * Represents a connection between resources through annotations
3622
3620
  */
3623
3621
  interface GraphConnection {
3624
3622
  targetResource: ResourceDescriptor;
3625
- annotations: Annotation$4[];
3623
+ annotations: Annotation[];
3626
3624
  relationshipType?: string;
3627
3625
  bidirectional: boolean;
3628
3626
  }
@@ -3631,7 +3629,7 @@ interface GraphConnection {
3631
3629
  */
3632
3630
  interface GraphPath {
3633
3631
  resources: ResourceDescriptor[];
3634
- annotations: Annotation$4[];
3632
+ annotations: Annotation[];
3635
3633
  }
3636
3634
  /**
3637
3635
  * Statistics about entity types in the graph
@@ -3649,6 +3647,15 @@ interface EntityTypeStats {
3649
3647
  * The PersistedEvent union derives from this catalog.
3650
3648
  */
3651
3649
 
3650
+ type AnnotationAddedPayload = components['schemas']['AnnotationAddedPayload'] & {
3651
+ annotation: Annotation;
3652
+ };
3653
+ type AnnotationRemovedPayload = components['schemas']['AnnotationRemovedPayload'] & {
3654
+ annotationId: AnnotationId;
3655
+ };
3656
+ type AnnotationBodyUpdatedPayload = components['schemas']['AnnotationBodyUpdatedPayload'] & {
3657
+ annotationId: AnnotationId;
3658
+ };
3652
3659
  /**
3653
3660
  * Maps each persisted event type string to its OpenAPI payload schema.
3654
3661
  * Single source of truth for "what events get written to the log."
@@ -3660,9 +3667,9 @@ type PersistedEventCatalog = {
3660
3667
  'yield:moved': components['schemas']['ResourceMovedPayload'];
3661
3668
  'yield:representation-added': components['schemas']['RepresentationAddedPayload'];
3662
3669
  'yield:representation-removed': components['schemas']['RepresentationRemovedPayload'];
3663
- 'mark:added': components['schemas']['AnnotationAddedPayload'];
3664
- 'mark:removed': components['schemas']['AnnotationRemovedPayload'];
3665
- 'mark:body-updated': components['schemas']['AnnotationBodyUpdatedPayload'];
3670
+ 'mark:added': AnnotationAddedPayload;
3671
+ 'mark:removed': AnnotationRemovedPayload;
3672
+ 'mark:body-updated': AnnotationBodyUpdatedPayload;
3666
3673
  'mark:archived': components['schemas']['ResourceArchivedPayload'];
3667
3674
  'mark:unarchived': components['schemas']['ResourceUnarchivedPayload'];
3668
3675
  'mark:entity-tag-added': components['schemas']['EntityTagChangedPayload'];
@@ -3754,7 +3761,7 @@ type StoredEvent<T extends EventBase = PersistedEvent> = T & {
3754
3761
  };
3755
3762
  type BodyItem = components['schemas']['TextualBody'] | components['schemas']['SpecificResource'];
3756
3763
  type BodyOperation = components['schemas']['BodyOperationAdd'] | components['schemas']['BodyOperationRemove'] | components['schemas']['BodyOperationReplace'];
3757
- type Annotation$3 = components['schemas']['Annotation'];
3764
+
3758
3765
  interface EventQuery {
3759
3766
  resourceId?: ResourceId;
3760
3767
  userId?: string;
@@ -3766,7 +3773,7 @@ interface EventQuery {
3766
3773
  }
3767
3774
  interface ResourceAnnotations {
3768
3775
  resourceId: ResourceId;
3769
- annotations: Annotation$3[];
3776
+ annotations: Annotation[];
3770
3777
  version: number;
3771
3778
  updatedAt: string;
3772
3779
  }
@@ -3778,17 +3785,34 @@ interface ResourceAnnotations {
3778
3785
  * its payload type is defined here — domain events, commands, reads,
3779
3786
  * results, SSE stream payloads, and frontend UI events.
3780
3787
  *
3781
- * Command and result payloads use OpenAPI-generated types (plain strings
3782
- * for identifiers). Branded type safety (ResourceId, UserId, etc.) is
3783
- * enforced at function boundaries, not on bus payloads — callers use
3784
- * factory functions (resourceId(), userId()) at the consume boundary.
3785
- *
3786
- * Domain events (StoredEvent<Interface>) retain branded types as they
3787
- * are the system of record, not wire-format payloads.
3788
+ * Identifier discipline: where a payload carries an annotation or
3789
+ * resource id, the TypeScript layer narrows the OpenAPI `string` to the
3790
+ * branded type (`AnnotationId`, `ResourceId`, `UserId`). The runtime
3791
+ * wire shape is unchanged (brands have no runtime representation);
3792
+ * what this buys us is that command handlers don't have to re-brand
3793
+ * at every seam. Brand once at the entry boundary (HTTP route handler,
3794
+ * DOM attribute read, URL param parse), not at every bus hop in
3795
+ * between. See `.plans/BRAND-UPSTREAM.md` for the rationale.
3788
3796
  *
3789
3797
  * Organized by flow (verb), then by category within each flow.
3790
3798
  */
3791
3799
 
3800
+ type MarkDeleteCommand = components['schemas']['MarkDeleteCommand'] & {
3801
+ annotationId: AnnotationId;
3802
+ resourceId?: ResourceId;
3803
+ };
3804
+ type MarkUpdateBodyCommand = components['schemas']['MarkUpdateBodyCommand'] & {
3805
+ annotationId: AnnotationId;
3806
+ resourceId: ResourceId;
3807
+ };
3808
+ type BindInitiateCommand = components['schemas']['BindInitiateCommand'] & {
3809
+ annotationId: AnnotationId;
3810
+ resourceId: ResourceId;
3811
+ };
3812
+ type BindUpdateBodyCommand = components['schemas']['BindUpdateBodyCommand'] & {
3813
+ annotationId: AnnotationId;
3814
+ resourceId: ResourceId;
3815
+ };
3792
3816
  /**
3793
3817
  * The unified EventMap — every channel on the EventBus.
3794
3818
  *
@@ -3848,8 +3872,8 @@ type EventMap = {
3848
3872
  'mark:unarchived': StoredEvent<EventOfType<'mark:unarchived'>>;
3849
3873
  'mark:create-request': components['schemas']['MarkCreateRequest'];
3850
3874
  'mark:create': components['schemas']['MarkCreateCommand'];
3851
- 'mark:delete': components['schemas']['MarkDeleteCommand'];
3852
- 'mark:update-body': components['schemas']['MarkUpdateBodyCommand'];
3875
+ 'mark:delete': MarkDeleteCommand;
3876
+ 'mark:update-body': MarkUpdateBodyCommand;
3853
3877
  'mark:archive': components['schemas']['MarkArchiveCommand'];
3854
3878
  'mark:unarchive': components['schemas']['MarkUnarchiveCommand'];
3855
3879
  'mark:update-entity-types': components['schemas']['MarkUpdateEntityTypesCommand'];
@@ -3874,8 +3898,8 @@ type EventMap = {
3874
3898
  'mark:selection-changed': components['schemas']['MarkSelectionChangedEvent'];
3875
3899
  'mark:click-changed': components['schemas']['MarkClickChangedEvent'];
3876
3900
  'mark:shape-changed': components['schemas']['MarkShapeChangedEvent'];
3877
- 'bind:initiate': components['schemas']['BindInitiateCommand'];
3878
- 'bind:update-body': components['schemas']['BindUpdateBodyCommand'];
3901
+ 'bind:initiate': BindInitiateCommand;
3902
+ 'bind:update-body': BindUpdateBodyCommand;
3879
3903
  'bind:body-updated': components['schemas']['BindBodyUpdated'];
3880
3904
  'bind:body-update-failed': components['schemas']['CommandError'];
3881
3905
  'match:search-requested': components['schemas']['MatchSearchRequest'];
@@ -4612,6 +4636,31 @@ interface Logger {
4612
4636
  */
4613
4637
  declare function errField(error: unknown): unknown;
4614
4638
 
4639
+ /**
4640
+ * Bus logging — runtime-toggleable cross-wire visibility.
4641
+ *
4642
+ * One line per event that crosses a process boundary, in a grep-able
4643
+ * format that's symmetric across frontend and backend:
4644
+ *
4645
+ * [bus EMIT] <channel> [scope=X] [cid=<first8>] <payload>
4646
+ * [bus RECV] <channel> [scope=X] [cid=<first8>] <payload>
4647
+ * [bus SSE] <channel> [scope=X] [cid=<first8>] <payload>
4648
+ *
4649
+ * Tier 1 of `.plans/OBSERVABILITY.md`. Forward-compatible with Tier 2:
4650
+ * the `cid` printed here is exactly the prefix of the W3C trace-id we
4651
+ * adopt later.
4652
+ *
4653
+ * Cost when disabled: one property read per call, zero allocations.
4654
+ *
4655
+ * Enable:
4656
+ * - Browser: `window.__SEMIONT_BUS_LOG__ = true` (DevTools or e2e init)
4657
+ * - Node: `SEMIONT_BUS_LOG=1` in the process env (read at module load)
4658
+ */
4659
+ type BusOp = 'EMIT' | 'RECV' | 'SSE' | 'PUT' | 'GET';
4660
+ declare function busLogEnabled(): boolean;
4661
+ declare function setBusLogTraceIdProvider(fn: (() => string | undefined) | undefined): void;
4662
+ declare function busLog(op: BusOp, channel: string, payload: unknown, scope?: string): void;
4663
+
4615
4664
  /**
4616
4665
  * Annotation body utilities
4617
4666
  *
@@ -4620,7 +4669,6 @@ declare function errField(error: unknown): unknown;
4620
4669
  * replace operations against an annotation body.
4621
4670
  */
4622
4671
 
4623
- type Annotation$2 = components['schemas']['Annotation'];
4624
4672
  type BodyPurpose = components['schemas']['BodyPurpose'];
4625
4673
  /**
4626
4674
  * Identity of a body item for matching purposes.
@@ -4652,7 +4700,7 @@ type BodyItemIdentity = {
4652
4700
  *
4653
4701
  * See `BodyItemIdentity` for matching semantics.
4654
4702
  */
4655
- declare function findBodyItem(body: Annotation$2['body'], identity: BodyItemIdentity): number;
4703
+ declare function findBodyItem(body: Annotation['body'], identity: BodyItemIdentity): number;
4656
4704
 
4657
4705
  /**
4658
4706
  * Annotation Assembly
@@ -4661,30 +4709,29 @@ declare function findBodyItem(body: Annotation$2['body'], identity: BodyItemIden
4661
4709
  * No EventBus, no persistence — just data transformation.
4662
4710
  */
4663
4711
 
4664
- type Agent$1 = components['schemas']['Agent'];
4665
- type Annotation$1 = components['schemas']['Annotation'];
4712
+ type Agent$2 = components['schemas']['Agent'];
4666
4713
  type AnnotationBody = components['schemas']['AnnotationBody'];
4667
4714
  type CreateAnnotationRequest = components['schemas']['CreateAnnotationRequest'];
4668
4715
  type UpdateAnnotationBodyRequest = components['schemas']['UpdateAnnotationBodyRequest'];
4669
- type TextPositionSelector = components['schemas']['TextPositionSelector'];
4670
- type SvgSelector = components['schemas']['SvgSelector'];
4671
- type FragmentSelector = components['schemas']['FragmentSelector'];
4716
+ type TextPositionSelector$1 = components['schemas']['TextPositionSelector'];
4717
+ type SvgSelector$1 = components['schemas']['SvgSelector'];
4718
+ type FragmentSelector$1 = components['schemas']['FragmentSelector'];
4672
4719
  interface AssembledAnnotation {
4673
- annotation: Annotation$1;
4720
+ annotation: Annotation;
4674
4721
  bodyArray: AnnotationBody[];
4675
4722
  }
4676
4723
  /**
4677
4724
  * Get TextPositionSelector from a selector (single or array)
4678
4725
  */
4679
- declare function getTextPositionSelector(selector: Selector | Selector[] | undefined): TextPositionSelector | null;
4726
+ declare function getTextPositionSelector(selector: Selector | Selector[] | undefined): TextPositionSelector$1 | null;
4680
4727
  /**
4681
4728
  * Get SvgSelector from a selector (single or array)
4682
4729
  */
4683
- declare function getSvgSelector(selector: Selector | Selector[] | undefined): SvgSelector | null;
4730
+ declare function getSvgSelector(selector: Selector | Selector[] | undefined): SvgSelector$1 | null;
4684
4731
  /**
4685
4732
  * Get FragmentSelector from a selector (single or array)
4686
4733
  */
4687
- declare function getFragmentSelector(selector: Selector | Selector[] | undefined): FragmentSelector | null;
4734
+ declare function getFragmentSelector(selector: Selector | Selector[] | undefined): FragmentSelector$1 | null;
4688
4735
  /**
4689
4736
  * Validate SVG markup for W3C compliance
4690
4737
  *
@@ -4699,12 +4746,833 @@ declare function validateSvgMarkup(svg: string): string | null;
4699
4746
  *
4700
4747
  * Throws on invalid input (missing selector, missing motivation, invalid SVG).
4701
4748
  */
4702
- declare function assembleAnnotation(request: CreateAnnotationRequest, creator: Agent$1): AssembledAnnotation;
4749
+ declare function assembleAnnotation(request: CreateAnnotationRequest, creator: Agent$2): AssembledAnnotation;
4703
4750
  /**
4704
4751
  * Apply body operations (add/remove/replace) to an annotation's body array.
4705
4752
  * Returns a new array — does not mutate the input.
4706
4753
  */
4707
- declare function applyBodyOperations(body: Annotation$1['body'], operations: UpdateAnnotationBodyRequest['operations']): AnnotationBody[];
4754
+ declare function applyBodyOperations(body: Annotation['body'], operations: UpdateAnnotationBodyRequest['operations']): AnnotationBody[];
4755
+
4756
+ /**
4757
+ * Annotation and Selector Utilities
4758
+ *
4759
+ * Pure TypeScript utilities for working with W3C Web Annotations.
4760
+ * No React dependencies - safe to use in any JavaScript environment.
4761
+ *
4762
+ * Body is either empty array (stub) or single SpecificResource (resolved)
4763
+ * Body can be array of TextualBody (tagging) + SpecificResource (linking)
4764
+ * Target can be simple string IRI or object with source and optional selector
4765
+ */
4766
+
4767
+ type HighlightAnnotation = Annotation;
4768
+ type ReferenceAnnotation = Annotation;
4769
+ type TextPositionSelector = components['schemas']['TextPositionSelector'];
4770
+ type TextQuoteSelector = components['schemas']['TextQuoteSelector'];
4771
+ type SvgSelector = components['schemas']['SvgSelector'];
4772
+ type FragmentSelector = components['schemas']['FragmentSelector'];
4773
+
4774
+ /**
4775
+ * Get the source from an annotation body (null if stub)
4776
+ * Search for SpecificResource in body array
4777
+ */
4778
+ declare function getBodySource(body: Annotation['body']): string | null;
4779
+ /**
4780
+ * Get the type from an annotation body (returns first body type in array)
4781
+ */
4782
+ declare function getBodyType(body: Annotation['body']): 'TextualBody' | 'SpecificResource' | null;
4783
+ /**
4784
+ * Check if body is resolved (has a source)
4785
+ * Check for SpecificResource in body array
4786
+ */
4787
+ declare function isBodyResolved(body: Annotation['body']): boolean;
4788
+ /**
4789
+ * Get the source IRI from target (handles both string and object forms)
4790
+ */
4791
+ declare function getTargetSource(target: Annotation['target']): string;
4792
+ /**
4793
+ * Get the selector from target (undefined if string or no selector)
4794
+ */
4795
+ declare function getTargetSelector(target: Annotation['target']): {
4796
+ type: "TextPositionSelector";
4797
+ start: number;
4798
+ end: number;
4799
+ } | {
4800
+ type: "TextQuoteSelector";
4801
+ exact: string;
4802
+ prefix?: string;
4803
+ suffix?: string;
4804
+ } | {
4805
+ type: "SvgSelector";
4806
+ value: string;
4807
+ } | {
4808
+ type: "FragmentSelector";
4809
+ value: string;
4810
+ conformsTo?: string;
4811
+ } | ({
4812
+ type: "TextPositionSelector";
4813
+ start: number;
4814
+ end: number;
4815
+ } | {
4816
+ type: "TextQuoteSelector";
4817
+ exact: string;
4818
+ prefix?: string;
4819
+ suffix?: string;
4820
+ } | {
4821
+ type: "SvgSelector";
4822
+ value: string;
4823
+ } | {
4824
+ type: "FragmentSelector";
4825
+ value: string;
4826
+ conformsTo?: string;
4827
+ })[] | undefined;
4828
+ /**
4829
+ * Check if target has a selector
4830
+ */
4831
+ declare function hasTargetSelector(target: Annotation['target']): boolean;
4832
+ /**
4833
+ * Type guard to check if an annotation is a highlight
4834
+ */
4835
+ declare function isHighlight(annotation: Annotation): annotation is HighlightAnnotation;
4836
+ /**
4837
+ * Type guard to check if an annotation is a reference (linking)
4838
+ */
4839
+ declare function isReference(annotation: Annotation): annotation is ReferenceAnnotation;
4840
+ /**
4841
+ * Type guard to check if an annotation is an assessment
4842
+ */
4843
+ declare function isAssessment(annotation: Annotation): annotation is Annotation;
4844
+ /**
4845
+ * Type guard to check if an annotation is a comment
4846
+ */
4847
+ declare function isComment(annotation: Annotation): annotation is Annotation;
4848
+ /**
4849
+ * Type guard to check if an annotation is a tag
4850
+ */
4851
+ declare function isTag(annotation: Annotation): annotation is Annotation;
4852
+ /**
4853
+ * Extract comment text from a comment annotation's body
4854
+ * @param annotation - The annotation to extract comment text from
4855
+ * @returns The comment text, or undefined if not a comment or no text found
4856
+ */
4857
+ declare function getCommentText(annotation: Annotation): string | undefined;
4858
+ /**
4859
+ * Type guard to check if a reference annotation is a stub (unresolved)
4860
+ * Stub if no SpecificResource in body array
4861
+ */
4862
+ declare function isStubReference(annotation: Annotation): boolean;
4863
+ /**
4864
+ * Type guard to check if a reference annotation is resolved
4865
+ * Resolved if SpecificResource exists in body array
4866
+ */
4867
+ declare function isResolvedReference(annotation: Annotation): annotation is ReferenceAnnotation;
4868
+ /**
4869
+ * Get the exact text from a selector (single or array)
4870
+ *
4871
+ * When selector is an array, tries to find a TextQuoteSelector (which has exact text).
4872
+ * TextPositionSelector does not have exact text, only character offsets.
4873
+ * Handles undefined selector (when target is a string IRI with no selector)
4874
+ */
4875
+ declare function getExactText(selector: Selector | Selector[] | undefined): string;
4876
+ /**
4877
+ * Get the exact text from an annotation's target selector
4878
+ * Uses getTargetSelector helper to safely get selector
4879
+ */
4880
+ declare function getAnnotationExactText(annotation: Annotation): string;
4881
+ /**
4882
+ * Get the primary selector from a selector (single or array)
4883
+ *
4884
+ * When selector is an array, returns the first selector.
4885
+ * When selector is a single object, returns it as-is.
4886
+ */
4887
+ declare function getPrimarySelector(selector: Selector | Selector[]): Selector;
4888
+ /**
4889
+ * Get TextQuoteSelector from a selector (single or array)
4890
+ *
4891
+ * Returns the first TextQuoteSelector found, or null if none exists.
4892
+ */
4893
+ declare function getTextQuoteSelector(selector: Selector | Selector[]): TextQuoteSelector | null;
4894
+ /**
4895
+ * Extract bounding box from SVG markup
4896
+ *
4897
+ * Attempts to extract x, y, width, height from the SVG viewBox or root element.
4898
+ * Returns null if bounding box cannot be determined.
4899
+ */
4900
+ declare function extractBoundingBox(svg: string): {
4901
+ x: number;
4902
+ y: number;
4903
+ width: number;
4904
+ height: number;
4905
+ } | null;
4906
+
4907
+ /**
4908
+ * Helper functions for working with W3C ResourceDescriptor
4909
+ */
4910
+
4911
+ type Representation = components['schemas']['Representation'];
4912
+ /**
4913
+ * Get the resource ID from @id property
4914
+ *
4915
+ * @id is always a bare ID (UUID), never a full URI.
4916
+ */
4917
+ declare function getResourceId(resource: ResourceDescriptor | undefined): string | undefined;
4918
+ /**
4919
+ * Get the primary representation (first or only representation)
4920
+ */
4921
+ declare function getPrimaryRepresentation(resource: ResourceDescriptor | undefined): Representation | undefined;
4922
+ /**
4923
+ * Get the media type from the primary representation
4924
+ */
4925
+ declare function getPrimaryMediaType(resource: ResourceDescriptor | undefined): string | undefined;
4926
+ /**
4927
+ * Get the checksum from the primary representation
4928
+ */
4929
+ declare function getChecksum(resource: ResourceDescriptor | undefined): string | undefined;
4930
+ /**
4931
+ * Get the language from the primary representation
4932
+ */
4933
+ declare function getLanguage(resource: ResourceDescriptor | undefined): string | undefined;
4934
+ /**
4935
+ * Get storage URI from primary representation
4936
+ *
4937
+ * @param resource - ResourceDescriptor
4938
+ * @returns Storage URI or undefined
4939
+ */
4940
+ declare function getStorageUri(resource: ResourceDescriptor | undefined): string | undefined;
4941
+ /**
4942
+ * Get creator agent from wasAttributedTo
4943
+ * Handles both single agent and array of agents
4944
+ *
4945
+ * @param resource - ResourceDescriptor
4946
+ * @returns First agent or undefined
4947
+ */
4948
+ declare function getCreator(resource: ResourceDescriptor | undefined): components['schemas']['Agent'] | undefined;
4949
+ /**
4950
+ * Get derived-from URI
4951
+ * Handles both single URI and array of URIs
4952
+ *
4953
+ * @param resource - ResourceDescriptor
4954
+ * @returns First derivation URI or undefined
4955
+ */
4956
+ declare function getDerivedFrom(resource: ResourceDescriptor | undefined): string | undefined;
4957
+ /**
4958
+ * Check if resource is archived (application-specific field)
4959
+ *
4960
+ * @param resource - ResourceDescriptor
4961
+ * @returns True if archived, false otherwise
4962
+ */
4963
+ declare function isArchived(resource: ResourceDescriptor | undefined): boolean;
4964
+ /**
4965
+ * Get entity types from resource (application-specific field)
4966
+ *
4967
+ * @param resource - ResourceDescriptor
4968
+ * @returns Array of entity types, empty if not set
4969
+ */
4970
+ declare function getResourceEntityTypes(resource: ResourceDescriptor | undefined): string[];
4971
+ /**
4972
+ * Check if resource is a draft (application-specific field)
4973
+ *
4974
+ * @param resource - ResourceDescriptor
4975
+ * @returns True if draft, false otherwise
4976
+ */
4977
+ declare function isDraft(resource: ResourceDescriptor | undefined): boolean;
4978
+ /**
4979
+ * Map charset names to Node.js Buffer encoding names
4980
+ * Node.js Buffer.toString() supports: 'utf8', 'utf16le', 'latin1', 'base64', 'hex', 'ascii', 'binary', 'ucs2'
4981
+ *
4982
+ * @param charset - Charset name (e.g., "UTF-8", "ISO-8859-1", "Windows-1252")
4983
+ * @returns Node.js BufferEncoding
4984
+ */
4985
+ declare function getNodeEncoding(charset: string): BufferEncoding;
4986
+ /**
4987
+ * Decode a representation buffer to string using the correct charset
4988
+ * Extracts charset from media type and uses appropriate encoding
4989
+ *
4990
+ * @param buffer - The raw representation data
4991
+ * @param mediaType - Media type with optional charset (e.g., "text/plain; charset=iso-8859-1")
4992
+ * @returns Decoded string
4993
+ *
4994
+ * @example
4995
+ * ```typescript
4996
+ * const content = decodeRepresentation(buffer, "text/plain; charset=utf-8");
4997
+ * const legacy = decodeRepresentation(buffer, "text/plain; charset=windows-1252");
4998
+ * ```
4999
+ */
5000
+ declare function decodeRepresentation(buffer: Buffer, mediaType: string): string;
5001
+
5002
+ /**
5003
+ * Transport interfaces — the shared contract for any wire-or-local
5004
+ * communication path consumed by `SemiontClient`. Concrete implementations
5005
+ * live alongside the runtime they wrap (`HttpTransport` in
5006
+ * `@semiont/api-client`, in-process variants in `@semiont/make-meaning`,
5007
+ * etc.).
5008
+ *
5009
+ * Two interfaces:
5010
+ *
5011
+ * ITransport — full surface: bus primitives + auth + admin +
5012
+ * exchange + health/status + connection state.
5013
+ * IContentTransport — binary I/O (putBinary / getBinary). Narrow by
5014
+ * design because binary has different backpressure
5015
+ * and streaming characteristics.
5016
+ *
5017
+ * The behavioral guarantees every implementation must honor are documented
5018
+ * in `packages/core/docs/TRANSPORT-CONTRACT.md`.
5019
+ */
5020
+
5021
+ type Agent$1 = components['schemas']['Agent'];
5022
+ /**
5023
+ * Six-state lifecycle for a transport's connection. Drives UI affordances
5024
+ * (connecting spinners, reconnecting banners, etc.) and is observed via
5025
+ * `ITransport.state$`.
5026
+ *
5027
+ * initial ─ pre-`start()`; never enters subscribers' streams
5028
+ * except as the first replayed value
5029
+ * connecting ─ in-flight initial open
5030
+ * open ─ healthy, delivering events
5031
+ * reconnecting ─ open → dropped, retrying; may be transient
5032
+ * degraded ─ has been reconnecting for > DEGRADED_THRESHOLD_MS;
5033
+ * UI banner threshold; distinguishes brief mount-
5034
+ * churn cycles from sustained disconnection
5035
+ * closed ─ stop()/dispose() called; terminal
5036
+ */
5037
+ type ConnectionState = 'initial' | 'connecting' | 'open' | 'reconnecting' | 'degraded' | 'closed';
5038
+ type AuthResponse = components['schemas']['AuthResponse'];
5039
+ type TokenRefreshResponse = components['schemas']['TokenRefreshResponse'];
5040
+ type AdminUserStatsResponse = components['schemas']['AdminUserStatsResponse'];
5041
+ type OAuthConfigResponse = components['schemas']['OAuthConfigResponse'];
5042
+ type ResponseContent<T> = T extends {
5043
+ responses: {
5044
+ 200: {
5045
+ content: {
5046
+ 'application/json': infer R;
5047
+ };
5048
+ };
5049
+ };
5050
+ } ? R : T extends {
5051
+ responses: {
5052
+ 201: {
5053
+ content: {
5054
+ 'application/json': infer R;
5055
+ };
5056
+ };
5057
+ };
5058
+ } ? R : T extends {
5059
+ responses: {
5060
+ 202: {
5061
+ content: {
5062
+ 'application/json': infer R;
5063
+ };
5064
+ };
5065
+ };
5066
+ } ? R : never;
5067
+ type RequestContent<T> = T extends {
5068
+ requestBody?: {
5069
+ content: {
5070
+ 'application/json': infer R;
5071
+ };
5072
+ };
5073
+ } ? R : never;
5074
+ type HealthCheckResponse = ResponseContent<paths['/api/health']['get']>;
5075
+ type StatusResponse = ResponseContent<paths['/api/status']['get']>;
5076
+ type UserResponse = ResponseContent<paths['/api/users/me']['get']>;
5077
+ type UpdateUserRequest = RequestContent<paths['/api/admin/users/{id}']['patch']>;
5078
+ type UpdateUserResponse = ResponseContent<paths['/api/admin/users/{id}']['patch']>;
5079
+ type ListUsersResponse = ResponseContent<paths['/api/admin/users']['get']>;
5080
+ type ProgressEvent = {
5081
+ phase: string;
5082
+ message?: string;
5083
+ result?: Record<string, unknown>;
5084
+ };
5085
+ type ProgressCallback = (event: ProgressEvent) => void;
5086
+ interface ITransport {
5087
+ /**
5088
+ * Base URL the transport speaks to. For HTTP this is `https://host[:port]`;
5089
+ * for in-process transports, an opaque identifier (e.g. `local://kb-id`).
5090
+ */
5091
+ readonly baseUrl: BaseUrl;
5092
+ /**
5093
+ * Publish a payload on the named channel.
5094
+ *
5095
+ * `resourceScope`, when set, marks the emit as a resource-scoped
5096
+ * broadcast — only delivered to subscribers attached to that
5097
+ * resource's scope.
5098
+ */
5099
+ emit<K extends keyof EventMap>(channel: K, payload: EventMap[K], resourceScope?: ResourceId): Promise<void>;
5100
+ on<K extends keyof EventMap>(channel: K, handler: (payload: EventMap[K]) => void): () => void;
5101
+ stream<K extends keyof EventMap>(channel: K): Observable<EventMap[K]>;
5102
+ /**
5103
+ * Subscribe to a resource-scoped channel set. HTTP attaches a scope to
5104
+ * its SSE connection; in-process transports may be a no-op because
5105
+ * local events are delivered without scoping.
5106
+ *
5107
+ * Returns a disposer that detaches the scope when the last subscriber
5108
+ * unsubscribes (ref-counted).
5109
+ */
5110
+ subscribeToResource(resourceId: ResourceId): () => void;
5111
+ /**
5112
+ * Hand the given bus to the transport so the transport can publish
5113
+ * the events it receives into it. The reference flows
5114
+ * client → transport (the client owns the bus); transports never
5115
+ * construct or replace it. Concrete transports decide what "receives"
5116
+ * means: HTTP bridges every channel it observes on its SSE wire;
5117
+ * an in-process transport bridges from the local actor bus.
5118
+ */
5119
+ bridgeInto(bus: EventBus): void;
5120
+ authenticatePassword(email: Email, password: string): Promise<AuthResponse>;
5121
+ authenticateGoogle(credential: GoogleCredential): Promise<AuthResponse>;
5122
+ refreshAccessToken(token: RefreshToken): Promise<TokenRefreshResponse>;
5123
+ logout(): Promise<void>;
5124
+ acceptTerms(): Promise<void>;
5125
+ getCurrentUser(): Promise<UserResponse>;
5126
+ generateMcpToken(): Promise<{
5127
+ token: string;
5128
+ }>;
5129
+ getMediaToken(resourceId: ResourceId): Promise<{
5130
+ token: string;
5131
+ }>;
5132
+ listUsers(): Promise<ListUsersResponse>;
5133
+ getUserStats(): Promise<AdminUserStatsResponse>;
5134
+ updateUser(id: UserDID, data: UpdateUserRequest): Promise<UpdateUserResponse>;
5135
+ getOAuthConfig(): Promise<OAuthConfigResponse>;
5136
+ backupKnowledgeBase(): Promise<Response>;
5137
+ restoreKnowledgeBase(file: File, onProgress?: ProgressCallback): Promise<ProgressEvent>;
5138
+ exportKnowledgeBase(params?: {
5139
+ includeArchived?: boolean;
5140
+ }): Promise<Response>;
5141
+ importKnowledgeBase(file: File, onProgress?: ProgressCallback): Promise<ProgressEvent>;
5142
+ healthCheck(): Promise<HealthCheckResponse>;
5143
+ getStatus(): Promise<StatusResponse>;
5144
+ /**
5145
+ * Transport-level connection state. For HTTP, reflects the SSE
5146
+ * connection's health; for in-process transports, typically `'open'`
5147
+ * from construction onward (no connection to lose).
5148
+ */
5149
+ readonly state$: Observable<ConnectionState>;
5150
+ dispose(): void;
5151
+ }
5152
+ interface PutBinaryRequest {
5153
+ name: string;
5154
+ file: File | Buffer;
5155
+ format: ContentFormat | string;
5156
+ storageUri: string;
5157
+ entityTypes?: string[];
5158
+ language?: string;
5159
+ creationMethod?: CreationMethod | string;
5160
+ sourceAnnotationId?: AnnotationId | string;
5161
+ sourceResourceId?: ResourceId | string;
5162
+ generationPrompt?: string;
5163
+ generator?: Agent$1 | Agent$1[];
5164
+ isDraft?: boolean;
5165
+ }
5166
+ interface IContentTransport {
5167
+ putBinary(request: PutBinaryRequest, options?: {
5168
+ auth?: AccessToken;
5169
+ }): Promise<{
5170
+ resourceId: ResourceId;
5171
+ }>;
5172
+ getBinary(resourceId: ResourceId, options?: {
5173
+ accept?: ContentFormat | string;
5174
+ auth?: AccessToken;
5175
+ }): Promise<{
5176
+ data: ArrayBuffer;
5177
+ contentType: string;
5178
+ }>;
5179
+ getBinaryStream(resourceId: ResourceId, options?: {
5180
+ accept?: ContentFormat | string;
5181
+ auth?: AccessToken;
5182
+ }): Promise<{
5183
+ stream: ReadableStream<Uint8Array>;
5184
+ contentType: string;
5185
+ }>;
5186
+ dispose(): void;
5187
+ }
5188
+
5189
+ /**
5190
+ * BRIDGED_CHANNELS
5191
+ *
5192
+ * The set of bus channels that any concrete transport bridges into the
5193
+ * caller-supplied bus via `bridgeInto`. Transport-neutral: every concrete
5194
+ * `ITransport` shares the same set; HTTP delivers them via SSE,
5195
+ * in-process transports forward them directly from the local actor bus.
5196
+ *
5197
+ * Note: this is the *fan-in* set — channels for events the transport
5198
+ * receives and pushes onto the client's bus. It is not the same as the
5199
+ * channels the client emits (which is open-ended).
5200
+ *
5201
+ * Resource-scoped channels (joined/left via `subscribeToResource`) are
5202
+ * tracked separately by transports that care about scope (HTTP).
5203
+ */
5204
+ declare const BRIDGED_CHANNELS: readonly ["browse:resources-result", "browse:resources-failed", "browse:resource-result", "browse:resource-failed", "browse:annotations-result", "browse:annotations-failed", "browse:annotation-result", "browse:annotation-failed", "browse:annotation-history-result", "browse:annotation-history-failed", "browse:events-result", "browse:events-failed", "browse:referenced-by-result", "browse:referenced-by-failed", "browse:entity-types-result", "browse:entity-types-failed", "browse:directory-result", "browse:directory-failed", "browse:annotation-context-result", "browse:annotation-context-failed", "mark:delete-ok", "mark:delete-failed", "mark:create-ok", "mark:create-failed", "match:search-results", "match:search-failed", "gather:complete", "gather:failed", "gather:annotation-progress", "gather:annotation-finished", "gather:summary-result", "gather:summary-failed", "bind:body-updated", "bind:body-update-failed", "job:report-progress", "job:complete", "job:fail", "job:status-result", "job:status-failed", "job:created", "job:create-failed", "job:claimed", "job:claim-failed", "yield:clone-token-generated", "yield:clone-token-failed", "yield:clone-resource-result", "yield:clone-resource-failed", "yield:clone-created", "yield:clone-create-failed", "mark:entity-type-added", "beckon:focus", "beckon:sparkle", "bus:resume-gap"];
5205
+ type BridgedChannel = typeof BRIDGED_CHANNELS[number];
5206
+
5207
+ /**
5208
+ * Fuzzy Anchoring for W3C Web Annotation TextQuoteSelector
5209
+ *
5210
+ * Uses prefix/suffix context to disambiguate when the same text appears multiple times.
5211
+ * Implements fuzzy matching as specified in the W3C Web Annotation Data Model.
5212
+ *
5213
+ * @see https://www.w3.org/TR/annotation-model/#text-quote-selector
5214
+ */
5215
+ interface TextPosition {
5216
+ start: number;
5217
+ end: number;
5218
+ }
5219
+ type MatchQuality = 'exact' | 'normalized' | 'case-insensitive' | 'fuzzy';
5220
+ /**
5221
+ * Normalize text for comparison - handles common document editing changes
5222
+ *
5223
+ * Collapses whitespace, converts curly quotes to straight quotes,
5224
+ * and normalizes common punctuation variations.
5225
+ */
5226
+ declare function normalizeText(text: string): string;
5227
+ /**
5228
+ * Pre-computed content strings for batch fuzzy matching.
5229
+ * Avoids recomputing normalizeText(content) and content.toLowerCase()
5230
+ * for every annotation when processing many annotations against the same content.
5231
+ */
5232
+ interface ContentCache {
5233
+ normalizedContent: string;
5234
+ lowerContent: string;
5235
+ }
5236
+ /**
5237
+ * Build a ContentCache for a given content string.
5238
+ * Call once per content, pass to findBestTextMatch/findTextWithContext for all annotations.
5239
+ */
5240
+ declare function buildContentCache(content: string): ContentCache;
5241
+ /**
5242
+ * Find best match for text in content using multi-strategy search
5243
+ *
5244
+ * Shared core logic used by both findTextWithContext and validateAndCorrectOffsets.
5245
+ *
5246
+ * @param content - Full text content to search within
5247
+ * @param searchText - The text to find
5248
+ * @param positionHint - Hint for where to search (TextPositionSelector.start)
5249
+ * @param cache - Pre-computed normalized/lowered content (from buildContentCache)
5250
+ * @returns Match with position and quality, or null if not found
5251
+ */
5252
+ declare function findBestTextMatch(content: string, searchText: string, positionHint: number | undefined, cache: ContentCache): {
5253
+ start: number;
5254
+ end: number;
5255
+ matchQuality: MatchQuality;
5256
+ } | null;
5257
+ /**
5258
+ * Find text using exact match with optional prefix/suffix context
5259
+ *
5260
+ * When the exact text appears multiple times in the content, prefix and suffix
5261
+ * are used to disambiguate and find the correct occurrence.
5262
+ *
5263
+ * If exact text is not found, uses multi-strategy fuzzy matching (normalization,
5264
+ * case-insensitive, Levenshtein distance) to locate changed text.
5265
+ *
5266
+ * @param content - Full text content to search within
5267
+ * @param exact - The exact text to find
5268
+ * @param prefix - Optional text that should appear immediately before the match
5269
+ * @param suffix - Optional text that should appear immediately after the match
5270
+ * @param positionHint - Optional position hint (from TextPositionSelector) for fuzzy search
5271
+ * @returns Position of the matched text, or null if not found
5272
+ *
5273
+ * @example
5274
+ * ```typescript
5275
+ * const content = "The cat sat. The cat ran.";
5276
+ * // Find second "The cat" occurrence
5277
+ * const pos = findTextWithContext(content, "The cat", "sat. ", " ran");
5278
+ * // Returns { start: 13, end: 20 }
5279
+ * ```
5280
+ */
5281
+ declare function findTextWithContext(content: string, exact: string, prefix: string | undefined, suffix: string | undefined, positionHint: number | undefined, cache: ContentCache): TextPosition | null;
5282
+ /**
5283
+ * Verify that a position correctly points to the exact text
5284
+ * Useful for debugging and validation
5285
+ */
5286
+ declare function verifyPosition(content: string, position: TextPosition, expectedExact: string): boolean;
5287
+
5288
+ /**
5289
+ * Locale information
5290
+ * Copied from SDK for frontend use
5291
+ */
5292
+ interface LocaleInfo {
5293
+ code: string;
5294
+ nativeName: string;
5295
+ englishName: string;
5296
+ }
5297
+ declare const LOCALES: readonly LocaleInfo[];
5298
+ /**
5299
+ * Get locale information by code
5300
+ */
5301
+ declare function getLocaleInfo(code: string | undefined): LocaleInfo | undefined;
5302
+ /**
5303
+ * Get the native name of a language by its locale code
5304
+ */
5305
+ declare function getLocaleNativeName(code: string | undefined): string | undefined;
5306
+ /**
5307
+ * Get the English name of a language by its locale code
5308
+ */
5309
+ declare function getLocaleEnglishName(code: string | undefined): string | undefined;
5310
+ /**
5311
+ * Format locale code for display as "Native Name (code)"
5312
+ */
5313
+ declare function formatLocaleDisplay(code: string | undefined): string | undefined;
5314
+ /**
5315
+ * Get all supported locale codes
5316
+ */
5317
+ declare function getAllLocaleCodes(): readonly string[];
5318
+
5319
+ /**
5320
+ * SVG Utility Functions
5321
+ *
5322
+ * Utilities for creating, parsing, and manipulating W3C-compliant SVG selectors
5323
+ * for image annotation.
5324
+ */
5325
+ interface Point {
5326
+ x: number;
5327
+ y: number;
5328
+ }
5329
+ interface BoundingBox {
5330
+ x: number;
5331
+ y: number;
5332
+ width: number;
5333
+ height: number;
5334
+ }
5335
+ /**
5336
+ * Create W3C-compliant SVG rectangle selector
5337
+ */
5338
+ declare function createRectangleSvg(start: Point, end: Point): string;
5339
+ /**
5340
+ * Create W3C-compliant SVG polygon selector
5341
+ */
5342
+ declare function createPolygonSvg(points: Point[]): string;
5343
+ /**
5344
+ * Create W3C-compliant SVG circle selector
5345
+ */
5346
+ declare function createCircleSvg(center: Point, radius: number): string;
5347
+ /**
5348
+ * Parse SVG selector to extract shape type and data
5349
+ */
5350
+ declare function parseSvgSelector(svg: string): {
5351
+ type: 'rect' | 'polygon' | 'circle' | 'path';
5352
+ data: any;
5353
+ } | null;
5354
+ /**
5355
+ * Normalize coordinates from display space to image native resolution
5356
+ */
5357
+ declare function normalizeCoordinates(point: Point, displayWidth: number, displayHeight: number, imageWidth: number, imageHeight: number): Point;
5358
+ /**
5359
+ * Scale entire SVG selector from display space to image native resolution
5360
+ */
5361
+ declare function scaleSvgToNative(svg: string, displayWidth: number, displayHeight: number, imageWidth: number, imageHeight: number): string;
5362
+
5363
+ /**
5364
+ * Text context extraction utilities for W3C Web Annotation TextQuoteSelector
5365
+ *
5366
+ * Provides robust prefix/suffix context extraction with word boundary detection
5367
+ * to ensure fuzzy anchoring works correctly when the same text appears multiple times.
5368
+ *
5369
+ * Also provides AI offset validation and correction for handling AI-generated annotations
5370
+ * where the model may return slightly incorrect character offsets.
5371
+ *
5372
+ * @see https://www.w3.org/TR/annotation-model/#text-quote-selector
5373
+ */
5374
+
5375
+ /**
5376
+ * Extract prefix and suffix context for TextQuoteSelector
5377
+ *
5378
+ * Extracts up to 64 characters before and after the selected text,
5379
+ * extending to word boundaries to avoid cutting words in half.
5380
+ * This ensures prefix/suffix are meaningful context for fuzzy anchoring.
5381
+ *
5382
+ * @param content - Full text content
5383
+ * @param start - Start offset of selection
5384
+ * @param end - End offset of selection
5385
+ * @returns Object with prefix and suffix (undefined if at boundaries)
5386
+ *
5387
+ * @example
5388
+ * ```typescript
5389
+ * const content = "The United States Congress...";
5390
+ * const context = extractContext(content, 4, 17); // "United States"
5391
+ * // Returns: { prefix: "The ", suffix: " Congress..." }
5392
+ * // NOT: { prefix: "nited ", suffix: "gress..." }
5393
+ * ```
5394
+ */
5395
+ declare function extractContext(content: string, start: number, end: number): {
5396
+ prefix?: string;
5397
+ suffix?: string;
5398
+ };
5399
+ /**
5400
+ * Result of validating and correcting AI-provided annotation offsets
5401
+ */
5402
+ interface ValidatedAnnotation {
5403
+ start: number;
5404
+ end: number;
5405
+ exact: string;
5406
+ prefix?: string;
5407
+ suffix?: string;
5408
+ corrected: boolean;
5409
+ fuzzyMatched?: boolean;
5410
+ matchQuality?: MatchQuality;
5411
+ }
5412
+ /**
5413
+ * Validate and correct AI-provided annotation offsets with fuzzy matching tolerance
5414
+ *
5415
+ * AI models sometimes return offsets that don't match the actual text position,
5416
+ * or provide text with minor variations (case differences, whitespace, typos).
5417
+ *
5418
+ * This function uses a multi-strategy approach:
5419
+ * 1. Check if AI's offsets are exactly correct
5420
+ * 2. Try exact case-sensitive search
5421
+ * 3. Try case-insensitive search
5422
+ * 4. Try fuzzy matching with Levenshtein distance (5% tolerance)
5423
+ *
5424
+ * This ensures we're maximally tolerant of AI errors while still maintaining
5425
+ * annotation quality and logging what corrections were made.
5426
+ *
5427
+ * @param content - Full text content
5428
+ * @param aiStart - Start offset from AI
5429
+ * @param aiEnd - End offset from AI
5430
+ * @param exact - The exact text that should be at this position (from AI)
5431
+ * @returns Validated annotation with corrected offsets and context
5432
+ * @throws Error if no acceptable match can be found
5433
+ *
5434
+ * @example
5435
+ * ```typescript
5436
+ * // AI said start=1143, but actual text is at 1161
5437
+ * const result = validateAndCorrectOffsets(
5438
+ * content,
5439
+ * 1143,
5440
+ * 1289,
5441
+ * "the question \"whether..."
5442
+ * );
5443
+ * // Returns: { start: 1161, end: 1303, exact: "...", corrected: true, matchQuality: 'exact', ... }
5444
+ * ```
5445
+ */
5446
+ declare function validateAndCorrectOffsets(content: string, aiStart: number, aiEnd: number, exact: string): ValidatedAnnotation;
5447
+
5448
+ /**
5449
+ * Text encoding utilities for consistent charset handling
5450
+ *
5451
+ * Ensures frontend decoding matches backend decoding by respecting
5452
+ * charset parameters in mediaType (e.g., "text/plain; charset=iso-8859-1")
5453
+ */
5454
+ /**
5455
+ * Extract charset from mediaType parameter
5456
+ *
5457
+ * @param mediaType - Media type with optional charset (e.g., "text/plain; charset=utf-8")
5458
+ * @returns Charset name in lowercase (defaults to "utf-8")
5459
+ *
5460
+ * @example
5461
+ * extractCharset("text/plain; charset=iso-8859-1") // "iso-8859-1"
5462
+ * extractCharset("text/plain") // "utf-8"
5463
+ */
5464
+ declare function extractCharset(mediaType: string): string;
5465
+ /**
5466
+ * Decode ArrayBuffer to string using charset from mediaType
5467
+ *
5468
+ * Uses TextDecoder with the charset extracted from mediaType parameter.
5469
+ * This ensures the same character space is used for both annotation creation
5470
+ * (backend) and rendering (frontend).
5471
+ *
5472
+ * @param buffer - Binary data to decode
5473
+ * @param mediaType - Media type with optional charset parameter
5474
+ * @returns Decoded string in the original character space
5475
+ *
5476
+ * @example
5477
+ * const buffer = new Uint8Array([...]);
5478
+ * const text = decodeWithCharset(buffer, "text/plain; charset=iso-8859-1");
5479
+ */
5480
+ declare function decodeWithCharset(buffer: ArrayBuffer, mediaType: string): string;
5481
+
5482
+ /**
5483
+ * Generic validation utilities for @semiont/api-client
5484
+ *
5485
+ * Pure TypeScript validation with no external dependencies.
5486
+ * Safe to use in any JavaScript environment (Node.js, browser, Deno, etc.)
5487
+ */
5488
+ /**
5489
+ * Validation result types
5490
+ */
5491
+ type ValidationSuccess<T> = {
5492
+ success: true;
5493
+ data: T;
5494
+ };
5495
+ type ValidationFailure = {
5496
+ success: false;
5497
+ error: string;
5498
+ details?: string[];
5499
+ };
5500
+ type ValidationResult<T> = ValidationSuccess<T> | ValidationFailure;
5501
+ /**
5502
+ * JWT Token validation
5503
+ *
5504
+ * Validates JWT token format (header.payload.signature).
5505
+ * Does not verify signature - use for format validation only.
5506
+ */
5507
+ declare const JWTTokenSchema: {
5508
+ parse(token: unknown): string;
5509
+ safeParse(token: unknown): ValidationResult<string>;
5510
+ };
5511
+ /**
5512
+ * Generic validation helper with error formatting
5513
+ *
5514
+ * Wraps any schema's parse method with try/catch and returns ValidationResult.
5515
+ *
5516
+ * @example
5517
+ * ```typescript
5518
+ * const result = validateData(JWTTokenSchema, 'eyJ...');
5519
+ * if (result.success) {
5520
+ * console.log('Valid token:', result.data);
5521
+ * } else {
5522
+ * console.error('Invalid:', result.error);
5523
+ * }
5524
+ * ```
5525
+ */
5526
+ declare function validateData<T>(schema: {
5527
+ parse(data: unknown): T;
5528
+ }, data: unknown): ValidationResult<T>;
5529
+ /**
5530
+ * Email validation helper
5531
+ *
5532
+ * Validates email format using RFC 5322 simplified regex.
5533
+ *
5534
+ * @param email - Email address to validate
5535
+ * @returns true if valid email format
5536
+ */
5537
+ declare function isValidEmail(email: string): boolean;
5538
+
5539
+ /**
5540
+ * MIME type utilities for Semiont
5541
+ *
5542
+ * Initial support for:
5543
+ * - text/plain
5544
+ * - text/markdown
5545
+ * - image/png
5546
+ * - image/jpeg
5547
+ * - application/pdf
5548
+ */
5549
+ /**
5550
+ * Map MIME type to file extension
5551
+ */
5552
+ declare function getExtensionForMimeType(mimeType: string): string;
5553
+ /**
5554
+ * Detect if MIME type is an image (png or jpeg only for now)
5555
+ */
5556
+ declare function isImageMimeType(mimeType: string): boolean;
5557
+ /**
5558
+ * Detect if MIME type is text-based (plain or markdown only for now)
5559
+ */
5560
+ declare function isTextMimeType(mimeType: string): boolean;
5561
+ /**
5562
+ * Detect if MIME type is PDF
5563
+ */
5564
+ declare function isPdfMimeType(mimeType: string): boolean;
5565
+ /**
5566
+ * Get category for MIME type (for routing to appropriate viewer)
5567
+ *
5568
+ * Categories represent annotation models, not file formats:
5569
+ * - 'text': Text-based annotations (TextPositionSelector, TextQuoteSelector)
5570
+ * - 'image': Spatial coordinate annotations (SvgSelector, FragmentSelector)
5571
+ *
5572
+ * PDFs use spatial coordinates for annotations, so they belong to 'image' category.
5573
+ */
5574
+ type MimeCategory = 'text' | 'image' | 'unsupported';
5575
+ declare function getMimeCategory(mimeType: string): MimeCategory;
4708
5576
 
4709
5577
  /**
4710
5578
  * Resource input/output types
@@ -4721,20 +5589,6 @@ interface ResourceFilter {
4721
5589
  offset?: number;
4722
5590
  }
4723
5591
 
4724
- /**
4725
- * Annotation types
4726
- */
4727
-
4728
- type Annotation = components['schemas']['Annotation'];
4729
- type AnnotationCategory = 'highlight' | 'reference';
4730
- interface CreateAnnotationInternal {
4731
- id: string;
4732
- motivation: Annotation['motivation'];
4733
- target: Annotation['target'];
4734
- body?: Annotation['body'];
4735
- creator: components['schemas']['Agent'];
4736
- }
4737
-
4738
5592
  /**
4739
5593
  * Auth types
4740
5594
  */
@@ -5031,4 +5885,4 @@ declare function getAllPlatformTypes(): PlatformType[];
5031
5885
  declare const CORE_TYPES_VERSION = "0.1.0";
5032
5886
  declare const SDK_VERSION = "0.1.0";
5033
5887
 
5034
- export { APIError, type AccessToken, type AnnotationCategory, type AnnotationId, type AnnotationUri, type AssembledAnnotation, type AuthCode, type BaseUrl, type BodyItem, type BodyItemIdentity, type BodyOperation, type Brand, type BurstBufferOptions, CHANNEL_SCHEMAS, CORE_TYPES_VERSION, CREATION_METHODS, type CloneToken, ConfigurationError, ConflictError, type ContentFormat, type CreateAnnotationInternal, type CreationMethod, type Email, type EmittableChannel, type EntityType, type EntityTypeStats, type Environment, EnvironmentConfig, type EventBase, EventBus, type EventInput, type EventMap, type EventMetadata, type EventName, type EventOfType, type EventQuery, type EventSignature, type GatheredContext, type GoogleAuthRequest, type GoogleCredential, type GraphConnection, type GraphPath, type JobId, type Logger, type MCPToken, type Motivation, NotFoundError, PERSISTED_EVENT_TYPES, type PersistedEvent, type PersistedEventType, type PlatformType, RESOURCE_BROADCAST_TYPES, type RefreshToken, type ResourceAnnotationUri, type ResourceAnnotations, type ResourceBroadcastType, type ResourceFilter, type ResourceId, type ResourceUri, SDK_VERSION, ScopedEventBus, ScriptError, type SearchQuery, type SelectionData, type Selector, SemiontError, type StoredEvent, type StoredEventLike, type ActorInferenceConfig as TomlActorInferenceConfig, type TomlFileReader, type InferenceConfig as TomlInferenceConfig, type WorkerInferenceConfig as TomlWorkerInferenceConfig, UnauthorizedError, type UpdateResourceInput, type UserDID, type UserId, ValidationError, accessToken, annotationId, annotationUri, applyBodyOperations, assembleAnnotation, authCode, baseUrl, burstBuffer, cloneToken, type components, createTomlConfigLoader, didToAgent, email, entityType, errField, findBodyItem, generateUuid, getAllPlatformTypes, getAnnotationUriFromEvent, getFragmentSelector, getSvgSelector, getTextPositionSelector, googleCredential, isAnnotationId, isArray, isBoolean, isDefined, isEventRelatedToAnnotation, isFunction, isNull, isNullish, isNumber, isObject, isResourceId, isStoredEvent, isString, isUndefined, isValidPlatformType, jobId, loadTomlConfig, mcpToken, type operations, parseEnvironment, type paths, refreshToken, resourceAnnotationUri, resourceId, resourceUri, searchQuery, serializePerKey, userDID, userId, userToAgent, userToDid, validateEnvironment, validateSvgMarkup };
5888
+ export { APIError, type AccessToken, type Annotation, type AnnotationCategory, type AnnotationId, type AnnotationUri, type AssembledAnnotation, type AuthCode, BRIDGED_CHANNELS, type BaseUrl, type BodyItem, type BodyItemIdentity, type BodyOperation, type BoundingBox, type Brand, type BridgedChannel, type BurstBufferOptions, type BusOp, CHANNEL_SCHEMAS, CORE_TYPES_VERSION, CREATION_METHODS, type CloneToken, ConfigurationError, ConflictError, type ConnectionState, type ContentCache, type ContentFormat, type CreateAnnotationInternal, type CreationMethod, type Email, type EmittableChannel, type EntityType, type EntityTypeStats, type Environment, EnvironmentConfig, type EventBase, EventBus, type EventInput, type EventMap, type EventMetadata, type EventName, type EventOfType, type EventQuery, type EventSignature, type FragmentSelector, type GatheredContext, type GoogleAuthRequest, type GoogleCredential, type GraphConnection, type GraphPath, type HealthCheckResponse, type IContentTransport, type ITransport, JWTTokenSchema, type JobId, LOCALES, type ListUsersResponse, type LocaleInfo, type Logger, type MCPToken, type MatchQuality, type MimeCategory, type Motivation, NotFoundError, PERSISTED_EVENT_TYPES, type PersistedEvent, type PersistedEventType, type PlatformType, type Point, type ProgressCallback, type ProgressEvent, type PutBinaryRequest, RESOURCE_BROADCAST_TYPES, type RefreshToken, type ResourceAnnotationUri, type ResourceAnnotations, type ResourceBroadcastType, type ResourceDescriptor, type ResourceFilter, type ResourceId, type ResourceUri, SDK_VERSION, ScopedEventBus, ScriptError, type SearchQuery, type SelectionData, type Selector, SemiontError, type StatusResponse, type StoredEvent, type StoredEventLike, type SvgSelector, type TextPosition, type TextPositionSelector, type TextQuoteSelector, type ActorInferenceConfig as TomlActorInferenceConfig, type TomlFileReader, type InferenceConfig as TomlInferenceConfig, type WorkerInferenceConfig as TomlWorkerInferenceConfig, UnauthorizedError, type UpdateResourceInput, type UpdateUserRequest, type UpdateUserResponse, type UserDID, type UserId, type UserResponse, type ValidatedAnnotation, ValidationError, type ValidationFailure, type ValidationResult, type ValidationSuccess, accessToken, annotationId, annotationUri, applyBodyOperations, assembleAnnotation, authCode, baseUrl, buildContentCache, burstBuffer, busLog, busLogEnabled, cloneToken, type components, createCircleSvg, createPolygonSvg, createRectangleSvg, createTomlConfigLoader, decodeRepresentation, decodeWithCharset, didToAgent, email, entityType, errField, extractBoundingBox, extractCharset, extractContext, findBestTextMatch, findBodyItem, findTextWithContext, formatLocaleDisplay, generateUuid, getAllLocaleCodes, getAllPlatformTypes, getAnnotationExactText, getAnnotationUriFromEvent, getBodySource, getBodyType, getChecksum, getCommentText, getCreator, getDerivedFrom, getExactText, getExtensionForMimeType, getFragmentSelector, getLanguage, getLocaleEnglishName, getLocaleInfo, getLocaleNativeName, getMimeCategory, getNodeEncoding, getPrimaryMediaType, getPrimaryRepresentation, getPrimarySelector, getResourceEntityTypes, getResourceId, getStorageUri, getSvgSelector, getTargetSelector, getTargetSource, getTextPositionSelector, getTextQuoteSelector, googleCredential, hasTargetSelector, isAnnotationId, isArchived, isArray, isAssessment, isBodyResolved, isBoolean, isComment, isDefined, isDraft, isEventRelatedToAnnotation, isFunction, isHighlight, isImageMimeType, isNull, isNullish, isNumber, isObject, isPdfMimeType, isReference, isResolvedReference, isResourceId, isStoredEvent, isString, isStubReference, isTag, isTextMimeType, isUndefined, isValidEmail, isValidPlatformType, jobId, loadTomlConfig, mcpToken, normalizeCoordinates, normalizeText, type operations, parseEnvironment, parseSvgSelector, type paths, refreshToken, resourceAnnotationUri, resourceId, resourceUri, scaleSvgToNative, searchQuery, serializePerKey, setBusLogTraceIdProvider, userDID, userId, userToAgent, userToDid, validateAndCorrectOffsets, validateData, validateEnvironment, validateSvgMarkup, verifyPosition };