@yugoo-design/dsh-design-studio 0.1.2 → 0.2.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/README.md CHANGED
@@ -1,91 +1,95 @@
1
1
  # Design Studio domain library
2
2
 
3
- `dsh-design-studio` is the host-neutral Studio domain layer. Its installed-content inspection remains read-only: compiled Kit/Bundle catalogs, exact Kit workspaces and real Bundle files with loader-compiled summaries. Optional Panel drafts use separately injected snapshot and persistence ports, never installed-content mutation. The library does not depend on DSH, Codex, Claude Code, Cordis or a browser UI.
4
-
5
- ## Catalog composition
6
-
7
- `buildStudioCompositionCatalog` derives one flat, immutable Bundle-version catalog from the Core-compiled installed snapshot. Identical `{name, version}` Bundle pins are coalesced without copying source, while different declared versions of the same Bundle name remain distinct. Each entry lists the exact published Kit versions that use it, so reverse dependencies are derived rather than maintained as a second authority. `searchStudioBundles` searches names and descriptions in deterministic catalog order.
8
-
9
- Hosts may supply the independent `snapshot.bundles` catalog, including unmounted
10
- versions. Kit bindings contribute reverse references only. Source inspection uses
11
- an exact host-resolved Bundle root, not a path inferred from an owning Kit.
12
- Catalog identity (`catalogName ?? name`) is distinct from a fork's preserved
13
- runtime name. File-backed retained closures preserve methods, resources and
14
- version pins after editable sources disappear; mutable discovery cannot replace
15
- a retained resource root for the same pin.
16
-
17
- ## Management service
18
-
19
- `StudioManagementService` is the host-neutral read API for the Studio browser surface. `workspace` derives a JSON-only view from a `StudioCatalogSnapshotPort`: published Kit pins plus searched Bundle entries with exact reverse Kit pins. `readKitWorkspace` resolves one exact installed `name@version` and returns the complete raw `mindset.md` source byte-identically, the mounted Bundles with reverse Kit references, the loader-compiled resource paths, and a browser-safe read-only projection of the optional Core-validated `relations.yaml`; a missing Kit or version diagnoses explicitly. Executable Core definitions and filesystem authority never enter the view model.
20
-
21
- ## Bundle source inspection
22
-
23
- `StudioBundleSourceService` reads real Bundle source files through the read-only `StudioBundleSourcePort`. `readBundleWorkspace` returns the complete readable UTF-8 file tree with byte sizes plus the loader-compiled `skill.yaml` manifest, parsed schema, validation rule/driver summary, and Panel classification (`native` Panels are provider-owned code; `declarative` Panels are Bundle-authored data). `readBundleFile` returns one file byte-exactly. Identity is reconciled against the compiled catalog by exact Kit and Bundle `name+version`; an ambiguous physical source (`studio.duplicate_source`) or a catalog/source disagreement (`studio.source_catalog_mismatch`) fails loud instead of guessing. Traversal, `.git`, directories, and binary content are rejected with explicit diagnostics.
24
-
25
- ## Validation
26
-
27
- `validateKit` and `validateBundle` capture the Design Core loader's content errors
28
- as bounded, locatable diagnostics. `valid` means the definition actually loads
29
- without errors, not that the diagnostic list is empty. An omitted diagnostic
30
- severity retains its existing error meaning; `severity: "warning"` is advisory.
31
-
32
- These entries and Kit-draft validation reuse Core's read-only knowledge-declaration
33
- analysis. A direct single-target record selector is compared with the owning
34
- schema's reference role and target. Warnings identify the Bundle, schema pointer,
35
- Panel section, field and expected collection. Explicit metadata, multi-target
36
- selectors, free-form/external references and unresolvable declarations do not
37
- acquire guessed semantics. No field-name or Kit-name heuristics, schema rewriting,
38
- Design File changes, new approval state or runtime loading gate are introduced.
39
- Kit-draft confirmation still gates on `valid`, so warnings remain visible without
40
- blocking a loadable working copy. Other error-only preview/read result contracts
41
- are unchanged. A passing definition is not proof that its KAG relationships have
42
- been indexed or accepted.
43
-
44
- ## Authoring and remaining boundaries
45
-
46
- The first authoring primitive, `prepareStudioPanelPreview`, compiles an in-memory `panel.yaml` edit against a host-resolved immutable Kit snapshot. It verifies the exact Kit and Bundle pins, uses the runtime loader (including translation and schema-binding checks), validates an isolated JSON sample, and returns runtime-interpreter input tagged with the editor revision. It writes no files, invokes no model or validation drivers, and grants no runtime/artifact/publication capabilities. Hosts must resolve the source snapshot themselves; arbitrary browser-supplied filesystem paths are not an API.
47
-
48
- `StudioPanelDraftService` implements a bounded Panel authoring slice: exact installed Kit/Bundle → retained immutable source snapshot → editable Panel/sample draft → preview → save/reopen → confirm/lock → new editable fork. Hosts own snapshot storage and atomic compare-and-swap. Incomplete drafts may be saved for recovery; confirmation reruns compilation against the retained source and rejects conflicts. Confirmed drafts cannot be overwritten. Companion supplies content-addressed complete-source snapshots and an atomic local repository under its trusted `stateRoot`, with size/count limits and no fallback to live project files. Preview does not run Bundle validation drivers or a model. Full Kit copy/create, import/export, actual Bundle trial execution and catalog publication are not yet implemented by this slice.
49
-
50
- `StudioKitDraftService` adds a Kit-owned authoring service over the same snapshot and
51
- atomic-repository ports. It retains the exact base Kit and mounted Bundle pins;
52
- only `mindset.md` and optional `relations.yaml` are editable in this slice. Shared
53
- Bundle source cannot be changed through this API. The Mindset catalog may reorder
54
- its entries but cannot add/remove/change mounted identities without a future
55
- explicit mount operation. Changing the candidate Kit identity does not publish it
56
- or retarget any installed Kit/session. Definition validation uses the full Core
57
- loader, and declarative Panel preview uses the retained mounted Bundle and an
58
- isolated sample through the existing preview implementation.
59
-
60
- Companion supplies durable Kit draft storage separately from Panel draft records,
61
- reusing the same locking, snapshot and confinement implementation. Authenticated
62
- `studioKitDraft*` RPC operations expose create/list/read/save/validate/preview/
63
- confirm/fork. Confirmation locks a successfully compiled working copy only; it is
64
- not a catalog publication or a runtime Bundle test. The optional shared Kit draft
65
- editor is exposed by `studio-ui` and wired to these RPC operations in Companion;
66
- it reuses the sample-only runtime renderer and protects pending navigation and
67
- confirmation. New-Kit scaffolding, independent Bundle working-copy adoption and
68
- release flow remain subsequent work, not claimed capabilities of these endpoints.
69
-
70
- The content archive functions described in [the archive contract](docs/content-archive.md)
71
- are exported from this library. Companion adds bounded private envelope storage
72
- and authenticated export/import/read/list/adopt routes. `studioContentImportAdopt`
73
- accepts a retained Kit or independent Bundle import ID, rechecks the archive and
74
- its definition, and passes the prepared units to the host's shared
75
- `contentLibrary.adoptPrepared` adapter. It retains the exact content closure in
76
- the local content library, rejecting different bytes at an existing pin and
77
- reusing identical bytes. Kit adoption additionally creates a new unconfirmed
78
- working copy through the existing snapshot/CAS service; repeated adoption creates
79
- separate Kit working-copy identities. Bundle adoption returns its independent
80
- pin without inventing a Kit, creating a Kit draft or mounting it into a project.
81
- Source/license/trust declarations remain in the import record. This operation
82
- does not overwrite installed sources, publish a new version, retarget project
83
- pins, register trusted providers or execute content. The shared archive browser
84
- is wired through `contentClient`: adopted Kits open their exact working copy;
85
- adopted Bundles open their exact source workspace after refreshing the catalog.
86
-
87
- Focused source-plane checks: `pnpm --filter dsh-design-studio test:kit-drafts`.
88
- The checked-in test configuration resolves Core source explicitly. Companion's
89
- `test/studio-panel-drafts.test.mjs` additionally exercises actual temporary storage,
90
- fresh service instances and retained declarative preview. These are not installed
91
- package or browser-interaction claims.
3
+ `dsh-design-studio` supplies host-neutral Kit/Bundle inspection, source authoring,
4
+ validation, archives and isolated Panel previews. Hosts provide storage and trusted
5
+ source readers; the library does not create native sessions or depend on a browser.
6
+ Core owns definition loading, schema validation and declarative Panel compilation.
7
+
8
+ ## Edit current content
9
+
10
+ The optional `dsh-design-studio/node` entry exposes `createStudioInstances` and its
11
+ Core-backed composition adapters. `editCurrent({kind, kit?, bundle?})` opens the
12
+ same catalog identity for editing. The first call materializes its complete source;
13
+ subsequent calls return that same record with `current: true`. Ordinary saves keep
14
+ its identity. `copy` explicitly creates a new independent identity while preserving
15
+ Bundle runtime names and data paths. Created and imported sources use the same editor.
16
+
17
+ Kit membership belongs to `kit.yaml`; its Mindset catalog is the generated readable
18
+ projection. Mounts select stable Bundle identities. A mounted local Bundle reads its
19
+ current saved source, including overlays, rather than locking an earlier revision.
20
+ Unfinished methods, missing dependencies and empty Kit membership can be saved;
21
+ loading or previewing reports the actual missing/invalid definition. A missing
22
+ installed catalog does not prevent reopening and editing retained local files.
23
+
24
+ `prepareChanges` returns a bounded multi-file source diff, candidate digest and
25
+ validation/preview diagnostics without saving. `saveChanges` defaults to `draft`:
26
+ it saves incomplete authoring source using the repository lock and atomic record
27
+ CAS. The internal revision and reviewed digest detect conflicting edits; they are
28
+ not release versions. Explicit `validated` saves remain an optional caller check,
29
+ not a prerequisite for ordinary editing. Source version metadata is retained as
30
+ provenance and does not require a version bump or remount to use saved changes.
31
+
32
+ `captureKit` captures the current complete Kit and all mounted Bundle bytes under
33
+ the same storage lock. `loadKit` compiles this captured closure through Core. Hosts
34
+ can supply it directly to Core's `ensureProjectKit(projectRoot, {loadSource})`:
35
+ a project receives its own complete editable `design_kit/kit` and
36
+ `design_kit/bundles/<identity>` trees, including binary resources. Methods, schema,
37
+ validation, Panel, summaries and runtime resources then come from that project.
38
+ Library edits affect future projects. Requested comparison/adaptation/synchronization
39
+ uses ordinary Agent source edits and existing validation, saving and Git.
40
+ There is no separate local publication, confirmation, upgrade or synchronization
41
+ workflow. Trusted native providers still own executable contributions.
42
+
43
+ ## Import, export and removal
44
+
45
+ `importSources({kind, files, title?})` accepts decoded ZIP/folder entries or a single
46
+ `SKILL.md`. A Bundle needs `SKILL.md`; a Kit needs `mindset.md` and `kit.yaml`.
47
+ Other incomplete or malformed definitions remain editable with locatable readiness
48
+ diagnostics. Imports get independent catalog identities and retain original bytes,
49
+ methods, runtime names and resources. Repeated display names receive numeric suffixes.
50
+ Kit imports preserve supplied Bundle trees; absent dependencies remain explicit.
51
+
52
+ `exportArchive({id, expectedRevision})` exports the current complete saved source
53
+ and mounted Bundle resources through the existing source-archive format. It supports
54
+ unfinished definitions, checks the source revision, and does not replace edits with
55
+ an installed base. Source/license metadata is optional and stays covered by archive
56
+ hashes. `exportStudioContentArchive` additionally validates complete definitions;
57
+ `exportStudioSourceArchive` preserves incomplete authoring material.
58
+
59
+ Removal moves the selected instance record to the operating system trash using
60
+ `trash`, or a trusted Host's `moveToTrash(file)` adapter. Revision checks and Bundle
61
+ reference protection apply. Failure never falls back to permanent deletion.
62
+ Restoring the record restores its source; shared snapshots remain available to other
63
+ copies. There is no separate Studio recycle-bin API.
64
+
65
+ ## Inspection and preview
66
+
67
+ `StudioManagementService` and `StudioBundleSourceService` expose JSON-only catalog
68
+ and source views. They inspect real UTF-8 source, resources, compiled manifests,
69
+ schemas, validation and optional relation declarations. Native Panels are provider
70
+ code; declarative Panels are source data. Identity ambiguity, traversal, binary text
71
+ reads and catalog/source disagreement produce explicit diagnostics. Runtime names
72
+ remain distinct from catalog identities.
73
+
74
+ Validation uses Core's real loader. Warnings are advisory and include locations;
75
+ `valid` means the definition loads, not that its diagnostic list is empty. Optional
76
+ knowledge-declaration analysis uses actual schema and reference declarations without
77
+ field-name heuristics, guessed relationships or source rewriting.
78
+
79
+ Panel preview uses the same loader and interpreter with isolated sample data:
80
+ explicit input, then `reference/preview.json`, then existing `initial_values`.
81
+ Invalid samples diagnose instead of silently falling back. Bounded synthetic artifact
82
+ mappings may support sample HTML/SVG resources. Preview grants no project file access,
83
+ does not run native validation drivers, and proves neither durable save/reopen nor
84
+ native Agent consumption. Hosts supply the actual installed component vocabulary.
85
+
86
+ ## Verification
87
+
88
+ Build Core and Studio before checks that consume `lib`. `test:source-import`,
89
+ `test:instance-changes` and `test:current-sources` exercise real Core definitions over
90
+ isolated source storage. Their checked-in configuration explicitly aliases Core
91
+ source. `test:node` checks the built Node entry and public types separately from
92
+ browser and native Host acceptance. Historical Panel-trial records expose read/list and retained-source reads. Installed
93
+ Bundle trials still use the bounded current-source capture. The former Kit/Panel
94
+ confirmation services, archive adoption, and cumulative draft/snapshot quotas have
95
+ been removed. Current records have no confirmation state; revisions protect writes.
@@ -9,6 +9,7 @@ or a substitute for license texts, source provision, or other obligations.
9
9
 
