@semiont/backend 0.4.7 → 0.4.11

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/openapi.json CHANGED
@@ -507,6 +507,52 @@
507
507
  }
508
508
  }
509
509
  },
510
+ "/api/tokens/media": {
511
+ "post": {
512
+ "summary": "Generate Media Token",
513
+ "description": "Generate a short-lived, resource-scoped media token for use as a ?token= query parameter on binary resource URLs (images, PDFs). Requires session authentication.",
514
+ "tags": [
515
+ "Authentication"
516
+ ],
517
+ "security": [
518
+ {
519
+ "bearerAuth": []
520
+ }
521
+ ],
522
+ "requestBody": {
523
+ "required": true,
524
+ "content": {
525
+ "application/json": {
526
+ "schema": {
527
+ "$ref": "#/components/schemas/MediaTokenRequest"
528
+ }
529
+ }
530
+ }
531
+ },
532
+ "responses": {
533
+ "200": {
534
+ "description": "Media token generated",
535
+ "content": {
536
+ "application/json": {
537
+ "schema": {
538
+ "$ref": "#/components/schemas/MediaTokenResponse"
539
+ }
540
+ }
541
+ }
542
+ },
543
+ "401": {
544
+ "description": "Unauthorized",
545
+ "content": {
546
+ "application/json": {
547
+ "schema": {
548
+ "$ref": "#/components/schemas/ErrorResponse"
549
+ }
550
+ }
551
+ }
552
+ }
553
+ }
554
+ }
555
+ },
510
556
  "/api/users/me": {
511
557
  "get": {
512
558
  "summary": "Get Current User",
@@ -1695,6 +1741,65 @@
1695
1741
  }
1696
1742
  }
1697
1743
  },
