@semiont/core 0.5.17 → 0.5.19

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/testing.d.ts CHANGED
@@ -121,22 +121,6 @@ interface components {
121
121
  updatedAt: string;
122
122
  };
123
123
  };
124
- AdminUsersListResponse: {
125
- success: boolean;
126
- users: {
127
- id: string;
128
- email: string;
129
- name: string | null;
130
- image: string | null;
131
- domain: string;
132
- provider: string;
133
- isAdmin: boolean;
134
- isActive: boolean;
135
- lastLogin: string | null;
136
- created: string;
137
- updatedAt: string;
138
- }[];
139
- };
140
124
  AdminUserStatsResponse: {
141
125
  success: boolean;
142
126
  stats: {
@@ -156,6 +140,22 @@ interface components {
156
140
  }[];
157
141
  };
158
142
  };
143
+ AdminUsersListResponse: {
144
+ success: boolean;
145
+ users: {
146
+ id: string;
147
+ email: string;
148
+ name: string | null;
149
+ image: string | null;
150
+ domain: string;
151
+ provider: string;
152
+ isAdmin: boolean;
153
+ isActive: boolean;
154
+ lastLogin: string | null;
155
+ created: string;
156
+ updatedAt: string;
157
+ }[];
158
+ };
159
159
  /** @description Web Annotation / W3C PROV Agent. Discriminated by @type — Person, Organization, or Software. Each branch carries fields appropriate to its kind. Software peers are first-class participants, not a sub-class of Person. */