10
10
  | Component | License / location | Release requirement to verify |
11
11
  | --- | --- | --- |
12
+ | `trash@10.1.1` | MIT; upstream `sindresorhus/trash`, npm package `license` | Keep the external package, platform executables and its license together. Install the declared dependency; do not bundle its executable-relative paths into standalone JavaScript. |
12
13
  | Official Ladybug WASM dependency `@ladybugdb/wasm-core@0.21.1` | Package declares MIT; original text and public source locator in `third-party/native/ladybug-wasm-core-0.21.1/` | Current `packages/knowledge-ladybug` dependency route. Preserve Kùzu Inc./Ladybug Memory Inc. notices and verify actual release inclusion. The installed package has no separate third-party inventory or precise build-provenance file; embedded components and source/build correspondence remain unresolved. Package MIT is not a blanket license for the complete WASM. |
13
14
  | Historical vendored Ladybug WASM runtime | MIT; `vendor/ladybug/runtime/LICENSE` | Separate legacy route: preserve its own copyright/license, provenance and patch if distributed. Do not use its patch/source evidence as the build provenance of the official npm dependency. Compiled-in component checks remain separate. |
14
15
  | DSH code and reused utilities | MIT; `deepseek-harness/LICENSE` | Retain original notices; distinguish external host from copied/bundled utilities. |