1744
+ "/resources/{id}/match-search-stream": {
1745
+ "post": {
1746
+ "summary": "Match Search (SSE Stream)",
1747
+ "description": "Search for binding candidates for a reference annotation via Server-Sent Events. Delegates to the Matcher actor on the backend EventBus.",
1748
+ "tags": [
1749
+ "Resources",
1750
+ "Annotations",
1751
+ "Real-time",
1752
+ "AI"
1753
+ ],
1754
+ "security": [
1755
+ {
1756
+ "bearerAuth": []
1757
+ }
1758
+ ],
1759
+ "parameters": [
1760
+ {
1761
+ "schema": {
1762
+ "type": "string"
1763
+ },
1764
+ "required": true,
1765
+ "name": "id",
1766
+ "in": "path",
1767
+ "description": "Resource ID"
1768
+ }
1769
+ ],
1770
+ "requestBody": {
1771
+ "required": true,
1772
+ "content": {
1773
+ "application/json": {
1774
+ "schema": {
1775
+ "$ref": "#/components/schemas/MatchSearchStreamRequest"
1776
+ }
1777
+ }
1778
+ }
1779
+ },
1780
+ "responses": {
1781
+ "200": {
1782
+ "description": "SSE stream opened successfully",
1783
+ "content": {
1784
+ "text/event-stream": {
1785
+ "schema": {
1786
+ "$ref": "#/components/schemas/EventStreamResponse"
1787
+ }
1788
+ }
1789
+ }
1790
+ },
1791
+ "400": {
1792
+ "description": "referenceId and context are required"
1793
+ },
1794
+ "401": {
1795
+ "description": "Authentication required"
1796
+ },
1797
+ "404": {
1798
+ "description": "Resource not found"
1799
+ }
1800
+ }
1801
+ }
1802
+ },
1698
1803
  "/resources/{resourceId}/annotations/{annotationId}/gather-annotation-stream": {
1699
1804
  "post": {
1700
1805
  "summary": "Gather Annotation LLM Context (SSE Stream)",
@@ -4129,6 +4234,10 @@
4129
4234
  "GatherResourceStreamRequest": {
4130
4235
  "type": "object",
4131
4236
  "properties": {
4237
+ "correlationId": {
4238
+ "type": "string",
4239
+ "description": "Client-generated correlation ID to thread the response back to the originating request"
4240
+ },
4132
4241
  "depth": {
4133
4242
  "type": "integer",
4134
4243
  "minimum": 1,
@@ -4154,6 +4263,10 @@
4154
4263
  "GatherAnnotationStreamRequest": {
4155
4264
  "type": "object",
4156
4265
  "properties": {
4266
+ "correlationId": {
4267
+ "type": "string",
4268
+ "description": "Client-generated correlation ID to thread the response back to the originating request"
4269
+ },
4157
4270
  "contextWindow": {
4158
4271
  "type": "integer",
4159
4272
  "minimum": 100,
@@ -5979,6 +6092,9 @@
5979
6092
  "isAdmin": {
5980
6093
  "type": "boolean"
5981
6094
  },
6095
+ "isModerator": {
6096
+ "type": "boolean"
6097
+ },
5982
6098
  "isActive": {
5983
6099
  "type": "boolean"
5984
6100
  },
@@ -6006,6 +6122,7 @@
6006
6122
  "domain",
6007
6123
  "provider",
6008
6124
  "isAdmin",
6125
+ "isModerator",
6009
6126
  "isActive",
6010
6127
  "termsAcceptedAt",
6011
6128
  "lastLogin",
@@ -6077,6 +6194,30 @@
6077
6194
  ],
6078
6195
  "description": "W3C Web Annotation body purpose vocabulary - https://www.w3.org/TR/annotation-vocab/#motivation"
6079
6196
  },
6197
+ "MediaTokenRequest": {
6198
+ "type": "object",
6199
+ "properties": {
6200
+ "resourceId": {
6201
+ "type": "string",
6202
+ "description": "The resource ID to generate a media token for"
6203
+ }
6204
+ },
6205
+ "required": [
6206
+ "resourceId"
6207
+ ]
6208
+ },
6209
+ "MediaTokenResponse": {
6210
+ "type": "object",
6211
+ "properties": {
6212
+ "token": {
6213
+ "type": "string",
6214
+ "description": "Short-lived media token for use as ?token= query parameter on resource URLs"
6215
+ }
6216
+ },
6217
+ "required": [
6218
+ "token"
6219
+ ]
6220
+ },
6080
6221
  "GatheredContext": {
6081
6222
  "type": "object",
6082
6223
  "description": "Context gathered for an annotation. Includes source document excerpts, metadata, and graph-derived context. Used by both Find (bind) and Generate (yield) flows.",
@@ -6220,6 +6361,37 @@
6220
6361
  "annotation",
6221
6362
  "sourceResource"
6222
6363
  ]
6364
+ },
6365
+ "MatchSearchStreamRequest": {
6366
+ "type": "object",
6367
+ "properties": {
6368
+ "correlationId": {
6369
+ "type": "string",
6370
+ "description": "Client-generated correlation ID to thread the response back to the originating request"
6371
+ },
6372
+ "referenceId": {
6373
+ "type": "string",
6374
+ "description": "Annotation ID of the reference to search candidates for"
6375
+ },
6376
+ "context": {
6377
+ "$ref": "#/components/schemas/GatheredContext",
6378
+ "description": "Gathered context for the reference annotation"
6379
+ },
6380
+ "limit": {
6381
+ "type": "integer",
6382
+ "minimum": 1,
6383
+ "maximum": 20,
6384
+ "description": "Maximum number of candidate results to return (default: 10)"
6385
+ },
6386
+ "useSemanticScoring": {
6387
+ "type": "boolean",
6388
+ "description": "Enable semantic similarity scoring in addition to keyword matching (default: true)"
6389
+ }
6390
+ },
6391
+ "required": [
6392
+ "referenceId",
6393
+ "context"
6394
+ ]
6223
6395
  }
6224
6396
  }
6225
6397
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@semiont/backend",
3
- "version": "0.4.7",
3
+ "version": "0.4.11",
4
4
  "type": "module",
5
5
  "description": "Semiont backend server - pre-built for npm consumption",
6
6
  "main": "dist/index.js",
@@ -20,10 +20,10 @@
20
20
  "@hono/swagger-ui": "^0.6.1",
21
21
  "@prisma/adapter-pg": "^7.5.0",
22
22
  "@prisma/client": "^7.5.0",
23
- "@semiont/core": "^0.4.7",
24
- "@semiont/event-sourcing": "^0.4.7",
25
- "@semiont/jobs": "^0.4.7",
26
- "@semiont/make-meaning": "^0.4.7",
23
+ "@semiont/core": "^0.4.11",
24
+ "@semiont/event-sourcing": "^0.4.11",
25
+ "@semiont/jobs": "^0.4.11",
26
+ "@semiont/make-meaning": "^0.4.11",
27
27
  "ajv": "^8.17.1",
28
28
  "ajv-formats": "^3.0.1",
29
29
  "argon2": "^0.44.0",