@happyvertical/smrt-assets-ergot 0.40.13 → 0.40.15
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/README.md +92 -0
- package/package.json +3 -3
package/README.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# @happyvertical/smrt-assets-ergot
|
|
2
|
+
|
|
3
|
+
Ergot-backed processing, search, synchronization, and workflow capabilities for
|
|
4
|
+
the s-m-r-t asset runtime. Applications continue to use
|
|
5
|
+
[`@happyvertical/smrt-assets`](../assets/README.md) as their asset API and opt
|
|
6
|
+
into Ergot only at composition time.
|
|
7
|
+
|
|
8
|
+
Use this adapter when an application needs MAM-backed search, generated media
|
|
9
|
+
candidates, cloud processors, workflow jobs, or synchronization with an Ergot
|
|
10
|
+
library. Use [`smrt-assets-local`](../assets-local/README.md) for lightweight
|
|
11
|
+
local image processing.
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pnpm add @happyvertical/smrt-assets @happyvertical/smrt-assets-ergot
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
The adapter is structurally typed around a small consumer client. It does not
|
|
20
|
+
force every s-m-r-t application to install an Ergot SDK.
|
|
21
|
+
|
|
22
|
+
## Quick start
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
import { createAssetRuntime } from '@happyvertical/smrt-assets';
|
|
26
|
+
import {
|
|
27
|
+
createErgotAssetProcessor,
|
|
28
|
+
type ErgotConsumerAssetClient,
|
|
29
|
+
} from '@happyvertical/smrt-assets-ergot';
|
|
30
|
+
|
|
31
|
+
const ergot: ErgotConsumerAssetClient = createErgotClient();
|
|
32
|
+
const runtime = await createAssetRuntime({
|
|
33
|
+
db: 'assets.db',
|
|
34
|
+
storage: './data/assets',
|
|
35
|
+
capabilityProviders: [createErgotAssetProcessor({ client: ergot })],
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const asset = await runtime.storeSourceAsset(
|
|
39
|
+
'Lead image',
|
|
40
|
+
imageBytes,
|
|
41
|
+
{ mimeType: 'image/jpeg', typeSlug: 'image' },
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
const synced = await runtime.syncExternalAsset(asset);
|
|
45
|
+
console.log(synced.externalAssetId);
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Synchronization uses stable source references and external IDs. A s-m-r-t asset
|
|
49
|
+
ID and an Ergot asset ID are separate identities and must never be treated as
|
|
50
|
+
interchangeable.
|
|
51
|
+
|
|
52
|
+
## Capabilities
|
|
53
|
+
|
|
54
|
+
| Asset runtime operation | Ergot behavior |
|
|
55
|
+
| --- | --- |
|
|
56
|
+
| `syncExternalAsset()` | Idempotently find or upload by source reference |
|
|
57
|
+
| `searchNearbyAssets()` | Query Ergot's tenant-scoped nearby search |
|
|
58
|
+
| `ensureVariant()` | Resolve Ergot delivery variants when available |
|
|
59
|
+
| `submitAssetWorkflow()` | Submit a workflow job with source lineage |
|
|
60
|
+
| `processAsset()` | Delegate supported processing to Ergot |
|
|
61
|
+
|
|
62
|
+
Every request that can expose tenant data must carry tenant scope. Direct asset
|
|
63
|
+
and job lookups are validated even when the upstream client already scopes list
|
|
64
|
+
operations.
|
|
65
|
+
|
|
66
|
+
## Source references and outputs
|
|
67
|
+
|
|
68
|
+
- `sourceRef` is the canonical idempotent synchronization key.
|
|
69
|
+
- `externalId` is used when the consumer already owns a stable upstream key.
|
|
70
|
+
- Generated candidates remain candidates until approved and materialized into
|
|
71
|
+
the s-m-r-t asset runtime.
|
|
72
|
+
- Variant metadata may reference Ergot delivery URLs without copying bytes.
|
|
73
|
+
- Workflow outputs preserve lineage to both the source asset and Ergot job.
|
|
74
|
+
|
|
75
|
+
## Public API
|
|
76
|
+
|
|
77
|
+
| Export | Purpose |
|
|
78
|
+
| --- | --- |
|
|
79
|
+
| `createErgotAssetProcessor()` | Create the s-m-r-t capability provider |
|
|
80
|
+
| `ErgotConsumerAssetClient` | Minimal client contract a host implements |
|
|
81
|
+
| `ErgotAssetSummary` | Provider-neutral view of an Ergot asset |
|
|
82
|
+
| `ErgotAssetProcessorOptions` | Client and source-system configuration |
|
|
83
|
+
|
|
84
|
+
## Development
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
pnpm --filter @happyvertical/smrt-assets-ergot test
|
|
88
|
+
pnpm --filter @happyvertical/smrt-assets-ergot typecheck
|
|
89
|
+
pnpm --filter @happyvertical/smrt-assets-ergot build
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
See [`AGENTS.md`](./AGENTS.md) for provider, tenancy, and lineage invariants.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@happyvertical/smrt-assets-ergot",
|
|
3
|
-
"version": "0.40.
|
|
3
|
+
"version": "0.40.15",
|
|
4
4
|
"description": "Ergot-backed processing, search, and workflow adapter for SMRT assets",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -18,14 +18,14 @@
|
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@happyvertical/smrt-assets": "0.40.
|
|
21
|
+
"@happyvertical/smrt-assets": "0.40.15"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@happyvertical/sql": "^0.80.2",
|
|
25
25
|
"@types/node": "24.13.2",
|
|
26
26
|
"typescript": "5.9.3",
|
|
27
27
|
"vitest": "4.1.10",
|
|
28
|
-
"@happyvertical/smrt-core": "0.40.
|
|
28
|
+
"@happyvertical/smrt-core": "0.40.15"
|
|
29
29
|
},
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"registry": "https://registry.npmjs.org",
|