@happyvertical/smrt-content 0.60.18 → 0.61.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/AGENTS.md CHANGED
@@ -164,6 +164,8 @@ await content.getReferenceDrift(); // → [{ targetId, citedVersion, currentVer
164
164
 
165
165
  ## API Contracts
166
166
 
167
+ Public JSON serializer: [content-list](agents/content-list.md#public-content-serialization).
168
+
167
169
  `Content` implements `AssetAssociable` and `MetadataAccessor` (issue #1162). Consumers can type their parameters as `Content` (or the interfaces directly) and rely on the methods existing without `typeof === 'function'` defensive checks:
168
170
 
169
171
  ```typescript
@@ -226,3 +228,5 @@ The review and correction calls bind the tier through `prepareAiOperation()`.
226
228
  - **Tenant-local keys rollout (#3305 M1)**: `smrt db:migrate` adds `<table>_tenant_id_{email,key}_idx` and drops the superseded `<table>_{email,key}_idx` in one migration; rows are untouched (every row satisfies the wider key). Old code upserts on the old arbiter, so deploy the code and the migration together in a writer-drained window; reverting afterwards needs collision analysis, since tenants may then share a key
227
229
  - **Chat tables**: chat endpoint requires `@happyvertical/smrt-chat` tables; dev server handles missing tables gracefully
228
230
  - **Dev server bootstraps all classes**: `hooks.server.ts` generates schemas for all 13 local `@smrt()` classes plus cross-package manifests
231
+
232
+ Optional loading boundaries: [agents/optional-capabilities.md](agents/optional-capabilities.md).
@@ -276,3 +276,24 @@ byte budgeting. Objects hydrated from text columns become JSON strings and use
276
276
  the existing scalar shortening/warning path; JSON columns retain their document
277
277
  limits. Date-only and timezone-less datetime strings mean UTC, including facet
278
278
  buckets. Bigint values must remain safely representable as JavaScript numbers.
279
+
280
+ ## Public content serialization
281
+
282
+ `serializeContent` is exported from `@happyvertical/smrt-content`. It is the existing
283
+ `src/serialization.ts` implementation used by content's API adapters, not a second
284
+ serializer. Hosts whose generated manifest still names
285
+ `$lib/server/content-api-serializers` can forward this public export; they must not
286
+ import installed `src/` files. The host override module remains supported. A future
287
+ provider-default serializer reference with an explicit host override would remove
288
+ that compatibility forwarding file without breaking existing host customizations.
289
+
290
+ Reuse check: smrt-dev-mcp package review, intent index and `rg` serializeContent/
291
+ serialization/export searches in content, core, UI/Svelte/chat found the existing
292
+ implementation and its internal route wrapper; no public export existed. Only the
293
+ root export is added. No new component/helper/model implementation is introduced.
294
+
295
+ The default Content API item serializer imports `serializeContent` from the
296
+ public `@happyvertical/smrt-content` entry. Hosts need no forwarding module at
297
+ `$lib/server/content-api-serializers`. An app subclass can explicitly supply its
298
+ own `api.serializers.item` reference while retaining the provider's API exposure
299
+ restrictions; the normal serializer and inheritance contracts still apply.
@@ -0,0 +1,36 @@
1
+ # Optional content capabilities
2
+
3
+ Ordinary content import/CRUD must not eagerly load document extraction,
4
+ filesystem provider SDKs or map-provider caches. Contents.mirror,
5
+ Contents.writeContentFile and map-thumbnail generation load their capability
6
+ through core's existing importOptionalDependency. Existing mirror URL validation,
7
+ SSRF checks, cache options, export formatting and thumbnail behavior stay at the
8
+ same boundary; only the load occurs at use. This also keeps these SDK graphs out
9
+ of downstream server output rather than merely delaying their execution.
10
+
11
+ The existing collection/thumbnail suites retain their behavior assertions. The
12
+ bundle-gate consumer-content fixture exercises the published dist surface with
13
+ SSR noExternal and rejects document/browser extraction and messaging-provider
14
+ SDK resolution. sharp/resvg are runtime-native externals, matching real apps.
15
+
16
+ Reuse: intent index, smrt-dev-mcp content review, rg by name and purpose in core,
17
+ content, images, chat and UI found importOptionalDependency and the existing
18
+ consumer-boundary gate; no new production helper or file is introduced.
19
+
20
+ Headline-card rendering also imports the image SDK inside the existing async
21
+ thumbnail operation. Importing content models or using other thumbnail strategies
22
+ must not initialize that SDK or Sharp. `thumbnail-generator.test.ts` adds a
23
+ fresh-Node published-root guard (fails on the original build) and retains the
24
+ headline-card input/output, persistence and other-strategy tests. The guard
25
+ refuses both image SDK and Sharp resolution; the existing rendering tests verify
26
+ that first use still dispatches to the SDK. No new public API, component, helper,
27
+ model or persistence path is introduced. All runtimes supported by this Node-only
28
+ server operation keep its async signature; SQL dialect behavior is unchanged.
29
+
30
+ Content editor chat resolves the AI SDK only when an actual send needs the default
31
+ client. Its existing injected `getAIClient` seam short-circuits that import; model
32
+ selection and missing-configuration errors still run first. The published-root
33
+ startup guard also refuses the AI SDK root. Existing chat and image-generation
34
+ operation tests prove the SDK is still reachable at first use. Reuse: MCP content
35
+ review and exact `getAI`/client-acquisition searches found this async send seam;
36
+ no second provider selector, wrapper, helper or public signature is introduced.