Manage kits: reconcile the schema on save, and a dialog to repin builds

Placing a palette component no longer edits <schema> straight away. The kit is
noted as pending, its manifest is compiled so the box can be painted, and the
status bar says the kit will be declared on save. The <schema> block is then
reconciled when the file is written, in the one place that can report the whole
kit list the file will carry, with each kit's version and checksum.

What a kit's manifest depends on counts as used too, transitively, so placing a
component can bring in more than one entry: hvac pulls in types, ontrolPion
pulls in ontrolPlatform.

New Kits > Manage Kits... dialog lists every kit in three groups -- needed by
the app, declared but unused, and merely installed -- with the pinned build, the
newest installed build, and an Action dropdown of every build a kit ships.
The tick means the schema declares the kit: grey and fixed for kits the app
needs, unticked to remove, ticked to add at the newest build. "Upgrade all kits
to latest version" moves every declared kit; "Update kits" applies the ticks and
the Action column, additions and removals included.

Every schema change is applied as a batch, then verified: a missing manifest or
a component type that stops resolving reverts the whole block and reports why,
and a kit the app needs cannot be removed. Changes are one undo step, which
recompiles the slot registry in both directions since a repin can change a
component's slots.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-21 12:06:25 +03:00
co-authored by Claude Opus 5
parent b286b208da
commit 01dadea610
8 changed files with 851 additions and 45 deletions
+40 -1
View File
@@ -6,7 +6,9 @@ import graph free of cycles (sax_file and wiresheet both push commands here).
"""
import app_state
from sax_dom import update_meta_property
import palette
import schema
from sax_dom import restore_children, update_meta_property
_undo_stack = []
_redo_stack = []
@@ -79,6 +81,43 @@ def reset():
_saved_depth = 0
def reload_schema_registry():
"""Recompiles the slot registry after the <schema> block changed.
A failure is swallowed: undo and redo only ever land on a state that resolved once
already, so a missing manifest here means Sedona home moved underneath the session,
which the next action reports in its own words.
"""
palette.invalidate()
try:
schema.load_schema_kits_and_manifests()
except schema.MissingManifestError:
pass
class SchemaBlockCommand:
"""A change to the file's <schema> block, held as a before/after snapshot.
Kit entries decide which manifest describes which type, so the slot registry is
recompiled in both directions — a repinned kit can change a component's slots.
"""
def __init__(self, schema_element, before, after, label="update kits"):
# before/after: snapshots from sax_dom.snapshot_children
self.schema_element = schema_element
self.before = before
self.after = after
self.label = label
def undo(self):
restore_children(self.schema_element, self.before)
reload_schema_registry()
def redo(self):
restore_children(self.schema_element, self.after)
reload_schema_registry()
class MetaMoveCommand:
"""One or many components changing position, i.e. their packed meta x/y."""