@happyvertical/smrt-content 0.30.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 +194 -0
- package/CLAUDE.md +1 -0
- package/LICENSE +7 -0
- package/README.md +634 -0
- package/dist/__smrt-register__.d.ts +2 -0
- package/dist/__smrt-register__.d.ts.map +1 -0
- package/dist/asset-associable.d.ts +115 -0
- package/dist/asset-associable.d.ts.map +1 -0
- package/dist/body-format.d.ts +29 -0
- package/dist/body-format.d.ts.map +1 -0
- package/dist/body-format.js +604 -0
- package/dist/body-format.js.map +1 -0
- package/dist/content-asset.d.ts +17 -0
- package/dist/content-asset.d.ts.map +1 -0
- package/dist/content-assets.d.ts +10 -0
- package/dist/content-assets.d.ts.map +1 -0
- package/dist/content-chat-handlers.d.ts +115 -0
- package/dist/content-chat-handlers.d.ts.map +1 -0
- package/dist/content-chat-prompts.d.ts +3 -0
- package/dist/content-chat-prompts.d.ts.map +1 -0
- package/dist/content-chat-session.d.ts +26 -0
- package/dist/content-chat-session.d.ts.map +1 -0
- package/dist/content-contribution-attachment.d.ts +42 -0
- package/dist/content-contribution-attachment.d.ts.map +1 -0
- package/dist/content-contribution-attachments.d.ts +8 -0
- package/dist/content-contribution-attachments.d.ts.map +1 -0
- package/dist/content-contribution-config.d.ts +84 -0
- package/dist/content-contribution-config.d.ts.map +1 -0
- package/dist/content-contribution-revision.d.ts +38 -0
- package/dist/content-contribution-revision.d.ts.map +1 -0
- package/dist/content-contribution-revisions.d.ts +8 -0
- package/dist/content-contribution-revisions.d.ts.map +1 -0
- package/dist/content-contribution-type.d.ts +51 -0
- package/dist/content-contribution-type.d.ts.map +1 -0
- package/dist/content-contribution-types.d.ts +7 -0
- package/dist/content-contribution-types.d.ts.map +1 -0
- package/dist/content-contribution.d.ts +161 -0
- package/dist/content-contribution.d.ts.map +1 -0
- package/dist/content-contributions.d.ts +53 -0
- package/dist/content-contributions.d.ts.map +1 -0
- package/dist/content-contributor.d.ts +30 -0
- package/dist/content-contributor.d.ts.map +1 -0
- package/dist/content-contributors.d.ts +13 -0
- package/dist/content-contributors.d.ts.map +1 -0
- package/dist/content-correction.d.ts +39 -0
- package/dist/content-correction.d.ts.map +1 -0
- package/dist/content-corrections.d.ts +9 -0
- package/dist/content-corrections.d.ts.map +1 -0
- package/dist/content-editor-assistant.d.ts +68 -0
- package/dist/content-editor-assistant.d.ts.map +1 -0
- package/dist/content-editor-assistant.js +97 -0
- package/dist/content-editor-assistant.js.map +1 -0
- package/dist/content-feed-parser.d.ts +19 -0
- package/dist/content-feed-parser.d.ts.map +1 -0
- package/dist/content-feed-source.d.ts +52 -0
- package/dist/content-feed-source.d.ts.map +1 -0
- package/dist/content-feed-sources.d.ts +11 -0
- package/dist/content-feed-sources.d.ts.map +1 -0
- package/dist/content-feed-sync.d.ts +23 -0
- package/dist/content-feed-sync.d.ts.map +1 -0
- package/dist/content-governance-assignment.d.ts +42 -0
- package/dist/content-governance-assignment.d.ts.map +1 -0
- package/dist/content-governance-assignments.d.ts +11 -0
- package/dist/content-governance-assignments.d.ts.map +1 -0
- package/dist/content-governance-policies.d.ts +7 -0
- package/dist/content-governance-policies.d.ts.map +1 -0
- package/dist/content-governance-policy.d.ts +29 -0
- package/dist/content-governance-policy.d.ts.map +1 -0
- package/dist/content-governance-profile.d.ts +31 -0
- package/dist/content-governance-profile.d.ts.map +1 -0
- package/dist/content-governance-profiles.d.ts +7 -0
- package/dist/content-governance-profiles.d.ts.map +1 -0
- package/dist/content-governance.d.ts +188 -0
- package/dist/content-governance.d.ts.map +1 -0
- package/dist/content-prompts.d.ts +10 -0
- package/dist/content-prompts.d.ts.map +1 -0
- package/dist/content-reference.d.ts +17 -0
- package/dist/content-reference.d.ts.map +1 -0
- package/dist/content-references.d.ts +55 -0
- package/dist/content-references.d.ts.map +1 -0
- package/dist/content-review.d.ts +34 -0
- package/dist/content-review.d.ts.map +1 -0
- package/dist/content-reviews.d.ts +21 -0
- package/dist/content-reviews.d.ts.map +1 -0
- package/dist/content-transparency.d.ts +72 -0
- package/dist/content-transparency.d.ts.map +1 -0
- package/dist/content-types.d.ts +51 -0
- package/dist/content-types.d.ts.map +1 -0
- package/dist/content-version.d.ts +38 -0
- package/dist/content-version.d.ts.map +1 -0
- package/dist/content-versions.d.ts +16 -0
- package/dist/content-versions.d.ts.map +1 -0
- package/dist/content.d.ts +736 -0
- package/dist/content.d.ts.map +1 -0
- package/dist/contents.d.ts +292 -0
- package/dist/contents.d.ts.map +1 -0
- package/dist/database-utils.d.ts +3 -0
- package/dist/database-utils.d.ts.map +1 -0
- package/dist/index.d.ts +78 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11602 -0
- package/dist/index.js.map +1 -0
- package/dist/manifest.json +12308 -0
- package/dist/mock-smrt-client.d.ts +493 -0
- package/dist/mock-smrt-client.d.ts.map +1 -0
- package/dist/mock-smrt-client.js +390 -0
- package/dist/mock-smrt-client.js.map +1 -0
- package/dist/playground.d.ts +2 -0
- package/dist/playground.d.ts.map +1 -0
- package/dist/playground.js +454 -0
- package/dist/playground.js.map +1 -0
- package/dist/publish-readiness.d.ts +30 -0
- package/dist/publish-readiness.d.ts.map +1 -0
- package/dist/publish-readiness.js +74 -0
- package/dist/publish-readiness.js.map +1 -0
- package/dist/safe-remote-url.d.ts +52 -0
- package/dist/safe-remote-url.d.ts.map +1 -0
- package/dist/serialization.d.ts +78 -0
- package/dist/serialization.d.ts.map +1 -0
- package/dist/smrt-knowledge.json +6130 -0
- package/dist/svelte/api.d.ts +3 -0
- package/dist/svelte/api.d.ts.map +1 -0
- package/dist/svelte/api.js +10 -0
- package/dist/svelte/components/ArticleCard.svelte +159 -0
- package/dist/svelte/components/ArticleCard.svelte.d.ts +17 -0
- package/dist/svelte/components/ArticleCard.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ArticleList.svelte +75 -0
- package/dist/svelte/components/ArticleList.svelte.d.ts +21 -0
- package/dist/svelte/components/ArticleList.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentAgentChat.svelte +652 -0
- package/dist/svelte/components/ContentAgentChat.svelte.d.ts +17 -0
- package/dist/svelte/components/ContentAgentChat.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentBodyEditor.svelte +1446 -0
- package/dist/svelte/components/ContentBodyEditor.svelte.d.ts +25 -0
- package/dist/svelte/components/ContentBodyEditor.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentBodyRenderer.svelte +152 -0
- package/dist/svelte/components/ContentBodyRenderer.svelte.d.ts +10 -0
- package/dist/svelte/components/ContentBodyRenderer.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentClaimAuditTool.svelte +441 -0
- package/dist/svelte/components/ContentClaimAuditTool.svelte.d.ts +12 -0
- package/dist/svelte/components/ContentClaimAuditTool.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentContributionForm.svelte +226 -0
- package/dist/svelte/components/ContentContributionForm.svelte.d.ts +23 -0
- package/dist/svelte/components/ContentContributionForm.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentContributionInbox.svelte +322 -0
- package/dist/svelte/components/ContentContributionInbox.svelte.d.ts +22 -0
- package/dist/svelte/components/ContentContributionInbox.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentContributionPortal.svelte +182 -0
- package/dist/svelte/components/ContentContributionPortal.svelte.d.ts +12 -0
- package/dist/svelte/components/ContentContributionPortal.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentContributionTypeManager.svelte +281 -0
- package/dist/svelte/components/ContentContributionTypeManager.svelte.d.ts +10 -0
- package/dist/svelte/components/ContentContributionTypeManager.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentContributorManager.svelte +140 -0
- package/dist/svelte/components/ContentContributorManager.svelte.d.ts +10 -0
- package/dist/svelte/components/ContentContributorManager.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentCorrectionsTool.svelte +361 -0
- package/dist/svelte/components/ContentCorrectionsTool.svelte.d.ts +11 -0
- package/dist/svelte/components/ContentCorrectionsTool.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentEditor.svelte +2166 -0
- package/dist/svelte/components/ContentEditor.svelte.d.ts +26 -0
- package/dist/svelte/components/ContentEditor.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentGovernanceAssignmentEditor.svelte +199 -0
- package/dist/svelte/components/ContentGovernanceAssignmentEditor.svelte.d.ts +11 -0
- package/dist/svelte/components/ContentGovernanceAssignmentEditor.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentGovernanceManager.svelte +340 -0
- package/dist/svelte/components/ContentGovernanceManager.svelte.d.ts +11 -0
- package/dist/svelte/components/ContentGovernanceManager.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentGovernancePanel.svelte +2244 -0
- package/dist/svelte/components/ContentGovernancePanel.svelte.d.ts +26 -0
- package/dist/svelte/components/ContentGovernancePanel.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentGovernancePolicyEditor.svelte +110 -0
- package/dist/svelte/components/ContentGovernancePolicyEditor.svelte.d.ts +10 -0
- package/dist/svelte/components/ContentGovernancePolicyEditor.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentGovernanceProfileEditor.svelte +185 -0
- package/dist/svelte/components/ContentGovernanceProfileEditor.svelte.d.ts +11 -0
- package/dist/svelte/components/ContentGovernanceProfileEditor.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentGovernanceTool.svelte +56 -0
- package/dist/svelte/components/ContentGovernanceTool.svelte.d.ts +13 -0
- package/dist/svelte/components/ContentGovernanceTool.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentImageBrowser.svelte +243 -0
- package/dist/svelte/components/ContentImageBrowser.svelte.d.ts +18 -0
- package/dist/svelte/components/ContentImageBrowser.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentImageChooser.svelte +134 -0
- package/dist/svelte/components/ContentImageChooser.svelte.d.ts +11 -0
- package/dist/svelte/components/ContentImageChooser.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentList.svelte +906 -0
- package/dist/svelte/components/ContentList.svelte.d.ts +16 -0
- package/dist/svelte/components/ContentList.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentMetadataFields.svelte +107 -0
- package/dist/svelte/components/ContentMetadataFields.svelte.d.ts +8 -0
- package/dist/svelte/components/ContentMetadataFields.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentReferencesPanel.svelte +221 -0
- package/dist/svelte/components/ContentReferencesPanel.svelte.d.ts +20 -0
- package/dist/svelte/components/ContentReferencesPanel.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentReviewStatusTray.svelte +151 -0
- package/dist/svelte/components/ContentReviewStatusTray.svelte.d.ts +20 -0
- package/dist/svelte/components/ContentReviewStatusTray.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentStatusFields.svelte +85 -0
- package/dist/svelte/components/ContentStatusFields.svelte.d.ts +8 -0
- package/dist/svelte/components/ContentStatusFields.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentTitleField.svelte +54 -0
- package/dist/svelte/components/ContentTitleField.svelte.d.ts +10 -0
- package/dist/svelte/components/ContentTitleField.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentTransparencyReport.svelte +322 -0
- package/dist/svelte/components/ContentTransparencyReport.svelte.d.ts +10 -0
- package/dist/svelte/components/ContentTransparencyReport.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentTransparencyTool.svelte +314 -0
- package/dist/svelte/components/ContentTransparencyTool.svelte.d.ts +10 -0
- package/dist/svelte/components/ContentTransparencyTool.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ContentVersionsTool.svelte +291 -0
- package/dist/svelte/components/ContentVersionsTool.svelte.d.ts +10 -0
- package/dist/svelte/components/ContentVersionsTool.svelte.d.ts.map +1 -0
- package/dist/svelte/components/GovernedContentEditor.svelte +409 -0
- package/dist/svelte/components/GovernedContentEditor.svelte.d.ts +35 -0
- package/dist/svelte/components/GovernedContentEditor.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ImageThumbnail.cache.d.ts +14 -0
- package/dist/svelte/components/ImageThumbnail.cache.d.ts.map +1 -0
- package/dist/svelte/components/ImageThumbnail.cache.js +36 -0
- package/dist/svelte/components/ImageThumbnail.svelte +159 -0
- package/dist/svelte/components/ImageThumbnail.svelte.d.ts +8 -0
- package/dist/svelte/components/ImageThumbnail.svelte.d.ts.map +1 -0
- package/dist/svelte/components/Markdown.svelte +125 -0
- package/dist/svelte/components/Markdown.svelte.d.ts +11 -0
- package/dist/svelte/components/Markdown.svelte.d.ts.map +1 -0
- package/dist/svelte/content-editor-form.d.ts +63 -0
- package/dist/svelte/content-editor-form.d.ts.map +1 -0
- package/dist/svelte/content-editor-form.js +94 -0
- package/dist/svelte/content-editor-media.d.ts +12 -0
- package/dist/svelte/content-editor-media.d.ts.map +1 -0
- package/dist/svelte/content-editor-media.js +84 -0
- package/dist/svelte/content-editor-state.svelte.d.ts +35 -0
- package/dist/svelte/content-editor-state.svelte.d.ts.map +1 -0
- package/dist/svelte/content-editor-state.svelte.js +141 -0
- package/dist/svelte/governance-manager-client.d.ts +22 -0
- package/dist/svelte/governance-manager-client.d.ts.map +1 -0
- package/dist/svelte/governance-manager-client.js +1 -0
- package/dist/svelte/i18n.contribution.d.ts +57 -0
- package/dist/svelte/i18n.contribution.d.ts.map +1 -0
- package/dist/svelte/i18n.contribution.js +64 -0
- package/dist/svelte/i18n.editor.d.ts +71 -0
- package/dist/svelte/i18n.editor.d.ts.map +1 -0
- package/dist/svelte/i18n.editor.js +87 -0
- package/dist/svelte/i18n.governance.d.ts +66 -0
- package/dist/svelte/i18n.governance.d.ts.map +1 -0
- package/dist/svelte/i18n.governance.js +66 -0
- package/dist/svelte/i18n.routes.d.ts +66 -0
- package/dist/svelte/i18n.routes.d.ts.map +1 -0
- package/dist/svelte/i18n.routes.js +75 -0
- package/dist/svelte/i18n.tools.d.ts +81 -0
- package/dist/svelte/i18n.tools.d.ts.map +1 -0
- package/dist/svelte/i18n.tools.js +90 -0
- package/dist/svelte/index.d.ts +101 -0
- package/dist/svelte/index.d.ts.map +1 -0
- package/dist/svelte/index.js +63 -0
- package/dist/svelte/playground.d.ts +281 -0
- package/dist/svelte/playground.d.ts.map +1 -0
- package/dist/svelte/playground.js +438 -0
- package/dist/svelte/routes/ContentContributionsRoute.svelte +809 -0
- package/dist/svelte/routes/ContentContributionsRoute.svelte.d.ts +10 -0
- package/dist/svelte/routes/ContentContributionsRoute.svelte.d.ts.map +1 -0
- package/dist/svelte/routes/ContentFactsRoute.svelte +612 -0
- package/dist/svelte/routes/ContentFactsRoute.svelte.d.ts +11 -0
- package/dist/svelte/routes/ContentFactsRoute.svelte.d.ts.map +1 -0
- package/dist/svelte/routes/ContentGovernanceRoute.svelte +218 -0
- package/dist/svelte/routes/ContentGovernanceRoute.svelte.d.ts +10 -0
- package/dist/svelte/routes/ContentGovernanceRoute.svelte.d.ts.map +1 -0
- package/dist/svelte/routes/ContentWorkspaceRoute.svelte +431 -0
- package/dist/svelte/routes/ContentWorkspaceRoute.svelte.d.ts +12 -0
- package/dist/svelte/routes/ContentWorkspaceRoute.svelte.d.ts.map +1 -0
- package/dist/svelte/routes/PublishedArticleRoute.svelte +194 -0
- package/dist/svelte/routes/PublishedArticleRoute.svelte.d.ts +10 -0
- package/dist/svelte/routes/PublishedArticleRoute.svelte.d.ts.map +1 -0
- package/dist/svelte/routes/index.d.ts +8 -0
- package/dist/svelte/routes/index.d.ts.map +1 -0
- package/dist/svelte/routes/index.js +6 -0
- package/dist/svelte/routes/shared.d.ts +90 -0
- package/dist/svelte/routes/shared.d.ts.map +1 -0
- package/dist/svelte/routes/shared.js +104 -0
- package/dist/svelte/types.d.ts +69 -0
- package/dist/svelte/types.d.ts.map +1 -0
- package/dist/svelte/types.js +6 -0
- package/dist/thumbnail-generator.d.ts +174 -0
- package/dist/thumbnail-generator.d.ts.map +1 -0
- package/dist/ui.d.ts +10 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +42 -0
- package/dist/ui.js.map +1 -0
- package/dist/utils.d.ts +18 -0
- package/dist/utils.d.ts.map +1 -0
- package/package.json +119 -0
package/README.md
ADDED
|
@@ -0,0 +1,634 @@
|
|
|
1
|
+
# @happyvertical/smrt-content
|
|
2
|
+
|
|
3
|
+
STI content types (Article, ContentDocument, Mirror) with governance workflows, contribution intake, fact-checking, AI reviews, transparency reports, and thumbnail generation.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @happyvertical/smrt-content
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { Content, Contents, Article, Mirror } from '@happyvertical/smrt-content';
|
|
15
|
+
import { contentToString, stringToContent } from '@happyvertical/smrt-content';
|
|
16
|
+
|
|
17
|
+
// Initialize collection
|
|
18
|
+
const contents = await Contents.create({
|
|
19
|
+
db: { url: 'sqlite:./content.db' },
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
// Create and save content
|
|
23
|
+
const article = new Article({
|
|
24
|
+
title: 'AI in Content Processing',
|
|
25
|
+
body: 'Large language models have revolutionized...',
|
|
26
|
+
status: 'published',
|
|
27
|
+
tags: ['ai', 'nlp'],
|
|
28
|
+
category: 'technology/ai',
|
|
29
|
+
});
|
|
30
|
+
await article.initialize();
|
|
31
|
+
await article.save();
|
|
32
|
+
|
|
33
|
+
// Mirror content from a URL (idempotent -- returns existing if already mirrored)
|
|
34
|
+
const mirrored = await contents.mirror({
|
|
35
|
+
url: 'https://example.com/article.html',
|
|
36
|
+
context: 'research',
|
|
37
|
+
mirrorDir: './cache',
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// Upsert by slug + context
|
|
41
|
+
const doc = await contents.getOrUpsert({
|
|
42
|
+
slug: 'project-notes',
|
|
43
|
+
context: 'docs',
|
|
44
|
+
title: 'Project Notes',
|
|
45
|
+
body: 'Notes content...',
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// Thumbnail generation (three strategies)
|
|
49
|
+
await contents.generateMissingThumbnails({
|
|
50
|
+
strategy: 'headline-card',
|
|
51
|
+
db: { url: 'sqlite:./content.db' },
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// Export to markdown with YAML frontmatter
|
|
55
|
+
const markdown = contentToString(article);
|
|
56
|
+
const parsed = stringToContent(markdown);
|
|
57
|
+
|
|
58
|
+
// Batch export articles as markdown files
|
|
59
|
+
await contents.syncContentDir({ contentDir: './blog-posts' });
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Content Governance
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
import {
|
|
66
|
+
Content,
|
|
67
|
+
ContentGovernanceAssignment,
|
|
68
|
+
ContentGovernanceManager,
|
|
69
|
+
GovernedContentEditor,
|
|
70
|
+
configureContentGovernance,
|
|
71
|
+
} from '@happyvertical/smrt-content';
|
|
72
|
+
|
|
73
|
+
configureContentGovernance({
|
|
74
|
+
policies: [
|
|
75
|
+
{
|
|
76
|
+
key: 'editorial',
|
|
77
|
+
label: 'Editorial Review',
|
|
78
|
+
kind: 'custom',
|
|
79
|
+
instructions: 'Check tone, sourcing, and local publication standards.',
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
profiles: [
|
|
83
|
+
{
|
|
84
|
+
key: 'publication',
|
|
85
|
+
label: 'Publication',
|
|
86
|
+
requirements: [
|
|
87
|
+
{ policyKey: 'safety', blocking: true },
|
|
88
|
+
{ policyKey: 'facts', blocking: true },
|
|
89
|
+
{ policyKey: 'editorial', blocking: false },
|
|
90
|
+
],
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
assignments: [
|
|
94
|
+
{
|
|
95
|
+
contentType: 'article',
|
|
96
|
+
enabled: true,
|
|
97
|
+
factLinkingEnabled: true,
|
|
98
|
+
transparencyEnabled: true,
|
|
99
|
+
publicationProfileKey: 'publication',
|
|
100
|
+
correctionProfileKey: 'correction',
|
|
101
|
+
enforcePublishReadiness: true,
|
|
102
|
+
},
|
|
103
|
+
],
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
const article = new Content({
|
|
107
|
+
title: 'Transit service changes',
|
|
108
|
+
body: 'Weekend service will resume on April 3.',
|
|
109
|
+
type: 'article',
|
|
110
|
+
metadata: {
|
|
111
|
+
generation: {
|
|
112
|
+
publicPrompt: 'Summarize the service change for riders.',
|
|
113
|
+
aiAssisted: true,
|
|
114
|
+
model: 'gpt-5.4',
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
await article.initialize();
|
|
120
|
+
await article.save();
|
|
121
|
+
await article.addFact('fact_123', 'supports');
|
|
122
|
+
await article.runReviewAction({ kind: 'facts', policyKey: 'facts' });
|
|
123
|
+
await article.runReviewAction({ kind: 'safety', policyKey: 'safety' });
|
|
124
|
+
|
|
125
|
+
article.status = 'published';
|
|
126
|
+
await article.save();
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Governance stays opt-in. Plain `Content` records behave like legacy `smrt-content`
|
|
130
|
+
unless an assignment matches their `type` and optional exact `variant`.
|
|
131
|
+
|
|
132
|
+
Persisted governance definitions are modeled as first-class SMRT objects:
|
|
133
|
+
|
|
134
|
+
- `ContentGovernancePolicy`
|
|
135
|
+
- `ContentGovernanceProfile`
|
|
136
|
+
- `ContentGovernanceAssignment`
|
|
137
|
+
|
|
138
|
+
### Reviews & Corrections
|
|
139
|
+
|
|
140
|
+
Content reviews are AI-driven quality checks tied to governance policies.
|
|
141
|
+
Corrections track post-publication changes with accountability.
|
|
142
|
+
|
|
143
|
+
```typescript
|
|
144
|
+
// Run an AI review against a policy
|
|
145
|
+
const review = await article.runReviewAction({
|
|
146
|
+
kind: 'facts',
|
|
147
|
+
policyKey: 'facts',
|
|
148
|
+
});
|
|
149
|
+
console.log(review.status); // 'accepted' | 'flagged' | 'rejected'
|
|
150
|
+
console.log(review.findings); // Array of issues found
|
|
151
|
+
|
|
152
|
+
// List all reviews for content
|
|
153
|
+
const reviews = await article.listReviews();
|
|
154
|
+
|
|
155
|
+
// Evaluate readiness against a profile
|
|
156
|
+
const profiles = await article.listReviewProfilesAction();
|
|
157
|
+
const evaluation = await article.evaluateReviewProfile('publication');
|
|
158
|
+
console.log(evaluation.ready); // true if all blocking requirements met
|
|
159
|
+
|
|
160
|
+
// Issue a correction
|
|
161
|
+
await article.issueCorrectionAction({
|
|
162
|
+
type: 'correction',
|
|
163
|
+
summary: 'Updated figures to reflect Q4 data',
|
|
164
|
+
note: 'Previous values were from Q3',
|
|
165
|
+
});
|
|
166
|
+
const corrections = await article.listCorrections();
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Versioning
|
|
170
|
+
|
|
171
|
+
Content versions track snapshots of content state. Publication versions
|
|
172
|
+
are created automatically when governed content is published.
|
|
173
|
+
|
|
174
|
+
```typescript
|
|
175
|
+
// Manual version snapshot
|
|
176
|
+
await article.mutateVersionAction({
|
|
177
|
+
kind: 'publication',
|
|
178
|
+
summary: 'Content published.',
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
// List version history
|
|
182
|
+
const versions = await article.listVersions();
|
|
183
|
+
|
|
184
|
+
// Restore a previous version
|
|
185
|
+
await versions.restoreIntoContent(versionId);
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### References & Drift Detection
|
|
189
|
+
|
|
190
|
+
References are `(source_id, target_id)` edges between Content rows. They can
|
|
191
|
+
optionally pin a `targetVersion` captured at citation time. When the target
|
|
192
|
+
is later re-synced (a new `ContentVersion` is created), callers can detect
|
|
193
|
+
drift between what was cited and what the target now says.
|
|
194
|
+
|
|
195
|
+
```typescript
|
|
196
|
+
// Pin to the target's current version when citing
|
|
197
|
+
const latest = await citedArticle.listVersions();
|
|
198
|
+
const currentVersion = latest[latest.length - 1]?.version ?? null;
|
|
199
|
+
await article.addReference(citedArticle, { targetVersion: currentVersion });
|
|
200
|
+
|
|
201
|
+
// Or leave it unpinned — no version is recorded and `isDrifted` will
|
|
202
|
+
// always be false for this edge regardless of how the target evolves.
|
|
203
|
+
await article.addReference(otherArticle);
|
|
204
|
+
|
|
205
|
+
// Detect drift across all references
|
|
206
|
+
const drift = await article.getReferenceDrift();
|
|
207
|
+
// → [{ targetId, citedVersion, currentVersion, isDrifted }, ...]
|
|
208
|
+
// `isDrifted` is true only when both versions are present and differ.
|
|
209
|
+
|
|
210
|
+
// Re-link with a new pin to acknowledge drift (idempotent on source+target,
|
|
211
|
+
// mutable on the version column).
|
|
212
|
+
await article.addReference(citedArticle, { targetVersion: 2 });
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
`serializeContent` includes per-reference `citedVersion`, `currentVersion`,
|
|
216
|
+
and `isDrifted` fields so SvelteKit `load` functions can pass them through
|
|
217
|
+
to consumers without an extra round-trip. The fields surface in the
|
|
218
|
+
serialized payload; rendering them (e.g. a drift badge in
|
|
219
|
+
`ContentReferencesPanel`) is left to the consumer.
|
|
220
|
+
|
|
221
|
+
`getReferenceDrift` compares against the target's latest `ContentVersion`
|
|
222
|
+
of **any kind** (manual or publication), so a manual snapshot of the target
|
|
223
|
+
will trigger `isDrifted: true`. Consumers that only care about published
|
|
224
|
+
drift can filter further using `ContentVersion.kind`.
|
|
225
|
+
|
|
226
|
+
Typical use: cite an ingested external snapshot (web page, upstream feed,
|
|
227
|
+
asset library entry) as a Content row. Re-sync the source on a schedule, bump
|
|
228
|
+
the version, and any article that cites the prior version surfaces a drift
|
|
229
|
+
signal in the editor.
|
|
230
|
+
|
|
231
|
+
### Published Transparency
|
|
232
|
+
|
|
233
|
+
```typescript
|
|
234
|
+
const publishedTransparency = await article.getPublishedTransparencyAction();
|
|
235
|
+
const previewTransparency = await article.previewTransparencyAction();
|
|
236
|
+
|
|
237
|
+
console.log(publishedTransparency?.factsUsed);
|
|
238
|
+
console.log(publishedTransparency?.publicationProfileKey);
|
|
239
|
+
console.log(previewTransparency.references);
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
Published transparency is frozen into `ContentVersion.metadata.transparency` when a
|
|
243
|
+
publication snapshot is created. Built sites should render the published snapshot,
|
|
244
|
+
while editors can use the preview snapshot to inspect what will be shown publicly
|
|
245
|
+
before publishing.
|
|
246
|
+
|
|
247
|
+
### Publish Readiness
|
|
248
|
+
|
|
249
|
+
```typescript
|
|
250
|
+
import { evaluateContentPublishReadiness } from '@happyvertical/smrt-content';
|
|
251
|
+
|
|
252
|
+
const readiness = await evaluateContentPublishReadiness({
|
|
253
|
+
content: article,
|
|
254
|
+
profileKey: 'publication',
|
|
255
|
+
});
|
|
256
|
+
console.log(readiness.ready);
|
|
257
|
+
console.log(readiness.blockingRequirements);
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
When `enforcePublishReadiness` is enabled on a governance assignment,
|
|
261
|
+
`content.save()` will throw a `ValidationError` if blocking requirements
|
|
262
|
+
are not satisfied when status is set to `'published'`.
|
|
263
|
+
|
|
264
|
+
### Facts Integration
|
|
265
|
+
|
|
266
|
+
Content links to facts from `@happyvertical/smrt-facts` when fact-linking
|
|
267
|
+
is enabled in governance:
|
|
268
|
+
|
|
269
|
+
```typescript
|
|
270
|
+
// Link a fact to content
|
|
271
|
+
await article.addFact('fact_id', 'supports');
|
|
272
|
+
await article.addFact('fact_id', 'contradicts');
|
|
273
|
+
await article.addFact('fact_id', 'referenced_in');
|
|
274
|
+
|
|
275
|
+
// Get linked facts
|
|
276
|
+
const facts = await article.getFacts({ latestOnly: true });
|
|
277
|
+
const factLinks = await article.getFactLinks();
|
|
278
|
+
|
|
279
|
+
// Sync facts state (used by API)
|
|
280
|
+
const factsState = await article.getFactsState();
|
|
281
|
+
await article.syncFactsState({ factIds: ['fact1', 'fact2'] });
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
Collection-level fact browsing:
|
|
285
|
+
|
|
286
|
+
```typescript
|
|
287
|
+
const contents = await Contents.create({ db: dbConfig });
|
|
288
|
+
const factCatalog = await contents.browseFacts();
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
## Content Contributions
|
|
292
|
+
|
|
293
|
+
```typescript
|
|
294
|
+
import {
|
|
295
|
+
ContentContributionType,
|
|
296
|
+
ContentContributions,
|
|
297
|
+
ContentContributionForm,
|
|
298
|
+
ContentContributionInbox,
|
|
299
|
+
ContentContributionPortal,
|
|
300
|
+
ContentContributionTypeManager,
|
|
301
|
+
ContentContributorManager,
|
|
302
|
+
configureContentContributions,
|
|
303
|
+
} from '@happyvertical/smrt-content';
|
|
304
|
+
|
|
305
|
+
configureContentContributions({
|
|
306
|
+
types: [
|
|
307
|
+
{
|
|
308
|
+
key: 'letter',
|
|
309
|
+
label: 'Letter to the editor',
|
|
310
|
+
enabled: true,
|
|
311
|
+
allowedChannels: ['web', 'email'],
|
|
312
|
+
allowText: true,
|
|
313
|
+
allowFiles: true,
|
|
314
|
+
allowEmptyText: false,
|
|
315
|
+
intakeRules: {
|
|
316
|
+
maxFiles: 3,
|
|
317
|
+
allowedMimePatterns: ['image/*', 'application/pdf'],
|
|
318
|
+
quarantineTextPatterns: ['lawsuit', 'defamation'],
|
|
319
|
+
},
|
|
320
|
+
promotion: {
|
|
321
|
+
targetContentType: 'article',
|
|
322
|
+
targetContentVariant: 'letter',
|
|
323
|
+
targetContentStatus: 'draft',
|
|
324
|
+
autoPromoteTrusted: true,
|
|
325
|
+
createAssets: true,
|
|
326
|
+
assetRelationship: 'attachment',
|
|
327
|
+
},
|
|
328
|
+
},
|
|
329
|
+
],
|
|
330
|
+
});
|
|
331
|
+
|
|
332
|
+
const contributions = await ContentContributions.create({
|
|
333
|
+
db: { url: 'sqlite:./content.db' },
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
const result = await contributions.submitWebContribution({
|
|
337
|
+
typeKey: 'letter',
|
|
338
|
+
contributorEmail: 'reader@example.com',
|
|
339
|
+
contributorName: 'Reader',
|
|
340
|
+
title: 'A community letter',
|
|
341
|
+
body: 'Please publish this letter.',
|
|
342
|
+
attachments: [
|
|
343
|
+
{
|
|
344
|
+
filename: 'photo.jpg',
|
|
345
|
+
mimeType: 'image/jpeg',
|
|
346
|
+
size: 1024,
|
|
347
|
+
fileKey: 'uploads/photo.jpg',
|
|
348
|
+
},
|
|
349
|
+
],
|
|
350
|
+
tenantId: 'tenant-1',
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
const approved = await contributions.get({ id: result.contribution.id });
|
|
354
|
+
await approved?.approveAction({
|
|
355
|
+
editorNote: 'Looks good for editorial review.',
|
|
356
|
+
targetStatus: 'draft',
|
|
357
|
+
});
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
Content contributions are held separately from editorial `Content` and `Asset`
|
|
361
|
+
records until they are promoted. That keeps plain `smrt-content` generic, while
|
|
362
|
+
supporting community intake and moderation workflows when an app opts in.
|
|
363
|
+
|
|
364
|
+
The contribution holding layer adds these first-class SMRT objects:
|
|
365
|
+
|
|
366
|
+
- `ContentContributionType`
|
|
367
|
+
- `ContentContributor`
|
|
368
|
+
- `ContentContribution`
|
|
369
|
+
- `ContentContributionRevision`
|
|
370
|
+
- `ContentContributionAttachment`
|
|
371
|
+
|
|
372
|
+
Key behavior:
|
|
373
|
+
|
|
374
|
+
- web and email intake normalize into the same contribution package
|
|
375
|
+
- one contribution can contain one primary text submission plus zero or more held files
|
|
376
|
+
- asset-only submissions are allowed when the type permits empty text
|
|
377
|
+
- contributors are resolved by email and linked to a `Profile`
|
|
378
|
+
- trust levels are `standard`, `trusted`, or `blocked`
|
|
379
|
+
- intake rules can accept, quarantine, or reject before editorial review
|
|
380
|
+
- approval promotes into normal draft `Content` and `Asset` records with provenance metadata
|
|
381
|
+
- governance starts after promotion, based on the promoted content `type` and `variant`
|
|
382
|
+
|
|
383
|
+
## Chat Integration
|
|
384
|
+
|
|
385
|
+
Content has built-in AI chat via `@happyvertical/smrt-chat`:
|
|
386
|
+
|
|
387
|
+
```typescript
|
|
388
|
+
// API endpoint: GET /api/v1/contents/{id}/chat
|
|
389
|
+
// Returns: { session, threads } or { session: null, notice }
|
|
390
|
+
// API endpoint: POST /api/v1/contents/{id}/chat
|
|
391
|
+
// Creates a new chat thread for the content
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
The `ContentAgentChat` Svelte component provides a chat sidebar in the
|
|
395
|
+
content editor. When chat tables aren't provisioned, it gracefully shows
|
|
396
|
+
a "not available" notice instead of erroring.
|
|
397
|
+
|
|
398
|
+
For app-level assistants, `ContentEditor` and `GovernedContentEditor` also
|
|
399
|
+
publish a reusable assistant registration through `onAssistantContextChange`.
|
|
400
|
+
This works even when `hideChat={true}`:
|
|
401
|
+
|
|
402
|
+
```svelte
|
|
403
|
+
<GovernedContentEditor
|
|
404
|
+
content={article}
|
|
405
|
+
contentId={article.id}
|
|
406
|
+
hideChat
|
|
407
|
+
onAssistantContextChange={(registration) => {
|
|
408
|
+
assistantStore.setContext(registration?.context ?? null);
|
|
409
|
+
assistantStore.setActions(registration?.actions ?? null);
|
|
410
|
+
}}
|
|
411
|
+
onSave={saveArticle}
|
|
412
|
+
onCancel={closeEditor}
|
|
413
|
+
/>
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
The registration includes a serializable `ContentEditorAssistantContext`
|
|
417
|
+
(`contentId`, draft fields, current editor body, reference IDs, and governed
|
|
418
|
+
fact/readiness summaries) plus local actions such as `triggerSave`,
|
|
419
|
+
`triggerReview`, `applyFieldUpdates`, and undo for AI-applied field updates.
|
|
420
|
+
`ContentAgentChat` can be mounted outside the editor by passing the context:
|
|
421
|
+
|
|
422
|
+
```svelte
|
|
423
|
+
<ContentAgentChat apiBaseUrl="/tenant/api/v1" assistantContext={context} />
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
Server integrations can use `getOrCreateContentEditorChatSession`,
|
|
427
|
+
`createContentEditorChatThread`, `listContentEditorChatThreadMessages`, and
|
|
428
|
+
`sendContentEditorChatThreadMessage` to install `/contents/:id/chat` routes
|
|
429
|
+
with app-specific tenancy, auth, and AI model resolution hooks instead of
|
|
430
|
+
copying the package dev-server endpoints.
|
|
431
|
+
|
|
432
|
+
## Dev Server
|
|
433
|
+
|
|
434
|
+
The package includes a SvelteKit dev server (`npm run dev`) with:
|
|
435
|
+
|
|
436
|
+
- **Contents page** (`/`) — Content catalog with search, filters, card/list
|
|
437
|
+
views, and full CRUD. Includes governed article creation.
|
|
438
|
+
- **Governance page** (`/governance`) — Policy, profile, and assignment
|
|
439
|
+
management via `ContentGovernanceManager`.
|
|
440
|
+
- **Contributions page** (`/contributions`) — Sub-tabbed: editorial inbox,
|
|
441
|
+
public submit form, contributor management, contribution type config.
|
|
442
|
+
- **API Explorer page** (`/api-explorer`) — Browse all 69 auto-generated
|
|
443
|
+
REST endpoints grouped by domain, with try-it-live for GET endpoints.
|
|
444
|
+
|
|
445
|
+
The dev server bootstraps schemas for all 13 local `@smrt()` classes on
|
|
446
|
+
startup and seeds sample content (3 items) for immediate testing.
|
|
447
|
+
|
|
448
|
+
## Svelte Components
|
|
449
|
+
|
|
450
|
+
### Content Management
|
|
451
|
+
|
|
452
|
+
| Component | Props | Description |
|
|
453
|
+
|-----------|-------|-------------|
|
|
454
|
+
| `ContentList` | `contents`, `onEdit`, `onDelete`, `onAdd`, `getViewHref` | Card/list catalog with search, filters, and view toggles |
|
|
455
|
+
| `ContentEditor` | `content`, `contentId`, `onSave`, `onCancel` | Full content editor with metadata, assets, references |
|
|
456
|
+
| `GovernedContentEditor` | `content`, `contentId`, `onSave`, `onCancel` | Editor with integrated governance panel and review controls |
|
|
457
|
+
| `ContentAgentChat` | `contentId`, `apiBasePath` | AI chat sidebar for content with thread management |
|
|
458
|
+
| `ContentTitleField`, `ContentStatusFields`, `ContentMetadataFields`, `ContentReferencesPanel`, `ContentImageBrowser` | focused field/section props | Composable editor primitives for application-owned layouts |
|
|
459
|
+
| `ContentReviewStatusTray` | `items`, `activeId`, `open`, `onSelect` | Compact review status tray for inline review drawers |
|
|
460
|
+
| `ArticleCard` | `article` | Card display for an article |
|
|
461
|
+
| `ArticleList` | `articles` | List of article cards |
|
|
462
|
+
| `ImageThumbnail` | `src`, `alt` | Thumbnail image display |
|
|
463
|
+
| `Markdown` | `source` | Markdown renderer |
|
|
464
|
+
|
|
465
|
+
Applications that compose their own article editor can use
|
|
466
|
+
`createContentEditorState`, `getContentEditorAssetImageSource`, and
|
|
467
|
+
`resolveContentEditorImageSelection` to share the same form normalization,
|
|
468
|
+
thumbnail selection, and save payload behavior as the package editors.
|
|
469
|
+
|
|
470
|
+
### Governance
|
|
471
|
+
|
|
472
|
+
| Component | Props | Description |
|
|
473
|
+
|-----------|-------|-------------|
|
|
474
|
+
| `ContentGovernanceManager` | *(self-contained)* | Full manager for policies, profiles, and assignments |
|
|
475
|
+
| `ContentGovernancePanel` | `contentId` | Governance status panel for a single content item |
|
|
476
|
+
| `ContentGovernancePolicyEditor` | `policy`, `onSave` | Editor for a single policy |
|
|
477
|
+
| `ContentGovernanceProfileEditor` | `profile`, `onSave` | Editor for a single profile |
|
|
478
|
+
| `ContentGovernanceAssignmentEditor` | `assignment`, `onSave` | Editor for a single assignment |
|
|
479
|
+
| `ContentTransparencyReport` | `data` | Renders the transparency report for published content |
|
|
480
|
+
|
|
481
|
+
### Contributions
|
|
482
|
+
|
|
483
|
+
| Component | Props | Description |
|
|
484
|
+
|-----------|-------|-------------|
|
|
485
|
+
| `ContentContributionForm` | `types`, `onSubmit`, `onCancel` | Public submission form with file uploads |
|
|
486
|
+
| `ContentContributionInbox` | `contributions`, `selectedId`, `onSelect`, `onApprove`, `onReject`, `onRequestChanges` | Editorial inbox with approve/reject/request-changes actions |
|
|
487
|
+
| `ContentContributionPortal` | `contributions`, `onSelect`, `onWithdraw` | Contributor-facing submission tracker |
|
|
488
|
+
| `ContentContributionTypeManager` | `types`, `onSave`, `onDelete` | Manage contribution types, channels, and promotion settings |
|
|
489
|
+
| `ContentContributorManager` | `contributors`, `onSave`, `onDelete` | Manage contributors with trust levels |
|
|
490
|
+
|
|
491
|
+
## API
|
|
492
|
+
|
|
493
|
+
### Classes
|
|
494
|
+
|
|
495
|
+
| Export | Description |
|
|
496
|
+
|--------|------------|
|
|
497
|
+
| `Content` | STI base model. Fields: `type`, `variant`, `status`, `state`, `category`, `tags`, `metadata`, `thumbnailAssetId` |
|
|
498
|
+
| `ContentAsset` | Junction model for canonical content-to-asset ownership in `content_assets` |
|
|
499
|
+
| `Article` | STI subclass for editorial content |
|
|
500
|
+
| `ContentDocument` | STI subclass for structured documents |
|
|
501
|
+
| `Mirror` | STI subclass for mirrored/cached external content |
|
|
502
|
+
| `Contents` | Collection with `mirror()`, `syncContentDir()`, `generateMissingThumbnails()`, `findWithGlobals()`, `getOrUpsert()`, `browseFacts()`, `getGovernanceDefinitionsAction()`, `resolveGovernanceAction()` |
|
|
503
|
+
| `ContentReference` | Junction model for content-to-content links; nullable `targetVersion` pins citation-time `ContentVersion.version` for drift detection |
|
|
504
|
+
| `ContentReview` | AI review result tied to a governance policy |
|
|
505
|
+
| `ContentCorrection` | Post-publication correction record |
|
|
506
|
+
| `ContentVersion` | Content snapshot with kind (`'publication'`, `'manual'`) and transparency metadata |
|
|
507
|
+
| `ContentContribution` | Held inbound submission with approval, rejection, withdrawal, and promotion actions |
|
|
508
|
+
| `ContentContributions` | Contribution collection with web intake, email ingestion, inbox, and contributor views |
|
|
509
|
+
| `ContentContributionType` | Persisted contribution-type override for app-defined intake rules and promotion mapping |
|
|
510
|
+
| `ContentContributor` | Contributor profile/trust record resolved by email |
|
|
511
|
+
| `ContentContributionRevision` | Revision history for held submissions |
|
|
512
|
+
| `ContentContributionAttachment` | Held file metadata that only becomes an `Asset` on promotion |
|
|
513
|
+
| `ContentGovernancePolicy` | Persisted review policy definition |
|
|
514
|
+
| `ContentGovernanceProfile` | Persisted review profile with requirements |
|
|
515
|
+
| `ContentGovernanceAssignment` | Persisted governance assignment for content type/variant |
|
|
516
|
+
| `ThumbnailGenerator` | Generates thumbnails via `headline-card`, `static-map`, or `ai-generate` strategies |
|
|
517
|
+
|
|
518
|
+
### Content Instance Methods
|
|
519
|
+
|
|
520
|
+
| Method | Description |
|
|
521
|
+
|--------|-------------|
|
|
522
|
+
| `resolveGovernance()` | Resolve effective governance for this content's type/variant |
|
|
523
|
+
| `runReviewAction(options)` | Run an AI review against a policy |
|
|
524
|
+
| `listReviews()` | List all reviews for this content |
|
|
525
|
+
| `listReviewProfilesAction()` | Get review readiness for all profiles |
|
|
526
|
+
| `evaluateReviewProfile(key)` | Evaluate one profile's requirements |
|
|
527
|
+
| `issueCorrectionAction(options)` | Issue a post-publication correction |
|
|
528
|
+
| `listCorrections()` | List corrections for this content |
|
|
529
|
+
| `listVersions()` | List version history |
|
|
530
|
+
| `mutateVersionAction(options)` | Create a version snapshot |
|
|
531
|
+
| `getPublishedTransparencyAction()` | Get frozen transparency data |
|
|
532
|
+
| `previewTransparencyAction()` | Preview live transparency state |
|
|
533
|
+
| `addFact(factId, relationship)` | Link a fact to this content |
|
|
534
|
+
| `getFacts(options)` | Get linked facts |
|
|
535
|
+
| `getFactLinks()` | Get fact-content link records |
|
|
536
|
+
| `getFactsState()` | Get full facts state (API) |
|
|
537
|
+
| `syncFactsState(options)` | Sync fact links (API) |
|
|
538
|
+
| `getAssets(relationship?)` | Get associated assets |
|
|
539
|
+
| `addAsset(asset, relationship, sortOrder)` | Add asset association |
|
|
540
|
+
| `removeAsset(assetId, relationship?)` | Remove asset association |
|
|
541
|
+
| `setThumbnail(image)` | Set thumbnail (adds asset + updates `thumbnailAssetId`) |
|
|
542
|
+
| `generateThumbnail(options)` | Generate a thumbnail |
|
|
543
|
+
| `addReference(content, options?)` | Link to another content; pass `{ targetVersion }` to pin the citation to a specific `ContentVersion.version` |
|
|
544
|
+
| `getReferences()` | Get content references |
|
|
545
|
+
| `getReferenceDrift()` | Per-edge `{ citedVersion, currentVersion, isDrifted }` — surfaces references whose pinned version differs from the target's latest |
|
|
546
|
+
|
|
547
|
+
### Types
|
|
548
|
+
|
|
549
|
+
| Export | Description |
|
|
550
|
+
|--------|------------|
|
|
551
|
+
| `ContentOptions` | Options for `Content` constructor |
|
|
552
|
+
| `ContentsOptions` | Options for `Contents.create()` |
|
|
553
|
+
| `ThumbnailStrategy` | `'headline-card' \| 'static-map' \| 'ai-generate'` |
|
|
554
|
+
| `ThumbnailOptions` | Union of strategy-specific option types |
|
|
555
|
+
| `HeadlineCardThumbnailOptions` | Options for headline-card strategy |
|
|
556
|
+
| `StaticMapThumbnailOptions` | Options for static-map strategy |
|
|
557
|
+
| `AIGenerateThumbnailOptions` | Options for ai-generate strategy |
|
|
558
|
+
| `ContentContributionTypeDefinition` | App-defined contribution type shape |
|
|
559
|
+
| `ContentGovernanceConfig` | Shape passed to `configureContentGovernance()` |
|
|
560
|
+
| `ContentGovernanceState` | Resolved governance state for a content item |
|
|
561
|
+
| `ContentReviewResult` | AI review output with findings |
|
|
562
|
+
| `ContentReviewFinding` | Individual issue from a review |
|
|
563
|
+
| `ContentCorrectionType` | `'correction' \| 'retraction' \| 'update' \| 'clarification'` |
|
|
564
|
+
| `ContentVersionKind` | `'publication' \| 'manual'` |
|
|
565
|
+
| `ContentTransparencyData` | Full transparency report data shape |
|
|
566
|
+
| `ContentPublishReadinessState` | Profile evaluation result |
|
|
567
|
+
|
|
568
|
+
### Utilities
|
|
569
|
+
|
|
570
|
+
| Export | Description |
|
|
571
|
+
|--------|------------|
|
|
572
|
+
| `contentToString(content)` | Serialize content to markdown with YAML frontmatter |
|
|
573
|
+
| `stringToContent(str)` | Parse markdown with frontmatter back to content data |
|
|
574
|
+
| `configureContentGovernance(config)` | Define default governance policies, profiles, and assignments |
|
|
575
|
+
| `configureContentContributions(config)` | Define default contribution types and intake rules |
|
|
576
|
+
| `evaluateContentPublishReadiness(options)` | Evaluate publication readiness against a profile |
|
|
577
|
+
| `normalizeContentTransparency(raw)` | Normalize raw transparency data into standard shape |
|
|
578
|
+
|
|
579
|
+
## Auto-Generated Endpoints
|
|
580
|
+
|
|
581
|
+
The `@smrt()` decorator generates REST API, MCP tools, and CLI commands.
|
|
582
|
+
|
|
583
|
+
### Content Endpoints (instance-level)
|
|
584
|
+
|
|
585
|
+
| Method | Path | Description |
|
|
586
|
+
|--------|------|-------------|
|
|
587
|
+
| GET | `/api/v1/contents` | List contents |
|
|
588
|
+
| POST | `/api/v1/contents` | Create content |
|
|
589
|
+
| GET | `/api/v1/contents/{id}` | Get content |
|
|
590
|
+
| PUT | `/api/v1/contents/{id}` | Update content |
|
|
591
|
+
| DELETE | `/api/v1/contents/{id}` | Delete content |
|
|
592
|
+
| GET | `/api/v1/contents/{id}/facts` | Get facts state |
|
|
593
|
+
| PUT | `/api/v1/contents/{id}/facts` | Sync facts state |
|
|
594
|
+
| GET | `/api/v1/contents/{id}/governance` | Get governance state |
|
|
595
|
+
| GET | `/api/v1/contents/{id}/reviews` | List reviews |
|
|
596
|
+
| POST | `/api/v1/contents/{id}/reviews` | Run AI review |
|
|
597
|
+
| GET | `/api/v1/contents/{id}/review-profiles` | Review readiness |
|
|
598
|
+
| GET | `/api/v1/contents/{id}/review-profiles/{profileKey}` | Evaluate profile |
|
|
599
|
+
| GET | `/api/v1/contents/{id}/transparency` | Published transparency |
|
|
600
|
+
| GET | `/api/v1/contents/{id}/transparency/preview` | Preview transparency |
|
|
601
|
+
| GET | `/api/v1/contents/{id}/corrections` | List corrections |
|
|
602
|
+
| POST | `/api/v1/contents/{id}/corrections` | Issue correction |
|
|
603
|
+
| GET | `/api/v1/contents/{id}/versions` | List versions |
|
|
604
|
+
| POST | `/api/v1/contents/{id}/versions` | Create version |
|
|
605
|
+
|
|
606
|
+
### Collection Endpoints
|
|
607
|
+
|
|
608
|
+
| Method | Path | Description |
|
|
609
|
+
|--------|------|-------------|
|
|
610
|
+
| GET | `/api/v1/contents/by-slug?slug=...` | Get by slug |
|
|
611
|
+
| GET | `/api/v1/contents/facts` | Browse fact catalog |
|
|
612
|
+
| GET | `/api/v1/contents/governance` | Governance definitions |
|
|
613
|
+
| GET | `/api/v1/contents/governance/resolve?type=...` | Resolve governance |
|
|
614
|
+
|
|
615
|
+
All SMRT models (`ContentGovernancePolicy`, `ContentContribution`, etc.)
|
|
616
|
+
also get standard CRUD + custom collection-level endpoints.
|
|
617
|
+
|
|
618
|
+
## Dependencies
|
|
619
|
+
|
|
620
|
+
| Package | Purpose |
|
|
621
|
+
|---------|---------|
|
|
622
|
+
| `@happyvertical/smrt-core` | ORM base (SmrtObject, SmrtCollection) |
|
|
623
|
+
| `@happyvertical/smrt-assets` | Asset association support |
|
|
624
|
+
| `@happyvertical/smrt-images` | Image/thumbnail creation |
|
|
625
|
+
| `@happyvertical/smrt-facts` | Fact linking and browsing |
|
|
626
|
+
| `@happyvertical/smrt-chat` | Content chat sessions and threads |
|
|
627
|
+
| `@happyvertical/smrt-messages` | Email ingestion for contribution intake |
|
|
628
|
+
| `@happyvertical/smrt-profiles` | Contributor/profile resolution by email |
|
|
629
|
+
| `@happyvertical/smrt-tenancy` | Optional tenant scoping |
|
|
630
|
+
| `@happyvertical/documents` | Document fetching and text extraction |
|
|
631
|
+
| `@happyvertical/files` | Filesystem operations |
|
|
632
|
+
| `@happyvertical/geo` | Static map thumbnails |
|
|
633
|
+
| `@happyvertical/images` | Headline card rendering |
|
|
634
|
+
| `yaml` | YAML frontmatter parsing |
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"__smrt-register__.d.ts","sourceRoot":"","sources":["../src/__smrt-register__.ts"],"names":[],"mappings":""}
|