videobook-engine 2.0.1 → 5.0.1
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 +99 -68
- package/dist/artifacts.d.ts +4 -9
- package/dist/artifacts.d.ts.map +1 -1
- package/dist/artifacts.js +78 -138
- package/dist/artifacts.js.map +1 -1
- package/dist/books.d.ts +1 -1
- package/dist/books.d.ts.map +1 -1
- package/dist/books.js +18 -10
- package/dist/books.js.map +1 -1
- package/dist/cas.d.ts +27 -1
- package/dist/cas.d.ts.map +1 -1
- package/dist/cas.js +78 -6
- package/dist/cas.js.map +1 -1
- package/dist/catalog-metadata.d.ts +56 -0
- package/dist/catalog-metadata.d.ts.map +1 -0
- package/dist/catalog-metadata.js +42 -0
- package/dist/catalog-metadata.js.map +1 -0
- package/dist/communications.js +4 -2
- package/dist/communications.js.map +1 -1
- package/dist/context.d.ts +9 -6
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +42 -51
- package/dist/context.js.map +1 -1
- package/dist/domain.d.ts +39 -2
- package/dist/domain.d.ts.map +1 -1
- package/dist/domain.js +846 -64
- package/dist/domain.js.map +1 -1
- package/dist/edit-policy.d.ts +3 -0
- package/dist/edit-policy.d.ts.map +1 -0
- package/dist/edit-policy.js +6 -0
- package/dist/edit-policy.js.map +1 -0
- package/dist/edits.d.ts +10 -0
- package/dist/edits.d.ts.map +1 -0
- package/dist/edits.js +1392 -0
- package/dist/edits.js.map +1 -0
- package/dist/engine-types.d.ts +171 -86
- package/dist/engine-types.d.ts.map +1 -1
- package/dist/engine-types.js +32 -0
- package/dist/engine-types.js.map +1 -1
- package/dist/engine.d.ts +89 -26
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +27 -21
- package/dist/engine.js.map +1 -1
- package/dist/files.d.ts.map +1 -1
- package/dist/files.js +32 -28
- package/dist/files.js.map +1 -1
- package/dist/fork.d.ts +148 -0
- package/dist/fork.d.ts.map +1 -0
- package/dist/fork.js +602 -0
- package/dist/fork.js.map +1 -0
- package/dist/generations.d.ts +9 -0
- package/dist/generations.d.ts.map +1 -0
- package/dist/generations.js +175 -0
- package/dist/generations.js.map +1 -0
- package/dist/history.d.ts +2 -5
- package/dist/history.d.ts.map +1 -1
- package/dist/history.js +183 -640
- package/dist/history.js.map +1 -1
- package/dist/index.d.ts +21 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -5
- package/dist/index.js.map +1 -1
- package/dist/job-queue.d.ts +2 -0
- package/dist/job-queue.d.ts.map +1 -1
- package/dist/job-queue.js +29 -2
- package/dist/job-queue.js.map +1 -1
- package/dist/media.d.ts +3 -3
- package/dist/media.d.ts.map +1 -1
- package/dist/media.js +6 -5
- package/dist/media.js.map +1 -1
- package/dist/merge-policy.d.ts +83 -0
- package/dist/merge-policy.d.ts.map +1 -0
- package/dist/merge-policy.js +203 -0
- package/dist/merge-policy.js.map +1 -0
- package/dist/metadata.d.ts.map +1 -1
- package/dist/metadata.js +17 -23
- package/dist/metadata.js.map +1 -1
- package/dist/migration.d.ts +9 -0
- package/dist/migration.d.ts.map +1 -0
- package/dist/migration.js +564 -0
- package/dist/migration.js.map +1 -0
- package/dist/mvp-contract-fixtures.d.ts +244 -0
- package/dist/mvp-contract-fixtures.d.ts.map +1 -0
- package/dist/mvp-contract-fixtures.js +556 -0
- package/dist/mvp-contract-fixtures.js.map +1 -0
- package/dist/mvp-contracts.d.ts +761 -0
- package/dist/mvp-contracts.d.ts.map +1 -0
- package/dist/mvp-contracts.js +59 -0
- package/dist/mvp-contracts.js.map +1 -0
- package/dist/mvp-time.d.ts +54 -0
- package/dist/mvp-time.d.ts.map +1 -0
- package/dist/mvp-time.js +148 -0
- package/dist/mvp-time.js.map +1 -0
- package/dist/notebook/types.d.ts +85 -8
- package/dist/notebook/types.d.ts.map +1 -1
- package/dist/notebook-grid.d.ts +37 -0
- package/dist/notebook-grid.d.ts.map +1 -0
- package/dist/notebook-grid.js +160 -0
- package/dist/notebook-grid.js.map +1 -0
- package/dist/notebook-media-artifact.d.ts +23 -0
- package/dist/notebook-media-artifact.d.ts.map +1 -0
- package/dist/notebook-media-artifact.js +67 -0
- package/dist/notebook-media-artifact.js.map +1 -0
- package/dist/notebook-mentions.d.ts +20 -0
- package/dist/notebook-mentions.d.ts.map +1 -0
- package/dist/notebook-mentions.js +53 -0
- package/dist/notebook-mentions.js.map +1 -0
- package/dist/order-keys.d.ts +22 -0
- package/dist/order-keys.d.ts.map +1 -0
- package/dist/order-keys.js +262 -0
- package/dist/order-keys.js.map +1 -0
- package/dist/runtime-services.js +8 -11
- package/dist/runtime-services.js.map +1 -1
- package/dist/schema.d.ts +8 -5
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +624 -141
- package/dist/schema.js.map +1 -1
- package/dist/search-benchmark.d.ts +4 -0
- package/dist/search-benchmark.d.ts.map +1 -0
- package/dist/search-benchmark.js +144 -0
- package/dist/search-benchmark.js.map +1 -0
- package/dist/sequences.d.ts +20 -0
- package/dist/sequences.d.ts.map +1 -0
- package/dist/sequences.js +825 -0
- package/dist/sequences.js.map +1 -0
- package/dist/similarity.js +10 -10
- package/dist/similarity.js.map +1 -1
- package/dist/status.js +8 -10
- package/dist/status.js.map +1 -1
- package/dist/storage.d.ts +3 -1
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +388 -7
- package/dist/storage.js.map +1 -1
- package/dist/store.d.ts +64 -3
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +354 -68
- package/dist/store.js.map +1 -1
- package/dist/streams.d.ts +10 -0
- package/dist/streams.d.ts.map +1 -0
- package/dist/streams.js +183 -0
- package/dist/streams.js.map +1 -0
- package/dist/temporal-models.d.ts +48 -0
- package/dist/temporal-models.d.ts.map +1 -0
- package/dist/temporal-models.js +278 -0
- package/dist/temporal-models.js.map +1 -0
- package/dist/temporal-search.d.ts +29 -0
- package/dist/temporal-search.d.ts.map +1 -0
- package/dist/temporal-search.js +1551 -0
- package/dist/temporal-search.js.map +1 -0
- package/dist/transcripts.d.ts +16 -0
- package/dist/transcripts.d.ts.map +1 -0
- package/dist/transcripts.js +519 -0
- package/dist/transcripts.js.map +1 -0
- package/docs/engine-layout.md +345 -110
- package/docs/mvp-prd.md +918 -0
- package/fixtures/media/vancat.mp4 +0 -0
- package/fixtures/media/vancat_profile.jpg +0 -0
- package/fixtures/v5/contract-fixtures.json +1532 -0
- package/package.json +42 -5
- package/dist/history-types.d.ts +0 -74
- package/dist/history-types.d.ts.map +0 -1
- package/dist/history-types.js +0 -2
- package/dist/history-types.js.map +0 -1
- package/dist/resolver.d.ts +0 -15
- package/dist/resolver.d.ts.map +0 -1
- package/dist/resolver.js +0 -81
- package/dist/resolver.js.map +0 -1
- package/dist/timeline.d.ts +0 -9
- package/dist/timeline.d.ts.map +0 -1
- package/dist/timeline.js +0 -236
- package/dist/timeline.js.map +0 -1
package/README.md
CHANGED
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
videobook per engine root. It keeps book state, artifacts, files, metadata,
|
|
5
5
|
notebook graphs, revisions, and action history in a single catalog.
|
|
6
6
|
|
|
7
|
+
The temporal search, sequence, and edit-engine requirements for the Videobook
|
|
8
|
+
MVP are in [docs/mvp-prd.md](docs/mvp-prd.md).
|
|
9
|
+
|
|
7
10
|
There is no project layer. A fresh engine root creates exactly one Book;
|
|
8
11
|
reopening that root always returns the same book.
|
|
9
12
|
|
|
@@ -18,7 +21,7 @@ const engine = createEngine({
|
|
|
18
21
|
});
|
|
19
22
|
|
|
20
23
|
const book = engine.book.get();
|
|
21
|
-
// { bookId: "…",
|
|
24
|
+
// { bookId: "…", name: "My Story", createdAt: … }
|
|
22
25
|
|
|
23
26
|
const script = await engine.artifacts.create({
|
|
24
27
|
kind: "script",
|
|
@@ -40,6 +43,31 @@ engine.close();
|
|
|
40
43
|
later opens it is optional and never changes the stored book. Rename the book
|
|
41
44
|
explicitly with `await engine.book.rename("new-name")`.
|
|
42
45
|
|
|
46
|
+
## MVP contracts
|
|
47
|
+
|
|
48
|
+
Contract version 1, introduced with schema v5 and carried by the current
|
|
49
|
+
schema v19 catalog, defines the media-time, stream, transcript, sequence,
|
|
50
|
+
temporal-search, edit-intent, job, and copy-forward migration boundary:
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
import {
|
|
54
|
+
MVP_CONTRACT_VERSION,
|
|
55
|
+
MVP_CONTRACT_FIXTURES,
|
|
56
|
+
type EditIntent,
|
|
57
|
+
type SearchPage,
|
|
58
|
+
type Sequence,
|
|
59
|
+
type SourceRange,
|
|
60
|
+
} from "videobook-engine";
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
The typed fixtures cover every P0 edit operation and the main cross-repository
|
|
64
|
+
projections. The equivalent checked-in JSON fixture is exported as
|
|
65
|
+
`videobook-engine/fixtures/v5`. Contract objects use rational, half-open media
|
|
66
|
+
ranges and immutable object-hash-qualified stream references. The legacy
|
|
67
|
+
schema-v4 timeline compiles into the sequences model at import; the schema-v4
|
|
68
|
+
similarity API remains a compatibility surface until it compiles into
|
|
69
|
+
temporal-search semantics.
|
|
70
|
+
|
|
43
71
|
## Storage model
|
|
44
72
|
|
|
45
73
|
Each engine root owns exactly one book:
|
|
@@ -56,65 +84,65 @@ rootDir/
|
|
|
56
84
|
Semantic tables are committed as Dolt revisions. Runtime tables (jobs, leases,
|
|
57
85
|
views, caches, settings, and logs) share the same database, match the
|
|
58
86
|
versioned `runtime_%` ignore policy, and are never staged. Semantic surrogate
|
|
59
|
-
identities are UUIDv7 values. Artifact
|
|
87
|
+
identities are UUIDv7 values. Artifact labels are free-text display names and can be
|
|
60
88
|
reused after hard deletion; immutable CAS objects remain available to history.
|
|
61
89
|
|
|
62
|
-
The current catalog format is schema version
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
`
|
|
69
|
-
`
|
|
70
|
-
`
|
|
71
|
-
`
|
|
72
|
-
|
|
73
|
-
|
|
90
|
+
The current catalog format is schema version 20. Valid schema version 19
|
|
91
|
+
catalogs upgrade in place. Catalogs with cells outside the fixed 26-by-13
|
|
92
|
+
notebook grid are rejected, and older catalogs require an explicit migration
|
|
93
|
+
or a fresh engine root.
|
|
94
|
+
|
|
95
|
+
The 34 versioned semantic tables are `engine_schema`, `book`, `artifacts`,
|
|
96
|
+
`objects`, `artifact_files`, `artifact_streams`, `book_metadata`,
|
|
97
|
+
`artifact_metadata`, `entities`, `notebooks`, `notebook_fields`, `cells`,
|
|
98
|
+
`notebook_cell_executions`, `notebook_generation_plans`,
|
|
99
|
+
`notebook_run_plans`, `notebook_transcript_edits`,
|
|
100
|
+
`notebook_transcript_attachments`, `edges`, `runs`, `cell_references`,
|
|
101
|
+
`pinned_search_results`, `transcripts`, `transcript_segments`,
|
|
102
|
+
`transcript_words`, `sequences`, `sequence_tracks`, `sequence_clips`,
|
|
103
|
+
`clip_links`, `clip_transforms`, `transitions`, `caption_cues`,
|
|
104
|
+
`audio_waveforms`, `prompt_entries`, and `messages`. Dolt's versioned
|
|
105
|
+
`dolt_ignore` configuration table carries the local-table policy. Provenance
|
|
106
|
+
is the commit log itself: every semantic commit carries its operation,
|
|
107
|
+
parameters, and write set in a structured commit message, authored by the
|
|
108
|
+
configured engine identity.
|
|
109
|
+
|
|
110
|
+
The 23 local-only tables are `runtime_meta`, `runtime_jobs`, `job_runs`,
|
|
74
111
|
`runtime_resource_leases`, `runtime_object_publications`,
|
|
75
112
|
`runtime_workspace_entries`, `runtime_artifact_views`,
|
|
76
113
|
`runtime_pending_tasks`, `runtime_generation_errors`, `runtime_settings`,
|
|
77
|
-
`runtime_logs`, `runtime_commit_outbox`, `
|
|
114
|
+
`runtime_logs`, `runtime_commit_outbox`, `runtime_index_manifests`,
|
|
115
|
+
`runtime_index_generations`, `runtime_index_coverage`,
|
|
116
|
+
`runtime_media_segments`, `runtime_segment_text`,
|
|
117
|
+
`runtime_segment_embeddings`, `runtime_segment_fingerprints`,
|
|
118
|
+
`runtime_index_batches`, `runtime_similarity_embeddings`,
|
|
78
119
|
`runtime_text_similarity_documents`, and `runtime_text_similarity_chunks`.
|
|
79
120
|
|
|
80
121
|
See [the complete engine layout](docs/engine-layout.md) for every schema
|
|
81
122
|
column, relationship, index, runtime/CAS structure, current editing contract,
|
|
82
123
|
and the additional normalized structures a full non-linear editor will need.
|
|
83
124
|
|
|
84
|
-
## Artifacts and
|
|
125
|
+
## Artifacts, labels, and identity
|
|
85
126
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
| Kind | Prefix | Example |
|
|
91
|
-
| --- | --- | --- |
|
|
92
|
-
| `video` | `vid-` | `vid-opening-shot` |
|
|
93
|
-
| `image` | `img-` | `img-cat-portrait` |
|
|
94
|
-
| `audio` | `aud-` | `aud-ambient-bed` |
|
|
95
|
-
| `script` | `script-` | `script-opening-draft` |
|
|
96
|
-
| `character` | `char-` | `char-protagonist` |
|
|
97
|
-
| `prompt` | `prompt-` | `prompt-sunrise` |
|
|
98
|
-
| `scene` | `scene-` | `scene-rooftop` |
|
|
99
|
-
| `final` | `final` | `final` |
|
|
100
|
-
|
|
101
|
-
There is no `notebook` artifact kind or `book-` artifact prefix. Notebook
|
|
102
|
-
graphs remain available separately through `engine.notebooks`.
|
|
127
|
+
Artifacts are identified by `artifact_id` (UUIDv7) — the only reference
|
|
128
|
+
handle. An optional free-text `label` exists purely for display: it is
|
|
129
|
+
non-unique, never parsed, and never used to look anything up. Media content
|
|
130
|
+
is addressed by `object_hash` in the CAS.
|
|
103
131
|
|
|
104
132
|
## API surface
|
|
105
133
|
|
|
106
|
-
- `engine.book` — `get()` and `rename(
|
|
107
|
-
- `engine.artifacts` — create, list, get, rename
|
|
134
|
+
- `engine.book` — `get()` and `rename(name)` for the singleton book
|
|
135
|
+
- `engine.artifacts` — create, list, get, rename (relabel), and delete
|
|
108
136
|
- `engine.files` and `engine.workspaces` — immutable object-backed files and
|
|
109
137
|
disposable materialization
|
|
110
138
|
- `engine.metadata` — book metadata, artifact metadata, and audio waveforms
|
|
111
|
-
- `engine.
|
|
112
|
-
|
|
139
|
+
- `engine.sequences` and `engine.edits` — the sequence/track/clip timeline
|
|
140
|
+
model and its transactional edit operations
|
|
113
141
|
- `engine.entities` and `engine.notebooks` — normalized characters, prompts,
|
|
114
142
|
scenes, and notebook graph documents
|
|
115
143
|
- `engine.prompts` and `engine.messages` — semantic prompt and message history
|
|
116
|
-
- `engine.history` —
|
|
117
|
-
restores
|
|
144
|
+
- `engine.history` — revision listings, per-artifact history, and forward
|
|
145
|
+
restores derived from the Dolt commit log
|
|
118
146
|
- `engine.jobs`, `engine.status`, `engine.settings`, and `engine.logs` —
|
|
119
147
|
runtime coordination
|
|
120
148
|
- `engine.storage` — object publication and catalog backup
|
|
@@ -123,8 +151,25 @@ graphs remain available separately through `engine.notebooks`.
|
|
|
123
151
|
All APIs operate in the engine's one book. No method accepts or returns a
|
|
124
152
|
project ID.
|
|
125
153
|
|
|
126
|
-
|
|
127
|
-
|
|
154
|
+
### Full API benchmark
|
|
155
|
+
|
|
156
|
+
The deterministic benchmark exercises every top-level `Engine` API group,
|
|
157
|
+
reports latency distributions per operation, and identifies the smallest set
|
|
158
|
+
of operations responsible for at least 80% of measured time:
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
npm run benchmark:api
|
|
162
|
+
npm run benchmark:api -- --json --output /tmp/videobook-api-benchmark.json
|
|
163
|
+
npm run benchmark:api:smoke
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
The default workload creates 40 artifacts, indexes 2,000 temporal moments, and
|
|
167
|
+
repeats the read paths 100 times. Use `--artifacts`, `--moments`, and `--reads`
|
|
168
|
+
to select a different workload; use `--retain-fixture` to keep the generated
|
|
169
|
+
engine root for inspection.
|
|
170
|
+
|
|
171
|
+
Deleting an artifact or entity that is referenced by a live cell or clip
|
|
172
|
+
returns `IN_USE` with `details.references`. Deleting a notebook cascades
|
|
128
173
|
its owned cells, edges, and terminal runs. There are no tombstone rows.
|
|
129
174
|
|
|
130
175
|
## Revisions and restores
|
|
@@ -135,44 +180,30 @@ unambiguous prefix) to inspect or restore state:
|
|
|
135
180
|
```ts
|
|
136
181
|
const revisions = engine.history.revisions();
|
|
137
182
|
|
|
138
|
-
await engine.history.restoreArtifact(
|
|
139
|
-
artifactId,
|
|
140
|
-
revisions[0]!.hash,
|
|
141
|
-
"script-restored-draft", // optional replacement slug
|
|
142
|
-
);
|
|
183
|
+
await engine.history.restoreArtifact(artifactId, revisions[0]!.hash);
|
|
143
184
|
|
|
144
185
|
await engine.history.restore(revisions[0]!.hash);
|
|
145
186
|
```
|
|
146
187
|
|
|
147
188
|
`restoreArtifact` keeps the artifact UUID stable and restores its files,
|
|
148
|
-
metadata, and waveform as a new forward revision. `restore`
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
189
|
+
metadata, and waveform as a new forward revision. `restore` mechanically
|
|
190
|
+
reloads every semantic table from its `dolt_at_*` projection at the target
|
|
191
|
+
revision — book metadata, artifacts and files, entities, notebooks, sequences,
|
|
192
|
+
prompts, messages, and the rest — so the restored state is exactly the state
|
|
193
|
+
that revision recorded. Runtime work is invalidated and active jobs are
|
|
194
|
+
aborted during a restore.
|
|
152
195
|
|
|
153
196
|
## Future forks
|
|
154
197
|
|
|
155
|
-
Schema
|
|
156
|
-
|
|
198
|
+
Schema v18 adds independently mergeable notebook workflow rows while retaining
|
|
199
|
+
the stable identities and normalized boundaries introduced in v17. A fork is a
|
|
200
|
+
separate catalog copy in another namespace,
|
|
157
201
|
keeps the same `bookId`, and can open a pull request against the upstream
|
|
158
202
|
`main` branch. User, origin, fork, and pull-request APIs are intentionally not
|
|
159
203
|
part of this release; an open engine still accepts only its local `main`
|
|
160
|
-
branch.
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
```ts
|
|
165
|
-
const action = await engine.history.recordAction({
|
|
166
|
-
operation: "generate_image",
|
|
167
|
-
scope: "artifact",
|
|
168
|
-
targetArtifactId: imageId,
|
|
169
|
-
inputArtifactIds: [promptId],
|
|
170
|
-
outputArtifactIds: [imageId],
|
|
171
|
-
writeSet: [`artifact:${imageId}`],
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
const page = engine.history.actions({ limit: 50 });
|
|
175
|
-
```
|
|
204
|
+
branch. Because provenance lives in authored Dolt commits rather than
|
|
205
|
+
engine-owned meta-history tables, merging a fork never requires merging a
|
|
206
|
+
parallel audit graph.
|
|
176
207
|
|
|
177
208
|
## Similarity
|
|
178
209
|
|
package/dist/artifacts.d.ts
CHANGED
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
import type { Artifact, ArtifactKind, CreateArtifactInput, EngineError, RenameArtifactInput, Result } from "./engine-types.js";
|
|
2
2
|
import { EngineContext } from "./context.js";
|
|
3
3
|
export declare function createArtifactsApi(context: EngineContext): {
|
|
4
|
-
create: (input: CreateArtifactInput | string,
|
|
4
|
+
create: (input: CreateArtifactInput | string, label?: string) => Promise<Result<Artifact, EngineError>>;
|
|
5
5
|
list: (options?: {
|
|
6
6
|
sort?: "newest" | "oldest";
|
|
7
7
|
}) => Artifact[];
|
|
8
|
-
get: (
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
rename: (input: RenameArtifactInput | string, name?: string) => Promise<Result<Artifact, EngineError>>;
|
|
12
|
-
delete: (artifact: string) => Promise<Result<{
|
|
8
|
+
get: (artifactId: string) => Result<Artifact, EngineError>;
|
|
9
|
+
rename: (input: RenameArtifactInput | string, label?: string) => Promise<Result<Artifact, EngineError>>;
|
|
10
|
+
delete: (artifactId: string) => Promise<Result<{
|
|
13
11
|
artifactId: string;
|
|
14
|
-
slug: string;
|
|
15
12
|
}, EngineError>>;
|
|
16
13
|
};
|
|
17
14
|
export declare function normalizeKind(input: string): ArtifactKind;
|
|
18
|
-
/** Normalizes a name or slug with the canonical prefix for its artifact kind. */
|
|
19
|
-
export declare function artifactSlug(kind: ArtifactKind, input: string): string;
|
|
20
15
|
//# sourceMappingURL=artifacts.d.ts.map
|
package/dist/artifacts.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifacts.d.ts","sourceRoot":"","sources":["../src/artifacts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,QAAQ,EACR,YAAY,EACZ,mBAAmB,EACnB,WAAW,EACX,mBAAmB,EACnB,MAAM,EACP,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,aAAa,EAId,MAAM,cAAc,CAAC;AActB,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,aAAa;oBAG5C,mBAAmB,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"artifacts.d.ts","sourceRoot":"","sources":["../src/artifacts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,QAAQ,EACR,YAAY,EACZ,mBAAmB,EACnB,WAAW,EACX,mBAAmB,EACnB,MAAM,EACP,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,aAAa,EAId,MAAM,cAAc,CAAC;AActB,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,aAAa;oBAG5C,mBAAmB,GAAG,MAAM,UAC3B,MAAM,KACb,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;qBAExB;QAAE,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAA;KAAE,KAAG,QAAQ,EAAE;sBAE1C,MAAM,KAAG,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC;oBAG/C,mBAAmB,GAAG,MAAM,UAC3B,MAAM,KACb,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;yBAG3B,MAAM,KACjB,OAAO,CAAC,MAAM,CAAC;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,EAAE,WAAW,CAAC,CAAC;EAG1D;AAoOD,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,CA4BzD"}
|
package/dist/artifacts.js
CHANGED
|
@@ -6,60 +6,44 @@ import { EngineFault } from "./store.js";
|
|
|
6
6
|
import { newUuidV7 } from "./ids.js";
|
|
7
7
|
export function createArtifactsApi(context) {
|
|
8
8
|
return {
|
|
9
|
-
create: (input,
|
|
9
|
+
create: (input, label) => createArtifact(context, input, label),
|
|
10
10
|
list: (options) => listArtifacts(context, options),
|
|
11
|
-
get: (
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
.prepare(`SELECT artifact_id, slug, kind, created_at
|
|
15
|
-
FROM artifacts
|
|
16
|
-
WHERE slug=?`)
|
|
17
|
-
.get(slug);
|
|
18
|
-
if (!row)
|
|
19
|
-
throw new Error(`Active artifact slug not found: ${slug}`);
|
|
20
|
-
return context.artifact(row);
|
|
21
|
-
}),
|
|
22
|
-
isSlugAvailable: (slug) => !context.store.db
|
|
23
|
-
.prepare(`SELECT 1 AS present
|
|
24
|
-
FROM artifacts
|
|
25
|
-
WHERE slug=?`)
|
|
26
|
-
.get(slug),
|
|
27
|
-
rename: (input, name) => renameArtifact(context, input, name),
|
|
28
|
-
delete: (artifact) => deleteArtifact(context, artifact),
|
|
11
|
+
get: (artifactId) => syncResultOf(() => context.artifact(context.artifactRowById(artifactId))),
|
|
12
|
+
rename: (input, label) => renameArtifact(context, input, label),
|
|
13
|
+
delete: (artifactId) => deleteArtifact(context, artifactId),
|
|
29
14
|
};
|
|
30
15
|
}
|
|
31
|
-
|
|
16
|
+
function normalizeLabel(input) {
|
|
17
|
+
const label = input?.trim();
|
|
18
|
+
return label ? label : null;
|
|
19
|
+
}
|
|
20
|
+
async function createArtifact(context, input, positionalLabel) {
|
|
32
21
|
return resultOf(async () => {
|
|
33
22
|
const parsed = typeof input === "string"
|
|
34
23
|
? {
|
|
35
24
|
kind: normalizeKind(input),
|
|
36
|
-
|
|
37
|
-
explicitSlug: undefined,
|
|
25
|
+
label: normalizeLabel(positionalLabel),
|
|
38
26
|
}
|
|
39
27
|
: {
|
|
40
28
|
kind: normalizeKind(input.kind),
|
|
41
|
-
|
|
42
|
-
explicitSlug: input.slug,
|
|
29
|
+
label: normalizeLabel(input.label),
|
|
43
30
|
};
|
|
44
|
-
const base = artifactSlug(parsed.kind, parsed.explicitSlug ?? parsed.name);
|
|
45
|
-
const slug = parsed.explicitSlug === undefined
|
|
46
|
-
? nextActiveSlug(context, base)
|
|
47
|
-
: base;
|
|
48
31
|
const artifactId = newUuidV7();
|
|
49
32
|
const mutation = await context.store.semantic({
|
|
50
33
|
operation: "create_artifact",
|
|
34
|
+
tables: ["artifacts"],
|
|
51
35
|
artifactId,
|
|
52
|
-
details: {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
],
|
|
57
|
-
},
|
|
36
|
+
details: {
|
|
37
|
+
...(parsed.label === null ? {} : { label: parsed.label }),
|
|
38
|
+
kind: parsed.kind,
|
|
39
|
+
},
|
|
40
|
+
writeSet: [`artifact:${artifactId}`],
|
|
41
|
+
}, (_operationId, now) => {
|
|
58
42
|
context.store.db
|
|
59
43
|
.prepare(`INSERT INTO artifacts(
|
|
60
|
-
artifact_id,
|
|
44
|
+
artifact_id, label, kind, created_at
|
|
61
45
|
) VALUES (?, ?, ?, ?)`)
|
|
62
|
-
.run(artifactId,
|
|
46
|
+
.run(artifactId, parsed.label, parsed.kind, now);
|
|
63
47
|
context.store.db
|
|
64
48
|
.prepare(`INSERT INTO runtime_artifact_views(
|
|
65
49
|
artifact_id, status, meta_json, deadline_at, updated_at
|
|
@@ -72,54 +56,54 @@ async function createArtifact(context, input, positionalName) {
|
|
|
72
56
|
.run(artifactId, context.artifactPath(artifactId), now);
|
|
73
57
|
});
|
|
74
58
|
context.ensureArtifactWorkspace(artifactId);
|
|
75
|
-
return ok(context.artifact(context.
|
|
59
|
+
return ok(context.artifact(context.artifactRowById(artifactId)), mutation.revision);
|
|
76
60
|
});
|
|
77
61
|
}
|
|
78
62
|
function listArtifacts(context, options = {}) {
|
|
79
63
|
const direction = options.sort === "oldest" ? "ASC" : "DESC";
|
|
80
64
|
const rows = context.store.db
|
|
81
|
-
.prepare(`SELECT artifact_id,
|
|
65
|
+
.prepare(`SELECT artifact_id, label, kind, created_at
|
|
82
66
|
FROM artifacts
|
|
83
67
|
ORDER BY created_at ${direction}, artifact_id ${direction}`)
|
|
84
68
|
.all();
|
|
85
69
|
return rows.map((row) => context.artifact(row));
|
|
86
70
|
}
|
|
87
|
-
async function renameArtifact(context, input,
|
|
71
|
+
async function renameArtifact(context, input, positionalLabel) {
|
|
88
72
|
return resultOf(async () => {
|
|
89
73
|
const parsed = typeof input === "string"
|
|
90
|
-
? { artifact: input,
|
|
74
|
+
? { artifact: input, label: positionalLabel ?? "" }
|
|
91
75
|
: input;
|
|
92
|
-
const current = context.
|
|
93
|
-
const
|
|
94
|
-
if (
|
|
76
|
+
const current = context.artifactRowById(parsed.artifact);
|
|
77
|
+
const label = normalizeLabel(parsed.label);
|
|
78
|
+
if (label === current.label)
|
|
95
79
|
return context.artifact(current);
|
|
96
80
|
const mutation = await context.store.semantic({
|
|
97
81
|
operation: "rename_artifact",
|
|
82
|
+
tables: ["artifacts"],
|
|
98
83
|
artifactId: current.artifact_id,
|
|
99
|
-
details: {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}, ["artifacts"], () => {
|
|
84
|
+
details: {
|
|
85
|
+
...(current.label === null ? {} : { oldLabel: current.label }),
|
|
86
|
+
...(label === null ? {} : { newLabel: label }),
|
|
87
|
+
},
|
|
88
|
+
writeSet: [`artifact:${current.artifact_id}`],
|
|
89
|
+
}, () => {
|
|
106
90
|
context.store.db
|
|
107
91
|
.prepare(`UPDATE artifacts
|
|
108
|
-
SET
|
|
92
|
+
SET label=?
|
|
109
93
|
WHERE artifact_id=?`)
|
|
110
|
-
.run(
|
|
94
|
+
.run(label, current.artifact_id);
|
|
111
95
|
});
|
|
112
|
-
return ok(context.artifact(context.
|
|
96
|
+
return ok(context.artifact(context.artifactRowById(current.artifact_id)), mutation.revision);
|
|
113
97
|
});
|
|
114
98
|
}
|
|
115
|
-
async function deleteArtifact(context,
|
|
99
|
+
async function deleteArtifact(context, artifactId) {
|
|
116
100
|
return resultOf(async () => {
|
|
117
|
-
const artifact = context.
|
|
101
|
+
const artifact = context.artifactRowById(artifactId);
|
|
118
102
|
const references = artifactReferences(context, artifact.artifact_id);
|
|
119
103
|
if (references.length > 0) {
|
|
120
104
|
throw new EngineFault({
|
|
121
105
|
code: "IN_USE",
|
|
122
|
-
message: `Artifact is still referenced: ${artifact.
|
|
106
|
+
message: `Artifact is still referenced: ${artifact.artifact_id}`,
|
|
123
107
|
details: { references },
|
|
124
108
|
});
|
|
125
109
|
}
|
|
@@ -131,22 +115,19 @@ async function deleteArtifact(context, artifactReference) {
|
|
|
131
115
|
.all(artifact.artifact_id);
|
|
132
116
|
const mutation = await context.store.semantic({
|
|
133
117
|
operation: "delete_artifact",
|
|
118
|
+
tables: [
|
|
119
|
+
"artifacts",
|
|
120
|
+
"artifact_files",
|
|
121
|
+
"artifact_metadata",
|
|
122
|
+
"audio_waveforms",
|
|
123
|
+
],
|
|
134
124
|
artifactId: artifact.artifact_id,
|
|
135
125
|
details: {
|
|
136
|
-
|
|
126
|
+
...(artifact.label === null ? {} : { label: artifact.label }),
|
|
137
127
|
cancelledJobs: jobs.map((job) => job.id),
|
|
138
128
|
},
|
|
139
|
-
writeSet: [
|
|
140
|
-
|
|
141
|
-
`artifact-slug:${artifact.slug}`,
|
|
142
|
-
],
|
|
143
|
-
}, [
|
|
144
|
-
"artifacts",
|
|
145
|
-
"artifact_files",
|
|
146
|
-
"artifact_metadata",
|
|
147
|
-
"audio_waveforms",
|
|
148
|
-
"job_runs",
|
|
149
|
-
], (_operationId, now) => {
|
|
129
|
+
writeSet: [`artifact:${artifact.artifact_id}`],
|
|
130
|
+
}, (_operationId, now) => {
|
|
150
131
|
context.store.db
|
|
151
132
|
.prepare("DELETE FROM artifacts WHERE artifact_id=?")
|
|
152
133
|
.run(artifact.artifact_id);
|
|
@@ -194,10 +175,7 @@ async function deleteArtifact(context, artifactReference) {
|
|
|
194
175
|
recursive: true,
|
|
195
176
|
force: true,
|
|
196
177
|
});
|
|
197
|
-
return ok({
|
|
198
|
-
artifactId: artifact.artifact_id,
|
|
199
|
-
slug: artifact.slug,
|
|
200
|
-
}, mutation.revision);
|
|
178
|
+
return ok({ artifactId: artifact.artifact_id }, mutation.revision);
|
|
201
179
|
});
|
|
202
180
|
}
|
|
203
181
|
export function normalizeKind(input) {
|
|
@@ -229,47 +207,11 @@ export function normalizeKind(input) {
|
|
|
229
207
|
throw new Error(`Invalid artifact kind: ${input}`);
|
|
230
208
|
}
|
|
231
209
|
}
|
|
232
|
-
/** Normalizes a name or slug with the canonical prefix for its artifact kind. */
|
|
233
|
-
export function artifactSlug(kind, input) {
|
|
234
|
-
if (kind === "final")
|
|
235
|
-
return "final";
|
|
236
|
-
const prefix = prefixForKind(kind);
|
|
237
|
-
let normalized = input
|
|
238
|
-
.trim()
|
|
239
|
-
.toLowerCase()
|
|
240
|
-
.replace(/^@/, "")
|
|
241
|
-
.replace(/[^a-z0-9_-]+/g, "-")
|
|
242
|
-
.replace(/-+/g, "-")
|
|
243
|
-
.replace(/^[-_]+|[-_]+$/g, "");
|
|
244
|
-
if (!normalized)
|
|
245
|
-
throw new Error("Artifact name or slug is required");
|
|
246
|
-
const knownPrefix = /^(vid|img|aud|script|char|prompt|scene|prm|scn)-/;
|
|
247
|
-
if (knownPrefix.test(normalized)) {
|
|
248
|
-
if (!normalized.startsWith(`${prefix}-`)) {
|
|
249
|
-
throw new Error(`Artifact slug ${normalized} does not match kind ${kind}`);
|
|
250
|
-
}
|
|
251
|
-
return normalized;
|
|
252
|
-
}
|
|
253
|
-
normalized = `${prefix}-${normalized}`;
|
|
254
|
-
if (!/^[a-z0-9]+(?:[a-z0-9_-]*[a-z0-9])?$/.test(normalized)) {
|
|
255
|
-
throw new Error(`Invalid artifact slug: ${normalized}`);
|
|
256
|
-
}
|
|
257
|
-
return normalized;
|
|
258
|
-
}
|
|
259
|
-
function nextActiveSlug(context, base) {
|
|
260
|
-
let suffix = 1;
|
|
261
|
-
let candidate = base;
|
|
262
|
-
while (context.store.db
|
|
263
|
-
.prepare(`SELECT 1 AS present
|
|
264
|
-
FROM artifacts
|
|
265
|
-
WHERE slug=?`)
|
|
266
|
-
.get(candidate)) {
|
|
267
|
-
suffix += 1;
|
|
268
|
-
candidate = `${base}-${suffix}`;
|
|
269
|
-
}
|
|
270
|
-
return candidate;
|
|
271
|
-
}
|
|
272
210
|
function artifactReferences(context, artifactId) {
|
|
211
|
+
// Covers every RESTRICT foreign key targeting artifacts so a refused
|
|
212
|
+
// delete surfaces as IN_USE rather than a raw FK error mapped to
|
|
213
|
+
// IO_ERROR. CASCADE-owned rows (artifact_files, artifact_metadata,
|
|
214
|
+
// audio_waveforms) are deleted with the artifact and are not listed.
|
|
273
215
|
const references = [];
|
|
274
216
|
const cells = context.store.db
|
|
275
217
|
.prepare(`SELECT notebook_id, cell_id FROM cells
|
|
@@ -279,34 +221,32 @@ function artifactReferences(context, artifactId) {
|
|
|
279
221
|
kind: "cell.outputArtifact",
|
|
280
222
|
id: `${cell.notebook_id}/${cell.cell_id}`,
|
|
281
223
|
})));
|
|
282
|
-
const
|
|
283
|
-
.prepare(
|
|
224
|
+
const streams = context.store.db
|
|
225
|
+
.prepare(`SELECT stream_id FROM artifact_streams
|
|
226
|
+
WHERE artifact_id=? ORDER BY stream_id`)
|
|
227
|
+
.all(artifactId);
|
|
228
|
+
references.push(...streams.map((stream) => ({ kind: "stream", id: stream.stream_id })));
|
|
229
|
+
const transcripts = context.store.db
|
|
230
|
+
.prepare(`SELECT transcript_id FROM transcripts
|
|
231
|
+
WHERE artifact_id=? ORDER BY transcript_id`)
|
|
232
|
+
.all(artifactId);
|
|
233
|
+
references.push(...transcripts.map((row) => ({
|
|
234
|
+
kind: "transcript",
|
|
235
|
+
id: row.transcript_id,
|
|
236
|
+
})));
|
|
237
|
+
const clips = context.store.db
|
|
238
|
+
.prepare(`SELECT clip_id FROM sequence_clips
|
|
239
|
+
WHERE artifact_id=? ORDER BY clip_id`)
|
|
284
240
|
.all(artifactId);
|
|
285
|
-
references.push(...
|
|
286
|
-
const
|
|
287
|
-
.prepare(
|
|
241
|
+
references.push(...clips.map((clip) => ({ kind: "sequenceClip", id: clip.clip_id })));
|
|
242
|
+
const pinned = context.store.db
|
|
243
|
+
.prepare(`SELECT notebook_id, cell_id, result_id FROM pinned_search_results
|
|
244
|
+
WHERE artifact_id=? ORDER BY notebook_id, cell_id, result_id`)
|
|
288
245
|
.all(artifactId);
|
|
289
|
-
references.push(...
|
|
246
|
+
references.push(...pinned.map((row) => ({
|
|
247
|
+
kind: "pinnedSearchResult",
|
|
248
|
+
id: `${row.notebook_id}/${row.cell_id}/${row.result_id}`,
|
|
249
|
+
})));
|
|
290
250
|
return references;
|
|
291
251
|
}
|
|
292
|
-
function prefixForKind(kind) {
|
|
293
|
-
switch (kind) {
|
|
294
|
-
case "video":
|
|
295
|
-
return "vid";
|
|
296
|
-
case "image":
|
|
297
|
-
return "img";
|
|
298
|
-
case "audio":
|
|
299
|
-
return "aud";
|
|
300
|
-
case "script":
|
|
301
|
-
return "script";
|
|
302
|
-
case "character":
|
|
303
|
-
return "char";
|
|
304
|
-
case "prompt":
|
|
305
|
-
return "prompt";
|
|
306
|
-
case "scene":
|
|
307
|
-
return "scene";
|
|
308
|
-
case "final":
|
|
309
|
-
return "final";
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
252
|
//# sourceMappingURL=artifacts.js.map
|
package/dist/artifacts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifacts.js","sourceRoot":"","sources":["../src/artifacts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAUtC,OAAO,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAEL,QAAQ,EACR,YAAY,GAEb,MAAM,cAAc,CAAC;AAC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E,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CACrE,CAAC;IACF,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,EAAE;SAC5B,OAAO,CACN;oEAC8D,CAC/D;SACA,GAAG,CAAC,UAAU,CAIf,CAAC;IACH,UAAU,CAAC,IAAI,CACb,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QACtB,IAAI,EAAE,oBAAoB;QAC1B,EAAE,EAAE,GAAG,GAAG,CAAC,WAAW,IAAI,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,SAAS,EAAE;KACzD,CAAC,CAAC,CACJ,CAAC;IACF,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
package/dist/books.d.ts
CHANGED
|
@@ -2,6 +2,6 @@ import type { Book, EngineError, Result } from "./engine-types.js";
|
|
|
2
2
|
import { EngineContext } from "./context.js";
|
|
3
3
|
export declare function createBookApi(context: EngineContext): {
|
|
4
4
|
get: () => Book;
|
|
5
|
-
rename: (
|
|
5
|
+
rename: (name: string) => Promise<Result<Book, EngineError>>;
|
|
6
6
|
};
|
|
7
7
|
//# sourceMappingURL=books.d.ts.map
|