@semiont/core 0.4.13 → 0.4.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1479,7 +1479,7 @@ interface paths {
1479
1479
  patch?: never;
1480
1480
  trace?: never;
1481
1481
  };
1482
- "/resources/{id}/annotate-references-stream": {
1482
+ "/resources/{id}/annotate-references": {
1483
1483
  parameters: {
1484
1484
  query?: never;
1485
1485
  header?: never;
@@ -1538,7 +1538,7 @@ interface paths {
1538
1538
  patch?: never;
1539
1539
  trace?: never;
1540
1540
  };
1541
- "/resources/{id}/annotate-highlights-stream": {
1541
+ "/resources/{id}/annotate-highlights": {
1542
1542
  parameters: {
1543
1543
  query?: never;
1544
1544
  header?: never;
@@ -1597,7 +1597,7 @@ interface paths {
1597
1597
  patch?: never;
1598
1598
  trace?: never;
1599
1599
  };
1600
- "/resources/{id}/annotate-assessments-stream": {
1600
+ "/resources/{id}/annotate-assessments": {
1601
1601
  parameters: {
1602
1602
  query?: never;
1603
1603
  header?: never;
@@ -1656,7 +1656,7 @@ interface paths {
1656
1656
  patch?: never;
1657
1657
  trace?: never;
1658
1658
  };
1659
- "/resources/{id}/annotate-comments-stream": {
1659
+ "/resources/{id}/annotate-comments": {
1660
1660
  parameters: {
1661
1661
  query?: never;
1662
1662
  header?: never;
@@ -1715,7 +1715,7 @@ interface paths {
1715
1715
  patch?: never;
1716
1716
  trace?: never;
1717
1717
  };
1718
- "/resources/{id}/annotate-tags-stream": {
1718
+ "/resources/{id}/annotate-tags": {
1719
1719
  parameters: {
1720
1720
  query?: never;
1721
1721
  header?: never;
@@ -1833,7 +1833,7 @@ interface paths {
1833
1833
  patch?: never;
1834
1834
  trace?: never;
1835
1835
  };
1836
- "/resources/{id}/match-search-stream": {
1836
+ "/resources/{id}/match-search": {
1837
1837
  parameters: {
1838
1838
  query?: never;
1839
1839
  header?: never;
@@ -1843,8 +1843,8 @@ interface paths {
1843
1843
  get?: never;
1844
1844
  put?: never;
1845
1845
  /**
1846
- * Match Search (SSE Stream)
1847
- * @description Search for binding candidates for a reference annotation via Server-Sent Events. Delegates to the Matcher actor on the backend EventBus.
1846
+ * Match Search
1847
+ * @description Submit a match-search command for binding candidates. Returns {correlationId} immediately. Results are delivered asynchronously via the long-lived events-stream as match:search-results or match:search-failed events.
1848
1848
  */
1849
1849
  post: {
1850
1850
  parameters: {
@@ -1858,25 +1858,20 @@ interface paths {
1858
1858
  };
1859
1859
  requestBody: {
1860
1860
  content: {
1861
- "application/json": components["schemas"]["MatchSearchStreamRequest"];
1861
+ "application/json": components["schemas"]["MatchSearchRequest"];
1862
1862
  };
1863
1863
  };
1864
1864
  responses: {
1865
- /** @description SSE stream opened successfully */
1866
- 200: {
1865
+ /** @description Search command accepted. Results delivered via events-stream. */
1866
+ 202: {
1867
1867
  headers: {
1868
1868
  [name: string]: unknown;
1869
1869
  };
1870
1870
  content: {
1871
- "text/event-stream": components["schemas"]["EventStreamResponse"];
1872
- };
1873
- };
1874
- /** @description referenceId and context are required */
1875
- 400: {
1876
- headers: {
1877
- [name: string]: unknown;
1871
+ "application/json": {
1872
+ correlationId: string;
1873
+ };
1878
1874
  };
1879
- content?: never;
1880
1875
  };
1881
1876
  /** @description Authentication required */
1882
1877
  401: {
@@ -1900,7 +1895,7 @@ interface paths {
1900
1895
  patch?: never;
1901
1896
  trace?: never;
1902
1897
  };
1903
- "/resources/{resourceId}/annotations/{annotationId}/gather-annotation-stream": {
1898
+ "/resources/{resourceId}/annotations/{annotationId}/gather": {
1904
1899
  parameters: {
1905
1900
  query?: never;
1906
1901
  header?: never;
@@ -1910,8 +1905,8 @@ interface paths {
1910
1905
  get?: never;
1911
1906
  put?: never;
1912
1907
  /**
1913
- * Gather Annotation LLM Context (SSE Stream)
1914
- * @description Stream real-time annotation LLM context gathering progress via Server-Sent Events
1908
+ * Gather Annotation Context
1909
+ * @description Submit a gather-context command for an annotation. Returns {correlationId} immediately. The Gatherer assembles passage + graph context (long-running, involves LLM calls) and delivers results via the events-stream as gather:complete, gather:failed, or gather:annotation-progress events.
1915
1910
  */
1916
1911
  post: {
1917
1912
  parameters: {
@@ -1925,81 +1920,21 @@ interface paths {
1925
1920
  };
1926
1921
  cookie?: never;
1927
1922
  };
1928
- requestBody?: {
1923
+ requestBody: {
1929
1924
  content: {
1930
1925
  "application/json": components["schemas"]["GatherAnnotationStreamRequest"];
1931
1926
  };
1932
1927
  };
1933
1928
  responses: {
1934
- /** @description SSE stream opened successfully */
1935
- 200: {
1936
- headers: {
1937
- [name: string]: unknown;
1938
- };
1939
- content: {
1940
- "text/event-stream": components["schemas"]["EventStreamResponse"];
1941
- };
1942
- };
1943
- /** @description Authentication required */
1944
- 401: {
1945
- headers: {
1946
- [name: string]: unknown;
1947
- };
1948
- content?: never;
1949
- };
1950
- /** @description Annotation not found */
1951
- 404: {
1952
- headers: {
1953
- [name: string]: unknown;
1954
- };
1955
- content?: never;
1956
- };
1957
- };
1958
- };
1959
- delete?: never;
1960
- options?: never;
1961
- head?: never;
1962
- patch?: never;
1963
- trace?: never;
1964
- };
1965
- "/resources/{resourceId}/annotations/{annotationId}/bind-stream": {
1966
- parameters: {
1967
- query?: never;
1968
- header?: never;
1969
- path?: never;
1970
- cookie?: never;
1971
- };
1972
- get?: never;
1973
- put?: never;
1974
- /**
1975
- * Bind Annotation Body (SSE Stream)
1976
- * @description Apply annotation body operations and stream completion via Server-Sent Events
1977
- */
1978
- post: {
1979
- parameters: {
1980
- query?: never;
1981
- header?: never;
1982
- path: {
1983
- /** @description Resource ID */
1984
- resourceId: string;
1985
- /** @description Annotation ID */
1986
- annotationId: string;
1987
- };
1988
- cookie?: never;
1989
- };
1990
- requestBody?: {
1991
- content: {
1992
- "application/json": components["schemas"]["BindAnnotationStreamRequest"];
1993
- };
1994
- };
1995
- responses: {
1996
- /** @description SSE stream opened successfully */
1997
- 200: {
1929
+ /** @description Gather command accepted. Results delivered via events-stream. */
1930
+ 202: {
1998
1931
  headers: {
1999
1932
  [name: string]: unknown;
2000
1933
  };
2001
1934
  content: {
2002
- "text/event-stream": components["schemas"]["EventStreamResponse"];
1935
+ "application/json": {
1936
+ correlationId: string;
1937
+ };
2003
1938
  };
2004
1939
  };
2005
1940
  /** @description Authentication required */
@@ -2009,13 +1944,6 @@ interface paths {
2009
1944
  };
2010
1945
  content?: never;
2011
1946
  };
2012
- /** @description Annotation not found */
2013
- 404: {
2014
- headers: {
2015
- [name: string]: unknown;
2016
- };
2017
- content?: never;
2018
- };
2019
1947
  };
2020
1948
  };
2021
1949
  delete?: never;
@@ -2477,7 +2405,7 @@ interface paths {
2477
2405
  patch?: never;
2478
2406
  trace?: never;
2479
2407
  };
2480
- "/resources/{resourceId}/annotations/{annotationId}/yield-resource-stream": {
2408
+ "/resources/{resourceId}/annotations/{annotationId}/yield-resource": {
2481
2409
  parameters: {
2482
2410
  query?: never;
2483
2411
  header?: never;
@@ -2487,35 +2415,45 @@ interface paths {
2487
2415
  get?: never;
2488
2416
  put?: never;
2489
2417
  /**
2490
- * Generate Resource (SSE Stream)
2491
- * @description Stream real-time resource generation progress via Server-Sent Events
2418
+ * Generate Resource from Annotation
2419
+ * @description Submit a resource generation command. Returns {correlationId, jobId} immediately. The generation worker processes the job asynchronously and delivers progress (yield:progress) and completion (yield:finished) or failure (yield:failed) via the events-stream to all connected clients.
2492
2420
  */
2493
2421
  post: {
2494
2422
  parameters: {
2495
2423
  query?: never;
2496
2424
  header?: never;
2497
2425
  path: {
2498
- /** @description Resource ID */
2426
+ /** @description Source resource ID */
2499
2427
  resourceId: string;
2500
- /** @description Annotation ID */
2428
+ /** @description Reference annotation ID */
2501
2429
  annotationId: string;
2502
2430
  };
2503
2431
  cookie?: never;
2504
2432
  };
2505
- requestBody?: {
2433
+ requestBody: {
2506
2434
  content: {
2507
2435
  "application/json": components["schemas"]["YieldResourceStreamRequest"];
2508
2436
  };
2509
2437
  };
2510
2438
  responses: {
2511
- /** @description SSE stream opened successfully */
2512
- 200: {
2439
+ /** @description Generation command accepted. Progress and results delivered via events-stream. */
2440
+ 202: {
2513
2441
  headers: {
2514
2442
  [name: string]: unknown;
2515
2443
  };
2516
2444
  content: {
2517
- "text/event-stream": components["schemas"]["EventStreamResponse"];
2445
+ "application/json": {
2446
+ correlationId: string;
2447
+ jobId: string;
2448
+ };
2449
+ };
2450
+ };
2451
+ /** @description Context is required for generation */
2452
+ 400: {
2453
+ headers: {
2454
+ [name: string]: unknown;
2518
2455
  };
2456
+ content?: never;
2519
2457
  };
2520
2458
  /** @description Authentication required */
2521
2459
  401: {
@@ -3106,7 +3044,10 @@ interface components {
3106
3044
  domain: string;
3107
3045
  isAdmin: boolean;
3108
3046
  };
3047
+ /** @description Short-lived access token (1 hour). Use as Authorization: Bearer header on API calls. */
3109
3048
  token: string;
3049
+ /** @description Long-lived refresh token (30 days). Exchange via POST /api/tokens/refresh for a fresh access token. */
3050
+ refreshToken: string;
3110
3051
  isNewUser: boolean;
3111
3052
  };
3112
3053
  BrowseFilesResponse: {
@@ -3200,6 +3141,13 @@ interface components {
3200
3141
  expiresAt: string;
3201
3142
  resource: components["schemas"]["ResourceDescriptor"];
3202
3143
  };
3144
+ /** @description Error response for failed bus commands. Replaces native Error objects on the EventBus so payloads are serializable and OpenAPI-typed. */
3145
+ CommandError: {
3146
+ /** @description Human-readable error message */
3147
+ message: string;
3148
+ /** @description Optional additional context (stack trace, field name, etc.) */
3149
+ details?: string;
3150
+ };
3203
3151
  /**
3204
3152
  * @description Content format as MIME type, optionally with charset parameter. Values include: text/plain, text/plain; charset=utf-8, text/plain; charset=iso-8859-1, text/markdown, text/markdown; charset=windows-1252, image/png, image/jpeg, application/pdf
3205
3153
  * @example text/plain; charset=utf-8
@@ -3342,6 +3290,336 @@ interface components {
3342
3290
  /** @description Array of body modification operations to apply */
3343
3291
  operations: (components["schemas"]["BodyOperationAdd"] | components["schemas"]["BodyOperationRemove"] | components["schemas"]["BodyOperationReplace"])[];
3344
3292
  };
3293
+ /** @description Progress payload emitted on gather:annotation-progress and gather:progress SSE channels during LLM context gathering. */
3294
+ GatherProgress: {
3295
+ message?: string;
3296
+ percentage?: number;
3297
+ };
3298
+ /** @description Completion payload emitted on gather:annotation-finished SSE channel. */
3299
+ GatherAnnotationFinished: {
3300
+ correlationId: string;
3301
+ annotationId: string;
3302
+ response: components["schemas"]["AnnotationLLMContextResponse"];
3303
+ };
3304
+ /** @description Completion payload emitted on gather:finished SSE channel for resource-level context gathering. */
3305
+ GatherFinished: {
3306
+ correlationId: string;
3307
+ resourceId: string;
3308
+ response: components["schemas"]["ResourceLLMContextResponse"];
3309
+ };
3310
+ /** @description Progress state for mark (annotation) workflows. Supports both entity-type-step and percentage-based progress strategies. Emitted on mark:progress SSE channel. */
3311
+ MarkProgress: {
3312
+ /** @description Echoes the correlationId from the originating mark:assist-request command, if any. Lets clients match progress events back to the operation that initiated them. */
3313
+ correlationId?: string;
3314
+ /** @description Current status of the annotation workflow */
3315
+ status: string;
3316
+ /** @description Human-readable status message */
3317
+ message?: string;
3318
+ /** @description Resource being annotated */
3319
+ resourceId?: string;
3320
+ /** @description Reference annotation: currently scanning entity type */
3321
+ currentEntityType?: string;
3322
+ /** @description Reference annotation: completed entity types with counts */
3323
+ completedEntityTypes?: {
3324
+ entityType: string;
3325
+ foundCount: number;
3326
+ }[];
3327
+ /** @description Percentage-based motivations (highlight, assessment, comment, tag) */
3328
+ percentage?: number;
3329
+ /** @description Category-based motivations (tag): current category */
3330
+ currentCategory?: string;
3331
+ /** @description Category-based motivations (tag): number processed */
3332
+ processedCategories?: number;
3333
+ /** @description Category-based motivations (tag): total categories */
3334
+ totalCategories?: number;
3335
+ /** @description Request parameters for display in progress UI */
3336
+ requestParams?: {
3337
+ label: string;
3338
+ value: string;
3339
+ }[];
3340
+ };
3341
+ /** @description Completion payload emitted on mark:assist-finished SSE channel when AI-assisted annotation completes. */
3342
+ MarkAssistFinished: {
3343
+ /** @description Echoes the correlationId from the originating mark:assist-request command, if any. */
3344
+ correlationId?: string;
3345
+ motivation?: components["schemas"]["Motivation"];
3346
+ resourceId?: string;
3347
+ status?: string;
3348
+ percentage?: number;
3349
+ /** @description Number of annotations found/created */
3350
+ foundCount?: number;
3351
+ /** @description Number of annotations actually created */
3352
+ createdCount?: number;
3353
+ /** @description Counts by category (for tag annotations) */
3354
+ byCategory?: {
3355
+ [key: string]: number;
3356
+ };
3357
+ message?: string;
3358
+ progress?: components["schemas"]["MarkProgress"];
3359
+ };
3360
+ /** @description Error payload emitted on mark:assist-failed SSE channel when AI-assisted annotation fails. */
3361
+ MarkAssistFailed: {
3362
+ /** @description Echoes the correlationId from the originating mark:assist-request command, if any. */
3363
+ correlationId?: string;
3364
+ resourceId?: string;
3365
+ message?: string;
3366
+ };
3367
+ /** @description Search results payload emitted on match:search-results SSE channel. */
3368
+ MatchSearchResult: {
3369
+ correlationId: string;
3370
+ referenceId: string;
3371
+ response: (components["schemas"]["ResourceDescriptor"] & {
3372
+ /** @description Relevance score */
3373
+ score?: number;
3374
+ /** @description Human-readable reason for the match */
3375
+ matchReason?: string;
3376
+ })[];
3377
+ };
3378
+ /** @description Error payload emitted on match:search-failed SSE channel. */
3379
+ MatchSearchFailed: {
3380
+ correlationId: string;
3381
+ referenceId: string;
3382
+ error: string;
3383
+ };
3384
+ /** @description Progress state for resource yield (generation) workflow. Emitted as SSE events on yield:progress and yield:finished channels. */
3385
+ YieldProgress: {
3386
+ /** @description Echoes the correlationId from the originating yield:request command, if any. Lets clients match progress events back to the operation that initiated them. */
3387
+ correlationId?: string;
3388
+ /** @enum {string} */
3389
+ status: "started" | "fetching" | "generating" | "creating" | "complete" | "error";
3390
+ /** @description ID of the reference annotation that triggered generation */
3391
+ referenceId: string;
3392
+ /** @description Name of the resource being generated */
3393
+ resourceName?: string;
3394
+ /** @description ID of the generated resource (available after creation) */
3395
+ resourceId?: string;
3396
+ /** @description ID of the source resource containing the reference */
3397
+ sourceResourceId?: string;
3398
+ /** @description Progress percentage (0-100) */
3399
+ percentage: number;
3400
+ /** @description Human-readable status message */
3401
+ message?: string;
3402
+ };
3403
+ /** @description Error payload emitted on yield:failed SSE channel when resource generation fails. */
3404
+ YieldStreamError: {
3405
+ /** @description Echoes the correlationId from the originating yield:request command, if any. */
3406
+ correlationId?: string;
3407
+ /** @description Error message */
3408
+ error?: string;
3409
+ status?: string;
3410
+ referenceId?: string;
3411
+ percentage?: number;
3412
+ message?: string;
3413
+ };
3414
+ /** @description Metadata added at persistence time. Part of every StoredEvent. */
3415
+ EventMetadata: {
3416
+ /** @description Monotonic position in the event log (ordering authority) */
3417
+ sequenceNumber: number;
3418
+ /** @description Byte offset in the JSONL file */
3419
+ streamPosition: number;
3420
+ /** @description SHA-256 of the previous event (hash chain) */
3421
+ prevEventHash?: string;
3422
+ /** @description SHA-256 of this event (integrity verification) */
3423
+ checksum?: string;
3424
+ /** @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. */
3425
+ correlationId?: string;
3426
+ };
3427
+ /** @description Selection data for user-initiated annotations. Captures the text range and optional selector information from a user's highlight in the UI. */
3428
+ SelectionData: {
3429
+ /** @description The exact selected text */
3430
+ exact: string;
3431
+ /** @description Start character offset */
3432
+ start: number;
3433
+ /** @description End character offset */
3434
+ end: number;
3435
+ /** @description SVG selector for non-text selections (e.g. PDF regions) */
3436
+ svgSelector?: string;
3437
+ /** @description Fragment selector (e.g. page=2) */
3438
+ fragmentSelector?: string;
3439
+ /** @description Specification the fragment selector conforms to */
3440
+ conformsTo?: string;
3441
+ /** @description Text before the selection (for disambiguation) */
3442
+ prefix?: string;
3443
+ /** @description Text after the selection (for disambiguation) */
3444
+ suffix?: string;
3445
+ };
3446
+ /** @description A persisted domain event with metadata. Flat shape — event fields and metadata are peers. */
3447
+ StoredEventResponse: {
3448
+ /** @description Unique event ID (UUID) */
3449
+ id: string;
3450
+ /** @description Event type (flow verb name, e.g. mark:added) */
3451
+ type: string;
3452
+ /**
3453
+ * Format: date-time
3454
+ * @description When the event occurred
3455
+ */
3456
+ timestamp: string;
3457
+ /** @description DID of the user who triggered the event */
3458
+ userId: string;
3459
+ /** @description Resource this event affects (absent for system events) */
3460
+ resourceId?: string;
3461
+ /** @description Event schema version */
3462
+ version: number;
3463
+ /** @description Event-type-specific payload */
3464
+ payload: {
3465
+ [key: string]: unknown;
3466
+ };
3467
+ metadata: components["schemas"]["EventMetadata"];
3468
+ };
3469
+ /** @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. */
3470
+ EnrichedResourceEvent: components["schemas"]["StoredEventResponse"] & {
3471
+ /** @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. */
3472
+ annotation?: components["schemas"]["Annotation"];
3473
+ };
3474
+ /** @description Payload for yield:created domain event */
3475
+ ResourceCreatedPayload: {
3476
+ name: string;
3477
+ format: components["schemas"]["ContentFormat"];
3478
+ /** @description SHA-256 of content */
3479
+ contentChecksum: string;
3480
+ contentByteSize?: number;
3481
+ /** @enum {string} */
3482
+ creationMethod: "api" | "upload" | "ui" | "reference" | "cli" | "clone" | "generated";
3483
+ entityTypes?: string[];
3484
+ /** @description Working-tree URI (e.g. file://docs/overview.md) */
3485
+ storageUri?: string;
3486
+ language?: string;
3487
+ isDraft?: boolean;
3488
+ generatedFrom?: {
3489
+ resourceId: string;
3490
+ annotationId: string;
3491
+ };
3492
+ generationPrompt?: string;
3493
+ generator?: components["schemas"]["Agent"] | components["schemas"]["Agent"][];
3494
+ };
3495
+ /** @description Payload for yield:cloned domain event */
3496
+ ResourceClonedPayload: {
3497
+ name: string;
3498
+ format: components["schemas"]["ContentFormat"];
3499
+ contentChecksum: string;
3500
+ contentByteSize?: number;
3501
+ parentResourceId: string;
3502
+ /** @enum {string} */
3503
+ creationMethod: "api" | "upload" | "ui" | "reference" | "cli" | "clone" | "generated";
3504
+ entityTypes?: string[];
3505
+ language?: string;
3506
+ };
3507
+ /** @description Payload for yield:updated domain event */
3508
+ ResourceUpdatedPayload: {
3509
+ /** @description SHA-256 of new content */
3510
+ contentChecksum: string;
3511
+ contentByteSize?: number;
3512
+ };
3513
+ /** @description Payload for yield:moved domain event */
3514
+ ResourceMovedPayload: {
3515
+ /** @description Previous file:// URI */
3516
+ fromUri: string;
3517
+ /** @description New file:// URI */
3518
+ toUri: string;
3519
+ };
3520
+ /** @description Payload for mark:archived domain event */
3521
+ ResourceArchivedPayload: {
3522
+ reason?: string;
3523
+ };
3524
+ /** @description Payload for mark:unarchived domain event (empty payload) */
3525
+ ResourceUnarchivedPayload: Record<string, never>;
3526
+ /** @description Payload for yield:representation-added domain event */
3527
+ RepresentationAddedPayload: {
3528
+ representation: components["schemas"]["Representation"];
3529
+ };
3530
+ /** @description Payload for yield:representation-removed domain event */
3531
+ RepresentationRemovedPayload: {
3532
+ /** @description Checksum of the representation to remove */
3533
+ checksum: string;
3534
+ };
3535
+ /** @description Payload for mark:added domain event */
3536
+ AnnotationAddedPayload: {
3537
+ annotation: components["schemas"]["Annotation"];
3538
+ /** @description SHA-256 of resource content at annotation time */
3539
+ contentChecksum?: string;
3540
+ };
3541
+ /** @description Payload for mark:removed domain event */
3542
+ AnnotationRemovedPayload: {
3543
+ annotationId: string;
3544
+ };
3545
+ /** @description Payload for mark:body-updated domain event */
3546
+ AnnotationBodyUpdatedPayload: {
3547
+ annotationId: string;
3548
+ operations: (components["schemas"]["BodyOperationAdd"] | components["schemas"]["BodyOperationRemove"] | components["schemas"]["BodyOperationReplace"])[];
3549
+ };
3550
+ /** @description Payload for mark:entity-type-added domain event */
3551
+ EntityTypeAddedPayload: {
3552
+ entityType: string;
3553
+ };
3554
+ /** @description Payload for mark:entity-tag-added and mark:entity-tag-removed domain events */
3555
+ EntityTagChangedPayload: {
3556
+ entityType: string;
3557
+ };
3558
+ /**
3559
+ * @description Type of background job
3560
+ * @enum {string}
3561
+ */
3562
+ JobType: "reference-annotation" | "generation" | "highlight-annotation" | "assessment-annotation" | "comment-annotation" | "tag-annotation";
3563
+ /** @description Payload for job:started domain event */
3564
+ JobStartedPayload: {
3565
+ jobId: string;
3566
+ jobType: components["schemas"]["JobType"];
3567
+ totalSteps?: number;
3568
+ };
3569
+ /** @description Payload for job:progress domain event */
3570
+ JobProgressPayload: {
3571
+ jobId: string;
3572
+ jobType: components["schemas"]["JobType"];
3573
+ percentage: number;
3574
+ /** @description Human-readable current step */
3575
+ currentStep?: string;
3576
+ processedSteps?: number;
3577
+ totalSteps?: number;
3578
+ /** @description For detection: entities found so far */
3579
+ foundCount?: number;
3580
+ message?: string;
3581
+ /** @description Full progress object for extensibility */
3582
+ progress?: {
3583
+ [key: string]: unknown;
3584
+ };
3585
+ };
3586
+ /** @description Payload for job:completed domain event */
3587
+ JobCompletedPayload: {
3588
+ jobId: string;
3589
+ jobType: components["schemas"]["JobType"];
3590
+ totalSteps?: number;
3591
+ /** @description For detection: total entities found */
3592
+ foundCount?: number;
3593
+ /** @description For generation: ID of generated resource */
3594
+ resultResourceId?: string;
3595
+ /** @description For generation: URI of annotation that triggered generation */
3596
+ annotationUri?: string;
3597
+ message?: string;
3598
+ /** @description Full result object for extensibility */
3599
+ result?: {
3600
+ [key: string]: unknown;
3601
+ };
3602
+ };
3603
+ /** @description Payload for job:failed domain event */
3604
+ JobFailedPayload: {
3605
+ jobId: string;
3606
+ jobType: components["schemas"]["JobType"];
3607
+ error: string;
3608
+ details?: string;
3609
+ };
3610
+ /** @description Payload for embedding:computed domain event */
3611
+ EmbeddingComputedPayload: {
3612
+ annotationId?: string;
3613
+ chunkIndex: number;
3614
+ chunkText: string;
3615
+ embedding: number[];
3616
+ model: string;
3617
+ dimensions: number;
3618
+ };
3619
+ /** @description Payload for embedding:deleted domain event */
3620
+ EmbeddingDeletedPayload: {
3621
+ annotationId?: string;
3622
+ };
3345
3623
  AnnotateHighlightsStreamRequest: {
3346
3624
  /** @description Optional instructions to guide AI highlight annotation */
3347
3625
  instructions?: string;
@@ -3432,57 +3710,7 @@ interface components {
3432
3710
  storageUri: string;
3433
3711
  };
3434
3712
  GetAnnotationHistoryResponse: {
3435
- events: {
3436
- id: string;
3437
- type: string;
3438
- timestamp: string;
3439
- userId: string;
3440
- resourceId: string;
3441
- payload: {
3442
- name: string;
3443
- format: components["schemas"]["ContentFormat"];
3444
- contentChecksum: string;
3445
- /** @enum {string} */
3446
- creationMethod: "api" | "upload" | "ui" | "reference" | "clone" | "generated";
3447
- entityTypes?: string[];
3448
- metadata?: {
3449
- [key: string]: unknown;
3450
- };
3451
- } | {
3452
- name: string;
3453
- format: components["schemas"]["ContentFormat"];
3454
- contentChecksum: string;
3455
- parentResourceId: string;
3456
- /** @enum {string} */
3457
- creationMethod: "api" | "upload" | "ui" | "reference" | "clone" | "generated";
3458
- entityTypes?: string[];
3459
- metadata?: {
3460
- [key: string]: unknown;
3461
- };
3462
- } | {
3463
- reason?: string;
3464
- } | Record<string, never> | {
3465
- /** @description W3C Annotation (creator/created fields are optional in events - they're derived from event userId/timestamp) */
3466
- annotation: components["schemas"]["Annotation"];
3467
- } | {
3468
- /** @description Unified annotation ID */
3469
- annotationId: string;
3470
- } | {
3471
- /** @description Unified annotation ID */
3472
- annotationId: string;
3473
- /** @description For linking motivation */
3474
- targetResourceId: string;
3475
- } | {
3476
- entityType: string;
3477
- } | {
3478
- entityType: string;
3479
- };
3480
- metadata: {
3481
- sequenceNumber: number;
3482
- prevEventHash?: string;
3483
- checksum?: string;
3484
- };
3485
- }[];
3713
+ events: components["schemas"]["StoredEventResponse"][];
3486
3714
  total: number;
3487
3715
  annotationId: string;
3488
3716
  resourceId: string;
@@ -3503,21 +3731,7 @@ interface components {
3503
3731
  entityTypes: string[];
3504
3732
  };
3505
3733
  GetEventsResponse: {
3506
- events: {
3507
- event: {
3508
- id: string;
3509
- type: string;
3510
- timestamp: string;
3511
- userId: string;
3512
- resourceId: string;
3513
- payload?: unknown;
3514
- };
3515
- metadata: {
3516
- sequenceNumber: number;
3517
- prevEventHash?: string;
3518
- checksum?: string;
3519
- };
3520
- }[];
3734
+ events: components["schemas"]["StoredEventResponse"][];
3521
3735
  total: number;
3522
3736
  resourceId: string;
3523
3737
  };
@@ -3721,7 +3935,7 @@ interface components {
3721
3935
  * @description Application-specific: How this resource was created
3722
3936
  * @enum {string}
3723
3937
  */
3724
- creationMethod?: "api" | "upload" | "ui" | "reference" | "clone" | "generated";
3938
+ creationMethod?: "api" | "upload" | "ui" | "reference" | "cli" | "clone" | "generated";
3725
3939
  /** @description Application-specific: ID of annotation that triggered generation */
3726
3940
  sourceAnnotationId?: string;
3727
3941
  /** @description Application-specific: ID of source resource for clones/derivatives */
@@ -3799,6 +4013,8 @@ interface components {
3799
4013
  };
3800
4014
  message: string;
3801
4015
  authenticatedAs?: string;
4016
+ /** @description Name of the knowledge base project */
4017
+ projectName?: string;
3802
4018
  };
3803
4019
  TextPositionSelector: {
3804
4020
  /** @enum {string} */
@@ -3884,39 +4100,272 @@ interface components {
3884
4100
  /** @description The validated JWT token string for the current session */
3885
4101
  token: string;
3886
4102
  };
3887
- SvgSelector: {
3888
- /** @enum {string} */
3889
- type: "SvgSelector";
3890
- /** @description SVG markup defining the region (must include xmlns attribute) */
3891
- value: string;
4103
+ /** @description Emitted when an annotation receives focus for beckoning */
4104
+ BeckonFocusEvent: {
4105
+ annotationId?: string;
4106
+ resourceId?: string;
3892
4107
  };
3893
- /** @description W3C Web Annotation FragmentSelector for media fragment identifiers (RFC 3778 for PDFs) */
3894
- FragmentSelector: {
3895
- /** @enum {string} */
3896
- type: "FragmentSelector";
3897
- /**
3898
- * @description Media fragment identifier (e.g., 'page=1&viewrect=100,200,50,30' for PDF)
3899
- * @example page=1&viewrect=100,200,50,30
3900
- */
3901
- value: string;
3902
- /**
3903
- * @description URI identifying the fragment syntax specification
3904
- * @example http://tools.ietf.org/rfc/rfc3778
3905
- */
3906
- conformsTo?: string;
4108
+ /** @description Emitted when an annotation is hovered over for beckoning */
4109
+ BeckonHoverEvent: {
4110
+ annotationId: string | null;
3907
4111
  };
3908
- /**
3909
- * @description W3C Web Annotation body purpose vocabulary - https://www.w3.org/TR/annotation-vocab/#motivation
4112
+ /** @description Emitted when a sparkle effect is triggered on an annotation */
4113
+ BeckonSparkleEvent: {
4114
+ annotationId: string;
4115
+ };
4116
+ /** @description Event payload emitted on the bind:body-updated bus channel after annotation bodies are modified. */
4117
+ BindBodyUpdated: {
4118
+ /** @description Branded AnnotationId of the annotation whose body was updated */
4119
+ annotationId: string;
4120
+ };
4121
+ /** @description Command payload sent on the bind:initiate bus channel to start a bind flow. */
4122
+ BindInitiateCommand: {
4123
+ /** @description Branded AnnotationId of the annotation being bound */
4124
+ annotationId: string;
4125
+ /** @description Branded ResourceId of the resource being bound to */
4126
+ resourceId: string;
4127
+ /** @description Default title for the bound annotation */
4128
+ defaultTitle: string;
4129
+ /** @description Entity types to associate with the annotation */
4130
+ entityTypes: string[];
4131
+ };
4132
+ /** @description Command payload sent on the bind:update-body bus channel to modify annotation bodies. */
4133
+ BindUpdateBodyCommand: {
4134
+ /** @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. */
4135
+ correlationId: string;
4136
+ /** @description Branded AnnotationId of the annotation whose body is being updated */
4137
+ annotationId: string;
4138
+ /** @description Branded ResourceId of the resource the annotation belongs to */
4139
+ resourceId: string;
4140
+ /** @description Branded UserId of the user performing the update */
4141
+ userId?: string;
4142
+ /** @description List of body mutation operations to apply */
4143
+ operations: {
4144
+ /**
4145
+ * @description The type of body operation
4146
+ * @enum {string}
4147
+ */
4148
+ op: "add" | "remove" | "replace";
4149
+ /** @description Body item for add operations */
4150
+ item?: components["schemas"]["AnnotationBody"];
4151
+ /** @description Previous body item for replace operations */
4152
+ oldItem?: components["schemas"]["AnnotationBody"];
4153
+ /** @description Replacement body item for replace operations */
4154
+ newItem?: components["schemas"]["AnnotationBody"];
4155
+ }[];
4156
+ };
4157
+ /**
4158
+ * @description W3C Web Annotation body purpose vocabulary - https://www.w3.org/TR/annotation-vocab/#motivation
3910
4159
  * @enum {string}
3911
4160
  */
3912
4161
  BodyPurpose: "assessing" | "bookmarking" | "classifying" | "commenting" | "describing" | "editing" | "highlighting" | "identifying" | "linking" | "moderating" | "questioning" | "replying" | "tagging";
3913
- MediaTokenRequest: {
3914
- /** @description The resource ID to generate a media token for */
4162
+ /** @description Request to browse the history of an annotation */
4163
+ BrowseAnnotationHistoryRequest: {
4164
+ correlationId: string;
3915
4165
  resourceId: string;
4166
+ annotationId: string;
3916
4167
  };
3917
- MediaTokenResponse: {
3918
- /** @description Short-lived media token for use as ?token= query parameter on resource URLs */
3919
- token: string;
4168
+ /** @description Result of browsing annotation history */
4169
+ BrowseAnnotationHistoryResult: {
4170
+ correlationId: string;
4171
+ response: components["schemas"]["GetAnnotationHistoryResponse"];
4172
+ };
4173
+ /** @description Request to browse a single annotation */
4174
+ BrowseAnnotationRequest: {
4175
+ correlationId: string;
4176
+ resourceId: string;
4177
+ annotationId: string;
4178
+ };
4179
+ /** @description Result of browsing a single annotation */
4180
+ BrowseAnnotationResult: {
4181
+ correlationId: string;
4182
+ response: components["schemas"]["GetAnnotationResponse"];
4183
+ };
4184
+ /** @description Request to browse annotations for a resource */
4185
+ BrowseAnnotationsRequest: {
4186
+ correlationId: string;
4187
+ resourceId: string;
4188
+ };
4189
+ /** @description Result of browsing annotations for a resource */
4190
+ BrowseAnnotationsResult: {
4191
+ correlationId: string;
4192
+ response: components["schemas"]["GetAnnotationsResponse"];
4193
+ };
4194
+ /** @description Emitted when an annotation is clicked in the browse panel */
4195
+ BrowseClickEvent: {
4196
+ annotationId: string;
4197
+ motivation: components["schemas"]["Motivation"];
4198
+ };
4199
+ /** @description Request to browse a directory listing */
4200
+ BrowseDirectoryRequest: {
4201
+ correlationId: string;
4202
+ path: string;
4203
+ /** @enum {string} */
4204
+ sort?: "name" | "mtime" | "annotationCount";
4205
+ };
4206
+ /** @description Result of browsing a directory listing */
4207
+ BrowseDirectoryResult: {
4208
+ correlationId: string;
4209
+ response: {
4210
+ path: string;
4211
+ entries: components["schemas"]["DirectoryEntry"][];
4212
+ };
4213
+ };
4214
+ /** @description Emitted when an entity type is clicked in the browse panel */
4215
+ BrowseEntityTypeClickedEvent: {
4216
+ entityType: string;
4217
+ };
4218
+ /** @description Request to browse available entity types */
4219
+ BrowseEntityTypesRequest: {
4220
+ correlationId: string;
4221
+ };
4222
+ /** @description Result of browsing entity types */
4223
+ BrowseEntityTypesResult: {
4224
+ correlationId: string;
4225
+ response: components["schemas"]["GetEntityTypesResponse"];
4226
+ };
4227
+ /** @description Request to browse events for a resource */
4228
+ BrowseEventsRequest: {
4229
+ correlationId: string;
4230
+ resourceId: string;
4231
+ type?: string;
4232
+ userId?: string;
4233
+ limit?: number;
4234
+ };
4235
+ /** @description Result of browsing events for a resource */
4236
+ BrowseEventsResult: {
4237
+ correlationId: string;
4238
+ response: components["schemas"]["GetEventsResponse"];
4239
+ };
4240
+ /** @description Emitted when navigation to an external URL is requested */
4241
+ BrowseExternalNavigateEvent: {
4242
+ url: string;
4243
+ resourceId?: string;
4244
+ };
4245
+ /** @description Emitted when a link is clicked in the browse panel */
4246
+ BrowseLinkClickedEvent: {
4247
+ href: string;
4248
+ label?: string;
4249
+ };
4250
+ /** @description Emitted when a browse panel is opened */
4251
+ BrowsePanelOpenEvent: {
4252
+ panel: string;
4253
+ scrollToAnnotationId?: string;
4254
+ motivation?: string;
4255
+ };
4256
+ /** @description Emitted when a browse panel is toggled */
4257
+ BrowsePanelToggleEvent: {
4258
+ panel: string;
4259
+ };
4260
+ /** @description Request to browse annotations that reference a resource */
4261
+ BrowseReferencedByRequest: {
4262
+ correlationId: string;
4263
+ resourceId: string;
4264
+ motivation?: string;
4265
+ };
4266
+ /** @description Result of browsing annotations that reference a resource */
4267
+ BrowseReferencedByResult: {
4268
+ correlationId: string;
4269
+ response: components["schemas"]["GetReferencedByResponse"];
4270
+ };
4271
+ /** @description Emitted when navigation to a reference resource is requested */
4272
+ BrowseReferenceNavigateEvent: {
4273
+ resourceId: string;
4274
+ };
4275
+ /** @description Emitted when a resource is closed in the browse panel */
4276
+ BrowseResourceCloseEvent: {
4277
+ resourceId: string;
4278
+ };
4279
+ /** @description Emitted when resources are reordered in the browse panel */
4280
+ BrowseResourceReorderEvent: {
4281
+ oldIndex: number;
4282
+ newIndex: number;
4283
+ };
4284
+ /** @description Request to browse a single resource */
4285
+ BrowseResourceRequest: {
4286
+ correlationId: string;
4287
+ resourceId: string;
4288
+ };
4289
+ /** @description Result of browsing a single resource */
4290
+ BrowseResourceResult: {
4291
+ correlationId: string;
4292
+ response: components["schemas"]["GetResourceResponse"];
4293
+ };
4294
+ /** @description Request to browse resources with optional filtering and pagination */
4295
+ BrowseResourcesRequest: {
4296
+ correlationId: string;
4297
+ search?: string;
4298
+ archived?: boolean;
4299
+ entityType?: string;
4300
+ offset?: number;
4301
+ limit?: number;
4302
+ };
4303
+ /** @description Result of browsing resources */
4304
+ BrowseResourcesResult: {
4305
+ correlationId: string;
4306
+ response: components["schemas"]["ListResourcesResponse"];
4307
+ };
4308
+ /** @description Emitted when the browse panel requests a router navigation */
4309
+ BrowseRouterPushEvent: {
4310
+ path: string;
4311
+ reason?: string;
4312
+ };
4313
+ /** @description Command to store a computed embedding for a resource chunk */
4314
+ EmbeddingComputeCommand: {
4315
+ resourceId: string;
4316
+ annotationId?: string;
4317
+ chunkIndex: number;
4318
+ chunkText: string;
4319
+ embedding: number[];
4320
+ model: string;
4321
+ dimensions: number;
4322
+ };
4323
+ /** @description Command to delete embeddings for a resource or annotation */
4324
+ EmbeddingDeleteCommand: {
4325
+ resourceId: string;
4326
+ annotationId?: string;
4327
+ };
4328
+ /** @description W3C Web Annotation FragmentSelector for media fragment identifiers (RFC 3778 for PDFs) */
4329
+ FragmentSelector: {
4330
+ /** @enum {string} */
4331
+ type: "FragmentSelector";
4332
+ /**
4333
+ * @description Media fragment identifier (e.g., 'page=1&viewrect=100,200,50,30' for PDF)
4334
+ * @example page=1&viewrect=100,200,50,30
4335
+ */
4336
+ value: string;
4337
+ /**
4338
+ * @description URI identifying the fragment syntax specification
4339
+ * @example http://tools.ietf.org/rfc/rfc3778
4340
+ */
4341
+ conformsTo?: string;
4342
+ };
4343
+ /** @description Completion payload emitted on the gather:annotation-complete bus channel when annotation context gathering finishes. */
4344
+ GatherAnnotationComplete: {
4345
+ /** @description Client-generated correlation ID to thread the response back to the originating request */
4346
+ correlationId: string;
4347
+ /** @description Branded AnnotationId of the annotation whose context was gathered */
4348
+ annotationId: string;
4349
+ /** @description The gathered annotation context */
4350
+ response: components["schemas"]["AnnotationLLMContextResponse"];
4351
+ };
4352
+ /** @description Request payload sent on the gather:annotation-request bus channel to gather context for an annotation. */
4353
+ GatherAnnotationRequest: {
4354
+ /** @description Client-generated correlation ID to thread the response back to the originating request */
4355
+ correlationId: string;
4356
+ /** @description Branded AnnotationId of the annotation to gather context for */
4357
+ annotationId: string;
4358
+ /** @description Branded ResourceId of the resource the annotation belongs to */
4359
+ resourceId: string;
4360
+ /** @description Optional gathering configuration */
4361
+ options?: {
4362
+ /** @description Whether to include source context in the gathered result */
4363
+ includeSourceContext?: boolean;
4364
+ /** @description Whether to include target context in the gathered result */
4365
+ includeTargetContext?: boolean;
4366
+ /** @description Characters of surrounding text context to include */
4367
+ contextWindow?: number;
4368
+ };
3920
4369
  };
3921
4370
  /** @description Context gathered for an annotation. Includes source document excerpts, metadata, and graph-derived context. Used by both Find (bind) and Generate (yield) flows. */
3922
4371
  GatheredContext: {
@@ -3979,18 +4428,383 @@ interface components {
3979
4428
  similar: components["schemas"]["SemanticMatch"][];
3980
4429
  };
3981
4430
  };
3982
- MatchSearchStreamRequest: {
4431
+ /** @description Completion payload emitted on the gather:resource-complete bus channel when resource context gathering finishes. */
4432
+ GatherResourceComplete: {
3983
4433
  /** @description Client-generated correlation ID to thread the response back to the originating request */
4434
+ correlationId: string;
4435
+ /** @description Branded ResourceId of the resource whose context was gathered */
4436
+ resourceId: string;
4437
+ /** @description The gathered resource context */
4438
+ response: components["schemas"]["ResourceLLMContextResponse"];
4439
+ };
4440
+ /** @description Request payload sent on the gather:resource-request bus channel to gather context for a resource. */
4441
+ GatherResourceRequest: {
4442
+ /** @description Client-generated correlation ID to thread the response back to the originating request */
4443
+ correlationId: string;
4444
+ /** @description Branded ResourceId of the resource to gather context for */
4445
+ resourceId: string;
4446
+ /** @description Gathering configuration */
4447
+ options: {
4448
+ /** @description Depth of resource graph traversal */
4449
+ depth: number;
4450
+ /** @description Maximum number of related resources to include */
4451
+ maxResources: number;
4452
+ /** @description Whether to include resource content in the gathered result */
4453
+ includeContent: boolean;
4454
+ /** @description Whether to include resource summaries in the gathered result */
4455
+ includeSummary: boolean;
4456
+ };
4457
+ };
4458
+ /** @description Result of a completed assessment-annotation job. */
4459
+ JobAssessmentAnnotationResult: {
4460
+ assessmentsFound: number;
4461
+ assessmentsCreated: number;
4462
+ };
4463
+ /** @description Request to cancel a job */
4464
+ JobCancelRequest: {
4465
+ /** @enum {string} */
4466
+ jobType: "annotation" | "generation";
4467
+ };
4468
+ /** @description Result of a completed comment-annotation job. */
4469
+ JobCommentAnnotationResult: {
4470
+ commentsFound: number;
4471
+ commentsCreated: number;
4472
+ };
4473
+ /** @description Command to mark a job as complete */
4474
+ JobCompleteCommand: {
4475
+ resourceId: string;
4476
+ userId: string;
4477
+ jobId: string;
4478
+ jobType: components["schemas"]["JobType"];
4479
+ result?: components["schemas"]["JobResult"];
4480
+ };
4481
+ /** @description Command to mark a job as failed */
4482
+ JobFailCommand: {
4483
+ resourceId: string;
4484
+ userId: string;
4485
+ jobId: string;
4486
+ jobType: components["schemas"]["JobType"];
4487
+ error: string;
4488
+ };
4489
+ /** @description Result of a completed generation job. */
4490
+ JobGenerationResult: {
4491
+ /** @description ID of the generated resource */
4492
+ resourceId: string;
4493
+ /** @description Name of the generated resource */
4494
+ resourceName: string;
4495
+ };
4496
+ /** @description Result of a completed highlight-annotation job. */
4497
+ JobHighlightAnnotationResult: {
4498
+ highlightsFound: number;
4499
+ highlightsCreated: number;
4500
+ };
4501
+ /** @description Progress report from a running job. Common fields are stage/percentage/message; job-type-specific fields may also be present. */
4502
+ JobProgress: {
4503
+ /** @description Current processing stage */
4504
+ stage: string;
4505
+ /** @description Completion percentage (0-100) */
4506
+ percentage: number;
4507
+ /** @description Human-readable progress message */
4508
+ message: string;
4509
+ /** @description Total entity types to process (reference-annotation) */
4510
+ totalEntityTypes?: number;
4511
+ /** @description Entity types processed so far (reference-annotation) */
4512
+ processedEntityTypes?: number;
4513
+ /** @description Entities found so far (reference-annotation) */
4514
+ entitiesFound?: number;
4515
+ /** @description Annotations emitted so far (reference-annotation) */
4516
+ entitiesEmitted?: number;
4517
+ /** @description Entity type currently being processed */
4518
+ currentEntityType?: string;
4519
+ /** @description Categories processed (tag-annotation) */
4520
+ processedCategories?: number;
4521
+ /** @description Total categories (tag-annotation) */
4522
+ totalCategories?: number;
4523
+ /** @description Category currently being processed (tag-annotation) */
4524
+ currentCategory?: string;
4525
+ };
4526
+ /** @description Event indicating a job has been queued */
4527
+ JobQueuedEvent: {
4528
+ jobId: string;
4529
+ jobType: string;
4530
+ resourceId: string;
4531
+ };
4532
+ /** @description Result of a completed reference-annotation job. */
4533
+ JobReferenceAnnotationResult: {
4534
+ /** @description Total entities found */
4535
+ totalFound: number;
4536
+ /** @description Total annotations emitted */
4537
+ totalEmitted: number;
4538
+ /** @description Number of errors encountered */
4539
+ errors: number;
4540
+ };
4541
+ /** @description Command to report progress on a job */
4542
+ JobReportProgressCommand: {
4543
+ resourceId: string;
4544
+ userId: string;
4545
+ jobId: string;
4546
+ jobType: components["schemas"]["JobType"];
4547
+ percentage: number;
4548
+ progress?: components["schemas"]["JobProgress"];
4549
+ };
4550
+ /** @description Discriminated union of all job result types. */
4551
+ JobResult: components["schemas"]["JobGenerationResult"] | components["schemas"]["JobReferenceAnnotationResult"] | components["schemas"]["JobHighlightAnnotationResult"] | components["schemas"]["JobAssessmentAnnotationResult"] | components["schemas"]["JobCommentAnnotationResult"] | components["schemas"]["JobTagAnnotationResult"];
4552
+ /** @description Command to start a job */
4553
+ JobStartCommand: {
4554
+ resourceId: string;
4555
+ userId: string;
4556
+ jobId: string;
4557
+ jobType: components["schemas"]["JobType"];
4558
+ };
4559
+ /** @description Request to check the status of a job */
4560
+ JobStatusRequest: {
4561
+ correlationId: string;
4562
+ jobId: string;
4563
+ };
4564
+ /** @description Result of a job status request */
4565
+ JobStatusResult: {
4566
+ correlationId: string;
4567
+ response: components["schemas"]["JobStatusResponse"];
4568
+ };
4569
+ /** @description Result of a completed tag-annotation job. */
4570
+ JobTagAnnotationResult: {
4571
+ tagsFound: number;
4572
+ tagsCreated: number;
4573
+ /** @description Count of tags created per category */
4574
+ byCategory: {
4575
+ [key: string]: number;
4576
+ };
4577
+ };
4578
+ /** @description Bus command to add a new entity type tag. */
4579
+ MarkAddEntityTypeCommand: {
4580
+ tag: string;
4581
+ userId: string;
4582
+ };
4583
+ /** @description Bus command to archive a resource and optionally remove its file. */
4584
+ MarkArchiveCommand: {
4585
+ userId?: string;
4586
+ resourceId: string;
4587
+ storageUri?: string;
4588
+ keepFile?: boolean;
4589
+ noGit?: boolean;
4590
+ };
4591
+ /** @description Emitted when the user requests AI assistance for a mark */
4592
+ MarkAssistRequestEvent: {
4593
+ /** @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. */
4594
+ correlationId?: string;
4595
+ motivation: components["schemas"]["Motivation"];
4596
+ options: {
4597
+ instructions?: string;
4598
+ /** @enum {string} */
4599
+ tone?: "scholarly" | "explanatory" | "conversational" | "technical" | "analytical" | "critical" | "balanced" | "constructive";
4600
+ density?: number;
4601
+ language?: string;
4602
+ entityTypes?: string[];
4603
+ includeDescriptiveReferences?: boolean;
4604
+ schemaId?: string;
4605
+ categories?: string[];
4606
+ };
4607
+ };
4608
+ /** @description Emitted when the mark click action changes */
4609
+ MarkClickChangedEvent: {
4610
+ action: string;
4611
+ };
4612
+ /** @description Bus command to create an annotation on a resource. */
4613
+ MarkCreateCommand: {
4614
+ annotation: components["schemas"]["Annotation"];
4615
+ userId: string;
4616
+ resourceId: string;
4617
+ };
4618
+ /** @description Success response after creating an annotation. */
4619
+ MarkCreateOk: {
4620
+ annotationId: string;
4621
+ };
4622
+ /** @description Bus command to delete an annotation. */
4623
+ MarkDeleteCommand: {
4624
+ annotationId: string;
4625
+ userId?: string;
4626
+ resourceId?: string;
4627
+ };
4628
+ /** @description Success response after deleting an annotation. */
4629
+ MarkDeleteOk: {
4630
+ annotationId: string;
4631
+ };
4632
+ /** @description Emitted when the user requests a new mark (annotation) on a resource */
4633
+ MarkRequestedEvent: {
4634
+ /** @description One or more W3C selectors */
4635
+ selector: components["schemas"]["TextPositionSelector"] | components["schemas"]["TextQuoteSelector"] | components["schemas"]["SvgSelector"] | components["schemas"]["FragmentSelector"] | (components["schemas"]["TextPositionSelector"] | components["schemas"]["TextQuoteSelector"] | components["schemas"]["SvgSelector"] | components["schemas"]["FragmentSelector"])[];
4636
+ motivation: components["schemas"]["Motivation"];
4637
+ };
4638
+ /** @description Emitted when the active mark selection changes */
4639
+ MarkSelectionChangedEvent: {
4640
+ motivation: string | null;
4641
+ };
4642
+ /** @description Emitted when the mark shape changes */
4643
+ MarkShapeChangedEvent: {
4644
+ shape: string;
4645
+ };
4646
+ /** @description Emitted when a mark is submitted with its annotation body */
4647
+ MarkSubmitEvent: {
4648
+ motivation: components["schemas"]["Motivation"];
4649
+ /** @description One or more W3C selectors */
4650
+ selector: components["schemas"]["TextPositionSelector"] | components["schemas"]["TextQuoteSelector"] | components["schemas"]["SvgSelector"] | components["schemas"]["FragmentSelector"] | (components["schemas"]["TextPositionSelector"] | components["schemas"]["TextQuoteSelector"] | components["schemas"]["SvgSelector"] | components["schemas"]["FragmentSelector"])[];
4651
+ body: components["schemas"]["AnnotationBody"][];
4652
+ };
4653
+ /** @description Bus command to unarchive a previously archived resource. */
4654
+ MarkUnarchiveCommand: {
4655
+ userId?: string;
4656
+ resourceId: string;
4657
+ storageUri?: string;
4658
+ };
4659
+ /** @description Bus command to update an annotation's body with patch operations. */
4660
+ MarkUpdateBodyCommand: {
4661
+ /** @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. */
3984
4662
  correlationId?: string;
4663
+ annotationId: string;
4664
+ userId: string;
4665
+ resourceId: string;
4666
+ operations: (components["schemas"]["BodyOperationAdd"] | components["schemas"]["BodyOperationRemove"] | components["schemas"]["BodyOperationReplace"])[];
4667
+ };
4668
+ /** @description Bus command to replace the entity types on a resource. */
4669
+ MarkUpdateEntityTypesCommand: {
4670
+ resourceId: string;
4671
+ userId: string;
4672
+ currentEntityTypes: string[];
4673
+ updatedEntityTypes: string[];
4674
+ };
4675
+ /** @description Request payload sent on the match:search-request bus channel to find candidate matches. */
4676
+ MatchSearchRequest: {
4677
+ /** @description Client-generated correlation ID to thread the response back to the originating request */
4678
+ correlationId: string;
4679
+ /** @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. */
4680
+ resourceId: string;
3985
4681
  /** @description Annotation ID of the reference to search candidates for */
3986
4682
  referenceId: string;
3987
4683
  /** @description Gathered context for the reference annotation */
3988
4684
  context: components["schemas"]["GatheredContext"];
3989
- /** @description Maximum number of candidate results to return (default: 10) */
4685
+ /** @description Maximum number of candidate results to return */
3990
4686
  limit?: number;
3991
- /** @description Enable semantic similarity scoring in addition to keyword matching (default: true) */
4687
+ /** @description Enable semantic similarity scoring in addition to keyword matching */
3992
4688
  useSemanticScoring?: boolean;
3993
4689
  };
4690
+ MediaTokenRequest: {
4691
+ /** @description The resource ID to generate a media token for */
4692
+ resourceId: string;
4693
+ };
4694
+ MediaTokenResponse: {
4695
+ /** @description Short-lived media token for use as ?token= query parameter on resource URLs */
4696
+ token: string;
4697
+ };
4698
+ /** @description Emitted when the hover delay setting changes */
4699
+ SettingsHoverDelayChangedEvent: {
4700
+ hoverDelayMs: number;
4701
+ };
4702
+ /** @description Emitted when the UI locale setting changes */
4703
+ SettingsLocaleChangedEvent: {
4704
+ locale: string;
4705
+ };
4706
+ /** @description Emitted when the UI theme setting changes */
4707
+ SettingsThemeChangedEvent: {
4708
+ /** @enum {string} */
4709
+ theme: "light" | "dark" | "system";
4710
+ };
4711
+ SvgSelector: {
4712
+ /** @enum {string} */
4713
+ type: "SvgSelector";
4714
+ /** @description SVG markup defining the region (must include xmlns attribute) */
4715
+ value: string;
4716
+ };
4717
+ /** @description Bus command to create a cloned resource from a clone token. */
4718
+ YieldCloneCreateCommand: {
4719
+ correlationId: string;
4720
+ token: string;
4721
+ name: string;
4722
+ content: string;
4723
+ userId: string;
4724
+ archiveOriginal?: boolean;
4725
+ };
4726
+ /** @description Success response after creating a cloned resource. */
4727
+ YieldCloneCreated: {
4728
+ correlationId: string;
4729
+ response: {
4730
+ resourceId?: string;
4731
+ };
4732
+ };
4733
+ /** @description Bus command to request cloning a resource using a clone token. */
4734
+ YieldCloneResourceRequest: {
4735
+ correlationId: string;
4736
+ token: string;
4737
+ };
4738
+ /** @description Bus command to request a clone token for a resource. */
4739
+ YieldCloneTokenRequest: {
4740
+ correlationId: string;
4741
+ resourceId: string;
4742
+ };
4743
+ /** @description Bus command to create a yielded resource in the knowledge base. */
4744
+ YieldCreateCommand: {
4745
+ name: string;
4746
+ storageUri: string;
4747
+ contentChecksum: string;
4748
+ byteSize: number;
4749
+ format: components["schemas"]["ContentFormat"];
4750
+ userId: string;
4751
+ language?: string;
4752
+ entityTypes?: string[];
4753
+ creationMethod?: string;
4754
+ isDraft?: boolean;
4755
+ generatedFrom?: {
4756
+ resourceId?: string;
4757
+ annotationId?: string;
4758
+ };
4759
+ generationPrompt?: string;
4760
+ generator?: components["schemas"]["Agent"] | components["schemas"]["Agent"][];
4761
+ noGit?: boolean;
4762
+ };
4763
+ /** @description Success response after creating a yielded resource. */
4764
+ YieldCreateOk: {
4765
+ resourceId: string;
4766
+ resource: components["schemas"]["ResourceDescriptor"];
4767
+ };
4768
+ /** @description Success response after moving a yielded resource. */
4769
+ YieldMoveOk: {
4770
+ resourceId: string;
4771
+ };
4772
+ /** @description Bus command to move (rename) a yielded resource. */
4773
+ YieldMvCommand: {
4774
+ fromUri: string;
4775
+ toUri: string;
4776
+ userId: string;
4777
+ noGit?: boolean;
4778
+ };
4779
+ /** @description Bus command to request yield (generation) of a new resource from an annotation. */
4780
+ YieldRequestCommand: {
4781
+ /** @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. */
4782
+ correlationId?: string;
4783
+ annotationId: string;
4784
+ resourceId: string;
4785
+ options: {
4786
+ title: string;
4787
+ prompt?: string;
4788
+ language?: string;
4789
+ temperature?: number;
4790
+ maxTokens?: number;
4791
+ context?: components["schemas"]["GatheredContext"];
4792
+ storageUri: string;
4793
+ };
4794
+ };
4795
+ /** @description Bus command to update a yielded resource's storage content. */
4796
+ YieldUpdateCommand: {
4797
+ resourceId: string;
4798
+ storageUri: string;
4799
+ contentChecksum: string;
4800
+ byteSize: number;
4801
+ userId: string;
4802
+ noGit?: boolean;
4803
+ };
4804
+ /** @description Success response after updating a yielded resource. */
4805
+ YieldUpdateOk: {
4806
+ resourceId: string;
4807
+ };
3994
4808
  };
3995
4809
  responses: never;
3996
4810
  parameters: never;
@@ -4007,8 +4821,8 @@ type operations = Record<string, never>;
4007
4821
  * different string types at compile time.
4008
4822
  */
4009
4823
 
4010
- type Motivation$2 = components['schemas']['Motivation'];
4011
- type ContentFormat$1 = components['schemas']['ContentFormat'];
4824
+ type Motivation = components['schemas']['Motivation'];
4825
+ type ContentFormat = components['schemas']['ContentFormat'];
4012
4826
  type Email = string & {
4013
4827
  readonly __brand: 'Email';
4014
4828
  };
@@ -4081,6 +4895,7 @@ declare const CREATION_METHODS: {
4081
4895
  readonly UPLOAD: "upload";
4082
4896
  readonly UI: "ui";
4083
4897
  readonly REFERENCE: "reference";
4898
+ readonly CLI: "cli";
4084
4899
  readonly CLONE: "clone";
4085
4900
  readonly GENERATED: "generated";
4086
4901
  };
@@ -4118,13 +4933,13 @@ declare function userId(id: string): UserId;
4118
4933
  */
4119
4934
 
4120
4935
  type ResourceDescriptor = components['schemas']['ResourceDescriptor'];
4121
- type Annotation$5 = components['schemas']['Annotation'];
4936
+ type Annotation$4 = components['schemas']['Annotation'];
4122
4937
  /**
4123
4938
  * Represents a connection between resources through annotations
4124
4939
  */
4125
4940
  interface GraphConnection {
4126
4941
  targetResource: ResourceDescriptor;
4127
- annotations: Annotation$5[];
4942
+ annotations: Annotation$4[];
4128
4943
  relationshipType?: string;
4129
4944
  bidirectional: boolean;
4130
4945
  }
@@ -4133,7 +4948,7 @@ interface GraphConnection {
4133
4948
  */
4134
4949
  interface GraphPath {
4135
4950
  resources: ResourceDescriptor[];
4136
- annotations: Annotation$5[];
4951
+ annotations: Annotation$4[];
4137
4952
  }
4138
4953
  /**
4139
4954
  * Statistics about entity types in the graph
@@ -4144,282 +4959,125 @@ interface EntityTypeStats {
4144
4959
  }
4145
4960
 
4146
4961
  /**
4147
- * Resource Event Types
4962
+ * Persisted Events
4963
+ *
4964
+ * The 20 event types that get appended to the JSONL event log.
4965
+ * Each maps a type string to its OpenAPI payload schema.
4966
+ * The PersistedEvent union derives from this catalog.
4967
+ */
4968
+
4969
+ /**
4970
+ * Maps each persisted event type string to its OpenAPI payload schema.
4971
+ * Single source of truth for "what events get written to the log."
4972
+ */
4973
+ type PersistedEventCatalog = {
4974
+ 'yield:created': components['schemas']['ResourceCreatedPayload'];
4975
+ 'yield:cloned': components['schemas']['ResourceClonedPayload'];
4976
+ 'yield:updated': components['schemas']['ResourceUpdatedPayload'];
4977
+ 'yield:moved': components['schemas']['ResourceMovedPayload'];
4978
+ 'yield:representation-added': components['schemas']['RepresentationAddedPayload'];
4979
+ 'yield:representation-removed': components['schemas']['RepresentationRemovedPayload'];
4980
+ 'mark:added': components['schemas']['AnnotationAddedPayload'];
4981
+ 'mark:removed': components['schemas']['AnnotationRemovedPayload'];
4982
+ 'mark:body-updated': components['schemas']['AnnotationBodyUpdatedPayload'];
4983
+ 'mark:archived': components['schemas']['ResourceArchivedPayload'];
4984
+ 'mark:unarchived': components['schemas']['ResourceUnarchivedPayload'];
4985
+ 'mark:entity-tag-added': components['schemas']['EntityTagChangedPayload'];
4986
+ 'mark:entity-tag-removed': components['schemas']['EntityTagChangedPayload'];
4987
+ 'mark:entity-type-added': components['schemas']['EntityTypeAddedPayload'];
4988
+ 'job:started': components['schemas']['JobStartedPayload'];
4989
+ 'job:progress': components['schemas']['JobProgressPayload'];
4990
+ 'job:completed': components['schemas']['JobCompletedPayload'];
4991
+ 'job:failed': components['schemas']['JobFailedPayload'];
4992
+ 'embedding:computed': components['schemas']['EmbeddingComputedPayload'];
4993
+ 'embedding:deleted': components['schemas']['EmbeddingDeletedPayload'];
4994
+ };
4995
+ /** System event types — persisted events that have no resourceId. */
4996
+ type SystemEventType = 'mark:entity-type-added';
4997
+ /** Extract the concrete persisted event type for a given type string. */
4998
+ type EventOfType<K extends keyof PersistedEventCatalog> = K extends SystemEventType ? EventBase & {
4999
+ type: K;
5000
+ payload: PersistedEventCatalog[K];
5001
+ } : EventBase & {
5002
+ type: K;
5003
+ resourceId: ResourceId;
5004
+ payload: PersistedEventCatalog[K];
5005
+ };
5006
+ /** The union of all 20 persisted event types. Discriminated on `type`. */
5007
+ type PersistedEvent = {
5008
+ [K in keyof PersistedEventCatalog]: EventOfType<K>;
5009
+ }[keyof PersistedEventCatalog];
5010
+ type PersistedEventType = PersistedEvent['type'];
5011
+ /**
5012
+ * Runtime list of every persisted event type.
5013
+ *
5014
+ * Single source of truth for code that needs to enumerate event types at
5015
+ * runtime — most importantly the per-resource `events-stream` SSE route,
5016
+ * which subscribes to all of them. The exhaustiveness check below makes
5017
+ * it impossible to add a new member to `PersistedEventCatalog` without
5018
+ * also adding it here: forgetting fails to typecheck rather than silently
5019
+ * dropping the event from the events-stream.
5020
+ */
5021
+ declare const PERSISTED_EVENT_TYPES: readonly ["yield:created", "yield:cloned", "yield:updated", "yield:moved", "yield:representation-added", "yield:representation-removed", "mark:added", "mark:removed", "mark:body-updated", "mark:archived", "mark:unarchived", "mark:entity-tag-added", "mark:entity-tag-removed", "mark:entity-type-added", "job:started", "job:progress", "job:completed", "job:failed", "embedding:computed", "embedding:deleted"];
5022
+ /** Input type for appendEvent — PersistedEvent without id/timestamp (assigned at persistence time). */
5023
+ type EventInput = Omit<PersistedEvent, 'id' | 'timestamp'>;
5024
+
5025
+ /**
5026
+ * Event Base Types
4148
5027
  *
4149
- * Event-sourced architecture for resource state management
4150
- * Events are stored in an append-only log (JSONL format)
5028
+ * Core shapes for the event-sourced persistence model.
5029
+ * EventBase is the common shape for all domain events.
5030
+ * StoredEvent wraps an event with persistence metadata.
4151
5031
  *
4152
- * Federation-ready design:
4153
- * - resourceId uses content hashes (doc-sha256:...)
4154
- * - userId uses DID format (did:web:org.com:users:alice)
4155
- * - prevEventHash creates tamper-evident chains
4156
- * - Optional signatures for cross-org verification
5032
+ * These types are referenced by event-catalog.ts (domain events)
5033
+ * and bus-protocol.ts (the full EventMap).
4157
5034
  */
4158
5035
 
4159
- type Annotation$4 = components['schemas']['Annotation'];
4160
- type ContentFormat = components['schemas']['ContentFormat'];
4161
- type Motivation$1 = components['schemas']['Motivation'];
4162
- interface BaseEvent {
5036
+ /**
5037
+ * Narrow an OpenAPI-generated type by overriding specific fields with branded types.
5038
+ *
5039
+ * OpenAPI schemas use plain `string` for identifiers. TypeScript branded types
5040
+ * (ResourceId, AnnotationId, UserId, JobId) add compile-time safety. Brand<T, B>
5041
+ * takes the OpenAPI type T and replaces the fields listed in B with their branded
5042
+ * counterparts, preserving all other fields from the schema.
5043
+ *
5044
+ * @example
5045
+ * type MyCommand = Brand<components['schemas']['YieldCreateCommand'], { userId: UserId }>;
5046
+ * // Result: YieldCreateCommand with userId narrowed from string to UserId
5047
+ */
5048
+ type Brand<T, Overrides> = Omit<T, keyof Overrides> & Overrides;
5049
+ /** Fields common to ALL domain events (system and resource-scoped). */
5050
+ interface EventBase {
4163
5051
  id: string;
4164
5052
  timestamp: string;
4165
5053
  resourceId?: ResourceId;
4166
5054
  userId: UserId;
4167
5055
  version: number;
4168
5056
  }
4169
- interface ResourceCreatedEvent extends BaseEvent {
4170
- type: 'resource.created';
4171
- payload: {
4172
- name: string;
4173
- format: ContentFormat;
4174
- contentChecksum: string;
4175
- contentByteSize?: number;
4176
- creationMethod: CreationMethod;
4177
- entityTypes?: string[];
4178
- storageUri?: string;
4179
- language?: string;
4180
- isDraft?: boolean;
4181
- generatedFrom?: {
4182
- resourceId: string;
4183
- annotationId: string;
4184
- };
4185
- generationPrompt?: string;
4186
- generator?: components['schemas']['Agent'] | components['schemas']['Agent'][];
4187
- };
4188
- }
4189
- interface ResourceClonedEvent extends BaseEvent {
4190
- type: 'resource.cloned';
4191
- payload: {
4192
- name: string;
4193
- format: ContentFormat;
4194
- contentChecksum: string;
4195
- contentByteSize?: number;
4196
- parentResourceId: string;
4197
- creationMethod: CreationMethod;
4198
- entityTypes?: string[];
4199
- language?: string;
4200
- };
4201
- }
4202
- interface ResourceArchivedEvent extends BaseEvent {
4203
- type: 'resource.archived';
4204
- payload: {
4205
- reason?: string;
4206
- };
4207
- }
4208
- interface ResourceUnarchivedEvent extends BaseEvent {
4209
- type: 'resource.unarchived';
4210
- payload: Record<string, never>;
4211
- }
4212
- interface ResourceUpdatedEvent extends BaseEvent {
4213
- type: 'resource.updated';
4214
- resourceId: ResourceId;
4215
- payload: {
4216
- contentChecksum: string;
4217
- contentByteSize?: number;
4218
- };
4219
- }
4220
- interface ResourceMovedEvent extends BaseEvent {
4221
- type: 'resource.moved';
4222
- resourceId: ResourceId;
4223
- payload: {
4224
- fromUri: string;
4225
- toUri: string;
4226
- };
4227
- }
4228
- interface RepresentationAddedEvent extends BaseEvent {
4229
- type: 'representation.added';
4230
- resourceId: ResourceId;
4231
- payload: {
4232
- representation: {
4233
- '@id': string;
4234
- mediaType: string;
4235
- byteSize: number;
4236
- checksum: string;
4237
- created: string;
4238
- rel?: 'original' | 'thumbnail' | 'preview' | 'optimized' | 'derived' | 'other';
4239
- storageUri?: string;
4240
- filename?: string;
4241
- language?: string;
4242
- width?: number;
4243
- height?: number;
4244
- duration?: number;
4245
- };
4246
- };
4247
- }
4248
- interface RepresentationRemovedEvent extends BaseEvent {
4249
- type: 'representation.removed';
4250
- resourceId: ResourceId;
4251
- payload: {
4252
- checksum: string;
4253
- };
4254
- }
4255
- interface AnnotationAddedEvent extends BaseEvent {
4256
- type: 'annotation.added';
4257
- payload: {
4258
- annotation: Annotation$4;
4259
- contentChecksum?: string;
4260
- };
4261
- }
4262
- interface AnnotationRemovedEvent extends BaseEvent {
4263
- type: 'annotation.removed';
4264
- payload: {
4265
- annotationId: AnnotationId;
4266
- };
4267
- }
4268
- type BodyItem = {
4269
- type: 'TextualBody';
4270
- value: string;
4271
- purpose?: Motivation$1;
4272
- format?: string;
4273
- language?: string;
4274
- } | {
4275
- type: 'SpecificResource';
4276
- source: string;
4277
- purpose?: Motivation$1;
4278
- };
4279
- type BodyOperation = {
4280
- op: 'add';
4281
- item: BodyItem;
4282
- } | {
4283
- op: 'remove';
4284
- item: BodyItem;
4285
- } | {
4286
- op: 'replace';
4287
- oldItem: BodyItem;
4288
- newItem: BodyItem;
4289
- };
4290
- interface AnnotationBodyUpdatedEvent extends BaseEvent {
4291
- type: 'annotation.body.updated';
4292
- payload: {
4293
- annotationId: AnnotationId;
4294
- operations: BodyOperation[];
4295
- };
4296
- }
4297
- interface JobStartedEvent extends BaseEvent {
4298
- type: 'job.started';
4299
- resourceId: ResourceId;
4300
- payload: {
4301
- jobId: JobId;
4302
- jobType: 'reference-annotation' | 'generation' | 'highlight-annotation' | 'assessment-annotation' | 'comment-annotation' | 'tag-annotation';
4303
- totalSteps?: number;
4304
- };
4305
- }
4306
- interface JobProgressEvent extends BaseEvent {
4307
- type: 'job.progress';
4308
- resourceId: ResourceId;
4309
- payload: {
4310
- jobId: JobId;
4311
- jobType: 'reference-annotation' | 'generation' | 'highlight-annotation' | 'assessment-annotation' | 'comment-annotation' | 'tag-annotation';
4312
- percentage: number;
4313
- currentStep?: string;
4314
- processedSteps?: number;
4315
- totalSteps?: number;
4316
- foundCount?: number;
4317
- message?: string;
4318
- progress?: any;
4319
- };
4320
- }
4321
- interface JobCompletedEvent extends BaseEvent {
4322
- type: 'job.completed';
4323
- resourceId: ResourceId;
4324
- payload: {
4325
- jobId: JobId;
4326
- jobType: 'reference-annotation' | 'generation' | 'highlight-annotation' | 'assessment-annotation' | 'comment-annotation' | 'tag-annotation';
4327
- totalSteps?: number;
4328
- foundCount?: number;
4329
- resultResourceId?: ResourceId;
4330
- annotationUri?: AnnotationUri;
4331
- message?: string;
4332
- result?: any;
4333
- };
4334
- }
4335
- interface JobFailedEvent extends BaseEvent {
4336
- type: 'job.failed';
4337
- resourceId: ResourceId;
4338
- payload: {
4339
- jobId: JobId;
4340
- jobType: 'reference-annotation' | 'generation' | 'highlight-annotation' | 'assessment-annotation' | 'comment-annotation' | 'tag-annotation';
4341
- error: string;
4342
- details?: string;
4343
- };
4344
- }
4345
- interface EntityTagAddedEvent extends BaseEvent {
4346
- type: 'entitytag.added';
4347
- resourceId: ResourceId;
4348
- payload: {
4349
- entityType: string;
4350
- };
4351
- }
4352
- interface EntityTagRemovedEvent extends BaseEvent {
4353
- type: 'entitytag.removed';
4354
- resourceId: ResourceId;
4355
- payload: {
4356
- entityType: string;
4357
- };
4358
- }
4359
- interface EmbeddingComputedEvent extends BaseEvent {
4360
- type: 'embedding.computed';
4361
- resourceId: ResourceId;
4362
- payload: {
4363
- annotationId?: AnnotationId;
4364
- chunkIndex: number;
4365
- chunkText: string;
4366
- embedding: number[];
4367
- model: string;
4368
- dimensions: number;
4369
- };
4370
- }
4371
- interface EmbeddingDeletedEvent extends BaseEvent {
4372
- type: 'embedding.deleted';
4373
- resourceId: ResourceId;
4374
- payload: {
4375
- annotationId?: AnnotationId;
4376
- };
4377
- }
4378
- interface EntityTypeAddedEvent extends BaseEvent {
4379
- type: 'entitytype.added';
4380
- resourceId?: undefined;
4381
- payload: {
4382
- entityType: string;
4383
- };
4384
- }
4385
- type ResourceEvent = ResourceCreatedEvent | ResourceClonedEvent | ResourceUpdatedEvent | ResourceMovedEvent | ResourceArchivedEvent | ResourceUnarchivedEvent | RepresentationAddedEvent | RepresentationRemovedEvent | AnnotationAddedEvent | AnnotationRemovedEvent | AnnotationBodyUpdatedEvent | JobStartedEvent | JobProgressEvent | JobCompletedEvent | JobFailedEvent | EntityTagAddedEvent | EntityTagRemovedEvent | EntityTypeAddedEvent | EmbeddingComputedEvent | EmbeddingDeletedEvent;
4386
- type ResourceEventType = ResourceEvent['type'];
4387
- type SystemEvent = EntityTypeAddedEvent;
4388
- type ResourceScopedEvent = Exclude<ResourceEvent, SystemEvent>;
4389
- declare function isResourceEvent$1(event: any): event is ResourceEvent;
4390
- /**
4391
- * Type guard: Check if event is system-level (no resourceId)
4392
- * System events affect global state, not individual resources
4393
- */
4394
- declare function isSystemEvent(event: ResourceEvent): event is SystemEvent;
4395
- /**
4396
- * Type guard: Check if event is resource-scoped (has resourceId)
4397
- * Resource events affect a specific resource's state
4398
- */
4399
- declare function isResourceScopedEvent(event: ResourceEvent): event is ResourceScopedEvent;
4400
- declare function getEventType<T extends ResourceEvent>(event: ResourceEvent): T['type'];
4401
- interface EventMetadata {
4402
- sequenceNumber: number;
4403
- streamPosition: number;
4404
- timestamp: string;
4405
- prevEventHash?: string;
4406
- checksum?: string;
4407
- }
5057
+ /** Persistence metadata attached to every stored event. */
5058
+ type EventMetadata = components['schemas']['EventMetadata'];
5059
+ /** Optional cryptographic signature on a stored event. */
4408
5060
  interface EventSignature {
4409
5061
  algorithm: 'ed25519';
4410
5062
  publicKey: string;
4411
5063
  signature: string;
4412
5064
  keyId?: string;
4413
5065
  }
4414
- interface StoredEvent<T extends ResourceEvent = ResourceEvent> {
4415
- event: T;
5066
+ /**
5067
+ * A domain event with persistence metadata.
5068
+ * Flat intersection — no nesting (event.type, not event.event.type).
5069
+ */
5070
+ type StoredEvent<T extends EventBase = PersistedEvent> = T & {
4416
5071
  metadata: EventMetadata;
4417
5072
  signature?: EventSignature;
4418
- }
5073
+ };
5074
+ type BodyItem = components['schemas']['TextualBody'] | components['schemas']['SpecificResource'];
5075
+ type BodyOperation = components['schemas']['BodyOperationAdd'] | components['schemas']['BodyOperationRemove'] | components['schemas']['BodyOperationReplace'];
5076
+ type Annotation$3 = components['schemas']['Annotation'];
4419
5077
  interface EventQuery {
4420
5078
  resourceId?: ResourceId;
4421
5079
  userId?: string;
4422
- eventTypes?: ResourceEvent['type'][];
5080
+ eventTypes?: string[];
4423
5081
  fromTimestamp?: string;
4424
5082
  toTimestamp?: string;
4425
5083
  fromSequence?: number;
@@ -4427,768 +5085,302 @@ interface EventQuery {
4427
5085
  }
4428
5086
  interface ResourceAnnotations {
4429
5087
  resourceId: ResourceId;
4430
- annotations: Annotation$4[];
5088
+ annotations: Annotation$3[];
4431
5089
  version: number;
4432
5090
  updatedAt: string;
4433
5091
  }
4434
5092
 
4435
5093
  /**
4436
- * Event Type Guards and Extraction Utilities
5094
+ * Bus Protocol
4437
5095
  *
4438
- * Domain logic for working with resource events.
4439
- * No React dependencies - safe to use in any JavaScript environment.
4440
- */
4441
-
4442
- /**
4443
- * Minimal event shape accepted by event utility functions.
4444
- * Compatible with both the internal `StoredEvent` type and the OpenAPI-derived
4445
- * schema type (`GetEventsResponse['events'][number]`), which lacks `version`
4446
- * on the inner event.
4447
- */
4448
- interface StoredEventLike {
4449
- event: {
4450
- id: string;
4451
- type: string;
4452
- timestamp: string;
4453
- userId: string;
4454
- resourceId?: string;
4455
- payload?: unknown;
4456
- };
4457
- metadata: {
4458
- sequenceNumber: number;
4459
- prevEventHash?: string;
4460
- checksum?: string;
4461
- };
4462
- }
4463
- /**
4464
- * Extract annotation ID from event payload
4465
- * Returns null if event is not annotation-related
5096
+ * The complete EventMap for the RxJS EventBus. Every channel name and
5097
+ * its payload type is defined here domain events, commands, reads,
5098
+ * results, SSE stream payloads, and frontend UI events.
4466
5099
  *
4467
- * For annotation.added: extracts full URI from payload.annotation.id
4468
- * For annotation.removed/body.updated: constructs full URI from payload.annotationId (UUID) + resourceId
4469
- */
4470
- declare function getAnnotationUriFromEvent(event: StoredEventLike): AnnotationUri | null;
4471
- /**
4472
- * Check if an event is related to a specific annotation
4473
- */
4474
- declare function isEventRelatedToAnnotation(event: StoredEventLike, annotationUri: AnnotationUri): boolean;
4475
- /**
4476
- * Type guard to check if event is a resource event
4477
- */
4478
- declare function isResourceEvent(event: any): event is StoredEvent;
4479
-
4480
- /**
4481
- * Event Protocol Types
5100
+ * Command and result payloads use OpenAPI-generated types (plain strings
5101
+ * for identifiers). Branded type safety (ResourceId, UserId, etc.) is
5102
+ * enforced at function boundaries, not on bus payloads — callers use
5103
+ * factory functions (resourceId(), userId()) at the consume boundary.
4482
5104
  *
4483
- * Type definitions for the application's event-driven architecture.
4484
- * Single source of truth for all EventBus event types.
5105
+ * Domain events (StoredEvent<Interface>) retain branded types as they
5106
+ * are the system of record, not wire-format payloads.
5107
+ *
5108
+ * Organized by flow (verb), then by category within each flow.
4485
5109
  */
4486
5110
 
4487
5111
  type Selector = components['schemas']['TextPositionSelector'] | components['schemas']['TextQuoteSelector'] | components['schemas']['SvgSelector'] | components['schemas']['FragmentSelector'];
4488
5112
  type GatheredContext = components['schemas']['GatheredContext'];
4489
- type Annotation$3 = components['schemas']['Annotation'];
4490
- type Motivation = components['schemas']['Motivation'];
4491
- /**
4492
- * Progress state for resource yield workflow
4493
- */
4494
- interface YieldProgress {
4495
- status: 'started' | 'fetching' | 'generating' | 'creating' | 'complete' | 'error';
4496
- referenceId: string;
4497
- resourceName?: string;
4498
- resourceId?: string;
4499
- sourceResourceId?: string;
4500
- percentage: number;
4501
- message?: string;
4502
- }
4503
- /**
4504
- * Selection data for user-initiated annotations
4505
- */
4506
- interface SelectionData {
4507
- exact: string;
4508
- start: number;
4509
- end: number;
4510
- svgSelector?: string;
4511
- fragmentSelector?: string;
4512
- conformsTo?: string;
4513
- prefix?: string;
4514
- suffix?: string;
4515
- }
4516
- /**
4517
- * Progress state for mark workflows (manual and assisted)
4518
- *
4519
- * Unified progress interface supporting different annotation strategies:
4520
- * - Reference annotation: entity-type steps
4521
- * - Other motivations: percentage-based progress
4522
- */
4523
- interface MarkProgress {
4524
- status: string;
4525
- message?: string;
4526
- /** Reference annotation: currently scanning entity type */
4527
- currentEntityType?: string;
4528
- /** Reference annotation: completed entity types with counts (frontend-only) */
4529
- completedEntityTypes?: Array<{
4530
- entityType: string;
4531
- foundCount: number;
4532
- }>;
4533
- /** Percentage-based motivations (highlight, assessment, comment, tag) */
4534
- percentage?: number;
4535
- /** Category-based motivations (tag) */
4536
- currentCategory?: string;
4537
- processedCategories?: number;
4538
- totalCategories?: number;
4539
- /** Request parameters for display in progress UI (frontend-only, added by annotation-registry) */
4540
- requestParams?: Array<{
4541
- label: string;
4542
- value: string;
4543
- }>;
4544
- }
5113
+ type YieldProgress = components['schemas']['YieldProgress'];
5114
+ type MarkProgress = components['schemas']['MarkProgress'];
5115
+ type SelectionData = components['schemas']['SelectionData'];
4545
5116
  /**
4546
- * Unified event map for all application events
4547
- *
4548
- * Organized by workflow ("flows") and actor sections:
4549
- * 1. Yield Flow - Resource generation from references
4550
- * 2. Mark Flow - Manual + AI-assisted annotation (all motivations)
4551
- * 3. Bind Flow - Reference linking/resolution (search modal)
4552
- * 4. Matcher Flow - Candidate search for bind/link operations
4553
- * 5. Gather Flow - LLM context fetching from annotations
4554
- * 6. Browse Flow - Panel, sidebar, and application routing
4555
- * 7. Beckon Flow - Annotation hover/focus/sparkle coordination
5117
+ * The unified EventMap every channel on the EventBus.
4556
5118
  *
4557
- * Plus infrastructure events (domain events, SSE, resource operations, settings)
5119
+ * Convention:
5120
+ * - Domain events (past tense): StoredEvent<Interface> — branded types
5121
+ * - Commands/reads/results/UI: OpenAPI schema refs — plain strings
5122
+ * - void: UI-only signals with no payload
4558
5123
  */
4559
5124
  type EventMap = {
4560
- 'make-meaning:event': ResourceEvent;
4561
- 'yield:request': {
4562
- annotationId: AnnotationId;
4563
- resourceId: ResourceId;
4564
- options: {
4565
- title: string;
4566
- prompt?: string;
4567
- language?: string;
4568
- temperature?: number;
4569
- maxTokens?: number;
4570
- context: GatheredContext;
4571
- storageUri: string;
4572
- };
4573
- };
4574
- 'yield:progress': YieldProgress;
4575
- 'yield:finished': YieldProgress;
4576
- 'yield:failed': {
4577
- error?: Error | string;
4578
- status?: string;
4579
- referenceId?: string;
4580
- percentage?: number;
4581
- message?: string;
4582
- };
4583
- 'yield:representation-added': Extract<ResourceEvent, {
4584
- type: 'representation.added';
4585
- }>;
4586
- 'yield:representation-removed': Extract<ResourceEvent, {
4587
- type: 'representation.removed';
4588
- }>;
4589
- 'yield:create': {
4590
- name: string;
4591
- content?: Buffer;
4592
- storageUri?: string;
4593
- contentChecksum?: string;
4594
- format: components['schemas']['ContentFormat'];
4595
- userId: UserId;
4596
- language?: string;
4597
- entityTypes?: string[];
4598
- creationMethod?: CreationMethod;
4599
- isDraft?: boolean;
4600
- generatedFrom?: {
4601
- resourceId: string;
4602
- annotationId: string;
4603
- };
4604
- generationPrompt?: string;
4605
- generator?: components['schemas']['Agent'] | components['schemas']['Agent'][];
4606
- noGit?: boolean;
4607
- };
4608
- 'yield:created': {
4609
- resourceId: ResourceId;
4610
- resource: components['schemas']['ResourceDescriptor'];
4611
- };
4612
- 'yield:create-failed': {
4613
- error: Error;
4614
- };
4615
- 'yield:update': {
4616
- resourceId: ResourceId;
4617
- storageUri: string;
4618
- content?: Buffer;
4619
- contentChecksum: string;
4620
- userId: UserId;
4621
- noGit?: boolean;
4622
- };
4623
- 'yield:updated': {
4624
- resourceId: ResourceId;
4625
- };
4626
- 'yield:update-failed': {
4627
- resourceId: ResourceId;
4628
- error: Error;
4629
- };
4630
- 'yield:mv': {
4631
- fromUri: string;
4632
- toUri: string;
4633
- userId: UserId;
4634
- noGit?: boolean;
4635
- };
4636
- 'yield:moved': {
4637
- resourceId: ResourceId;
4638
- };
5125
+ 'yield:created': StoredEvent<EventOfType<'yield:created'>>;
5126
+ 'yield:cloned': StoredEvent<EventOfType<'yield:cloned'>>;
5127
+ 'yield:updated': StoredEvent<EventOfType<'yield:updated'>>;
5128
+ 'yield:moved': StoredEvent<EventOfType<'yield:moved'>>;
5129
+ 'yield:representation-added': StoredEvent<EventOfType<'yield:representation-added'>>;
5130
+ 'yield:representation-removed': StoredEvent<EventOfType<'yield:representation-removed'>>;
5131
+ 'yield:progress': components['schemas']['YieldProgress'];
5132
+ 'yield:finished': components['schemas']['YieldProgress'];
5133
+ 'yield:failed': components['schemas']['YieldStreamError'];
5134
+ 'yield:request': components['schemas']['YieldRequestCommand'];
5135
+ 'yield:create': components['schemas']['YieldCreateCommand'];
5136
+ 'yield:update': components['schemas']['YieldUpdateCommand'];
5137
+ 'yield:mv': components['schemas']['YieldMvCommand'];
5138
+ 'yield:clone': void;
5139
+ 'yield:clone-token-requested': components['schemas']['YieldCloneTokenRequest'];
5140
+ 'yield:clone-resource-requested': components['schemas']['YieldCloneResourceRequest'];
5141
+ 'yield:clone-create': components['schemas']['YieldCloneCreateCommand'];
5142
+ 'yield:create-ok': components['schemas']['YieldCreateOk'];
5143
+ 'yield:create-failed': components['schemas']['CommandError'];
5144
+ 'yield:update-ok': components['schemas']['YieldUpdateOk'];
5145
+ 'yield:update-failed': components['schemas']['YieldUpdateOk'] & components['schemas']['CommandError'];
5146
+ 'yield:move-ok': components['schemas']['YieldMoveOk'];
4639
5147
  'yield:move-failed': {
4640
5148
  fromUri: string;
4641
- error: Error;
4642
- };
4643
- 'yield:clone': void;
4644
- 'yield:clone-token-requested': {
4645
- correlationId: string;
4646
- resourceId: ResourceId;
4647
- };
5149
+ } & components['schemas']['CommandError'];
4648
5150
  'yield:clone-token-generated': {
4649
5151
  correlationId: string;
4650
5152
  response: components['schemas']['CloneResourceWithTokenResponse'];
4651
5153
  };
4652
5154
  'yield:clone-token-failed': {
4653
5155
  correlationId: string;
4654
- error: Error;
4655
- };
4656
- 'yield:clone-resource-requested': {
4657
- correlationId: string;
4658
- token: string;
4659
- };
5156
+ } & components['schemas']['CommandError'];
4660
5157
  'yield:clone-resource-result': {
4661
5158
  correlationId: string;
4662
5159
  response: components['schemas']['GetResourceByTokenResponse'];
4663
5160
  };
4664
5161
  'yield:clone-resource-failed': {
4665
5162
  correlationId: string;
4666
- error: Error;
4667
- };
4668
- 'yield:clone-create': {
4669
- correlationId: string;
4670
- token: string;
4671
- name: string;
4672
- content: string;
4673
- userId: UserId;
4674
- archiveOriginal?: boolean;
4675
- };
4676
- 'yield:clone-created': {
4677
- correlationId: string;
4678
- response: {
4679
- resourceId: ResourceId;
4680
- };
4681
- };
5163
+ } & components['schemas']['CommandError'];
5164
+ 'yield:clone-created': components['schemas']['YieldCloneCreated'];
4682
5165
  'yield:clone-create-failed': {
4683
5166
  correlationId: string;
4684
- error: Error;
4685
- };
4686
- 'mark:select-comment': SelectionData;
4687
- 'mark:select-tag': SelectionData;
4688
- 'mark:select-assessment': SelectionData;
4689
- 'mark:select-reference': SelectionData;
4690
- 'mark:requested': {
4691
- selector: Selector | Selector[];
4692
- motivation: Motivation;
4693
- };
5167
+ } & components['schemas']['CommandError'];
5168
+ 'mark:added': StoredEvent<EventOfType<'mark:added'>>;
5169
+ 'mark:removed': StoredEvent<EventOfType<'mark:removed'>>;
5170
+ 'mark:body-updated': StoredEvent<EventOfType<'mark:body-updated'>>;
5171
+ 'mark:entity-tag-added': StoredEvent<EventOfType<'mark:entity-tag-added'>>;
5172
+ 'mark:entity-tag-removed': StoredEvent<EventOfType<'mark:entity-tag-removed'>>;
5173
+ 'mark:entity-type-added': StoredEvent<EventOfType<'mark:entity-type-added'>>;
5174
+ 'mark:archived': StoredEvent<EventOfType<'mark:archived'>>;
5175
+ 'mark:unarchived': StoredEvent<EventOfType<'mark:unarchived'>>;
5176
+ 'mark:progress': components['schemas']['MarkProgress'];
5177
+ 'mark:assist-finished': components['schemas']['MarkAssistFinished'];
5178
+ 'mark:assist-failed': components['schemas']['MarkAssistFailed'];
5179
+ 'mark:create': components['schemas']['MarkCreateCommand'];
5180
+ 'mark:delete': components['schemas']['MarkDeleteCommand'];
5181
+ 'mark:update-body': components['schemas']['MarkUpdateBodyCommand'];
5182
+ 'mark:archive': components['schemas']['MarkArchiveCommand'];
5183
+ 'mark:unarchive': components['schemas']['MarkUnarchiveCommand'];
5184
+ 'mark:update-entity-types': components['schemas']['MarkUpdateEntityTypesCommand'];
5185
+ 'mark:add-entity-type': components['schemas']['MarkAddEntityTypeCommand'];
5186
+ 'mark:create-ok': components['schemas']['MarkCreateOk'];
5187
+ 'mark:create-failed': components['schemas']['CommandError'];
5188
+ 'mark:delete-ok': components['schemas']['MarkDeleteOk'];
5189
+ 'mark:delete-failed': components['schemas']['CommandError'];
5190
+ 'mark:body-update-failed': components['schemas']['CommandError'];
5191
+ 'mark:entity-type-add-failed': components['schemas']['CommandError'];
5192
+ 'mark:select-comment': components['schemas']['SelectionData'];
5193
+ 'mark:select-tag': components['schemas']['SelectionData'];
5194
+ 'mark:select-assessment': components['schemas']['SelectionData'];
5195
+ 'mark:select-reference': components['schemas']['SelectionData'];
5196
+ 'mark:requested': components['schemas']['MarkRequestedEvent'];
4694
5197
  'mark:cancel-pending': void;
4695
- 'mark:submit': {
4696
- motivation: Motivation;
4697
- selector: Selector | Selector[];
4698
- body: components['schemas']['AnnotationBody'][];
4699
- };
4700
- 'mark:create': {
4701
- annotation: Annotation$3;
4702
- userId: UserId;
4703
- resourceId: ResourceId;
4704
- };
4705
- 'mark:created': {
4706
- annotationId: AnnotationId;
4707
- };
4708
- 'mark:create-failed': {
4709
- error: Error;
4710
- };
4711
- 'mark:delete': {
4712
- annotationId: AnnotationId;
4713
- userId?: UserId;
4714
- resourceId?: ResourceId;
4715
- };
4716
- 'mark:deleted': {
4717
- annotationId: AnnotationId;
4718
- };
4719
- 'mark:delete-failed': {
4720
- error: Error;
4721
- };
4722
- 'mark:update-body': {
4723
- annotationId: AnnotationId;
4724
- userId: UserId;
4725
- resourceId: ResourceId;
4726
- operations: BodyOperation[];
4727
- };
4728
- 'mark:body-update-failed': {
4729
- error: Error;
4730
- };
4731
- 'mark:assist-request': {
4732
- motivation: Motivation;
4733
- options: {
4734
- instructions?: string;
4735
- tone?: 'scholarly' | 'explanatory' | 'conversational' | 'technical' | 'analytical' | 'critical' | 'balanced' | 'constructive';
4736
- density?: number;
4737
- language?: string;
4738
- entityTypes?: string[];
4739
- includeDescriptiveReferences?: boolean;
4740
- schemaId?: string;
4741
- categories?: string[];
4742
- };
4743
- };
4744
- 'mark:progress': MarkProgress & {
4745
- resourceId?: ResourceId;
4746
- };
4747
- 'mark:assist-finished': {
4748
- motivation?: Motivation;
4749
- resourceId?: ResourceId;
4750
- status?: string;
4751
- percentage?: number;
4752
- foundCount?: number;
4753
- createdCount?: number;
4754
- byCategory?: Record<string, number>;
4755
- message?: string;
4756
- progress?: MarkProgress;
4757
- };
4758
- 'mark:assist-failed': {
4759
- resourceId?: ResourceId;
4760
- message?: string;
4761
- };
5198
+ 'mark:submit': components['schemas']['MarkSubmitEvent'];
5199
+ 'mark:assist-request': components['schemas']['MarkAssistRequestEvent'];
4762
5200
  'mark:assist-cancelled': void;
4763
5201
  'mark:progress-dismiss': void;
4764
5202
  'mark:mode-toggled': void;
4765
- 'mark:selection-changed': {
4766
- motivation: string | null;
4767
- };
4768
- 'mark:click-changed': {
4769
- action: string;
4770
- };
4771
- 'mark:shape-changed': {
4772
- shape: string;
4773
- };
4774
- 'mark:added': Extract<ResourceEvent, {
4775
- type: 'annotation.added';
4776
- }>;
4777
- 'mark:removed': Extract<ResourceEvent, {
4778
- type: 'annotation.removed';
4779
- }>;
4780
- 'mark:body-updated': Extract<ResourceEvent, {
4781
- type: 'annotation.body.updated';
4782
- }>;
4783
- 'mark:entity-tag-added': Extract<ResourceEvent, {
4784
- type: 'entitytag.added';
4785
- }>;
4786
- 'mark:entity-tag-removed': Extract<ResourceEvent, {
4787
- type: 'entitytag.removed';
4788
- }>;
4789
- 'mark:update-entity-types': {
4790
- resourceId: ResourceId;
4791
- userId: UserId;
4792
- currentEntityTypes: string[];
4793
- updatedEntityTypes: string[];
4794
- };
4795
- 'mark:add-entity-type': {
4796
- tag: string;
4797
- userId: UserId;
4798
- };
4799
- 'mark:entity-type-added': {
4800
- tag: string;
4801
- };
4802
- 'mark:entity-type-add-failed': {
4803
- error: Error;
4804
- };
4805
- 'mark:archive': void | {
4806
- userId: UserId;
4807
- resourceId?: ResourceId;
4808
- storageUri?: string;
4809
- keepFile?: boolean;
4810
- noGit?: boolean;
4811
- };
4812
- 'mark:archived': Extract<ResourceEvent, {
4813
- type: 'resource.archived';
4814
- }>;
4815
- 'mark:unarchive': void | {
4816
- userId: UserId;
4817
- resourceId?: ResourceId;
4818
- storageUri?: string;
4819
- };
4820
- 'mark:unarchived': Extract<ResourceEvent, {
4821
- type: 'resource.unarchived';
4822
- }>;
4823
- 'bind:initiate': {
4824
- annotationId: AnnotationId;
4825
- resourceId: ResourceId;
4826
- defaultTitle: string;
4827
- entityTypes: string[];
4828
- };
4829
- 'bind:update-body': {
4830
- annotationId: AnnotationId;
4831
- resourceId: ResourceId;
4832
- userId?: UserId;
4833
- operations: Array<{
4834
- op: 'add' | 'remove' | 'replace';
4835
- item?: components['schemas']['AnnotationBody'];
4836
- oldItem?: components['schemas']['AnnotationBody'];
4837
- newItem?: components['schemas']['AnnotationBody'];
4838
- }>;
4839
- };
4840
- 'bind:body-updated': {
4841
- annotationId: AnnotationId;
4842
- };
4843
- 'bind:body-update-failed': {
4844
- error: Error;
4845
- };
4846
- 'bind:finished': {
4847
- annotationId: AnnotationId;
4848
- };
4849
- 'bind:failed': {
4850
- error: Error;
4851
- };
4852
- 'match:search-requested': {
4853
- correlationId: string;
4854
- referenceId: string;
4855
- context: GatheredContext;
4856
- limit?: number;
4857
- useSemanticScoring?: boolean;
4858
- };
4859
- 'match:search-results': {
4860
- correlationId: string;
4861
- referenceId: string;
4862
- response: Array<components['schemas']['ResourceDescriptor'] & {
4863
- score?: number;
4864
- matchReason?: string;
4865
- }>;
4866
- };
4867
- 'match:search-failed': {
4868
- correlationId: string;
4869
- referenceId: string;
4870
- error: string;
4871
- };
4872
- 'gather:requested': {
4873
- correlationId: string;
4874
- annotationId: AnnotationId;
4875
- resourceId: ResourceId;
4876
- options?: {
4877
- includeSourceContext?: boolean;
4878
- includeTargetContext?: boolean;
4879
- contextWindow?: number;
4880
- };
4881
- };
4882
- 'gather:complete': {
4883
- correlationId: string;
4884
- annotationId: AnnotationId;
4885
- response: components['schemas']['AnnotationLLMContextResponse'];
4886
- };
5203
+ 'mark:selection-changed': components['schemas']['MarkSelectionChangedEvent'];
5204
+ 'mark:click-changed': components['schemas']['MarkClickChangedEvent'];
5205
+ 'mark:shape-changed': components['schemas']['MarkShapeChangedEvent'];
5206
+ 'bind:initiate': components['schemas']['BindInitiateCommand'];
5207
+ 'bind:update-body': components['schemas']['BindUpdateBodyCommand'];
5208
+ 'bind:body-updated': components['schemas']['BindBodyUpdated'];
5209
+ 'bind:body-update-failed': components['schemas']['CommandError'];
5210
+ 'match:search-requested': components['schemas']['MatchSearchRequest'];
5211
+ 'match:search-results': components['schemas']['MatchSearchResult'];
5212
+ 'match:search-failed': components['schemas']['MatchSearchFailed'];
5213
+ 'gather:requested': components['schemas']['GatherAnnotationRequest'];
5214
+ 'gather:complete': components['schemas']['GatherAnnotationComplete'];
4887
5215
  'gather:failed': {
4888
5216
  correlationId: string;
4889
- annotationId: AnnotationId;
4890
- error: Error;
4891
- };
4892
- 'gather:annotation-progress': {
4893
- message?: string;
4894
- percentage?: number;
4895
- };
4896
- 'gather:annotation-finished': {
4897
- correlationId: string;
4898
- annotationId: AnnotationId;
4899
- response: components['schemas']['AnnotationLLMContextResponse'];
4900
- };
4901
- 'gather:resource-requested': {
4902
- correlationId: string;
4903
- resourceId: ResourceId;
4904
- options: {
4905
- depth: number;
4906
- maxResources: number;
4907
- includeContent: boolean;
4908
- includeSummary: boolean;
4909
- };
4910
- };
4911
- 'gather:resource-complete': {
4912
- correlationId: string;
4913
- resourceId: ResourceId;
4914
- response: components['schemas']['ResourceLLMContextResponse'];
4915
- };
5217
+ annotationId: string;
5218
+ } & components['schemas']['CommandError'];
5219
+ 'gather:resource-requested': components['schemas']['GatherResourceRequest'];
5220
+ 'gather:resource-complete': components['schemas']['GatherResourceComplete'];
4916
5221
  'gather:resource-failed': {
4917
5222
  correlationId: string;
4918
- resourceId: ResourceId;
4919
- error: Error;
4920
- };
4921
- 'gather:progress': {
4922
- message?: string;
4923
- percentage?: number;
4924
- };
4925
- 'gather:finished': {
4926
- correlationId: string;
4927
- resourceId: ResourceId;
4928
- response: components['schemas']['ResourceLLMContextResponse'];
4929
- };
4930
- 'browse:click': {
4931
- annotationId: string;
4932
- motivation: Motivation;
4933
- };
4934
- 'browse:panel-toggle': {
4935
- panel: string;
4936
- };
4937
- 'browse:panel-open': {
4938
- panel: string;
4939
- scrollToAnnotationId?: string;
4940
- motivation?: string;
4941
- };
4942
- 'browse:panel-close': void;
4943
- 'browse:sidebar-toggle': void;
4944
- 'browse:resource-close': {
4945
- resourceId: string;
4946
- };
4947
- 'browse:resource-reorder': {
4948
- oldIndex: number;
4949
- newIndex: number;
4950
- };
4951
- 'browse:link-clicked': {
4952
- href: string;
4953
- label?: string;
4954
- };
4955
- 'browse:router-push': {
4956
- path: string;
4957
- reason?: string;
4958
- };
4959
- 'browse:external-navigate': {
4960
- url: string;
4961
- resourceId?: string;
4962
- cancelFallback: () => void;
4963
- };
4964
- 'browse:reference-navigate': {
4965
5223
  resourceId: string;
4966
- };
4967
- 'browse:entity-type-clicked': {
4968
- entityType: string;
4969
- };
4970
- 'browse:resource-requested': {
4971
- correlationId: string;
4972
- resourceId: ResourceId;
4973
- };
4974
- 'browse:resource-result': {
4975
- correlationId: string;
4976
- response: components['schemas']['GetResourceResponse'];
4977
- };
5224
+ } & components['schemas']['CommandError'];
5225
+ 'gather:annotation-progress': components['schemas']['GatherProgress'];
5226
+ 'gather:annotation-finished': components['schemas']['GatherAnnotationFinished'];
5227
+ 'gather:progress': components['schemas']['GatherProgress'];
5228
+ 'gather:finished': components['schemas']['GatherFinished'];
5229
+ 'browse:resource-requested': components['schemas']['BrowseResourceRequest'];
5230
+ 'browse:resource-result': components['schemas']['BrowseResourceResult'];
4978
5231
  'browse:resource-failed': {
4979
5232
  correlationId: string;
4980
- error: Error;
4981
- };
4982
- 'browse:resources-requested': {
4983
- correlationId: string;
4984
- search?: string;
4985
- archived?: boolean;
4986
- entityType?: string;
4987
- offset?: number;
4988
- limit?: number;
4989
- };
4990
- 'browse:resources-result': {
4991
- correlationId: string;
4992
- response: components['schemas']['ListResourcesResponse'];
4993
- };
5233
+ } & components['schemas']['CommandError'];
5234
+ 'browse:resources-requested': components['schemas']['BrowseResourcesRequest'];
5235
+ 'browse:resources-result': components['schemas']['BrowseResourcesResult'];
4994
5236
  'browse:resources-failed': {
4995
5237
  correlationId: string;
4996
- error: Error;
4997
- };
4998
- 'browse:annotations-requested': {
4999
- correlationId: string;
5000
- resourceId: ResourceId;
5001
- };
5002
- 'browse:annotations-result': {
5003
- correlationId: string;
5004
- response: components['schemas']['GetAnnotationsResponse'];
5005
- };
5238
+ } & components['schemas']['CommandError'];
5239
+ 'browse:annotations-requested': components['schemas']['BrowseAnnotationsRequest'];
5240
+ 'browse:annotations-result': components['schemas']['BrowseAnnotationsResult'];
5006
5241
  'browse:annotations-failed': {
5007
5242
  correlationId: string;
5008
- error: Error;
5009
- };
5010
- 'browse:annotation-requested': {
5011
- correlationId: string;
5012
- resourceId: ResourceId;
5013
- annotationId: AnnotationId;
5014
- };
5015
- 'browse:annotation-result': {
5016
- correlationId: string;
5017
- response: components['schemas']['GetAnnotationResponse'];
5018
- };
5243
+ } & components['schemas']['CommandError'];
5244
+ 'browse:annotation-requested': components['schemas']['BrowseAnnotationRequest'];
5245
+ 'browse:annotation-result': components['schemas']['BrowseAnnotationResult'];
5019
5246
  'browse:annotation-failed': {
5020
5247
  correlationId: string;
5021
- error: Error;
5022
- };
5023
- 'browse:events-requested': {
5024
- correlationId: string;
5025
- resourceId: ResourceId;
5026
- type?: string;
5027
- userId?: string;
5028
- limit?: number;
5029
- };
5030
- 'browse:events-result': {
5031
- correlationId: string;
5032
- response: components['schemas']['GetEventsResponse'];
5033
- };
5248
+ } & components['schemas']['CommandError'];
5249
+ 'browse:events-requested': components['schemas']['BrowseEventsRequest'];
5250
+ 'browse:events-result': components['schemas']['BrowseEventsResult'];
5034
5251
  'browse:events-failed': {
5035
5252
  correlationId: string;
5036
- error: Error;
5037
- };
5038
- 'browse:annotation-history-requested': {
5039
- correlationId: string;
5040
- resourceId: ResourceId;
5041
- annotationId: AnnotationId;
5042
- };
5043
- 'browse:annotation-history-result': {
5044
- correlationId: string;
5045
- response: components['schemas']['GetAnnotationHistoryResponse'];
5046
- };
5253
+ } & components['schemas']['CommandError'];
5254
+ 'browse:annotation-history-requested': components['schemas']['BrowseAnnotationHistoryRequest'];
5255
+ 'browse:annotation-history-result': components['schemas']['BrowseAnnotationHistoryResult'];
5047
5256
  'browse:annotation-history-failed': {
5048
5257
  correlationId: string;
5049
- error: Error;
5050
- };
5051
- 'browse:referenced-by-requested': {
5052
- correlationId: string;
5053
- resourceId: ResourceId;
5054
- motivation?: string;
5055
- };
5056
- 'browse:referenced-by-result': {
5057
- correlationId: string;
5058
- response: components['schemas']['GetReferencedByResponse'];
5059
- };
5258
+ } & components['schemas']['CommandError'];
5259
+ 'browse:referenced-by-requested': components['schemas']['BrowseReferencedByRequest'];
5260
+ 'browse:referenced-by-result': components['schemas']['BrowseReferencedByResult'];
5060
5261
  'browse:referenced-by-failed': {
5061
5262
  correlationId: string;
5062
- error: Error;
5063
- };
5064
- 'browse:entity-types-requested': {
5065
- correlationId: string;
5066
- };
5067
- 'browse:entity-types-result': {
5068
- correlationId: string;
5069
- response: components['schemas']['GetEntityTypesResponse'];
5070
- };
5263
+ } & components['schemas']['CommandError'];
5264
+ 'browse:entity-types-requested': components['schemas']['BrowseEntityTypesRequest'];
5265
+ 'browse:entity-types-result': components['schemas']['BrowseEntityTypesResult'];
5071
5266
  'browse:entity-types-failed': {
5072
5267
  correlationId: string;
5073
- error: Error;
5074
- };
5075
- 'browse:directory-requested': {
5076
- correlationId: string;
5077
- path: string;
5078
- sort?: 'name' | 'mtime' | 'annotationCount';
5079
- };
5080
- 'browse:directory-result': {
5081
- correlationId: string;
5082
- response: {
5083
- path: string;
5084
- entries: components['schemas']['DirectoryEntry'][];
5085
- };
5086
- };
5268
+ } & components['schemas']['CommandError'];
5269
+ 'browse:directory-requested': components['schemas']['BrowseDirectoryRequest'];
5270
+ 'browse:directory-result': components['schemas']['BrowseDirectoryResult'];
5087
5271
  'browse:directory-failed': {
5088
5272
  correlationId: string;
5089
5273
  path: string;
5090
- error: Error;
5091
- };
5092
- 'beckon:hover': {
5093
- annotationId: string | null;
5094
- };
5095
- 'beckon:focus': {
5096
- annotationId?: string;
5097
- resourceId?: string;
5098
- };
5099
- 'beckon:sparkle': {
5100
- annotationId: string;
5101
- };
5102
- 'job:start': {
5103
- resourceId: ResourceId;
5104
- userId: UserId;
5105
- jobId: JobId;
5106
- jobType: 'reference-annotation' | 'generation' | 'highlight-annotation' | 'assessment-annotation' | 'comment-annotation' | 'tag-annotation';
5107
- };
5108
- 'job:report-progress': {
5109
- resourceId: ResourceId;
5110
- userId: UserId;
5111
- jobId: JobId;
5112
- jobType: 'reference-annotation' | 'generation' | 'highlight-annotation' | 'assessment-annotation' | 'comment-annotation' | 'tag-annotation';
5113
- percentage: number;
5114
- progress?: any;
5115
- };
5116
- 'job:complete': {
5117
- resourceId: ResourceId;
5118
- userId: UserId;
5119
- jobId: JobId;
5120
- jobType: 'reference-annotation' | 'generation' | 'highlight-annotation' | 'assessment-annotation' | 'comment-annotation' | 'tag-annotation';
5121
- result?: any;
5122
- };
5123
- 'job:fail': {
5124
- resourceId: ResourceId;
5125
- userId: UserId;
5126
- jobId: JobId;
5127
- jobType: 'reference-annotation' | 'generation' | 'highlight-annotation' | 'assessment-annotation' | 'comment-annotation' | 'tag-annotation';
5128
- error: string;
5129
- };
5130
- 'job:started': Extract<ResourceEvent, {
5131
- type: 'job.started';
5132
- }>;
5133
- 'job:progress': Extract<ResourceEvent, {
5134
- type: 'job.progress';
5135
- }>;
5136
- 'job:completed': Extract<ResourceEvent, {
5137
- type: 'job.completed';
5138
- }>;
5139
- 'job:failed': Extract<ResourceEvent, {
5140
- type: 'job.failed';
5141
- }>;
5142
- 'job:queued': {
5143
- jobId: string;
5144
- jobType: string;
5145
- resourceId: string;
5146
- };
5147
- 'job:cancel-requested': {
5148
- jobType: 'annotation' | 'generation';
5149
- };
5150
- 'job:status-requested': {
5151
- correlationId: string;
5152
- jobId: JobId;
5153
- };
5154
- 'job:status-result': {
5155
- correlationId: string;
5156
- response: components['schemas']['JobStatusResponse'];
5274
+ } & components['schemas']['CommandError'];
5275
+ 'browse:click': components['schemas']['BrowseClickEvent'];
5276
+ 'browse:panel-toggle': components['schemas']['BrowsePanelToggleEvent'];
5277
+ 'browse:panel-open': components['schemas']['BrowsePanelOpenEvent'];
5278
+ 'browse:panel-close': void;
5279
+ 'browse:sidebar-toggle': void;
5280
+ 'browse:resource-close': components['schemas']['BrowseResourceCloseEvent'];
5281
+ 'browse:resource-reorder': components['schemas']['BrowseResourceReorderEvent'];
5282
+ 'browse:link-clicked': components['schemas']['BrowseLinkClickedEvent'];
5283
+ 'browse:router-push': components['schemas']['BrowseRouterPushEvent'];
5284
+ 'browse:external-navigate': components['schemas']['BrowseExternalNavigateEvent'] & {
5285
+ cancelFallback: () => void;
5157
5286
  };
5287
+ 'browse:reference-navigate': components['schemas']['BrowseReferenceNavigateEvent'];
5288
+ 'browse:entity-type-clicked': components['schemas']['BrowseEntityTypeClickedEvent'];
5289
+ 'beckon:hover': components['schemas']['BeckonHoverEvent'];
5290
+ 'beckon:focus': components['schemas']['BeckonFocusEvent'];
5291
+ 'beckon:sparkle': components['schemas']['BeckonSparkleEvent'];
5292
+ 'job:started': StoredEvent<EventOfType<'job:started'>>;
5293
+ 'job:progress': StoredEvent<EventOfType<'job:progress'>>;
5294
+ 'job:completed': StoredEvent<EventOfType<'job:completed'>>;
5295
+ 'job:failed': StoredEvent<EventOfType<'job:failed'>>;
5296
+ 'job:start': components['schemas']['JobStartCommand'];
5297
+ 'job:report-progress': components['schemas']['JobReportProgressCommand'];
5298
+ 'job:complete': components['schemas']['JobCompleteCommand'];
5299
+ 'job:fail': components['schemas']['JobFailCommand'];
5300
+ 'job:queued': components['schemas']['JobQueuedEvent'];
5301
+ 'job:cancel-requested': components['schemas']['JobCancelRequest'];
5302
+ 'job:status-requested': components['schemas']['JobStatusRequest'];
5303
+ 'job:status-result': components['schemas']['JobStatusResult'];
5158
5304
  'job:status-failed': {
5159
5305
  correlationId: string;
5160
- error: Error;
5161
- };
5162
- 'settings:theme-changed': {
5163
- theme: 'light' | 'dark' | 'system';
5164
- };
5306
+ } & components['schemas']['CommandError'];
5307
+ 'embedding:compute': components['schemas']['EmbeddingComputeCommand'];
5308
+ 'embedding:delete': components['schemas']['EmbeddingDeleteCommand'];
5309
+ 'settings:theme-changed': components['schemas']['SettingsThemeChangedEvent'];
5165
5310
  'settings:line-numbers-toggled': void;
5166
- 'settings:locale-changed': {
5167
- locale: string;
5168
- };
5169
- 'settings:hover-delay-changed': {
5170
- hoverDelayMs: number;
5171
- };
5172
- 'embedding:computed': {
5173
- resourceId: ResourceId;
5174
- annotationId?: AnnotationId;
5175
- chunkIndex: number;
5176
- chunkText: string;
5177
- embedding: number[];
5178
- model: string;
5179
- dimensions: number;
5180
- };
5181
- 'embedding:deleted': {
5182
- resourceId: ResourceId;
5183
- annotationId?: AnnotationId;
5184
- };
5311
+ 'settings:locale-changed': components['schemas']['SettingsLocaleChangedEvent'];
5312
+ 'settings:hover-delay-changed': components['schemas']['SettingsHoverDelayChangedEvent'];
5185
5313
  'stream-connected': Record<string, never>;
5314
+ 'replay-window-exceeded': {
5315
+ resourceId?: string;
5316
+ lastEventId: number;
5317
+ missedCount: number;
5318
+ cap: number;
5319
+ message: string;
5320
+ };
5186
5321
  };
5322
+ /** Any valid channel name on the EventBus. */
5323
+ type EventName = keyof EventMap;
5187
5324
  /**
5188
- * Union type of all valid event names
5189
- * Use this to enforce compile-time checking of event names
5325
+ * Non-persisted event types that the per-resource events-stream should deliver
5326
+ * to all connected clients. These are ephemeral command-result and progress
5327
+ * events that don't go through EventStore.appendEvent but still need to reach
5328
+ * every participant viewing the resource for real-time collaboration.
5329
+ *
5330
+ * Actors (Binder, Gatherer, workers) publish these on the scoped EventBus
5331
+ * (`eventBus.scope(resourceId)`). The events-stream route subscribes to them
5332
+ * alongside the persisted event types.
5333
+ *
5334
+ * Unlike PERSISTED_EVENT_TYPES, there's no compile-time exhaustiveness check
5335
+ * here because these event types are a curated subset of EventMap — not every
5336
+ * non-persisted event should flow to all participants. Adding a new one is a
5337
+ * deliberate choice, not an automatic cascade.
5190
5338
  */
5191
- type EventName = keyof EventMap;
5339
+ declare const STREAM_COMMAND_RESULT_TYPES: readonly ["match:search-results", "match:search-failed", "gather:complete", "gather:failed", "gather:annotation-progress", "mark:progress", "mark:assist-finished", "mark:assist-failed", "yield:progress", "yield:finished", "yield:failed"];
5340
+
5341
+ /**
5342
+ * Event Type Guards and Extraction Utilities
5343
+ *
5344
+ * Domain logic for working with resource events.
5345
+ * No React dependencies - safe to use in any JavaScript environment.
5346
+ */
5347
+
5348
+ /**
5349
+ * Minimal event shape accepted by event utility functions.
5350
+ * Compatible with both the internal `StoredEvent` type and the OpenAPI-derived
5351
+ * schema type (`GetEventsResponse['events'][number]`), which lacks `version`.
5352
+ *
5353
+ * Flat shape — event fields and metadata are peers (no `event` wrapper).
5354
+ */
5355
+ interface StoredEventLike {
5356
+ id: string;
5357
+ type: string;
5358
+ timestamp: string;
5359
+ userId: string;
5360
+ resourceId?: string;
5361
+ payload?: unknown;
5362
+ metadata: {
5363
+ sequenceNumber: number;
5364
+ prevEventHash?: string;
5365
+ checksum?: string;
5366
+ };
5367
+ }
5368
+ /**
5369
+ * Extract annotation ID from event payload
5370
+ * Returns null if event is not annotation-related
5371
+ *
5372
+ * For mark:added: extracts full URI from payload.annotation.id
5373
+ * For mark:removed/mark:body-updated: constructs full URI from payload.annotationId (UUID) + resourceId
5374
+ */
5375
+ declare function getAnnotationUriFromEvent(event: StoredEventLike): AnnotationUri | null;
5376
+ /**
5377
+ * Check if an event is related to a specific annotation
5378
+ */
5379
+ declare function isEventRelatedToAnnotation(event: StoredEventLike, annotationUri: AnnotationUri): boolean;
5380
+ /**
5381
+ * Type guard to check if an object is a StoredEvent (flat shape)
5382
+ */
5383
+ declare function isStoredEvent(event: any): event is StoredEvent;
5192
5384
 
5193
5385
  /**
5194
5386
  * RxJS-based Event Bus
@@ -5255,6 +5447,14 @@ declare class EventBus {
5255
5447
  * ```
5256
5448
  */
5257
5449
  get<K extends keyof EventMap>(eventName: K): Subject<EventMap[K]>;
5450
+ /**
5451
+ * Get the RxJS Subject for a domain event type (PersistedEventType).
5452
+ *
5453
+ * Domain event channels carry `StoredEvent`. This method avoids the need
5454
+ * for `as keyof EventMap` casts when subscribing to domain event channels
5455
+ * using runtime `PersistedEventType` strings.
5456
+ */
5457
+ getDomainEvent(eventType: PersistedEventType): Subject<StoredEvent>;
5258
5458
  /**
5259
5459
  * Destroy the event bus and complete all subjects
5260
5460
  *
@@ -5307,6 +5507,8 @@ declare class ScopedEventBus {
5307
5507
  * @returns The RxJS Subject for this scoped event
5308
5508
  */
5309
5509
  get<E extends keyof EventMap>(event: E): Subject<EventMap[E]>;
5510
+ /** Get the RxJS Subject for a domain event type on this scoped bus. */
5511
+ getDomainEvent(eventType: PersistedEventType): Subject<StoredEvent>;
5310
5512
  /**
5311
5513
  * Create a nested scope
5312
5514
  *
@@ -5793,4 +5995,4 @@ declare function getAllPlatformTypes(): PlatformType[];
5793
5995
  declare const CORE_TYPES_VERSION = "0.1.0";
5794
5996
  declare const SDK_VERSION = "0.1.0";
5795
5997
 
5796
- export { APIError, type AccessToken, type AnnotationAddedEvent, type AnnotationBodyUpdatedEvent, type AnnotationCategory, type AnnotationId, type AnnotationRemovedEvent, type AnnotationUri, type AssembledAnnotation, type AuthCode, type BaseEvent, type BaseUrl, type BodyItem, type BodyOperation, type BurstBufferOptions, CORE_TYPES_VERSION, CREATION_METHODS, type CloneToken, ConfigurationError, ConflictError, type ContentFormat$1 as ContentFormat, type CreateAnnotationInternal, type CreationMethod, type Email, type EmbeddingComputedEvent, type EmbeddingDeletedEvent, type EntityTagAddedEvent, type EntityTagRemovedEvent, type EntityType, type EntityTypeStats, type Environment, EnvironmentConfig, EventBus, type EventMap, type EventMetadata, type EventName, type EventQuery, type EventSignature, type GatheredContext, type GoogleAuthRequest, type GoogleCredential, type GraphConnection, type GraphPath, type JobCompletedEvent, type JobFailedEvent, type JobId, type JobProgressEvent, type JobStartedEvent, type Logger, type MCPToken, type MarkProgress, type Motivation$2 as Motivation, NotFoundError, type PlatformType, type RefreshToken, type RepresentationAddedEvent, type RepresentationRemovedEvent, type ResourceAnnotationUri, type ResourceAnnotations, type ResourceArchivedEvent, type ResourceClonedEvent, type ResourceCreatedEvent, type ResourceEvent, type ResourceEventType, type ResourceFilter, type ResourceId, type ResourceScopedEvent, type ResourceUnarchivedEvent, type ResourceUri, SDK_VERSION, ScopedEventBus, ScriptError, type SearchQuery, type SelectionData, type Selector, SemiontError, type StoredEvent, type StoredEventLike, type SystemEvent, type ActorInferenceConfig as TomlActorInferenceConfig, type TomlFileReader, type InferenceConfig as TomlInferenceConfig, type WorkerInferenceConfig as TomlWorkerInferenceConfig, UnauthorizedError, type UpdateResourceInput, type UserDID, type UserId, ValidationError, type YieldProgress, accessToken, annotationId, annotationUri, applyBodyOperations, assembleAnnotation, authCode, baseUrl, burstBuffer, cloneToken, type components, createTomlConfigLoader, didToAgent, email, entityType, findBodyItem, generateUuid, getAllPlatformTypes, getAnnotationUriFromEvent, getEventType, getFragmentSelector, getSvgSelector, getTextPositionSelector, googleCredential, isAnnotationId, isArray, isBoolean, isDefined, isEventRelatedToAnnotation, isFunction, isNull, isNullish, isNumber, isObject, isResourceEvent$1 as isResourceEvent, isResourceId, isResourceScopedEvent, isResourceEvent as isStoredEvent, isString, isSystemEvent, isUndefined, isValidPlatformType, jobId, loadTomlConfig, mcpToken, type operations, parseEnvironment, type paths, refreshToken, resourceAnnotationUri, resourceId, resourceUri, searchQuery, userDID, userId, userToAgent, userToDid, validateEnvironment, validateSvgMarkup };
5998
+ export { APIError, type AccessToken, type AnnotationCategory, type AnnotationId, type AnnotationUri, type AssembledAnnotation, type AuthCode, type BaseUrl, type BodyItem, type BodyOperation, type Brand, type BurstBufferOptions, CORE_TYPES_VERSION, CREATION_METHODS, type CloneToken, ConfigurationError, ConflictError, type ContentFormat, type CreateAnnotationInternal, type CreationMethod, type Email, type EntityType, type EntityTypeStats, type Environment, EnvironmentConfig, type EventBase, EventBus, type EventInput, type EventMap, type EventMetadata, type EventName, type EventOfType, type EventQuery, type EventSignature, type GatheredContext, type GoogleAuthRequest, type GoogleCredential, type GraphConnection, type GraphPath, type JobId, type Logger, type MCPToken, type MarkProgress, type Motivation, NotFoundError, PERSISTED_EVENT_TYPES, type PersistedEvent, type PersistedEventType, type PlatformType, type RefreshToken, type ResourceAnnotationUri, type ResourceAnnotations, type ResourceFilter, type ResourceId, type ResourceUri, SDK_VERSION, STREAM_COMMAND_RESULT_TYPES, ScopedEventBus, ScriptError, type SearchQuery, type SelectionData, type Selector, SemiontError, type StoredEvent, type StoredEventLike, type ActorInferenceConfig as TomlActorInferenceConfig, type TomlFileReader, type InferenceConfig as TomlInferenceConfig, type WorkerInferenceConfig as TomlWorkerInferenceConfig, UnauthorizedError, type UpdateResourceInput, type UserDID, type UserId, ValidationError, type YieldProgress, accessToken, annotationId, annotationUri, applyBodyOperations, assembleAnnotation, authCode, baseUrl, burstBuffer, cloneToken, type components, createTomlConfigLoader, didToAgent, email, entityType, findBodyItem, generateUuid, getAllPlatformTypes, getAnnotationUriFromEvent, getFragmentSelector, getSvgSelector, getTextPositionSelector, googleCredential, isAnnotationId, isArray, isBoolean, isDefined, isEventRelatedToAnnotation, isFunction, isNull, isNullish, isNumber, isObject, isResourceId, isStoredEvent, isString, isUndefined, isValidPlatformType, jobId, loadTomlConfig, mcpToken, type operations, parseEnvironment, type paths, refreshToken, resourceAnnotationUri, resourceId, resourceUri, searchQuery, userDID, userId, userToAgent, userToDid, validateEnvironment, validateSvgMarkup };