160
160
  Agent: ({
161
161
  /** @constant */
@@ -231,8 +231,19 @@ interface components {
231
231
  /** @description PROV-O wasAttributedTo — all parties responsible for this annotation. For human-prompted AI work this combines `creator` (the Person) and `generator` (the Software). For purely manual annotations it equals `[creator]`; for autonomous-agent work it equals `[generator]` (and `creator` may be the same Software). */
232
232
  wasAttributedTo?: components["schemas"]["Agent"] | components["schemas"]["Agent"][];
233
233
  };
234
+ /** @description Payload for mark:added domain event */
235
+ AnnotationAddedPayload: {
236
+ annotation: components["schemas"]["Annotation"];
237
+ /** @description SHA-256 of resource content at annotation time */
238
+ contentChecksum?: string;
239
+ };
234
240
  /** @description Phase 2: Body can be TextualBody (for entity tags, descriptions) or SpecificResource (for links) */
235
241
  AnnotationBody: components["schemas"]["TextualBody"] | components["schemas"]["SpecificResource"];
242
+ /** @description Payload for mark:body-updated domain event */
243
+ AnnotationBodyUpdatedPayload: {
244
+ annotationId: string;
245
+ operations: (components["schemas"]["BodyOperationAdd"] | components["schemas"]["BodyOperationRemove"] | components["schemas"]["BodyOperationReplace"])[];
246
+ };
236
247
  AnnotationContextResponse: {
237
248
  annotation: components["schemas"]["Annotation"];
238
249
  context: {
@@ -242,6 +253,10 @@ interface components {
242
253
  };
243
254
  resource: components["schemas"]["ResourceDescriptor"];
244
255
  };
256
+ /** @description Payload for mark:removed domain event */
257
+ AnnotationRemovedPayload: {
258
+ annotationId: string;
259
+ };
245
260
  /** @description W3C Web Annotation target object - source is required, selector is optional */
246
261
  AnnotationTarget: {
247
262
  /** @description IRI of the resource being annotated */
@@ -265,96 +280,59 @@ interface components {
265
280
  refreshToken: string;
266
281
  isNewUser: boolean;
267
282
  };
268
- BrowseFilesResponse: {
269
- /** @description The directory path that was listed, relative to project root */
270
- path: string;
271
- entries: components["schemas"]["DirectoryEntry"][];
272
- };
273
- /** @description Emit an event on the Semiont bus. Channel names come from bus-protocol.ts; payload shape is validated against the channel's registered schema (CHANNEL_SCHEMAS). An optional scope routes resource-scoped broadcasts (e.g. mark:added, job:complete) to per-resource subscribers via eventBus.scope(scope); leave it unset for unscoped/global events. */
274
- BusEmitRequest: {
275
- /** @description Channel name from bus-protocol.ts EventMap */
276
- channel: string;
277
- /** @description Channel-specific payload, validated against CHANNEL_SCHEMAS */
278
- payload: {
279
- [key: string]: unknown;
280
- };
281
- /** @description Optional resource scope for broadcast channels (e.g. resourceId). Publishers only — frontends must never set this. */
282
- scope?: string;
283
- };
284
- /** @description User's cookie consent preferences. `necessary` is always true — necessary cookies cannot be disabled. Timestamps and version are stamped server-side. */
285
- CookieConsent: {
286
- /** @enum {boolean} */
287
- necessary: true;
288
- analytics: boolean;
289
- marketing: boolean;
290
- preferences: boolean;
291
- /** Format: date-time */
292
- timestamp: string;
293
- version: string;
283
+ /** @description Emitted when an annotation receives focus for beckoning */
284
+ BeckonFocusEvent: {
285
+ annotationId?: string;
286
+ resourceId?: string;
294
287
  };
295
- /** @description Request body for POST /api/cookies/consent. All four preference fields must be booleans; `necessary` must be true. */
296
- CookieConsentRequest: {
297
- /** @enum {boolean} */
298
- necessary: true;
299
- analytics: boolean;
300
- marketing: boolean;
301
- preferences: boolean;
288
+ /** @description Emitted when an annotation is hovered over for beckoning */
289
+ BeckonHoverEvent: {
290
+ annotationId: string | null;
302
291
  };
303
- /** @description Standard envelope for cookie consent endpoints. On success `success: true` and `consent` carries the current preferences; on error `success: false` and `error` carries a human-readable message. */
304
- CookieConsentResponse: {
305
- success: boolean;
306
- consent?: components["schemas"]["CookieConsent"];
307
- error?: string;
292
+ /** @description Emitted when a sparkle effect is triggered on an annotation */
293
+ BeckonSparkleEvent: {
294
+ annotationId: string;
308
295
  };
309
- /** @description GDPR data export of a user's cookie-related data. The response is returned as a file download (Content-Disposition: attachment). */
310
- CookieExportResponse: {
311
- user: {
312
- id: string;
313
- email: string;
314
- };
315
- consent: components["schemas"]["CookieConsent"];
316
- /** Format: date-time */
317
- exportDate: string;
318
- dataRetentionPolicy: string;
296
+ /** @description Void success reply emitted on the bind:body-updated channel after bind:update-body has been applied, matched to the originating command by correlationId. */
297
+ BindBodyUpdated: {
298
+ /** @description Correlation id echoed from the originating bind:update-body command so busRequest can match the reply. */
299
+ correlationId: string;
319
300
  };
320
- DirectoryEntry: components["schemas"]["FileEntry"] | components["schemas"]["DirEntry"];
321
- FileEntry: {
322
- /** @enum {string} */
323
- type: "file";
324
- /** @description Entry name (basename) */
325
- name: string;
326
- /** @description Path relative to project root */
327
- path: string;
328
- /** @description File size in bytes */
329
- size: number;
330
- /**
331
- * Format: date-time
332
- * @description Last modified time (ISO 8601)
333
- */
334
- mtime: string;
335
- /** @description True if this file is a tracked resource in the Knowledge Base */
336
- tracked: boolean;
337
- /** @description Resource ID (only when tracked is true) */
338
- resourceId?: string;
339
- /** @description Entity types assigned to this resource (only when tracked is true) */
340
- entityTypes?: string[];
341
- /** @description Number of annotations on this resource (only when tracked is true) */
342
- annotationCount?: number;
343
- /** @description DID of the user who created the resource (only when tracked is true) */
344
- creator?: string;
301
+ /** @description Command payload sent on the bind:initiate bus channel to start a bind flow. */
302
+ BindInitiateCommand: {
303
+ /** @description Branded AnnotationId of the annotation being bound */
304
+ annotationId: string;
305
+ /** @description Branded ResourceId of the resource being bound to */
306
+ resourceId: string;
307
+ /** @description Default title for the bound annotation */
308
+ defaultTitle: string;
309
+ /** @description Entity types to associate with the annotation */
310
+ entityTypes: string[];
345
311
  };
346
- DirEntry: {
347
- /** @enum {string} */
348
- type: "dir";
349
- /** @description Entry name (basename) */
350
- name: string;
351
- /** @description Path relative to project root */
352
- path: string;
353
- /**
354
- * Format: date-time
355
- * @description Last modified time (ISO 8601)
356
- */
357
- mtime: string;
312
+ /** @description Command payload sent on the bind:update-body bus channel to modify annotation bodies. */
313
+ BindUpdateBodyCommand: {
314
+ /** @description Authenticated user's DID, injected by the /bus/emit gateway. Clients do not set this. */
315
+ _userId?: string;
316
+ /** @description Client-supplied id used to match this command to its result event(s) on the events-stream. Generated by the route handler if absent. */
317
+ correlationId: string;
318
+ /** @description Branded AnnotationId of the annotation whose body is being updated */
319
+ annotationId: string;
320
+ /** @description Branded ResourceId of the resource the annotation belongs to */
321
+ resourceId: string;
322
+ /** @description List of body mutation operations to apply */
323
+ operations: {
324
+ /**
325
+ * @description The type of body operation
326
+ * @enum {string}
327
+ */
328
+ op: "add" | "remove" | "replace";
329
+ /** @description Body item for add operations */
330
+ item?: components["schemas"]["AnnotationBody"];
331
+ /** @description Previous body item for replace operations */
332
+ oldItem?: components["schemas"]["AnnotationBody"];
333
+ /** @description Replacement body item for replace operations */
334
+ newItem?: components["schemas"]["AnnotationBody"];
335
+ }[];
358
336
  };
359
337
  BodyOperationAdd: {
360
338
  /** @enum {string} */
@@ -372,731 +350,38 @@ interface components {
372
350
  oldItem: components["schemas"]["TextualBody"] | components["schemas"]["SpecificResource"];
373
351
  newItem: components["schemas"]["TextualBody"] | components["schemas"]["SpecificResource"];
374
352
  };
375
- CloneResourceWithTokenResponse: {
376
- /** @description Generated clone token */
377
- token: string;
378
- /** @description ISO 8601 timestamp when token expires */
379
- expiresAt: string;
380
- resource: components["schemas"]["ResourceDescriptor"];
381
- };
382
- /** @description Error response for failed bus commands. Replaces native Error objects on the EventBus so payloads are serializable and OpenAPI-typed. */
383
- CommandError: {
384
- /** @description Optional correlation id echoed from the originating command. When present, the failure event can be matched back to the specific command that failed. */
385
- correlationId?: string;
386
- /** @description Human-readable error message */
387
- message: string;
388
- /** @description Optional additional context (stack trace, field name, etc.) */
389
- details?: string;
390
- };
391
- /**
392
- * @description Content format as a MIME type, optionally with parameters. The base type (everything before the first ';') MUST be a SupportedMediaType; parameters such as charset are preserved as metadata. Semantic validation happens in code at the create/yield boundary — there is deliberately no pattern here, the vocabulary lives in SupportedMediaType. Examples: text/plain, text/plain; charset=iso-8859-1, text/markdown; charset=windows-1252, image/png, application/pdf
393
- * @example text/plain; charset=utf-8
394
- */
395
- ContentFormat: string;
396
353
  /**
397
- * @description Base MIME types (no parameters) admitted by Semiont. Membership is the create/yield gate — every member is storable, nameable, and uploadable. What more the system can do with a type (render, annotate, extract text, author) is curated per type in @semiont/core's media-type registry, which is keyed by this enum.
354
+ * @description W3C Web Annotation body purpose vocabulary - https://www.w3.org/TR/annotation-vocab/#motivation
398
355
  * @enum {string}
399
356
  */
400
- SupportedMediaType: "text/plain" | "text/markdown" | "text/html" | "text/css" | "text/csv" | "text/xml" | "application/json" | "application/xml" | "application/yaml" | "application/x-yaml" | "application/pdf" | "application/msword" | "application/vnd.openxmlformats-officedocument.wordprocessingml.document" | "application/vnd.ms-excel" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "application/vnd.ms-powerpoint" | "application/vnd.openxmlformats-officedocument.presentationml.presentation" | "application/zip" | "application/gzip" | "application/x-tar" | "application/x-7z-compressed" | "application/octet-stream" | "application/wasm" | "image/png" | "image/jpeg" | "image/gif" | "image/webp" | "image/svg+xml" | "image/bmp" | "image/tiff" | "image/x-icon" | "video/mp4" | "video/mpeg" | "video/webm" | "video/ogg" | "video/quicktime" | "video/x-msvideo" | "audio/mpeg" | "audio/wav" | "audio/ogg" | "audio/webm" | "audio/aac" | "audio/flac" | "text/javascript" | "application/javascript" | "text/x-typescript" | "application/typescript" | "text/x-python" | "text/x-java" | "text/x-c" | "text/x-c++" | "text/x-csharp" | "text/x-go" | "text/x-rust" | "text/x-ruby" | "text/x-php" | "text/x-swift" | "text/x-kotlin" | "text/x-shell" | "font/woff" | "font/woff2" | "font/ttf" | "font/otf";
401
- ContextualSummaryResponse: {
402
- summary: string;
403
- relevantFields: {
404
- [key: string]: unknown;
405
- };
406
- context: {
407
- before?: string;
408
- selected: string;
409
- after?: string;
410
- };
357
+ BodyPurpose: "assessing" | "bookmarking" | "classifying" | "commenting" | "describing" | "editing" | "highlighting" | "identifying" | "linking" | "moderating" | "questioning" | "replying" | "tagging";
358
+ /** @description Request to browse the KB's collaborator directory (its declared Agents) */
359
+ BrowseAgentsRequest: {
360
+ correlationId: string;
411
361
  };
412
- CreateAnnotationRequest: {
413
- motivation: components["schemas"]["Motivation"];
414
- target: components["schemas"]["AnnotationTarget"];
415
- /** @description Optional body. Omit for annotations whose motivation alone is meaningful (highlighting) or whose user-supplied content is empty. Shape matches Annotation.body. */
416
- body?: components["schemas"]["AnnotationBody"] | components["schemas"]["AnnotationBody"][];
362
+ /** @description Result of browsing the collaborator directory */
363
+ BrowseAgentsResult: {
364
+ correlationId: string;
365
+ response: {
366
+ agents: components["schemas"]["CollaboratorEntry"][];
367
+ };
417
368
  };
418
- /** @description Response body for POST /resources (202 Accepted). Resource creation is asynchronous — the backend writes content to disk, emits yield:create on the bus, and returns the newly-minted resourceId immediately. Consumers watch SSE domain events (yield:created) to observe the fully-persisted state. */
419
- CreateResourceResponse: {
420
- /** @description The id of the newly-created resource. Assigned by Stower when it persists yield:create. */
369
+ /** @description Request to get contextual text around an annotation */
370
+ BrowseAnnotationContextRequest: {
371
+ correlationId: string;
372
+ annotationId: string;
421
373
  resourceId: string;
374
+ contextBefore?: number;
375
+ contextAfter?: number;
422
376
  };
423
- DeleteUserResponse: {
424
- success: boolean;
425
- message: string;
426
- };
427
- /** @description Progress payload emitted on the gather:annotation-progress SSE channel during LLM context gathering. */
428
- GatherProgress: {
429
- message?: string;
430
- percentage?: number;
377
+ /** @description Request to browse the history of an annotation */
378
+ BrowseAnnotationHistoryRequest: {
379
+ correlationId: string;
380
+ resourceId: string;
381
+ annotationId: string;
431
382
  };
432
- /** @description Search results payload emitted on match:search-results SSE channel. */
433
- MatchSearchResult: {
434
- correlationId: string;
435
- referenceId: string;
436
- response: (components["schemas"]["ResourceDescriptor"] & {
437
- /** @description Relevance score */
438
- score?: number;
439
- /** @description Human-readable reason for the match */
440
- matchReason?: string;
441
- })[];
442
- };
443
- /** @description Error payload emitted on match:search-failed SSE channel. */
444
- MatchSearchFailed: {
445
- correlationId: string;
446
- referenceId: string;
447
- error: string;
448
- };
449
- /** @description Metadata added at persistence time. Part of every StoredEvent. Integrity is provided by git at the commit level (when gitSync is enabled), not by in-event metadata fields. */
450
- EventMetadata: {
451
- /** @description Monotonic position in the event log (ordering authority) */
452
- sequenceNumber: number;
453
- /** @description Optional correlation id propagated from a command. Lets clients match command-result events back to the POST that initiated them. Set by EventStore.appendEvent's options when a route handler passes one through. */
454
- correlationId?: string;
455
- };
456
- /** @description Selection data for user-initiated annotations. Captures the text range and optional selector information from a user's highlight in the UI. */
457
- SelectionData: {
458
- /** @description The exact selected text */
459
- exact: string;
460
- /** @description Start character offset */
461
- start: number;
462
- /** @description End character offset */
463
- end: number;
464
- /** @description SVG selector for non-text selections (e.g. PDF regions) */
465
- svgSelector?: string;
466
- /** @description Fragment selector (e.g. page=2) */
467
- fragmentSelector?: string;
468
- /** @description Specification the fragment selector conforms to */
469
- conformsTo?: string;
470
- /** @description Text before the selection (for disambiguation) */
471
- prefix?: string;
472
- /** @description Text after the selection (for disambiguation) */
473
- suffix?: string;
474
- };
475
- /** @description A persisted domain event with metadata. Flat shape — event fields and metadata are peers. */
476
- StoredEventResponse: {
477
- /** @description Unique event ID (UUID) */
478
- id: string;
479
- /** @description Event type (flow verb name, e.g. mark:added) */
480
- type: string;
481
- /**
482
- * Format: date-time
483
- * @description When the event occurred
484
- */
485
- timestamp: string;
486
- /** @description DID of the user who triggered the event */
487
- userId: string;
488
- /** @description Resource this event affects (absent for system events) */
489
- resourceId?: string;
490
- /** @description Event schema version */
491
- version: number;
492
- /** @description Event-type-specific payload */
493
- payload: {
494
- [key: string]: unknown;
495
- };
496
- metadata: components["schemas"]["EventMetadata"];
497
- };
498
- /** @description Wire format emitted by GET /resources/:id/events/stream. Extends StoredEventResponse with optional enrichment fields populated from the materialized view at SSE-write time. Subscribers can read the enrichment fields directly to update local caches without an additional fetch. */
499
- EnrichedResourceEvent: components["schemas"]["StoredEventResponse"] & {
500
- /** @description Populated for events that mutate an annotation (mark:added, mark:body-updated, mark:removed). Carries the post-materialization annotation as it exists in the view, so subscribers can update local caches in-place without refetching. Absent for events that don't touch annotations. */
501
- annotation?: components["schemas"]["Annotation"];
502
- };
503
- /** @description Payload for yield:created domain event */
504
- ResourceCreatedPayload: {
505
- name: string;
506
- format: components["schemas"]["ContentFormat"];
507
- /** @description SHA-256 of content */
508
- contentChecksum: string;
509
- contentByteSize?: number;
510
- entityTypes?: string[];
511
- /** @description Working-tree URI (e.g. file://docs/overview.md) */
512
- storageUri?: string;
513
- language?: string;
514
- isDraft?: boolean;
515
- generatedFrom?: {
516
- resourceId: string;
517
- annotationId: string;
518
- };
519
- generationPrompt?: string;
520
- generator?: components["schemas"]["Agent"] | components["schemas"]["Agent"][];
521
- };
522
- /** @description Payload for yield:cloned domain event */
523
- ResourceClonedPayload: {
524
- name: string;
525
- format: components["schemas"]["ContentFormat"];
526
- contentChecksum: string;
527
- contentByteSize?: number;
528
- parentResourceId: string;
529
- entityTypes?: string[];
530
- language?: string;
531
- };
532
- /** @description Payload for yield:updated domain event */
533
- ResourceUpdatedPayload: {
534
- /** @description SHA-256 of new content */
535
- contentChecksum: string;
536
- contentByteSize?: number;
537
- };
538
- /** @description Payload for yield:moved domain event */
539
- ResourceMovedPayload: {
540
- /** @description Previous file:// URI */
541
- fromUri: string;
542
- /** @description New file:// URI */
543
- toUri: string;
544
- };
545
- /** @description Payload for mark:archived domain event */
546
- ResourceArchivedPayload: {
547
- reason?: string;
548
- };
549
- /** @description Payload for mark:unarchived domain event (empty payload) */
550
- ResourceUnarchivedPayload: Record<string, never>;
551
- /** @description Payload for yield:representation-added domain event */
552
- RepresentationAddedPayload: {
553
- representation: components["schemas"]["Representation"];
554
- };
555
- /** @description Payload for yield:representation-removed domain event */
556
- RepresentationRemovedPayload: {
557
- /** @description Checksum of the representation to remove */
558
- checksum: string;
559
- };
560
- /** @description Payload for mark:added domain event */
561
- AnnotationAddedPayload: {
562
- annotation: components["schemas"]["Annotation"];
563
- /** @description SHA-256 of resource content at annotation time */
564
- contentChecksum?: string;
565
- };
566
- /** @description Payload for mark:removed domain event */
567
- AnnotationRemovedPayload: {
568
- annotationId: string;
569
- };
570
- /** @description Payload for mark:body-updated domain event */
571
- AnnotationBodyUpdatedPayload: {
572
- annotationId: string;
573
- operations: (components["schemas"]["BodyOperationAdd"] | components["schemas"]["BodyOperationRemove"] | components["schemas"]["BodyOperationReplace"])[];
574
- };
575
- /** @description Payload for frame:entity-type-added domain event (system-level, no resourceId — fan-out is global) */
576
- EntityTypeAddedPayload: {
577
- entityType: string;
578
- };
579
- /** @description Payload for frame:tag-schema-added domain event (system-level, no resourceId — fan-out is global to the KB). */
580
- TagSchemaAddedPayload: {
581
- schema: components["schemas"]["TagSchema"];
582
- };
583
- /** @description Payload for mark:entity-tag-added and mark:entity-tag-removed domain events */
584
- EntityTagChangedPayload: {
585
- entityType: string;
586
- };
587
- /**
588
- * @description Type of background job
589
- * @enum {string}
590
- */
591
- JobType: "reference-annotation" | "generation" | "highlight-annotation" | "assessment-annotation" | "comment-annotation" | "tag-annotation";
592
- /** @description Payload for job:started domain event */
593
- JobStartedPayload: {
594
- jobId: string;
595
- jobType: components["schemas"]["JobType"];
596
- /** @description Annotation this job is attached to, when applicable */
597
- annotationId?: string;
598
- totalSteps?: number;
599
- };
600
- /** @description Payload for job:progress domain event */
601
- JobProgressPayload: {
602
- jobId: string;
603
- jobType: components["schemas"]["JobType"];
604
- percentage: number;
605
- /** @description Human-readable current step */
606
- currentStep?: string;
607
- processedSteps?: number;
608
- totalSteps?: number;
609
- /** @description For detection: entities found so far */
610
- foundCount?: number;
611
- message?: string;
612
- /** @description Full progress object for extensibility */
613
- progress?: {
614
- [key: string]: unknown;
615
- };
616
- };
617
- /** @description Payload for job:completed domain event */
618
- JobCompletedPayload: {
619
- jobId: string;
620
- jobType: components["schemas"]["JobType"];
621
- /** @description Annotation this job was attached to, when applicable */
622
- annotationId?: string;
623
- totalSteps?: number;
624
- /** @description For detection: total entities found */
625
- foundCount?: number;
626
- /** @description For generation: ID of generated resource */
627
- resultResourceId?: string;
628
- /** @description For generation: URI of annotation that triggered generation */
629
- annotationUri?: string;
630
- message?: string;
631
- /** @description Full result object for extensibility */
632
- result?: {
633
- [key: string]: unknown;
634
- };
635
- };
636
- /** @description Payload for job:failed domain event */
637
- JobFailedPayload: {
638
- jobId: string;
639
- jobType: components["schemas"]["JobType"];
640
- /** @description Annotation this job was attached to, when applicable */
641
- annotationId?: string;
642
- error: string;
643
- details?: string;
644
- };
645
- ErrorResponse: {
646
- error: string;
647
- code?: string;
648
- details?: unknown;
649
- };
650
- EventStreamResponse: {
651
- event: string;
652
- data: string;
653
- id?: string;
654
- };
655
- GetAnnotationHistoryResponse: {
656
- events: components["schemas"]["StoredEventResponse"][];
657
- total: number;
658
- annotationId: string;
659
- resourceId: string;
660
- };
661
- GetAnnotationResponse: {
662
- annotation: components["schemas"]["Annotation"];
663
- resource: components["schemas"]["ResourceDescriptor"] | null;
664
- resolvedResource: components["schemas"]["ResourceDescriptor"] | null;
665
- };
666
- GetAnnotationsResponse: {
667
- annotations: components["schemas"]["Annotation"][];
668
- /** @description Total number of annotations */
669
- total: number;
670
- /** @description Motivation filter applied (if any) */
671
- motivation?: components["schemas"]["Motivation"] | null;
672
- };
673
- GetEntityTypesResponse: {
674
- entityTypes: string[];
675
- };
676
- GetEventsResponse: {
677
- events: components["schemas"]["StoredEventResponse"][];
678
- total: number;
679
- resourceId: string;
680
- };
681
- GetReferencedByResponse: {
682
- referencedBy: {
683
- /** @description Reference annotation ID */
684
- id: string;
685
- /** @description Name of resource containing the reference */
686
- resourceName: string;
687
- target: {
688
- /** @description ID of resource containing the reference */
689
- source: string;
690
- selector: {
691
- /** @description The selected text that references this resource */
692
- exact: string;
693
- };
694
- };
695
- }[];
696
- };
697
- GetResourceByTokenResponse: {
698
- sourceResource: components["schemas"]["ResourceDescriptor"];
699
- /** @description ISO 8601 timestamp when token expires */
700
- expiresAt: string;
701
- };
702
- GetResourceResponse: {
703
- resource: components["schemas"]["ResourceDescriptor"];
704
- /** @description All annotations for the resource (highlights, references, assessments, etc.) */
705
- annotations: components["schemas"]["Annotation"][];
706
- /** @description Annotations that reference this resource from other resources */
707
- entityReferences: components["schemas"]["Annotation"][];
708
- };
709
- GetTagSchemasResponse: {
710
- tagSchemas: components["schemas"]["TagSchema"][];
711
- };
712
- GoogleAuthRequest: {
713
- access_token: string;
714
- };
715
- HealthResponse: {
716
- status: string;
717
- message: string;
718
- version: string;
719
- timestamp: string;
720
- /** @enum {string} */
721
- database: "connected" | "disconnected" | "unknown";
722
- environment: string;
723
- };
724
- JobStatusResponse: {
725
- jobId: string;
726
- type: components["schemas"]["JobType"];
727
- /** @enum {string} */
728
- status: "pending" | "running" | "complete" | "failed" | "cancelled";
729
- userId: string;
730
- created: string;
731
- startedAt?: string;
732
- completedAt?: string;
733
- error?: string;
734
- progress?: unknown;
735
- result?: unknown;
736
- };
737
- /** @description Knowledge graph gathered for an LLM context — a shared backbone in which resources AND annotations are typed nodes, connected by typed (optionally bidirectional) edges. Flattened views the matcher/generation read (connections, citedBy, siblings) are derived from these nodes/edges. */
738
- KnowledgeGraph: {
739
- nodes: {
740
- /** @description Node identifier — a ResourceId or AnnotationId */
741
- id: string;
742
- /**
743
- * @description Whether this node is a resource or an annotation
744
- * @enum {string}
745
- */
746
- type: "resource" | "annotation";
747
- label: string;
748
- /** @description Entity types on the node (resources) or carried by the annotation */
749
- entityTypes?: string[];
750
- metadata?: {
751
- [key: string]: unknown;
752
- };
753
- }[];
754
- edges: {
755
- source: string;
756
- target: string;
757
- /** @description Edge kind (e.g. citation, annotation-of, sibling) */
758
- type: string;
759
- /** @description Whether the connection goes both ways */
760
- bidirectional?: boolean;
761
- metadata?: {
762
- [key: string]: unknown;
763
- };
764
- }[];
765
- };
766
- ListResourcesResponse: {
767
- resources: components["schemas"]["ResourceDescriptor"][];
768
- total: number;
769
- offset: number;
770
- limit: number;
771
- };
772
- PasswordAuthRequest: {
773
- /**
774
- * Format: email
775
- * @description User email address
776
- */
777
- email: string;
778
- /** @description User password (minimum 8 characters) */
779
- password: string;
780
- };
781
- /**
782
- * @description Semiont-supported W3C Web Annotation motivations - https://www.w3.org/TR/annotation-vocab/#motivation
783
- * @enum {string}
784
- */
785
- Motivation: "assessing" | "commenting" | "highlighting" | "linking" | "tagging";
786
- OAuthConfigResponse: {
787
- providers: {
788
- name: string;
789
- isConfigured: boolean;
790
- clientId: string;
791
- }[];
792
- allowedDomains: string[];
793
- };
794
- /** @description A specific, byte-addressable rendition of a resource (file/asset/variant). */
795
- Representation: {
796
- /**
797
- * Format: uri
798
- * @description Stable ID for this representation.
799
- */
800
- "@id"?: string;
801
- /** @description Type(s), e.g., schema:MediaObject. */
802
- "@type"?: string | string[];
803
- /** @description MIME/media type (e.g., text/markdown, image/png). */
804
- mediaType: string;
805
- /** @description Working-tree URI identifying where the bytes live. Only file:// is supported (e.g. file://docs/overview.md). */
806
- storageUri?: string;
807
- filename?: string;
808
- /** @description Size of the payload in bytes. */
809
- byteSize?: number;
810
- /** @description Integrity hash (e.g., sha256:abcd…). */
811
- checksum?: string;
812
- /** @description Compression/transfer encoding if applicable. */
813
- encoding?: string;
814
- /** @description IETF BCP 47 language tag (e.g., en, es-ES). */
815
- language?: string;
816
- /** @description Pixels (images/video). */
817
- width?: number;
818
- /** @description Pixels (images/video). */
819
- height?: number;
820
- /** @description Seconds (audio/video). */
821
- duration?: number;
822
- /** Format: date-time */
823
- created?: string;
824
- /** Format: date-time */
825
- modified?: string;
826
- /** @description Profile/shape the bytes conform to (e.g., a JSON profile or SVG profile). */
827
- conformsTo?: string | string[];
828
- tags?: string[];
829
- /**
830
- * @description Semantics of this rendition relative to the resource (e.g., original, thumbnail, preview, derived).
831
- * @enum {string}
832
- */
833
- rel?: "original" | "thumbnail" | "preview" | "optimized" | "derived" | "other";
834
- } & {
835
- [key: string]: unknown;
836
- };
837
- /** @description Metadata about a resource (1:1 with its URI). JSON-LD subject is @id. Link to concrete bytes via representations. */
838
- ResourceDescriptor: {
839
- /** @description JSON-LD context; URI, object, or array of these. */
840
- "@context": string | {
841
- [key: string]: unknown;
842
- } | (string | {
843
- [key: string]: unknown;
844
- })[];
845
- /** @description Canonical URI/URN of the resource being described. */
846
- "@id": string;
847
- /** @description Type(s) of the resource (IRIs/CURIEs via @context). */
848
- "@type"?: string | string[];
849
- name: string;
850
- description?: string;
851
- /** @description Persistent identifiers (e.g., DOI, URN). */
852
- identifier?: string | string[] | ({
853
- /** Format: uri */
854
- "@id"?: string;
855
- value?: string;
856
- scheme?: string;
857
- } & {
858
- [key: string]: unknown;
859
- });
860
- /** @description Topics (IRIs or strings). */
861
- about?: string | string[];
862
- /** @description Equivalent/authoritative references. */
863
- sameAs?: string[];
864
- isPartOf?: string[];
865
- hasPart?: string[];
866
- /** Format: uri */
867
- license?: string;
868
- version?: string;
869
- /** Format: date-time */
870
- dateCreated?: string;
871
- /** Format: date-time */
872
- dateModified?: string;
873
- /** @description W3C PROV - source resources this was derived from */
874
- wasDerivedFrom?: string | string[];
875
- /** @description W3C PROV - agents responsible for this resource */
876
- wasAttributedTo?: components["schemas"]["Agent"] | components["schemas"]["Agent"][];
877
- /** @description Software agent that produced or processed this resource (W3C Web Annotation model) */
878
- generator?: components["schemas"]["Agent"] | components["schemas"]["Agent"][];
879
- /** @description Profile/shape URI this resource description conforms to. */
880
- conformsTo?: string | string[];
881
- /** @description Convenience set summarizing media types across representations. */
882
- availableFormats?: string[];
883
- /** @description Managed or referenced byte-level renditions of this resource. */
884
- representations: components["schemas"]["Representation"] | components["schemas"]["Representation"][];
885
- /** @description Application-specific: Whether this resource is archived */
886
- archived?: boolean;
887
- /** @description Application-specific: Entity types for this resource */
888
- entityTypes?: string[];
889
- /** @description Application-specific: Whether this resource is a draft */
890
- isDraft?: boolean;
891
- /** @description Application-specific: ID of annotation that triggered generation */
892
- sourceAnnotationId?: string;
893
- /** @description Application-specific: ID of source resource for clones/derivatives */
894
- sourceResourceId?: string;
895
- /**
896
- * Format: uri
897
- * @description Original URI from a source knowledge base when this resource was imported
898
- */
899
- originatedFrom?: string;
900
- /** @description Working-tree URI for this resource (e.g. file://docs/overview.md). Stable across updates and moves. */
901
- storageUri?: string;
902
- /** @description SHA-256 hex hash of the current content. Updated on resource.created, resource.updated, resource.cloned events. */
903
- currentChecksum?: string;
904
- } & {
905
- [key: string]: unknown;
906
- };
907
- SemanticMatch: {
908
- /** @description The chunk text that matched */
909
- text: string;
910
- /** @description Source resource ID */
911
- resourceId: string;
912
- /** @description Source annotation ID, if the match is from an annotation */
913
- annotationId?: string;
914
- /** @description Cosine similarity score (0-1) */
915
- score: number;
916
- /** @description Entity types on the matched passage */
917
- entityTypes?: string[];
918
- };
919
- SpecificResource: {
920
- /** @enum {string} */
921
- type: "SpecificResource";
922
- /** @description IRI of the target resource */
923
- source: string;
924
- /** @description Why this body is included */
925
- purpose?: components["schemas"]["BodyPurpose"];
926
- };
927
- StatusResponse: {
928
- status: string;
929
- version: string;
930
- features: {
931
- semanticContent: string;
932
- collaboration: string;
933
- rbac: string;
934
- };
935
- message: string;
936
- authenticatedAs?: string;
937
- /** @description Name of the knowledge base project */
938
- projectName?: string;
939
- /** @description Current git branch of the knowledge base repository */
940
- gitBranch?: string;
941
- };
942
- TextPositionSelector: {
943
- /** @enum {string} */
944
- type: "TextPositionSelector";
945
- /** @description Character offset from resource start */
946
- start: number;
947
- /** @description Character offset from resource start */
948
- end: number;
949
- };
950
- TextQuoteSelector: {
951
- /** @enum {string} */
952
- type: "TextQuoteSelector";
953
- exact: string;
954
- prefix?: string;
955
- suffix?: string;
956
- };
957
- TextualBody: {
958
- /** @enum {string} */
959
- type: "TextualBody";
960
- /** @description The text content (e.g., entity type name) */
961
- value: string;
962
- /** @description Why this body is included */
963
- purpose?: components["schemas"]["BodyPurpose"];
964
- /** @description MIME type (defaults to text/plain) */
965
- format?: string;
966
- /** @description BCP 47 language tag */
967
- language?: string;
968
- };
969
- TokenRefreshRequest: {
970
- /**
971
- * @description Refresh token obtained during login
972
- * @example eyJhbGciOiJIUzI1NiIs...
973
- */
974
- refreshToken: string;
975
- };
976
- TokenRefreshResponse: {
977
- access_token: string;
978
- };
979
- UpdateAnnotationBodyRequest: {
980
- /** @description Resource ID containing the annotation (required for O(1) Layer 3 lookup) */
981
- resourceId: string;
982
- /** @description Array of body modification operations to apply */
983
- operations: (components["schemas"]["BodyOperationAdd"] | components["schemas"]["BodyOperationRemove"] | components["schemas"]["BodyOperationReplace"])[];
984
- };
985
- UpdateUserRequest: {
986
- isAdmin?: boolean;
987
- isActive?: boolean;
988
- name?: string;
989
- };
990
- UpdateUserResponse: {
991
- success: boolean;
992
- user: {
993
- id: string;
994
- email: string;
995
- name?: string | null;
996
- image?: string | null;
997
- domain: string;
998
- provider: string;
999
- isAdmin: boolean;
1000
- isActive: boolean;
1001
- lastLogin?: string | null;
1002
- created: string;
1003
- updatedAt: string;
1004
- };
1005
- };
1006
- UserResponse: {
1007
- id: string;
1008
- email: string;
1009
- name: string | null;
1010
- image: string | null;
1011
- domain: string;
1012
- provider: string;
1013
- isAdmin: boolean;
1014
- isModerator: boolean;
1015
- isActive: boolean;
1016
- termsAcceptedAt: string | null;
1017
- lastLogin: string | null;
1018
- created: string;
1019
- /** @description The validated JWT token string for the current session */
1020
- token: string;
1021
- };
1022
- /** @description Emitted when an annotation receives focus for beckoning */
1023
- BeckonFocusEvent: {
1024
- annotationId?: string;
1025
- resourceId?: string;
1026
- };
1027
- /** @description Emitted when an annotation is hovered over for beckoning */
1028
- BeckonHoverEvent: {
1029
- annotationId: string | null;
1030
- };
1031
- /** @description Emitted when a sparkle effect is triggered on an annotation */
1032
- BeckonSparkleEvent: {
1033
- annotationId: string;
1034
- };
1035
- /** @description Void success reply emitted on the bind:body-updated channel after bind:update-body has been applied, matched to the originating command by correlationId. */
1036
- BindBodyUpdated: {
1037
- /** @description Correlation id echoed from the originating bind:update-body command so busRequest can match the reply. */
1038
- correlationId: string;
1039
- };
1040
- /** @description Command payload sent on the bind:initiate bus channel to start a bind flow. */
1041
- BindInitiateCommand: {
1042
- /** @description Branded AnnotationId of the annotation being bound */
1043
- annotationId: string;
1044
- /** @description Branded ResourceId of the resource being bound to */
1045
- resourceId: string;
1046
- /** @description Default title for the bound annotation */
1047
- defaultTitle: string;
1048
- /** @description Entity types to associate with the annotation */
1049
- entityTypes: string[];
1050
- };
1051
- /** @description Command payload sent on the bind:update-body bus channel to modify annotation bodies. */
1052
- BindUpdateBodyCommand: {
1053
- /** @description Authenticated user's DID, injected by the /bus/emit gateway. Clients do not set this. */
1054
- _userId?: string;
1055
- /** @description Client-supplied id used to match this command to its result event(s) on the events-stream. Generated by the route handler if absent. */
1056
- correlationId: string;
1057
- /** @description Branded AnnotationId of the annotation whose body is being updated */
1058
- annotationId: string;
1059
- /** @description Branded ResourceId of the resource the annotation belongs to */
1060
- resourceId: string;
1061
- /** @description List of body mutation operations to apply */
1062
- operations: {
1063
- /**
1064
- * @description The type of body operation
1065
- * @enum {string}
1066
- */
1067
- op: "add" | "remove" | "replace";
1068
- /** @description Body item for add operations */
1069
- item?: components["schemas"]["AnnotationBody"];
1070
- /** @description Previous body item for replace operations */
1071
- oldItem?: components["schemas"]["AnnotationBody"];
1072
- /** @description Replacement body item for replace operations */
1073
- newItem?: components["schemas"]["AnnotationBody"];
1074
- }[];
1075
- };
1076
- /**
1077
- * @description W3C Web Annotation body purpose vocabulary - https://www.w3.org/TR/annotation-vocab/#motivation
1078
- * @enum {string}
1079
- */
1080
- BodyPurpose: "assessing" | "bookmarking" | "classifying" | "commenting" | "describing" | "editing" | "highlighting" | "identifying" | "linking" | "moderating" | "questioning" | "replying" | "tagging";
1081
- /** @description Request to browse the KB's collaborator directory (its declared Agents) */
1082
- BrowseAgentsRequest: {
1083
- correlationId: string;
1084
- };
1085
- /** @description Result of browsing the collaborator directory */
1086
- BrowseAgentsResult: {
1087
- correlationId: string;
1088
- response: {
1089
- agents: components["schemas"]["CollaboratorEntry"][];
1090
- };
1091
- };
1092
- /** @description Request to browse the history of an annotation */
1093
- BrowseAnnotationHistoryRequest: {
1094
- correlationId: string;
1095
- resourceId: string;
1096
- annotationId: string;
1097
- };
1098
- /** @description Result of browsing annotation history */
1099
- BrowseAnnotationHistoryResult: {
383
+ /** @description Result of browsing annotation history */
384
+ BrowseAnnotationHistoryResult: {
1100
385
  correlationId: string;
1101
386
  response: components["schemas"]["GetAnnotationHistoryResponse"];
1102
387
  };
@@ -1111,14 +396,6 @@ interface components {
1111
396
  correlationId: string;
1112
397
  response: components["schemas"]["GetAnnotationResponse"];
1113
398
  };
1114
- /** @description Request to get contextual text around an annotation */
1115
- BrowseAnnotationContextRequest: {
1116
- correlationId: string;
1117
- annotationId: string;
1118
- resourceId: string;
1119
- contextBefore?: number;
1120
- contextAfter?: number;
1121
- };
1122
399
  /** @description Request to browse annotations for a resource */
1123
400
  BrowseAnnotationsRequest: {
1124
401
  correlationId: string;
@@ -1180,6 +457,11 @@ interface components {
1180
457
  url: string;
1181
458
  resourceId?: string;
1182
459
  };
460
+ BrowseFilesResponse: {
461
+ /** @description The directory path that was listed, relative to project root */
462
+ path: string;
463
+ entries: components["schemas"]["DirectoryEntry"][];
464
+ };
1183
465
  /** @description Emitted when a link is clicked in the browse panel */
1184
466
  BrowseLinkClickedEvent: {
1185
467
  href: string;
@@ -1195,6 +477,10 @@ interface components {
1195
477
  BrowsePanelToggleEvent: {
1196
478
  panel: string;
1197
479
  };
480
+ /** @description Emitted when navigation to a reference resource is requested */
481
+ BrowseReferenceNavigateEvent: {
482
+ resourceId: string;
483
+ };
1198
484
  /** @description Request to browse annotations that reference a resource */
1199
485
  BrowseReferencedByRequest: {
1200
486
  correlationId: string;
@@ -1206,10 +492,6 @@ interface components {
1206
492
  correlationId: string;
1207
493
  response: components["schemas"]["GetReferencedByResponse"];
1208
494
  };
1209
- /** @description Emitted when navigation to a reference resource is requested */
1210
- BrowseReferenceNavigateEvent: {
1211
- resourceId: string;
1212
- };
1213
495
  /** @description Emitted when a resource is closed in the browse panel */
1214
496
  BrowseResourceCloseEvent: {
1215
497
  resourceId: string;
@@ -1257,12 +539,211 @@ interface components {
1257
539
  correlationId: string;
1258
540
  response: components["schemas"]["GetTagSchemasResponse"];
1259
541
  };
542
+ /** @description Emit an event on the Semiont bus. Channel names come from bus-protocol.ts; payload shape is validated against the channel's registered schema (CHANNEL_SCHEMAS). An optional scope routes resource-scoped broadcasts (e.g. mark:added, job:complete) to per-resource subscribers via eventBus.scope(scope); leave it unset for unscoped/global events. */
543
+ BusEmitRequest: {
544
+ /** @description Channel name from bus-protocol.ts EventMap */
545
+ channel: string;
546
+ /** @description Channel-specific payload, validated against CHANNEL_SCHEMAS */
547
+ payload: {
548
+ [key: string]: unknown;
549
+ };
550
+ /** @description Optional resource scope for broadcast channels (e.g. resourceId). Publishers only — frontends must never set this. */
551
+ scope?: string;
552
+ };
553
+ CloneResourceWithTokenResponse: {
554
+ /** @description Generated clone token */
555
+ token: string;
556
+ /** @description ISO 8601 timestamp when token expires */
557
+ expiresAt: string;
558
+ resource: components["schemas"]["ResourceDescriptor"];
559
+ };
1260
560
  /** @description One collaborator in the KB's directory: a W3C Agent plus, for software agents declared in the KB's worker inference config, the job types it serves. Actor-role-only agents (gatherer/matcher) and Persons omit servesJobTypes. */
1261
561
  CollaboratorEntry: {
1262
562
  agent: components["schemas"]["Agent"];
1263
563
  /** @description Job types this agent is declared to serve (from the KB's workers.* config sections). Absent for Persons and for agents declared only under actor roles. */
1264
564
  servesJobTypes?: components["schemas"]["JobType"][];
1265
565
  };
566
+ /** @description Error response for failed bus commands. Replaces native Error objects on the EventBus so payloads are serializable and OpenAPI-typed. */
567
+ CommandError: {
568
+ /** @description Optional correlation id echoed from the originating command. When present, the failure event can be matched back to the specific command that failed. */
569
+ correlationId?: string;
570
+ /** @description Human-readable error message */
571
+ message: string;
572
+ /** @description Optional additional context (stack trace, field name, etc.) */
573
+ details?: string;
574
+ };
575
+ /**
576
+ * @description Content format as a MIME type, optionally with parameters. The base type (everything before the first ';') MUST be a SupportedMediaType; parameters such as charset are preserved as metadata. Semantic validation happens in code at the create/yield boundary — there is deliberately no pattern here, the vocabulary lives in SupportedMediaType. Examples: text/plain, text/plain; charset=iso-8859-1, text/markdown; charset=windows-1252, image/png, application/pdf
577
+ * @example text/plain; charset=utf-8
578
+ */
579
+ ContentFormat: string;
580
+ ContextualSummaryResponse: {
581
+ summary: string;
582
+ relevantFields: {
583
+ [key: string]: unknown;
584
+ };
585
+ context: {
586
+ before?: string;
587
+ selected: string;
588
+ after?: string;
589
+ };
590
+ };
591
+ /** @description User's cookie consent preferences. `necessary` is always true — necessary cookies cannot be disabled. Timestamps and version are stamped server-side. */
592
+ CookieConsent: {
593
+ /** @enum {boolean} */
594
+ necessary: true;
595
+ analytics: boolean;
596
+ marketing: boolean;
597
+ preferences: boolean;
598
+ /** Format: date-time */
599
+ timestamp: string;
600
+ version: string;
601
+ };
602
+ /** @description Request body for POST /api/cookies/consent. All four preference fields must be booleans; `necessary` must be true. */
603
+ CookieConsentRequest: {
604
+ /** @enum {boolean} */
605
+ necessary: true;
606
+ analytics: boolean;
607
+ marketing: boolean;
608
+ preferences: boolean;
609
+ };
610
+ /** @description Standard envelope for cookie consent endpoints. On success `success: true` and `consent` carries the current preferences; on error `success: false` and `error` carries a human-readable message. */
611
+ CookieConsentResponse: {
612
+ success: boolean;
613
+ consent?: components["schemas"]["CookieConsent"];
614
+ error?: string;
615
+ };
616
+ /** @description GDPR data export of a user's cookie-related data. The response is returned as a file download (Content-Disposition: attachment). */
617
+ CookieExportResponse: {
618
+ user: {
619
+ id: string;
620
+ email: string;
621
+ };
622
+ consent: components["schemas"]["CookieConsent"];
623
+ /** Format: date-time */
624
+ exportDate: string;
625
+ dataRetentionPolicy: string;
626
+ };
627
+ CreateAnnotationRequest: {
628
+ motivation: components["schemas"]["Motivation"];
629
+ target: components["schemas"]["AnnotationTarget"];
630
+ /** @description Optional body. Omit for annotations whose motivation alone is meaningful (highlighting) or whose user-supplied content is empty. Shape matches Annotation.body. */
631
+ body?: components["schemas"]["AnnotationBody"] | components["schemas"]["AnnotationBody"][];
632
+ };
633
+ /** @description Response body for POST /resources (202 Accepted). Resource creation is asynchronous — the backend writes content to disk, emits yield:create on the bus, and returns the newly-minted resourceId immediately. Consumers watch SSE domain events (yield:created) to observe the fully-persisted state. */
634
+ CreateResourceResponse: {
635
+ /** @description The id of the newly-created resource. Assigned by Stower when it persists yield:create. */
636
+ resourceId: string;
637
+ };
638
+ DeleteUserResponse: {
639
+ success: boolean;
640
+ message: string;
641
+ };
642
+ DirEntry: {
643
+ /** @enum {string} */
644
+ type: "dir";
645
+ /** @description Entry name (basename) */
646
+ name: string;
647
+ /** @description Path relative to project root */
648
+ path: string;
649
+ /**
650
+ * Format: date-time
651
+ * @description Last modified time (ISO 8601)
652
+ */
653
+ mtime: string;
654
+ };
655
+ DirectoryEntry: components["schemas"]["FileEntry"] | components["schemas"]["DirEntry"];
656
+ /**
657
+ * DiscoveredKB
658
+ * @description One knowledge base the Semiont launcher manages on this machine, as published in the discovery document (see DiscoveryDocument). Endpoints and identity only — never credentials; login remains the consumer's per-KB business.
659
+ */
660
+ DiscoveredKB: {
661
+ /** @description Hostname the KB is reachable on from this machine (today always "localhost" — local stacks bind locally and codespace KBs arrive through a local port forward) */
662
+ host: string;
663
+ /** @description Local TCP port of the KB's API (the backend port for a local stack; the allocated forward port for a codespace stack) */
664
+ port: number;
665
+ /**
666
+ * @description Where the stack actually runs. "local": containers on this machine. "codespace": a GitHub-hosted VM whose KB is port-forwarded here.
667
+ * @enum {string}
668
+ */
669
+ placement: "local" | "codespace";
670
+ /** @description owner/name GitHub slug — present for codespace placements, where the repo is the stack's identity */
671
+ repo?: string;
672
+ /** @description The KB's did:web identifier as recorded from its committed .semiont/config — the permanent identity stamped into its event log. Prefer this as a merge key: ports are reallocated across restarts; the did follows the KB. */
673
+ did?: string;
674
+ /** @description Human-readable site name from the KB's .semiont/config, for display */
675
+ siteName?: string;
676
+ /** @description The agent that owns this entry's lifecycle (the launcher writes "semiont-launcher"). Consumers treat managed entries as authoritative for themselves — upsert on appearance, remove on disappearance — and never touch entries they did not write. */
677
+ managedBy: string;
678
+ };
679
+ /**
680
+ * DiscoveryDocument
681
+ * @description The launcher's KB discovery document — the schema authority for <stateDir>/discovery/kbs.json, which the semiont launcher (Go, apps/launcher) regenerates on every stack mutation and the frontend container mounts read-only at /discovery. NOT an API endpoint: a static document fetched same-origin by browsers (via the frontend's static server) or read from disk by local Node consumers. An empty kbs list is meaningful ("the launcher manages nothing right now") and distinct from an absent file. Design record: .plans/BROWSER-KB-DISCOVERY.md.
682
+ */
683
+ DiscoveryDocument: {
684
+ /**
685
+ * @description Document schema version. Consumers MUST check it and ignore documents they do not understand.
686
+ * @enum {integer}
687
+ */
688
+ version: 1;
689
+ /** @description Every KB the launcher currently manages, local and forwarded */
690
+ kbs: components["schemas"]["DiscoveredKB"][];
691
+ };
692
+ /** @description Wire format emitted by GET /resources/:id/events/stream. Extends StoredEventResponse with optional enrichment fields populated from the materialized view at SSE-write time. Subscribers can read the enrichment fields directly to update local caches without an additional fetch. */
693
+ EnrichedResourceEvent: components["schemas"]["StoredEventResponse"] & {
694
+ /** @description Populated for events that mutate an annotation (mark:added, mark:body-updated, mark:removed). Carries the post-materialization annotation as it exists in the view, so subscribers can update local caches in-place without refetching. Absent for events that don't touch annotations. */
695
+ annotation?: components["schemas"]["Annotation"];
696
+ };
697
+ /** @description Payload for mark:entity-tag-added and mark:entity-tag-removed domain events */
698
+ EntityTagChangedPayload: {
699
+ entityType: string;
700
+ };
701
+ /** @description Payload for frame:entity-type-added domain event (system-level, no resourceId — fan-out is global) */
702
+ EntityTypeAddedPayload: {
703
+ entityType: string;
704
+ };
705
+ ErrorResponse: {
706
+ error: string;
707
+ code?: string;
708
+ details?: unknown;
709
+ };
710
+ /** @description Metadata added at persistence time. Part of every StoredEvent. Integrity is provided by git at the commit level (when gitSync is enabled), not by in-event metadata fields. */
711
+ EventMetadata: {
712
+ /** @description Monotonic position in the event log (ordering authority) */
713
+ sequenceNumber: number;
714
+ /** @description Optional correlation id propagated from a command. Lets clients match command-result events back to the POST that initiated them. Set by EventStore.appendEvent's options when a route handler passes one through. */
715
+ correlationId?: string;
716
+ };
717
+ EventStreamResponse: {
718
+ event: string;
719
+ data: string;
720
+ id?: string;
721
+ };
722
+ FileEntry: {
723
+ /** @enum {string} */
724
+ type: "file";
725
+ /** @description Entry name (basename) */
726
+ name: string;
727
+ /** @description Path relative to project root */
728
+ path: string;
729
+ /** @description File size in bytes */
730
+ size: number;
731
+ /**
732
+ * Format: date-time
733
+ * @description Last modified time (ISO 8601)
734
+ */
735
+ mtime: string;
736
+ /** @description True if this file is a tracked resource in the Knowledge Base */
737
+ tracked: boolean;
738
+ /** @description Resource ID (only when tracked is true) */
739
+ resourceId?: string;
740
+ /** @description Entity types assigned to this resource (only when tracked is true) */
741
+ entityTypes?: string[];
742
+ /** @description Number of annotations on this resource (only when tracked is true) */
743
+ annotationCount?: number;
744
+ /** @description DID of the user who created the resource (only when tracked is true) */
745
+ creator?: string;
746
+ };
1266
747
  /** @description W3C Web Annotation FragmentSelector for media fragment identifiers (RFC 3778 for PDFs) */
1267
748
  FragmentSelector: {
1268
749
  /** @enum {string} */
@@ -1278,6 +759,22 @@ interface components {
1278
759
  */
1279
760
  conformsTo?: string;
1280
761
  };
762
+ /** @description Bus command to add a new entity type to the KB's vocabulary. Carried on the `frame:add-entity-type` channel — Frame is the schema-layer flow that owns vocabulary writes. */
763
+ FrameAddEntityTypeCommand: {
764
+ /** @description Correlation id for request/reply matching, set by the SDK's busRequest so the confirmed-write ack/failure routes back. Absent for in-process (bootstrap/replay/import) emits, which race the frame:entity-type-added domain event instead. */
765
+ correlationId?: string;
766
+ tag: string;
767
+ /** @description Authenticated user's DID, injected by the /bus/emit gateway. Clients do not set this. */
768
+ _userId?: string;
769
+ };
770
+ /** @description Bus command to register a tag schema with the KB's runtime registry. Carried on the `frame:add-tag-schema` channel — Frame is the schema-layer flow that owns vocabulary writes. Most-recent registration of a given `schema.id` wins; the projection reflects the latest content. Identical re-registrations are silent; differing content overwrites and logs a warning. */
771
+ FrameAddTagSchemaCommand: {
772
+ /** @description Correlation id for request/reply matching, set by the SDK's busRequest so the confirmed-write ack/failure routes back. Absent for in-process emits. */
773
+ correlationId?: string;
774
+ schema: components["schemas"]["TagSchema"];
775
+ /** @description Authenticated user's DID, injected by the /bus/emit gateway. Clients do not set this. */
776
+ _userId?: string;
777
+ };
1281
778
  /** @description Completion payload emitted on the gather:annotation-complete bus channel when annotation context gathering finishes. */
1282
779
  GatherAnnotationComplete: {
1283
780
  /** @description Client-generated correlation ID to thread the response back to the originating request */
@@ -1305,6 +802,46 @@ interface components {
1305
802
  contextWindow?: number;
1306
803
  };
1307
804
  };
805
+ /** @description Progress payload emitted on the gather:annotation-progress SSE channel during LLM context gathering. */
806
+ GatherProgress: {
807
+ message?: string;
808
+ percentage?: number;
809
+ };
810
+ /** @description Completion payload emitted on the gather:resource-complete bus channel when resource context gathering finishes. */
811
+ GatherResourceComplete: {
812
+ /** @description Client-generated correlation ID to thread the response back to the originating request */
813
+ correlationId: string;
814
+ /** @description Branded ResourceId of the resource whose context was gathered */
815
+ resourceId: string;
816
+ /** @description The gathered resource context (unified GatheredContext, focus.kind:'resource') */
817
+ response: components["schemas"]["GatheredContext"];
818
+ };
819
+ /** @description Request payload sent on the gather:resource-requested bus channel to gather context for a resource. */
820
+ GatherResourceRequest: {
821
+ /** @description Client-generated correlation ID to thread the response back to the originating request */
822
+ correlationId: string;
823
+ /** @description Branded ResourceId of the resource to gather context for */
824
+ resourceId: string;
825
+ /** @description Gathering configuration */
826
+ options: {
827
+ /** @description Depth of resource graph traversal */
828
+ depth: number;
829
+ /** @description Maximum number of related resources to include */
830
+ maxResources: number;
831
+ /** @description Whether to include resource content in the gathered result */
832
+ includeContent: boolean;
833
+ /** @description Whether to include resource summaries in the gathered result */
834
+ includeSummary: boolean;
835
+ /** @description Entity types to exclude from the semantic recall built into this context (caller-supplied; e.g. a chat consumer passes ['Question'] so prior questions never ground answer generation). Optional; default none. */
836
+ excludeEntityTypes?: string[];
837
+ };
838
+ };
839
+ /** @description Request to generate an AI summary of an annotation */
840
+ GatherSummaryRequest: {
841
+ correlationId: string;
842
+ annotationId: string;
843
+ resourceId: string;
844
+ };
1308
845
  /** @description Context gathered for a gather.* call — consumed by yield.* (generation) and the matcher. A shared base (graph, semanticContext, metadata, inferredRelationshipSummary) plus a discriminated `focus` that names the anchor: an annotation or a whole resource. */
1309
846
  GatheredContext: {
1310
847
  /** @description The gather anchor. Discriminated on `kind`. */
@@ -1375,41 +912,75 @@ interface components {
1375
912
  /** @description LLM-generated summary of the focal anchor's relationships in the knowledge graph */
1376
913
  inferredRelationshipSummary?: string;
1377
914
  };
1378
- /** @description Completion payload emitted on the gather:resource-complete bus channel when resource context gathering finishes. */
1379
- GatherResourceComplete: {
1380
- /** @description Client-generated correlation ID to thread the response back to the originating request */
1381
- correlationId: string;
1382
- /** @description Branded ResourceId of the resource whose context was gathered */
915
+ GetAnnotationHistoryResponse: {
916
+ events: components["schemas"]["StoredEventResponse"][];
917
+ total: number;
918
+ annotationId: string;
1383
919
  resourceId: string;
1384
- /** @description The gathered resource context (unified GatheredContext, focus.kind:'resource') */
1385
- response: components["schemas"]["GatheredContext"];
1386
920
  };
1387
- /** @description Request payload sent on the gather:resource-requested bus channel to gather context for a resource. */
1388
- GatherResourceRequest: {
1389
- /** @description Client-generated correlation ID to thread the response back to the originating request */
1390
- correlationId: string;
1391
- /** @description Branded ResourceId of the resource to gather context for */
1392
- resourceId: string;
1393
- /** @description Gathering configuration */
1394
- options: {
1395
- /** @description Depth of resource graph traversal */
1396
- depth: number;
1397
- /** @description Maximum number of related resources to include */
1398
- maxResources: number;
1399
- /** @description Whether to include resource content in the gathered result */
1400
- includeContent: boolean;
1401
- /** @description Whether to include resource summaries in the gathered result */
1402
- includeSummary: boolean;
1403
- /** @description Entity types to exclude from the semantic recall built into this context (caller-supplied; e.g. a chat consumer passes ['Question'] so prior questions never ground answer generation). Optional; default none. */
1404
- excludeEntityTypes?: string[];
1405
- };
921
+ GetAnnotationResponse: {
922
+ annotation: components["schemas"]["Annotation"];
923
+ resource: components["schemas"]["ResourceDescriptor"] | null;
924
+ resolvedResource: components["schemas"]["ResourceDescriptor"] | null;
1406
925
  };
1407
- /** @description Request to generate an AI summary of an annotation */
1408
- GatherSummaryRequest: {
1409
- correlationId: string;
1410
- annotationId: string;
926
+ GetAnnotationsResponse: {
927
+ annotations: components["schemas"]["Annotation"][];
928
+ /** @description Total number of annotations */
929
+ total: number;
930
+ /** @description Motivation filter applied (if any) */
931
+ motivation?: components["schemas"]["Motivation"] | null;
932
+ };
933
+ GetEntityTypesResponse: {
934
+ entityTypes: string[];
935
+ };
936
+ GetEventsResponse: {
937
+ events: components["schemas"]["StoredEventResponse"][];
938
+ total: number;
1411
939
  resourceId: string;
1412
940
  };
941
+ GetReferencedByResponse: {
942
+ referencedBy: {
943
+ /** @description Reference annotation ID */
944
+ id: string;
945
+ /** @description Name of resource containing the reference */
946
+ resourceName: string;
947
+ target: {
948
+ /** @description ID of resource containing the reference */
949
+ source: string;
950
+ selector: {
951
+ /** @description The selected text that references this resource */
952
+ exact: string;
953
+ };
954
+ };
955
+ }[];
956
+ };
957
+ GetResourceByTokenResponse: {
958
+ sourceResource: components["schemas"]["ResourceDescriptor"];
959
+ /** @description ISO 8601 timestamp when token expires */
960
+ expiresAt: string;
961
+ };
962
+ GetResourceResponse: {
963
+ resource: components["schemas"]["ResourceDescriptor"];
964
+ /** @description All annotations for the resource (highlights, references, assessments, etc.) */
965
+ annotations: components["schemas"]["Annotation"][];
966
+ /** @description Annotations that reference this resource from other resources */
967
+ entityReferences: components["schemas"]["Annotation"][];
968
+ };
969
+ GetTagSchemasResponse: {
970
+ tagSchemas: components["schemas"]["TagSchema"][];
971
+ };
972
+ GoogleAuthRequest: {
973
+ access_token: string;
974
+ };
975
+ HealthResponse: {
976
+ status: string;
977
+ message: string;
978
+ version: string;
979
+ timestamp: string;
980
+ /** @enum {string} */
981
+ database: "connected" | "disconnected" | "unknown";
982
+ environment: string;
983
+ };
1413
984
  /** @description Result of a completed assessment-annotation job. */
1414
985
  JobAssessmentAnnotationResult: {
1415
986
  assessmentsFound: number;
@@ -1427,6 +998,41 @@ interface components {
1427
998
  correlationId: string;
1428
999
  jobId: string;
1429
1000
  };
1001
+ /** @description Result of a completed comment-annotation job. */
1002
+ JobCommentAnnotationResult: {
1003
+ commentsFound: number;
1004
+ commentsCreated: number;
1005
+ };
1006
+ /** @description Command to mark a job as complete */
1007
+ JobCompleteCommand: {
1008
+ /** @description Authenticated user's DID, injected by the /bus/emit gateway. Clients do not set this. */
1009
+ _userId?: string;
1010
+ resourceId: string;
1011
+ jobId: string;
1012
+ jobType: components["schemas"]["JobType"];
1013
+ /** @description Annotation this job is attached to, when applicable. Lets the UI route completion feedback (toast, resolve state) to a specific annotation. */
1014
+ annotationId?: string;
1015
+ result?: components["schemas"]["JobResult"];
1016
+ };
1017
+ /** @description Payload for job:completed domain event */
1018
+ JobCompletedPayload: {
1019
+ jobId: string;
1020
+ jobType: components["schemas"]["JobType"];
1021
+ /** @description Annotation this job was attached to, when applicable */
1022
+ annotationId?: string;
1023
+ totalSteps?: number;
1024
+ /** @description For detection: total entities found */
1025
+ foundCount?: number;
1026
+ /** @description For generation: ID of generated resource */
1027
+ resultResourceId?: string;
1028
+ /** @description For generation: URI of annotation that triggered generation */
1029
+ annotationUri?: string;
1030
+ message?: string;
1031
+ /** @description Full result object for extensibility */
1032
+ result?: {
1033
+ [key: string]: unknown;
1034
+ };
1035
+ };
1430
1036
  /** @description Command to create a new job via the event bus */
1431
1037
  JobCreateCommand: {
1432
1038
  correlationId: string;
@@ -1445,32 +1051,25 @@ interface components {
1445
1051
  jobId: string;
1446
1052
  };
1447
1053
  };
1448
- /** @description Result of a completed comment-annotation job. */
1449
- JobCommentAnnotationResult: {
1450
- commentsFound: number;
1451
- commentsCreated: number;
1452
- };
1453
- /** @description Command to mark a job as complete */
1454
- JobCompleteCommand: {
1054
+ /** @description Command to mark a job as failed */
1055
+ JobFailCommand: {
1455
1056
  /** @description Authenticated user's DID, injected by the /bus/emit gateway. Clients do not set this. */
1456
1057
  _userId?: string;
1457
1058
  resourceId: string;
1458
1059
  jobId: string;
1459
1060
  jobType: components["schemas"]["JobType"];
1460
- /** @description Annotation this job is attached to, when applicable. Lets the UI route completion feedback (toast, resolve state) to a specific annotation. */
1061
+ /** @description Annotation this job is attached to, when applicable. Lets the UI route failure feedback (error toast, revert state) to a specific annotation. */
1461
1062
  annotationId?: string;
1462
- result?: components["schemas"]["JobResult"];
1063
+ error: string;
1463
1064
  };
1464
- /** @description Command to mark a job as failed */
1465
- JobFailCommand: {
1466
- /** @description Authenticated user's DID, injected by the /bus/emit gateway. Clients do not set this. */
1467
- _userId?: string;
1468
- resourceId: string;
1065
+ /** @description Payload for job:failed domain event */
1066
+ JobFailedPayload: {
1469
1067
  jobId: string;
1470
1068
  jobType: components["schemas"]["JobType"];
1471
- /** @description Annotation this job is attached to, when applicable. Lets the UI route failure feedback (error toast, revert state) to a specific annotation. */
1069
+ /** @description Annotation this job was attached to, when applicable */
1472
1070
  annotationId?: string;
1473
1071
  error: string;
1072
+ details?: string;
1474
1073
  };
1475
1074
  /** @description Result of a completed generation job. resourceId is assigned by Stower when yield:create is processed; the worker emits job:complete with only resourceName, and Stower populates resourceId on the persisted payload. */
1476
1075
  JobGenerationResult: {
@@ -1521,6 +1120,23 @@ interface components {
1521
1120
  value: string;
1522
1121
  }[];
1523
1122
  };
1123
+ /** @description Payload for job:progress domain event */
1124
+ JobProgressPayload: {
1125
+ jobId: string;
1126
+ jobType: components["schemas"]["JobType"];
1127
+ percentage: number;
1128
+ /** @description Human-readable current step */
1129
+ currentStep?: string;
1130
+ processedSteps?: number;
1131
+ totalSteps?: number;
1132
+ /** @description For detection: entities found so far */
1133
+ foundCount?: number;
1134
+ message?: string;
1135
+ /** @description Full progress object for extensibility */
1136
+ progress?: {
1137
+ [key: string]: unknown;
1138
+ };
1139
+ };
1524
1140
  /** @description Event indicating a job has been queued */
1525
1141
  JobQueuedEvent: {
1526
1142
  jobId: string;
@@ -1562,11 +1178,32 @@ interface components {
1562
1178
  /** @description Annotation this job is attached to, when applicable. Set for annotation-scoped jobs like generation (from a specific reference). Unset for resource-scoped jobs like bulk reference/tag/highlight detection. */
1563
1179
  annotationId?: string;
1564
1180
  };
1181
+ /** @description Payload for job:started domain event */
1182
+ JobStartedPayload: {
1183
+ jobId: string;
1184
+ jobType: components["schemas"]["JobType"];
1185
+ /** @description Annotation this job is attached to, when applicable */
1186
+ annotationId?: string;
1187
+ totalSteps?: number;
1188
+ };
1565
1189
  /** @description Request to check the status of a job */
1566
1190
  JobStatusRequest: {
1567
1191
  correlationId: string;
1568
1192
  jobId: string;
1569
1193
  };
1194
+ JobStatusResponse: {
1195
+ jobId: string;
1196
+ type: components["schemas"]["JobType"];
1197
+ /** @enum {string} */
1198
+ status: "pending" | "running" | "complete" | "failed" | "cancelled";
1199
+ userId: string;
1200
+ created: string;
1201
+ startedAt?: string;
1202
+ completedAt?: string;
1203
+ error?: string;
1204
+ progress?: unknown;
1205
+ result?: unknown;
1206
+ };
1570
1207
  /** @description Result of a job status request */
1571
1208
  JobStatusResult: {
1572
1209
  correlationId: string;
@@ -1581,21 +1218,45 @@ interface components {
1581
1218
  [key: string]: number;
1582
1219
  };
1583
1220
  };
1584
- /** @description Bus command to add a new entity type to the KB's vocabulary. Carried on the `frame:add-entity-type` channel — Frame is the schema-layer flow that owns vocabulary writes. */
1585
- FrameAddEntityTypeCommand: {
1586
- /** @description Correlation id for request/reply matching, set by the SDK's busRequest so the confirmed-write ack/failure routes back. Absent for in-process (bootstrap/replay/import) emits, which race the frame:entity-type-added domain event instead. */
1587
- correlationId?: string;
1588
- tag: string;
1589
- /** @description Authenticated user's DID, injected by the /bus/emit gateway. Clients do not set this. */
1590
- _userId?: string;
1221
+ /**
1222
+ * @description Type of background job
1223
+ * @enum {string}
1224
+ */
1225
+ JobType: "reference-annotation" | "generation" | "highlight-annotation" | "assessment-annotation" | "comment-annotation" | "tag-annotation";
1226
+ /** @description Knowledge graph gathered for an LLM context — a shared backbone in which resources AND annotations are typed nodes, connected by typed (optionally bidirectional) edges. Flattened views the matcher/generation read (connections, citedBy, siblings) are derived from these nodes/edges. */
1227
+ KnowledgeGraph: {
1228
+ nodes: {
1229
+ /** @description Node identifier — a ResourceId or AnnotationId */
1230
+ id: string;
1231
+ /**
1232
+ * @description Whether this node is a resource or an annotation
1233
+ * @enum {string}
1234
+ */
1235
+ type: "resource" | "annotation";
1236
+ label: string;
1237
+ /** @description Entity types on the node (resources) or carried by the annotation */
1238
+ entityTypes?: string[];
1239
+ metadata?: {
1240
+ [key: string]: unknown;
1241
+ };
1242
+ }[];
1243
+ edges: {
1244
+ source: string;
1245
+ target: string;
1246
+ /** @description Edge kind (e.g. citation, annotation-of, sibling) */
1247
+ type: string;
1248
+ /** @description Whether the connection goes both ways */
1249
+ bidirectional?: boolean;
1250
+ metadata?: {
1251
+ [key: string]: unknown;
1252
+ };
1253
+ }[];
1591
1254
  };
1592
- /** @description Bus command to register a tag schema with the KB's runtime registry. Carried on the `frame:add-tag-schema` channel — Frame is the schema-layer flow that owns vocabulary writes. Most-recent registration of a given `schema.id` wins; the projection reflects the latest content. Identical re-registrations are silent; differing content overwrites and logs a warning. */
1593
- FrameAddTagSchemaCommand: {
1594
- /** @description Correlation id for request/reply matching, set by the SDK's busRequest so the confirmed-write ack/failure routes back. Absent for in-process emits. */
1595
- correlationId?: string;
1596
- schema: components["schemas"]["TagSchema"];
1597
- /** @description Authenticated user's DID, injected by the /bus/emit gateway. Clients do not set this. */
1598
- _userId?: string;
1255
+ ListResourcesResponse: {
1256
+ resources: components["schemas"]["ResourceDescriptor"][];
1257
+ total: number;
1258
+ offset: number;
1259
+ limit: number;
1599
1260
  };
1600
1261
  /** @description Bus command to archive a resource and optionally remove its file. */
1601
1262
  MarkArchiveCommand: {
@@ -1694,48 +1355,288 @@ interface components {
1694
1355
  resourceId: string;
1695
1356
  storageUri?: string;
1696
1357
  };
1697
- /** @description Bus command to update an annotation's body with patch operations. */
1698
- MarkUpdateBodyCommand: {
1699
- /** @description Authenticated user's DID, injected by the /bus/emit gateway. Clients do not set this. */
1700
- _userId?: string;
1701
- /** @description Correlation id threaded from the originating route through to event metadata. Lets the events-stream deliver matched results to the client that initiated the bind. */
1702
- correlationId?: string;
1703
- annotationId: string;
1704
- resourceId: string;
1705
- operations: (components["schemas"]["BodyOperationAdd"] | components["schemas"]["BodyOperationRemove"] | components["schemas"]["BodyOperationReplace"])[];
1358
+ /** @description Bus command to update an annotation's body with patch operations. */
1359
+ MarkUpdateBodyCommand: {
1360
+ /** @description Authenticated user's DID, injected by the /bus/emit gateway. Clients do not set this. */
1361
+ _userId?: string;
1362
+ /** @description Correlation id threaded from the originating route through to event metadata. Lets the events-stream deliver matched results to the client that initiated the bind. */
1363
+ correlationId?: string;
1364
+ annotationId: string;
1365
+ resourceId: string;
1366
+ operations: (components["schemas"]["BodyOperationAdd"] | components["schemas"]["BodyOperationRemove"] | components["schemas"]["BodyOperationReplace"])[];
1367
+ };
1368
+ /** @description Bus command to replace the entity types on a resource. */
1369
+ MarkUpdateEntityTypesCommand: {
1370
+ /** @description Correlation id for request/reply matching, set by the SDK's busRequest so the confirmed-write ack/failure routes back. */
1371
+ correlationId?: string;
1372
+ resourceId: string;
1373
+ /** @description Authenticated user's DID, injected by the /bus/emit gateway. Clients do not set this. */
1374
+ _userId?: string;
1375
+ currentEntityTypes: string[];
1376
+ updatedEntityTypes: string[];
1377
+ };
1378
+ /** @description Error payload emitted on match:search-failed SSE channel. */
1379
+ MatchSearchFailed: {
1380
+ correlationId: string;
1381
+ referenceId: string;
1382
+ error: string;
1383
+ };
1384
+ /** @description Request payload sent on the match:search-request bus channel to find candidate matches. */
1385
+ MatchSearchRequest: {
1386
+ /** @description Client-generated correlation ID to thread the response back to the originating request */
1387
+ correlationId: string;
1388
+ /** @description Resource ID the reference annotation belongs to. Used to scope result events on the EventBus so the events-stream delivers them to participants viewing this resource. */
1389
+ resourceId: string;
1390
+ /** @description Annotation ID of the reference to search candidates for */
1391
+ referenceId: string;
1392
+ /** @description Gathered context for the reference annotation */
1393
+ context: components["schemas"]["GatheredContext"];
1394
+ /** @description Maximum number of candidate results to return */
1395
+ limit?: number;
1396
+ /** @description Enable semantic similarity scoring in addition to keyword matching */
1397
+ useSemanticScoring?: boolean;
1398
+ };
1399
+ /** @description Search results payload emitted on match:search-results SSE channel. */
1400
+ MatchSearchResult: {
1401
+ correlationId: string;
1402
+ referenceId: string;
1403
+ response: (components["schemas"]["ResourceDescriptor"] & {
1404
+ /** @description Relevance score */
1405
+ score?: number;
1406
+ /** @description Human-readable reason for the match */
1407
+ matchReason?: string;
1408
+ })[];
1409
+ };
1410
+ MediaTokenRequest: {
1411
+ /** @description The resource ID to generate a media token for */
1412
+ resourceId: string;
1413
+ };
1414
+ MediaTokenResponse: {
1415
+ /** @description Short-lived media token for use as ?token= query parameter on resource URLs */
1416
+ token: string;
1417
+ };
1418
+ /**
1419
+ * @description Semiont-supported W3C Web Annotation motivations - https://www.w3.org/TR/annotation-vocab/#motivation
1420
+ * @enum {string}
1421
+ */
1422
+ Motivation: "assessing" | "commenting" | "highlighting" | "linking" | "tagging";
1423
+ OAuthConfigResponse: {
1424
+ providers: {
1425
+ name: string;
1426
+ isConfigured: boolean;
1427
+ clientId: string;
1428
+ }[];
1429
+ allowedDomains: string[];
1430
+ };
1431
+ PasswordAuthRequest: {
1432
+ /**
1433
+ * Format: email
1434
+ * @description User email address
1435
+ */
1436
+ email: string;
1437
+ /** @description User password (minimum 8 characters) */
1438
+ password: string;
1439
+ };
1440
+ /** @description A specific, byte-addressable rendition of a resource (file/asset/variant). */
1441
+ Representation: {
1442
+ /**
1443
+ * Format: uri
1444
+ * @description Stable ID for this representation.
1445
+ */
1446
+ "@id"?: string;
1447
+ /** @description Type(s), e.g., schema:MediaObject. */
1448
+ "@type"?: string | string[];
1449
+ /** @description MIME/media type (e.g., text/markdown, image/png). */
1450
+ mediaType: string;
1451
+ /** @description Working-tree URI identifying where the bytes live. Only file:// is supported (e.g. file://docs/overview.md). */
1452
+ storageUri?: string;
1453
+ filename?: string;
1454
+ /** @description Size of the payload in bytes. */
1455
+ byteSize?: number;
1456
+ /** @description Integrity hash (e.g., sha256:abcd…). */
1457
+ checksum?: string;
1458
+ /** @description Compression/transfer encoding if applicable. */
1459
+ encoding?: string;
1460
+ /** @description IETF BCP 47 language tag (e.g., en, es-ES). */
1461
+ language?: string;
1462
+ /** @description Pixels (images/video). */
1463
+ width?: number;
1464
+ /** @description Pixels (images/video). */
1465
+ height?: number;
1466
+ /** @description Seconds (audio/video). */
1467
+ duration?: number;
1468
+ /** Format: date-time */
1469
+ created?: string;
1470
+ /** Format: date-time */
1471
+ modified?: string;
1472
+ /** @description Profile/shape the bytes conform to (e.g., a JSON profile or SVG profile). */
1473
+ conformsTo?: string | string[];
1474
+ tags?: string[];
1475
+ /**
1476
+ * @description Semantics of this rendition relative to the resource (e.g., original, thumbnail, preview, derived).
1477
+ * @enum {string}
1478
+ */
1479
+ rel?: "original" | "thumbnail" | "preview" | "optimized" | "derived" | "other";
1480
+ } & {
1481
+ [key: string]: unknown;
1482
+ };
1483
+ /** @description Payload for yield:representation-added domain event */
1484
+ RepresentationAddedPayload: {
1485
+ representation: components["schemas"]["Representation"];
1486
+ };
1487
+ /** @description Payload for yield:representation-removed domain event */
1488
+ RepresentationRemovedPayload: {
1489
+ /** @description Checksum of the representation to remove */
1490
+ checksum: string;
1491
+ };
1492
+ /** @description Payload for mark:archived domain event */
1493
+ ResourceArchivedPayload: {
1494
+ reason?: string;
1495
+ };
1496
+ /** @description Payload for yield:cloned domain event */
1497
+ ResourceClonedPayload: {
1498
+ name: string;
1499
+ format: components["schemas"]["ContentFormat"];
1500
+ contentChecksum: string;
1501
+ contentByteSize?: number;
1502
+ parentResourceId: string;
1503
+ entityTypes?: string[];
1504
+ language?: string;
1505
+ };
1506
+ /** @description Payload for yield:created domain event */
1507
+ ResourceCreatedPayload: {
1508
+ name: string;
1509
+ format: components["schemas"]["ContentFormat"];
1510
+ /** @description SHA-256 of content */
1511
+ contentChecksum: string;
1512
+ contentByteSize?: number;
1513
+ entityTypes?: string[];
1514
+ /** @description Working-tree URI (e.g. file://docs/overview.md) */
1515
+ storageUri?: string;
1516
+ language?: string;
1517
+ isDraft?: boolean;
1518
+ generatedFrom?: {
1519
+ resourceId: string;
1520
+ annotationId: string;
1521
+ };
1522
+ generationPrompt?: string;
1523
+ generator?: components["schemas"]["Agent"] | components["schemas"]["Agent"][];
1524
+ };
1525
+ /** @description Metadata about a resource (1:1 with its URI). JSON-LD subject is @id. Link to concrete bytes via representations. */
1526
+ ResourceDescriptor: {
1527
+ /** @description JSON-LD context; URI, object, or array of these. */
1528
+ "@context": string | {
1529
+ [key: string]: unknown;
1530
+ } | (string | {
1531
+ [key: string]: unknown;
1532
+ })[];
1533
+ /** @description Canonical URI/URN of the resource being described. */
1534
+ "@id": string;
1535
+ /** @description Type(s) of the resource (IRIs/CURIEs via @context). */
1536
+ "@type"?: string | string[];
1537
+ name: string;
1538
+ description?: string;
1539
+ /** @description Persistent identifiers (e.g., DOI, URN). */
1540
+ identifier?: string | string[] | ({
1541
+ /** Format: uri */
1542
+ "@id"?: string;
1543
+ value?: string;
1544
+ scheme?: string;
1545
+ } & {
1546
+ [key: string]: unknown;
1547
+ });
1548
+ /** @description Topics (IRIs or strings). */
1549
+ about?: string | string[];
1550
+ /** @description Equivalent/authoritative references. */
1551
+ sameAs?: string[];
1552
+ isPartOf?: string[];
1553
+ hasPart?: string[];
1554
+ /** Format: uri */
1555
+ license?: string;
1556
+ version?: string;
1557
+ /** Format: date-time */
1558
+ dateCreated?: string;
1559
+ /** Format: date-time */
1560
+ dateModified?: string;
1561
+ /** @description W3C PROV - source resources this was derived from */
1562
+ wasDerivedFrom?: string | string[];
1563
+ /** @description W3C PROV - agents responsible for this resource */
1564
+ wasAttributedTo?: components["schemas"]["Agent"] | components["schemas"]["Agent"][];
1565
+ /** @description Software agent that produced or processed this resource (W3C Web Annotation model) */
1566
+ generator?: components["schemas"]["Agent"] | components["schemas"]["Agent"][];
1567
+ /** @description Profile/shape URI this resource description conforms to. */
1568
+ conformsTo?: string | string[];
1569
+ /** @description Convenience set summarizing media types across representations. */
1570
+ availableFormats?: string[];
1571
+ /** @description Managed or referenced byte-level renditions of this resource. */
1572
+ representations: components["schemas"]["Representation"] | components["schemas"]["Representation"][];
1573
+ /** @description Application-specific: Whether this resource is archived */
1574
+ archived?: boolean;
1575
+ /** @description Application-specific: Entity types for this resource */
1576
+ entityTypes?: string[];
1577
+ /** @description Application-specific: Whether this resource is a draft */
1578
+ isDraft?: boolean;
1579
+ /** @description Application-specific: ID of annotation that triggered generation */
1580
+ sourceAnnotationId?: string;
1581
+ /** @description Application-specific: ID of source resource for clones/derivatives */
1582
+ sourceResourceId?: string;
1583
+ /**
1584
+ * Format: uri
1585
+ * @description Original URI from a source knowledge base when this resource was imported
1586
+ */
1587
+ originatedFrom?: string;
1588
+ /** @description Working-tree URI for this resource (e.g. file://docs/overview.md). Stable across updates and moves. */
1589
+ storageUri?: string;
1590
+ /** @description SHA-256 hex hash of the current content. Updated on resource.created, resource.updated, resource.cloned events. */
1591
+ currentChecksum?: string;
1592
+ } & {
1593
+ [key: string]: unknown;
1594
+ };
1595
+ /** @description Payload for yield:moved domain event */
1596
+ ResourceMovedPayload: {
1597
+ /** @description Previous file:// URI */
1598
+ fromUri: string;
1599
+ /** @description New file:// URI */
1600
+ toUri: string;
1706
1601
  };
1707
- /** @description Bus command to replace the entity types on a resource. */
1708
- MarkUpdateEntityTypesCommand: {
1709
- /** @description Correlation id for request/reply matching, set by the SDK's busRequest so the confirmed-write ack/failure routes back. */
1710
- correlationId?: string;
1711
- resourceId: string;
1712
- /** @description Authenticated user's DID, injected by the /bus/emit gateway. Clients do not set this. */
1713
- _userId?: string;
1714
- currentEntityTypes: string[];
1715
- updatedEntityTypes: string[];
1602
+ /** @description Payload for mark:unarchived domain event (empty payload) */
1603
+ ResourceUnarchivedPayload: Record<string, never>;
1604
+ /** @description Payload for yield:updated domain event */
1605
+ ResourceUpdatedPayload: {
1606
+ /** @description SHA-256 of new content */
1607
+ contentChecksum: string;
1608
+ contentByteSize?: number;
1716
1609
  };
1717
- /** @description Request payload sent on the match:search-request bus channel to find candidate matches. */
1718
- MatchSearchRequest: {
1719
- /** @description Client-generated correlation ID to thread the response back to the originating request */
1720
- correlationId: string;
1721
- /** @description Resource ID the reference annotation belongs to. Used to scope result events on the EventBus so the events-stream delivers them to participants viewing this resource. */
1722
- resourceId: string;
1723
- /** @description Annotation ID of the reference to search candidates for */
1724
- referenceId: string;
1725
- /** @description Gathered context for the reference annotation */
1726
- context: components["schemas"]["GatheredContext"];
1727
- /** @description Maximum number of candidate results to return */
1728
- limit?: number;
1729
- /** @description Enable semantic similarity scoring in addition to keyword matching */
1730
- useSemanticScoring?: boolean;
1610
+ /** @description Selection data for user-initiated annotations. Captures the text range and optional selector information from a user's highlight in the UI. */
1611
+ SelectionData: {
1612
+ /** @description The exact selected text */
1613
+ exact: string;
1614
+ /** @description Start character offset */
1615
+ start: number;
1616
+ /** @description End character offset */
1617
+ end: number;
1618
+ /** @description SVG selector for non-text selections (e.g. PDF regions) */
1619
+ svgSelector?: string;
1620
+ /** @description Fragment selector (e.g. page=2) */
1621
+ fragmentSelector?: string;
1622
+ /** @description Specification the fragment selector conforms to */
1623
+ conformsTo?: string;
1624
+ /** @description Text before the selection (for disambiguation) */
1625
+ prefix?: string;
1626
+ /** @description Text after the selection (for disambiguation) */
1627
+ suffix?: string;
1731
1628
  };
1732
- MediaTokenRequest: {
1733
- /** @description The resource ID to generate a media token for */
1629
+ SemanticMatch: {
1630
+ /** @description The chunk text that matched */
1631
+ text: string;
1632
+ /** @description Source resource ID */
1734
1633
  resourceId: string;
1735
- };
1736
- MediaTokenResponse: {
1737
- /** @description Short-lived media token for use as ?token= query parameter on resource URLs */
1738
- token: string;
1634
+ /** @description Source annotation ID, if the match is from an annotation */
1635
+ annotationId?: string;
1636
+ /** @description Cosine similarity score (0-1) */
1637
+ score: number;
1638
+ /** @description Entity types on the matched passage */
1639
+ entityTypes?: string[];
1739
1640
  };
1740
1641
  /** @description Emitted when the hover delay setting changes */
1741
1642
  SettingsHoverDelayChangedEvent: {
@@ -1750,6 +1651,57 @@ interface components {
1750
1651
  /** @enum {string} */
1751
1652
  theme: "light" | "dark" | "system";
1752
1653
  };
1654
+ SpecificResource: {
1655
+ /** @enum {string} */
1656
+ type: "SpecificResource";
1657
+ /** @description IRI of the target resource */
1658
+ source: string;
1659
+ /** @description Why this body is included */
1660
+ purpose?: components["schemas"]["BodyPurpose"];
1661
+ };
1662
+ StatusResponse: {
1663
+ status: string;
1664
+ version: string;
1665
+ features: {
1666
+ semanticContent: string;
1667
+ collaboration: string;
1668
+ rbac: string;
1669
+ };
1670
+ message: string;
1671
+ authenticatedAs?: string;
1672
+ /** @description Name of the knowledge base project */
1673
+ projectName?: string;
1674
+ /** @description Current git branch of the knowledge base repository */
1675
+ gitBranch?: string;
1676
+ };
1677
+ /** @description A persisted domain event with metadata. Flat shape — event fields and metadata are peers. */
1678
+ StoredEventResponse: {
1679
+ /** @description Unique event ID (UUID) */
1680
+ id: string;
1681
+ /** @description Event type (flow verb name, e.g. mark:added) */
1682
+ type: string;
1683
+ /**
1684
+ * Format: date-time
1685
+ * @description When the event occurred
1686
+ */
1687
+ timestamp: string;
1688
+ /** @description DID of the user who triggered the event */
1689
+ userId: string;
1690
+ /** @description Resource this event affects (absent for system events) */
1691
+ resourceId?: string;
1692
+ /** @description Event schema version */
1693
+ version: number;
1694
+ /** @description Event-type-specific payload */
1695
+ payload: {
1696
+ [key: string]: unknown;
1697
+ };
1698
+ metadata: components["schemas"]["EventMetadata"];
1699
+ };
1700
+ /**
1701
+ * @description Base MIME types (no parameters) admitted by Semiont. Membership is the create/yield gate — every member is storable, nameable, and uploadable. What more the system can do with a type (render, annotate, extract text, author) is curated per type in @semiont/core's media-type registry, which is keyed by this enum.
1702
+ * @enum {string}
1703
+ */
1704
+ SupportedMediaType: "text/plain" | "text/markdown" | "text/html" | "text/css" | "text/csv" | "text/xml" | "application/json" | "application/xml" | "application/yaml" | "application/x-yaml" | "application/pdf" | "application/msword" | "application/vnd.openxmlformats-officedocument.wordprocessingml.document" | "application/vnd.ms-excel" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "application/vnd.ms-powerpoint" | "application/vnd.openxmlformats-officedocument.presentationml.presentation" | "application/zip" | "application/gzip" | "application/x-tar" | "application/x-7z-compressed" | "application/octet-stream" | "application/wasm" | "image/png" | "image/jpeg" | "image/gif" | "image/webp" | "image/svg+xml" | "image/bmp" | "image/tiff" | "image/x-icon" | "video/mp4" | "video/mpeg" | "video/webm" | "video/ogg" | "video/quicktime" | "video/x-msvideo" | "audio/mpeg" | "audio/wav" | "audio/ogg" | "audio/webm" | "audio/aac" | "audio/flac" | "text/javascript" | "application/javascript" | "text/x-typescript" | "application/typescript" | "text/x-python" | "text/x-java" | "text/x-c" | "text/x-c++" | "text/x-csharp" | "text/x-go" | "text/x-rust" | "text/x-ruby" | "text/x-php" | "text/x-swift" | "text/x-kotlin" | "text/x-shell" | "font/woff" | "font/woff2" | "font/ttf" | "font/otf";
1753
1705
  SvgSelector: {
1754
1706
  /** @enum {string} */
1755
1707
  type: "SvgSelector";
@@ -1771,6 +1723,90 @@ interface components {
1771
1723
  domain: string;
1772
1724
  tags: components["schemas"]["TagCategory"][];
1773
1725
  };
1726
+ /** @description Payload for frame:tag-schema-added domain event (system-level, no resourceId — fan-out is global to the KB). */
1727
+ TagSchemaAddedPayload: {
1728
+ schema: components["schemas"]["TagSchema"];
1729
+ };
1730
+ TextPositionSelector: {
1731
+ /** @enum {string} */
1732
+ type: "TextPositionSelector";
1733
+ /** @description Character offset from resource start */
1734
+ start: number;
1735
+ /** @description Character offset from resource start */
1736
+ end: number;
1737
+ };
1738
+ TextQuoteSelector: {
1739
+ /** @enum {string} */
1740
+ type: "TextQuoteSelector";
1741
+ exact: string;
1742
+ prefix?: string;
1743
+ suffix?: string;
1744
+ };
1745
+ TextualBody: {
1746
+ /** @enum {string} */
1747
+ type: "TextualBody";
1748
+ /** @description The text content (e.g., entity type name) */
1749
+ value: string;
1750
+ /** @description Why this body is included */
1751
+ purpose?: components["schemas"]["BodyPurpose"];
1752
+ /** @description MIME type (defaults to text/plain) */
1753
+ format?: string;
1754
+ /** @description BCP 47 language tag */
1755
+ language?: string;
1756
+ };
1757
+ TokenRefreshRequest: {
1758
+ /**
1759
+ * @description Refresh token obtained during login
1760
+ * @example eyJhbGciOiJIUzI1NiIs...
1761
+ */
1762
+ refreshToken: string;
1763
+ };
1764
+ TokenRefreshResponse: {
1765
+ access_token: string;
1766
+ };
1767
+ UpdateAnnotationBodyRequest: {
1768
+ /** @description Resource ID containing the annotation (required for O(1) Layer 3 lookup) */
1769
+ resourceId: string;
1770
+ /** @description Array of body modification operations to apply */
1771
+ operations: (components["schemas"]["BodyOperationAdd"] | components["schemas"]["BodyOperationRemove"] | components["schemas"]["BodyOperationReplace"])[];
1772
+ };
1773
+ UpdateUserRequest: {
1774
+ isAdmin?: boolean;
1775
+ isActive?: boolean;
1776
+ name?: string;
1777
+ };
1778
+ UpdateUserResponse: {
1779
+ success: boolean;
1780
+ user: {
1781
+ id: string;
1782
+ email: string;
1783
+ name?: string | null;
1784
+ image?: string | null;
1785
+ domain: string;
1786
+ provider: string;
1787
+ isAdmin: boolean;
1788
+ isActive: boolean;
1789
+ lastLogin?: string | null;
1790
+ created: string;
1791
+ updatedAt: string;
1792
+ };
1793
+ };
1794
+ UserResponse: {
1795
+ id: string;
1796
+ email: string;
1797
+ name: string | null;
1798
+ image: string | null;
1799
+ domain: string;
1800
+ provider: string;
1801
+ isAdmin: boolean;
1802
+ isModerator: boolean;
1803
+ isActive: boolean;
1804
+ termsAcceptedAt: string | null;
1805
+ lastLogin: string | null;
1806
+ created: string;
1807
+ /** @description The validated JWT token string for the current session */
1808
+ token: string;
1809
+ };
1774
1810
  /** @description Bus command to rebuild the graph projection from the event log — the whole graph when resourceId is absent, one resource when present. Served by the Weaver; replaces direct rebuild access, which does not survive the Weaver's container split. */
1775
1811
  WeaveRebuildCommand: {
1776
1812
  /** @description Correlation id for request/reply matching, set by busRequest so the ok/failed reply routes back. */