@semiont/core 0.2.45 → 0.3.0

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
@@ -84,14 +84,12 @@ interface paths {
84
84
  };
85
85
  };
86
86
  responses: {
87
- /** @description Resource updated successfully */
88
- 200: {
87
+ /** @description Update accepted */
88
+ 202: {
89
89
  headers: {
90
90
  [name: string]: unknown;
91
91
  };
92
- content: {
93
- "application/json": components["schemas"]["GetResourceResponse"];
94
- };
92
+ content?: never;
95
93
  };
96
94
  /** @description Resource not found */
97
95
  404: {
@@ -1063,6 +1061,275 @@ interface paths {
1063
1061
  patch?: never;
1064
1062
  trace?: never;
1065
1063
  };
1064
+ "/api/admin/exchange/backup": {
1065
+ parameters: {
1066
+ query?: never;
1067
+ header?: never;
1068
+ path?: never;
1069
+ cookie?: never;
1070
+ };
1071
+ get?: never;
1072
+ put?: never;
1073
+ /**
1074
+ * Backup Knowledge Base
1075
+ * @description Create a lossless backup of the knowledge base as a streaming tar.gz archive
1076
+ */
1077
+ post: {
1078
+ parameters: {
1079
+ query?: never;
1080
+ header?: never;
1081
+ path?: never;
1082
+ cookie?: never;
1083
+ };
1084
+ requestBody?: never;
1085
+ responses: {
1086
+ /** @description Streaming backup archive */
1087
+ 200: {
1088
+ headers: {
1089
+ [name: string]: unknown;
1090
+ };
1091
+ content: {
1092
+ "application/gzip": string;
1093
+ };
1094
+ };
1095
+ /** @description Unauthorized */
1096
+ 401: {
1097
+ headers: {
1098
+ [name: string]: unknown;
1099
+ };
1100
+ content: {
1101
+ "application/json": components["schemas"]["ErrorResponse"];
1102
+ };
1103
+ };
1104
+ /** @description Forbidden - Admin access required */
1105
+ 403: {
1106
+ headers: {
1107
+ [name: string]: unknown;
1108
+ };
1109
+ content: {
1110
+ "application/json": components["schemas"]["ErrorResponse"];
1111
+ };
1112
+ };
1113
+ };
1114
+ };
1115
+ delete?: never;
1116
+ options?: never;
1117
+ head?: never;
1118
+ patch?: never;
1119
+ trace?: never;
1120
+ };
1121
+ "/api/admin/exchange/restore": {
1122
+ parameters: {
1123
+ query?: never;
1124
+ header?: never;
1125
+ path?: never;
1126
+ cookie?: never;
1127
+ };
1128
+ get?: never;
1129
+ put?: never;
1130
+ /**
1131
+ * Restore Knowledge Base
1132
+ * @description Restore knowledge base from a backup archive. Returns SSE progress events.
1133
+ */
1134
+ post: {
1135
+ parameters: {
1136
+ query?: never;
1137
+ header?: never;
1138
+ path?: never;
1139
+ cookie?: never;
1140
+ };
1141
+ requestBody: {
1142
+ content: {
1143
+ "multipart/form-data": {
1144
+ /**
1145
+ * Format: binary
1146
+ * @description Backup archive (.tar.gz)
1147
+ */
1148
+ file: string;
1149
+ };
1150
+ };
1151
+ };
1152
+ responses: {
1153
+ /** @description SSE stream of restore progress events */
1154
+ 200: {
1155
+ headers: {
1156
+ [name: string]: unknown;
1157
+ };
1158
+ content: {
1159
+ "text/event-stream": string;
1160
+ };
1161
+ };
1162
+ /** @description Invalid file format */
1163
+ 400: {
1164
+ headers: {
1165
+ [name: string]: unknown;
1166
+ };
1167
+ content: {
1168
+ "application/json": components["schemas"]["ErrorResponse"];
1169
+ };
1170
+ };
1171
+ /** @description Unauthorized */
1172
+ 401: {
1173
+ headers: {
1174
+ [name: string]: unknown;
1175
+ };
1176
+ content: {
1177
+ "application/json": components["schemas"]["ErrorResponse"];
1178
+ };
1179
+ };
1180
+ /** @description Forbidden - Admin access required */
1181
+ 403: {
1182
+ headers: {
1183
+ [name: string]: unknown;
1184
+ };
1185
+ content: {
1186
+ "application/json": components["schemas"]["ErrorResponse"];
1187
+ };
1188
+ };
1189
+ };
1190
+ };
1191
+ delete?: never;
1192
+ options?: never;
1193
+ head?: never;
1194
+ patch?: never;
1195
+ trace?: never;
1196
+ };
1197
+ "/api/admin/exchange/export": {
1198
+ parameters: {
1199
+ query?: never;
1200
+ header?: never;
1201
+ path?: never;
1202
+ cookie?: never;
1203
+ };
1204
+ get?: never;
1205
+ put?: never;
1206
+ /**
1207
+ * Export Knowledge Base as JSON-LD
1208
+ * @description Export the knowledge base as a JSON-LD Linked Data tar.gz archive
1209
+ */
1210
+ post: {
1211
+ parameters: {
1212
+ query?: {
1213
+ /** @description Include archived resources in export */
1214
+ includeArchived?: boolean;
1215
+ };
1216
+ header?: never;
1217
+ path?: never;
1218
+ cookie?: never;
1219
+ };
1220
+ requestBody?: never;
1221
+ responses: {
1222
+ /** @description Streaming JSON-LD archive */
1223
+ 200: {
1224
+ headers: {
1225
+ [name: string]: unknown;
1226
+ };
1227
+ content: {
1228
+ "application/gzip": string;
1229
+ };
1230
+ };
1231
+ /** @description Unauthorized */
1232
+ 401: {
1233
+ headers: {
1234
+ [name: string]: unknown;
1235
+ };
1236
+ content: {
1237
+ "application/json": components["schemas"]["ErrorResponse"];
1238
+ };
1239
+ };
1240
+ /** @description Forbidden - Admin access required */
1241
+ 403: {
1242
+ headers: {
1243
+ [name: string]: unknown;
1244
+ };
1245
+ content: {
1246
+ "application/json": components["schemas"]["ErrorResponse"];
1247
+ };
1248
+ };
1249
+ };
1250
+ };
1251
+ delete?: never;
1252
+ options?: never;
1253
+ head?: never;
1254
+ patch?: never;
1255
+ trace?: never;
1256
+ };
1257
+ "/api/admin/exchange/import": {
1258
+ parameters: {
1259
+ query?: never;
1260
+ header?: never;
1261
+ path?: never;
1262
+ cookie?: never;
1263
+ };
1264
+ get?: never;
1265
+ put?: never;
1266
+ /**
1267
+ * Import Knowledge Base from JSON-LD
1268
+ * @description Import resources from a JSON-LD Linked Data archive. Returns SSE progress events.
1269
+ */
1270
+ post: {
1271
+ parameters: {
1272
+ query?: never;
1273
+ header?: never;
1274
+ path?: never;
1275
+ cookie?: never;
1276
+ };
1277
+ requestBody: {
1278
+ content: {
1279
+ "multipart/form-data": {
1280
+ /**
1281
+ * Format: binary
1282
+ * @description JSON-LD archive (.tar.gz)
1283
+ */
1284
+ file: string;
1285
+ };
1286
+ };
1287
+ };
1288
+ responses: {
1289
+ /** @description SSE stream of import progress events */
1290
+ 200: {
1291
+ headers: {
1292
+ [name: string]: unknown;
1293
+ };
1294
+ content: {
1295
+ "text/event-stream": string;
1296
+ };
1297
+ };
1298
+ /** @description Invalid file format */
1299
+ 400: {
1300
+ headers: {
1301
+ [name: string]: unknown;
1302
+ };
1303
+ content: {
1304
+ "application/json": components["schemas"]["ErrorResponse"];
1305
+ };
1306
+ };
1307
+ /** @description Unauthorized */
1308
+ 401: {
1309
+ headers: {
1310
+ [name: string]: unknown;
1311
+ };
1312
+ content: {
1313
+ "application/json": components["schemas"]["ErrorResponse"];
1314
+ };
1315
+ };
1316
+ /** @description Forbidden - Admin access required */
1317
+ 403: {
1318
+ headers: {
1319
+ [name: string]: unknown;
1320
+ };
1321
+ content: {
1322
+ "application/json": components["schemas"]["ErrorResponse"];
1323
+ };
1324
+ };
1325
+ };
1326
+ };
1327
+ delete?: never;
1328
+ options?: never;
1329
+ head?: never;
1330
+ patch?: never;
1331
+ trace?: never;
1332
+ };
1066
1333
  "/resources": {
1067
1334
  parameters: {
1068
1335
  query?: never;
@@ -1140,13 +1407,15 @@ interface paths {
1140
1407
  };
1141
1408
  };
1142
1409
  responses: {
1143
- /** @description Resource created successfully */
1144
- 201: {
1410
+ /** @description Resource creation accepted */
1411
+ 202: {
1145
1412
  headers: {
1146
1413
  [name: string]: unknown;
1147
1414
  };
1148
1415
  content: {
1149
- "application/json": components["schemas"]["CreateResourceResponse"];
1416
+ "application/json": {
1417
+ resourceId: string;
1418
+ };
1150
1419
  };
1151
1420
  };
1152
1421
  };
@@ -1655,13 +1924,15 @@ interface paths {
1655
1924
  };
1656
1925
  };
1657
1926
  responses: {
1658
- /** @description Resource created successfully */
1659
- 201: {
1927
+ /** @description Resource creation accepted */
1928
+ 202: {
1660
1929
  headers: {
1661
1930
  [name: string]: unknown;
1662
1931
  };
1663
1932
  content: {
1664
- "application/json": components["schemas"]["CreateResourceResponse"];
1933
+ "application/json": {
1934
+ resourceId: string;
1935
+ };
1665
1936
  };
1666
1937
  };
1667
1938
  };
@@ -1767,13 +2038,15 @@ interface paths {
1767
2038
  };
1768
2039
  };
1769
2040
  responses: {
1770
- /** @description Annotation created successfully */
1771
- 201: {
2041
+ /** @description Annotation creation accepted */
2042
+ 202: {
1772
2043
  headers: {
1773
2044
  [name: string]: unknown;
1774
2045
  };
1775
2046
  content: {
1776
- "application/json": components["schemas"]["CreateAnnotationResponse"];
2047
+ "application/json": {
2048
+ annotationId: string;
2049
+ };
1777
2050
  };
1778
2051
  };
1779
2052
  };
@@ -1933,15 +2206,8 @@ interface paths {
1933
2206
  };
1934
2207
  requestBody?: never;
1935
2208
  responses: {
1936
- /** @description Annotation deleted successfully */
1937
- 204: {
1938
- headers: {
1939
- [name: string]: unknown;
1940
- };
1941
- content?: never;
1942
- };
1943
- /** @description Annotation not found */
1944
- 404: {
2209
+ /** @description Annotation deletion accepted */
2210
+ 202: {
1945
2211
  headers: {
1946
2212
  [name: string]: unknown;
1947
2213
  };
@@ -1984,14 +2250,12 @@ interface paths {
1984
2250
  };
1985
2251
  };
1986
2252
  responses: {
1987
- /** @description Annotation body updated successfully */
1988
- 200: {
2253
+ /** @description Annotation body update accepted */
2254
+ 202: {
1989
2255
  headers: {
1990
2256
  [name: string]: unknown;
1991
2257
  };
1992
- content: {
1993
- "application/json": components["schemas"]["UpdateAnnotationBodyResponse"];
1994
- };
2258
+ content?: never;
1995
2259
  };
1996
2260
  };
1997
2261
  };
@@ -2158,18 +2422,66 @@ interface paths {
2158
2422
  };
2159
2423
  requestBody?: {
2160
2424
  content: {
2161
- "application/json": components["schemas"]["AddEntityTypeRequest"];
2425
+ "application/json": components["schemas"]["AddEntityTypeRequest"];
2426
+ };
2427
+ };
2428
+ responses: {
2429
+ /** @description Entity type addition accepted */
2430
+ 202: {
2431
+ headers: {
2432
+ [name: string]: unknown;
2433
+ };
2434
+ content?: never;
2435
+ };
2436
+ /** @description Forbidden - Moderator or Admin access required */
2437
+ 403: {
2438
+ headers: {
2439
+ [name: string]: unknown;
2440
+ };
2441
+ content: {
2442
+ "application/json": components["schemas"]["ErrorResponse"];
2443
+ };
2444
+ };
2445
+ };
2446
+ };
2447
+ delete?: never;
2448
+ options?: never;
2449
+ head?: never;
2450
+ patch?: never;
2451
+ trace?: never;
2452
+ };
2453
+ "/api/entity-types/bulk": {
2454
+ parameters: {
2455
+ query?: never;
2456
+ header?: never;
2457
+ path?: never;
2458
+ cookie?: never;
2459
+ };
2460
+ get?: never;
2461
+ put?: never;
2462
+ /**
2463
+ * Bulk Add Entity Types
2464
+ * @description Add multiple entity types to the collection (append-only, requires moderator/admin)
2465
+ */
2466
+ post: {
2467
+ parameters: {
2468
+ query?: never;
2469
+ header?: never;
2470
+ path?: never;
2471
+ cookie?: never;
2472
+ };
2473
+ requestBody?: {
2474
+ content: {
2475
+ "application/json": components["schemas"]["BulkAddEntityTypesRequest"];
2162
2476
  };
2163
2477
  };
2164
2478
  responses: {
2165
- /** @description Entity type added successfully */
2166
- 200: {
2479
+ /** @description Entity types addition accepted */
2480
+ 202: {
2167
2481
  headers: {
2168
2482
  [name: string]: unknown;
2169
2483
  };
2170
- content: {
2171
- "application/json": components["schemas"]["AddEntityTypeResponse"];
2172
- };
2484
+ content?: never;
2173
2485
  };
2174
2486
  /** @description Forbidden - Moderator or Admin access required */
2175
2487
  403: {
@@ -2188,52 +2500,39 @@ interface paths {
2188
2500
  patch?: never;
2189
2501
  trace?: never;
2190
2502
  };
2191
- "/api/entity-types/bulk": {
2503
+ "/api/events/stream": {
2192
2504
  parameters: {
2193
2505
  query?: never;
2194
2506
  header?: never;
2195
2507
  path?: never;
2196
2508
  cookie?: never;
2197
2509
  };
2198
- get?: never;
2199
- put?: never;
2200
2510
  /**
2201
- * Bulk Add Entity Types
2202
- * @description Add multiple entity types to the collection (append-only, requires moderator/admin)
2511
+ * Subscribe to Global Events (SSE)
2512
+ * @description Open a Server-Sent Events stream to receive real-time system-level events (e.g., entity type changes). Events not scoped to a specific resource are delivered on this channel.
2203
2513
  */
2204
- post: {
2514
+ get: {
2205
2515
  parameters: {
2206
2516
  query?: never;
2207
2517
  header?: never;
2208
2518
  path?: never;
2209
2519
  cookie?: never;
2210
2520
  };
2211
- requestBody?: {
2212
- content: {
2213
- "application/json": components["schemas"]["BulkAddEntityTypesRequest"];
2214
- };
2215
- };
2521
+ requestBody?: never;
2216
2522
  responses: {
2217
- /** @description Entity types added successfully */
2523
+ /** @description SSE stream opened successfully */
2218
2524
  200: {
2219
2525
  headers: {
2220
2526
  [name: string]: unknown;
2221
2527
  };
2222
2528
  content: {
2223
- "application/json": components["schemas"]["AddEntityTypeResponse"];
2224
- };
2225
- };
2226
- /** @description Forbidden - Moderator or Admin access required */
2227
- 403: {
2228
- headers: {
2229
- [name: string]: unknown;
2230
- };
2231
- content: {
2232
- "application/json": components["schemas"]["ErrorResponse"];
2529
+ "text/event-stream": components["schemas"]["EventStreamResponse"];
2233
2530
  };
2234
2531
  };
2235
2532
  };
2236
2533
  };
2534
+ put?: never;
2535
+ post?: never;
2237
2536
  delete?: never;
2238
2537
  options?: never;
2239
2538
  head?: never;
@@ -2298,10 +2597,6 @@ interface components {
2298
2597
  AddEntityTypeRequest: {
2299
2598
  tag: string;
2300
2599
  };
2301
- AddEntityTypeResponse: {
2302
- success: boolean;
2303
- entityTypes: string[];
2304
- };
2305
2600
  AdminUpdateUserResponse: {
2306
2601
  success: boolean;
2307
2602
  user: {
@@ -2409,8 +2704,8 @@ interface components {
2409
2704
  annotation: components["schemas"]["Annotation"];
2410
2705
  sourceResource: components["schemas"]["ResourceDescriptor"];
2411
2706
  targetResource?: components["schemas"]["ResourceDescriptor"] | null;
2412
- /** @description Generation context for this annotation */
2413
- context?: components["schemas"]["YieldContext"];
2707
+ /** @description Gathered context for this annotation */
2708
+ context?: components["schemas"]["GatheredContext"];
2414
2709
  /** @description DEPRECATED: Use 'context' instead. Legacy source context format. */
2415
2710
  sourceContext?: {
2416
2711
  before: string;
@@ -2523,9 +2818,6 @@ interface components {
2523
2818
  };
2524
2819
  body: unknown[] | components["schemas"]["AnnotationBody"] | components["schemas"]["AnnotationBody"][];
2525
2820
  };
2526
- CreateAnnotationResponse: {
2527
- annotation: components["schemas"]["Annotation"];
2528
- };
2529
2821
  CreateFromAnnotationRequest: {
2530
2822
  /** @description ID of the resource containing the annotation */
2531
2823
  resourceId: string;
@@ -2577,10 +2869,6 @@ interface components {
2577
2869
  /** @description Whether to archive the original resource */
2578
2870
  archiveOriginal?: boolean;
2579
2871
  };
2580
- CreateResourceFromTokenResponse: {
2581
- resource: components["schemas"]["ResourceDescriptor"];
2582
- annotations: components["schemas"]["Annotation"][];
2583
- };
2584
2872
  CreateResourceRequest: {
2585
2873
  name: string;
2586
2874
  content: string;
@@ -2688,8 +2976,8 @@ interface components {
2688
2976
  prompt?: string;
2689
2977
  /** @description Language locale for generated content (e.g., "es", "fr", "ja") */
2690
2978
  language?: string;
2691
- /** @description Generation context including source document excerpts and metadata */
2692
- context: components["schemas"]["YieldContext"];
2979
+ /** @description Gathered context including source document excerpts, metadata, and graph context */
2980
+ context: components["schemas"]["GatheredContext"];
2693
2981
  /** @description Inference temperature (0.0 = focused, 1.0 = creative) */
2694
2982
  temperature?: number;
2695
2983
  /** @description Maximum tokens to generate */
@@ -2935,10 +3223,7 @@ interface components {
2935
3223
  } | (string | {
2936
3224
  [key: string]: unknown;
2937
3225
  })[];
2938
- /**
2939
- * Format: uri
2940
- * @description Canonical URI/URN of the resource being described.
2941
- */
3226
+ /** @description Canonical URI/URN of the resource being described. */
2942
3227
  "@id": string;
2943
3228
  /** @description Type(s) of the resource (IRIs/CURIEs via @context). */
2944
3229
  "@type"?: string | string[];
@@ -2991,6 +3276,11 @@ interface components {
2991
3276
  sourceAnnotationId?: string;
2992
3277
  /** @description Application-specific: ID of source resource for clones/derivatives */
2993
3278
  sourceResourceId?: string;
3279
+ /**
3280
+ * Format: uri
3281
+ * @description Original URI from a source knowledge base when this resource was imported
3282
+ */
3283
+ originatedFrom?: string;
2994
3284
  } & {
2995
3285
  [key: string]: unknown;
2996
3286
  };
@@ -3087,9 +3377,6 @@ interface components {
3087
3377
  /** @description Array of body modification operations to apply */
3088
3378
  operations: (components["schemas"]["BodyOperationAdd"] | components["schemas"]["BodyOperationRemove"] | components["schemas"]["BodyOperationReplace"])[];
3089
3379
  };
3090
- UpdateAnnotationBodyResponse: {
3091
- annotation: components["schemas"]["Annotation"];
3092
- };
3093
3380
  UpdateResourceRequest: {
3094
3381
  entityTypes?: string[];
3095
3382
  archived?: boolean;
@@ -3149,8 +3436,12 @@ interface components {
3149
3436
  */
3150
3437
  conformsTo?: string;
3151
3438
  };
3152
- /** @description Context information used for AI generation. Includes source document excerpts and metadata. */
3153
- YieldContext: {
3439
+ /** @description Context gathered for an annotation. Includes source document excerpts, metadata, and graph-derived context. Used by both Find (bind) and Generate (yield) flows. */
3440
+ GatheredContext: {
3441
+ /** @description The annotation this context was gathered for */
3442
+ annotation: components["schemas"]["Annotation"];
3443
+ /** @description The resource containing the annotation */
3444
+ sourceResource: components["schemas"]["ResourceDescriptor"];
3154
3445
  /** @description Text context from the source document */
3155
3446
  sourceContext: {
3156
3447
  /** @description Text appearing before the selected passage */
@@ -3160,7 +3451,7 @@ interface components {
3160
3451
  /** @description Text appearing after the selected passage */
3161
3452
  after?: string;
3162
3453
  };
3163
- /** @description Additional context metadata (reserved for future use) */
3454
+ /** @description Context metadata about the annotation and its source */
3164
3455
  metadata?: {
3165
3456
  /** @description Type of source resource (e.g., 'document', 'image', 'video') */
3166
3457
  resourceType?: string;
@@ -3169,6 +3460,35 @@ interface components {
3169
3460
  /** @description Entity types associated with the annotation */
3170
3461
  entityTypes?: string[];
3171
3462
  };
3463
+ /** @description Graph-derived context from the knowledge base */
3464
+ graphContext?: {
3465
+ /** @description Resources connected to the source resource via annotations */
3466
+ connections?: {
3467
+ /** @description ID of the connected resource */
3468
+ resourceId: string;
3469
+ /** @description Name of the connected resource */
3470
+ resourceName: string;
3471
+ /** @description Entity types on the connected resource */
3472
+ entityTypes?: string[];
3473
+ /** @description Whether the connection goes both ways */
3474
+ bidirectional: boolean;
3475
+ }[];
3476
+ /** @description Number of other resources that reference the source resource */
3477
+ citedByCount?: number;
3478
+ /** @description Resources that reference the source resource */
3479
+ citedBy?: {
3480
+ resourceId: string;
3481
+ resourceName: string;
3482
+ }[];
3483
+ /** @description Entity types from other annotations on the same resource */
3484
+ siblingEntityTypes?: string[];
3485
+ /** @description Global frequency counts for entity types (for IDF-like weighting) */
3486
+ entityTypeFrequencies?: {
3487
+ [key: string]: number;
3488
+ };
3489
+ /** @description LLM-generated summary of the annotation's relationships in the knowledge graph */
3490
+ inferredRelationshipSummary?: string;
3491
+ };
3172
3492
  };
3173
3493
  };
3174
3494
  responses: never;
@@ -3292,104 +3612,18 @@ declare function resourceId(id: string): ResourceId;
3292
3612
  declare function annotationId(id: string): AnnotationId;
3293
3613
  declare function userId(id: string): UserId;
3294
3614
 
3295
- /**
3296
- * URI utilities for W3C annotations
3297
- *
3298
- * Converts between short resource/annotation IDs and full URIs.
3299
- * Full URIs are required by W3C Web Annotation Data Model.
3300
- */
3301
-
3302
- /**
3303
- * Convert resource ID to full URI
3304
- *
3305
- * @param id - Short resource ID (e.g., "doc-abc123")
3306
- * @param publicURL - Backend base URL
3307
- * @returns Full URI (e.g., "https://api.semiont.app/resources/doc-abc123")
3308
- *
3309
- * @example
3310
- * resourceIdToURI("doc-abc123", "https://api.semiont.app")
3311
- * // => "https://api.semiont.app/resources/doc-abc123"
3312
- */
3313
- declare function resourceIdToURI(id: ResourceId, publicURL: string): ResourceUri;
3314
- /**
3315
- * Extract resource ID from full URI
3316
- *
3317
- * @param uri - Full resource URI (e.g., "https://api.semiont.app/resources/doc-abc123")
3318
- * @returns Short resource ID (e.g., "doc-abc123")
3319
- * @throws Error if URI format is invalid
3320
- *
3321
- * @example
3322
- * uriToResourceId("https://api.semiont.app/resources/doc-abc123")
3323
- * // => "doc-abc123"
3324
- */
3325
- declare function uriToResourceId(uri: string): ResourceId;
3326
- /**
3327
- * Convert annotation ID to full URI
3328
- *
3329
- * @param id - Short annotation ID (e.g., "anno-xyz789")
3330
- * @param publicURL - Backend base URL
3331
- * @returns Full URI (e.g., "https://api.semiont.app/annotations/anno-xyz789")
3332
- *
3333
- * @example
3334
- * annotationIdToURI("anno-xyz789", "https://api.semiont.app")
3335
- * // => "https://api.semiont.app/annotations/anno-xyz789"
3336
- */
3337
- declare function annotationIdToURI(id: AnnotationId, publicURL: string): AnnotationUri;
3338
- /**
3339
- * Extract annotation ID from full URI
3340
- *
3341
- * @param uri - Full annotation URI (e.g., "https://api.semiont.app/annotations/anno-xyz789")
3342
- * @returns Short annotation ID (e.g., "anno-xyz789")
3343
- * @throws Error if URI format is invalid
3344
- *
3345
- * @example
3346
- * uriToAnnotationId("https://api.semiont.app/annotations/anno-xyz789")
3347
- * // => "anno-xyz789"
3348
- */
3349
- declare function uriToAnnotationId(uri: string): AnnotationId;
3350
- /**
3351
- * Extract annotation ID from URI or pass through if already an ID
3352
- *
3353
- * Defensive version of uriToAnnotationId that handles both:
3354
- * - Full URIs: "https://api.semiont.app/annotations/anno-xyz789" → "anno-xyz789"
3355
- * - Already IDs: "anno-xyz789" → "anno-xyz789"
3356
- *
3357
- * @param uriOrId - Full annotation URI or short ID
3358
- * @returns Short annotation ID
3359
- *
3360
- * @example
3361
- * uriToAnnotationIdOrPassthrough("https://api.semiont.app/annotations/anno-xyz789")
3362
- * // => "anno-xyz789"
3363
- *
3364
- * uriToAnnotationIdOrPassthrough("anno-xyz789")
3365
- * // => "anno-xyz789"
3366
- */
3367
- declare function uriToAnnotationIdOrPassthrough(uriOrId: string): AnnotationId;
3368
- /**
3369
- * Extract resource URI from nested annotation URI
3370
- *
3371
- * @param annotationUri - Nested ResourceAnnotationUri (e.g., "https://api.semiont.app/resources/doc-123/annotations/anno-456")
3372
- * @returns Resource URI (e.g., "https://api.semiont.app/resources/doc-123")
3373
- * @throws Error if URI format is invalid
3374
- *
3375
- * @example
3376
- * extractResourceUriFromAnnotationUri("https://api.semiont.app/resources/doc-123/annotations/anno-456")
3377
- * // => "https://api.semiont.app/resources/doc-123"
3378
- */
3379
- declare function extractResourceUriFromAnnotationUri(annotationUri: ResourceAnnotationUri): ResourceUri;
3380
-
3381
3615
  /**
3382
3616
  * Graph types - Models for graph connections and relationships
3383
3617
  */
3384
3618
 
3385
3619
  type ResourceDescriptor = components['schemas']['ResourceDescriptor'];
3386
- type Annotation$4 = components['schemas']['Annotation'];
3620
+ type Annotation$5 = components['schemas']['Annotation'];
3387
3621
  /**
3388
3622
  * Represents a connection between resources through annotations
3389
3623
  */
3390
3624
  interface GraphConnection {
3391
3625
  targetResource: ResourceDescriptor;
3392
- annotations: Annotation$4[];
3626
+ annotations: Annotation$5[];
3393
3627
  relationshipType?: string;
3394
3628
  bidirectional: boolean;
3395
3629
  }
@@ -3398,7 +3632,7 @@ interface GraphConnection {
3398
3632
  */
3399
3633
  interface GraphPath {
3400
3634
  resources: ResourceDescriptor[];
3401
- annotations: Annotation$4[];
3635
+ annotations: Annotation$5[];
3402
3636
  }
3403
3637
  /**
3404
3638
  * Statistics about entity types in the graph
@@ -3421,7 +3655,7 @@ interface EntityTypeStats {
3421
3655
  * - Optional signatures for cross-org verification
3422
3656
  */
3423
3657
 
3424
- type Annotation$3 = components['schemas']['Annotation'];
3658
+ type Annotation$4 = components['schemas']['Annotation'];
3425
3659
  type ContentFormat = components['schemas']['ContentFormat'];
3426
3660
  type Motivation$1 = components['schemas']['Motivation'];
3427
3661
  interface BaseEvent {
@@ -3499,7 +3733,7 @@ interface RepresentationRemovedEvent extends BaseEvent {
3499
3733
  interface AnnotationAddedEvent extends BaseEvent {
3500
3734
  type: 'annotation.added';
3501
3735
  payload: {
3502
- annotation: Omit<Annotation$3, 'creator' | 'created'>;
3736
+ annotation: Annotation$4;
3503
3737
  };
3504
3738
  }
3505
3739
  interface AnnotationRemovedEvent extends BaseEvent {
@@ -3651,7 +3885,7 @@ interface EventQuery {
3651
3885
  }
3652
3886
  interface ResourceAnnotations {
3653
3887
  resourceId: ResourceId;
3654
- annotations: Annotation$3[];
3888
+ annotations: Annotation$4[];
3655
3889
  version: number;
3656
3890
  updatedAt: string;
3657
3891
  }
@@ -3688,8 +3922,8 @@ declare function isResourceEvent(event: any): event is StoredEvent;
3688
3922
  */
3689
3923
 
3690
3924
  type Selector = components['schemas']['TextPositionSelector'] | components['schemas']['TextQuoteSelector'] | components['schemas']['SvgSelector'] | components['schemas']['FragmentSelector'];
3691
- type YieldContext = components['schemas']['YieldContext'];
3692
- type Annotation$2 = components['schemas']['Annotation'];
3925
+ type GatheredContext = components['schemas']['GatheredContext'];
3926
+ type Annotation$3 = components['schemas']['Annotation'];
3693
3927
  type Motivation = components['schemas']['Motivation'];
3694
3928
  /**
3695
3929
  * Progress state for resource yield workflow
@@ -3760,21 +3994,16 @@ interface MarkProgress {
3760
3994
  */
3761
3995
  type EventMap = {
3762
3996
  'make-meaning:event': ResourceEvent;
3763
- 'yield:modal-open': {
3764
- annotationUri: string;
3765
- resourceUri: string;
3766
- defaultTitle: string;
3767
- };
3768
3997
  'yield:request': {
3769
- annotationUri: string;
3770
- resourceUri: string;
3998
+ annotationId: AnnotationId;
3999
+ resourceId: ResourceId;
3771
4000
  options: {
3772
4001
  title: string;
3773
4002
  prompt?: string;
3774
4003
  language?: string;
3775
4004
  temperature?: number;
3776
4005
  maxTokens?: number;
3777
- context: YieldContext;
4006
+ context: GatheredContext;
3778
4007
  };
3779
4008
  };
3780
4009
  'yield:progress': YieldProgress;
@@ -3788,7 +4017,68 @@ type EventMap = {
3788
4017
  'yield:representation-removed': Extract<ResourceEvent, {
3789
4018
  type: 'representation.removed';
3790
4019
  }>;
4020
+ 'yield:create': {
4021
+ name: string;
4022
+ content: Buffer;
4023
+ format: components['schemas']['ContentFormat'];
4024
+ userId: UserId;
4025
+ language?: string;
4026
+ entityTypes?: string[];
4027
+ creationMethod?: CreationMethod;
4028
+ isDraft?: boolean;
4029
+ generatedFrom?: string;
4030
+ generationPrompt?: string;
4031
+ };
4032
+ 'yield:created': {
4033
+ resourceId: ResourceId;
4034
+ resource: components['schemas']['ResourceDescriptor'];
4035
+ };
4036
+ 'yield:create-failed': {
4037
+ error: Error;
4038
+ };
3791
4039
  'yield:clone': void;
4040
+ 'yield:clone-token-requested': {
4041
+ correlationId: string;
4042
+ resourceId: ResourceId;
4043
+ };
4044
+ 'yield:clone-token-generated': {
4045
+ correlationId: string;
4046
+ response: components['schemas']['CloneResourceWithTokenResponse'];
4047
+ };
4048
+ 'yield:clone-token-failed': {
4049
+ correlationId: string;
4050
+ error: Error;
4051
+ };
4052
+ 'yield:clone-resource-requested': {
4053
+ correlationId: string;
4054
+ token: string;
4055
+ };
4056
+ 'yield:clone-resource-result': {
4057
+ correlationId: string;
4058
+ response: components['schemas']['GetResourceByTokenResponse'];
4059
+ };
4060
+ 'yield:clone-resource-failed': {
4061
+ correlationId: string;
4062
+ error: Error;
4063
+ };
4064
+ 'yield:clone-create': {
4065
+ correlationId: string;
4066
+ token: string;
4067
+ name: string;
4068
+ content: string;
4069
+ userId: UserId;
4070
+ archiveOriginal?: boolean;
4071
+ };
4072
+ 'yield:clone-created': {
4073
+ correlationId: string;
4074
+ response: {
4075
+ resourceId: ResourceId;
4076
+ };
4077
+ };
4078
+ 'yield:clone-create-failed': {
4079
+ correlationId: string;
4080
+ error: Error;
4081
+ };
3792
4082
  'mark:select-comment': SelectionData;
3793
4083
  'mark:select-tag': SelectionData;
3794
4084
  'mark:select-assessment': SelectionData;
@@ -3798,26 +4088,42 @@ type EventMap = {
3798
4088
  motivation: Motivation;
3799
4089
  };
3800
4090
  'mark:cancel-pending': void;
3801
- 'mark:create': {
4091
+ 'mark:submit': {
3802
4092
  motivation: Motivation;
3803
4093
  selector: Selector | Selector[];
3804
4094
  body: components['schemas']['AnnotationBody'][];
3805
4095
  };
4096
+ 'mark:create': {
4097
+ annotation: Annotation$3;
4098
+ userId: UserId;
4099
+ resourceId: ResourceId;
4100
+ };
3806
4101
  'mark:created': {
3807
- annotation: Annotation$2;
4102
+ annotationId: AnnotationId;
3808
4103
  };
3809
4104
  'mark:create-failed': {
3810
4105
  error: Error;
3811
4106
  };
3812
4107
  'mark:delete': {
3813
- annotationId: string;
4108
+ annotationId: AnnotationId;
4109
+ userId?: UserId;
4110
+ resourceId?: ResourceId;
3814
4111
  };
3815
4112
  'mark:deleted': {
3816
- annotationId: string;
4113
+ annotationId: AnnotationId;
3817
4114
  };
3818
4115
  'mark:delete-failed': {
3819
4116
  error: Error;
3820
4117
  };
4118
+ 'mark:update-body': {
4119
+ annotationId: AnnotationId;
4120
+ userId: UserId;
4121
+ resourceId: ResourceId;
4122
+ operations: BodyOperation[];
4123
+ };
4124
+ 'mark:body-update-failed': {
4125
+ error: Error;
4126
+ };
3821
4127
  'mark:assist-request': {
3822
4128
  motivation: Motivation;
3823
4129
  options: {
@@ -3833,7 +4139,7 @@ type EventMap = {
3833
4139
  'mark:progress': MarkProgress;
3834
4140
  'mark:assist-finished': {
3835
4141
  motivation?: Motivation;
3836
- resourceUri?: ResourceUri;
4142
+ resourceId?: ResourceId;
3837
4143
  progress?: MarkProgress;
3838
4144
  };
3839
4145
  'mark:assist-failed': Extract<ResourceEvent, {
@@ -3866,30 +4172,64 @@ type EventMap = {
3866
4172
  'mark:entity-tag-removed': Extract<ResourceEvent, {
3867
4173
  type: 'entitytag.removed';
3868
4174
  }>;
3869
- 'mark:archive': void;
4175
+ 'mark:update-entity-types': {
4176
+ resourceId: ResourceId;
4177
+ userId: UserId;
4178
+ currentEntityTypes: string[];
4179
+ updatedEntityTypes: string[];
4180
+ };
4181
+ 'mark:add-entity-type': {
4182
+ tag: string;
4183
+ userId: UserId;
4184
+ };
4185
+ 'mark:entity-type-added': {
4186
+ tag: string;
4187
+ };
4188
+ 'mark:entity-type-add-failed': {
4189
+ error: Error;
4190
+ };
4191
+ 'mark:entity-types-requested': {
4192
+ correlationId: string;
4193
+ };
4194
+ 'mark:entity-types-result': {
4195
+ correlationId: string;
4196
+ response: components['schemas']['GetEntityTypesResponse'];
4197
+ };
4198
+ 'mark:entity-types-failed': {
4199
+ correlationId: string;
4200
+ error: Error;
4201
+ };
4202
+ 'mark:archive': void | {
4203
+ userId: UserId;
4204
+ resourceId?: ResourceId;
4205
+ };
3870
4206
  'mark:archived': Extract<ResourceEvent, {
3871
4207
  type: 'resource.archived';
3872
4208
  }>;
3873
- 'mark:unarchive': void;
4209
+ 'mark:unarchive': void | {
4210
+ userId: UserId;
4211
+ resourceId?: ResourceId;
4212
+ };
3874
4213
  'mark:unarchived': Extract<ResourceEvent, {
3875
4214
  type: 'resource.unarchived';
3876
4215
  }>;
3877
- 'bind:create-manual': {
3878
- annotationUri: string;
3879
- title: string;
4216
+ 'bind:initiate': {
4217
+ annotationId: AnnotationId;
4218
+ resourceId: ResourceId;
4219
+ defaultTitle: string;
3880
4220
  entityTypes: string[];
3881
4221
  };
3882
- 'bind:link': {
3883
- annotationUri: string;
3884
- searchTerm: string;
3885
- };
3886
4222
  'bind:search-requested': {
4223
+ correlationId?: string;
3887
4224
  referenceId: string;
3888
- searchTerm: string;
4225
+ context: GatheredContext;
4226
+ limit?: number;
4227
+ useSemanticScoring?: boolean;
3889
4228
  };
3890
4229
  'bind:update-body': {
3891
- annotationUri: string;
3892
- resourceId: string;
4230
+ annotationId: AnnotationId;
4231
+ resourceId: ResourceId;
4232
+ userId?: UserId;
3893
4233
  operations: Array<{
3894
4234
  op: 'add' | 'remove' | 'replace';
3895
4235
  item?: components['schemas']['AnnotationBody'];
@@ -3898,21 +4238,75 @@ type EventMap = {
3898
4238
  }>;
3899
4239
  };
3900
4240
  'bind:body-updated': {
3901
- annotationUri: string;
4241
+ annotationId: AnnotationId;
3902
4242
  };
3903
4243
  'bind:body-update-failed': {
3904
4244
  error: Error;
3905
4245
  };
4246
+ 'bind:search-results': {
4247
+ referenceId: string;
4248
+ results: Array<components['schemas']['ResourceDescriptor'] & {
4249
+ score?: number;
4250
+ matchReason?: string;
4251
+ }>;
4252
+ correlationId?: string;
4253
+ };
4254
+ 'bind:search-failed': {
4255
+ referenceId: string;
4256
+ error: Error;
4257
+ correlationId?: string;
4258
+ };
4259
+ 'bind:referenced-by-requested': {
4260
+ correlationId: string;
4261
+ resourceId: ResourceId;
4262
+ motivation?: string;
4263
+ };
4264
+ 'bind:referenced-by-result': {
4265
+ correlationId: string;
4266
+ response: components['schemas']['GetReferencedByResponse'];
4267
+ };
4268
+ 'bind:referenced-by-failed': {
4269
+ correlationId: string;
4270
+ error: Error;
4271
+ };
3906
4272
  'gather:requested': {
3907
- annotationUri: string;
3908
- resourceUri: string;
4273
+ correlationId?: string;
4274
+ annotationId: AnnotationId;
4275
+ resourceId: ResourceId;
4276
+ options?: {
4277
+ includeSourceContext?: boolean;
4278
+ includeTargetContext?: boolean;
4279
+ contextWindow?: number;
4280
+ };
3909
4281
  };
3910
4282
  'gather:complete': {
3911
- annotationUri: string;
3912
- context: YieldContext;
4283
+ correlationId?: string;
4284
+ annotationId: AnnotationId;
4285
+ response: components['schemas']['AnnotationLLMContextResponse'];
3913
4286
  };
3914
4287
  'gather:failed': {
3915
- annotationUri: string;
4288
+ correlationId?: string;
4289
+ annotationId: AnnotationId;
4290
+ error: Error;
4291
+ };
4292
+ 'gather:resource-requested': {
4293
+ correlationId?: string;
4294
+ resourceId: ResourceId;
4295
+ options: {
4296
+ depth: number;
4297
+ maxResources: number;
4298
+ includeContent: boolean;
4299
+ includeSummary: boolean;
4300
+ };
4301
+ };
4302
+ 'gather:resource-complete': {
4303
+ correlationId?: string;
4304
+ resourceId: ResourceId;
4305
+ context: components['schemas']['ResourceLLMContextResponse'];
4306
+ };
4307
+ 'gather:resource-failed': {
4308
+ correlationId?: string;
4309
+ resourceId: ResourceId;
3916
4310
  error: Error;
3917
4311
  };
3918
4312
  'browse:click': {
@@ -3955,6 +4349,87 @@ type EventMap = {
3955
4349
  'browse:entity-type-clicked': {
3956
4350
  entityType: string;
3957
4351
  };
4352
+ 'browse:resource-requested': {
4353
+ correlationId: string;
4354
+ resourceId: ResourceId;
4355
+ };
4356
+ 'browse:resource-result': {
4357
+ correlationId: string;
4358
+ response: components['schemas']['GetResourceResponse'];
4359
+ };
4360
+ 'browse:resource-failed': {
4361
+ correlationId: string;
4362
+ error: Error;
4363
+ };
4364
+ 'browse:resources-requested': {
4365
+ correlationId: string;
4366
+ search?: string;
4367
+ archived?: boolean;
4368
+ entityType?: string;
4369
+ offset?: number;
4370
+ limit?: number;
4371
+ };
4372
+ 'browse:resources-result': {
4373
+ correlationId: string;
4374
+ response: components['schemas']['ListResourcesResponse'];
4375
+ };
4376
+ 'browse:resources-failed': {
4377
+ correlationId: string;
4378
+ error: Error;
4379
+ };
4380
+ 'browse:annotations-requested': {
4381
+ correlationId: string;
4382
+ resourceId: ResourceId;
4383
+ };
4384
+ 'browse:annotations-result': {
4385
+ correlationId: string;
4386
+ response: components['schemas']['GetAnnotationsResponse'];
4387
+ };
4388
+ 'browse:annotations-failed': {
4389
+ correlationId: string;
4390
+ error: Error;
4391
+ };
4392
+ 'browse:annotation-requested': {
4393
+ correlationId: string;
4394
+ resourceId: ResourceId;
4395
+ annotationId: AnnotationId;
4396
+ };
4397
+ 'browse:annotation-result': {
4398
+ correlationId: string;
4399
+ response: components['schemas']['GetAnnotationResponse'];
4400
+ };
4401
+ 'browse:annotation-failed': {
4402
+ correlationId: string;
4403
+ error: Error;
4404
+ };
4405
+ 'browse:events-requested': {
4406
+ correlationId: string;
4407
+ resourceId: ResourceId;
4408
+ type?: string;
4409
+ userId?: string;
4410
+ limit?: number;
4411
+ };
4412
+ 'browse:events-result': {
4413
+ correlationId: string;
4414
+ response: components['schemas']['GetEventsResponse'];
4415
+ };
4416
+ 'browse:events-failed': {
4417
+ correlationId: string;
4418
+ error: Error;
4419
+ };
4420
+ 'browse:annotation-history-requested': {
4421
+ correlationId: string;
4422
+ resourceId: ResourceId;
4423
+ annotationId: AnnotationId;
4424
+ };
4425
+ 'browse:annotation-history-result': {
4426
+ correlationId: string;
4427
+ response: components['schemas']['GetAnnotationHistoryResponse'];
4428
+ };
4429
+ 'browse:annotation-history-failed': {
4430
+ correlationId: string;
4431
+ error: Error;
4432
+ };
3958
4433
  'beckon:hover': {
3959
4434
  annotationId: string | null;
3960
4435
  };
@@ -3964,6 +4439,34 @@ type EventMap = {
3964
4439
  'beckon:sparkle': {
3965
4440
  annotationId: string;
3966
4441
  };
4442
+ 'job:start': {
4443
+ resourceId: ResourceId;
4444
+ userId: UserId;
4445
+ jobId: JobId;
4446
+ jobType: 'reference-annotation' | 'generation' | 'highlight-annotation' | 'assessment-annotation' | 'comment-annotation' | 'tag-annotation';
4447
+ };
4448
+ 'job:report-progress': {
4449
+ resourceId: ResourceId;
4450
+ userId: UserId;
4451
+ jobId: JobId;
4452
+ jobType: 'reference-annotation' | 'generation' | 'highlight-annotation' | 'assessment-annotation' | 'comment-annotation' | 'tag-annotation';
4453
+ percentage: number;
4454
+ progress?: any;
4455
+ };
4456
+ 'job:complete': {
4457
+ resourceId: ResourceId;
4458
+ userId: UserId;
4459
+ jobId: JobId;
4460
+ jobType: 'reference-annotation' | 'generation' | 'highlight-annotation' | 'assessment-annotation' | 'comment-annotation' | 'tag-annotation';
4461
+ result?: any;
4462
+ };
4463
+ 'job:fail': {
4464
+ resourceId: ResourceId;
4465
+ userId: UserId;
4466
+ jobId: JobId;
4467
+ jobType: 'reference-annotation' | 'generation' | 'highlight-annotation' | 'assessment-annotation' | 'comment-annotation' | 'tag-annotation';
4468
+ error: string;
4469
+ };
3967
4470
  'job:started': Extract<ResourceEvent, {
3968
4471
  type: 'job.started';
3969
4472
  }>;
@@ -3984,6 +4487,18 @@ type EventMap = {
3984
4487
  'job:cancel-requested': {
3985
4488
  jobType: 'annotation' | 'generation';
3986
4489
  };
4490
+ 'job:status-requested': {
4491
+ correlationId: string;
4492
+ jobId: JobId;
4493
+ };
4494
+ 'job:status-result': {
4495
+ correlationId: string;
4496
+ response: components['schemas']['JobStatusResponse'];
4497
+ };
4498
+ 'job:status-failed': {
4499
+ correlationId: string;
4500
+ error: Error;
4501
+ };
3987
4502
  'settings:theme-changed': {
3988
4503
  theme: 'light' | 'dark' | 'system';
3989
4504
  };
@@ -4220,12 +4735,64 @@ interface Logger {
4220
4735
  * Backend-specific annotation utility functions
4221
4736
  */
4222
4737
 
4223
- type Annotation$1 = components['schemas']['Annotation'];
4738
+ type Annotation$2 = components['schemas']['Annotation'];
4224
4739
  /**
4225
4740
  * Find a body item in an array
4226
4741
  * Returns the index of the first matching item, or -1 if not found
4227
4742
  */
4228
- declare function findBodyItem(body: Annotation$1['body'], targetItem: BodyItem): number;
4743
+ declare function findBodyItem(body: Annotation$2['body'], targetItem: BodyItem): number;
4744
+
4745
+ /**
4746
+ * Annotation Assembly
4747
+ *
4748
+ * Pure functions for building W3C Annotations and applying body operations.
4749
+ * No EventBus, no persistence — just data transformation.
4750
+ */
4751
+
4752
+ type Agent$1 = components['schemas']['Agent'];
4753
+ type Annotation$1 = components['schemas']['Annotation'];
4754
+ type AnnotationBody = components['schemas']['AnnotationBody'];
4755
+ type CreateAnnotationRequest = components['schemas']['CreateAnnotationRequest'];
4756
+ type UpdateAnnotationBodyRequest = components['schemas']['UpdateAnnotationBodyRequest'];
4757
+ type TextPositionSelector = components['schemas']['TextPositionSelector'];
4758
+ type SvgSelector = components['schemas']['SvgSelector'];
4759
+ type FragmentSelector = components['schemas']['FragmentSelector'];
4760
+ interface AssembledAnnotation {
4761
+ annotation: Annotation$1;
4762
+ bodyArray: AnnotationBody[];
4763
+ }
4764
+ /**
4765
+ * Get TextPositionSelector from a selector (single or array)
4766
+ */
4767
+ declare function getTextPositionSelector(selector: Selector | Selector[] | undefined): TextPositionSelector | null;
4768
+ /**
4769
+ * Get SvgSelector from a selector (single or array)
4770
+ */
4771
+ declare function getSvgSelector(selector: Selector | Selector[] | undefined): SvgSelector | null;
4772
+ /**
4773
+ * Get FragmentSelector from a selector (single or array)
4774
+ */
4775
+ declare function getFragmentSelector(selector: Selector | Selector[] | undefined): FragmentSelector | null;
4776
+ /**
4777
+ * Validate SVG markup for W3C compliance
4778
+ *
4779
+ * @returns null if valid, error message if invalid
4780
+ */
4781
+ declare function validateSvgMarkup(svg: string): string | null;
4782
+ /**
4783
+ * Build a complete W3C Annotation from a CreateAnnotationRequest.
4784
+ *
4785
+ * Generates a bare annotation ID (no URL prefix). URIs are constructed
4786
+ * at the API boundary when returning responses to clients.
4787
+ *
4788
+ * Throws on invalid input (missing selector, missing motivation, invalid SVG).
4789
+ */
4790
+ declare function assembleAnnotation(request: CreateAnnotationRequest, creator: Agent$1): AssembledAnnotation;
4791
+ /**
4792
+ * Apply body operations (add/remove/replace) to an annotation's body array.
4793
+ * Returns a new array — does not mutate the input.
4794
+ */
4795
+ declare function applyBodyOperations(body: Annotation$1['body'], operations: UpdateAnnotationBodyRequest['operations']): AnnotationBody[];
4229
4796
 
4230
4797
  /**
4231
4798
  * Resource input/output types
@@ -4264,6 +4831,14 @@ interface GoogleAuthRequest {
4264
4831
  termsAccepted: boolean;
4265
4832
  }
4266
4833
 
4834
+ /**
4835
+ * ID generation utilities
4836
+ */
4837
+ /**
4838
+ * Generate a UUID v4-like ID (without dashes)
4839
+ */
4840
+ declare function generateUuid(): string;
4841
+
4267
4842
  /**
4268
4843
  * Common type guard utilities
4269
4844
  */
@@ -5258,4 +5833,4 @@ declare class ConfigurationError extends Error {
5258
5833
  declare const CORE_TYPES_VERSION = "0.1.0";
5259
5834
  declare const SDK_VERSION = "0.1.0";
5260
5835
 
5261
- export { APIError, type AWSConfig, type AccessToken, type AnnotationAddedEvent, type AnnotationBodyUpdatedEvent, type AnnotationCategory, type AnnotationId, type AnnotationRemovedEvent, type AnnotationUri, type AppConfig, type AuthCode, type BackendServiceConfig, type BaseEvent, type BaseUrl, type BodyItem, type BodyOperation, type BurstBufferOptions, CORE_TYPES_VERSION, CREATION_METHODS, type CloneToken, type ConfigFileReader, ConfigurationError, ConflictError, type ContentFormat$1 as ContentFormat, type CreateAnnotationInternal, type CreationMethod, type DatabaseServiceConfig, type Email, type EntityTagAddedEvent, type EntityTagRemovedEvent, type EntityType, type EntityTypeStats, type Environment, type EnvironmentConfig, EventBus, type EventMap, type EventMetadata, type EventName, type EventQuery, type EventSignature, type FilesystemServiceConfig, type FrontendServiceConfig, type GoogleAuthRequest, type GoogleCredential, type GraphConnection, type GraphDatabaseType, type GraphPath, type GraphServiceConfig, type InferenceServiceConfig, type JobCompletedEvent, type JobFailedEvent, type JobId, type JobProgressEvent, type JobStartedEvent, type Logger, type MCPToken, type MarkProgress, type McpServiceConfig, type Motivation$2 as Motivation, NotFoundError, type PlatformType, type ProxyServiceConfig, 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, type SemiontConfig, SemiontError, type ServiceConfig, type ServicePlatformConfig, type ServicesConfig, type SiteConfig, type StoredEvent, type SystemEvent, UnauthorizedError, type UpdateResourceInput, type UserDID, type UserId, ValidationError, type ValidationResult, type YieldContext, type YieldProgress, accessToken, annotationId, annotationIdToURI, annotationUri, authCode, baseUrl, burstBuffer, cloneToken, type components, createConfigLoader, deepMerge, didToAgent, displayConfiguration, email, entityType, extractResourceUriFromAnnotationUri, findBodyItem, formatErrors, getAllPlatformTypes, getAnnotationUriFromEvent, getEventType, getNodeEnvForEnvironment, googleCredential, hasAWSConfig, isAnnotationId, isArray, isBoolean, isDefined, isEventRelatedToAnnotation, isFunction, isNull, isNullish, isNumber, isObject, isResourceEvent$1 as isResourceEvent, isResourceId, isResourceScopedEvent, isResourceEvent as isStoredEvent, isString, isSystemEvent, isUndefined, isValidPlatformType, jobId, listEnvironmentNames, mcpToken, type operations, parseAndMergeConfigs, parseEnvironment, type paths, refreshToken, resolveEnvVars, resourceAnnotationUri, resourceId, resourceIdToURI, resourceUri, searchQuery, uriToAnnotationId, uriToAnnotationIdOrPassthrough, uriToResourceId, userDID, userId, userToAgent, userToDid, validateEnvironment, validateEnvironmentConfig, validateSemiontConfig, validateSiteConfig };
5836
+ export { APIError, type AWSConfig, type AccessToken, type AnnotationAddedEvent, type AnnotationBodyUpdatedEvent, type AnnotationCategory, type AnnotationId, type AnnotationRemovedEvent, type AnnotationUri, type AppConfig, type AssembledAnnotation, type AuthCode, type BackendServiceConfig, type BaseEvent, type BaseUrl, type BodyItem, type BodyOperation, type BurstBufferOptions, CORE_TYPES_VERSION, CREATION_METHODS, type CloneToken, type ConfigFileReader, ConfigurationError, ConflictError, type ContentFormat$1 as ContentFormat, type CreateAnnotationInternal, type CreationMethod, type DatabaseServiceConfig, type Email, type EntityTagAddedEvent, type EntityTagRemovedEvent, type EntityType, type EntityTypeStats, type Environment, type EnvironmentConfig, EventBus, type EventMap, type EventMetadata, type EventName, type EventQuery, type EventSignature, type FilesystemServiceConfig, type FrontendServiceConfig, type GatheredContext, type GoogleAuthRequest, type GoogleCredential, type GraphConnection, type GraphDatabaseType, type GraphPath, type GraphServiceConfig, type InferenceServiceConfig, type JobCompletedEvent, type JobFailedEvent, type JobId, type JobProgressEvent, type JobStartedEvent, type Logger, type MCPToken, type MarkProgress, type McpServiceConfig, type Motivation$2 as Motivation, NotFoundError, type PlatformType, type ProxyServiceConfig, 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, type SemiontConfig, SemiontError, type ServiceConfig, type ServicePlatformConfig, type ServicesConfig, type SiteConfig, type StoredEvent, type SystemEvent, UnauthorizedError, type UpdateResourceInput, type UserDID, type UserId, ValidationError, type ValidationResult, type YieldProgress, accessToken, annotationId, annotationUri, applyBodyOperations, assembleAnnotation, authCode, baseUrl, burstBuffer, cloneToken, type components, createConfigLoader, deepMerge, didToAgent, displayConfiguration, email, entityType, findBodyItem, formatErrors, generateUuid, getAllPlatformTypes, getAnnotationUriFromEvent, getEventType, getFragmentSelector, getNodeEnvForEnvironment, getSvgSelector, getTextPositionSelector, googleCredential, hasAWSConfig, isAnnotationId, isArray, isBoolean, isDefined, isEventRelatedToAnnotation, isFunction, isNull, isNullish, isNumber, isObject, isResourceEvent$1 as isResourceEvent, isResourceId, isResourceScopedEvent, isResourceEvent as isStoredEvent, isString, isSystemEvent, isUndefined, isValidPlatformType, jobId, listEnvironmentNames, mcpToken, type operations, parseAndMergeConfigs, parseEnvironment, type paths, refreshToken, resolveEnvVars, resourceAnnotationUri, resourceId, resourceUri, searchQuery, userDID, userId, userToAgent, userToDid, validateEnvironment, validateEnvironmentConfig, validateSemiontConfig, validateSiteConfig, validateSvgMarkup };