@semiont/core 0.5.6 → 0.5.8

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
@@ -1545,8 +1545,8 @@ interface paths {
1545
1545
  file: string;
1546
1546
  /** @description Media type of the content (e.g. text/plain, text/markdown, image/png) */
1547
1547
  format: string;
1548
- /** @description Where the content has been / should be placed (file://... for local). If omitted, derived from name + format. */
1549
- storageUri?: string;
1548
+ /** @description Where the content lives (file://... for local). Required the client names the location; the server does not derive one. */
1549
+ storageUri: string;
1550
1550
  /** @description ISO 639-1 language code */
1551
1551
  language?: string;
1552
1552
  /** @description JSON-stringified array of entity type names */
@@ -1574,7 +1574,7 @@ interface paths {
1574
1574
  "application/json": components["schemas"]["CreateResourceResponse"];
1575
1575
  };
1576
1576
  };
1577
- /** @description Missing required fields (name, file, or format) */
1577
+ /** @description Missing required fields (name, file, format, or storageUri), or the format's base MIME type is not a SupportedMediaType. The error message names the offending type. */
1578
1578
  400: {
1579
1579
  headers: {
1580
1580
  [name: string]: unknown;
@@ -1608,20 +1608,17 @@ interface paths {
1608
1608
  cookie?: never;
1609
1609
  };
1610
1610
  /**
1611
- * Get a resource (content-negotiated)
1612
- * @description Content negotiation via the Accept header:
1613
- * - application/ld+json (default) — returns JSON-LD metadata including all annotations + inbound entity references
1614
- * - text/* or image/* or application/pdf — returns the raw representation bytes
1611
+ * Get a resource's stored representation (the pipe)
1612
+ * @description Returns the stored representation's bytes, verbatim, with the stored media type in Content-Type (`application/octet-stream` when the stored metadata carries none). The Accept header is never read: there is no content negotiation and no transcoding, so the served bytes always hash to the representation's registered checksum.
1615
1613
  *
1616
- * Binary payloads flow directly from the content store; metadata payloads go through the bus gateway.
1614
+ * The resource's JSON-LD description (descriptor + annotations + inbound entity references) lives at GET /resources/{id}/jsonld; every content response advertises it via a `Link: rel="describedby"` header.
1615
+ *
1616
+ * Content is immutable (checksum-addressed), and this route is bearer-authenticated, so responses carry `Cache-Control: private, max-age=31536000, immutable`.
1617
1617
  */
1618
1618
  get: {
1619
1619
  parameters: {
1620
1620
  query?: never;
1621
- header?: {
1622
- /** @description application/ld+json for metadata, or a text/image/pdf media type for raw content */
1623
- Accept?: string;
1624
- };
1621
+ header?: never;
1625
1622
  path: {
1626
1623
  id: string;
1627
1624
  };
@@ -1629,21 +1626,18 @@ interface paths {
1629
1626
  };
1630
1627
  requestBody?: never;
1631
1628
  responses: {
1632
- /** @description Resource content or metadata, depending on Accept */
1629
+ /** @description The stored representation's bytes, verbatim */
1633
1630
  200: {
1634
1631
  headers: {
1632
+ /** @description `</resources/{id}/jsonld>; rel="describedby"; type="application/ld+json"` — where to dereference the resource's JSON-LD description */
1633
+ Link?: string;
1635
1634
  [name: string]: unknown;
1636
1635
  };
1637
1636
  content: {
1638
- "application/ld+json": components["schemas"]["GetResourceResponse"];
1639
- "text/plain": string;
1640
- "text/markdown": string;
1641
- "text/html": string;
1642
- "image/*": string;
1643
- "application/pdf": string;
1637
+ "*/*": string;
1644
1638
  };
1645
1639
  };
1646
- /** @description Resource not found */
1640
+ /** @description Resource or representation not found */
1647
1641
  404: {
1648
1642
  headers: {
1649
1643
  [name: string]: unknown;
@@ -1661,6 +1655,58 @@ interface paths {
1661
1655
  "application/json": components["schemas"]["ErrorResponse"];
1662
1656
  };
1663
1657
  };
1658
+ };
1659
+ };
1660
+ put?: never;
1661
+ post?: never;
1662
+ delete?: never;
1663
+ options?: never;
1664
+ head?: never;
1665
+ patch?: never;
1666
+ trace?: never;
1667
+ };
1668
+ "/resources/{id}/jsonld": {
1669
+ parameters: {
1670
+ query?: never;
1671
+ header?: never;
1672
+ path?: never;
1673
+ cookie?: never;
1674
+ };
1675
+ /**
1676
+ * Get a resource's JSON-LD description
1677
+ * @description The dereferenceable linked-data description of the resource: its descriptor plus all annotations and inbound entity references, assembled via the bus gateway. This is the target of the `Link: rel="describedby"` header that GET /resources/{id} sends with every content response.
1678
+ *
1679
+ * Live data — annotations and references change — so responses carry `Cache-Control: no-cache`, in contrast to the immutable content at GET /resources/{id}.
1680
+ */
1681
+ get: {
1682
+ parameters: {
1683
+ query?: never;
1684
+ header?: never;
1685
+ path: {
1686
+ id: string;
1687
+ };
1688
+ cookie?: never;
1689
+ };
1690
+ requestBody?: never;
1691
+ responses: {
1692
+ /** @description The resource's JSON-LD description */
1693
+ 200: {
1694
+ headers: {
1695
+ [name: string]: unknown;
1696
+ };
1697
+ content: {
1698
+ "application/ld+json": components["schemas"]["GetResourceResponse"];
1699
+ };
1700
+ };
1701
+ /** @description Resource not found */
1702
+ 404: {
1703
+ headers: {
1704
+ [name: string]: unknown;
1705
+ };
1706
+ content: {
1707
+ "application/json": components["schemas"]["ErrorResponse"];
1708
+ };
1709
+ };
1664
1710
  /** @description Request timed out (bus gateway) */
1665
1711
  504: {
1666
1712
  headers: {
@@ -1688,10 +1734,10 @@ interface paths {
1688
1734
  cookie?: never;
1689
1735
  };
1690
1736
  /**
1691
- * Get raw resource content (browser-friendly alias)
1692
- * @description Browser-friendly alternative to GET /resources/{id} that always returns the raw representation, never JSON-LD. Used by `<img>` / PDF.js / `<video>` tags and anywhere an httpOnly cookie is the only feasible auth vector. Behaves like GET /resources/{id} with JSON-LD stripped from the Accept header before content negotiation.
1737
+ * Get a resource's stored representation (browser-friendly alias)
1738
+ * @description Identical pipe to GET /resources/{id} verbatim bytes, stored media type in Content-Type, Accept never read. Exists only as the auth affordance for `<img>` / PDF.js / download links, which cannot carry Authorization headers: the `?token=` media token or the httpOnly semiont-token cookie ride along automatically.
1693
1739
  *
1694
- * Sets long-lived immutable Cache-Control (content is addressed by checksum upstream, so bytes never change for a given resource id).
1740
+ * Responses carry `Cache-Control: public, max-age=31536000, immutable` — `public` is safe here, unlike the bearer-authenticated main route, because the `?token=` is part of the cache key.
1695
1741
  */
1696
1742
  get: {
1697
1743
  parameters: {
@@ -1704,17 +1750,15 @@ interface paths {
1704
1750
  };
1705
1751
  requestBody?: never;
1706
1752
  responses: {
1707
- /** @description Raw representation bytes with appropriate Content-Type */
1753
+ /** @description The stored representation's bytes, verbatim */
1708
1754
  200: {
1709
1755
  headers: {
1756
+ /** @description `</resources/{id}/jsonld>; rel="describedby"; type="application/ld+json"` — where to dereference the resource's JSON-LD description */
1757
+ Link?: string;
1710
1758
  [name: string]: unknown;
1711
1759
  };
1712
1760
  content: {
1713
- "text/plain": string;
1714
- "text/markdown": string;
1715
- "text/html": string;
1716
- "image/*": string;
1717
- "application/pdf": string;
1761
+ "*/*": string;
1718
1762
  };
1719
1763
  };
1720
1764
  /** @description Resource or representation not found */
@@ -1895,22 +1939,10 @@ interface components {
1895
1939
  targetResource?: components["schemas"]["ResourceDescriptor"] | null;
1896
1940
  /** @description Gathered context for this annotation */
1897
1941
  context?: components["schemas"]["GatheredContext"];
1898
- /** @description DEPRECATED: Use 'context' instead. Legacy source context format. */
1899
- sourceContext?: {
1900
- before: string;
1901
- selected: string;
1902
- after: string;
1903
- };
1904
1942
  targetContext?: {
1905
1943
  content: string;
1906
1944
  summary?: string;
1907
1945
  };
1908
- suggestedResolution?: {
1909
- resourceId: string;
1910
- resourceName: string;
1911
- confidence: number;
1912
- reasoning: string;
1913
- };
1914
1946
  };
1915
1947
  /** @description W3C Web Annotation target object - source is required, selector is optional */
1916
1948
  AnnotationTarget: {
@@ -2059,10 +2091,15 @@ interface components {
2059
2091
  details?: string;
2060
2092
  };
2061
2093
  /**
2062
- * @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
2094
+ * @description Content format as a MIME type, optionally with parameters. The base type (everything before the first ';') MUST be a SupportedMediaType; parameters such as charset are preserved as metadata. Semantic validation happens in code at the create/yield boundary — there is deliberately no pattern here, the vocabulary lives in SupportedMediaType. Examples: text/plain, text/plain; charset=iso-8859-1, text/markdown; charset=windows-1252, image/png, application/pdf
2063
2095
  * @example text/plain; charset=utf-8
2064
2096
  */
2065
2097
  ContentFormat: string;
2098
+ /**
2099
+ * @description Base MIME types (no parameters) admitted by Semiont. Membership is the create/yield gate — every member is storable, nameable, and uploadable. What more the system can do with a type (render, annotate, extract text, author) is curated per type in @semiont/core's media-type registry, which is keyed by this enum.
2100
+ * @enum {string}
2101
+ */
2102
+ SupportedMediaType: "text/plain" | "text/markdown" | "text/html" | "text/css" | "text/csv" | "text/xml" | "application/json" | "application/xml" | "application/yaml" | "application/x-yaml" | "application/pdf" | "application/msword" | "application/vnd.openxmlformats-officedocument.wordprocessingml.document" | "application/vnd.ms-excel" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "application/vnd.ms-powerpoint" | "application/vnd.openxmlformats-officedocument.presentationml.presentation" | "application/zip" | "application/gzip" | "application/x-tar" | "application/x-7z-compressed" | "application/octet-stream" | "application/wasm" | "image/png" | "image/jpeg" | "image/gif" | "image/webp" | "image/svg+xml" | "image/bmp" | "image/tiff" | "image/x-icon" | "video/mp4" | "video/mpeg" | "video/webm" | "video/ogg" | "video/quicktime" | "video/x-msvideo" | "audio/mpeg" | "audio/wav" | "audio/ogg" | "audio/webm" | "audio/aac" | "audio/flac" | "text/javascript" | "application/javascript" | "text/x-typescript" | "application/typescript" | "text/x-python" | "text/x-java" | "text/x-c" | "text/x-c++" | "text/x-csharp" | "text/x-go" | "text/x-rust" | "text/x-ruby" | "text/x-php" | "text/x-swift" | "text/x-kotlin" | "text/x-shell" | "font/woff" | "font/woff2" | "font/ttf" | "font/otf";
2066
2103
  ContextualSummaryResponse: {
2067
2104
  summary: string;
2068
2105
  relevantFields: {
@@ -2142,8 +2179,6 @@ interface components {
2142
2179
  EventMetadata: {
2143
2180
  /** @description Monotonic position in the event log (ordering authority) */
2144
2181
  sequenceNumber: number;
2145
- /** @description Byte offset in the JSONL file */
2146
- streamPosition: number;
2147
2182
  /** @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. */
2148
2183
  correlationId?: string;
2149
2184
  };
@@ -3591,7 +3626,7 @@ declare function resourceAnnotationUri(uri: string): ResourceAnnotationUri;
3591
3626
  * These types prevent mixing up resource IDs, annotation IDs, and user IDs
3592
3627
  * at compile time while having zero runtime overhead.
3593
3628
  *
3594
- * URI types (ResourceUri, AnnotationUri) are in @semiont/api-client
3629
+ * URI types (ResourceUri, AnnotationUri) are in @semiont/http-transport
3595
3630
  * since they deal with HTTP URIs returned by the API.
3596
3631
  */
3597
3632
  type ResourceId = string & {
@@ -3619,7 +3654,7 @@ type RawAnnotation = components['schemas']['Annotation'];
3619
3654
  * `components['schemas']['Annotation']`, but with a branded `AnnotationId`
3620
3655
  * for the `id` field. Use this import everywhere the codebase refers to
3621
3656
  * "an annotation"; the raw OpenAPI type is only used inside
3622
- * `@semiont/api-client` at the HTTP boundary.
3657
+ * `@semiont/http-transport` at the HTTP boundary.
3623
3658
  *
3624
3659
  * Implemented by intersection (not `Omit`) to be robust against generator
3625
3660
  * drift — if the OpenAPI schema gets `additionalProperties: true` added,
@@ -3681,7 +3716,7 @@ interface EntityTypeStats {
3681
3716
  /**
3682
3717
  * Persisted Events
3683
3718
  *
3684
- * The 18 event types that get appended to the JSONL event log.
3719
+ * The event types that get appended to the JSONL event log.
3685
3720
  * Each maps a type string to its OpenAPI payload schema.
3686
3721
  * The PersistedEvent union derives from this catalog.
3687
3722
  */
@@ -3731,7 +3766,7 @@ type EventOfType<K extends keyof PersistedEventCatalog> = K extends SystemEventT
3731
3766
  resourceId: ResourceId;
3732
3767
  payload: PersistedEventCatalog[K];
3733
3768
  };
3734
- /** The union of all 20 persisted event types. Discriminated on `type`. */
3769
+ /** The union of all persisted event types. Discriminated on `type`. */
3735
3770
  type PersistedEvent = {
3736
3771
  [K in keyof PersistedEventCatalog]: EventOfType<K>;
3737
3772
  }[keyof PersistedEventCatalog];
@@ -5084,7 +5119,7 @@ declare function decodeRepresentation(buffer: Buffer, mediaType: string): string
5084
5119
  * Common error classes — the unified Semiont error hierarchy.
5085
5120
  *
5086
5121
  * `SemiontError` is the base every other Semiont error class extends:
5087
- * `APIError` (api-client), `BusRequestError` and `SemiontSessionError` (sdk),
5122
+ * `APIError` (http-transport), `BusRequestError` and `SemiontSessionError` (sdk),
5088
5123
  * `ValidationError`, `ScriptError`, `NotFoundError`, `UnauthorizedError`,
5089
5124
  * `ConflictError` (here), and `AWSError` (cli). Subclasses tighten the
5090
5125
  * `code` field to a literal-union for discriminated handling.
@@ -5132,7 +5167,7 @@ declare class ConflictError extends SemiontError {
5132
5167
  * Transport interfaces — the shared contract for any wire-or-local
5133
5168
  * communication path consumed by `SemiontClient`. Concrete implementations
5134
5169
  * live alongside the runtime they wrap (`HttpTransport` in
5135
- * `@semiont/api-client`, in-process variants in `@semiont/make-meaning`,
5170
+ * `@semiont/http-transport`, in-process variants in `@semiont/make-meaning`,
5136
5171
  * etc.).
5137
5172
  *
5138
5173
  * Three interfaces:
@@ -5153,6 +5188,7 @@ declare class ConflictError extends SemiontError {
5153
5188
  */
5154
5189
 
5155
5190
  type Agent$1 = components['schemas']['Agent'];
5191
+ type GetResourceResponse = components['schemas']['GetResourceResponse'];
5156
5192
  /**
5157
5193
  * Six-state lifecycle for a transport's connection. Drives UI affordances
5158
5194
  * (connecting spinners, reconnecting banners, etc.) and is observed via
@@ -5342,7 +5378,7 @@ interface IBackendOperations {
5342
5378
  interface PutBinaryRequest {
5343
5379
  name: string;
5344
5380
  file: File | Buffer;
5345
- format: ContentFormat | string;
5381
+ format: ContentFormat;
5346
5382
  storageUri: string;
5347
5383
  entityTypes?: string[];
5348
5384
  language?: string;
@@ -5385,19 +5421,27 @@ interface IContentTransport {
5385
5421
  resourceId: ResourceId;
5386
5422
  }>;
5387
5423
  getBinary(resourceId: ResourceId, options?: {
5388
- accept?: ContentFormat | string;
5389
5424
  auth?: AccessToken;
5390
5425
  }): Promise<{
5391
5426
  data: ArrayBuffer;
5392
5427
  contentType: string;
5393
5428
  }>;
5394
5429
  getBinaryStream(resourceId: ResourceId, options?: {
5395
- accept?: ContentFormat | string;
5396
5430
  auth?: AccessToken;
5397
5431
  }): Promise<{
5398
5432
  stream: ReadableStream<Uint8Array>;
5399
5433
  contentType: string;
5400
5434
  }>;
5435
+ /**
5436
+ * Fetch the resource's JSON-LD metadata graph (descriptor + annotations +
5437
+ * inbound entity references). The HTTP transport dereferences
5438
+ * `GET /resources/:id/jsonld` (the LD face an external linked-data client
5439
+ * sees); in-process transports assemble it from their `KnowledgeSystem`.
5440
+ * See `.plans/SIMPLER-JSON-LD.md` §5 / decision 7.
5441
+ */
5442
+ getResourceGraph(resourceId: ResourceId, options?: {
5443
+ auth?: AccessToken;
5444
+ }): Promise<GetResourceResponse>;
5401
5445
  dispose(): void;
5402
5446
  }
5403
5447
 
@@ -5759,7 +5803,7 @@ declare function extractCharset(mediaType: string): string;
5759
5803
  declare function decodeWithCharset(buffer: ArrayBuffer, mediaType: string): string;
5760
5804
 
5761
5805
  /**
5762
- * Generic validation utilities for @semiont/api-client
5806
+ * Generic validation utilities for @semiont/http-transport
5763
5807
  *
5764
5808
  * Pure TypeScript validation with no external dependencies.
5765
5809
  * Safe to use in any JavaScript environment (Node.js, browser, Deno, etc.)
@@ -5816,42 +5860,215 @@ declare function validateData<T>(schema: {
5816
5860
  declare function isValidEmail(email: string): boolean;
5817
5861
 
5818
5862
  /**
5819
- * MIME type utilities for Semiont
5863
+ * Media-type registry for Semiont
5820
5864
  *
5821
- * Initial support for:
5822
- * - text/plain
5823
- * - text/markdown
5824
- * - image/png
5825
- * - image/jpeg
5826
- * - application/pdf
5865
+ * One supported-types list, capability-tiered, keyed by the spec's
5866
+ * SupportedMediaType enum. Admission (registry membership) is the
5867
+ * create/yield gate: every member is storable, nameable, and uploadable.
5868
+ * The curated capabilities say what more the system can do with a type:
5869
+ *
5870
+ * - `render` — which viewer the UI mounts ('none' → metadata + download)
5871
+ * - `anchoring` — which annotation model applies: character-offset text
5872
+ * selectors vs spatial geometry (PDFs are spatial)
5873
+ * - `extractText` — how the Smelter gets embeddable text ('none' → skip
5874
+ * embedding, never mojibake)
5875
+ * - `authorable` — offered in the compose editor's format dropdown
5876
+ * - `uploadable` — big tent: true for every registry member
5877
+ *
5878
+ * Capabilities are orthogonal strategies, not a ladder: images render but
5879
+ * yield no text; PDFs yield text but aren't authorable. A "tier" is a
5880
+ * derived reading, not a stored fact.
5881
+ *
5882
+ * Import-leniency invariant: restore/import preserves archive mediaTypes
5883
+ * verbatim, so "every stored mediaType is registry-valid" holds only for
5884
+ * content that entered through the validated create/yield gate. No code
5885
+ * reading a stored mediaType may assume `capabilitiesOf()` succeeds — the
5886
+ * `undefined` branch is mandatory wherever stored types are read.
5827
5887
  */
5888
+
5889
+ type SupportedMediaType = components['schemas']['SupportedMediaType'];
5890
+ type RenderMode = 'text' | 'image' | 'pdf' | 'none';
5891
+ type AnchoringModel = 'text-selector' | 'spatial' | 'none';
5892
+ type TextExtraction = 'decode' | 'pdf-text-layer' | 'none';
5893
+ interface MediaTypeCapabilities {
5894
+ /** Canonical file extension, with leading dot. */
5895
+ extension: `.${string}`;
5896
+ /** UI display name. */
5897
+ label: string;
5898
+ render: RenderMode;
5899
+ anchoring: AnchoringModel;
5900
+ extractText: TextExtraction;
5901
+ authorable: boolean;
5902
+ uploadable: boolean;
5903
+ }
5828
5904
  /**
5829
- * Map MIME type to file extension
5905
+ * The registry. `satisfies Record<SupportedMediaType, …>` is the
5906
+ * drift-lock: adding a type to the spec enum without a capabilities row
5907
+ * (or vice versa) is a compile error.
5908
+ *
5909
+ * Row order matters for `mediaTypeForExtension`: extension collisions
5910
+ * (.xml, .yaml, .js, .ts, .webm) resolve to the first row declaring the
5911
+ * extension.
5912
+ */
5913
+ declare const MEDIA_TYPES: {
5914
+ 'text/markdown': {
5915
+ extension: ".md";
5916
+ label: string;
5917
+ render: "text";
5918
+ anchoring: "text-selector";
5919
+ extractText: "decode";
5920
+ authorable: true;
5921
+ uploadable: true;
5922
+ };
5923
+ 'text/plain': {
5924
+ extension: ".txt";
5925
+ label: string;
5926
+ render: "text";
5927
+ anchoring: "text-selector";
5928
+ extractText: "decode";
5929
+ authorable: true;
5930
+ uploadable: true;
5931
+ };
5932
+ 'text/html': {
5933
+ extension: ".html";
5934
+ label: string;
5935
+ render: "text";
5936
+ anchoring: "text-selector";
5937
+ extractText: "decode";
5938
+ authorable: true;
5939
+ uploadable: true;
5940
+ };
5941
+ 'application/json': {
5942
+ extension: ".json";
5943
+ label: string;
5944
+ render: "text";
5945
+ anchoring: "text-selector";
5946
+ extractText: "decode";
5947
+ authorable: false;
5948
+ uploadable: true;
5949
+ };
5950
+ 'image/png': {
5951
+ extension: ".png";
5952
+ label: string;
5953
+ render: "image";
5954
+ anchoring: "spatial";
5955
+ extractText: "none";
5956
+ authorable: false;
5957
+ uploadable: true;
5958
+ };
5959
+ 'image/jpeg': {
5960
+ extension: ".jpg";
5961
+ label: string;
5962
+ render: "image";
5963
+ anchoring: "spatial";
5964
+ extractText: "none";
5965
+ authorable: false;
5966
+ uploadable: true;
5967
+ };
5968
+ 'application/pdf': {
5969
+ extension: ".pdf";
5970
+ label: string;
5971
+ render: "pdf";
5972
+ anchoring: "spatial";
5973
+ extractText: "pdf-text-layer";
5974
+ authorable: false;
5975
+ uploadable: true;
5976
+ };
5977
+ 'text/css': MediaTypeCapabilities;
5978
+ 'text/csv': MediaTypeCapabilities;
5979
+ 'text/xml': MediaTypeCapabilities;
5980
+ 'application/xml': MediaTypeCapabilities;
5981
+ 'application/yaml': MediaTypeCapabilities;
5982
+ 'application/x-yaml': MediaTypeCapabilities;
5983
+ 'text/javascript': MediaTypeCapabilities;
5984
+ 'application/javascript': MediaTypeCapabilities;
5985
+ 'text/x-typescript': MediaTypeCapabilities;
5986
+ 'application/typescript': MediaTypeCapabilities;
5987
+ 'text/x-python': MediaTypeCapabilities;
5988
+ 'text/x-java': MediaTypeCapabilities;
5989
+ 'text/x-c': MediaTypeCapabilities;
5990
+ 'text/x-c++': MediaTypeCapabilities;
5991
+ 'text/x-csharp': MediaTypeCapabilities;
5992
+ 'text/x-go': MediaTypeCapabilities;
5993
+ 'text/x-rust': MediaTypeCapabilities;
5994
+ 'text/x-ruby': MediaTypeCapabilities;
5995
+ 'text/x-php': MediaTypeCapabilities;
5996
+ 'text/x-swift': MediaTypeCapabilities;
5997
+ 'text/x-kotlin': MediaTypeCapabilities;
5998
+ 'text/x-shell': MediaTypeCapabilities;
5999
+ 'application/msword': MediaTypeCapabilities;
6000
+ 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': MediaTypeCapabilities;
6001
+ 'application/vnd.ms-excel': MediaTypeCapabilities;
6002
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': MediaTypeCapabilities;
6003
+ 'application/vnd.ms-powerpoint': MediaTypeCapabilities;
6004
+ 'application/vnd.openxmlformats-officedocument.presentationml.presentation': MediaTypeCapabilities;
6005
+ 'application/zip': MediaTypeCapabilities;
6006
+ 'application/gzip': MediaTypeCapabilities;
6007
+ 'application/x-tar': MediaTypeCapabilities;
6008
+ 'application/x-7z-compressed': MediaTypeCapabilities;
6009
+ 'application/octet-stream': MediaTypeCapabilities;
6010
+ 'application/wasm': MediaTypeCapabilities;
6011
+ 'image/gif': MediaTypeCapabilities;
6012
+ 'image/webp': MediaTypeCapabilities;
6013
+ 'image/svg+xml': MediaTypeCapabilities;
6014
+ 'image/bmp': MediaTypeCapabilities;
6015
+ 'image/tiff': MediaTypeCapabilities;
6016
+ 'image/x-icon': MediaTypeCapabilities;
6017
+ 'video/mp4': MediaTypeCapabilities;
6018
+ 'video/mpeg': MediaTypeCapabilities;
6019
+ 'video/webm': MediaTypeCapabilities;
6020
+ 'video/ogg': MediaTypeCapabilities;
6021
+ 'video/quicktime': MediaTypeCapabilities;
6022
+ 'video/x-msvideo': MediaTypeCapabilities;
6023
+ 'audio/mpeg': MediaTypeCapabilities;
6024
+ 'audio/wav': MediaTypeCapabilities;
6025
+ 'audio/ogg': MediaTypeCapabilities;
6026
+ 'audio/webm': MediaTypeCapabilities;
6027
+ 'audio/aac': MediaTypeCapabilities;
6028
+ 'audio/flac': MediaTypeCapabilities;
6029
+ 'font/woff': MediaTypeCapabilities;
6030
+ 'font/woff2': MediaTypeCapabilities;
6031
+ 'font/ttf': MediaTypeCapabilities;
6032
+ 'font/otf': MediaTypeCapabilities;
6033
+ };
6034
+ /**
6035
+ * Strip parameters ("; charset=...") and normalize case.
6036
+ * Replaces the inline `split(';')[0]` sites across the codebase.
5830
6037
  */
5831
- declare function getExtensionForMimeType(mimeType: string): string;
6038
+ declare function baseMediaType(format: string): string;
5832
6039
  /**
5833
- * Detect if MIME type is an image (png or jpeg only for now)
6040
+ * Registry membership the admission gate. Exact match: callers pass a
6041
+ * base type (see `baseMediaType`); strings carrying parameters are not
6042
+ * members.
5834
6043
  */
5835
- declare function isImageMimeType(mimeType: string): boolean;
6044
+ declare function isSupportedMediaType(format: string): format is SupportedMediaType;
6045
+ /** Capabilities for a format (parameters tolerated), or undefined on registry miss. */
6046
+ declare function capabilitiesOf(format: string): MediaTypeCapabilities | undefined;
5836
6047
  /**
5837
- * Detect if MIME type is text-based (plain or markdown only for now)
6048
+ * Lenient extension lookup for naming foreign/imported content: '.dat' on
6049
+ * registry miss. Exporters use this — a vocabulary change must never
6050
+ * refuse to name restored data.
5838
6051
  */
5839
- declare function isTextMimeType(mimeType: string): boolean;
6052
+ declare function extensionForMediaType(format: string): string;
5840
6053
  /**
5841
- * Detect if MIME type is PDF
6054
+ * Inverted registry: extension → media type, for the CLI and the upload
6055
+ * detection chain. Accepts 'md' or '.md', any case, and common alternate
6056
+ * spellings. Returns undefined for unknown extensions — detection chains
6057
+ * fall back to 'application/octet-stream' themselves.
5842
6058
  */
5843
- declare function isPdfMimeType(mimeType: string): boolean;
6059
+ declare function mediaTypeForExtension(ext: string): SupportedMediaType | undefined;
5844
6060
  /**
5845
- * Get category for MIME type (for routing to appropriate viewer)
5846
- *
5847
- * Categories represent annotation models, not file formats:
5848
- * - 'text': Text-based annotations (TextPositionSelector, TextQuoteSelector)
5849
- * - 'image': Spatial coordinate annotations (SvgSelector, FragmentSelector)
5850
- *
5851
- * PDFs use spatial coordinates for annotations, so they belong to 'image' category.
6061
+ * The Smelter's gate: how to get embeddable text from a format. Registry
6062
+ * rows answer directly; on a registry miss, base types under text/* decode
6063
+ * (RFC 2046 guarantees the text top-level type is textual — imported
6064
+ * unregistered text subtypes embed too), everything else is 'none'.
5852
6065
  */
5853
- type MimeCategory = 'text' | 'image' | 'unsupported';
5854
- declare function getMimeCategory(mimeType: string): MimeCategory;
6066
+ declare function textExtractionOf(format: string): TextExtraction;
6067
+ /** Types offered in the compose editor's format dropdown. */
6068
+ declare const AUTHORABLE_MEDIA_TYPES: readonly SupportedMediaType[];
6069
+ /** Registry rows whose text the Smelter can extract. Rows only — the
6070
+ * text/* fallback in `textExtractionOf` isn't enumerable. */
6071
+ declare const EMBEDDABLE_MEDIA_TYPES: readonly SupportedMediaType[];
5855
6072
 
5856
6073
  /**
5857
6074
  * Resource input/output types
@@ -6714,15 +6931,5 @@ declare function isValidPlatformType(value: string): value is PlatformType;
6714
6931
  */
6715
6932
  declare function getAllPlatformTypes(): PlatformType[];
6716
6933
 
6717
- /**
6718
- * @semiont/core
6719
- *
6720
- * Core domain logic and utilities for the Semiont semantic knowledge platform.
6721
- * OpenAPI types are generated here and exported for use across the monorepo.
6722
- */
6723
-
6724
- declare const CORE_TYPES_VERSION = "0.1.0";
6725
- declare const SDK_VERSION = "0.1.0";
6726
-
6727
- export { BRIDGED_CHANNELS, CHANNEL_SCHEMAS, CONTEXT_FULL_WEIGHT, CONTEXT_PARTIAL_WEIGHT, CORE_TYPES_VERSION, ConfigurationError, ConflictError, EventBus, JWTTokenSchema, LOCALES, NotFoundError, PERSISTED_EVENT_TYPES, POSITION_WEIGHT_MAX, POSITION_WINDOW, RESOURCE_BROADCAST_TYPES, SDK_VERSION, ScopedEventBus, ScriptError, SemiontError, UnauthorizedError, ValidationError, accessToken, agentToDid, anchorAnnotation, annotationId, annotationUri, applyBodyOperations, assembleAnnotation, authCode, baseUrl, buildContentCache, burstBuffer, busLog, busLogEnabled, cloneToken, createCircleSvg, createFragmentSelector, createPolygonSvg, createRectangleSvg, createTomlConfigLoader, decodeRepresentation, decodeWithCharset, didToAgent, email, entityType, errField, extractBoundingBox, extractCharset, extractContext, findBestTextMatch, findBodyItem, formatLocaleDisplay, generateUuid, getAllLocaleCodes, getAllPlatformTypes, getAnnotationExactText, getAnnotationUriFromEvent, getBodySource, getBodyType, getChecksum, getCommentText, getCreator, getDerivedFrom, getExactText, getExtensionForMimeType, getFragmentSelector, getLanguage, getLocaleEnglishName, getLocaleInfo, getLocaleNativeName, getMimeCategory, getNodeEncoding, getPageFromFragment, getPrimaryMediaType, getPrimaryRepresentation, getPrimarySelector, getResourceEntityTypes, getResourceId, getStorageUri, getSvgSelector, getTargetSelector, getTargetSource, getTextPositionSelector, getTextQuoteSelector, googleCredential, hasTargetSelector, isAnnotationId, isArchived, isArray, isAssessment, isBodyResolved, isBoolean, isComment, isDefined, isDraft, isEventRelatedToAnnotation, isFunction, isHighlight, isImageMimeType, isNull, isNullish, isNumber, isObject, isPdfMimeType, isReference, isResolvedReference, isResourceId, isStoredEvent, isString, isStubReference, isTag, isTextMimeType, isUndefined, isValidEmail, isValidPlatformType, jobId, loadTomlConfig, mcpToken, normalizeCoordinates, normalizeText, parseEnvironment, parseFragmentSelector, parseSvgSelector, reconcileSelector, refreshToken, resourceAnnotationUri, resourceId, resourceUri, scaleSvgToNative, searchQuery, serializePerKey, setBusLogTraceIdProvider, softwareToAgent, userDID, userId, userToAgent, userToDid, validateData, validateEnvironment, validateSvgMarkup, verifyPosition };
6728
- export type { AccessToken, AnchorConfidence, AnchorMethod, AnchorSelectors, AnchorStrategy, Annotation, AnnotationCategory, AnnotationId, AnnotationUri, AnthropicProviderConfig, AppConfig, AssembledAnnotation, AuthCode, BackendDownload, BackendServiceConfig, BaseUrl, BodyItem, BodyItemIdentity, BodyOperation, BoundingBox, Brand, BridgedChannel, BurstBufferOptions, BusOp, CloneToken, ConnectionState, ContentCache, ContentFormat, CreateAnnotationInternal, DatabaseServiceConfig, Email, EmbeddingServiceConfig, EmittableChannel, EntityType, EntityTypeStats, Environment, EnvironmentConfig, EventBase, EventInput, EventMap, EventMetadata, EventName, EventOfType, EventQuery, EventSignature, FragmentSelector, FrontendServiceConfig, GatheredContext, GoogleAuthRequest, GoogleCredential, GraphConnection, GraphDatabaseType, GraphPath, GraphServiceConfig, HealthCheckResponse, IBackendOperations, IContentTransport, ITransport, InferenceProvidersConfig, JobId, ListUsersResponse, LlmSelectorInput, LocaleInfo, Logger, MCPToken, MatchQuality, McpServiceConfig, MimeCategory, Motivation, OllamaProviderConfig, PdfCoordinate, PersistedEvent, PersistedEventType, PlatformType, Point, ProgressCallback, ProgressEvent, PutBinaryOptions, PutBinaryProgress, PutBinaryRequest, ReconciledSelector, RefreshToken, RenderedAnchor, ResourceAnnotationUri, ResourceAnnotations, ResourceBroadcastType, ResourceDescriptor, ResourceFilter, ResourceId, ResourceUri, SearchQuery, SelectionData, Selector, SemiontConfig, ServicePlatformConfig, ServicesConfig, SiteConfig, StatusResponse, StoredEvent, StoredEventLike, SvgSelector, TagCategory, TagSchema, TextPosition, TextPositionSelector, TextQuoteSelector, ActorInferenceConfig as TomlActorInferenceConfig, TomlFileReader, InferenceConfig as TomlInferenceConfig, WorkerInferenceConfig as TomlWorkerInferenceConfig, TransportErrorCode, UpdateResourceInput, UpdateUserRequest, UpdateUserResponse, UserDID, UserId, UserResponse, ValidationFailure, ValidationResult, ValidationSuccess, VectorsServiceConfig, components, operations, paths };
6934
+ export { AUTHORABLE_MEDIA_TYPES, BRIDGED_CHANNELS, CHANNEL_SCHEMAS, CONTEXT_FULL_WEIGHT, CONTEXT_PARTIAL_WEIGHT, ConfigurationError, ConflictError, EMBEDDABLE_MEDIA_TYPES, EventBus, JWTTokenSchema, LOCALES, MEDIA_TYPES, NotFoundError, PERSISTED_EVENT_TYPES, POSITION_WEIGHT_MAX, POSITION_WINDOW, RESOURCE_BROADCAST_TYPES, ScopedEventBus, ScriptError, SemiontError, UnauthorizedError, ValidationError, accessToken, agentToDid, anchorAnnotation, annotationId, annotationUri, applyBodyOperations, assembleAnnotation, authCode, baseMediaType, baseUrl, buildContentCache, burstBuffer, busLog, busLogEnabled, capabilitiesOf, cloneToken, createCircleSvg, createFragmentSelector, createPolygonSvg, createRectangleSvg, createTomlConfigLoader, decodeRepresentation, decodeWithCharset, didToAgent, email, entityType, errField, extensionForMediaType, extractBoundingBox, extractCharset, extractContext, findBestTextMatch, findBodyItem, formatLocaleDisplay, generateUuid, getAllLocaleCodes, getAllPlatformTypes, getAnnotationExactText, getAnnotationUriFromEvent, getBodySource, getBodyType, getChecksum, getCommentText, getCreator, getDerivedFrom, getExactText, getFragmentSelector, getLanguage, getLocaleEnglishName, getLocaleInfo, getLocaleNativeName, getNodeEncoding, getPageFromFragment, getPrimaryMediaType, getPrimaryRepresentation, getPrimarySelector, getResourceEntityTypes, getResourceId, getStorageUri, getSvgSelector, getTargetSelector, getTargetSource, getTextPositionSelector, getTextQuoteSelector, googleCredential, hasTargetSelector, isAnnotationId, isArchived, isArray, isAssessment, isBodyResolved, isBoolean, isComment, isDefined, isDraft, isEventRelatedToAnnotation, isFunction, isHighlight, isNull, isNullish, isNumber, isObject, isReference, isResolvedReference, isResourceId, isStoredEvent, isString, isStubReference, isSupportedMediaType, isTag, isUndefined, isValidEmail, isValidPlatformType, jobId, loadTomlConfig, mcpToken, mediaTypeForExtension, normalizeCoordinates, normalizeText, parseEnvironment, parseFragmentSelector, parseSvgSelector, reconcileSelector, refreshToken, resourceAnnotationUri, resourceId, resourceUri, scaleSvgToNative, searchQuery, serializePerKey, setBusLogTraceIdProvider, softwareToAgent, textExtractionOf, userDID, userId, userToAgent, userToDid, validateData, validateEnvironment, validateSvgMarkup, verifyPosition };
6935
+ export type { AccessToken, AnchorConfidence, AnchorMethod, AnchorSelectors, AnchorStrategy, AnchoringModel, Annotation, AnnotationCategory, AnnotationId, AnnotationUri, AnthropicProviderConfig, AppConfig, AssembledAnnotation, AuthCode, BackendDownload, BackendServiceConfig, BaseUrl, BodyItem, BodyItemIdentity, BodyOperation, BoundingBox, Brand, BridgedChannel, BurstBufferOptions, BusOp, CloneToken, ConnectionState, ContentCache, ContentFormat, CreateAnnotationInternal, DatabaseServiceConfig, Email, EmbeddingServiceConfig, EmittableChannel, EntityType, EntityTypeStats, Environment, EnvironmentConfig, EventBase, EventInput, EventMap, EventMetadata, EventName, EventOfType, EventQuery, EventSignature, FragmentSelector, FrontendServiceConfig, GatheredContext, GoogleAuthRequest, GoogleCredential, GraphConnection, GraphDatabaseType, GraphPath, GraphServiceConfig, HealthCheckResponse, IBackendOperations, IContentTransport, ITransport, InferenceProvidersConfig, JobId, ListUsersResponse, LlmSelectorInput, LocaleInfo, Logger, MCPToken, MatchQuality, McpServiceConfig, MediaTypeCapabilities, Motivation, OllamaProviderConfig, PdfCoordinate, PersistedEvent, PersistedEventType, PlatformType, Point, ProgressCallback, ProgressEvent, PutBinaryOptions, PutBinaryProgress, PutBinaryRequest, ReconciledSelector, RefreshToken, RenderMode, RenderedAnchor, ResourceAnnotationUri, ResourceAnnotations, ResourceBroadcastType, ResourceDescriptor, ResourceFilter, ResourceId, ResourceUri, SearchQuery, SelectionData, Selector, SemiontConfig, ServicePlatformConfig, ServicesConfig, SiteConfig, StatusResponse, StoredEvent, StoredEventLike, SupportedMediaType, SvgSelector, TagCategory, TagSchema, TextExtraction, TextPosition, TextPositionSelector, TextQuoteSelector, ActorInferenceConfig as TomlActorInferenceConfig, TomlFileReader, InferenceConfig as TomlInferenceConfig, WorkerInferenceConfig as TomlWorkerInferenceConfig, TransportErrorCode, UpdateResourceInput, UpdateUserRequest, UpdateUserResponse, UserDID, UserId, UserResponse, ValidationFailure, ValidationResult, ValidationSuccess, VectorsServiceConfig, components, operations, paths };