@semiont/backend 0.5.3 → 0.5.4

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
@@ -256,10 +256,10 @@
256
256
  }
257
257
  }
258
258
  },
259
- "/api/tokens/worker": {
259
+ "/api/tokens/agent": {
260
260
  "post": {
261
- "summary": "Worker Token Exchange",
262
- "description": "Exchange a shared secret for a bearer JWT. Used by workers and actors connecting to the EventBus.",
261
+ "summary": "Software-Agent Token Exchange",
262
+ "description": "Exchange the shared secret plus an inference (provider, model) pair for a bearer JWT issued for that agent identity. Used by worker processes that emit on behalf of one or more software peers.\n\nThe issued JWT carries the agent's DID (shape `did:web:<host>:agents:<provider>:<model>`); the bus stamps that DID onto `_userId` so events the agent emits attribute to the agent rather than to a generic worker pool.",
263
263
  "tags": [
264
264
  "Authentication"
265
265
  ],
@@ -273,11 +273,21 @@
273
273
  "properties": {
274
274
  "secret": {
275
275
  "type": "string",
276
- "description": "The shared worker secret (SEMIONT_WORKER_SECRET)"
276
+ "description": "The shared secret (SEMIONT_WORKER_SECRET)"
277
+ },
278
+ "provider": {
279
+ "type": "string",
280
+ "description": "Inference provider (e.g. ollama, anthropic)"
281
+ },
282
+ "model": {
283
+ "type": "string",
284
+ "description": "Model identifier (e.g. gemma2:27b, claude-3-5-sonnet)"
277
285
  }
278
286
  },
279
287
  "required": [
280
- "secret"
288
+ "secret",
289
+ "provider",
290
+ "model"
281
291
  ]
282
292
  }
283
293
  }
@@ -294,17 +304,32 @@
294
304
  "token": {
295
305
  "type": "string",
296
306
  "description": "Bearer JWT for subsequent authenticated requests"
307
+ },
308
+ "did": {
309
+ "type": "string",
310
+ "description": "DID of the software-agent identity the token is acting as"
297
311
  }
298
312
  },
299
313
  "required": [
300
- "token"
314
+ "token",
315
+ "did"
301
316
  ]
302
317
  }
303
318
  }
304
319
  }
305
320
  },