package/lib/index.d.ts CHANGED
@@ -1,74 +1,5 @@
1
- import { DesignKit, DesignSkill, KitResourceContent } from "@yugoo-design/dsh-design-core";
2
- //#region src/types.d.ts
3
- /**
4
- * Host-neutral Design Studio ports and read-model vocabulary.
5
- *
6
- * The Studio is a pure domain library: every filesystem operation goes through
7
- * an injected port so each Agent Host adapter (DSH, Codex, Claude Code, SDK
8
- * Pilot) supplies its own native file operations. Nothing here imports an
9
- * Agent Host runtime, Cordis, or `node:fs`. Installed content remains read-only;
10
- * editable drafts use separate injected snapshot and persistence ports.
11
- */
12
- /**
13
- * Read-only filesystem surface the Studio needs to enumerate and validate
14
- * Kits. Structurally compatible with the Design Core `KitFsLike` loader port.
15
- */
16
- interface StudioReadFs {
17
- /** Read one UTF-8 text file; `undefined` when absent. */
18
- readText(path: string): Promise<string | undefined>;
19
- /** Optional attached-resource text/opaque projection; never used for definition slots. */
20
- readResource?(path: string): Promise<KitResourceContent | undefined>;
21
- /** List one directory's entry names. */
22
- listDir(path: string): Promise<string[]>;
23
- /** Whether a path is a directory; adapters without it fall back to read probes. */
24
- isDirectory?(path: string): Promise<boolean>;
25
- /** Resolve symlinks for confinement checks. */
26
- realPath?(path: string): Promise<string>;
27
- }
28
- /** One explicit Studio diagnostic (a stable code plus a locatable message). */
29
- interface StudioDiagnostic {
30
- /** Stable diagnostic code, e.g. `kit.load`. */
31
- readonly code: string;
32
- /** Human-readable, locatable message. */
33
- readonly message: string;
34
- /** The Kit or Bundle the diagnostic is about, when known. */
35
- readonly subject?: string;
36
- /** Omitted means error, preserving existing error-only consumers. */
37
- readonly severity?: 'warning';
38
- }
39
- /** The outcome of validating one Kit or Bundle definition. */
40
- interface StudioValidationReport {
41
- /** True when the definition loads without errors; warnings do not block use. */
42
- readonly valid: boolean;
43
- /** Definition errors or non-blocking authoring warnings. */
44
- readonly diagnostics: readonly StudioDiagnostic[];
45
- }
46
- /** Exact identity of one published Kit version. */
47
- interface DesignKitVersionPin {
48
- /** Published Kit name. */
49
- readonly name: string;
50
- /** Exact declared Kit version (`major.minor`). */
51
- readonly version: string;
52
- }
53
- /** Exact identity of one published Bundle version. */
54
- interface DesignBundleVersionPin {
55
- /** Published Bundle name. */
56
- readonly name: string;
57
- /** Explicit declared Bundle version (`major.minor`). */
58
- readonly version: string;
59
- }
60
- /**
61
- * Thrown by a Bundle source port when a file exists but is not decodable
62
- * UTF-8 text. The Studio surfaces binary content as an explicit diagnostic
63
- * instead of lossy-decoding it into a text viewer.
64
- */
65
- declare class StudioBinaryContentError extends Error {
66
- /** The path whose content is not UTF-8 text. */
67
- readonly path: string;
68
- /** @param path - absolute path of the non-text file. */
69
- constructor(path: string);
70
- }
71
- //#endregion
1
+ import { A as StudioDiagnostic, C as StudioPanelPreviewRequest, D as DesignBundleVersionPin, E as loadStudioKit, M as StudioValidationReport, O as DesignKitVersionPin, S as StudioPanelPreview, T as prepareStudioPanelPreview, _ as StudioArchiveSource, a as StudioInstanceFileChange, b as exportStudioSourceArchive, c as normalizeStudioInstanceChanges, d as StudioPanelDraftRecord, f as StudioPanelDraftRepository, g as StudioArchivePin, h as StudioArchiveFile, i as StudioInstanceChangeRequest, j as StudioReadFs, k as StudioBinaryContentError, l as StudioDraftSources, m as StudioSourceSnapshot, n as StudioInstanceCandidate, o as StudioInstanceFileDiff, p as StudioPanelDraftSummary, r as StudioInstanceChangeReceipt, s as StudioInstanceSaveChanges, t as STUDIO_INSTANCE_CHANGE_LIMITS, u as StudioPanelDraftContent, v as StudioContentArchive, w as StudioPanelPreviewResult, x as readStudioContentArchive, y as exportStudioContentArchive } from "./instance-changes-CFLBPBdi.js";
2
+ import { DesignKit, DesignSkill } from "@yugoo-design/dsh-design-core";
72
3
  //#region src/snapshot.d.ts
