@semiont/api-client 0.4.2 → 0.4.3
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 +93 -30
- package/dist/index.js +161 -32
- package/dist/index.js.map +1 -1
- package/package.json +2 -4
package/dist/index.d.ts
CHANGED
|
@@ -185,6 +185,19 @@ interface AnnotateTagsStreamRequest {
|
|
|
185
185
|
schemaId: string;
|
|
186
186
|
categories: string[];
|
|
187
187
|
}
|
|
188
|
+
/**
|
|
189
|
+
* Request body for resource gather stream
|
|
190
|
+
*/
|
|
191
|
+
type GatherResourceStreamRequest = components['schemas']['GatherResourceStreamRequest'];
|
|
192
|
+
/**
|
|
193
|
+
* Request body for annotation gather stream
|
|
194
|
+
*/
|
|
195
|
+
type GatherAnnotationStreamRequest = components['schemas']['GatherAnnotationStreamRequest'];
|
|
196
|
+
/**
|
|
197
|
+
* Request body for bind annotation stream
|
|
198
|
+
* Uses generated type from OpenAPI schema
|
|
199
|
+
*/
|
|
200
|
+
type BindAnnotationStreamRequest = components['schemas']['BindAnnotationStreamRequest'];
|
|
188
201
|
/**
|
|
189
202
|
* Request body for bind search stream
|
|
190
203
|
*/
|
|
@@ -223,7 +236,7 @@ interface SSERequestOptions {
|
|
|
223
236
|
* baseUrl: 'http://localhost:4000'
|
|
224
237
|
* });
|
|
225
238
|
*
|
|
226
|
-
* const stream = sseClient.
|
|
239
|
+
* const stream = sseClient.markReferences(
|
|
227
240
|
* 'http://localhost:4000/resources/doc-123',
|
|
228
241
|
* { entityTypes: ['Person', 'Organization'] },
|
|
229
242
|
* { auth: 'your-token' }
|
|
@@ -254,7 +267,7 @@ declare class SSEClient {
|
|
|
254
267
|
*
|
|
255
268
|
* @example
|
|
256
269
|
* ```typescript
|
|
257
|
-
* const stream = sseClient.
|
|
270
|
+
* const stream = sseClient.markReferences(
|
|
258
271
|
* 'http://localhost:4000/resources/doc-123',
|
|
259
272
|
* { entityTypes: ['Person', 'Organization'] },
|
|
260
273
|
* { auth: 'your-token' }
|
|
@@ -277,7 +290,7 @@ declare class SSEClient {
|
|
|
277
290
|
* stream.close();
|
|
278
291
|
* ```
|
|
279
292
|
*/
|
|
280
|
-
|
|
293
|
+
markReferences(resourceId: ResourceId, request: AnnotateReferencesStreamRequest, options: SSERequestOptions): SSEStream;
|
|
281
294
|
/**
|
|
282
295
|
* Generate resource from annotation (streaming)
|
|
283
296
|
*
|
|
@@ -291,7 +304,7 @@ declare class SSEClient {
|
|
|
291
304
|
*
|
|
292
305
|
* @example
|
|
293
306
|
* ```typescript
|
|
294
|
-
* const stream = sseClient.
|
|
307
|
+
* const stream = sseClient.yieldResource(
|
|
295
308
|
* 'http://localhost:4000/resources/doc-123',
|
|
296
309
|
* 'http://localhost:4000/annotations/ann-456',
|
|
297
310
|
* { language: 'es', title: 'Spanish Summary' },
|
|
@@ -315,7 +328,7 @@ declare class SSEClient {
|
|
|
315
328
|
* stream.close();
|
|
316
329
|
* ```
|
|
317
330
|
*/
|
|
318
|
-
|
|
331
|
+
yieldResource(resourceId: ResourceId, annotationId: AnnotationId, request: YieldResourceStreamRequest, options: SSERequestOptions): SSEStream;
|
|
319
332
|
/**
|
|
320
333
|
* Detect highlights in a resource (streaming)
|
|
321
334
|
*
|
|
@@ -328,7 +341,7 @@ declare class SSEClient {
|
|
|
328
341
|
*
|
|
329
342
|
* @example
|
|
330
343
|
* ```typescript
|
|
331
|
-
* const stream = sseClient.
|
|
344
|
+
* const stream = sseClient.markHighlights(
|
|
332
345
|
* 'http://localhost:4000/resources/doc-123',
|
|
333
346
|
* { instructions: 'Focus on key technical points' },
|
|
334
347
|
* { auth: 'your-token' }
|
|
@@ -351,7 +364,7 @@ declare class SSEClient {
|
|
|
351
364
|
* stream.close();
|
|
352
365
|
* ```
|
|
353
366
|
*/
|
|
354
|
-
|
|
367
|
+
markHighlights(resourceId: ResourceId, request: AnnotateHighlightsStreamRequest | undefined, options: SSERequestOptions): SSEStream;
|
|
355
368
|
/**
|
|
356
369
|
* Detect assessments in a resource (streaming)
|
|
357
370
|
*
|
|
@@ -364,7 +377,7 @@ declare class SSEClient {
|
|
|
364
377
|
*
|
|
365
378
|
* @example
|
|
366
379
|
* ```typescript
|
|
367
|
-
* const stream = sseClient.
|
|
380
|
+
* const stream = sseClient.markAssessments(
|
|
368
381
|
* 'http://localhost:4000/resources/doc-123',
|
|
369
382
|
* { instructions: 'Evaluate claims for accuracy' },
|
|
370
383
|
* { auth: 'your-token' }
|
|
@@ -387,7 +400,7 @@ declare class SSEClient {
|
|
|
387
400
|
* stream.close();
|
|
388
401
|
* ```
|
|
389
402
|
*/
|
|
390
|
-
|
|
403
|
+
markAssessments(resourceId: ResourceId, request: AnnotateAssessmentsStreamRequest | undefined, options: SSERequestOptions): SSEStream;
|
|
391
404
|
/**
|
|
392
405
|
* Detect comments in a resource (streaming)
|
|
393
406
|
*
|
|
@@ -402,7 +415,7 @@ declare class SSEClient {
|
|
|
402
415
|
*
|
|
403
416
|
* @example
|
|
404
417
|
* ```typescript
|
|
405
|
-
* const stream = sseClient.
|
|
418
|
+
* const stream = sseClient.markComments(
|
|
406
419
|
* 'http://localhost:4000/resources/doc-123',
|
|
407
420
|
* {
|
|
408
421
|
* instructions: 'Focus on technical terminology',
|
|
@@ -427,7 +440,7 @@ declare class SSEClient {
|
|
|
427
440
|
* stream.close();
|
|
428
441
|
* ```
|
|
429
442
|
*/
|
|
430
|
-
|
|
443
|
+
markComments(resourceId: ResourceId, request: AnnotateCommentsStreamRequest | undefined, options: SSERequestOptions): SSEStream;
|
|
431
444
|
/**
|
|
432
445
|
* Detect tags in a resource (streaming)
|
|
433
446
|
*
|
|
@@ -442,7 +455,7 @@ declare class SSEClient {
|
|
|
442
455
|
*
|
|
443
456
|
* @example
|
|
444
457
|
* ```typescript
|
|
445
|
-
* const stream = sseClient.
|
|
458
|
+
* const stream = sseClient.markTags(
|
|
446
459
|
* 'http://localhost:4000/resources/doc-123',
|
|
447
460
|
* {
|
|
448
461
|
* schemaId: 'legal-irac',
|
|
@@ -468,7 +481,42 @@ declare class SSEClient {
|
|
|
468
481
|
* stream.close();
|
|
469
482
|
* ```
|
|
470
483
|
*/
|
|
471
|
-
|
|
484
|
+
markTags(resourceId: ResourceId, request: AnnotateTagsStreamRequest, options: SSERequestOptions): SSEStream;
|
|
485
|
+
/**
|
|
486
|
+
* Gather LLM context for a resource (streaming)
|
|
487
|
+
*
|
|
488
|
+
* Streams resource LLM context gathering progress via Server-Sent Events.
|
|
489
|
+
*
|
|
490
|
+
* @param resourceId - Resource URI or ID
|
|
491
|
+
* @param request - Gather configuration (depth, maxResources, includeContent, includeSummary)
|
|
492
|
+
* @param options - Request options (auth token, eventBus)
|
|
493
|
+
* @returns SSE stream controller with progress/complete/error callbacks
|
|
494
|
+
*/
|
|
495
|
+
gatherResource(resourceId: ResourceId, request: GatherResourceStreamRequest, options: SSERequestOptions): SSEStream;
|
|
496
|
+
/**
|
|
497
|
+
* Gather LLM context for an annotation (streaming)
|
|
498
|
+
*
|
|
499
|
+
* Streams annotation LLM context gathering progress via Server-Sent Events.
|
|
500
|
+
*
|
|
501
|
+
* @param resourceId - Resource URI or ID
|
|
502
|
+
* @param annotationId - Annotation URI or ID
|
|
503
|
+
* @param request - Gather configuration (contextWindow)
|
|
504
|
+
* @param options - Request options (auth token, eventBus)
|
|
505
|
+
* @returns SSE stream controller with progress/complete/error callbacks
|
|
506
|
+
*/
|
|
507
|
+
gatherAnnotation(resourceId: ResourceId, annotationId: AnnotationId, request: GatherAnnotationStreamRequest, options: SSERequestOptions): SSEStream;
|
|
508
|
+
/**
|
|
509
|
+
* Bind annotation body (streaming)
|
|
510
|
+
*
|
|
511
|
+
* Applies annotation body operations and streams completion via Server-Sent Events.
|
|
512
|
+
*
|
|
513
|
+
* @param resourceId - Resource URI or ID
|
|
514
|
+
* @param annotationId - Annotation URI or ID
|
|
515
|
+
* @param request - Bind operations (resourceId + operations array)
|
|
516
|
+
* @param options - Request options (auth token, eventBus)
|
|
517
|
+
* @returns SSE stream controller with complete/error callbacks
|
|
518
|
+
*/
|
|
519
|
+
bindAnnotation(resourceId: ResourceId, annotationId: AnnotationId, request: BindAnnotationStreamRequest, options: SSERequestOptions): SSEStream;
|
|
472
520
|
/**
|
|
473
521
|
* Search for binding candidates (streaming)
|
|
474
522
|
*
|
|
@@ -545,6 +593,21 @@ declare class SSEClient {
|
|
|
545
593
|
globalEvents(options: SSERequestOptions & {
|
|
546
594
|
onConnected?: () => void;
|
|
547
595
|
}): SSEStream;
|
|
596
|
+
/**
|
|
597
|
+
* Subscribe to participant attention stream (long-lived stream)
|
|
598
|
+
*
|
|
599
|
+
* Opens a participant-scoped SSE connection to receive cross-participant
|
|
600
|
+
* beckon signals. Signals are delivered as 'beckon:focus' events routed
|
|
601
|
+
* to the EventBus — the existing scroll/highlight machinery handles them.
|
|
602
|
+
*
|
|
603
|
+
* Signals are ephemeral — delivered if connected, dropped if not.
|
|
604
|
+
*
|
|
605
|
+
* @param options - Request options (auth token, eventBus)
|
|
606
|
+
* @returns SSE stream controller
|
|
607
|
+
*/
|
|
608
|
+
attentionStream(options: SSERequestOptions & {
|
|
609
|
+
onConnected?: () => void;
|
|
610
|
+
}): SSEStream;
|
|
548
611
|
}
|
|
549
612
|
|
|
550
613
|
/**
|
|
@@ -653,7 +716,7 @@ declare class SemiontApiClient {
|
|
|
653
716
|
* @param data.sourceResourceId - Optional source resource ID
|
|
654
717
|
* @param options - Request options including auth
|
|
655
718
|
*/
|
|
656
|
-
|
|
719
|
+
yieldResource(data: {
|
|
657
720
|
name: string;
|
|
658
721
|
file: File | Buffer;
|
|
659
722
|
format: string;
|
|
@@ -666,7 +729,7 @@ declare class SemiontApiClient {
|
|
|
666
729
|
}, options?: RequestOptions): Promise<{
|
|
667
730
|
resourceId: string;
|
|
668
731
|
}>;
|
|
669
|
-
|
|
732
|
+
browseResource(id: ResourceId, options?: RequestOptions): Promise<ResponseContent<paths['/resources/{id}']['get']>>;
|
|
670
733
|
/**
|
|
671
734
|
* Get resource representation using W3C content negotiation
|
|
672
735
|
* Returns raw binary content (images, PDFs, text, etc.) with content type
|
|
@@ -739,17 +802,16 @@ declare class SemiontApiClient {
|
|
|
739
802
|
stream: ReadableStream<Uint8Array>;
|
|
740
803
|
contentType: string;
|
|
741
804
|
}>;
|
|
742
|
-
|
|
805
|
+
browseResources(limit?: number, archived?: boolean, query?: SearchQuery, options?: RequestOptions): Promise<ResponseContent<paths['/resources']['get']>>;
|
|
743
806
|
updateResource(id: ResourceId, data: RequestContent<paths['/resources/{id}']['patch']>, options?: RequestOptions): Promise<void>;
|
|
744
807
|
getResourceEvents(id: ResourceId, options?: RequestOptions): Promise<{
|
|
745
808
|
events: any[];
|
|
746
809
|
}>;
|
|
747
|
-
|
|
748
|
-
getAnnotationLLMContext(resourceId: ResourceId, annotationId: AnnotationId, options?: {
|
|
810
|
+
gatherAnnotation(resourceId: ResourceId, annotationId: AnnotationId, options?: {
|
|
749
811
|
contextWindow?: number;
|
|
750
812
|
auth?: AccessToken;
|
|
751
813
|
}): Promise<ResponseContent<paths['/resources/{resourceId}/annotations/{annotationId}/llm-context']['get']>>;
|
|
752
|
-
|
|
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,7 +895,7 @@ 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
|
-
|
|
898
|
+
gatherResource(id: ResourceId, options?: {
|
|
836
899
|
depth?: number;
|
|
837
900
|
maxResources?: number;
|
|
838
901
|
includeContent?: boolean;
|
|
@@ -860,8 +923,8 @@ declare class SemiontApiClient {
|
|
|
860
923
|
* const eventBus = new EventBus();
|
|
861
924
|
* const client = new EventBusClient(eventBus);
|
|
862
925
|
*
|
|
863
|
-
* const resources = await client.
|
|
864
|
-
* const resource = await client.
|
|
926
|
+
* const resources = await client.browseResources({ limit: 10 });
|
|
927
|
+
* const resource = await client.browseResource(resourceId('doc-123'));
|
|
865
928
|
* ```
|
|
866
929
|
*/
|
|
867
930
|
|
|
@@ -869,8 +932,8 @@ declare class EventBusClient {
|
|
|
869
932
|
private eventBus;
|
|
870
933
|
private timeoutMs;
|
|
871
934
|
constructor(eventBus: EventBus, timeoutMs?: number);
|
|
872
|
-
|
|
873
|
-
|
|
935
|
+
browseResource(resourceId: ResourceId): Promise<components['schemas']['GetResourceResponse']>;
|
|
936
|
+
browseResources(options?: {
|
|
874
937
|
search?: string;
|
|
875
938
|
archived?: boolean;
|
|
876
939
|
entityType?: string;
|
|
@@ -900,12 +963,12 @@ declare class EventBusClient {
|
|
|
900
963
|
resourceId: ResourceId;
|
|
901
964
|
}>;
|
|
902
965
|
getJobStatus(jobId: JobId): Promise<components['schemas']['JobStatusResponse']>;
|
|
903
|
-
|
|
966
|
+
gatherAnnotation(annotationId: AnnotationId, resourceId: ResourceId, options?: {
|
|
904
967
|
includeSourceContext?: boolean;
|
|
905
968
|
includeTargetContext?: boolean;
|
|
906
969
|
contextWindow?: number;
|
|
907
970
|
}): Promise<components['schemas']['AnnotationLLMContextResponse']>;
|
|
908
|
-
|
|
971
|
+
gatherResource(resourceId: ResourceId, options: {
|
|
909
972
|
depth: number;
|
|
910
973
|
maxResources: number;
|
|
911
974
|
includeContent: boolean;
|
package/dist/index.js
CHANGED
|
@@ -179,7 +179,7 @@ var SSEClient = class {
|
|
|
179
179
|
*
|
|
180
180
|
* @example
|
|
181
181
|
* ```typescript
|
|
182
|
-
* const stream = sseClient.
|
|
182
|
+
* const stream = sseClient.markReferences(
|
|
183
183
|
* 'http://localhost:4000/resources/doc-123',
|
|
184
184
|
* { entityTypes: ['Person', 'Organization'] },
|
|
185
185
|
* { auth: 'your-token' }
|
|
@@ -202,7 +202,7 @@ var SSEClient = class {
|
|
|
202
202
|
* stream.close();
|
|
203
203
|
* ```
|
|
204
204
|
*/
|
|
205
|
-
|
|
205
|
+
markReferences(resourceId, request, options) {
|
|
206
206
|
const url = `${this.baseUrl}/resources/${resourceId}/annotate-references-stream`;
|
|
207
207
|
return createSSEStream(
|
|
208
208
|
url,
|
|
@@ -234,7 +234,7 @@ var SSEClient = class {
|
|
|
234
234
|
*
|
|
235
235
|
* @example
|
|
236
236
|
* ```typescript
|
|
237
|
-
* const stream = sseClient.
|
|
237
|
+
* const stream = sseClient.yieldResource(
|
|
238
238
|
* 'http://localhost:4000/resources/doc-123',
|
|
239
239
|
* 'http://localhost:4000/annotations/ann-456',
|
|
240
240
|
* { language: 'es', title: 'Spanish Summary' },
|
|
@@ -258,7 +258,7 @@ var SSEClient = class {
|
|
|
258
258
|
* stream.close();
|
|
259
259
|
* ```
|
|
260
260
|
*/
|
|
261
|
-
|
|
261
|
+
yieldResource(resourceId, annotationId, request, options) {
|
|
262
262
|
const url = `${this.baseUrl}/resources/${resourceId}/annotations/${annotationId}/yield-resource-stream`;
|
|
263
263
|
return createSSEStream(
|
|
264
264
|
url,
|
|
@@ -289,7 +289,7 @@ var SSEClient = class {
|
|
|
289
289
|
*
|
|
290
290
|
* @example
|
|
291
291
|
* ```typescript
|
|
292
|
-
* const stream = sseClient.
|
|
292
|
+
* const stream = sseClient.markHighlights(
|
|
293
293
|
* 'http://localhost:4000/resources/doc-123',
|
|
294
294
|
* { instructions: 'Focus on key technical points' },
|
|
295
295
|
* { auth: 'your-token' }
|
|
@@ -312,7 +312,7 @@ var SSEClient = class {
|
|
|
312
312
|
* stream.close();
|
|
313
313
|
* ```
|
|
314
314
|
*/
|
|
315
|
-
|
|
315
|
+
markHighlights(resourceId, request = {}, options) {
|
|
316
316
|
const url = `${this.baseUrl}/resources/${resourceId}/annotate-highlights-stream`;
|
|
317
317
|
return createSSEStream(
|
|
318
318
|
url,
|
|
@@ -343,7 +343,7 @@ var SSEClient = class {
|
|
|
343
343
|
*
|
|
344
344
|
* @example
|
|
345
345
|
* ```typescript
|
|
346
|
-
* const stream = sseClient.
|
|
346
|
+
* const stream = sseClient.markAssessments(
|
|
347
347
|
* 'http://localhost:4000/resources/doc-123',
|
|
348
348
|
* { instructions: 'Evaluate claims for accuracy' },
|
|
349
349
|
* { auth: 'your-token' }
|
|
@@ -366,7 +366,7 @@ var SSEClient = class {
|
|
|
366
366
|
* stream.close();
|
|
367
367
|
* ```
|
|
368
368
|
*/
|
|
369
|
-
|
|
369
|
+
markAssessments(resourceId, request = {}, options) {
|
|
370
370
|
const url = `${this.baseUrl}/resources/${resourceId}/annotate-assessments-stream`;
|
|
371
371
|
return createSSEStream(
|
|
372
372
|
url,
|
|
@@ -399,7 +399,7 @@ var SSEClient = class {
|
|
|
399
399
|
*
|
|
400
400
|
* @example
|
|
401
401
|
* ```typescript
|
|
402
|
-
* const stream = sseClient.
|
|
402
|
+
* const stream = sseClient.markComments(
|
|
403
403
|
* 'http://localhost:4000/resources/doc-123',
|
|
404
404
|
* {
|
|
405
405
|
* instructions: 'Focus on technical terminology',
|
|
@@ -424,7 +424,7 @@ var SSEClient = class {
|
|
|
424
424
|
* stream.close();
|
|
425
425
|
* ```
|
|
426
426
|
*/
|
|
427
|
-
|
|
427
|
+
markComments(resourceId, request = {}, options) {
|
|
428
428
|
const url = `${this.baseUrl}/resources/${resourceId}/annotate-comments-stream`;
|
|
429
429
|
return createSSEStream(
|
|
430
430
|
url,
|
|
@@ -457,7 +457,7 @@ var SSEClient = class {
|
|
|
457
457
|
*
|
|
458
458
|
* @example
|
|
459
459
|
* ```typescript
|
|
460
|
-
* const stream = sseClient.
|
|
460
|
+
* const stream = sseClient.markTags(
|
|
461
461
|
* 'http://localhost:4000/resources/doc-123',
|
|
462
462
|
* {
|
|
463
463
|
* schemaId: 'legal-irac',
|
|
@@ -483,7 +483,7 @@ var SSEClient = class {
|
|
|
483
483
|
* stream.close();
|
|
484
484
|
* ```
|
|
485
485
|
*/
|
|
486
|
-
|
|
486
|
+
markTags(resourceId, request, options) {
|
|
487
487
|
const url = `${this.baseUrl}/resources/${resourceId}/annotate-tags-stream`;
|
|
488
488
|
return createSSEStream(
|
|
489
489
|
url,
|
|
@@ -502,6 +502,95 @@ var SSEClient = class {
|
|
|
502
502
|
this.logger
|
|
503
503
|
);
|
|
504
504
|
}
|
|
505
|
+
/**
|
|
506
|
+
* Gather LLM context for a resource (streaming)
|
|
507
|
+
*
|
|
508
|
+
* Streams resource LLM context gathering progress via Server-Sent Events.
|
|
509
|
+
*
|
|
510
|
+
* @param resourceId - Resource URI or ID
|
|
511
|
+
* @param request - Gather configuration (depth, maxResources, includeContent, includeSummary)
|
|
512
|
+
* @param options - Request options (auth token, eventBus)
|
|
513
|
+
* @returns SSE stream controller with progress/complete/error callbacks
|
|
514
|
+
*/
|
|
515
|
+
gatherResource(resourceId, request, options) {
|
|
516
|
+
const url = `${this.baseUrl}/resources/${resourceId}/gather-resource-stream`;
|
|
517
|
+
return createSSEStream(
|
|
518
|
+
url,
|
|
519
|
+
{
|
|
520
|
+
method: "POST",
|
|
521
|
+
headers: this.getHeaders(options.auth),
|
|
522
|
+
body: JSON.stringify(request)
|
|
523
|
+
},
|
|
524
|
+
{
|
|
525
|
+
progressEvents: ["gather:progress"],
|
|
526
|
+
completeEvent: "gather:finished",
|
|
527
|
+
errorEvent: "gather:failed",
|
|
528
|
+
eventBus: options.eventBus,
|
|
529
|
+
eventPrefix: void 0
|
|
530
|
+
},
|
|
531
|
+
this.logger
|
|
532
|
+
);
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* Gather LLM context for an annotation (streaming)
|
|
536
|
+
*
|
|
537
|
+
* Streams annotation LLM context gathering progress via Server-Sent Events.
|
|
538
|
+
*
|
|
539
|
+
* @param resourceId - Resource URI or ID
|
|
540
|
+
* @param annotationId - Annotation URI or ID
|
|
541
|
+
* @param request - Gather configuration (contextWindow)
|
|
542
|
+
* @param options - Request options (auth token, eventBus)
|
|
543
|
+
* @returns SSE stream controller with progress/complete/error callbacks
|
|
544
|
+
*/
|
|
545
|
+
gatherAnnotation(resourceId, annotationId, request, options) {
|
|
546
|
+
const url = `${this.baseUrl}/resources/${resourceId}/annotations/${annotationId}/gather-annotation-stream`;
|
|
547
|
+
return createSSEStream(
|
|
548
|
+
url,
|
|
549
|
+
{
|
|
550
|
+
method: "POST",
|
|
551
|
+
headers: this.getHeaders(options.auth),
|
|
552
|
+
body: JSON.stringify(request)
|
|
553
|
+
},
|
|
554
|
+
{
|
|
555
|
+
progressEvents: ["gather:annotation-progress"],
|
|
556
|
+
completeEvent: "gather:annotation-finished",
|
|
557
|
+
errorEvent: "gather:failed",
|
|
558
|
+
eventBus: options.eventBus,
|
|
559
|
+
eventPrefix: void 0
|
|
560
|
+
},
|
|
561
|
+
this.logger
|
|
562
|
+
);
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
* Bind annotation body (streaming)
|
|
566
|
+
*
|
|
567
|
+
* Applies annotation body operations and streams completion via Server-Sent Events.
|
|
568
|
+
*
|
|
569
|
+
* @param resourceId - Resource URI or ID
|
|
570
|
+
* @param annotationId - Annotation URI or ID
|
|
571
|
+
* @param request - Bind operations (resourceId + operations array)
|
|
572
|
+
* @param options - Request options (auth token, eventBus)
|
|
573
|
+
* @returns SSE stream controller with complete/error callbacks
|
|
574
|
+
*/
|
|
575
|
+
bindAnnotation(resourceId, annotationId, request, options) {
|
|
576
|
+
const url = `${this.baseUrl}/resources/${resourceId}/annotations/${annotationId}/bind-stream`;
|
|
577
|
+
return createSSEStream(
|
|
578
|
+
url,
|
|
579
|
+
{
|
|
580
|
+
method: "POST",
|
|
581
|
+
headers: this.getHeaders(options.auth),
|
|
582
|
+
body: JSON.stringify(request)
|
|
583
|
+
},
|
|
584
|
+
{
|
|
585
|
+
progressEvents: [],
|
|
586
|
+
completeEvent: "bind:finished",
|
|
587
|
+
errorEvent: "bind:failed",
|
|
588
|
+
eventBus: options.eventBus,
|
|
589
|
+
eventPrefix: void 0
|
|
590
|
+
},
|
|
591
|
+
this.logger
|
|
592
|
+
);
|
|
593
|
+
}
|
|
505
594
|
/**
|
|
506
595
|
* Search for binding candidates (streaming)
|
|
507
596
|
*
|
|
@@ -640,6 +729,42 @@ var SSEClient = class {
|
|
|
640
729
|
}
|
|
641
730
|
return stream;
|
|
642
731
|
}
|
|
732
|
+
/**
|
|
733
|
+
* Subscribe to participant attention stream (long-lived stream)
|
|
734
|
+
*
|
|
735
|
+
* Opens a participant-scoped SSE connection to receive cross-participant
|
|
736
|
+
* beckon signals. Signals are delivered as 'beckon:focus' events routed
|
|
737
|
+
* to the EventBus — the existing scroll/highlight machinery handles them.
|
|
738
|
+
*
|
|
739
|
+
* Signals are ephemeral — delivered if connected, dropped if not.
|
|
740
|
+
*
|
|
741
|
+
* @param options - Request options (auth token, eventBus)
|
|
742
|
+
* @returns SSE stream controller
|
|
743
|
+
*/
|
|
744
|
+
attentionStream(options) {
|
|
745
|
+
const url = `${this.baseUrl}/api/participants/me/attention-stream`;
|
|
746
|
+
const stream = createSSEStream(
|
|
747
|
+
url,
|
|
748
|
+
{
|
|
749
|
+
method: "GET",
|
|
750
|
+
headers: this.getHeaders(options.auth)
|
|
751
|
+
},
|
|
752
|
+
{
|
|
753
|
+
progressEvents: ["*"],
|
|
754
|
+
completeEvent: null,
|
|
755
|
+
errorEvent: null,
|
|
756
|
+
eventBus: options.eventBus
|
|
757
|
+
},
|
|
758
|
+
this.logger
|
|
759
|
+
);
|
|
760
|
+
if (options.onConnected) {
|
|
761
|
+
const sub = options.eventBus.get(SSE_STREAM_CONNECTED).subscribe(() => {
|
|
762
|
+
options.onConnected();
|
|
763
|
+
sub.unsubscribe();
|
|
764
|
+
});
|
|
765
|
+
}
|
|
766
|
+
return stream;
|
|
767
|
+
}
|
|
643
768
|
};
|
|
644
769
|
|
|
645
770
|
// src/client.ts
|
|
@@ -815,7 +940,7 @@ var SemiontApiClient = class {
|
|
|
815
940
|
* @param data.sourceResourceId - Optional source resource ID
|
|
816
941
|
* @param options - Request options including auth
|
|
817
942
|
*/
|
|
818
|
-
async
|
|
943
|
+
async yieldResource(data, options) {
|
|
819
944
|
const formData = new FormData();
|
|
820
945
|
formData.append("name", data.name);
|
|
821
946
|
formData.append("format", data.format);
|
|
@@ -849,7 +974,7 @@ var SemiontApiClient = class {
|
|
|
849
974
|
auth: options?.auth
|
|
850
975
|
}).json();
|
|
851
976
|
}
|
|
852
|
-
async
|
|
977
|
+
async browseResource(id, options) {
|
|
853
978
|
return this.http.get(`${this.baseUrl}/resources/${id}`, {
|
|
854
979
|
...options,
|
|
855
980
|
auth: options?.auth
|
|
@@ -937,7 +1062,7 @@ var SemiontApiClient = class {
|
|
|
937
1062
|
}
|
|
938
1063
|
return { stream: response.body, contentType };
|
|
939
1064
|
}
|
|
940
|
-
async
|
|
1065
|
+
async browseResources(limit, archived, query, options) {
|
|
941
1066
|
const searchParams = new URLSearchParams();
|
|
942
1067
|
if (limit) searchParams.append("limit", limit.toString());
|
|
943
1068
|
if (archived !== void 0) searchParams.append("archived", archived.toString());
|
|
@@ -961,13 +1086,7 @@ var SemiontApiClient = class {
|
|
|
961
1086
|
auth: options?.auth
|
|
962
1087
|
}).json();
|
|
963
1088
|
}
|
|
964
|
-
async
|
|
965
|
-
return this.http.get(`${this.baseUrl}/resources/${id}/annotations`, {
|
|
966
|
-
...options,
|
|
967
|
-
auth: options?.auth
|
|
968
|
-
}).json();
|
|
969
|
-
}
|
|
970
|
-
async getAnnotationLLMContext(resourceId, annotationId, options) {
|
|
1089
|
+
async gatherAnnotation(resourceId, annotationId, options) {
|
|
971
1090
|
const searchParams = new URLSearchParams();
|
|
972
1091
|
if (options?.contextWindow) {
|
|
973
1092
|
searchParams.append("contextWindow", options.contextWindow.toString());
|
|
@@ -980,7 +1099,7 @@ var SemiontApiClient = class {
|
|
|
980
1099
|
}
|
|
981
1100
|
).json();
|
|
982
1101
|
}
|
|
983
|
-
async
|
|
1102
|
+
async browseReferences(id, options) {
|
|
984
1103
|
return this.http.get(`${this.baseUrl}/resources/${id}/referenced-by`, {
|
|
985
1104
|
...options,
|
|
986
1105
|
auth: options?.auth
|
|
@@ -1008,7 +1127,7 @@ var SemiontApiClient = class {
|
|
|
1008
1127
|
// ============================================================================
|
|
1009
1128
|
// ANNOTATIONS
|
|
1010
1129
|
// ============================================================================
|
|
1011
|
-
async
|
|
1130
|
+
async markAnnotation(id, data, options) {
|
|
1012
1131
|
return this.http.post(`${this.baseUrl}/resources/${id}/annotations`, {
|
|
1013
1132
|
json: data,
|
|
1014
1133
|
...options,
|
|
@@ -1021,13 +1140,13 @@ var SemiontApiClient = class {
|
|
|
1021
1140
|
auth: options?.auth
|
|
1022
1141
|
}).json();
|
|
1023
1142
|
}
|
|
1024
|
-
async
|
|
1143
|
+
async browseAnnotation(resourceId, annotationId, options) {
|
|
1025
1144
|
return this.http.get(`${this.baseUrl}/resources/${resourceId}/annotations/${annotationId}`, {
|
|
1026
1145
|
...options,
|
|
1027
1146
|
auth: options?.auth
|
|
1028
1147
|
}).json();
|
|
1029
1148
|
}
|
|
1030
|
-
async
|
|
1149
|
+
async browseAnnotations(id, motivation, options) {
|
|
1031
1150
|
const searchParams = new URLSearchParams();
|
|
1032
1151
|
if (motivation) searchParams.append("motivation", motivation);
|
|
1033
1152
|
return this.http.get(`${this.baseUrl}/resources/${id}/annotations`, {
|
|
@@ -1042,7 +1161,7 @@ var SemiontApiClient = class {
|
|
|
1042
1161
|
auth: options?.auth
|
|
1043
1162
|
});
|
|
1044
1163
|
}
|
|
1045
|
-
async
|
|
1164
|
+
async bindAnnotation(resourceId, annotationId, data, options) {
|
|
1046
1165
|
await this.http.put(`${this.baseUrl}/resources/${resourceId}/annotations/${annotationId}/body`, {
|
|
1047
1166
|
json: data,
|
|
1048
1167
|
...options,
|
|
@@ -1080,6 +1199,16 @@ var SemiontApiClient = class {
|
|
|
1080
1199
|
}).json();
|
|
1081
1200
|
}
|
|
1082
1201
|
// ============================================================================
|
|
1202
|
+
// PARTICIPANTS
|
|
1203
|
+
// ============================================================================
|
|
1204
|
+
async beckonAttention(participantId, data, options) {
|
|
1205
|
+
return this.http.post(`${this.baseUrl}/api/participants/${participantId}/attention`, {
|
|
1206
|
+
json: data,
|
|
1207
|
+
...options,
|
|
1208
|
+
auth: options?.auth
|
|
1209
|
+
}).json();
|
|
1210
|
+
}
|
|
1211
|
+
// ============================================================================
|
|
1083
1212
|
// ADMIN
|
|
1084
1213
|
// ============================================================================
|
|
1085
1214
|
async listUsers(options) {
|
|
@@ -1254,7 +1383,7 @@ var SemiontApiClient = class {
|
|
|
1254
1383
|
// ============================================================================
|
|
1255
1384
|
// LLM CONTEXT
|
|
1256
1385
|
// ============================================================================
|
|
1257
|
-
async
|
|
1386
|
+
async gatherResource(id, options) {
|
|
1258
1387
|
const searchParams = new URLSearchParams();
|
|
1259
1388
|
if (options?.depth !== void 0) searchParams.append("depth", options.depth.toString());
|
|
1260
1389
|
if (options?.maxResources !== void 0) searchParams.append("maxResources", options.maxResources.toString());
|
|
@@ -1309,7 +1438,7 @@ var EventBusClient = class {
|
|
|
1309
1438
|
// ========================================================================
|
|
1310
1439
|
// Browse Flow — Resource reads
|
|
1311
1440
|
// ========================================================================
|
|
1312
|
-
async
|
|
1441
|
+
async browseResource(resourceId) {
|
|
1313
1442
|
return eventBusRequest(
|
|
1314
1443
|
this.eventBus,
|
|
1315
1444
|
"browse:resource-requested",
|
|
@@ -1319,7 +1448,7 @@ var EventBusClient = class {
|
|
|
1319
1448
|
this.timeoutMs
|
|
1320
1449
|
);
|
|
1321
1450
|
}
|
|
1322
|
-
async
|
|
1451
|
+
async browseResources(options) {
|
|
1323
1452
|
return eventBusRequest(
|
|
1324
1453
|
this.eventBus,
|
|
1325
1454
|
"browse:resources-requested",
|
|
@@ -1453,7 +1582,7 @@ var EventBusClient = class {
|
|
|
1453
1582
|
// ========================================================================
|
|
1454
1583
|
// Gather Flow — LLM context
|
|
1455
1584
|
// ========================================================================
|
|
1456
|
-
async
|
|
1585
|
+
async gatherAnnotation(annotationId, resourceId, options) {
|
|
1457
1586
|
const correlationId = crypto.randomUUID();
|
|
1458
1587
|
const result$ = merge(
|
|
1459
1588
|
this.eventBus.get("gather:complete").pipe(
|
|
@@ -1478,7 +1607,7 @@ var EventBusClient = class {
|
|
|
1478
1607
|
}
|
|
1479
1608
|
return result.response;
|
|
1480
1609
|
}
|
|
1481
|
-
async
|
|
1610
|
+
async gatherResource(resourceId, options) {
|
|
1482
1611
|
const correlationId = crypto.randomUUID();
|
|
1483
1612
|
const result$ = merge(
|
|
1484
1613
|
this.eventBus.get("gather:resource-complete").pipe(
|