321
+ "400": {
322
+ "description": "Missing or invalid request fields",
323
+ "content": {
324
+ "application/json": {
325
+ "schema": {
326
+ "$ref": "#/components/schemas/ErrorResponse"
327
+ }
328
+ }
329
+ }
330
+ },
306
331
  "401": {
307
- "description": "Invalid worker secret",
332
+ "description": "Invalid agent secret",
308
333
  "content": {
309
334
  "application/json": {
310
335
  "schema": {
@@ -314,7 +339,7 @@
314
339
  }
315
340
  },
316
341
  "503": {
317
- "description": "Worker authentication not configured",
342
+ "description": "Agent authentication not configured",
318
343
  "content": {
319
344
  "application/json": {
320
345
  "schema": {
@@ -1386,10 +1411,6 @@
1386
1411
  "type": "string",
1387
1412
  "description": "JSON-stringified array of entity type names"
1388
1413
  },
1389
- "creationMethod": {
1390
- "type": "string",
1391
- "description": "How this resource was created (api, ui, upload, reference, cli, clone, generated)"
1392
- },
1393
1414
  "sourceAnnotationId": {
1394
1415
  "type": "string",
1395
1416
  "description": "For AI-generated resources: the annotation that triggered generation. Nested into generatedFrom.annotationId on the persisted event."
@@ -1870,48 +1891,103 @@
1870
1891
  ]
1871
1892
  },
1872
1893
  "Agent": {
1873
- "type": "object",
1874
- "description": "Minimal Person/Organization for attribution (W3C PROV compatible)",
1875
- "additionalProperties": true,
1876
- "properties": {
1877
- "@id": {
1878
- "type": "string",
1879
- "format": "uri",
1880
- "description": "Unique identifier for the agent"
1881
- },
1882
- "@type": {
1883
- "description": "Type(s) of agent (Person, Organization, Software)",
1884
- "oneOf": [
1885
- {
1894
+ "description": "Web Annotation / W3C PROV Agent. Discriminated by @type — Person, Organization, or Software. Each branch carries fields appropriate to its kind. Software peers are first-class participants, not a sub-class of Person.",
1895
+ "oneOf": [
1896
+ {
1897
+ "type": "object",
1898
+ "additionalProperties": true,
1899
+ "properties": {
1900
+ "@type": {
1901
+ "type": "string",
1902
+ "const": "Person"
1903
+ },
1904
+ "@id": {
1905
+ "type": "string",
1906
+ "format": "uri",
1907
+ "description": "DID-shaped identifier (e.g. did:web:host:users:email%40host)"
1908
+ },
1909
+ "name": {
1910
+ "type": "string",
1911
+ "description": "Display name"
1912
+ },
1913
+ "nickname": {
1886
1914
  "type": "string"
1887
1915
  },
1888
- {
1889
- "type": "array",
1890
- "items": {
1891
- "type": "string"
1892
- },
1893
- "minItems": 1
1916
+ "email": {
1917
+ "type": "string"
1918
+ },
1919
+ "email_sha1": {
1920
+ "type": "string"
1921
+ },
1922
+ "homepage": {
1923
+ "type": "string"
1894
1924
  }
1925
+ },
1926
+ "required": [
1927
+ "@type",
1928
+ "name"
1895
1929
  ]
1896
1930
  },
1897
- "name": {
1898
- "type": "string"
1899
- },
1900
- "nickname": {
1901
- "type": "string"
1902
- },
1903
- "email": {
1904
- "type": "string"
1905
- },
1906
- "email_sha1": {
1907
- "type": "string"
1931
+ {
1932
+ "type": "object",
1933
+ "additionalProperties": true,
1934
+ "properties": {
1935
+ "@type": {
1936
+ "type": "string",
1937
+ "const": "Organization"
1938
+ },
1939
+ "@id": {
1940
+ "type": "string",
1941
+ "format": "uri"
1942
+ },
1943
+ "name": {
1944
+ "type": "string"
1945
+ },
1946
+ "homepage": {
1947
+ "type": "string"
1948
+ }
1949
+ },
1950
+ "required": [
1951
+ "@type",
1952
+ "name"
1953
+ ]
1908
1954
  },
1909
- "homepage": {
1910
- "type": "string"
1955
+ {
1956
+ "type": "object",
1957
+ "additionalProperties": true,
1958
+ "properties": {
1959
+ "@type": {
1960
+ "type": "string",
1961
+ "const": "Software"
1962
+ },
1963
+ "@id": {
1964
+ "type": "string",
1965
+ "format": "uri",
1966
+ "description": "DID-shaped identifier (e.g. did:web:host:agents:provider:model)"
1967
+ },
1968
+ "name": {
1969
+ "type": "string",
1970
+ "description": "Stable human-friendly label. Not parsed; UI composes display from structured fields."
1971
+ },
1972
+ "provider": {
1973
+ "type": "string",
1974
+ "description": "Inference provider (e.g. ollama, anthropic)"
1975
+ },
1976
+ "model": {
1977
+ "type": "string",
1978
+ "description": "Model identifier (e.g. gemma2:27b, claude-3-5-sonnet)"
1979
+ },
1980
+ "parameters": {
1981
+ "type": "object",
1982
+ "additionalProperties": true,
1983
+ "description": "Inference parameters (temperature, maxTokens, systemPrompt, etc.). Runtime metadata, not part of identity."
1984
+ }
1985
+ },
1986
+ "required": [
1987
+ "@type",
1988
+ "name"
1989
+ ]
1911
1990
  }
1912
- },
1913
- "required": [
1914
- "name"
1915
1991
  ]
1916
1992
  },
1917
1993
  "Annotation": {
@@ -1969,7 +2045,8 @@
1969
2045
  "description": "W3C Web Annotation body. Optional per the W3C spec — annotations whose motivation alone is meaningful (highlighting) legitimately omit it. Present values are either a single body or a non-empty array of bodies; the prior empty-array 'stub' branch has been removed (it was a naming lie shared between highlights and never-actually-emitted stub references, and the source of the #651 reference-annotation validator bug)."
1970
2046
  },
1971
2047
  "creator": {
1972
- "$ref": "#/components/schemas/Agent"
2048
+ "$ref": "#/components/schemas/Agent",
2049
+ "description": "Web Annotation creator — the entity that initiated the annotation. For human-driven work this is a Person; for autonomous-agent work this is a Software peer."
1973
2050
  },
1974
2051
  "created": {
1975
2052
  "type": "string"
@@ -1978,7 +2055,34 @@
1978
2055
  "type": "string"
1979
2056
  },
1980
2057
  "generator": {
1981
- "$ref": "#/components/schemas/Agent"
2058
+ "oneOf": [
2059
+ {
2060
+ "$ref": "#/components/schemas/Agent"
2061
+ },
2062
+ {
2063
+ "type": "array",
2064
+ "items": {
2065
+ "$ref": "#/components/schemas/Agent"
2066
+ },
2067
+ "minItems": 1
2068
+ }
2069
+ ],
2070
+ "description": "Web Annotation generator — the SoftwareAgent that produced the annotation, when software was involved. Absent for purely manual annotations. Single object is the common case; array supports pipelines that combine multiple software peers."
2071
+ },
2072
+ "wasAttributedTo": {
2073
+ "oneOf": [
2074
+ {
2075
+ "$ref": "#/components/schemas/Agent"
2076
+ },
2077
+ {
2078
+ "type": "array",
2079
+ "items": {
2080
+ "$ref": "#/components/schemas/Agent"
2081
+ },
2082
+ "minItems": 1
2083
+ }
2084
+ ],
2085
+ "description": "PROV-O wasAttributedTo — all parties responsible for this annotation. For human-prompted AI work this combines `creator` (the Person) and `generator` (the Software). For purely manual annotations it equals `[creator]`; for autonomous-agent work it equals `[generator]` (and `creator` may be the same Software)."
1982
2086
  }
1983
2087
  },
1984
2088
  "required": [
@@ -3063,18 +3167,6 @@
3063
3167
  "contentByteSize": {
3064
3168
  "type": "integer"
3065
3169
  },
3066
- "creationMethod": {
3067
- "type": "string",
3068
- "enum": [
3069
- "api",
3070
- "upload",
3071
- "ui",
3072
- "reference",
3073
- "cli",
3074
- "clone",
3075
- "generated"
3076
- ]
3077
- },
3078
3170
  "entityTypes": {
3079
3171
  "type": "array",
3080
3172
  "items": {
@@ -3126,8 +3218,7 @@
3126
3218
  "required": [
3127
3219
  "name",
3128
3220
  "format",
3129
- "contentChecksum",
3130
- "creationMethod"
3221
+ "contentChecksum"
3131
3222
  ]
3132
3223
  },
3133
3224
  "ResourceClonedPayload": {
@@ -3149,18 +3240,6 @@
3149
3240
  "parentResourceId": {
3150
3241
  "type": "string"
3151
3242
  },
3152
- "creationMethod": {
3153
- "type": "string",
3154
- "enum": [
3155
- "api",
3156
- "upload",
3157
- "ui",
3158
- "reference",
3159
- "cli",
3160
- "clone",
3161
- "generated"
3162
- ]
3163
- },
3164
3243
  "entityTypes": {
3165
3244
  "type": "array",
3166
3245
  "items": {
@@ -3175,8 +3254,7 @@
3175
3254
  "name",
3176
3255
  "format",
3177
3256
  "contentChecksum",
3178
- "parentResourceId",
3179
- "creationMethod"
3257
+ "parentResourceId"
3180
3258
  ]
3181
3259
  },
3182
3260
  "ResourceUpdatedPayload": {
@@ -4316,19 +4394,6 @@
4316
4394
  "type": "boolean",
4317
4395
  "description": "Application-specific: Whether this resource is a draft"
4318
4396
  },
4319
- "creationMethod": {
4320
- "type": "string",
4321
- "enum": [
4322
- "api",
4323
- "upload",
4324
- "ui",
4325
- "reference",
4326
- "cli",
4327
- "clone",
4328
- "generated"
4329
- ],
4330
- "description": "Application-specific: How this resource was created"
4331
- },
4332
4397
  "sourceAnnotationId": {
4333
4398
  "type": "string",
4334
4399
  "description": "Application-specific: ID of annotation that triggered generation"
@@ -7131,9 +7196,6 @@
7131
7196
  "type": "string"
7132
7197
  }
7133
7198
  },
7134
- "creationMethod": {
7135
- "type": "string"
7136
- },
7137
7199
  "isDraft": {
7138
7200
  "type": "boolean"
7139
7201
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@semiont/backend",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
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.5.3",
24
- "@semiont/event-sourcing": "^0.5.3",
25
- "@semiont/jobs": "^0.5.3",
26
- "@semiont/make-meaning": "^0.5.3",
23
+ "@semiont/core": "^0.5.4",
24
+ "@semiont/event-sourcing": "^0.5.4",
25
+ "@semiont/jobs": "^0.5.4",
26
+ "@semiont/make-meaning": "^0.5.4",
27
27
  "ajv": "^8.17.1",
28
28
  "ajv-formats": "^3.0.1",
29
29
  "argon2": "^0.44.0",