@semiont/api-client 0.4.2 → 0.4.4
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 +98 -41
- package/dist/index.js +182 -70
- package/dist/index.js.map +1 -1
- package/package.json +2 -4
package/dist/index.d.ts
CHANGED
|
@@ -168,6 +168,8 @@ interface AnnotateAssessmentsStreamRequest {
|
|
|
168
168
|
tone?: 'analytical' | 'critical' | 'balanced' | 'constructive';
|
|
169
169
|
/** Desired number of assessments per 2000 words (1-10) */
|
|
170
170
|
density?: number;
|
|
171
|
+
/** BCP 47 language tag for generated text (e.g. 'en', 'fr') */
|
|
172
|
+
language?: string;
|
|
171
173
|
}
|
|
172
174
|
/**
|
|
173
175
|
* Request body for comment annotation stream
|
|
@@ -177,6 +179,8 @@ interface AnnotateCommentsStreamRequest {
|
|
|
177
179
|
tone?: 'scholarly' | 'explanatory' | 'conversational' | 'technical';
|
|
178
180
|
/** Desired number of comments per 2000 words (2-12) */
|
|
179
181
|
density?: number;
|
|
182
|
+
/** BCP 47 language tag for generated text (e.g. 'en', 'fr') */
|
|
183
|
+
language?: string;
|
|
180
184
|
}
|
|
181
185
|
/**
|
|
182
186
|
* Request body for tag annotation stream
|
|
@@ -185,6 +189,19 @@ interface AnnotateTagsStreamRequest {
|
|
|
185
189
|
schemaId: string;
|
|
186
190
|
categories: string[];
|
|
187
191
|
}
|
|
192
|
+
/**
|
|
193
|
+
* Request body for resource gather stream
|
|
194
|
+
*/
|
|
195
|
+
type GatherResourceStreamRequest = components['schemas']['GatherResourceStreamRequest'];
|
|
196
|
+
/**
|
|
197
|
+
* Request body for annotation gather stream
|
|
198
|
+
*/
|
|
199
|
+
type GatherAnnotationStreamRequest = components['schemas']['GatherAnnotationStreamRequest'];
|
|
200
|
+
/**
|
|
201
|
+
* Request body for bind annotation stream
|
|
202
|
+
* Uses generated type from OpenAPI schema
|
|
203
|
+
*/
|
|
204
|
+
type BindAnnotationStreamRequest = components['schemas']['BindAnnotationStreamRequest'];
|
|
188
205
|
/**
|
|
189
206
|
* Request body for bind search stream
|
|
190
207
|
*/
|
|
@@ -223,7 +240,7 @@ interface SSERequestOptions {
|
|
|
223
240
|
* baseUrl: 'http://localhost:4000'
|
|
224
241
|
* });
|
|
225
242
|
*
|
|
226
|
-
* const stream = sseClient.
|
|
243
|
+
* const stream = sseClient.markReferences(
|
|
227
244
|
* 'http://localhost:4000/resources/doc-123',
|
|
228
245
|
* { entityTypes: ['Person', 'Organization'] },
|
|
229
246
|
* { auth: 'your-token' }
|
|
@@ -254,7 +271,7 @@ declare class SSEClient {
|
|
|
254
271
|
*
|
|
255
272
|
* @example
|
|
256
273
|
* ```typescript
|
|
257
|
-
* const stream = sseClient.
|
|
274
|
+
* const stream = sseClient.markReferences(
|
|
258
275
|
* 'http://localhost:4000/resources/doc-123',
|
|
259
276
|
* { entityTypes: ['Person', 'Organization'] },
|
|
260
277
|
* { auth: 'your-token' }
|
|
@@ -277,7 +294,7 @@ declare class SSEClient {
|
|
|
277
294
|
* stream.close();
|
|
278
295
|
* ```
|
|
279
296
|
*/
|
|
280
|
-
|
|
297
|
+
markReferences(resourceId: ResourceId, request: AnnotateReferencesStreamRequest, options: SSERequestOptions): SSEStream;
|
|
281
298
|
/**
|
|
282
299
|
* Generate resource from annotation (streaming)
|
|
283
300
|
*
|
|
@@ -291,7 +308,7 @@ declare class SSEClient {
|
|
|
291
308
|
*
|
|
292
309
|
* @example
|
|
293
310
|
* ```typescript
|
|
294
|
-
* const stream = sseClient.
|
|
311
|
+
* const stream = sseClient.yieldResource(
|
|
295
312
|
* 'http://localhost:4000/resources/doc-123',
|
|
296
313
|
* 'http://localhost:4000/annotations/ann-456',
|
|
297
314
|
* { language: 'es', title: 'Spanish Summary' },
|
|
@@ -315,7 +332,7 @@ declare class SSEClient {
|
|
|
315
332
|
* stream.close();
|
|
316
333
|
* ```
|
|
317
334
|
*/
|
|
318
|
-
|
|
335
|
+
yieldResource(resourceId: ResourceId, annotationId: AnnotationId, request: YieldResourceStreamRequest, options: SSERequestOptions): SSEStream;
|
|
319
336
|
/**
|
|
320
337
|
* Detect highlights in a resource (streaming)
|
|
321
338
|
*
|
|
@@ -328,7 +345,7 @@ declare class SSEClient {
|
|
|
328
345
|
*
|
|
329
346
|
* @example
|
|
330
347
|
* ```typescript
|
|
331
|
-
* const stream = sseClient.
|
|
348
|
+
* const stream = sseClient.markHighlights(
|
|
332
349
|
* 'http://localhost:4000/resources/doc-123',
|
|
333
350
|
* { instructions: 'Focus on key technical points' },
|
|
334
351
|
* { auth: 'your-token' }
|
|
@@ -351,7 +368,7 @@ declare class SSEClient {
|
|
|
351
368
|
* stream.close();
|
|
352
369
|
* ```
|
|
353
370
|
*/
|
|
354
|
-
|
|
371
|
+
markHighlights(resourceId: ResourceId, request: AnnotateHighlightsStreamRequest | undefined, options: SSERequestOptions): SSEStream;
|
|
355
372
|
/**
|
|
356
373
|
* Detect assessments in a resource (streaming)
|
|
357
374
|
*
|
|
@@ -364,7 +381,7 @@ declare class SSEClient {
|
|
|
364
381
|
*
|
|
365
382
|
* @example
|
|
366
383
|
* ```typescript
|
|
367
|
-
* const stream = sseClient.
|
|
384
|
+
* const stream = sseClient.markAssessments(
|
|
368
385
|
* 'http://localhost:4000/resources/doc-123',
|
|
369
386
|
* { instructions: 'Evaluate claims for accuracy' },
|
|
370
387
|
* { auth: 'your-token' }
|
|
@@ -387,7 +404,7 @@ declare class SSEClient {
|
|
|
387
404
|
* stream.close();
|
|
388
405
|
* ```
|
|
389
406
|
*/
|
|
390
|
-
|
|
407
|
+
markAssessments(resourceId: ResourceId, request: AnnotateAssessmentsStreamRequest | undefined, options: SSERequestOptions): SSEStream;
|
|
391
408
|
/**
|
|
392
409
|
* Detect comments in a resource (streaming)
|
|
393
410
|
*
|
|
@@ -402,7 +419,7 @@ declare class SSEClient {
|
|
|
402
419
|
*
|
|
403
420
|
* @example
|
|
404
421
|
* ```typescript
|
|
405
|
-
* const stream = sseClient.
|
|
422
|
+
* const stream = sseClient.markComments(
|
|
406
423
|
* 'http://localhost:4000/resources/doc-123',
|
|
407
424
|
* {
|
|
408
425
|
* instructions: 'Focus on technical terminology',
|
|
@@ -427,7 +444,7 @@ declare class SSEClient {
|
|
|
427
444
|
* stream.close();
|
|
428
445
|
* ```
|
|
429
446
|
*/
|
|
430
|
-
|
|
447
|
+
markComments(resourceId: ResourceId, request: AnnotateCommentsStreamRequest | undefined, options: SSERequestOptions): SSEStream;
|
|
431
448
|
/**
|
|
432
449
|
* Detect tags in a resource (streaming)
|
|
433
450
|
*
|
|
@@ -442,7 +459,7 @@ declare class SSEClient {
|
|
|
442
459
|
*
|
|
443
460
|
* @example
|
|
444
461
|
* ```typescript
|
|
445
|
-
* const stream = sseClient.
|
|
462
|
+
* const stream = sseClient.markTags(
|
|
446
463
|
* 'http://localhost:4000/resources/doc-123',
|
|
447
464
|
* {
|
|
448
465
|
* schemaId: 'legal-irac',
|
|
@@ -468,12 +485,47 @@ declare class SSEClient {
|
|
|
468
485
|
* stream.close();
|
|
469
486
|
* ```
|
|
470
487
|
*/
|
|
471
|
-
|
|
488
|
+
markTags(resourceId: ResourceId, request: AnnotateTagsStreamRequest, options: SSERequestOptions): SSEStream;
|
|
489
|
+
/**
|
|
490
|
+
* Gather LLM context for a resource (streaming)
|
|
491
|
+
*
|
|
492
|
+
* Streams resource LLM context gathering progress via Server-Sent Events.
|
|
493
|
+
*
|
|
494
|
+
* @param resourceId - Resource URI or ID
|
|
495
|
+
* @param request - Gather configuration (depth, maxResources, includeContent, includeSummary)
|
|
496
|
+
* @param options - Request options (auth token, eventBus)
|
|
497
|
+
* @returns SSE stream controller with progress/complete/error callbacks
|
|
498
|
+
*/
|
|
499
|
+
gatherResource(resourceId: ResourceId, request: GatherResourceStreamRequest, options: SSERequestOptions): SSEStream;
|
|
500
|
+
/**
|
|
501
|
+
* Gather LLM context for an annotation (streaming)
|
|
502
|
+
*
|
|
503
|
+
* Streams annotation LLM context gathering progress via Server-Sent Events.
|
|
504
|
+
*
|
|
505
|
+
* @param resourceId - Resource URI or ID
|
|
506
|
+
* @param annotationId - Annotation URI or ID
|
|
507
|
+
* @param request - Gather configuration (contextWindow)
|
|
508
|
+
* @param options - Request options (auth token, eventBus)
|
|
509
|
+
* @returns SSE stream controller with progress/complete/error callbacks
|
|
510
|
+
*/
|
|
511
|
+
gatherAnnotation(resourceId: ResourceId, annotationId: AnnotationId, request: GatherAnnotationStreamRequest, options: SSERequestOptions): SSEStream;
|
|
512
|
+
/**
|
|
513
|
+
* Bind annotation body (streaming)
|
|
514
|
+
*
|
|
515
|
+
* Applies annotation body operations and streams completion via Server-Sent Events.
|
|
516
|
+
*
|
|
517
|
+
* @param resourceId - Resource URI or ID
|
|
518
|
+
* @param annotationId - Annotation URI or ID
|
|
519
|
+
* @param request - Bind operations (resourceId + operations array)
|
|
520
|
+
* @param options - Request options (auth token, eventBus)
|
|
521
|
+
* @returns SSE stream controller with complete/error callbacks
|
|
522
|
+
*/
|
|
523
|
+
bindAnnotation(resourceId: ResourceId, annotationId: AnnotationId, request: BindAnnotationStreamRequest, options: SSERequestOptions): SSEStream;
|
|
472
524
|
/**
|
|
473
525
|
* Search for binding candidates (streaming)
|
|
474
526
|
*
|
|
475
|
-
* Bridges
|
|
476
|
-
* Results emit as
|
|
527
|
+
* Bridges match:search-requested to the backend Matcher actor via SSE.
|
|
528
|
+
* Results emit as match:search-results on the browser EventBus.
|
|
477
529
|
*
|
|
478
530
|
* @param resourceId - Resource the annotation belongs to
|
|
479
531
|
* @param request - Search configuration (referenceId, context, limit)
|
|
@@ -545,6 +597,21 @@ declare class SSEClient {
|
|
|
545
597
|
globalEvents(options: SSERequestOptions & {
|
|
546
598
|
onConnected?: () => void;
|
|
547
599
|
}): SSEStream;
|
|
600
|
+
/**
|
|
601
|
+
* Subscribe to participant attention stream (long-lived stream)
|
|
602
|
+
*
|
|
603
|
+
* Opens a participant-scoped SSE connection to receive cross-participant
|
|
604
|
+
* beckon signals. Signals are delivered as 'beckon:focus' events routed
|
|
605
|
+
* to the EventBus — the existing scroll/highlight machinery handles them.
|
|
606
|
+
*
|
|
607
|
+
* Signals are ephemeral — delivered if connected, dropped if not.
|
|
608
|
+
*
|
|
609
|
+
* @param options - Request options (auth token, eventBus)
|
|
610
|
+
* @returns SSE stream controller
|
|
611
|
+
*/
|
|
612
|
+
attentionStream(options: SSERequestOptions & {
|
|
613
|
+
onConnected?: () => void;
|
|
614
|
+
}): SSEStream;
|
|
548
615
|
}
|
|
549
616
|
|
|
550
617
|
/**
|
|
@@ -653,7 +720,7 @@ declare class SemiontApiClient {
|
|
|
653
720
|
* @param data.sourceResourceId - Optional source resource ID
|
|
654
721
|
* @param options - Request options including auth
|
|
655
722
|
*/
|
|
656
|
-
|
|
723
|
+
yieldResource(data: {
|
|
657
724
|
name: string;
|
|
658
725
|
file: File | Buffer;
|
|
659
726
|
format: string;
|
|
@@ -666,7 +733,7 @@ declare class SemiontApiClient {
|
|
|
666
733
|
}, options?: RequestOptions): Promise<{
|
|
667
734
|
resourceId: string;
|
|
668
735
|
}>;
|
|
669
|
-
|
|
736
|
+
browseResource(id: ResourceId, options?: RequestOptions): Promise<ResponseContent<paths['/resources/{id}']['get']>>;
|
|
670
737
|
/**
|
|
671
738
|
* Get resource representation using W3C content negotiation
|
|
672
739
|
* Returns raw binary content (images, PDFs, text, etc.) with content type
|
|
@@ -739,17 +806,12 @@ declare class SemiontApiClient {
|
|
|
739
806
|
stream: ReadableStream<Uint8Array>;
|
|
740
807
|
contentType: string;
|
|
741
808
|
}>;
|
|
742
|
-
|
|
809
|
+
browseResources(limit?: number, archived?: boolean, query?: SearchQuery, options?: RequestOptions): Promise<ResponseContent<paths['/resources']['get']>>;
|
|
743
810
|
updateResource(id: ResourceId, data: RequestContent<paths['/resources/{id}']['patch']>, options?: RequestOptions): Promise<void>;
|
|
744
811
|
getResourceEvents(id: ResourceId, options?: RequestOptions): Promise<{
|
|
745
812
|
events: any[];
|
|
746
813
|
}>;
|
|
747
|
-
|
|
748
|
-
getAnnotationLLMContext(resourceId: ResourceId, annotationId: AnnotationId, options?: {
|
|
749
|
-
contextWindow?: number;
|
|
750
|
-
auth?: AccessToken;
|
|
751
|
-
}): Promise<ResponseContent<paths['/resources/{resourceId}/annotations/{annotationId}/llm-context']['get']>>;
|
|
752
|
-
getResourceReferencedBy(id: ResourceId, options?: RequestOptions): Promise<{
|
|
814
|
+
browseReferences(id: ResourceId, options?: RequestOptions): Promise<{
|
|
753
815
|
referencedBy: any[];
|
|
754
816
|
}>;
|
|
755
817
|
generateCloneToken(id: ResourceId, options?: RequestOptions): Promise<ResponseContent<paths['/resources/{id}/clone-with-token']['post']>>;
|
|
@@ -757,18 +819,19 @@ declare class SemiontApiClient {
|
|
|
757
819
|
createResourceFromToken(data: RequestContent<paths['/api/clone-tokens/create-resource']['post']>, options?: RequestOptions): Promise<{
|
|
758
820
|
resourceId: string;
|
|
759
821
|
}>;
|
|
760
|
-
|
|
822
|
+
markAnnotation(id: ResourceId, data: RequestContent<paths['/resources/{id}/annotations']['post']>, options?: RequestOptions): Promise<{
|
|
761
823
|
annotationId: string;
|
|
762
824
|
}>;
|
|
763
825
|
getAnnotation(id: AnnotationId, options?: RequestOptions): Promise<ResponseContent<paths['/annotations/{id}']['get']>>;
|
|
764
|
-
|
|
765
|
-
|
|
826
|
+
browseAnnotation(resourceId: ResourceId, annotationId: AnnotationId, options?: RequestOptions): Promise<ResponseContent<paths['/resources/{resourceId}/annotations/{annotationId}']['get']>>;
|
|
827
|
+
browseAnnotations(id: ResourceId, motivation?: Motivation, options?: RequestOptions): Promise<ResponseContent<paths['/resources/{id}/annotations']['get']>>;
|
|
766
828
|
deleteAnnotation(resourceId: ResourceId, annotationId: AnnotationId, options?: RequestOptions): Promise<void>;
|
|
767
|
-
|
|
829
|
+
bindAnnotation(resourceId: ResourceId, annotationId: AnnotationId, data: RequestContent<paths['/resources/{resourceId}/annotations/{annotationId}/body']['put']>, options?: RequestOptions): Promise<void>;
|
|
768
830
|
getAnnotationHistory(resourceId: ResourceId, annotationId: AnnotationId, options?: RequestOptions): Promise<ResponseContent<paths['/resources/{resourceId}/annotations/{annotationId}/history']['get']>>;
|
|
769
831
|
addEntityType(type: EntityType, options?: RequestOptions): Promise<void>;
|
|
770
832
|
addEntityTypesBulk(types: EntityType[], options?: RequestOptions): Promise<void>;
|
|
771
833
|
listEntityTypes(options?: RequestOptions): Promise<ResponseContent<paths['/api/entity-types']['get']>>;
|
|
834
|
+
beckonAttention(participantId: string, data: RequestContent<paths['/api/participants/{id}/attention']['post']>, options?: RequestOptions): Promise<ResponseContent<paths['/api/participants/{id}/attention']['post']>>;
|
|
772
835
|
listUsers(options?: RequestOptions): Promise<ResponseContent<paths['/api/admin/users']['get']>>;
|
|
773
836
|
getUserStats(options?: RequestOptions): Promise<ResponseContent<paths['/api/admin/users/stats']['get']>>;
|
|
774
837
|
/**
|
|
@@ -832,15 +895,9 @@ declare class SemiontApiClient {
|
|
|
832
895
|
onProgress?: (status: ResponseContent<paths['/api/jobs/{id}']['get']>) => void;
|
|
833
896
|
auth?: AccessToken;
|
|
834
897
|
}): Promise<ResponseContent<paths['/api/jobs/{id}']['get']>>;
|
|
835
|
-
getResourceLLMContext(id: ResourceId, options?: {
|
|
836
|
-
depth?: number;
|
|
837
|
-
maxResources?: number;
|
|
838
|
-
includeContent?: boolean;
|
|
839
|
-
includeSummary?: boolean;
|
|
840
|
-
auth?: AccessToken;
|
|
841
|
-
}): Promise<ResponseContent<paths['/resources/{id}/llm-context']['get']>>;
|
|
842
898
|
healthCheck(options?: RequestOptions): Promise<ResponseContent<paths['/api/health']['get']>>;
|
|
843
899
|
getStatus(options?: RequestOptions): Promise<ResponseContent<paths['/api/status']['get']>>;
|
|
900
|
+
browseFiles(dirPath?: string, sort?: 'name' | 'mtime' | 'annotationCount', options?: RequestOptions): Promise<ResponseContent<paths['/api/browse/files']['get']>>;
|
|
844
901
|
}
|
|
845
902
|
|
|
846
903
|
/**
|
|
@@ -860,8 +917,8 @@ declare class SemiontApiClient {
|
|
|
860
917
|
* const eventBus = new EventBus();
|
|
861
918
|
* const client = new EventBusClient(eventBus);
|
|
862
919
|
*
|
|
863
|
-
* const resources = await client.
|
|
864
|
-
* const resource = await client.
|
|
920
|
+
* const resources = await client.browseResources({ limit: 10 });
|
|
921
|
+
* const resource = await client.browseResource(resourceId('doc-123'));
|
|
865
922
|
* ```
|
|
866
923
|
*/
|
|
867
924
|
|
|
@@ -869,8 +926,8 @@ declare class EventBusClient {
|
|
|
869
926
|
private eventBus;
|
|
870
927
|
private timeoutMs;
|
|
871
928
|
constructor(eventBus: EventBus, timeoutMs?: number);
|
|
872
|
-
|
|
873
|
-
|
|
929
|
+
browseResource(resourceId: ResourceId): Promise<components['schemas']['GetResourceResponse']>;
|
|
930
|
+
browseResources(options?: {
|
|
874
931
|
search?: string;
|
|
875
932
|
archived?: boolean;
|
|
876
933
|
entityType?: string;
|
|
@@ -900,12 +957,12 @@ declare class EventBusClient {
|
|
|
900
957
|
resourceId: ResourceId;
|
|
901
958
|
}>;
|
|
902
959
|
getJobStatus(jobId: JobId): Promise<components['schemas']['JobStatusResponse']>;
|
|
903
|
-
|
|
960
|
+
gatherAnnotation(annotationId: AnnotationId, resourceId: ResourceId, options?: {
|
|
904
961
|
includeSourceContext?: boolean;
|
|
905
962
|
includeTargetContext?: boolean;
|
|
906
963
|
contextWindow?: number;
|
|
907
964
|
}): Promise<components['schemas']['AnnotationLLMContextResponse']>;
|
|
908
|
-
|
|
965
|
+
gatherResource(resourceId: ResourceId, options: {
|
|
909
966
|
depth: number;
|
|
910
967
|
maxResources: number;
|
|
911
968
|
includeContent: boolean;
|