@semiont/api-client 0.2.33-build.79 → 0.2.33-build.81

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.
@@ -1178,7 +1178,7 @@ interface paths {
1178
1178
  };
1179
1179
  requestBody?: {
1180
1180
  content: {
1181
- "application/json": components["schemas"]["GetEntityTypesResponse"];
1181
+ "application/json": components["schemas"]["DetectReferencesStreamRequest"];
1182
1182
  };
1183
1183
  };
1184
1184
  responses: {
@@ -2611,7 +2611,7 @@ interface components {
2611
2611
  success: boolean;
2612
2612
  message: string;
2613
2613
  };
2614
- DetectAnnotationsStreamRequest: {
2614
+ DetectReferencesStreamRequest: {
2615
2615
  /** @description Entity types to detect (e.g., 'Person', 'Organization', 'Location') */
2616
2616
  entityTypes: string[];
2617
2617
  /** @description Include anaphoric/cataphoric references (e.g., 'the CEO', 'the tech giant') in addition to direct mentions */
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { B as BaseUrl, A as AccessToken, R as ResourceUri, E as EntityType, a as AnnotationUri, c as components, b as Email, p as paths, d as RefreshToken, G as GoogleCredential, C as ContentFormat, S as SearchQuery, e as CloneToken, f as ResourceAnnotationUri, M as Motivation, U as UserDID, J as JobId } from './index-BUlCf43K.js';
2
- export { $ as $defs, aA as AuthCode, ai as BoundingBox, F as FragmentSelector, ax as JWTTokenSchema, Z as LOCALES, Y as LocaleInfo, aB as MCPToken, ah as Point, i as Selector, h as SvgSelector, V as TextPosition, T as TextPositionSelector, g as TextQuoteSelector, aq as ValidatedAnnotation, av as ValidationFailure, aw as ValidationResult, au as ValidationSuccess, aF as accessToken, aP as annotationUri, aD as authCode, aN as baseUrl, aI as cloneToken, al as createCircleSvg, ak as createPolygonSvg, aj as createRectangleSvg, ag as decodeRepresentation, at as decodeWithCharset, aC as email, aL as entityType, Q as extractBoundingBox, as as extractCharset, ap as extractContext, W as findTextWithContext, a2 as formatLocaleDisplay, a3 as getAllLocaleCodes, H as getAnnotationExactText, j as getBodySource, k as getBodyType, a7 as getChecksum, x as getCommentText, aa as getCreator, ab as getDerivedFrom, D as getExactText, O as getFragmentSelector, a8 as getLanguage, a1 as getLocaleEnglishName, _ as getLocaleInfo, a0 as getLocaleNativeName, af as getNodeEncoding, a6 as getPrimaryMediaType, a5 as getPrimaryRepresentation, I as getPrimarySelector, ad as getResourceEntityTypes, a4 as getResourceId, a9 as getStorageUri, N as getSvgSelector, n as getTargetSelector, m as getTargetSource, K as getTextPositionSelector, L as getTextQuoteSelector, aE as googleCredential, q as hasTargetSelector, ac as isArchived, t as isAssessment, l as isBodyResolved, u as isComment, ae as isDraft, r as isHighlight, s as isReference, z as isResolvedReference, y as isStubReference, v as isTag, az as isValidEmail, aJ as jobId, aH as mcpToken, an as normalizeCoordinates, o as operations, am as parseSvgSelector, aG as refreshToken, aQ as resourceAnnotationUri, aO as resourceUri, ao as scaleSvgToNative, aM as searchQuery, aK as userDID, ar as validateAndCorrectOffsets, ay as validateData, P as validateSvgMarkup, X as verifyPosition, w as webhooks } from './index-BUlCf43K.js';
1
+ import { B as BaseUrl, R as ResourceUri, E as EntityType, A as AccessToken, a as AnnotationUri, c as components, b as Email, p as paths, d as RefreshToken, G as GoogleCredential, C as ContentFormat, S as SearchQuery, e as CloneToken, f as ResourceAnnotationUri, M as Motivation, U as UserDID, J as JobId } from './index-vuErmLIm.js';
2
+ export { $ as $defs, aA as AuthCode, ai as BoundingBox, F as FragmentSelector, ax as JWTTokenSchema, Z as LOCALES, Y as LocaleInfo, aB as MCPToken, ah as Point, i as Selector, h as SvgSelector, V as TextPosition, T as TextPositionSelector, g as TextQuoteSelector, aq as ValidatedAnnotation, av as ValidationFailure, aw as ValidationResult, au as ValidationSuccess, aF as accessToken, aP as annotationUri, aD as authCode, aN as baseUrl, aI as cloneToken, al as createCircleSvg, ak as createPolygonSvg, aj as createRectangleSvg, ag as decodeRepresentation, at as decodeWithCharset, aC as email, aL as entityType, Q as extractBoundingBox, as as extractCharset, ap as extractContext, W as findTextWithContext, a2 as formatLocaleDisplay, a3 as getAllLocaleCodes, H as getAnnotationExactText, j as getBodySource, k as getBodyType, a7 as getChecksum, x as getCommentText, aa as getCreator, ab as getDerivedFrom, D as getExactText, O as getFragmentSelector, a8 as getLanguage, a1 as getLocaleEnglishName, _ as getLocaleInfo, a0 as getLocaleNativeName, af as getNodeEncoding, a6 as getPrimaryMediaType, a5 as getPrimaryRepresentation, I as getPrimarySelector, ad as getResourceEntityTypes, a4 as getResourceId, a9 as getStorageUri, N as getSvgSelector, n as getTargetSelector, m as getTargetSource, K as getTextPositionSelector, L as getTextQuoteSelector, aE as googleCredential, q as hasTargetSelector, ac as isArchived, t as isAssessment, l as isBodyResolved, u as isComment, ae as isDraft, r as isHighlight, s as isReference, z as isResolvedReference, y as isStubReference, v as isTag, az as isValidEmail, aJ as jobId, aH as mcpToken, an as normalizeCoordinates, o as operations, am as parseSvgSelector, aG as refreshToken, aQ as resourceAnnotationUri, aO as resourceUri, ao as scaleSvgToNative, aM as searchQuery, aK as userDID, ar as validateAndCorrectOffsets, ay as validateData, P as validateSvgMarkup, X as verifyPosition, w as webhooks } from './index-vuErmLIm.js';
3
3
 
4
4
  /**
5
5
  * TypeScript types for Server-Sent Events (SSE) streaming
@@ -9,13 +9,13 @@ export { $ as $defs, aA as AuthCode, ai as BoundingBox, F as FragmentSelector, a
9
9
  * type safety for client code consuming the streams.
10
10
  */
11
11
  /**
12
- * Progress event for entity detection stream
12
+ * Progress event for reference/linking detection stream
13
13
  *
14
14
  * Sent by POST /resources/:id/detect-annotations-stream
15
15
  *
16
16
  * @example
17
17
  * ```typescript
18
- * stream.onProgress((progress: DetectionProgress) => {
18
+ * stream.onProgress((progress: ReferenceDetectionProgress) => {
19
19
  * if (progress.status === 'scanning') {
20
20
  * console.log(`Scanning for ${progress.currentEntityType}...`);
21
21
  * console.log(`Progress: ${progress.processedEntityTypes}/${progress.totalEntityTypes}`);
@@ -23,7 +23,7 @@ export { $ as $defs, aA as AuthCode, ai as BoundingBox, F as FragmentSelector, a
23
23
  * });
24
24
  * ```
25
25
  */
26
- interface DetectionProgress {
26
+ interface ReferenceDetectionProgress {
27
27
  /** Current status of detection operation */
28
28
  status: 'started' | 'scanning' | 'complete' | 'error';
29
29
  /** Resource ID being scanned */
@@ -311,9 +311,9 @@ interface Logger {
311
311
  */
312
312
 
313
313
  /**
314
- * Request body for detection stream
314
+ * Request body for reference detection stream
315
315
  */
316
- interface DetectAnnotationsStreamRequest {
316
+ interface DetectReferencesStreamRequest {
317
317
  entityTypes: EntityType[];
318
318
  includeDescriptiveReferences?: boolean;
319
319
  }
@@ -327,12 +327,17 @@ type GenerateResourceStreamRequest = components['schemas']['GenerateResourceStre
327
327
  */
328
328
  interface DetectHighlightsStreamRequest {
329
329
  instructions?: string;
330
+ /** Desired number of highlights per 2000 words (1-15) */
331
+ density?: number;
330
332
  }
331
333
  /**
332
334
  * Request body for assessment detection stream
333
335
  */
334
336
  interface DetectAssessmentsStreamRequest {
335
337
  instructions?: string;
338
+ tone?: 'analytical' | 'critical' | 'balanced' | 'constructive';
339
+ /** Desired number of assessments per 2000 words (1-10) */
340
+ density?: number;
336
341
  }
337
342
  /**
338
343
  * Request body for comment detection stream
@@ -340,6 +345,8 @@ interface DetectAssessmentsStreamRequest {
340
345
  interface DetectCommentsStreamRequest {
341
346
  instructions?: string;
342
347
  tone?: 'scholarly' | 'explanatory' | 'conversational' | 'technical';
348
+ /** Desired number of comments per 2000 words (2-12) */
349
+ density?: number;
343
350
  }
344
351
  /**
345
352
  * Request body for tag detection stream
@@ -353,25 +360,32 @@ interface DetectTagsStreamRequest {
353
360
  */
354
361
  interface SSEClientConfig {
355
362
  baseUrl: BaseUrl;
356
- accessToken?: AccessToken;
357
363
  logger?: Logger;
358
364
  }
365
+ /**
366
+ * Options for SSE requests
367
+ */
368
+ interface SSERequestOptions {
369
+ auth?: AccessToken;
370
+ }
359
371
  /**
360
372
  * SSE Client for real-time streaming operations
361
373
  *
362
374
  * Separate from the main HTTP client to clearly mark streaming endpoints.
363
375
  * Uses native fetch() instead of ky for SSE support.
364
376
  *
377
+ * This client is stateless - auth tokens are passed per-request via options.
378
+ *
365
379
  * @example
366
380
  * ```typescript
367
381
  * const sseClient = new SSEClient({
368
- * baseUrl: 'http://localhost:4000',
369
- * accessToken: 'your-token'
382
+ * baseUrl: 'http://localhost:4000'
370
383
  * });
371
384
  *
372
- * const stream = sseClient.detectAnnotations(
385
+ * const stream = sseClient.detectReferences(
373
386
  * 'http://localhost:4000/resources/doc-123',
374
- * { entityTypes: ['Person', 'Organization'] }
387
+ * { entityTypes: ['Person', 'Organization'] },
388
+ * { auth: 'your-token' }
375
389
  * );
376
390
  *
377
391
  * stream.onProgress((p) => console.log(p.message));
@@ -381,17 +395,8 @@ interface SSEClientConfig {
381
395
  */
382
396
  declare class SSEClient {
383
397
  private baseUrl;
384
- private accessToken;
385
398
  private logger?;
386
399
  constructor(config: SSEClientConfig);
387
- /**
388
- * Set the access token for authenticated requests
389
- */
390
- setAccessToken(token: AccessToken): void;
391
- /**
392
- * Clear the access token
393
- */
394
- clearAccessToken(): void;
395
400
  /**
396
401
  * Get common headers for SSE requests
397
402
  */
@@ -411,13 +416,15 @@ declare class SSEClient {
411
416
  *
412
417
  * @param resourceId - Resource URI or ID
413
418
  * @param request - Detection configuration (entity types to detect)
419
+ * @param options - Request options (auth token)
414
420
  * @returns SSE stream controller with progress/complete/error callbacks
415
421
  *
416
422
  * @example
417
423
  * ```typescript
418
- * const stream = sseClient.detectAnnotations(
424
+ * const stream = sseClient.detectReferences(
419
425
  * 'http://localhost:4000/resources/doc-123',
420
- * { entityTypes: ['Person', 'Organization'] }
426
+ * { entityTypes: ['Person', 'Organization'] },
427
+ * { auth: 'your-token' }
421
428
  * );
422
429
  *
423
430
  * stream.onProgress((progress) => {
@@ -437,7 +444,7 @@ declare class SSEClient {
437
444
  * stream.close();
438
445
  * ```
439
446
  */
440
- detectAnnotations(resourceId: ResourceUri, request: DetectAnnotationsStreamRequest): SSEStream<DetectionProgress, DetectionProgress>;
447
+ detectReferences(resourceId: ResourceUri, request: DetectReferencesStreamRequest, options?: SSERequestOptions): SSEStream<ReferenceDetectionProgress, ReferenceDetectionProgress>;
441
448
  /**
442
449
  * Generate resource from annotation (streaming)
443
450
  *
@@ -446,6 +453,7 @@ declare class SSEClient {
446
453
  * @param resourceId - Source resource URI or ID
447
454
  * @param annotationId - Annotation URI or ID to use as generation source
448
455
  * @param request - Generation options (title, prompt, language)
456
+ * @param options - Request options (auth token)
449
457
  * @returns SSE stream controller with progress/complete/error callbacks
450
458
  *
451
459
  * @example
@@ -453,7 +461,8 @@ declare class SSEClient {
453
461
  * const stream = sseClient.generateResourceFromAnnotation(
454
462
  * 'http://localhost:4000/resources/doc-123',
455
463
  * 'http://localhost:4000/annotations/ann-456',
456
- * { language: 'es', title: 'Spanish Summary' }
464
+ * { language: 'es', title: 'Spanish Summary' },
465
+ * { auth: 'your-token' }
457
466
  * );
458
467
  *
459
468
  * stream.onProgress((progress) => {
@@ -473,7 +482,7 @@ declare class SSEClient {
473
482
  * stream.close();
474
483
  * ```
475
484
  */
476
- generateResourceFromAnnotation(resourceId: ResourceUri, annotationId: AnnotationUri, request: GenerateResourceStreamRequest): SSEStream<GenerationProgress, GenerationProgress>;
485
+ generateResourceFromAnnotation(resourceId: ResourceUri, annotationId: AnnotationUri, request: GenerateResourceStreamRequest, options?: SSERequestOptions): SSEStream<GenerationProgress, GenerationProgress>;
477
486
  /**
478
487
  * Detect highlights in a resource (streaming)
479
488
  *
@@ -481,13 +490,15 @@ declare class SSEClient {
481
490
  *
482
491
  * @param resourceId - Resource URI or ID
483
492
  * @param request - Detection configuration (optional instructions)
493
+ * @param options - Request options (auth token)
484
494
  * @returns SSE stream controller with progress/complete/error callbacks
485
495
  *
486
496
  * @example
487
497
  * ```typescript
488
498
  * const stream = sseClient.detectHighlights(
489
499
  * 'http://localhost:4000/resources/doc-123',
490
- * { instructions: 'Focus on key technical points' }
500
+ * { instructions: 'Focus on key technical points' },
501
+ * { auth: 'your-token' }
491
502
  * );
492
503
  *
493
504
  * stream.onProgress((progress) => {
@@ -507,7 +518,7 @@ declare class SSEClient {
507
518
  * stream.close();
508
519
  * ```
509
520
  */
510
- detectHighlights(resourceId: ResourceUri, request?: DetectHighlightsStreamRequest): SSEStream<HighlightDetectionProgress, HighlightDetectionProgress>;
521
+ detectHighlights(resourceId: ResourceUri, request?: DetectHighlightsStreamRequest, options?: SSERequestOptions): SSEStream<HighlightDetectionProgress, HighlightDetectionProgress>;
511
522
  /**
512
523
  * Detect assessments in a resource (streaming)
513
524
  *
@@ -515,13 +526,15 @@ declare class SSEClient {
515
526
  *
516
527
  * @param resourceId - Resource URI or ID
517
528
  * @param request - Detection configuration (optional instructions)
529
+ * @param options - Request options (auth token)
518
530
  * @returns SSE stream controller with progress/complete/error callbacks
519
531
  *
520
532
  * @example
521
533
  * ```typescript
522
534
  * const stream = sseClient.detectAssessments(
523
535
  * 'http://localhost:4000/resources/doc-123',
524
- * { instructions: 'Evaluate claims for accuracy' }
536
+ * { instructions: 'Evaluate claims for accuracy' },
537
+ * { auth: 'your-token' }
525
538
  * );
526
539
  *
527
540
  * stream.onProgress((progress) => {
@@ -541,7 +554,7 @@ declare class SSEClient {
541
554
  * stream.close();
542
555
  * ```
543
556
  */
544
- detectAssessments(resourceId: ResourceUri, request?: DetectAssessmentsStreamRequest): SSEStream<AssessmentDetectionProgress, AssessmentDetectionProgress>;
557
+ detectAssessments(resourceId: ResourceUri, request?: DetectAssessmentsStreamRequest, options?: SSERequestOptions): SSEStream<AssessmentDetectionProgress, AssessmentDetectionProgress>;
545
558
  /**
546
559
  * Detect comments in a resource (streaming)
547
560
  *
@@ -551,14 +564,19 @@ declare class SSEClient {
551
564
  *
552
565
  * @param resourceId - Resource URI or ID
553
566
  * @param request - Detection configuration (optional instructions and tone)
567
+ * @param options - Request options (auth token)
554
568
  * @returns SSE stream controller with progress/complete/error callbacks
555
569
  *
556
570
  * @example
557
571
  * ```typescript
558
- * const stream = sseClient.detectComments('http://localhost:4000/resources/doc-123', {
559
- * instructions: 'Focus on technical terminology',
560
- * tone: 'scholarly'
561
- * });
572
+ * const stream = sseClient.detectComments(
573
+ * 'http://localhost:4000/resources/doc-123',
574
+ * {
575
+ * instructions: 'Focus on technical terminology',
576
+ * tone: 'scholarly'
577
+ * },
578
+ * { auth: 'your-token' }
579
+ * );
562
580
  *
563
581
  * stream.onProgress((progress) => {
564
582
  * console.log(`${progress.status}: ${progress.percentage}%`);
@@ -576,7 +594,7 @@ declare class SSEClient {
576
594
  * stream.close();
577
595
  * ```
578
596
  */
579
- detectComments(resourceId: ResourceUri, request?: DetectCommentsStreamRequest): SSEStream<CommentDetectionProgress, CommentDetectionProgress>;
597
+ detectComments(resourceId: ResourceUri, request?: DetectCommentsStreamRequest, options?: SSERequestOptions): SSEStream<CommentDetectionProgress, CommentDetectionProgress>;
580
598
  /**
581
599
  * Detect tags in a resource (streaming)
582
600
  *
@@ -586,14 +604,19 @@ declare class SSEClient {
586
604
  *
587
605
  * @param resourceId - Resource URI or ID
588
606
  * @param request - Detection configuration (schema and categories to detect)
607
+ * @param options - Request options (auth token)
589
608
  * @returns SSE stream controller with progress/complete/error callbacks
590
609
  *
591
610
  * @example
592
611
  * ```typescript
593
- * const stream = sseClient.detectTags('http://localhost:4000/resources/doc-123', {
594
- * schemaId: 'legal-irac',
595
- * categories: ['Issue', 'Rule', 'Application', 'Conclusion']
596
- * });
612
+ * const stream = sseClient.detectTags(
613
+ * 'http://localhost:4000/resources/doc-123',
614
+ * {
615
+ * schemaId: 'legal-irac',
616
+ * categories: ['Issue', 'Rule', 'Application', 'Conclusion']
617
+ * },
618
+ * { auth: 'your-token' }
619
+ * );
597
620
  *
598
621
  * stream.onProgress((progress) => {
599
622
  * console.log(`${progress.status}: ${progress.percentage}%`);
@@ -612,7 +635,7 @@ declare class SSEClient {
612
635
  * stream.close();
613
636
  * ```
614
637
  */
615
- detectTags(resourceId: ResourceUri, request: DetectTagsStreamRequest): SSEStream<TagDetectionProgress, TagDetectionProgress>;
638
+ detectTags(resourceId: ResourceUri, request: DetectTagsStreamRequest, options?: SSERequestOptions): SSEStream<TagDetectionProgress, TagDetectionProgress>;
616
639
  /**
617
640
  * Subscribe to resource events (long-lived stream)
618
641
  *
@@ -622,11 +645,15 @@ declare class SSEClient {
622
645
  * This stream does NOT have a complete event - it stays open until explicitly closed.
623
646
  *
624
647
  * @param resourceId - Resource URI or ID to subscribe to
648
+ * @param options - Request options (auth token)
625
649
  * @returns SSE stream controller with event callback
626
650
  *
627
651
  * @example
628
652
  * ```typescript
629
- * const stream = sseClient.resourceEvents('http://localhost:4000/resources/doc-123');
653
+ * const stream = sseClient.resourceEvents(
654
+ * 'http://localhost:4000/resources/doc-123',
655
+ * { auth: 'your-token' }
656
+ * );
630
657
  *
631
658
  * stream.onProgress((event) => {
632
659
  * console.log(`Event: ${event.type}`);
@@ -643,7 +670,9 @@ declare class SSEClient {
643
670
  * stream.close();
644
671
  * ```
645
672
  */
646
- resourceEvents(resourceId: ResourceUri): SSEStream<any, never>;
673
+ resourceEvents(resourceId: ResourceUri, options?: SSERequestOptions & {
674
+ onConnected?: () => void;
675
+ }): SSEStream<any, never>;
647
676
  }
648
677
 
649
678
  /**
@@ -689,20 +718,26 @@ declare class APIError extends Error {
689
718
  }
690
719
  interface SemiontApiClientConfig {
691
720
  baseUrl: BaseUrl;
692
- accessToken?: AccessToken;
693
721
  timeout?: number;
694
722
  retry?: number;
695
723
  logger?: Logger;
696
724
  }
725
+ /**
726
+ * Options for individual API requests
727
+ */
728
+ interface RequestOptions {
729
+ /** Access token for this request */
730
+ auth?: AccessToken;
731
+ }
697
732
  /**
698
733
  * Semiont API Client
699
734
  *
700
735
  * Provides type-safe methods for all Semiont backend API endpoints.
736
+ * This client is fully stateless - authentication must be provided per request.
701
737
  */
702
738
  declare class SemiontApiClient {
703
739
  private http;
704
740
  private baseUrl;
705
- private accessToken;
706
741
  private logger?;
707
742
  /**
708
743
  * SSE streaming client for real-time operations
@@ -714,7 +749,8 @@ declare class SemiontApiClient {
714
749
  * ```typescript
715
750
  * const stream = client.sse.detectAnnotations(
716
751
  * resourceId,
717
- * { entityTypes: ['Person', 'Organization'] }
752
+ * { entityTypes: ['Person', 'Organization'] },
753
+ * { auth: accessToken }
718
754
  * );
719
755
  *
720
756
  * stream.onProgress((p) => console.log(p.message));
@@ -724,21 +760,13 @@ declare class SemiontApiClient {
724
760
  */
725
761
  readonly sse: SSEClient;
726
762
  constructor(config: SemiontApiClientConfig);
727
- /**
728
- * Set the access token for authenticated requests
729
- */
730
- setAccessToken(token: AccessToken): void;
731
- /**
732
- * Clear the access token
733
- */
734
- clearAccessToken(): void;
735
- authenticatePassword(email: Email, password: string): Promise<ResponseContent<paths['/api/tokens/password']['post']>>;
736
- refreshToken(token: RefreshToken): Promise<ResponseContent<paths['/api/tokens/refresh']['post']>>;
737
- authenticateGoogle(credential: GoogleCredential): Promise<ResponseContent<paths['/api/tokens/google']['post']>>;
738
- generateMCPToken(): Promise<ResponseContent<paths['/api/tokens/mcp-generate']['post']>>;
739
- getMe(): Promise<ResponseContent<paths['/api/users/me']['get']>>;
740
- acceptTerms(): Promise<ResponseContent<paths['/api/users/accept-terms']['post']>>;
741
- logout(): Promise<ResponseContent<paths['/api/users/logout']['post']>>;
763
+ authenticatePassword(email: Email, password: string, options?: RequestOptions): Promise<ResponseContent<paths['/api/tokens/password']['post']>>;
764
+ refreshToken(token: RefreshToken, options?: RequestOptions): Promise<ResponseContent<paths['/api/tokens/refresh']['post']>>;
765
+ authenticateGoogle(credential: GoogleCredential, options?: RequestOptions): Promise<ResponseContent<paths['/api/tokens/google']['post']>>;
766
+ generateMCPToken(options?: RequestOptions): Promise<ResponseContent<paths['/api/tokens/mcp-generate']['post']>>;
767
+ getMe(options?: RequestOptions): Promise<ResponseContent<paths['/api/users/me']['get']>>;
768
+ acceptTerms(options?: RequestOptions): Promise<ResponseContent<paths['/api/users/accept-terms']['post']>>;
769
+ logout(options?: RequestOptions): Promise<ResponseContent<paths['/api/users/logout']['post']>>;
742
770
  /**
743
771
  * Create a new resource with binary content support
744
772
  *
@@ -751,6 +779,7 @@ declare class SemiontApiClient {
751
779
  * @param data.creationMethod - Optional creation method
752
780
  * @param data.sourceAnnotationId - Optional source annotation ID
753
781
  * @param data.sourceResourceId - Optional source resource ID
782
+ * @param options - Request options including auth
754
783
  */
755
784
  createResource(data: {
756
785
  name: string;
@@ -761,32 +790,33 @@ declare class SemiontApiClient {
761
790
  creationMethod?: string;
762
791
  sourceAnnotationId?: string;
763
792
  sourceResourceId?: string;
764
- }): Promise<ResponseContent<paths['/resources']['post']>>;
765
- getResource(resourceUri: ResourceUri): Promise<ResponseContent<paths['/resources/{id}']['get']>>;
793
+ }, options?: RequestOptions): Promise<ResponseContent<paths['/resources']['post']>>;
794
+ getResource(resourceUri: ResourceUri, options?: RequestOptions): Promise<ResponseContent<paths['/resources/{id}']['get']>>;
766
795
  /**
767
796
  * Get resource representation using W3C content negotiation
768
797
  * Returns raw binary content (images, PDFs, text, etc.) with content type
769
798
  *
770
799
  * @param resourceUri - Full resource URI
771
- * @param options - Options including Accept header for content negotiation
800
+ * @param options - Options including Accept header for content negotiation and auth
772
801
  * @returns Object with data (ArrayBuffer) and contentType (string)
773
802
  *
774
803
  * @example
775
804
  * ```typescript
776
805
  * // Get markdown representation
777
- * const { data, contentType } = await client.getResourceRepresentation(rUri, { accept: 'text/markdown' });
806
+ * const { data, contentType } = await client.getResourceRepresentation(rUri, { accept: 'text/markdown', auth: token });
778
807
  * const markdown = new TextDecoder().decode(data);
779
808
  *
780
809
  * // Get image representation
781
- * const { data, contentType } = await client.getResourceRepresentation(rUri, { accept: 'image/png' });
810
+ * const { data, contentType } = await client.getResourceRepresentation(rUri, { accept: 'image/png', auth: token });
782
811
  * const blob = new Blob([data], { type: contentType });
783
812
  *
784
813
  * // Get PDF representation
785
- * const { data, contentType } = await client.getResourceRepresentation(rUri, { accept: 'application/pdf' });
814
+ * const { data, contentType } = await client.getResourceRepresentation(rUri, { accept: 'application/pdf', auth: token });
786
815
  * ```
787
816
  */
788
817
  getResourceRepresentation(resourceUri: ResourceUri, options?: {
789
818
  accept?: ContentFormat;
819
+ auth?: AccessToken;
790
820
  }): Promise<{
791
821
  data: ArrayBuffer;
792
822
  contentType: string;
@@ -800,14 +830,15 @@ declare class SemiontApiClient {
800
830
  * until the stream is fully consumed or closed.
801
831
  *
802
832
  * @param resourceUri - Full resource URI
803
- * @param options - Options including Accept header for content negotiation
833
+ * @param options - Options including Accept header for content negotiation and auth
804
834
  * @returns Object with stream (ReadableStream) and contentType (string)
805
835
  *
806
836
  * @example
807
837
  * ```typescript
808
838
  * // Stream large file
809
839
  * const { stream, contentType } = await client.getResourceRepresentationStream(rUri, {
810
- * accept: 'video/mp4'
840
+ * accept: 'video/mp4',
841
+ * auth: token
811
842
  * });
812
843
  *
813
844
  * // Consume stream chunk by chunk (never loads entire file into memory)
@@ -828,44 +859,46 @@ declare class SemiontApiClient {
828
859
  */
829
860
  getResourceRepresentationStream(resourceUri: ResourceUri, options?: {
830
861
  accept?: ContentFormat;
862
+ auth?: AccessToken;
831
863
  }): Promise<{
832
864
  stream: ReadableStream<Uint8Array>;
833
865
  contentType: string;
834
866
  }>;
835
- listResources(limit?: number, archived?: boolean, query?: SearchQuery): Promise<ResponseContent<paths['/resources']['get']>>;
836
- updateResource(resourceUri: ResourceUri, data: RequestContent<paths['/resources/{id}']['patch']>): Promise<ResponseContent<paths['/resources/{id}']['patch']>>;
837
- getResourceEvents(resourceUri: ResourceUri): Promise<{
867
+ listResources(limit?: number, archived?: boolean, query?: SearchQuery, options?: RequestOptions): Promise<ResponseContent<paths['/resources']['get']>>;
868
+ updateResource(resourceUri: ResourceUri, data: RequestContent<paths['/resources/{id}']['patch']>, options?: RequestOptions): Promise<ResponseContent<paths['/resources/{id}']['patch']>>;
869
+ getResourceEvents(resourceUri: ResourceUri, options?: RequestOptions): Promise<{
838
870
  events: any[];
839
871
  }>;
840
- getResourceAnnotations(resourceUri: ResourceUri): Promise<ResponseContent<paths['/resources/{id}/annotations']['get']>>;
872
+ getResourceAnnotations(resourceUri: ResourceUri, options?: RequestOptions): Promise<ResponseContent<paths['/resources/{id}/annotations']['get']>>;
841
873
  getAnnotationLLMContext(resourceUri: ResourceUri, annotationId: string, options?: {
842
874
  contextWindow?: number;
875
+ auth?: AccessToken;
843
876
  }): Promise<ResponseContent<paths['/resources/{resourceId}/annotations/{annotationId}/llm-context']['get']>>;
844
- getResourceReferencedBy(resourceUri: ResourceUri): Promise<{
877
+ getResourceReferencedBy(resourceUri: ResourceUri, options?: RequestOptions): Promise<{
845
878
  referencedBy: any[];
846
879
  }>;
847
- generateCloneToken(resourceUri: ResourceUri): Promise<ResponseContent<paths['/resources/{id}/clone-with-token']['post']>>;
848
- getResourceByToken(token: CloneToken): Promise<ResponseContent<paths['/api/resources/token/{token}']['get']>>;
849
- createResourceFromToken(data: RequestContent<paths['/api/resources/create-from-token']['post']>): Promise<ResponseContent<paths['/api/resources/create-from-token']['post']>>;
850
- createAnnotation(resourceUri: ResourceUri, data: RequestContent<paths['/resources/{id}/annotations']['post']>): Promise<ResponseContent<paths['/resources/{id}/annotations']['post']>>;
851
- getAnnotation(annotationUri: AnnotationUri): Promise<ResponseContent<paths['/annotations/{id}']['get']>>;
852
- getResourceAnnotation(annotationUri: ResourceAnnotationUri): Promise<ResponseContent<paths['/resources/{resourceId}/annotations/{annotationId}']['get']>>;
853
- listAnnotations(resourceUri: ResourceUri, motivation?: Motivation): Promise<ResponseContent<paths['/resources/{id}/annotations']['get']>>;
854
- deleteAnnotation(annotationUri: ResourceAnnotationUri): Promise<void>;
855
- updateAnnotationBody(annotationUri: ResourceAnnotationUri, data: RequestContent<paths['/resources/{resourceId}/annotations/{annotationId}/body']['put']>): Promise<ResponseContent<paths['/resources/{resourceId}/annotations/{annotationId}/body']['put']>>;
856
- getAnnotationHistory(annotationUri: ResourceAnnotationUri): Promise<ResponseContent<paths['/resources/{resourceId}/annotations/{annotationId}/history']['get']>>;
857
- addEntityType(type: EntityType): Promise<ResponseContent<paths['/api/entity-types']['post']>>;
858
- addEntityTypesBulk(types: EntityType[]): Promise<ResponseContent<paths['/api/entity-types/bulk']['post']>>;
859
- listEntityTypes(): Promise<ResponseContent<paths['/api/entity-types']['get']>>;
860
- listUsers(): Promise<ResponseContent<paths['/api/admin/users']['get']>>;
861
- getUserStats(): Promise<ResponseContent<paths['/api/admin/users/stats']['get']>>;
880
+ generateCloneToken(resourceUri: ResourceUri, options?: RequestOptions): Promise<ResponseContent<paths['/resources/{id}/clone-with-token']['post']>>;
881
+ getResourceByToken(token: CloneToken, options?: RequestOptions): Promise<ResponseContent<paths['/api/resources/token/{token}']['get']>>;
882
+ createResourceFromToken(data: RequestContent<paths['/api/resources/create-from-token']['post']>, options?: RequestOptions): Promise<ResponseContent<paths['/api/resources/create-from-token']['post']>>;
883
+ createAnnotation(resourceUri: ResourceUri, data: RequestContent<paths['/resources/{id}/annotations']['post']>, options?: RequestOptions): Promise<ResponseContent<paths['/resources/{id}/annotations']['post']>>;
884
+ getAnnotation(annotationUri: AnnotationUri, options?: RequestOptions): Promise<ResponseContent<paths['/annotations/{id}']['get']>>;
885
+ getResourceAnnotation(annotationUri: ResourceAnnotationUri, options?: RequestOptions): Promise<ResponseContent<paths['/resources/{resourceId}/annotations/{annotationId}']['get']>>;
886
+ listAnnotations(resourceUri: ResourceUri, motivation?: Motivation, options?: RequestOptions): Promise<ResponseContent<paths['/resources/{id}/annotations']['get']>>;
887
+ deleteAnnotation(annotationUri: ResourceAnnotationUri, options?: RequestOptions): Promise<void>;
888
+ updateAnnotationBody(annotationUri: ResourceAnnotationUri, data: RequestContent<paths['/resources/{resourceId}/annotations/{annotationId}/body']['put']>, options?: RequestOptions): Promise<ResponseContent<paths['/resources/{resourceId}/annotations/{annotationId}/body']['put']>>;
889
+ getAnnotationHistory(annotationUri: ResourceAnnotationUri, options?: RequestOptions): Promise<ResponseContent<paths['/resources/{resourceId}/annotations/{annotationId}/history']['get']>>;
890
+ addEntityType(type: EntityType, options?: RequestOptions): Promise<ResponseContent<paths['/api/entity-types']['post']>>;
891
+ addEntityTypesBulk(types: EntityType[], options?: RequestOptions): Promise<ResponseContent<paths['/api/entity-types/bulk']['post']>>;
892
+ listEntityTypes(options?: RequestOptions): Promise<ResponseContent<paths['/api/entity-types']['get']>>;
893
+ listUsers(options?: RequestOptions): Promise<ResponseContent<paths['/api/admin/users']['get']>>;
894
+ getUserStats(options?: RequestOptions): Promise<ResponseContent<paths['/api/admin/users/stats']['get']>>;
862
895
  /**
863
896
  * Update a user by ID
864
897
  * Note: Users use DID identifiers (did:web:domain:users:id), not HTTP URIs.
865
898
  */
866
- updateUser(id: UserDID, data: RequestContent<paths['/api/admin/users/{id}']['patch']>): Promise<ResponseContent<paths['/api/admin/users/{id}']['patch']>>;
867
- getOAuthConfig(): Promise<ResponseContent<paths['/api/admin/oauth/config']['get']>>;
868
- getJobStatus(id: JobId): Promise<ResponseContent<paths['/api/jobs/{id}']['get']>>;
899
+ updateUser(id: UserDID, data: RequestContent<paths['/api/admin/users/{id}']['patch']>, options?: RequestOptions): Promise<ResponseContent<paths['/api/admin/users/{id}']['patch']>>;
900
+ getOAuthConfig(options?: RequestOptions): Promise<ResponseContent<paths['/api/admin/oauth/config']['get']>>;
901
+ getJobStatus(id: JobId, options?: RequestOptions): Promise<ResponseContent<paths['/api/jobs/{id}']['get']>>;
869
902
  /**
870
903
  * Poll a job until it completes or fails
871
904
  * @param id - The job ID to poll
@@ -876,15 +909,17 @@ declare class SemiontApiClient {
876
909
  interval?: number;
877
910
  timeout?: number;
878
911
  onProgress?: (status: ResponseContent<paths['/api/jobs/{id}']['get']>) => void;
912
+ auth?: AccessToken;
879
913
  }): Promise<ResponseContent<paths['/api/jobs/{id}']['get']>>;
880
914
  getResourceLLMContext(resourceUri: ResourceUri, options?: {
881
915
  depth?: number;
882
916
  maxResources?: number;
883
917
  includeContent?: boolean;
884
918
  includeSummary?: boolean;
919
+ auth?: AccessToken;
885
920
  }): Promise<ResponseContent<paths['/resources/{id}/llm-context']['get']>>;
886
- healthCheck(): Promise<ResponseContent<paths['/api/health']['get']>>;
887
- getStatus(): Promise<ResponseContent<paths['/api/status']['get']>>;
921
+ healthCheck(options?: RequestOptions): Promise<ResponseContent<paths['/api/health']['get']>>;
922
+ getStatus(options?: RequestOptions): Promise<ResponseContent<paths['/api/status']['get']>>;
888
923
  }
889
924
 
890
925
  /**
@@ -959,4 +994,4 @@ declare function getMimeCategory(mimeType: string): MimeCategory;
959
994
  type GenerationContext = components['schemas']['GenerationContext'];
960
995
  type AnnotationLLMContextResponse = components['schemas']['AnnotationLLMContextResponse'];
961
996
 
962
- export { APIError, AccessToken, type AnnotationLLMContextResponse, AnnotationUri, BaseUrl, CloneToken, ContentFormat, type DetectAnnotationsStreamRequest, type DetectionProgress, Email, EntityType, type GenerateResourceStreamRequest, type GenerationContext, type GenerationProgress, GoogleCredential, JobId, type Logger, type MimeCategory, Motivation, RefreshToken, ResourceAnnotationUri, ResourceUri, SSEClient, type SSEClientConfig, type SSEStream, SearchQuery, SemiontApiClient, type SemiontApiClientConfig, UserDID, components, getExtensionForMimeType, getMimeCategory, isImageMimeType, isPdfMimeType, isTextMimeType, paths };
997
+ export { APIError, AccessToken, type AnnotationLLMContextResponse, AnnotationUri, BaseUrl, CloneToken, ContentFormat, type DetectReferencesStreamRequest, Email, EntityType, type GenerateResourceStreamRequest, type GenerationContext, type GenerationProgress, GoogleCredential, JobId, type Logger, type MimeCategory, Motivation, type ReferenceDetectionProgress, RefreshToken, type RequestOptions, ResourceAnnotationUri, ResourceUri, SSEClient, type SSEClientConfig, type SSEStream, SearchQuery, SemiontApiClient, type SemiontApiClientConfig, UserDID, components, getExtensionForMimeType, getMimeCategory, isImageMimeType, isPdfMimeType, isTextMimeType, paths };