@semiont/api-client 0.2.45 → 0.3.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/README.md CHANGED
@@ -8,7 +8,12 @@
8
8
 
9
9
  TypeScript SDK for [Semiont](https://github.com/The-AI-Alliance/semiont) - a knowledge management system for semantic annotations, AI-powered annotation detection, and collaborative document analysis.
10
10
 
11
- This package provides the HTTP client, SSE streams, and utilities for working with the Semiont API. OpenAPI types are re-exported from [`@semiont/core`](../core/README.md) (the source of truth).
11
+ This package provides two clients, SSE streams, and utilities for working with Semiont:
12
+
13
+ - **`SemiontApiClient`** — HTTP client for the Semiont REST API
14
+ - **`EventBusClient`** — Direct EventBus client (no HTTP needed)
15
+
16
+ OpenAPI types are re-exported from [`@semiont/core`](../core/README.md) (the source of truth).
12
17
 
13
18
  ## What is Semiont?
14
19
 
@@ -74,6 +79,34 @@ const annotations = await client.getResourceAnnotations(resourceUri(resource['@i
74
79
  console.log('Annotations:', annotations.annotations.length);
75
80
  ```
76
81
 
82
+ ## EventBus Client (No HTTP)
83
+
84
+ The `EventBusClient` communicates directly via the RxJS EventBus — no HTTP server needed. It covers all knowledge-domain operations (resource reads, annotations, entity types, search, LLM context, clone tokens, job status).
85
+
86
+ ```typescript
87
+ import { EventBusClient } from '@semiont/api-client';
88
+ import { EventBus, resourceId } from '@semiont/core';
89
+ import { startMakeMeaning } from '@semiont/make-meaning';
90
+
91
+ // Start the knowledge system
92
+ const eventBus = new EventBus();
93
+ const makeMeaning = await startMakeMeaning(config, eventBus, logger);
94
+
95
+ // Use EventBusClient instead of SemiontApiClient
96
+ const client = new EventBusClient(eventBus);
97
+
98
+ // Same operations, no HTTP
99
+ const resources = await client.listResources({ limit: 10 });
100
+ const resource = await client.getResource(resourceId('doc-123'));
101
+ const annotations = await client.getAnnotations(resourceId('doc-123'));
102
+ const entityTypes = await client.listEntityTypes();
103
+ const results = await client.searchResources('quantum computing');
104
+ ```
105
+
106
+ **What's covered**: All browse, bind, mark, gather, yield (clone), and job operations.
107
+
108
+ **What's NOT covered** (HTTP-only): Auth, admin, health/status, binary content upload/download, SSE streaming.
109
+
77
110
  ## Logging
78
111
 
79
112
  Enable logging to debug requests and monitor API usage:
@@ -112,6 +145,7 @@ const client = new SemiontApiClient({
112
145
 
113
146
  ## Key Features
114
147
 
148
+ - **Two clients** - HTTP (`SemiontApiClient`) and EventBus (`EventBusClient`) for the same operations
115
149
  - **Type-safe** - Re-exports OpenAPI types from `@semiont/core` with branded types
116
150
  - **W3C compliant** - Web Annotation standard with fuzzy text matching
117
151
  - **Real-time** - SSE streaming for long operations
@@ -122,12 +156,16 @@ const client = new SemiontApiClient({
122
156
 
123
157
  ## Use Cases
124
158
 
125
- - ✅ MCP servers and AI integrations
126
- - Frontend applications (wrap with React hooks)
127
- - CLI tools and automation scripts
128
- - Third-party integrations
159
+ **SemiontApiClient (HTTP)**:
160
+ - MCP servers and AI integrations
161
+ - Frontend applications (wrap with React hooks)
162
+ - CLI tools and automation scripts
163
+ - Third-party integrations
129
164
 
130
- **Not for backend internal code** - Use [`@semiont/core`](../core/) instead
165
+ **EventBusClient (direct)**:
166
+ - Scripts that run alongside make-meaning (no HTTP server)
167
+ - Testing without HTTP overhead
168
+ - Embedded scenarios where EventBus is available directly
131
169
 
132
170
  ## License
133
171
 
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as _semiont_core from '@semiont/core';
2
- import { EntityType, BaseUrl, Logger, ResourceUri, AccessToken, AnnotationUri, components, Email, paths, RefreshToken, GoogleCredential, ContentFormat, SearchQuery, CloneToken, ResourceAnnotationUri, Motivation, UserDID, JobId } from '@semiont/core';
3
- export { Logger } from '@semiont/core';
4
- export { BoundingBox, ContentCache, FragmentSelector, JWTTokenSchema, LOCALES, LocaleInfo, MatchQuality, Point, Selector, SvgSelector, TextPosition, TextPositionSelector, TextQuoteSelector, ValidatedAnnotation, ValidationFailure, ValidationResult, ValidationSuccess, buildContentCache, createCircleSvg, createPolygonSvg, createRectangleSvg, decodeRepresentation, decodeWithCharset, extractBoundingBox, extractCharset, extractContext, findBestTextMatch, findTextWithContext, formatLocaleDisplay, getAllLocaleCodes, getAnnotationExactText, getBodySource, getBodyType, getChecksum, getCommentText, getCreator, getDerivedFrom, getExactText, getFragmentSelector, getLanguage, getLocaleEnglishName, getLocaleInfo, getLocaleNativeName, getNodeEncoding, getPrimaryMediaType, getPrimaryRepresentation, getPrimarySelector, getResourceEntityTypes, getResourceId, getStorageUri, getSvgSelector, getTargetSelector, getTargetSource, getTextPositionSelector, getTextQuoteSelector, hasTargetSelector, isArchived, isAssessment, isBodyResolved, isComment, isDraft, isHighlight, isReference, isResolvedReference, isStubReference, isTag, isValidEmail, normalizeCoordinates, normalizeText, parseSvgSelector, scaleSvgToNative, validateAndCorrectOffsets, validateData, validateSvgMarkup, verifyPosition } from './utils/index.js';
2
+ import { EntityType, GatheredContext, BaseUrl, Logger, ResourceId, AccessToken, AnnotationId, components, Email, paths, RefreshToken, GoogleCredential, ContentFormat, SearchQuery, CloneToken, Motivation, UserDID, JobId, EventBus, UserId } from '@semiont/core';
3
+ export { Logger, Selector, getFragmentSelector, getSvgSelector, getTextPositionSelector, validateSvgMarkup } from '@semiont/core';
4
+ export { BoundingBox, ContentCache, FragmentSelector, JWTTokenSchema, LOCALES, LocaleInfo, MatchQuality, Point, SvgSelector, TextPosition, TextPositionSelector, TextQuoteSelector, ValidatedAnnotation, ValidationFailure, ValidationResult, ValidationSuccess, buildContentCache, createCircleSvg, createPolygonSvg, createRectangleSvg, decodeRepresentation, decodeWithCharset, extractBoundingBox, extractCharset, extractContext, findBestTextMatch, findTextWithContext, formatLocaleDisplay, getAllLocaleCodes, getAnnotationExactText, getBodySource, getBodyType, getChecksum, getCommentText, getCreator, getDerivedFrom, getExactText, getLanguage, getLocaleEnglishName, getLocaleInfo, getLocaleNativeName, getNodeEncoding, getPrimaryMediaType, getPrimaryRepresentation, getPrimarySelector, getResourceEntityTypes, getResourceId, getStorageUri, getTargetSelector, getTargetSource, getTextQuoteSelector, hasTargetSelector, isArchived, isAssessment, isBodyResolved, isComment, isDraft, isHighlight, isReference, isResolvedReference, isStubReference, isTag, isValidEmail, normalizeCoordinates, normalizeText, parseSvgSelector, scaleSvgToNative, validateAndCorrectOffsets, validateData, verifyPosition } from './utils/index.js';
5
5
 
6
6
  /**
7
7
  * TypeScript types for Server-Sent Events (SSE) streaming
@@ -185,6 +185,15 @@ interface AnnotateTagsStreamRequest {
185
185
  schemaId: string;
186
186
  categories: string[];
187
187
  }
188
+ /**
189
+ * Request body for bind search stream
190
+ */
191
+ interface BindSearchStreamRequest {
192
+ referenceId: string;
193
+ context: GatheredContext;
194
+ limit?: number;
195
+ useSemanticScoring?: boolean;
196
+ }
188
197
  /**
189
198
  * SSE Client configuration
190
199
  */
@@ -233,14 +242,6 @@ declare class SSEClient {
233
242
  * Get common headers for SSE requests
234
243
  */
235
244
  private getHeaders;
236
- /**
237
- * Extract resource ID from URI
238
- *
239
- * Handles both full URIs and plain IDs:
240
- * - 'http://localhost:4000/resources/doc-123' -> 'doc-123'
241
- * - 'doc-123' -> 'doc-123'
242
- */
243
- private extractId;
244
245
  /**
245
246
  * Detect annotations in a resource (streaming)
246
247
  *
@@ -276,7 +277,7 @@ declare class SSEClient {
276
277
  * stream.close();
277
278
  * ```
278
279
  */
279
- annotateReferences(resourceId: ResourceUri, request: AnnotateReferencesStreamRequest, options: SSERequestOptions): SSEStream;
280
+ annotateReferences(resourceId: ResourceId, request: AnnotateReferencesStreamRequest, options: SSERequestOptions): SSEStream;
280
281
  /**
281
282
  * Generate resource from annotation (streaming)
282
283
  *
@@ -314,7 +315,7 @@ declare class SSEClient {
314
315
  * stream.close();
315
316
  * ```
316
317
  */
317
- yieldResourceFromAnnotation(resourceId: ResourceUri, annotationId: AnnotationUri, request: YieldResourceStreamRequest, options: SSERequestOptions): SSEStream;
318
+ yieldResourceFromAnnotation(resourceId: ResourceId, annotationId: AnnotationId, request: YieldResourceStreamRequest, options: SSERequestOptions): SSEStream;
318
319
  /**
319
320
  * Detect highlights in a resource (streaming)
320
321
  *
@@ -350,7 +351,7 @@ declare class SSEClient {
350
351
  * stream.close();
351
352
  * ```
352
353
  */
353
- annotateHighlights(resourceId: ResourceUri, request: AnnotateHighlightsStreamRequest | undefined, options: SSERequestOptions): SSEStream;
354
+ annotateHighlights(resourceId: ResourceId, request: AnnotateHighlightsStreamRequest | undefined, options: SSERequestOptions): SSEStream;
354
355
  /**
355
356
  * Detect assessments in a resource (streaming)
356
357
  *
@@ -386,7 +387,7 @@ declare class SSEClient {
386
387
  * stream.close();
387
388
  * ```
388
389
  */
389
- annotateAssessments(resourceId: ResourceUri, request: AnnotateAssessmentsStreamRequest | undefined, options: SSERequestOptions): SSEStream;
390
+ annotateAssessments(resourceId: ResourceId, request: AnnotateAssessmentsStreamRequest | undefined, options: SSERequestOptions): SSEStream;
390
391
  /**
391
392
  * Detect comments in a resource (streaming)
392
393
  *
@@ -426,7 +427,7 @@ declare class SSEClient {
426
427
  * stream.close();
427
428
  * ```
428
429
  */
429
- annotateComments(resourceId: ResourceUri, request: AnnotateCommentsStreamRequest | undefined, options: SSERequestOptions): SSEStream;
430
+ annotateComments(resourceId: ResourceId, request: AnnotateCommentsStreamRequest | undefined, options: SSERequestOptions): SSEStream;
430
431
  /**
431
432
  * Detect tags in a resource (streaming)
432
433
  *
@@ -467,7 +468,19 @@ declare class SSEClient {
467
468
  * stream.close();
468
469
  * ```
469
470
  */
470
- annotateTags(resourceId: ResourceUri, request: AnnotateTagsStreamRequest, options: SSERequestOptions): SSEStream;
471
+ annotateTags(resourceId: ResourceId, request: AnnotateTagsStreamRequest, options: SSERequestOptions): SSEStream;
472
+ /**
473
+ * Search for binding candidates (streaming)
474
+ *
475
+ * Bridges bind:search-requested to the backend Binder actor via SSE.
476
+ * Results emit as bind:search-results on the browser EventBus.
477
+ *
478
+ * @param resourceId - Resource the annotation belongs to
479
+ * @param request - Search configuration (referenceId, context, limit)
480
+ * @param options - Request options (auth token, eventBus)
481
+ * @returns SSE stream controller
482
+ */
483
+ bindSearch(resourceId: ResourceId, request: BindSearchStreamRequest, options: SSERequestOptions): SSEStream;
471
484
  /**
472
485
  * Subscribe to resource events (long-lived stream)
473
486
  *
@@ -502,7 +515,34 @@ declare class SSEClient {
502
515
  * stream.close();
503
516
  * ```
504
517
  */
505
- resourceEvents(resourceId: ResourceUri, options: SSERequestOptions & {
518
+ resourceEvents(resourceId: ResourceId, options: SSERequestOptions & {
519
+ onConnected?: () => void;
520
+ }): SSEStream;
521
+ /**
522
+ * Subscribe to global system events (long-lived stream)
523
+ *
524
+ * Opens a long-lived SSE connection to receive system-level domain events
525
+ * (entity type additions, etc.) that are not scoped to a specific resource.
526
+ *
527
+ * @param options - Request options (auth token, eventBus)
528
+ * @returns SSE stream controller
529
+ *
530
+ * @example
531
+ * ```typescript
532
+ * const stream = sseClient.globalEvents({ auth: 'your-token', eventBus });
533
+ *
534
+ * // Events auto-emit to EventBus — subscribe there
535
+ * eventBus.get('make-meaning:event').subscribe((event) => {
536
+ * if (event.type === 'entitytype.added') {
537
+ * // Invalidate entity types query
538
+ * }
539
+ * });
540
+ *
541
+ * // Close when no longer needed
542
+ * stream.close();
543
+ * ```
544
+ */
545
+ globalEvents(options: SSERequestOptions & {
506
546
  onConnected?: () => void;
507
547
  }): SSEStream;
508
548
  }
@@ -622,8 +662,10 @@ declare class SemiontApiClient {
622
662
  creationMethod?: string;
623
663
  sourceAnnotationId?: string;
624
664
  sourceResourceId?: string;
625
- }, options?: RequestOptions): Promise<ResponseContent<paths['/resources']['post']>>;
626
- getResource(resourceUri: ResourceUri, options?: RequestOptions): Promise<ResponseContent<paths['/resources/{id}']['get']>>;
665
+ }, options?: RequestOptions): Promise<{
666
+ resourceId: string;
667
+ }>;
668
+ getResource(id: ResourceId, options?: RequestOptions): Promise<ResponseContent<paths['/resources/{id}']['get']>>;
627
669
  /**
628
670
  * Get resource representation using W3C content negotiation
629
671
  * Returns raw binary content (images, PDFs, text, etc.) with content type
@@ -646,7 +688,7 @@ declare class SemiontApiClient {
646
688
  * const { data, contentType } = await client.getResourceRepresentation(rUri, { accept: 'application/pdf', auth: token });
647
689
  * ```
648
690
  */
649
- getResourceRepresentation(resourceUri: ResourceUri, options?: {
691
+ getResourceRepresentation(id: ResourceId, options?: {
650
692
  accept?: ContentFormat;
651
693
  auth?: AccessToken;
652
694
  }): Promise<{
@@ -689,7 +731,7 @@ declare class SemiontApiClient {
689
731
  * }
690
732
  * ```
691
733
  */
692
- getResourceRepresentationStream(resourceUri: ResourceUri, options?: {
734
+ getResourceRepresentationStream(id: ResourceId, options?: {
693
735
  accept?: ContentFormat;
694
736
  auth?: AccessToken;
695
737
  }): Promise<{
@@ -697,30 +739,34 @@ declare class SemiontApiClient {
697
739
  contentType: string;
698
740
  }>;
699
741
  listResources(limit?: number, archived?: boolean, query?: SearchQuery, options?: RequestOptions): Promise<ResponseContent<paths['/resources']['get']>>;
700
- updateResource(resourceUri: ResourceUri, data: RequestContent<paths['/resources/{id}']['patch']>, options?: RequestOptions): Promise<ResponseContent<paths['/resources/{id}']['patch']>>;
701
- getResourceEvents(resourceUri: ResourceUri, options?: RequestOptions): Promise<{
742
+ updateResource(id: ResourceId, data: RequestContent<paths['/resources/{id}']['patch']>, options?: RequestOptions): Promise<void>;
743
+ getResourceEvents(id: ResourceId, options?: RequestOptions): Promise<{
702
744
  events: any[];
703
745
  }>;
704
- getResourceAnnotations(resourceUri: ResourceUri, options?: RequestOptions): Promise<ResponseContent<paths['/resources/{id}/annotations']['get']>>;
705
- getAnnotationLLMContext(resourceUri: ResourceUri, annotationId: string, options?: {
746
+ getResourceAnnotations(id: ResourceId, options?: RequestOptions): Promise<ResponseContent<paths['/resources/{id}/annotations']['get']>>;
747
+ getAnnotationLLMContext(resourceId: ResourceId, annotationId: AnnotationId, options?: {
706
748
  contextWindow?: number;
707
749
  auth?: AccessToken;
708
750
  }): Promise<ResponseContent<paths['/resources/{resourceId}/annotations/{annotationId}/llm-context']['get']>>;
709
- getResourceReferencedBy(resourceUri: ResourceUri, options?: RequestOptions): Promise<{
751
+ getResourceReferencedBy(id: ResourceId, options?: RequestOptions): Promise<{
710
752
  referencedBy: any[];
711
753
  }>;
712
- generateCloneToken(resourceUri: ResourceUri, options?: RequestOptions): Promise<ResponseContent<paths['/resources/{id}/clone-with-token']['post']>>;
754
+ generateCloneToken(id: ResourceId, options?: RequestOptions): Promise<ResponseContent<paths['/resources/{id}/clone-with-token']['post']>>;
713
755
  getResourceByToken(token: CloneToken, options?: RequestOptions): Promise<ResponseContent<paths['/api/clone-tokens/{token}']['get']>>;
714
- createResourceFromToken(data: RequestContent<paths['/api/clone-tokens/create-resource']['post']>, options?: RequestOptions): Promise<ResponseContent<paths['/api/clone-tokens/create-resource']['post']>>;
715
- createAnnotation(resourceUri: ResourceUri, data: RequestContent<paths['/resources/{id}/annotations']['post']>, options?: RequestOptions): Promise<ResponseContent<paths['/resources/{id}/annotations']['post']>>;
716
- getAnnotation(annotationUri: AnnotationUri, options?: RequestOptions): Promise<ResponseContent<paths['/annotations/{id}']['get']>>;
717
- getResourceAnnotation(annotationUri: ResourceAnnotationUri, options?: RequestOptions): Promise<ResponseContent<paths['/resources/{resourceId}/annotations/{annotationId}']['get']>>;
718
- listAnnotations(resourceUri: ResourceUri, motivation?: Motivation, options?: RequestOptions): Promise<ResponseContent<paths['/resources/{id}/annotations']['get']>>;
719
- deleteAnnotation(annotationUri: ResourceAnnotationUri, options?: RequestOptions): Promise<void>;
720
- updateAnnotationBody(annotationUri: ResourceAnnotationUri, data: RequestContent<paths['/resources/{resourceId}/annotations/{annotationId}/body']['put']>, options?: RequestOptions): Promise<ResponseContent<paths['/resources/{resourceId}/annotations/{annotationId}/body']['put']>>;
721
- getAnnotationHistory(annotationUri: ResourceAnnotationUri, options?: RequestOptions): Promise<ResponseContent<paths['/resources/{resourceId}/annotations/{annotationId}/history']['get']>>;
722
- addEntityType(type: EntityType, options?: RequestOptions): Promise<ResponseContent<paths['/api/entity-types']['post']>>;
723
- addEntityTypesBulk(types: EntityType[], options?: RequestOptions): Promise<ResponseContent<paths['/api/entity-types/bulk']['post']>>;
756
+ createResourceFromToken(data: RequestContent<paths['/api/clone-tokens/create-resource']['post']>, options?: RequestOptions): Promise<{
757
+ resourceId: string;
758
+ }>;
759
+ createAnnotation(id: ResourceId, data: RequestContent<paths['/resources/{id}/annotations']['post']>, options?: RequestOptions): Promise<{
760
+ annotationId: string;
761
+ }>;
762
+ getAnnotation(id: AnnotationId, options?: RequestOptions): Promise<ResponseContent<paths['/annotations/{id}']['get']>>;
763
+ getResourceAnnotation(resourceId: ResourceId, annotationId: AnnotationId, options?: RequestOptions): Promise<ResponseContent<paths['/resources/{resourceId}/annotations/{annotationId}']['get']>>;
764
+ listAnnotations(id: ResourceId, motivation?: Motivation, options?: RequestOptions): Promise<ResponseContent<paths['/resources/{id}/annotations']['get']>>;
765
+ deleteAnnotation(resourceId: ResourceId, annotationId: AnnotationId, options?: RequestOptions): Promise<void>;
766
+ updateAnnotationBody(resourceId: ResourceId, annotationId: AnnotationId, data: RequestContent<paths['/resources/{resourceId}/annotations/{annotationId}/body']['put']>, options?: RequestOptions): Promise<void>;
767
+ getAnnotationHistory(resourceId: ResourceId, annotationId: AnnotationId, options?: RequestOptions): Promise<ResponseContent<paths['/resources/{resourceId}/annotations/{annotationId}/history']['get']>>;
768
+ addEntityType(type: EntityType, options?: RequestOptions): Promise<void>;
769
+ addEntityTypesBulk(types: EntityType[], options?: RequestOptions): Promise<void>;
724
770
  listEntityTypes(options?: RequestOptions): Promise<ResponseContent<paths['/api/entity-types']['get']>>;
725
771
  listUsers(options?: RequestOptions): Promise<ResponseContent<paths['/api/admin/users']['get']>>;
726
772
  getUserStats(options?: RequestOptions): Promise<ResponseContent<paths['/api/admin/users/stats']['get']>>;
@@ -730,6 +776,48 @@ declare class SemiontApiClient {
730
776
  */
731
777
  updateUser(id: UserDID, data: RequestContent<paths['/api/admin/users/{id}']['patch']>, options?: RequestOptions): Promise<ResponseContent<paths['/api/admin/users/{id}']['patch']>>;
732
778
  getOAuthConfig(options?: RequestOptions): Promise<ResponseContent<paths['/api/admin/oauth/config']['get']>>;
779
+ /**
780
+ * Create a backup of the knowledge base. Returns raw Response for streaming download.
781
+ * Caller should use response.blob() to trigger a file download.
782
+ */
783
+ backupKnowledgeBase(options?: RequestOptions): Promise<Response>;
784
+ /**
785
+ * Restore knowledge base from a backup file. Parses SSE progress events and calls onProgress.
786
+ * Returns the final SSE event (phase: 'complete' or 'error').
787
+ */
788
+ restoreKnowledgeBase(file: File, options?: RequestOptions & {
789
+ onProgress?: (event: {
790
+ phase: string;
791
+ message?: string;
792
+ result?: Record<string, unknown>;
793
+ }) => void;
794
+ }): Promise<{
795
+ phase: string;
796
+ message?: string;
797
+ result?: Record<string, unknown>;
798
+ }>;
799
+ /**
800
+ * Export the knowledge base as a JSON-LD Linked Data archive. Returns raw Response for streaming download.
801
+ * Caller should use response.blob() to trigger a file download.
802
+ */
803
+ exportKnowledgeBase(params?: {
804
+ includeArchived?: boolean;
805
+ }, options?: RequestOptions): Promise<Response>;
806
+ /**
807
+ * Import a JSON-LD Linked Data archive into the knowledge base. Parses SSE progress events and calls onProgress.
808
+ * Returns the final SSE event (phase: 'complete' or 'error').
809
+ */
810
+ importKnowledgeBase(file: File, options?: RequestOptions & {
811
+ onProgress?: (event: {
812
+ phase: string;
813
+ message?: string;
814
+ result?: Record<string, unknown>;
815
+ }) => void;
816
+ }): Promise<{
817
+ phase: string;
818
+ message?: string;
819
+ result?: Record<string, unknown>;
820
+ }>;
733
821
  getJobStatus(id: JobId, options?: RequestOptions): Promise<ResponseContent<paths['/api/jobs/{id}']['get']>>;
734
822
  /**
735
823
  * Poll a job until it completes or fails
@@ -743,7 +831,7 @@ declare class SemiontApiClient {
743
831
  onProgress?: (status: ResponseContent<paths['/api/jobs/{id}']['get']>) => void;
744
832
  auth?: AccessToken;
745
833
  }): Promise<ResponseContent<paths['/api/jobs/{id}']['get']>>;
746
- getResourceLLMContext(resourceUri: ResourceUri, options?: {
834
+ getResourceLLMContext(id: ResourceId, options?: {
747
835
  depth?: number;
748
836
  maxResources?: number;
749
837
  includeContent?: boolean;
@@ -754,6 +842,77 @@ declare class SemiontApiClient {
754
842
  getStatus(options?: RequestOptions): Promise<ResponseContent<paths['/api/status']['get']>>;
755
843
  }
756
844
 
845
+ /**
846
+ * EventBus-Only Client
847
+ *
848
+ * Implements the same knowledge-domain operations as SemiontApiClient
849
+ * but communicates directly via EventBus instead of HTTP.
850
+ *
851
+ * This proves the EventBus is a complete interface for all knowledge-domain
852
+ * operations. Binary content transfer and auth/admin stay HTTP-only.
853
+ *
854
+ * Usage:
855
+ * ```typescript
856
+ * import { EventBus } from '@semiont/core';
857
+ * import { EventBusClient } from '@semiont/api-client';
858
+ *
859
+ * const eventBus = new EventBus();
860
+ * const client = new EventBusClient(eventBus);
861
+ *
862
+ * const resources = await client.listResources({ limit: 10 });
863
+ * const resource = await client.getResource(resourceId('doc-123'));
864
+ * ```
865
+ */
866
+
867
+ declare class EventBusClient {
868
+ private eventBus;
869
+ private timeoutMs;
870
+ constructor(eventBus: EventBus, timeoutMs?: number);
871
+ getResource(resourceId: ResourceId): Promise<components['schemas']['GetResourceResponse']>;
872
+ listResources(options?: {
873
+ search?: string;
874
+ archived?: boolean;
875
+ entityType?: string;
876
+ offset?: number;
877
+ limit?: number;
878
+ }): Promise<components['schemas']['ListResourcesResponse']>;
879
+ getAnnotations(resourceId: ResourceId): Promise<components['schemas']['GetAnnotationsResponse']>;
880
+ getAnnotation(resourceId: ResourceId, annotationId: AnnotationId): Promise<components['schemas']['GetAnnotationResponse']>;
881
+ getEvents(resourceId: ResourceId, options?: {
882
+ type?: string;
883
+ userId?: string;
884
+ limit?: number;
885
+ }): Promise<components['schemas']['GetEventsResponse']>;
886
+ getAnnotationHistory(resourceId: ResourceId, annotationId: AnnotationId): Promise<components['schemas']['GetAnnotationHistoryResponse']>;
887
+ getReferencedBy(resourceId: ResourceId, motivation?: string): Promise<components['schemas']['GetReferencedByResponse']>;
888
+ listEntityTypes(): Promise<components['schemas']['GetEntityTypesResponse']>;
889
+ addEntityType(tag: string, userId: UserId): void;
890
+ generateCloneToken(resourceId: ResourceId): Promise<components['schemas']['CloneResourceWithTokenResponse']>;
891
+ getResourceByToken(token: string): Promise<components['schemas']['GetResourceByTokenResponse']>;
892
+ createResourceFromToken(options: {
893
+ token: string;
894
+ name: string;
895
+ content: string;
896
+ userId: UserId;
897
+ archiveOriginal?: boolean;
898
+ }): Promise<{
899
+ resourceId: ResourceId;
900
+ }>;
901
+ getJobStatus(jobId: JobId): Promise<components['schemas']['JobStatusResponse']>;
902
+ getAnnotationLLMContext(annotationId: AnnotationId, resourceId: ResourceId, options?: {
903
+ includeSourceContext?: boolean;
904
+ includeTargetContext?: boolean;
905
+ contextWindow?: number;
906
+ }): Promise<components['schemas']['AnnotationLLMContextResponse']>;
907
+ getResourceLLMContext(resourceId: ResourceId, options: {
908
+ depth: number;
909
+ maxResources: number;
910
+ includeContent: boolean;
911
+ includeSummary: boolean;
912
+ }): Promise<components['schemas']['ResourceLLMContextResponse']>;
913
+ searchResources(searchTerm: string): Promise<components['schemas']['ResourceDescriptor'][]>;
914
+ }
915
+
757
916
  /**
758
917
  * MIME type utilities for Semiont
759
918
  *
@@ -792,4 +951,4 @@ declare function isPdfMimeType(mimeType: string): boolean;
792
951
  type MimeCategory = 'text' | 'image' | 'unsupported';
793
952
  declare function getMimeCategory(mimeType: string): MimeCategory;
794
953
 
795
- export { APIError, type AnnotateReferencesStreamRequest, type MimeCategory, type ReferenceDetectionProgress, type RequestOptions, SSEClient, type SSEClientConfig, type SSEStream, type SSEStreamConnected, SSE_STREAM_CONNECTED, SemiontApiClient, type SemiontApiClientConfig, type YieldProgress, type YieldResourceStreamRequest, getExtensionForMimeType, getMimeCategory, isImageMimeType, isPdfMimeType, isTextMimeType };
954
+ export { APIError, type AnnotateReferencesStreamRequest, type BindSearchStreamRequest, EventBusClient, type MimeCategory, type ReferenceDetectionProgress, type RequestOptions, SSEClient, type SSEClientConfig, type SSEStream, type SSEStreamConnected, SSE_STREAM_CONNECTED, SemiontApiClient, type SemiontApiClientConfig, type YieldProgress, type YieldResourceStreamRequest, getExtensionForMimeType, getMimeCategory, isImageMimeType, isPdfMimeType, isTextMimeType };