73
4
  /** One Bundle addressed by its declared version. */
74
5
  interface DesignBundleSnapshot {
@@ -124,24 +55,6 @@ interface StudioCatalogSnapshotPort {
124
55
  */
125
56
  declare function snapshotKit(kit: DesignKit): DesignKitSnapshot;
126
57
  //#endregion
127
- //#region src/load.d.ts
128
- /**
129
- * Load a Kit with authority derived from the Studio-controlled directory.
130
- * @param fs - Studio file-ops port.
131
- * @param kitRoot - absolute Kit directory.
132
- * @returns the assembled Kit.
133
- */
134
- interface StudioKitLoadOptions {
135
- readonly sourceId?: string;
136
- readonly bundles?: readonly {
137
- name: string;
138
- version: string;
139
- rootDir: string;
140
- sourceId: string;
141
- }[];
142
- }
143
- declare function loadStudioKit(fs: StudioReadFs, kitRoot: string, options?: StudioKitLoadOptions): Promise<DesignKit>;
144
- //#endregion
145
58
  //#region src/validate.d.ts
146
59
  /**
147
60
  * Validate one Kit definition at `kitRoot`.
@@ -162,265 +75,6 @@ declare function validateKit(fs: StudioReadFs, kitRoot: string): Promise<StudioV
162
75
  */
163
76
  declare function validateBundle(fs: StudioReadFs, kitRoot: string, name: string): Promise<StudioValidationReport>;
164
77
  //#endregion
165
- //#region src/panel-preview.d.ts
166
- /** One editor revision and its isolated sample, not a runtime publication. */
167
- interface StudioPanelPreviewRequest {
168
- readonly kit: DesignKitVersionPin;
169
- readonly bundle: DesignBundleVersionPin;
170
- readonly revision: number;
171
- readonly panelSource: string;
172
- readonly sampleSource: string;
173
- }
174
- /** Runtime-interpreter input derived from a validated draft revision. */
175
- interface StudioPanelPreview {
176
- readonly revision: number;
177
- /** Absent only for a real independently loaded Bundle preview. */
178
- readonly kit?: DesignKitVersionPin;
179
- readonly bundle: DesignBundleVersionPin;
180
- /** Loader-resolved YAML, including the installed Bundle's translations. */
181
- readonly panelYaml: string;
182
- readonly sample: Readonly<Record<string, unknown>>;
183
- }
184
- interface StudioPanelPreviewResult {
185
- readonly preview?: StudioPanelPreview;
186
- readonly diagnostics: readonly StudioDiagnostic[];
187
- }
188
- /**
189
- * Compile one Panel edit against an exact, host-resolved Kit snapshot.
190
- *
191
- * The host must supply an immutable/read-confined source port and root for the
192
- * selected pin, not arbitrary browser paths or a mutable production project.
193
- * Only panel.yaml is overlaid. All schemas, methods, locales and renderer
194
- * contracts still come from that snapshot and pass through the runtime loader.
195
- * The returned sample is fresh JSON and can be edited in a sandboxed preview;
196
- * this function grants no artifact, filesystem, model or publication authority.
197
- * A preview consumer must discard a result if its editor revision has changed.
198
- */
199
- declare function prepareStudioPanelPreview(source: StudioReadFs, kitRoot: string, request: StudioPanelPreviewRequest, loadOptions?: StudioKitLoadOptions): Promise<StudioPanelPreviewResult>;
200
- //#endregion
201
- //#region src/panel-drafts.d.ts
202
- interface StudioPanelDraftContent {
203
- readonly kit: DesignKitVersionPin;
204
- readonly bundle: DesignBundleVersionPin;
205
- readonly baseSnapshot: string;
206
- readonly panelSource: string;
207
- readonly sampleSource: string;
208
- /** A confirmed snapshot is locked, but is NOT published into the Kit catalog. */
209
- readonly confirmed: boolean;
210
- }
211
- interface StudioPanelDraftRecord extends StudioPanelDraftContent {
212
- readonly id: string;
213
- readonly revision: number;
214
- }
215
- type StudioPanelDraftSummary = Pick<StudioPanelDraftRecord, 'id' | 'revision' | 'kit' | 'bundle' | 'confirmed'>;
216
- interface StudioPanelDraftRepository {
217
- create(content: StudioPanelDraftContent): Promise<StudioPanelDraftRecord>;
218
- read(id: string): Promise<StudioPanelDraftRecord>;
219
- list(): Promise<readonly StudioPanelDraftRecord[]>;
220
- /** Atomic, cross-process CAS: must fail without writing if revision differs. */
221
- replace(id: string, expectedRevision: number, content: StudioPanelDraftContent): Promise<StudioPanelDraftRecord>;
222
- }
223
- interface StudioSourceSnapshot {
224
- readonly id: string;
225
- readonly fs: StudioReadFs;
226
- readonly root: string;
227
- /** Bounded closure root; the Kit and independently retained Bundles may be siblings. */
228
- readonly storageRoot?: string;
229
- readonly loadOptions?: StudioKitLoadOptions;
230
- }
231
- interface StudioDraftSources {
232
- /** Host resolves exact installed pin, captures all source bytes and retains them. */
233
- capture(kit: DesignKitVersionPin): Promise<StudioSourceSnapshot>;
234
- open(id: string): Promise<StudioSourceSnapshot>;
235
- }
236
- interface StudioPanelDraftEdit {
237
- readonly id: string;
238
- readonly expectedRevision: number;
239
- readonly panelSource: string;
240
- readonly sampleSource: string;
241
- }
242
- /** Shared semantics used by host adapters; no filesystem or runtime tool access. */
243
- declare class StudioPanelDraftService {
244
- private readonly repository;
245
- private readonly sources;
246
- constructor(repository: StudioPanelDraftRepository, sources: StudioDraftSources);
247
- list(): Promise<readonly StudioPanelDraftSummary[]>;
248
- read(id: string): Promise<StudioPanelDraftRecord>;
249
- create(input: {
250
- kit: DesignKitVersionPin;
251
- bundle: DesignBundleVersionPin;
252
- sampleSource?: string;
253
- }): Promise<StudioPanelDraftRecord>;
254
- /** Open only the retained snapshot; imported/template pins need not be installed. */
255
- createFromSnapshot(input: {
256
- snapshotId: string;
257
- kit: DesignKitVersionPin;
258
- bundle: DesignBundleVersionPin;
259
- sampleSource?: string;
260
- }): Promise<StudioPanelDraftRecord>;
261
- private createRetained;
262
- /** Saving incomplete source is allowed; confirmation requires successful compilation. */
263
- save(input: StudioPanelDraftEdit): Promise<StudioPanelDraftRecord>;
264
- /** Compile an unsaved editor revision without persisting or touching any project. */
265
- preview(input: StudioPanelDraftEdit & {
266
- revision: number;
267
- }): Promise<StudioPanelPreviewResult>;
268
- confirm(input: {
269
- id: string;
270
- expectedRevision: number;
271
- }): Promise<{
272
- draft?: StudioPanelDraftRecord;
273
- } & StudioPanelPreviewResult>;
274
- /** Start another editable revision, sharing the immutable base bytes. */
275
- fork(id: string): Promise<StudioPanelDraftRecord>;
276
- }
277
- //#endregion
278
- //#region src/kit-drafts.d.ts
279
- interface StudioKitDraftContent {
280
- readonly baseKit: DesignKitVersionPin;
281
- readonly baseSnapshot: string;
282
- /** Exact immutable mounts. Bundle working copies are edited independently. */
283
- readonly mounts: readonly DesignBundleVersionPin[];
284
- readonly mindsetSource: string;
285
- /** null removes the optional Kit-owned relation vocabulary. */
286
- readonly relationsSource: string | null;
287
- readonly confirmed: boolean;
288
- }
289
- interface StudioKitDraftRecord extends StudioKitDraftContent {
290
- readonly id: string;
291
- readonly revision: number;
292
- }
293
- interface StudioKitDraftRepository {
294
- create(content: StudioKitDraftContent): Promise<StudioKitDraftRecord>;
295
- read(id: string): Promise<StudioKitDraftRecord>;
296
- list(): Promise<readonly StudioKitDraftRecord[]>;
297
- /** Atomic CAS across writers; conflicts and confirmed records must not be overwritten. */
298
- replace(id: string, expectedRevision: number, content: StudioKitDraftContent): Promise<StudioKitDraftRecord>;
299
- }
300
- interface StudioKitDraftEdit {
301
- readonly id: string;
302
- readonly expectedRevision: number;
303
- readonly mindsetSource: string;
304
- readonly relationsSource: string | null;
305
- }
306
- interface StudioKitDraftValidation extends StudioValidationReport {
307
- readonly revision: number;
308
- /** A candidate identity, not a published/catalog-resolvable version. */
309
- readonly candidateKit?: DesignKitVersionPin;
310
- }
311
- declare class StudioKitDraftService {
312
- private readonly repository;
313
- private readonly sources;
314
- constructor(repository: StudioKitDraftRepository, sources: StudioDraftSources);
315
- list(): Promise<readonly Pick<StudioKitDraftRecord, 'id' | 'revision' | 'baseKit' | 'confirmed'>[]>;
316
- read(id: string): Promise<StudioKitDraftRecord>;
317
- create(input: {
318
- kit: DesignKitVersionPin;
319
- }): Promise<StudioKitDraftRecord>;
320
- /** Adopt retained, independently validated content; never resolve an installed pin. */
321
- createFromSnapshot(input: {
322
- snapshotId: string;
323
- kit: DesignKitVersionPin;
324
- }): Promise<StudioKitDraftRecord>;
325
- private createRetained;
326
- /** Invalid intermediate edits can be retained, but cannot be confirmed. */
327
- save(input: StudioKitDraftEdit): Promise<StudioKitDraftRecord>;
328
- private compile;
329
- validate(input: {
330
- id: string;
331
- expectedRevision: number;
332
- }): Promise<StudioKitDraftValidation>;
333
- preview(input: {
334
- id: string;
335
- expectedRevision: number;
336
- bundle: DesignBundleVersionPin;
337
- sampleSource: string;
338
- }): Promise<StudioPanelPreviewResult>;
339
- confirm(input: {
340
- id: string;
341
- expectedRevision: number;
342
- }): Promise<StudioKitDraftValidation & {
343
- draft?: StudioKitDraftRecord;
344
- }>;
345
- fork(id: string): Promise<StudioKitDraftRecord>;
346
- }
347
- //#endregion
348
- //#region src/content-archive.d.ts
349
- interface StudioArchivePin {
350
- readonly name: string;
351
- readonly version: string;
352
- }
353
- interface StudioArchiveFile {
354
- readonly path: string;
355
- readonly base64: string;
356
- readonly bytes: number;
357
- readonly sha256: string;
358
- }
359
- interface StudioContentArchive {
360
- readonly format: 'studio-content-archive/v1';
361
- readonly kind: 'kit' | 'bundle';
362
- readonly pin: StudioArchivePin;
363
- /** Declared provenance, not verified authorship or redistribution permission. */
364
- readonly provenance: {
365
- readonly source: string;
366
- readonly license: string;
367
- };
368
- /** Kit membership pins in catalog order; Bundle explicitly declared requirements. */
369
- readonly dependencies: readonly DesignBundleVersionPin[];
370
- readonly files: readonly StudioArchiveFile[];
371
- /** SHA-256 of the canonical envelope excluding this field; not a signature. */
372
- readonly sha256: string;
373
- }
374
- interface StudioArchiveBundleSource extends StudioArchivePin {
375
- readonly sourceId: string;
376
- readonly snapshot: StudioArchiveSource;
377
- }
378
- interface StudioArchiveSource {
379
- readonly sourceId?: string;
380
- /** Trusted immutable Bundle snapshots, never paths supplied by an archive. */
381
- readonly bundles?: readonly StudioArchiveBundleSource[];
382
- readonly root: string;
383
- readonly fs: StudioReadFs;
384
- /** Host supplies a complete, immutable regular-file snapshot; no live fallback. */
385
- listFiles(): Promise<readonly string[]>;
386
- /** Byte-preserving read. Host rejects links and non-regular files before reading. */
387
- readBytes(path: string): Promise<Uint8Array>;
388
- }
389
- interface StudioPreparedContentImport {
390
- readonly archive: StudioContentArchive;
391
- /** Files relative to Kit root, or standalone Bundle root, respectively. */
392
- readonly files: readonly StudioArchiveFile[];
393
- /** Independently retainable content, only populated after definition validation. */
394
- readonly contents: readonly {
395
- readonly kind: 'kit' | 'bundle';
396
- readonly pin: StudioArchivePin;
397
- readonly files: readonly StudioArchiveFile[];
398
- }[];
399
- readonly executionGranted: false;
400
- /** Includes scripts and provider/driver references; host approval is separate. */
401
- readonly requiresTrustReview: boolean;
402
- readonly validation: {
403
- readonly valid: boolean;
404
- readonly diagnostics: readonly StudioDiagnostic[];
405
- };
406
- }
407
- /** Parse a bounded JSON envelope; hashes include metadata and every original byte. */
408
- declare function readStudioContentArchive(source: string): StudioContentArchive;
409
- /** No writes, extraction, permission restoration, script execution, installation or publication. */
410
- declare function prepareStudioContentImport(source: string, options?: {
411
- validationContext?: StudioArchiveSource | {
412
- root: string;
413
- fs: StudioReadFs;
414
- };
415
- }): Promise<StudioPreparedContentImport>;
416
- /** Capture only immutable host snapshots, preserving full exact referenced trees. */
417
- declare function exportStudioContentArchive(snapshot: StudioArchiveSource, input: {
418
- kind: 'kit' | 'bundle';
419
- pin: StudioArchivePin;
420
- provenance: StudioContentArchive['provenance'];
421
- dependencies?: readonly DesignBundleVersionPin[];
422
- }): Promise<string>;
423
- //#endregion
424
78
  //#region src/management.d.ts
425
79
  /** One browser-safe published Kit pin. */
426
80
  interface StudioKitView {
@@ -737,4 +391,4 @@ declare class StudioBundleSourceService {
737
391
  }): Promise<StudioBundleFileResult>;
738
392
  }
739
393
  //#endregion
740
- export { type DesignBundleSnapshot, type DesignBundleVersionPin, type DesignCatalogSnapshot, type DesignKitSnapshot, type DesignKitVersionPin, type StudioArchiveFile, type StudioArchivePin, type StudioArchiveSource, StudioBinaryContentError, type StudioBundleFileRefView, type StudioBundleFileResult, type StudioBundleFileView, type StudioBundleMountView, type StudioBundlePanelView, type StudioBundleSourcePort, StudioBundleSourceService, type StudioBundleValidationSummary, type StudioBundleVersionEntry, type StudioBundleView, type StudioBundleWorkspaceResult, type StudioBundleWorkspaceView, type StudioCatalogSnapshotPort, type StudioCompositionCatalog, type StudioContentArchive, type StudioDiagnostic, type StudioDraftSources, type StudioKitDraftContent, type StudioKitDraftEdit, type StudioKitDraftRecord, type StudioKitDraftRepository, StudioKitDraftService, type StudioKitDraftValidation, type StudioKitView, type StudioKitWorkspaceResult, type StudioKitWorkspaceView, type StudioManagementFailure, StudioManagementService, type StudioPanelDraftContent, type StudioPanelDraftEdit, type StudioPanelDraftRecord, type StudioPanelDraftRepository, StudioPanelDraftService, type StudioPanelDraftSummary, type StudioPanelPreview, type StudioPanelPreviewRequest, type StudioPanelPreviewResult, type StudioPreparedContentImport, type StudioReadFs, type StudioRelationView, type StudioRelationVocabularyView, type StudioResourceRefView, type StudioSourceSnapshot, type StudioValidationReport, type StudioWorkspaceView, buildStudioCompositionCatalog, exportStudioContentArchive, loadStudioKit, prepareStudioContentImport, prepareStudioPanelPreview, readStudioContentArchive, searchStudioBundles, snapshotKit, validateBundle, validateKit };
394
+ export { type DesignBundleSnapshot, type DesignBundleVersionPin, type DesignCatalogSnapshot, type DesignKitSnapshot, type DesignKitVersionPin, STUDIO_INSTANCE_CHANGE_LIMITS, type StudioArchiveFile, type StudioArchivePin, type StudioArchiveSource, StudioBinaryContentError, type StudioBundleFileRefView, type StudioBundleFileResult, type StudioBundleFileView, type StudioBundleMountView, type StudioBundlePanelView, type StudioBundleSourcePort, StudioBundleSourceService, type StudioBundleValidationSummary, type StudioBundleVersionEntry, type StudioBundleView, type StudioBundleWorkspaceResult, type StudioBundleWorkspaceView, type StudioCatalogSnapshotPort, type StudioCompositionCatalog, type StudioContentArchive, type StudioDiagnostic, type StudioDraftSources, type StudioInstanceCandidate, type StudioInstanceChangeReceipt, type StudioInstanceChangeRequest, type StudioInstanceFileChange, type StudioInstanceFileDiff, type StudioInstanceSaveChanges, type StudioKitView, type StudioKitWorkspaceResult, type StudioKitWorkspaceView, type StudioManagementFailure, StudioManagementService, type StudioPanelDraftContent, type StudioPanelDraftRecord, type StudioPanelDraftRepository, type StudioPanelDraftSummary, type StudioPanelPreview, type StudioPanelPreviewRequest, type StudioPanelPreviewResult, type StudioReadFs, type StudioRelationView, type StudioRelationVocabularyView, type StudioResourceRefView, type StudioSourceSnapshot, type StudioValidationReport, type StudioWorkspaceView, buildStudioCompositionCatalog, exportStudioContentArchive, exportStudioSourceArchive, loadStudioKit, normalizeStudioInstanceChanges, prepareStudioPanelPreview, readStudioContentArchive, searchStudioBundles, snapshotKit, validateBundle, validateKit };