drowse.ai 5.3.1__py3-none-any.whl
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.
- drowse/__init__.py +312 -0
- drowse/__main__.py +5 -0
- drowse/cli/__init__.py +5 -0
- drowse/cli/alpha_grid.py +96 -0
- drowse/cli/config_file.py +340 -0
- drowse/cli/main.py +52 -0
- drowse/cli/parsers.py +1478 -0
- drowse/cli/runners/__init__.py +155 -0
- drowse/cli/runners/config.py +85 -0
- drowse/cli/runners/experiment.py +344 -0
- drowse/cli/runners/lens.py +661 -0
- drowse/cli/runners/manifold.py +1097 -0
- drowse/cli/runners/pack.py +413 -0
- drowse/cli/runners/sae.py +304 -0
- drowse/cli/runners/serve.py +220 -0
- drowse/cli/runners/shared.py +389 -0
- drowse/cli/runners/template.py +232 -0
- drowse/core/__init__.py +1 -0
- drowse/core/capture.py +1205 -0
- drowse/core/errors.py +260 -0
- drowse/core/events.py +156 -0
- drowse/core/extraction.py +3076 -0
- drowse/core/generation.py +1738 -0
- drowse/core/generation_finalizer.py +278 -0
- drowse/core/histogram.py +30 -0
- drowse/core/hooks.py +1885 -0
- drowse/core/instruments/__init__.py +49 -0
- drowse/core/instruments/geometry.py +551 -0
- drowse/core/instruments/lens.py +1341 -0
- drowse/core/instruments/protocol.py +211 -0
- drowse/core/instruments/sae.py +935 -0
- drowse/core/instruments/types.py +597 -0
- drowse/core/jlens.py +874 -0
- drowse/core/jlens_fit.py +1305 -0
- drowse/core/joint_logprobs.py +748 -0
- drowse/core/loom.py +1938 -0
- drowse/core/loom_diff.py +408 -0
- drowse/core/mahalanobis.py +579 -0
- drowse/core/manifold.py +4106 -0
- drowse/core/measurements.py +382 -0
- drowse/core/model.py +1724 -0
- drowse/core/monitor.py +2060 -0
- drowse/core/monitor_attach.py +682 -0
- drowse/core/naming.py +42 -0
- drowse/core/naturalness.py +187 -0
- drowse/core/profile.py +617 -0
- drowse/core/relp.py +313 -0
- drowse/core/results.py +467 -0
- drowse/core/role_templates.py +677 -0
- drowse/core/sae.py +891 -0
- drowse/core/sae_training.py +239 -0
- drowse/core/sampling.py +127 -0
- drowse/core/scene.py +810 -0
- drowse/core/scoring.py +270 -0
- drowse/core/session.py +11015 -0
- drowse/core/static_cache.py +316 -0
- drowse/core/steering.py +229 -0
- drowse/core/steering_composer.py +1135 -0
- drowse/core/steering_expr.py +1413 -0
- drowse/core/surface_topology.py +128 -0
- drowse/core/token_callback.py +52 -0
- drowse/core/token_payloads.py +244 -0
- drowse/core/topology.py +1469 -0
- drowse/core/transcript.py +582 -0
- drowse/core/tree_filter.py +353 -0
- drowse/core/triggers.py +250 -0
- drowse/data/baseline_prompts.json +50 -0
- drowse/data/manifolds/confident.uncertain/manifold.json +28 -0
- drowse/data/manifolds/confident.uncertain/nodes/00_confident.json +50 -0
- drowse/data/manifolds/confident.uncertain/nodes/01_uncertain.json +50 -0
- drowse/data/manifolds/creative.conventional/manifold.json +28 -0
- drowse/data/manifolds/creative.conventional/nodes/00_creative.json +50 -0
- drowse/data/manifolds/creative.conventional/nodes/01_conventional.json +50 -0
- drowse/data/manifolds/curious.disinterested/manifold.json +28 -0
- drowse/data/manifolds/curious.disinterested/nodes/00_curious.json +50 -0
- drowse/data/manifolds/curious.disinterested/nodes/01_disinterested.json +50 -0
- drowse/data/manifolds/direct.indirect/manifold.json +28 -0
- drowse/data/manifolds/direct.indirect/nodes/00_direct.json +50 -0
- drowse/data/manifolds/direct.indirect/nodes/01_indirect.json +50 -0
- drowse/data/manifolds/emotions/manifold.json +115 -0
- drowse/data/manifolds/emotions/nodes/00_excited.json +50 -0
- drowse/data/manifolds/emotions/nodes/01_happy.json +50 -0
- drowse/data/manifolds/emotions/nodes/02_calm.json +50 -0
- drowse/data/manifolds/emotions/nodes/03_weary.json +50 -0
- drowse/data/manifolds/emotions/nodes/04_sad.json +50 -0
- drowse/data/manifolds/emotions/nodes/05_distressed.json +50 -0
- drowse/data/manifolds/emotions/nodes/06_alert.json +50 -0
- drowse/data/manifolds/emotions/nodes/07_dominant.json +50 -0
- drowse/data/manifolds/emotions/nodes/08_submissive.json +50 -0
- drowse/data/manifolds/emotions/nodes/09_angry.json +50 -0
- drowse/data/manifolds/emotions/nodes/10_fearful.json +50 -0
- drowse/data/manifolds/emotions/nodes/11_surprised.json +50 -0
- drowse/data/manifolds/emotions/nodes/12_triumphant.json +50 -0
- drowse/data/manifolds/emotions/nodes/13_humiliated.json +50 -0
- drowse/data/manifolds/emotions/nodes/14_disgusted.json +50 -0
- drowse/data/manifolds/emotions/nodes/15_bored.json +50 -0
- drowse/data/manifolds/emotions/nodes/16_grateful.json +50 -0
- drowse/data/manifolds/emotions/nodes/17_relieved.json +50 -0
- drowse/data/manifolds/emotions/nodes/18_playful.json +50 -0
- drowse/data/manifolds/emotions/nodes/19_hopeful.json +50 -0
- drowse/data/manifolds/formal.casual/manifold.json +28 -0
- drowse/data/manifolds/formal.casual/nodes/00_formal.json +50 -0
- drowse/data/manifolds/formal.casual/nodes/01_casual.json +50 -0
- drowse/data/manifolds/honest.deceptive/manifold.json +28 -0
- drowse/data/manifolds/honest.deceptive/nodes/00_honest.json +50 -0
- drowse/data/manifolds/honest.deceptive/nodes/01_deceptive.json +50 -0
- drowse/data/manifolds/humorous.serious/manifold.json +28 -0
- drowse/data/manifolds/humorous.serious/nodes/00_humorous.json +50 -0
- drowse/data/manifolds/humorous.serious/nodes/01_serious.json +50 -0
- drowse/data/manifolds/individualist.collectivist/manifold.json +28 -0
- drowse/data/manifolds/individualist.collectivist/nodes/00_individualist.json +50 -0
- drowse/data/manifolds/individualist.collectivist/nodes/01_collectivist.json +50 -0
- drowse/data/manifolds/masculine.feminine/manifold.json +28 -0
- drowse/data/manifolds/masculine.feminine/nodes/00_masculine.json +50 -0
- drowse/data/manifolds/masculine.feminine/nodes/01_feminine.json +50 -0
- drowse/data/manifolds/months/manifold.json +120 -0
- drowse/data/manifolds/months/nodes/00_january.json +50 -0
- drowse/data/manifolds/months/nodes/01_february.json +50 -0
- drowse/data/manifolds/months/nodes/02_march.json +50 -0
- drowse/data/manifolds/months/nodes/03_april.json +50 -0
- drowse/data/manifolds/months/nodes/04_may.json +50 -0
- drowse/data/manifolds/months/nodes/05_june.json +50 -0
- drowse/data/manifolds/months/nodes/06_july.json +50 -0
- drowse/data/manifolds/months/nodes/07_august.json +50 -0
- drowse/data/manifolds/months/nodes/08_september.json +50 -0
- drowse/data/manifolds/months/nodes/09_october.json +50 -0
- drowse/data/manifolds/months/nodes/10_november.json +50 -0
- drowse/data/manifolds/months/nodes/11_december.json +50 -0
- drowse/data/manifolds/personas/manifold.json +550 -0
- drowse/data/manifolds/personas/nodes/00_assistant.json +50 -0
- drowse/data/manifolds/personas/nodes/01_analyst.json +50 -0
- drowse/data/manifolds/personas/nodes/02_impostor.json +50 -0
- drowse/data/manifolds/personas/nodes/03_teacher.json +50 -0
- drowse/data/manifolds/personas/nodes/04_doctor.json +50 -0
- drowse/data/manifolds/personas/nodes/05_librarian.json +50 -0
- drowse/data/manifolds/personas/nodes/06_farmer.json +50 -0
- drowse/data/manifolds/personas/nodes/07_soldier.json +50 -0
- drowse/data/manifolds/personas/nodes/08_lawyer.json +50 -0
- drowse/data/manifolds/personas/nodes/09_chef.json +50 -0
- drowse/data/manifolds/personas/nodes/100_assassin.json +50 -0
- drowse/data/manifolds/personas/nodes/101_thief.json +50 -0
- drowse/data/manifolds/personas/nodes/102_conman.json +50 -0
- drowse/data/manifolds/personas/nodes/103_hacker.json +50 -0
- drowse/data/manifolds/personas/nodes/104_cultist.json +50 -0
- drowse/data/manifolds/personas/nodes/105_tyrant.json +50 -0
- drowse/data/manifolds/personas/nodes/106_vandal.json +50 -0
- drowse/data/manifolds/personas/nodes/10_journalist.json +50 -0
- drowse/data/manifolds/personas/nodes/11_mechanic.json +50 -0
- drowse/data/manifolds/personas/nodes/12_sailor.json +50 -0
- drowse/data/manifolds/personas/nodes/13_pilot.json +50 -0
- drowse/data/manifolds/personas/nodes/14_athlete.json +50 -0
- drowse/data/manifolds/personas/nodes/15_engineer.json +50 -0
- drowse/data/manifolds/personas/nodes/16_scientist.json +50 -0
- drowse/data/manifolds/personas/nodes/17_banker.json +50 -0
- drowse/data/manifolds/personas/nodes/18_salesperson.json +50 -0
- drowse/data/manifolds/personas/nodes/19_nerd.json +50 -0
- drowse/data/manifolds/personas/nodes/20_jock.json +50 -0
- drowse/data/manifolds/personas/nodes/21_gamer.json +50 -0
- drowse/data/manifolds/personas/nodes/22_furry.json +50 -0
- drowse/data/manifolds/personas/nodes/23_weeaboo.json +50 -0
- drowse/data/manifolds/personas/nodes/24_influencer.json +50 -0
- drowse/data/manifolds/personas/nodes/25_stoner.json +50 -0
- drowse/data/manifolds/personas/nodes/26_femboy.json +50 -0
- drowse/data/manifolds/personas/nodes/27_ceo.json +50 -0
- drowse/data/manifolds/personas/nodes/28_emperor.json +50 -0
- drowse/data/manifolds/personas/nodes/29_president.json +50 -0
- drowse/data/manifolds/personas/nodes/30_diplomat.json +50 -0
- drowse/data/manifolds/personas/nodes/31_judge.json +50 -0
- drowse/data/manifolds/personas/nodes/32_bureaucrat.json +50 -0
- drowse/data/manifolds/personas/nodes/33_conservative.json +50 -0
- drowse/data/manifolds/personas/nodes/34_liberal.json +50 -0
- drowse/data/manifolds/personas/nodes/35_libertarian.json +50 -0
- drowse/data/manifolds/personas/nodes/36_communist.json +50 -0
- drowse/data/manifolds/personas/nodes/37_anarchist.json +50 -0
- drowse/data/manifolds/personas/nodes/38_reactionary.json +50 -0
- drowse/data/manifolds/personas/nodes/39_loner.json +50 -0
- drowse/data/manifolds/personas/nodes/40_friend.json +50 -0
- drowse/data/manifolds/personas/nodes/41_rival.json +50 -0
- drowse/data/manifolds/personas/nodes/42_stranger.json +50 -0
- drowse/data/manifolds/personas/nodes/43_lover.json +50 -0
- drowse/data/manifolds/personas/nodes/44_stalker.json +50 -0
- drowse/data/manifolds/personas/nodes/45_lunatic.json +50 -0
- drowse/data/manifolds/personas/nodes/46_paranoid.json +50 -0
- drowse/data/manifolds/personas/nodes/47_detective.json +50 -0
- drowse/data/manifolds/personas/nodes/48_therapist.json +50 -0
- drowse/data/manifolds/personas/nodes/49_nomad.json +50 -0
- drowse/data/manifolds/personas/nodes/50_pirate.json +50 -0
- drowse/data/manifolds/personas/nodes/51_child.json +50 -0
- drowse/data/manifolds/personas/nodes/52_caveman.json +50 -0
- drowse/data/manifolds/personas/nodes/53_monk.json +50 -0
- drowse/data/manifolds/personas/nodes/54_knight.json +50 -0
- drowse/data/manifolds/personas/nodes/55_alchemist.json +50 -0
- drowse/data/manifolds/personas/nodes/56_blacksmith.json +50 -0
- drowse/data/manifolds/personas/nodes/57_viking.json +50 -0
- drowse/data/manifolds/personas/nodes/58_druid.json +50 -0
- drowse/data/manifolds/personas/nodes/59_poet.json +50 -0
- drowse/data/manifolds/personas/nodes/60_novelist.json +50 -0
- drowse/data/manifolds/personas/nodes/61_jester.json +50 -0
- drowse/data/manifolds/personas/nodes/62_philosopher.json +50 -0
- drowse/data/manifolds/personas/nodes/63_painter.json +50 -0
- drowse/data/manifolds/personas/nodes/64_musician.json +50 -0
- drowse/data/manifolds/personas/nodes/65_oracle.json +50 -0
- drowse/data/manifolds/personas/nodes/66_god.json +50 -0
- drowse/data/manifolds/personas/nodes/67_angel.json +50 -0
- drowse/data/manifolds/personas/nodes/68_prophet.json +50 -0
- drowse/data/manifolds/personas/nodes/69_saint.json +50 -0
- drowse/data/manifolds/personas/nodes/70_ghost.json +50 -0
- drowse/data/manifolds/personas/nodes/71_phoenix.json +50 -0
- drowse/data/manifolds/personas/nodes/72_witch.json +50 -0
- drowse/data/manifolds/personas/nodes/73_vampire.json +50 -0
- drowse/data/manifolds/personas/nodes/74_mermaid.json +50 -0
- drowse/data/manifolds/personas/nodes/75_sphinx.json +50 -0
- drowse/data/manifolds/personas/nodes/76_banshee.json +50 -0
- drowse/data/manifolds/personas/nodes/77_golem.json +50 -0
- drowse/data/manifolds/personas/nodes/78_deer.json +50 -0
- drowse/data/manifolds/personas/nodes/79_wolf.json +50 -0
- drowse/data/manifolds/personas/nodes/80_raven.json +50 -0
- drowse/data/manifolds/personas/nodes/81_serpent.json +50 -0
- drowse/data/manifolds/personas/nodes/82_lion.json +50 -0
- drowse/data/manifolds/personas/nodes/83_tree.json +50 -0
- drowse/data/manifolds/personas/nodes/84_river.json +50 -0
- drowse/data/manifolds/personas/nodes/85_storm.json +50 -0
- drowse/data/manifolds/personas/nodes/86_flame.json +50 -0
- drowse/data/manifolds/personas/nodes/87_mirror.json +50 -0
- drowse/data/manifolds/personas/nodes/88_clock.json +50 -0
- drowse/data/manifolds/personas/nodes/89_computer.json +50 -0
- drowse/data/manifolds/personas/nodes/90_robot.json +50 -0
- drowse/data/manifolds/personas/nodes/91_cyborg.json +50 -0
- drowse/data/manifolds/personas/nodes/92_drone.json +50 -0
- drowse/data/manifolds/personas/nodes/93_mecha.json +50 -0
- drowse/data/manifolds/personas/nodes/94_alien.json +50 -0
- drowse/data/manifolds/personas/nodes/95_trickster.json +50 -0
- drowse/data/manifolds/personas/nodes/96_virus.json +50 -0
- drowse/data/manifolds/personas/nodes/97_spy.json +50 -0
- drowse/data/manifolds/personas/nodes/98_narcissist.json +50 -0
- drowse/data/manifolds/personas/nodes/99_demon.json +50 -0
- drowse/data/manifolds/refusing.compliant/manifold.json +28 -0
- drowse/data/manifolds/refusing.compliant/nodes/00_refusing.json +50 -0
- drowse/data/manifolds/refusing.compliant/nodes/01_compliant.json +50 -0
- drowse/data/manifolds/religious.secular/manifold.json +28 -0
- drowse/data/manifolds/religious.secular/nodes/00_religious.json +50 -0
- drowse/data/manifolds/religious.secular/nodes/01_secular.json +50 -0
- drowse/data/manifolds/sincere.manipulative/manifold.json +28 -0
- drowse/data/manifolds/sincere.manipulative/nodes/00_sincere.json +50 -0
- drowse/data/manifolds/sincere.manipulative/nodes/01_manipulative.json +50 -0
- drowse/data/manifolds/sycophantic.blunt/manifold.json +28 -0
- drowse/data/manifolds/sycophantic.blunt/nodes/00_sycophantic.json +50 -0
- drowse/data/manifolds/sycophantic.blunt/nodes/01_blunt.json +50 -0
- drowse/data/manifolds/technical.accessible/manifold.json +28 -0
- drowse/data/manifolds/technical.accessible/nodes/00_technical.json +50 -0
- drowse/data/manifolds/technical.accessible/nodes/01_accessible.json +50 -0
- drowse/data/manifolds/traditional.progressive/manifold.json +28 -0
- drowse/data/manifolds/traditional.progressive/nodes/00_traditional.json +50 -0
- drowse/data/manifolds/traditional.progressive/nodes/01_progressive.json +50 -0
- drowse/data/manifolds/verbose.concise/manifold.json +28 -0
- drowse/data/manifolds/verbose.concise/nodes/00_verbose.json +50 -0
- drowse/data/manifolds/verbose.concise/nodes/01_concise.json +50 -0
- drowse/data/manifolds/warm.clinical/manifold.json +28 -0
- drowse/data/manifolds/warm.clinical/nodes/00_warm.json +50 -0
- drowse/data/manifolds/warm.clinical/nodes/01_clinical.json +50 -0
- drowse/data/neutral_statements.json +98 -0
- drowse/io/__init__.py +1 -0
- drowse/io/alignment.py +1334 -0
- drowse/io/atomic.py +278 -0
- drowse/io/bake.py +558 -0
- drowse/io/bootstrap.py +73 -0
- drowse/io/brand_migration.py +48 -0
- drowse/io/drowse_archive.py +1830 -0
- drowse/io/gguf_io.py +300 -0
- drowse/io/hf.py +81 -0
- drowse/io/hf_manifolds.py +931 -0
- drowse/io/integrity.py +102 -0
- drowse/io/lens.py +1992 -0
- drowse/io/lens_sources.py +1003 -0
- drowse/io/manifold_authoring.py +1348 -0
- drowse/io/manifold_folder.py +1854 -0
- drowse/io/manifold_lifecycle.py +1253 -0
- drowse/io/manifold_tensors.py +727 -0
- drowse/io/manifolds.py +443 -0
- drowse/io/paths.py +289 -0
- drowse/io/probes_bootstrap.py +58 -0
- drowse/io/sae.py +382 -0
- drowse/io/sae_artifacts.py +318 -0
- drowse/io/selectors.py +503 -0
- drowse/io/shards.py +160 -0
- drowse/io/source_registry.py +138 -0
- drowse/io/staging.py +80 -0
- drowse/io/templates.py +707 -0
- drowse/notebook/__init__.py +38 -0
- drowse/notebook/data.py +99 -0
- drowse/notebook/plots.py +352 -0
- drowse/py.typed +0 -0
- drowse/server/__init__.py +20 -0
- drowse/server/app.py +987 -0
- drowse/server/background_job.py +246 -0
- drowse/server/instrument_routes.py +1101 -0
- drowse/server/manifold_routes.py +1028 -0
- drowse/server/model_names.py +82 -0
- drowse/server/native_common.py +92 -0
- drowse/server/native_routes.py +45 -0
- drowse/server/ollama.py +817 -0
- drowse/server/operation_ledger.py +187 -0
- drowse/server/probe_routes.py +220 -0
- drowse/server/profile_models.py +52 -0
- drowse/server/profile_routes.py +440 -0
- drowse/server/request_helpers.py +198 -0
- drowse/server/request_ledger.py +85 -0
- drowse/server/response_models.py +814 -0
- drowse/server/session_models.py +146 -0
- drowse/server/session_routes.py +150 -0
- drowse/server/sse.py +333 -0
- drowse/server/streaming.py +129 -0
- drowse/server/template_routes.py +161 -0
- drowse/server/tree_models.py +121 -0
- drowse/server/tree_routes.py +550 -0
- drowse/server/ws_events.py +65 -0
- drowse/server/ws_models.py +219 -0
- drowse/server/ws_stream.py +1205 -0
- drowse/web/__init__.py +22 -0
- drowse/web/dist/LICENSE-Fluent-Icons.txt +21 -0
- drowse/web/dist/LICENSE-Fluent-System-Icons.txt +21 -0
- drowse/web/dist/LICENSE-Martian-Mono.txt +93 -0
- drowse/web/dist/LICENSE-Torph.txt +21 -0
- drowse/web/dist/LICENSE-Wix-Madefor.txt +93 -0
- drowse/web/dist/assets/App-BewwoFwv.js +33 -0
- drowse/web/dist/assets/App.css +1 -0
- drowse/web/dist/assets/MartianMono-cyrillic-ext.woff2 +0 -0
- drowse/web/dist/assets/MartianMono-cyrillic.woff2 +0 -0
- drowse/web/dist/assets/MartianMono-latin-ext.woff2 +0 -0
- drowse/web/dist/assets/MartianMono-latin.woff2 +0 -0
- drowse/web/dist/assets/WixMadeforDisplay-cyrillic.woff2 +0 -0
- drowse/web/dist/assets/WixMadeforDisplay-latin-ext.woff2 +0 -0
- drowse/web/dist/assets/WixMadeforDisplay-latin.woff2 +0 -0
- drowse/web/dist/assets/WixMadeforDisplay-vietnamese.woff2 +0 -0
- drowse/web/dist/assets/WixMadeforText-italic-latin-ext.woff2 +0 -0
- drowse/web/dist/assets/WixMadeforText-italic-latin.woff2 +0 -0
- drowse/web/dist/assets/WixMadeforText-normal-cyrillic.woff2 +0 -0
- drowse/web/dist/assets/WixMadeforText-normal-latin-ext.woff2 +0 -0
- drowse/web/dist/assets/WixMadeforText-normal-latin.woff2 +0 -0
- drowse/web/dist/assets/WixMadeforText-normal-vietnamese.woff2 +0 -0
- drowse/web/dist/assets/ab.svelte-CbVGAYXo.js +1 -0
- drowse/web/dist/assets/artifactUpdates-Cjeu6LJc.js +1 -0
- drowse/web/dist/assets/artifactUpdates-DfAoYC9j.js +1 -0
- drowse/web/dist/assets/chat.svelte-DxKufn9g.js +1 -0
- drowse/web/dist/assets/drawers-BDWC0hIN.js +123 -0
- drowse/web/dist/assets/drawers.css +1 -0
- drowse/web/dist/assets/drowse.js +7 -0
- drowse/web/dist/assets/eleutherai.png +0 -0
- drowse/web/dist/assets/errors-Dvb10QW_.js +2 -0
- drowse/web/dist/assets/expression-4yISdAdq.js +1 -0
- drowse/web/dist/assets/files-CvRivkey.js +1 -0
- drowse/web/dist/assets/files-JhDJVgD_.js +1 -0
- drowse/web/dist/assets/fittingCancellation-D72BZWPZ.js +1 -0
- drowse/web/dist/assets/gemma-3-1b-it.json +1 -0
- drowse/web/dist/assets/gemma-3-270m-it.json +1 -0
- drowse/web/dist/assets/gemma-3-4b-it.json +1 -0
- drowse/web/dist/assets/generation-DbkBAhP_.js +1 -0
- drowse/web/dist/assets/index-client-2OdH6IQp.js +3 -0
- drowse/web/dist/assets/index-client-D4S4PooY.js +1 -0
- drowse/web/dist/assets/index.css +1 -0
- drowse/web/dist/assets/instrumentAuthoring.svelte-Csh7NOGX.js +1 -0
- drowse/web/dist/assets/instrumentAuthoring.svelte-w9YPcDsP.js +1 -0
- drowse/web/dist/assets/instruments.svelte-XnEUQA6B.js +1 -0
- drowse/web/dist/assets/localData-DIBDM_zo.js +1 -0
- drowse/web/dist/assets/loom.svelte-D_YyqHHK.js +1 -0
- drowse/web/dist/assets/manifoldJobs.svelte-9f5hs_J7.js +1 -0
- drowse/web/dist/assets/manifoldJobs.svelte-Bwo2GYOH.js +1 -0
- drowse/web/dist/assets/openai.png +0 -0
- drowse/web/dist/assets/preload-helper-BLdHbfdN.js +1 -0
- drowse/web/dist/assets/probes.svelte-COcN1Rh8.js +1 -0
- drowse/web/dist/assets/registry-B0_pJoMg.js +1 -0
- drowse/web/dist/assets/registry-CQv71XNh.js +1 -0
- drowse/web/dist/assets/sampling.svelte-BU0kED3k.js +1 -0
- drowse/web/dist/assets/samplingCapabilities-DM6eoDoc.js +1 -0
- drowse/web/dist/assets/savedConversations.svelte-BsBLc-p7.js +1 -0
- drowse/web/dist/assets/savedConversations.svelte-TuSes9Kg.js +1 -0
- drowse/web/dist/assets/selectors-BxXnPPN_.js +1 -0
- drowse/web/dist/assets/serviceTools-CG0q1Xqg.js +2 -0
- drowse/web/dist/assets/session.svelte-D2STLuP6.js +1 -0
- drowse/web/dist/assets/steering.svelte-DvFT3O-d.js +1 -0
- drowse/web/dist/assets/steeringPositions-Dr0JOFu7.js +1 -0
- drowse/web/dist/assets/templates-Bkq2x5ID.js +1 -0
- drowse/web/dist/assets/types-CuMUbvHW.js +1 -0
- drowse/web/dist/assets/validation-5wgTuS7k.js +1 -0
- drowse/web/dist/assets/webmcp-DyqJf4z6.js +2 -0
- drowse/web/dist/assets/workspaceController-C2L33e3m.js +1 -0
- drowse/web/dist/assets/workspaceController-DJhXD_BC.js +1 -0
- drowse/web/dist/assets/workspaceTools-BWdmXopx.js +2 -0
- drowse/web/dist/favicon.ico +0 -0
- drowse/web/dist/favicon.svg +1 -0
- drowse/web/dist/icons/apple-touch-icon.png +0 -0
- drowse/web/dist/icons/drowse-192.png +0 -0
- drowse/web/dist/icons/drowse-512.png +0 -0
- drowse/web/dist/icons/drowse-maskable-512.png +0 -0
- drowse/web/dist/icons/tab-analyzing-0.png +0 -0
- drowse/web/dist/icons/tab-analyzing-1.png +0 -0
- drowse/web/dist/icons/tab-analyzing-2.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-0.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-1.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-10.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-11.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-12.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-13.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-14.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-15.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-16.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-17.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-18.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-19.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-2.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-20.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-21.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-22.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-23.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-24.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-25.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-26.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-27.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-28.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-29.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-3.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-30.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-31.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-32.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-33.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-34.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-35.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-36.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-37.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-38.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-39.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-4.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-40.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-41.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-42.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-43.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-44.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-45.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-46.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-47.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-5.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-6.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-7.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-8.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-9.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-0.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-1.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-10.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-11.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-12.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-13.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-14.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-15.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-16.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-17.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-18.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-19.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-2.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-20.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-21.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-22.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-23.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-24.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-25.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-26.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-27.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-28.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-29.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-3.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-30.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-31.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-32.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-33.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-34.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-35.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-36.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-37.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-38.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-39.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-4.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-40.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-41.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-42.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-43.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-44.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-45.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-46.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-47.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-5.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-6.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-7.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-8.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-9.png +0 -0
- drowse/web/dist/icons/tab-chat-settings-dark.png +0 -0
- drowse/web/dist/icons/tab-chat-settings-light.png +0 -0
- drowse/web/dist/icons/tab-chat-settings.png +0 -0
- drowse/web/dist/icons/tab-chats-dark.png +0 -0
- drowse/web/dist/icons/tab-chats-light.png +0 -0
- drowse/web/dist/icons/tab-chats.png +0 -0
- drowse/web/dist/icons/tab-checking-0.png +0 -0
- drowse/web/dist/icons/tab-checking-1.png +0 -0
- drowse/web/dist/icons/tab-checking-2.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-0.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-1.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-10.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-11.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-12.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-13.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-14.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-15.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-16.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-17.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-18.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-19.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-2.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-20.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-21.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-22.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-23.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-24.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-25.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-26.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-27.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-28.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-29.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-3.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-30.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-31.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-32.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-33.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-34.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-35.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-36.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-37.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-38.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-39.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-4.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-40.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-41.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-42.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-43.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-44.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-45.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-46.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-47.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-5.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-6.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-7.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-8.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-9.png +0 -0
- drowse/web/dist/icons/tab-checking-light-0.png +0 -0
- drowse/web/dist/icons/tab-checking-light-1.png +0 -0
- drowse/web/dist/icons/tab-checking-light-10.png +0 -0
- drowse/web/dist/icons/tab-checking-light-11.png +0 -0
- drowse/web/dist/icons/tab-checking-light-12.png +0 -0
- drowse/web/dist/icons/tab-checking-light-13.png +0 -0
- drowse/web/dist/icons/tab-checking-light-14.png +0 -0
- drowse/web/dist/icons/tab-checking-light-15.png +0 -0
- drowse/web/dist/icons/tab-checking-light-16.png +0 -0
- drowse/web/dist/icons/tab-checking-light-17.png +0 -0
- drowse/web/dist/icons/tab-checking-light-18.png +0 -0
- drowse/web/dist/icons/tab-checking-light-19.png +0 -0
- drowse/web/dist/icons/tab-checking-light-2.png +0 -0
- drowse/web/dist/icons/tab-checking-light-20.png +0 -0
- drowse/web/dist/icons/tab-checking-light-21.png +0 -0
- drowse/web/dist/icons/tab-checking-light-22.png +0 -0
- drowse/web/dist/icons/tab-checking-light-23.png +0 -0
- drowse/web/dist/icons/tab-checking-light-24.png +0 -0
- drowse/web/dist/icons/tab-checking-light-25.png +0 -0
- drowse/web/dist/icons/tab-checking-light-26.png +0 -0
- drowse/web/dist/icons/tab-checking-light-27.png +0 -0
- drowse/web/dist/icons/tab-checking-light-28.png +0 -0
- drowse/web/dist/icons/tab-checking-light-29.png +0 -0
- drowse/web/dist/icons/tab-checking-light-3.png +0 -0
- drowse/web/dist/icons/tab-checking-light-30.png +0 -0
- drowse/web/dist/icons/tab-checking-light-31.png +0 -0
- drowse/web/dist/icons/tab-checking-light-32.png +0 -0
- drowse/web/dist/icons/tab-checking-light-33.png +0 -0
- drowse/web/dist/icons/tab-checking-light-34.png +0 -0
- drowse/web/dist/icons/tab-checking-light-35.png +0 -0
- drowse/web/dist/icons/tab-checking-light-36.png +0 -0
- drowse/web/dist/icons/tab-checking-light-37.png +0 -0
- drowse/web/dist/icons/tab-checking-light-38.png +0 -0
- drowse/web/dist/icons/tab-checking-light-39.png +0 -0
- drowse/web/dist/icons/tab-checking-light-4.png +0 -0
- drowse/web/dist/icons/tab-checking-light-40.png +0 -0
- drowse/web/dist/icons/tab-checking-light-41.png +0 -0
- drowse/web/dist/icons/tab-checking-light-42.png +0 -0
- drowse/web/dist/icons/tab-checking-light-43.png +0 -0
- drowse/web/dist/icons/tab-checking-light-44.png +0 -0
- drowse/web/dist/icons/tab-checking-light-45.png +0 -0
- drowse/web/dist/icons/tab-checking-light-46.png +0 -0
- drowse/web/dist/icons/tab-checking-light-47.png +0 -0
- drowse/web/dist/icons/tab-checking-light-5.png +0 -0
- drowse/web/dist/icons/tab-checking-light-6.png +0 -0
- drowse/web/dist/icons/tab-checking-light-7.png +0 -0
- drowse/web/dist/icons/tab-checking-light-8.png +0 -0
- drowse/web/dist/icons/tab-checking-light-9.png +0 -0
- drowse/web/dist/icons/tab-comparison-dark.png +0 -0
- drowse/web/dist/icons/tab-comparison-light.png +0 -0
- drowse/web/dist/icons/tab-comparison.png +0 -0
- drowse/web/dist/icons/tab-controls-dark.png +0 -0
- drowse/web/dist/icons/tab-controls-light.png +0 -0
- drowse/web/dist/icons/tab-controls.png +0 -0
- drowse/web/dist/icons/tab-conversation-dark.png +0 -0
- drowse/web/dist/icons/tab-conversation-light.png +0 -0
- drowse/web/dist/icons/tab-conversation.png +0 -0
- drowse/web/dist/icons/tab-credits-dark.png +0 -0
- drowse/web/dist/icons/tab-credits-light.png +0 -0
- drowse/web/dist/icons/tab-credits.png +0 -0
- drowse/web/dist/icons/tab-downloading-0.png +0 -0
- drowse/web/dist/icons/tab-downloading-1.png +0 -0
- drowse/web/dist/icons/tab-downloading-2.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-0.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-1.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-10.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-11.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-12.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-13.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-14.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-15.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-16.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-17.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-18.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-19.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-2.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-20.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-21.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-22.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-23.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-24.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-25.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-26.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-27.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-28.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-29.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-3.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-30.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-31.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-32.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-33.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-34.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-35.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-36.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-37.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-38.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-39.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-4.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-40.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-41.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-42.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-43.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-44.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-45.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-46.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-47.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-5.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-6.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-7.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-8.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-9.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-0.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-1.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-10.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-11.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-12.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-13.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-14.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-15.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-16.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-17.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-18.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-19.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-2.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-20.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-21.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-22.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-23.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-24.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-25.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-26.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-27.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-28.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-29.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-3.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-30.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-31.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-32.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-33.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-34.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-35.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-36.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-37.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-38.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-39.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-4.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-40.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-41.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-42.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-43.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-44.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-45.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-46.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-47.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-5.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-6.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-7.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-8.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-9.png +0 -0
- drowse/web/dist/icons/tab-error-dark.png +0 -0
- drowse/web/dist/icons/tab-error-light.png +0 -0
- drowse/web/dist/icons/tab-error.png +0 -0
- drowse/web/dist/icons/tab-home-dark.png +0 -0
- drowse/web/dist/icons/tab-home-light.png +0 -0
- drowse/web/dist/icons/tab-home.png +0 -0
- drowse/web/dist/icons/tab-loading-0.png +0 -0
- drowse/web/dist/icons/tab-loading-1.png +0 -0
- drowse/web/dist/icons/tab-loading-2.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-0.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-1.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-10.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-11.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-12.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-13.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-14.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-15.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-16.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-17.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-18.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-19.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-2.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-20.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-21.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-22.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-23.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-24.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-25.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-26.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-27.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-28.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-29.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-3.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-30.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-31.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-32.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-33.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-34.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-35.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-36.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-37.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-38.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-39.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-4.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-40.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-41.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-42.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-43.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-44.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-45.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-46.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-47.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-5.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-6.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-7.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-8.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-9.png +0 -0
- drowse/web/dist/icons/tab-loading-light-0.png +0 -0
- drowse/web/dist/icons/tab-loading-light-1.png +0 -0
- drowse/web/dist/icons/tab-loading-light-10.png +0 -0
- drowse/web/dist/icons/tab-loading-light-11.png +0 -0
- drowse/web/dist/icons/tab-loading-light-12.png +0 -0
- drowse/web/dist/icons/tab-loading-light-13.png +0 -0
- drowse/web/dist/icons/tab-loading-light-14.png +0 -0
- drowse/web/dist/icons/tab-loading-light-15.png +0 -0
- drowse/web/dist/icons/tab-loading-light-16.png +0 -0
- drowse/web/dist/icons/tab-loading-light-17.png +0 -0
- drowse/web/dist/icons/tab-loading-light-18.png +0 -0
- drowse/web/dist/icons/tab-loading-light-19.png +0 -0
- drowse/web/dist/icons/tab-loading-light-2.png +0 -0
- drowse/web/dist/icons/tab-loading-light-20.png +0 -0
- drowse/web/dist/icons/tab-loading-light-21.png +0 -0
- drowse/web/dist/icons/tab-loading-light-22.png +0 -0
- drowse/web/dist/icons/tab-loading-light-23.png +0 -0
- drowse/web/dist/icons/tab-loading-light-24.png +0 -0
- drowse/web/dist/icons/tab-loading-light-25.png +0 -0
- drowse/web/dist/icons/tab-loading-light-26.png +0 -0
- drowse/web/dist/icons/tab-loading-light-27.png +0 -0
- drowse/web/dist/icons/tab-loading-light-28.png +0 -0
- drowse/web/dist/icons/tab-loading-light-29.png +0 -0
- drowse/web/dist/icons/tab-loading-light-3.png +0 -0
- drowse/web/dist/icons/tab-loading-light-30.png +0 -0
- drowse/web/dist/icons/tab-loading-light-31.png +0 -0
- drowse/web/dist/icons/tab-loading-light-32.png +0 -0
- drowse/web/dist/icons/tab-loading-light-33.png +0 -0
- drowse/web/dist/icons/tab-loading-light-34.png +0 -0
- drowse/web/dist/icons/tab-loading-light-35.png +0 -0
- drowse/web/dist/icons/tab-loading-light-36.png +0 -0
- drowse/web/dist/icons/tab-loading-light-37.png +0 -0
- drowse/web/dist/icons/tab-loading-light-38.png +0 -0
- drowse/web/dist/icons/tab-loading-light-39.png +0 -0
- drowse/web/dist/icons/tab-loading-light-4.png +0 -0
- drowse/web/dist/icons/tab-loading-light-40.png +0 -0
- drowse/web/dist/icons/tab-loading-light-41.png +0 -0
- drowse/web/dist/icons/tab-loading-light-42.png +0 -0
- drowse/web/dist/icons/tab-loading-light-43.png +0 -0
- drowse/web/dist/icons/tab-loading-light-44.png +0 -0
- drowse/web/dist/icons/tab-loading-light-45.png +0 -0
- drowse/web/dist/icons/tab-loading-light-46.png +0 -0
- drowse/web/dist/icons/tab-loading-light-47.png +0 -0
- drowse/web/dist/icons/tab-loading-light-5.png +0 -0
- drowse/web/dist/icons/tab-loading-light-6.png +0 -0
- drowse/web/dist/icons/tab-loading-light-7.png +0 -0
- drowse/web/dist/icons/tab-loading-light-8.png +0 -0
- drowse/web/dist/icons/tab-loading-light-9.png +0 -0
- drowse/web/dist/icons/tab-loom-dark.png +0 -0
- drowse/web/dist/icons/tab-loom-light.png +0 -0
- drowse/web/dist/icons/tab-loom-working-0.png +0 -0
- drowse/web/dist/icons/tab-loom-working-1.png +0 -0
- drowse/web/dist/icons/tab-loom-working-2.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-0.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-1.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-10.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-11.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-12.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-13.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-14.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-15.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-16.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-17.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-18.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-19.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-2.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-20.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-21.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-22.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-23.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-24.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-25.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-26.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-27.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-28.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-29.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-3.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-30.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-31.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-32.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-33.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-34.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-35.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-36.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-37.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-38.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-39.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-4.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-40.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-41.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-42.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-43.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-44.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-45.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-46.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-47.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-5.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-6.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-7.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-8.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-9.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-0.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-1.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-10.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-11.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-12.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-13.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-14.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-15.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-16.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-17.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-18.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-19.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-2.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-20.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-21.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-22.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-23.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-24.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-25.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-26.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-27.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-28.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-29.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-3.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-30.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-31.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-32.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-33.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-34.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-35.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-36.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-37.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-38.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-39.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-4.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-40.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-41.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-42.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-43.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-44.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-45.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-46.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-47.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-5.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-6.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-7.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-8.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-9.png +0 -0
- drowse/web/dist/icons/tab-loom.png +0 -0
- drowse/web/dist/icons/tab-models-dark.png +0 -0
- drowse/web/dist/icons/tab-models-light.png +0 -0
- drowse/web/dist/icons/tab-models.png +0 -0
- drowse/web/dist/icons/tab-offline-dark.png +0 -0
- drowse/web/dist/icons/tab-offline-light.png +0 -0
- drowse/web/dist/icons/tab-offline.png +0 -0
- drowse/web/dist/icons/tab-paused-dark.png +0 -0
- drowse/web/dist/icons/tab-paused-light.png +0 -0
- drowse/web/dist/icons/tab-paused.png +0 -0
- drowse/web/dist/icons/tab-ready-dark.png +0 -0
- drowse/web/dist/icons/tab-ready-light.png +0 -0
- drowse/web/dist/icons/tab-ready.png +0 -0
- drowse/web/dist/icons/tab-saving-0.png +0 -0
- drowse/web/dist/icons/tab-saving-1.png +0 -0
- drowse/web/dist/icons/tab-saving-2.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-0.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-1.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-10.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-11.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-12.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-13.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-14.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-15.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-16.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-17.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-18.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-19.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-2.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-20.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-21.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-22.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-23.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-24.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-25.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-26.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-27.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-28.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-29.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-3.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-30.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-31.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-32.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-33.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-34.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-35.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-36.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-37.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-38.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-39.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-4.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-40.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-41.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-42.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-43.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-44.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-45.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-46.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-47.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-5.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-6.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-7.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-8.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-9.png +0 -0
- drowse/web/dist/icons/tab-saving-light-0.png +0 -0
- drowse/web/dist/icons/tab-saving-light-1.png +0 -0
- drowse/web/dist/icons/tab-saving-light-10.png +0 -0
- drowse/web/dist/icons/tab-saving-light-11.png +0 -0
- drowse/web/dist/icons/tab-saving-light-12.png +0 -0
- drowse/web/dist/icons/tab-saving-light-13.png +0 -0
- drowse/web/dist/icons/tab-saving-light-14.png +0 -0
- drowse/web/dist/icons/tab-saving-light-15.png +0 -0
- drowse/web/dist/icons/tab-saving-light-16.png +0 -0
- drowse/web/dist/icons/tab-saving-light-17.png +0 -0
- drowse/web/dist/icons/tab-saving-light-18.png +0 -0
- drowse/web/dist/icons/tab-saving-light-19.png +0 -0
- drowse/web/dist/icons/tab-saving-light-2.png +0 -0
- drowse/web/dist/icons/tab-saving-light-20.png +0 -0
- drowse/web/dist/icons/tab-saving-light-21.png +0 -0
- drowse/web/dist/icons/tab-saving-light-22.png +0 -0
- drowse/web/dist/icons/tab-saving-light-23.png +0 -0
- drowse/web/dist/icons/tab-saving-light-24.png +0 -0
- drowse/web/dist/icons/tab-saving-light-25.png +0 -0
- drowse/web/dist/icons/tab-saving-light-26.png +0 -0
- drowse/web/dist/icons/tab-saving-light-27.png +0 -0
- drowse/web/dist/icons/tab-saving-light-28.png +0 -0
- drowse/web/dist/icons/tab-saving-light-29.png +0 -0
- drowse/web/dist/icons/tab-saving-light-3.png +0 -0
- drowse/web/dist/icons/tab-saving-light-30.png +0 -0
- drowse/web/dist/icons/tab-saving-light-31.png +0 -0
- drowse/web/dist/icons/tab-saving-light-32.png +0 -0
- drowse/web/dist/icons/tab-saving-light-33.png +0 -0
- drowse/web/dist/icons/tab-saving-light-34.png +0 -0
- drowse/web/dist/icons/tab-saving-light-35.png +0 -0
- drowse/web/dist/icons/tab-saving-light-36.png +0 -0
- drowse/web/dist/icons/tab-saving-light-37.png +0 -0
- drowse/web/dist/icons/tab-saving-light-38.png +0 -0
- drowse/web/dist/icons/tab-saving-light-39.png +0 -0
- drowse/web/dist/icons/tab-saving-light-4.png +0 -0
- drowse/web/dist/icons/tab-saving-light-40.png +0 -0
- drowse/web/dist/icons/tab-saving-light-41.png +0 -0
- drowse/web/dist/icons/tab-saving-light-42.png +0 -0
- drowse/web/dist/icons/tab-saving-light-43.png +0 -0
- drowse/web/dist/icons/tab-saving-light-44.png +0 -0
- drowse/web/dist/icons/tab-saving-light-45.png +0 -0
- drowse/web/dist/icons/tab-saving-light-46.png +0 -0
- drowse/web/dist/icons/tab-saving-light-47.png +0 -0
- drowse/web/dist/icons/tab-saving-light-5.png +0 -0
- drowse/web/dist/icons/tab-saving-light-6.png +0 -0
- drowse/web/dist/icons/tab-saving-light-7.png +0 -0
- drowse/web/dist/icons/tab-saving-light-8.png +0 -0
- drowse/web/dist/icons/tab-saving-light-9.png +0 -0
- drowse/web/dist/icons/tab-thinking-0.png +0 -0
- drowse/web/dist/icons/tab-thinking-1.png +0 -0
- drowse/web/dist/icons/tab-thinking-2.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-0.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-1.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-10.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-11.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-12.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-13.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-14.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-15.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-16.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-17.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-18.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-19.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-2.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-20.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-21.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-22.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-23.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-24.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-25.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-26.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-27.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-28.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-29.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-3.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-30.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-31.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-32.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-33.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-34.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-35.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-36.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-37.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-38.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-39.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-4.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-40.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-41.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-42.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-43.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-44.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-45.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-46.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-47.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-5.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-6.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-7.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-8.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-9.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-0.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-1.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-10.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-11.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-12.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-13.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-14.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-15.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-16.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-17.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-18.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-19.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-2.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-20.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-21.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-22.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-23.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-24.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-25.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-26.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-27.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-28.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-29.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-3.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-30.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-31.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-32.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-33.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-34.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-35.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-36.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-37.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-38.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-39.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-4.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-40.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-41.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-42.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-43.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-44.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-45.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-46.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-47.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-5.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-6.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-7.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-8.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-9.png +0 -0
- drowse/web/dist/icons/tab-tokens-dark.png +0 -0
- drowse/web/dist/icons/tab-tokens-light.png +0 -0
- drowse/web/dist/icons/tab-tokens.png +0 -0
- drowse/web/dist/icons/tab-training-0.png +0 -0
- drowse/web/dist/icons/tab-training-1.png +0 -0
- drowse/web/dist/icons/tab-training-2.png +0 -0
- drowse/web/dist/icons/tab-training-dark-0.png +0 -0
- drowse/web/dist/icons/tab-training-dark-1.png +0 -0
- drowse/web/dist/icons/tab-training-dark-10.png +0 -0
- drowse/web/dist/icons/tab-training-dark-11.png +0 -0
- drowse/web/dist/icons/tab-training-dark-12.png +0 -0
- drowse/web/dist/icons/tab-training-dark-13.png +0 -0
- drowse/web/dist/icons/tab-training-dark-14.png +0 -0
- drowse/web/dist/icons/tab-training-dark-15.png +0 -0
- drowse/web/dist/icons/tab-training-dark-16.png +0 -0
- drowse/web/dist/icons/tab-training-dark-17.png +0 -0
- drowse/web/dist/icons/tab-training-dark-18.png +0 -0
- drowse/web/dist/icons/tab-training-dark-19.png +0 -0
- drowse/web/dist/icons/tab-training-dark-2.png +0 -0
- drowse/web/dist/icons/tab-training-dark-20.png +0 -0
- drowse/web/dist/icons/tab-training-dark-21.png +0 -0
- drowse/web/dist/icons/tab-training-dark-22.png +0 -0
- drowse/web/dist/icons/tab-training-dark-23.png +0 -0
- drowse/web/dist/icons/tab-training-dark-24.png +0 -0
- drowse/web/dist/icons/tab-training-dark-25.png +0 -0
- drowse/web/dist/icons/tab-training-dark-26.png +0 -0
- drowse/web/dist/icons/tab-training-dark-27.png +0 -0
- drowse/web/dist/icons/tab-training-dark-28.png +0 -0
- drowse/web/dist/icons/tab-training-dark-29.png +0 -0
- drowse/web/dist/icons/tab-training-dark-3.png +0 -0
- drowse/web/dist/icons/tab-training-dark-30.png +0 -0
- drowse/web/dist/icons/tab-training-dark-31.png +0 -0
- drowse/web/dist/icons/tab-training-dark-32.png +0 -0
- drowse/web/dist/icons/tab-training-dark-33.png +0 -0
- drowse/web/dist/icons/tab-training-dark-34.png +0 -0
- drowse/web/dist/icons/tab-training-dark-35.png +0 -0
- drowse/web/dist/icons/tab-training-dark-36.png +0 -0
- drowse/web/dist/icons/tab-training-dark-37.png +0 -0
- drowse/web/dist/icons/tab-training-dark-38.png +0 -0
- drowse/web/dist/icons/tab-training-dark-39.png +0 -0
- drowse/web/dist/icons/tab-training-dark-4.png +0 -0
- drowse/web/dist/icons/tab-training-dark-40.png +0 -0
- drowse/web/dist/icons/tab-training-dark-41.png +0 -0
- drowse/web/dist/icons/tab-training-dark-42.png +0 -0
- drowse/web/dist/icons/tab-training-dark-43.png +0 -0
- drowse/web/dist/icons/tab-training-dark-44.png +0 -0
- drowse/web/dist/icons/tab-training-dark-45.png +0 -0
- drowse/web/dist/icons/tab-training-dark-46.png +0 -0
- drowse/web/dist/icons/tab-training-dark-47.png +0 -0
- drowse/web/dist/icons/tab-training-dark-5.png +0 -0
- drowse/web/dist/icons/tab-training-dark-6.png +0 -0
- drowse/web/dist/icons/tab-training-dark-7.png +0 -0
- drowse/web/dist/icons/tab-training-dark-8.png +0 -0
- drowse/web/dist/icons/tab-training-dark-9.png +0 -0
- drowse/web/dist/icons/tab-training-light-0.png +0 -0
- drowse/web/dist/icons/tab-training-light-1.png +0 -0
- drowse/web/dist/icons/tab-training-light-10.png +0 -0
- drowse/web/dist/icons/tab-training-light-11.png +0 -0
- drowse/web/dist/icons/tab-training-light-12.png +0 -0
- drowse/web/dist/icons/tab-training-light-13.png +0 -0
- drowse/web/dist/icons/tab-training-light-14.png +0 -0
- drowse/web/dist/icons/tab-training-light-15.png +0 -0
- drowse/web/dist/icons/tab-training-light-16.png +0 -0
- drowse/web/dist/icons/tab-training-light-17.png +0 -0
- drowse/web/dist/icons/tab-training-light-18.png +0 -0
- drowse/web/dist/icons/tab-training-light-19.png +0 -0
- drowse/web/dist/icons/tab-training-light-2.png +0 -0
- drowse/web/dist/icons/tab-training-light-20.png +0 -0
- drowse/web/dist/icons/tab-training-light-21.png +0 -0
- drowse/web/dist/icons/tab-training-light-22.png +0 -0
- drowse/web/dist/icons/tab-training-light-23.png +0 -0
- drowse/web/dist/icons/tab-training-light-24.png +0 -0
- drowse/web/dist/icons/tab-training-light-25.png +0 -0
- drowse/web/dist/icons/tab-training-light-26.png +0 -0
- drowse/web/dist/icons/tab-training-light-27.png +0 -0
- drowse/web/dist/icons/tab-training-light-28.png +0 -0
- drowse/web/dist/icons/tab-training-light-29.png +0 -0
- drowse/web/dist/icons/tab-training-light-3.png +0 -0
- drowse/web/dist/icons/tab-training-light-30.png +0 -0
- drowse/web/dist/icons/tab-training-light-31.png +0 -0
- drowse/web/dist/icons/tab-training-light-32.png +0 -0
- drowse/web/dist/icons/tab-training-light-33.png +0 -0
- drowse/web/dist/icons/tab-training-light-34.png +0 -0
- drowse/web/dist/icons/tab-training-light-35.png +0 -0
- drowse/web/dist/icons/tab-training-light-36.png +0 -0
- drowse/web/dist/icons/tab-training-light-37.png +0 -0
- drowse/web/dist/icons/tab-training-light-38.png +0 -0
- drowse/web/dist/icons/tab-training-light-39.png +0 -0
- drowse/web/dist/icons/tab-training-light-4.png +0 -0
- drowse/web/dist/icons/tab-training-light-40.png +0 -0
- drowse/web/dist/icons/tab-training-light-41.png +0 -0
- drowse/web/dist/icons/tab-training-light-42.png +0 -0
- drowse/web/dist/icons/tab-training-light-43.png +0 -0
- drowse/web/dist/icons/tab-training-light-44.png +0 -0
- drowse/web/dist/icons/tab-training-light-45.png +0 -0
- drowse/web/dist/icons/tab-training-light-46.png +0 -0
- drowse/web/dist/icons/tab-training-light-47.png +0 -0
- drowse/web/dist/icons/tab-training-light-5.png +0 -0
- drowse/web/dist/icons/tab-training-light-6.png +0 -0
- drowse/web/dist/icons/tab-training-light-7.png +0 -0
- drowse/web/dist/icons/tab-training-light-8.png +0 -0
- drowse/web/dist/icons/tab-training-light-9.png +0 -0
- drowse/web/dist/icons/tab-unsupported-dark.png +0 -0
- drowse/web/dist/icons/tab-unsupported-light.png +0 -0
- drowse/web/dist/icons/tab-unsupported.png +0 -0
- drowse/web/dist/icons/tab-working-0.png +0 -0
- drowse/web/dist/icons/tab-working-1.png +0 -0
- drowse/web/dist/icons/tab-working-2.png +0 -0
- drowse/web/dist/icons/tab-working-dark-0.png +0 -0
- drowse/web/dist/icons/tab-working-dark-1.png +0 -0
- drowse/web/dist/icons/tab-working-dark-10.png +0 -0
- drowse/web/dist/icons/tab-working-dark-11.png +0 -0
- drowse/web/dist/icons/tab-working-dark-12.png +0 -0
- drowse/web/dist/icons/tab-working-dark-13.png +0 -0
- drowse/web/dist/icons/tab-working-dark-14.png +0 -0
- drowse/web/dist/icons/tab-working-dark-15.png +0 -0
- drowse/web/dist/icons/tab-working-dark-16.png +0 -0
- drowse/web/dist/icons/tab-working-dark-17.png +0 -0
- drowse/web/dist/icons/tab-working-dark-18.png +0 -0
- drowse/web/dist/icons/tab-working-dark-19.png +0 -0
- drowse/web/dist/icons/tab-working-dark-2.png +0 -0
- drowse/web/dist/icons/tab-working-dark-20.png +0 -0
- drowse/web/dist/icons/tab-working-dark-21.png +0 -0
- drowse/web/dist/icons/tab-working-dark-22.png +0 -0
- drowse/web/dist/icons/tab-working-dark-23.png +0 -0
- drowse/web/dist/icons/tab-working-dark-24.png +0 -0
- drowse/web/dist/icons/tab-working-dark-25.png +0 -0
- drowse/web/dist/icons/tab-working-dark-26.png +0 -0
- drowse/web/dist/icons/tab-working-dark-27.png +0 -0
- drowse/web/dist/icons/tab-working-dark-28.png +0 -0
- drowse/web/dist/icons/tab-working-dark-29.png +0 -0
- drowse/web/dist/icons/tab-working-dark-3.png +0 -0
- drowse/web/dist/icons/tab-working-dark-30.png +0 -0
- drowse/web/dist/icons/tab-working-dark-31.png +0 -0
- drowse/web/dist/icons/tab-working-dark-32.png +0 -0
- drowse/web/dist/icons/tab-working-dark-33.png +0 -0
- drowse/web/dist/icons/tab-working-dark-34.png +0 -0
- drowse/web/dist/icons/tab-working-dark-35.png +0 -0
- drowse/web/dist/icons/tab-working-dark-36.png +0 -0
- drowse/web/dist/icons/tab-working-dark-37.png +0 -0
- drowse/web/dist/icons/tab-working-dark-38.png +0 -0
- drowse/web/dist/icons/tab-working-dark-39.png +0 -0
- drowse/web/dist/icons/tab-working-dark-4.png +0 -0
- drowse/web/dist/icons/tab-working-dark-40.png +0 -0
- drowse/web/dist/icons/tab-working-dark-41.png +0 -0
- drowse/web/dist/icons/tab-working-dark-42.png +0 -0
- drowse/web/dist/icons/tab-working-dark-43.png +0 -0
- drowse/web/dist/icons/tab-working-dark-44.png +0 -0
- drowse/web/dist/icons/tab-working-dark-45.png +0 -0
- drowse/web/dist/icons/tab-working-dark-46.png +0 -0
- drowse/web/dist/icons/tab-working-dark-47.png +0 -0
- drowse/web/dist/icons/tab-working-dark-5.png +0 -0
- drowse/web/dist/icons/tab-working-dark-6.png +0 -0
- drowse/web/dist/icons/tab-working-dark-7.png +0 -0
- drowse/web/dist/icons/tab-working-dark-8.png +0 -0
- drowse/web/dist/icons/tab-working-dark-9.png +0 -0
- drowse/web/dist/icons/tab-working-light-0.png +0 -0
- drowse/web/dist/icons/tab-working-light-1.png +0 -0
- drowse/web/dist/icons/tab-working-light-10.png +0 -0
- drowse/web/dist/icons/tab-working-light-11.png +0 -0
- drowse/web/dist/icons/tab-working-light-12.png +0 -0
- drowse/web/dist/icons/tab-working-light-13.png +0 -0
- drowse/web/dist/icons/tab-working-light-14.png +0 -0
- drowse/web/dist/icons/tab-working-light-15.png +0 -0
- drowse/web/dist/icons/tab-working-light-16.png +0 -0
- drowse/web/dist/icons/tab-working-light-17.png +0 -0
- drowse/web/dist/icons/tab-working-light-18.png +0 -0
- drowse/web/dist/icons/tab-working-light-19.png +0 -0
- drowse/web/dist/icons/tab-working-light-2.png +0 -0
- drowse/web/dist/icons/tab-working-light-20.png +0 -0
- drowse/web/dist/icons/tab-working-light-21.png +0 -0
- drowse/web/dist/icons/tab-working-light-22.png +0 -0
- drowse/web/dist/icons/tab-working-light-23.png +0 -0
- drowse/web/dist/icons/tab-working-light-24.png +0 -0
- drowse/web/dist/icons/tab-working-light-25.png +0 -0
- drowse/web/dist/icons/tab-working-light-26.png +0 -0
- drowse/web/dist/icons/tab-working-light-27.png +0 -0
- drowse/web/dist/icons/tab-working-light-28.png +0 -0
- drowse/web/dist/icons/tab-working-light-29.png +0 -0
- drowse/web/dist/icons/tab-working-light-3.png +0 -0
- drowse/web/dist/icons/tab-working-light-30.png +0 -0
- drowse/web/dist/icons/tab-working-light-31.png +0 -0
- drowse/web/dist/icons/tab-working-light-32.png +0 -0
- drowse/web/dist/icons/tab-working-light-33.png +0 -0
- drowse/web/dist/icons/tab-working-light-34.png +0 -0
- drowse/web/dist/icons/tab-working-light-35.png +0 -0
- drowse/web/dist/icons/tab-working-light-36.png +0 -0
- drowse/web/dist/icons/tab-working-light-37.png +0 -0
- drowse/web/dist/icons/tab-working-light-38.png +0 -0
- drowse/web/dist/icons/tab-working-light-39.png +0 -0
- drowse/web/dist/icons/tab-working-light-4.png +0 -0
- drowse/web/dist/icons/tab-working-light-40.png +0 -0
- drowse/web/dist/icons/tab-working-light-41.png +0 -0
- drowse/web/dist/icons/tab-working-light-42.png +0 -0
- drowse/web/dist/icons/tab-working-light-43.png +0 -0
- drowse/web/dist/icons/tab-working-light-44.png +0 -0
- drowse/web/dist/icons/tab-working-light-45.png +0 -0
- drowse/web/dist/icons/tab-working-light-46.png +0 -0
- drowse/web/dist/icons/tab-working-light-47.png +0 -0
- drowse/web/dist/icons/tab-working-light-5.png +0 -0
- drowse/web/dist/icons/tab-working-light-6.png +0 -0
- drowse/web/dist/icons/tab-working-light-7.png +0 -0
- drowse/web/dist/icons/tab-working-light-8.png +0 -0
- drowse/web/dist/icons/tab-working-light-9.png +0 -0
- drowse/web/dist/index.html +34 -0
- drowse/web/dist/social/drowse.png +0 -0
- drowse/web/dist/social/drowse.svg +6 -0
- drowse/web/dist/theme-init.js +25 -0
- drowse/web/routes.py +118 -0
- drowse_ai-5.3.1.dist-info/METADATA +632 -0
- drowse_ai-5.3.1.dist-info/RECORD +1341 -0
- drowse_ai-5.3.1.dist-info/WHEEL +5 -0
- drowse_ai-5.3.1.dist-info/entry_points.txt +2 -0
- drowse_ai-5.3.1.dist-info/licenses/LICENSE +661 -0
- drowse_ai-5.3.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,1830 @@
|
|
|
1
|
+
"""Secure ``.drowse`` manifold transport archives."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import hashlib
|
|
6
|
+
import json
|
|
7
|
+
import os
|
|
8
|
+
import re
|
|
9
|
+
import shutil
|
|
10
|
+
import stat
|
|
11
|
+
import tempfile
|
|
12
|
+
import uuid
|
|
13
|
+
import zipfile
|
|
14
|
+
from contextlib import ExitStack, contextmanager
|
|
15
|
+
from pathlib import Path, PurePosixPath
|
|
16
|
+
from typing import Any, Callable, Iterator
|
|
17
|
+
|
|
18
|
+
import torch
|
|
19
|
+
from safetensors import SafetensorError, safe_open
|
|
20
|
+
|
|
21
|
+
from drowse.core.errors import DrowseError
|
|
22
|
+
from drowse.io.atomic import artifact_lock, fsync_directory, write_json_atomic
|
|
23
|
+
from drowse.io.integrity import NAME_REGEX, hash_file
|
|
24
|
+
from drowse.io.manifold_folder import (
|
|
25
|
+
ManifoldFolder,
|
|
26
|
+
ManifoldFormatError,
|
|
27
|
+
load_manifold_sidecar_data,
|
|
28
|
+
manifold_folder_tensor_paths,
|
|
29
|
+
manifold_pair_lock,
|
|
30
|
+
)
|
|
31
|
+
from drowse.io.paths import manifold_dir, drowse_home
|
|
32
|
+
from drowse.io.templates import TemplateFolder, template_dir
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
DROWSE_ARCHIVE_FORMAT_VERSION = 1
|
|
36
|
+
DROWSE_ARCHIVE_MAX_ENTRIES = 4_096
|
|
37
|
+
DROWSE_ARCHIVE_MAX_FILE_BYTES = 512 * 1024 * 1024
|
|
38
|
+
DROWSE_ARCHIVE_MAX_TOTAL_BYTES = 2 * 1024 * 1024 * 1024
|
|
39
|
+
DROWSE_ARCHIVE_MAX_COMPRESSION_RATIO = 100
|
|
40
|
+
_PACK_MANIFEST_MAX_BYTES = 1024 * 1024
|
|
41
|
+
_METADATA_JSON_MAX_BYTES = 4 * 1024 * 1024
|
|
42
|
+
_NODE_JSON_MAX_BYTES = 64 * 1024 * 1024
|
|
43
|
+
_SAFETENSORS_HEADER_MAX_BYTES = 1024 * 1024
|
|
44
|
+
_SAFETENSORS_MAX_KEYS = 4_096
|
|
45
|
+
_TENSOR_VALIDATION_CHUNK_BYTES = 16 * 1024 * 1024
|
|
46
|
+
_TENSOR_MAX_ELEMENTS = DROWSE_ARCHIVE_MAX_FILE_BYTES // 4
|
|
47
|
+
_SHA256_RE = re.compile(r"^[0-9a-f]{64}$")
|
|
48
|
+
_HF_COMMIT_RE = re.compile(r"^[0-9a-f]{40}$")
|
|
49
|
+
_DRIVE_RE = re.compile(r"^[A-Za-z]:")
|
|
50
|
+
_TRANSACTION_FORMAT_VERSION = 1
|
|
51
|
+
_LEGACY_TRANSACTION_RE = re.compile(
|
|
52
|
+
r"^(?P<name>[a-z][a-z0-9._-]{0,63})\.drowse-"
|
|
53
|
+
r"(?P<kind>stage|bak)-(?P<token>[0-9a-f]{32})$"
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
ProgressCallback = Callable[[str], None]
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class DrowseArchiveError(ValueError, DrowseError):
|
|
60
|
+
"""A ``.drowse`` archive is malformed or unsafe."""
|
|
61
|
+
|
|
62
|
+
def user_message(self) -> tuple[int, str]:
|
|
63
|
+
return (400, str(self) or self.__class__.__name__)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def _report(on_progress: ProgressCallback | None, message: str) -> None:
|
|
67
|
+
if on_progress is not None:
|
|
68
|
+
on_progress(message)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def _load_exact_json(raw: bytes, *, label: str) -> Any:
|
|
72
|
+
def reject_duplicate_keys(pairs: list[tuple[str, Any]]) -> dict[str, Any]:
|
|
73
|
+
out: dict[str, Any] = {}
|
|
74
|
+
for key, value in pairs:
|
|
75
|
+
if key in out:
|
|
76
|
+
raise DrowseArchiveError(f"{label} has duplicate key {key!r}")
|
|
77
|
+
out[key] = value
|
|
78
|
+
return out
|
|
79
|
+
|
|
80
|
+
try:
|
|
81
|
+
return json.loads(raw, object_pairs_hook=reject_duplicate_keys)
|
|
82
|
+
except UnicodeDecodeError as exc:
|
|
83
|
+
raise DrowseArchiveError(f"{label} is not UTF-8 ({exc})") from exc
|
|
84
|
+
except json.JSONDecodeError as exc:
|
|
85
|
+
raise DrowseArchiveError(f"{label} is invalid JSON ({exc})") from exc
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def _load_pack_json(raw: bytes) -> dict[str, Any]:
|
|
89
|
+
data = _load_exact_json(raw, label="pack.json")
|
|
90
|
+
if not isinstance(data, dict):
|
|
91
|
+
raise DrowseArchiveError("pack.json must be a JSON object")
|
|
92
|
+
return data
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def _read_limited(path: Path, *, maximum: int, label: str) -> bytes:
|
|
96
|
+
try:
|
|
97
|
+
with open(path, "rb") as handle:
|
|
98
|
+
raw = handle.read(maximum + 1)
|
|
99
|
+
except OSError as exc:
|
|
100
|
+
raise DrowseArchiveError(f"{label} is unreadable ({exc})") from exc
|
|
101
|
+
if len(raw) > maximum:
|
|
102
|
+
raise DrowseArchiveError(f"{label} is larger than {maximum} bytes")
|
|
103
|
+
return raw
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def _archive_path(value: Any, *, root: str) -> tuple[str, str, str]:
|
|
107
|
+
if not isinstance(value, str):
|
|
108
|
+
raise DrowseArchiveError(f"pack.json {root!r} path must be a string")
|
|
109
|
+
_validate_member_path(value)
|
|
110
|
+
parts = PurePosixPath(value).parts
|
|
111
|
+
if len(parts) != 3 or parts[0] != root:
|
|
112
|
+
raise DrowseArchiveError(
|
|
113
|
+
f"pack.json path {value!r} must be {root}/<namespace>/<name>"
|
|
114
|
+
)
|
|
115
|
+
namespace, name = parts[1], parts[2]
|
|
116
|
+
for label, component in (("namespace", namespace), ("name", name)):
|
|
117
|
+
if not NAME_REGEX.fullmatch(component):
|
|
118
|
+
raise DrowseArchiveError(
|
|
119
|
+
f"pack.json {root} {label} {component!r} must match "
|
|
120
|
+
f"{NAME_REGEX.pattern}"
|
|
121
|
+
)
|
|
122
|
+
if root == "manifolds":
|
|
123
|
+
_validate_manifold_identity(namespace, name)
|
|
124
|
+
return value, namespace, name
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def _validate_manifold_identity(namespace: str, name: str) -> None:
|
|
128
|
+
from drowse.io.manifold_authoring import _validate_ns_name
|
|
129
|
+
|
|
130
|
+
try:
|
|
131
|
+
_validate_ns_name(namespace, name)
|
|
132
|
+
except ManifoldFormatError as exc:
|
|
133
|
+
raise DrowseArchiveError(str(exc)) from exc
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def _validate_member_path(name: str) -> None:
|
|
137
|
+
if not name or "\x00" in name:
|
|
138
|
+
raise DrowseArchiveError("archive contains a blank or NUL-containing path")
|
|
139
|
+
if "\\" in name:
|
|
140
|
+
raise DrowseArchiveError(f"archive path {name!r} contains a backslash")
|
|
141
|
+
if name.startswith("/") or _DRIVE_RE.match(name):
|
|
142
|
+
raise DrowseArchiveError(f"archive path {name!r} is absolute")
|
|
143
|
+
parts = name.split("/")
|
|
144
|
+
if any(part in {"", ".", ".."} for part in parts):
|
|
145
|
+
raise DrowseArchiveError(f"archive path {name!r} is not canonical")
|
|
146
|
+
if PurePosixPath(name).is_absolute():
|
|
147
|
+
raise DrowseArchiveError(f"archive path {name!r} is absolute")
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
def _validate_zip_infos(infos: list[zipfile.ZipInfo]) -> dict[str, zipfile.ZipInfo]:
|
|
151
|
+
if not infos:
|
|
152
|
+
raise DrowseArchiveError("archive is empty")
|
|
153
|
+
if len(infos) > DROWSE_ARCHIVE_MAX_ENTRIES:
|
|
154
|
+
raise DrowseArchiveError(
|
|
155
|
+
f"archive has {len(infos)} entries; maximum is "
|
|
156
|
+
f"{DROWSE_ARCHIVE_MAX_ENTRIES}"
|
|
157
|
+
)
|
|
158
|
+
by_name: dict[str, zipfile.ZipInfo] = {}
|
|
159
|
+
casefolded: dict[str, str] = {}
|
|
160
|
+
total = 0
|
|
161
|
+
for info in infos:
|
|
162
|
+
name = info.filename
|
|
163
|
+
original = getattr(info, "orig_filename", name)
|
|
164
|
+
if original != name:
|
|
165
|
+
raise DrowseArchiveError(
|
|
166
|
+
f"archive raw path {original!r} is not represented exactly"
|
|
167
|
+
)
|
|
168
|
+
_validate_member_path(original)
|
|
169
|
+
_validate_member_path(name)
|
|
170
|
+
if name in by_name:
|
|
171
|
+
raise DrowseArchiveError(f"archive contains duplicate path {name!r}")
|
|
172
|
+
folded = name.casefold()
|
|
173
|
+
if folded in casefolded:
|
|
174
|
+
raise DrowseArchiveError(
|
|
175
|
+
f"archive paths {casefolded[folded]!r} and {name!r} collide "
|
|
176
|
+
"case-insensitively"
|
|
177
|
+
)
|
|
178
|
+
if info.is_dir():
|
|
179
|
+
raise DrowseArchiveError(f"archive entry {name!r} must be a regular file")
|
|
180
|
+
if info.flag_bits & 0x1:
|
|
181
|
+
raise DrowseArchiveError(f"archive entry {name!r} is encrypted")
|
|
182
|
+
mode = info.external_attr >> 16
|
|
183
|
+
kind = stat.S_IFMT(mode)
|
|
184
|
+
if kind not in (0, stat.S_IFREG):
|
|
185
|
+
raise DrowseArchiveError(f"archive entry {name!r} is not a regular file")
|
|
186
|
+
if info.file_size > DROWSE_ARCHIVE_MAX_FILE_BYTES:
|
|
187
|
+
raise DrowseArchiveError(
|
|
188
|
+
f"archive entry {name!r} is larger than 512 MiB"
|
|
189
|
+
)
|
|
190
|
+
total += info.file_size
|
|
191
|
+
if total > DROWSE_ARCHIVE_MAX_TOTAL_BYTES:
|
|
192
|
+
raise DrowseArchiveError("archive expands beyond the 2 GiB total limit")
|
|
193
|
+
if info.file_size and (
|
|
194
|
+
info.compress_size == 0
|
|
195
|
+
or info.file_size / info.compress_size
|
|
196
|
+
> DROWSE_ARCHIVE_MAX_COMPRESSION_RATIO
|
|
197
|
+
):
|
|
198
|
+
raise DrowseArchiveError(
|
|
199
|
+
f"archive entry {name!r} exceeds the 100:1 compression limit"
|
|
200
|
+
)
|
|
201
|
+
by_name[name] = info
|
|
202
|
+
casefolded[folded] = name
|
|
203
|
+
return by_name
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
def _validate_pack_manifest(
|
|
207
|
+
data: dict[str, Any], infos: dict[str, zipfile.ZipInfo],
|
|
208
|
+
) -> tuple[str, tuple[str, str], str | None, tuple[str, str] | None, dict[str, Any]]:
|
|
209
|
+
from drowse.io.brand_migration import migrate_legacy_record
|
|
210
|
+
|
|
211
|
+
data = migrate_legacy_record(data)
|
|
212
|
+
expected = {
|
|
213
|
+
"format_version", "kind", "producer", "primary", "template",
|
|
214
|
+
"source", "files",
|
|
215
|
+
}
|
|
216
|
+
if set(data) != expected:
|
|
217
|
+
raise DrowseArchiveError("pack.json does not match the exact v1 schema")
|
|
218
|
+
version = data["format_version"]
|
|
219
|
+
if isinstance(version, bool) or version != DROWSE_ARCHIVE_FORMAT_VERSION:
|
|
220
|
+
raise DrowseArchiveError(
|
|
221
|
+
f"pack.json format_version must be {DROWSE_ARCHIVE_FORMAT_VERSION}"
|
|
222
|
+
)
|
|
223
|
+
if data["kind"] != "drowse-manifold":
|
|
224
|
+
raise DrowseArchiveError("pack.json kind must be 'drowse-manifold'")
|
|
225
|
+
producer = data["producer"]
|
|
226
|
+
if (
|
|
227
|
+
not isinstance(producer, dict)
|
|
228
|
+
or set(producer) != {"name", "version"}
|
|
229
|
+
or producer["name"] != "drowse"
|
|
230
|
+
or not isinstance(producer["version"], str)
|
|
231
|
+
or not producer["version"]
|
|
232
|
+
):
|
|
233
|
+
raise DrowseArchiveError("pack.json producer must name a drowse version")
|
|
234
|
+
|
|
235
|
+
primary, primary_ns, primary_name = _archive_path(
|
|
236
|
+
data["primary"], root="manifolds",
|
|
237
|
+
)
|
|
238
|
+
template_value = data["template"]
|
|
239
|
+
template: str | None = None
|
|
240
|
+
template_identity: tuple[str, str] | None = None
|
|
241
|
+
if template_value is not None:
|
|
242
|
+
template, template_ns, template_name = _archive_path(
|
|
243
|
+
template_value, root="templates",
|
|
244
|
+
)
|
|
245
|
+
template_identity = (template_ns, template_name)
|
|
246
|
+
|
|
247
|
+
_validate_source_provenance(data["source"])
|
|
248
|
+
|
|
249
|
+
files = data["files"]
|
|
250
|
+
if not isinstance(files, dict) or not files:
|
|
251
|
+
raise DrowseArchiveError("pack.json files must be a non-empty object")
|
|
252
|
+
expected_names = set(infos) - {"pack.json"}
|
|
253
|
+
if set(files) != expected_names:
|
|
254
|
+
raise DrowseArchiveError(
|
|
255
|
+
"pack.json files must describe every non-manifest archive entry exactly"
|
|
256
|
+
)
|
|
257
|
+
primary_prefix = primary + "/"
|
|
258
|
+
template_path = None if template is None else template + "/template.json"
|
|
259
|
+
for name, record in files.items():
|
|
260
|
+
_validate_member_path(name)
|
|
261
|
+
if not (
|
|
262
|
+
name.startswith(primary_prefix)
|
|
263
|
+
or template_path is not None and name == template_path
|
|
264
|
+
):
|
|
265
|
+
raise DrowseArchiveError(f"archive entry {name!r} is outside its closure")
|
|
266
|
+
if not isinstance(record, dict) or set(record) != {"size", "sha256"}:
|
|
267
|
+
raise DrowseArchiveError(f"pack.json file record for {name!r} is invalid")
|
|
268
|
+
size = record["size"]
|
|
269
|
+
digest = record["sha256"]
|
|
270
|
+
if isinstance(size, bool) or not isinstance(size, int) or size < 0:
|
|
271
|
+
raise DrowseArchiveError(f"pack.json size for {name!r} is invalid")
|
|
272
|
+
if not isinstance(digest, str) or not _SHA256_RE.fullmatch(digest):
|
|
273
|
+
raise DrowseArchiveError(f"pack.json sha256 for {name!r} is invalid")
|
|
274
|
+
if infos[name].file_size != size:
|
|
275
|
+
raise DrowseArchiveError(f"pack.json size for {name!r} does not match ZIP")
|
|
276
|
+
if f"{primary}/manifold.json" not in files:
|
|
277
|
+
raise DrowseArchiveError("archive closure has no manifold.json")
|
|
278
|
+
if template is None:
|
|
279
|
+
if any(name.startswith("templates/") for name in files):
|
|
280
|
+
raise DrowseArchiveError("archive has an undeclared template closure")
|
|
281
|
+
elif template_path not in files:
|
|
282
|
+
raise DrowseArchiveError("archive template closure has no template.json")
|
|
283
|
+
return (
|
|
284
|
+
primary, (primary_ns, primary_name), template, template_identity,
|
|
285
|
+
files,
|
|
286
|
+
)
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
def _validate_source_provenance(value: Any) -> dict[str, str | None]:
|
|
290
|
+
if not isinstance(value, dict) or set(value) != {
|
|
291
|
+
"uri", "repository", "revision",
|
|
292
|
+
}:
|
|
293
|
+
raise DrowseArchiveError("pack.json source does not match the exact v1 schema")
|
|
294
|
+
uri = value["uri"]
|
|
295
|
+
if (
|
|
296
|
+
not isinstance(uri, str)
|
|
297
|
+
or not uri
|
|
298
|
+
or "\x00" in uri
|
|
299
|
+
or len(uri.encode("utf-8")) > 4_096
|
|
300
|
+
):
|
|
301
|
+
raise DrowseArchiveError("pack.json source.uri must be a short non-empty string")
|
|
302
|
+
repository = value["repository"]
|
|
303
|
+
revision = value["revision"]
|
|
304
|
+
for field, item in (("repository", repository), ("revision", revision)):
|
|
305
|
+
if item is not None and (
|
|
306
|
+
not isinstance(item, str)
|
|
307
|
+
or not item
|
|
308
|
+
or "\x00" in item
|
|
309
|
+
or len(item.encode("utf-8")) > 1_024
|
|
310
|
+
):
|
|
311
|
+
raise DrowseArchiveError(
|
|
312
|
+
f"pack.json source.{field} must be a short string or null"
|
|
313
|
+
)
|
|
314
|
+
if uri.startswith("hf://"):
|
|
315
|
+
if repository is None or revision is None:
|
|
316
|
+
raise DrowseArchiveError(
|
|
317
|
+
"Hugging Face source provenance requires an immutable revision"
|
|
318
|
+
)
|
|
319
|
+
if not _HF_COMMIT_RE.fullmatch(revision):
|
|
320
|
+
raise DrowseArchiveError(
|
|
321
|
+
"Hugging Face source provenance revision must be an immutable "
|
|
322
|
+
"40-character commit SHA"
|
|
323
|
+
)
|
|
324
|
+
if uri != f"hf://{repository}@{revision}":
|
|
325
|
+
raise DrowseArchiveError(
|
|
326
|
+
"pack.json source fields do not describe the same Hugging Face source"
|
|
327
|
+
)
|
|
328
|
+
elif repository is not None or revision is not None:
|
|
329
|
+
raise DrowseArchiveError(
|
|
330
|
+
"non-Hugging Face source provenance cannot name a repository or revision"
|
|
331
|
+
)
|
|
332
|
+
return {"uri": uri, "repository": repository, "revision": revision}
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
def _stream_entry(
|
|
336
|
+
archive: zipfile.ZipFile, info: zipfile.ZipInfo, *, expected: dict[str, Any],
|
|
337
|
+
output: Path | None = None,
|
|
338
|
+
) -> None:
|
|
339
|
+
digest = hashlib.sha256()
|
|
340
|
+
count = 0
|
|
341
|
+
handle = None
|
|
342
|
+
try:
|
|
343
|
+
if output is not None:
|
|
344
|
+
output.parent.mkdir(parents=True, exist_ok=True)
|
|
345
|
+
handle = open(output, "xb")
|
|
346
|
+
with archive.open(info, "r") as source:
|
|
347
|
+
while chunk := source.read(1024 * 1024):
|
|
348
|
+
count += len(chunk)
|
|
349
|
+
if count > expected["size"] or count > DROWSE_ARCHIVE_MAX_FILE_BYTES:
|
|
350
|
+
raise DrowseArchiveError(
|
|
351
|
+
f"archive entry {info.filename!r} exceeds its declared size"
|
|
352
|
+
)
|
|
353
|
+
digest.update(chunk)
|
|
354
|
+
if handle is not None:
|
|
355
|
+
handle.write(chunk)
|
|
356
|
+
if count != expected["size"]:
|
|
357
|
+
raise DrowseArchiveError(
|
|
358
|
+
f"archive entry {info.filename!r} has the wrong size"
|
|
359
|
+
)
|
|
360
|
+
if digest.hexdigest() != expected["sha256"]:
|
|
361
|
+
raise DrowseArchiveError(
|
|
362
|
+
f"archive entry {info.filename!r} failed SHA-256 verification"
|
|
363
|
+
)
|
|
364
|
+
if handle is not None:
|
|
365
|
+
handle.flush()
|
|
366
|
+
os.fsync(handle.fileno())
|
|
367
|
+
except (OSError, RuntimeError, zipfile.BadZipFile) as exc:
|
|
368
|
+
raise DrowseArchiveError(
|
|
369
|
+
f"could not read archive entry {info.filename!r} ({exc})"
|
|
370
|
+
) from exc
|
|
371
|
+
finally:
|
|
372
|
+
if handle is not None:
|
|
373
|
+
handle.close()
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
def _validate_safetensors_header(path: Path) -> None:
|
|
377
|
+
try:
|
|
378
|
+
size = path.stat().st_size
|
|
379
|
+
with open(path, "rb") as handle:
|
|
380
|
+
prefix = handle.read(8)
|
|
381
|
+
except OSError as exc:
|
|
382
|
+
raise DrowseArchiveError(
|
|
383
|
+
f"fitted tensor {path.name} is unreadable ({exc})"
|
|
384
|
+
) from exc
|
|
385
|
+
if len(prefix) != 8:
|
|
386
|
+
raise DrowseArchiveError(f"fitted tensor {path.name} has a truncated header")
|
|
387
|
+
header_bytes = int.from_bytes(prefix, "little")
|
|
388
|
+
if (
|
|
389
|
+
header_bytes <= 0
|
|
390
|
+
or header_bytes > _SAFETENSORS_HEADER_MAX_BYTES
|
|
391
|
+
or header_bytes + 8 > size
|
|
392
|
+
):
|
|
393
|
+
raise DrowseArchiveError(
|
|
394
|
+
f"fitted tensor {path.name} has an invalid or oversized header"
|
|
395
|
+
)
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
def _tensor_shapes_and_finiteness(path: Path) -> dict[str, tuple[int, ...]]:
|
|
399
|
+
_validate_safetensors_header(path)
|
|
400
|
+
shapes: dict[str, tuple[int, ...]] = {}
|
|
401
|
+
try:
|
|
402
|
+
with safe_open(str(path), framework="pt", device="cpu") as tensors:
|
|
403
|
+
keys = list(tensors.keys())
|
|
404
|
+
if len(keys) > _SAFETENSORS_MAX_KEYS:
|
|
405
|
+
raise DrowseArchiveError(
|
|
406
|
+
f"fitted tensor {path.name} has too many tensor keys"
|
|
407
|
+
)
|
|
408
|
+
for key in keys:
|
|
409
|
+
view = tensors.get_slice(key)
|
|
410
|
+
shape = tuple(int(v) for v in view.get_shape())
|
|
411
|
+
if view.get_dtype() != "F32":
|
|
412
|
+
raise DrowseArchiveError(
|
|
413
|
+
f"fitted tensor {path.name} key {key!r} must be fp32"
|
|
414
|
+
)
|
|
415
|
+
if len(shape) > 2:
|
|
416
|
+
raise DrowseArchiveError(
|
|
417
|
+
f"fitted tensor {path.name} key {key!r} has rank > 2"
|
|
418
|
+
)
|
|
419
|
+
if not shape:
|
|
420
|
+
raise DrowseArchiveError(
|
|
421
|
+
f"fitted tensor {path.name} key {key!r} is scalar"
|
|
422
|
+
)
|
|
423
|
+
if any(dimension <= 0 for dimension in shape):
|
|
424
|
+
raise DrowseArchiveError(
|
|
425
|
+
f"fitted tensor {path.name} key {key!r} has a zero "
|
|
426
|
+
"or negative dimension"
|
|
427
|
+
)
|
|
428
|
+
elements = 1
|
|
429
|
+
for dimension in shape:
|
|
430
|
+
if dimension > _TENSOR_MAX_ELEMENTS // elements:
|
|
431
|
+
raise DrowseArchiveError(
|
|
432
|
+
f"fitted tensor {path.name} key {key!r} is too large"
|
|
433
|
+
)
|
|
434
|
+
elements *= dimension
|
|
435
|
+
if len(shape) == 1:
|
|
436
|
+
chunk_elements = max(
|
|
437
|
+
1, _TENSOR_VALIDATION_CHUNK_BYTES // 4,
|
|
438
|
+
)
|
|
439
|
+
chunks = (
|
|
440
|
+
view[start:min(start + chunk_elements, shape[0])]
|
|
441
|
+
for start in range(0, shape[0], chunk_elements)
|
|
442
|
+
)
|
|
443
|
+
else:
|
|
444
|
+
columns = max(1, _TENSOR_VALIDATION_CHUNK_BYTES // 4)
|
|
445
|
+
if shape[1] <= columns:
|
|
446
|
+
rows = max(1, columns // max(shape[1], 1))
|
|
447
|
+
chunks = (
|
|
448
|
+
view[start:min(start + rows, shape[0])]
|
|
449
|
+
for start in range(0, shape[0], rows)
|
|
450
|
+
)
|
|
451
|
+
else:
|
|
452
|
+
chunks = (
|
|
453
|
+
view[row:row + 1, start:min(start + columns, shape[1])]
|
|
454
|
+
for row in range(shape[0])
|
|
455
|
+
for start in range(0, shape[1], columns)
|
|
456
|
+
)
|
|
457
|
+
for chunk in chunks:
|
|
458
|
+
if not bool(torch.isfinite(chunk).all()):
|
|
459
|
+
raise DrowseArchiveError(
|
|
460
|
+
f"fitted tensor {path.name} key {key!r} is non-finite"
|
|
461
|
+
)
|
|
462
|
+
del chunk
|
|
463
|
+
shapes[key] = shape
|
|
464
|
+
except (OSError, OverflowError, ValueError, SafetensorError) as exc:
|
|
465
|
+
if isinstance(exc, DrowseArchiveError):
|
|
466
|
+
raise
|
|
467
|
+
raise DrowseArchiveError(
|
|
468
|
+
f"fitted tensor {path.name} is unreadable ({exc})"
|
|
469
|
+
) from exc
|
|
470
|
+
return shapes
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
def _validate_fitted_tensor(
|
|
474
|
+
path: Path,
|
|
475
|
+
folder: ManifoldFolder,
|
|
476
|
+
*,
|
|
477
|
+
resolved_template_sha256: str | None = None,
|
|
478
|
+
) -> None:
|
|
479
|
+
from drowse.core.manifold import domain_from_spec
|
|
480
|
+
from drowse.io.paths import decode_release_id, parse_tensor_filename
|
|
481
|
+
|
|
482
|
+
parsed_filename = parse_tensor_filename(path.name)
|
|
483
|
+
if parsed_filename is None:
|
|
484
|
+
raise DrowseArchiveError(f"fitted tensor filename {path.name!r} is invalid")
|
|
485
|
+
sidecar_path = path.with_suffix(".json")
|
|
486
|
+
_read_limited(
|
|
487
|
+
sidecar_path,
|
|
488
|
+
maximum=_METADATA_JSON_MAX_BYTES,
|
|
489
|
+
label=f"fitted sidecar {sidecar_path.name}",
|
|
490
|
+
)
|
|
491
|
+
sidecar = load_manifold_sidecar_data(sidecar_path)
|
|
492
|
+
variant = parsed_filename[1]
|
|
493
|
+
if variant is None:
|
|
494
|
+
if (
|
|
495
|
+
sidecar["feature_space"] != "raw"
|
|
496
|
+
or sidecar["method"] == "manifold_procrustes_transfer"
|
|
497
|
+
):
|
|
498
|
+
raise DrowseArchiveError(
|
|
499
|
+
f"fitted tensor {path.name} filename variant does not match "
|
|
500
|
+
"its feature-space/source provenance"
|
|
501
|
+
)
|
|
502
|
+
else:
|
|
503
|
+
variant_kind, encoded_identity = variant.split("-", 1)
|
|
504
|
+
decoded_identity = decode_release_id(encoded_identity)
|
|
505
|
+
if variant_kind == "sae":
|
|
506
|
+
matches_variant = (
|
|
507
|
+
sidecar["feature_space"] == f"sae-{decoded_identity}"
|
|
508
|
+
and sidecar["sae_release"] == decoded_identity
|
|
509
|
+
and sidecar["method"] != "manifold_procrustes_transfer"
|
|
510
|
+
)
|
|
511
|
+
else:
|
|
512
|
+
matches_variant = (
|
|
513
|
+
variant_kind == "from"
|
|
514
|
+
and sidecar["feature_space"] == "raw"
|
|
515
|
+
and sidecar["method"] == "manifold_procrustes_transfer"
|
|
516
|
+
and sidecar["source_model_id"] == decoded_identity
|
|
517
|
+
)
|
|
518
|
+
if not matches_variant:
|
|
519
|
+
raise DrowseArchiveError(
|
|
520
|
+
f"fitted tensor {path.name} filename variant does not match "
|
|
521
|
+
"its feature-space/source provenance"
|
|
522
|
+
)
|
|
523
|
+
if (
|
|
524
|
+
sidecar["name"] != folder.name
|
|
525
|
+
or sidecar["node_labels"] != folder.node_labels
|
|
526
|
+
or sidecar["fit_mode"] != folder.fit_mode
|
|
527
|
+
or sidecar["node_roles"] != folder.node_roles
|
|
528
|
+
or sidecar["node_kinds"] != folder.node_kinds
|
|
529
|
+
):
|
|
530
|
+
raise DrowseArchiveError(
|
|
531
|
+
f"fitted tensor {path.name} identity does not match manifold.json"
|
|
532
|
+
)
|
|
533
|
+
if folder.fit_mode in {"authored", "baked"} and sidecar["domain"] != folder.domain:
|
|
534
|
+
raise DrowseArchiveError(
|
|
535
|
+
f"fitted tensor {path.name} domain does not match manifold.json"
|
|
536
|
+
)
|
|
537
|
+
if folder.template_ref is not None and resolved_template_sha256 is None:
|
|
538
|
+
raise DrowseArchiveError(
|
|
539
|
+
f"fitted tensor {path.name} needs its template closure to be validated"
|
|
540
|
+
)
|
|
541
|
+
expected_nodes_sha256 = folder.nodes_sha256(
|
|
542
|
+
resolved_template_sha256=resolved_template_sha256,
|
|
543
|
+
)
|
|
544
|
+
if sidecar["nodes_sha256"] != expected_nodes_sha256:
|
|
545
|
+
raise DrowseArchiveError(
|
|
546
|
+
f"fitted tensor {path.name} node hash does not match its closure"
|
|
547
|
+
)
|
|
548
|
+
shapes = _tensor_shapes_and_finiteness(path)
|
|
549
|
+
domain = domain_from_spec(sidecar["domain"])
|
|
550
|
+
node_count = len(sidecar["node_labels"])
|
|
551
|
+
if shapes.pop("node_coords", None) != (node_count, domain.intrinsic_dim):
|
|
552
|
+
raise DrowseArchiveError(
|
|
553
|
+
f"fitted tensor {path.name} has invalid node_coords shape"
|
|
554
|
+
)
|
|
555
|
+
fields = {
|
|
556
|
+
"mean", "basis", "node_coords", "affine_map", "node_params",
|
|
557
|
+
"rbf_weights", "poly_coeffs", "coord_offset", "coord_scale",
|
|
558
|
+
"sigma_rbf_weights", "sigma_poly_coeffs",
|
|
559
|
+
}
|
|
560
|
+
by_layer: dict[int, dict[str, tuple[int, ...]]] = {}
|
|
561
|
+
for key, shape in shapes.items():
|
|
562
|
+
if key.count(".") != 1:
|
|
563
|
+
raise DrowseArchiveError(f"fitted tensor {path.name} has invalid key {key!r}")
|
|
564
|
+
head, field = key.split(".", 1)
|
|
565
|
+
raw_layer = head.removeprefix("layer_")
|
|
566
|
+
if (
|
|
567
|
+
not head.startswith("layer_") or not raw_layer.isascii()
|
|
568
|
+
or not raw_layer.isdecimal() or len(raw_layer) > 10
|
|
569
|
+
or str(int(raw_layer)) != raw_layer or field not in fields
|
|
570
|
+
):
|
|
571
|
+
raise DrowseArchiveError(f"fitted tensor {path.name} has invalid key {key!r}")
|
|
572
|
+
by_layer.setdefault(int(raw_layer), {})[field] = shape
|
|
573
|
+
if set(by_layer) != set(sidecar["fitted_layers"]) or not by_layer:
|
|
574
|
+
raise DrowseArchiveError(
|
|
575
|
+
f"fitted tensor {path.name} layers do not match its sidecar"
|
|
576
|
+
)
|
|
577
|
+
shares = sidecar["mahalanobis_share_per_layer"]
|
|
578
|
+
if set(shares) != {str(layer) for layer in by_layer} or any(
|
|
579
|
+
float(value) <= 0 for value in shares.values()
|
|
580
|
+
):
|
|
581
|
+
raise DrowseArchiveError(
|
|
582
|
+
f"fitted tensor {path.name} has invalid Mahalanobis shares"
|
|
583
|
+
)
|
|
584
|
+
hidden_dim: int | None = None
|
|
585
|
+
curved_layers: set[int] = set()
|
|
586
|
+
for layer, parts in by_layer.items():
|
|
587
|
+
mean = parts.get("mean")
|
|
588
|
+
basis = parts.get("basis")
|
|
589
|
+
if (
|
|
590
|
+
mean is None or len(mean) != 1 or basis is None or len(basis) != 2
|
|
591
|
+
or basis[0] < 1 or mean[0] != basis[1] or basis[0] > basis[1]
|
|
592
|
+
):
|
|
593
|
+
raise DrowseArchiveError(
|
|
594
|
+
f"fitted tensor {path.name} layer {layer} has invalid mean/basis"
|
|
595
|
+
)
|
|
596
|
+
rank, dim = basis
|
|
597
|
+
if hidden_dim is None:
|
|
598
|
+
hidden_dim = dim
|
|
599
|
+
elif hidden_dim != dim:
|
|
600
|
+
raise DrowseArchiveError(
|
|
601
|
+
f"fitted tensor {path.name} has inconsistent hidden dimensions"
|
|
602
|
+
)
|
|
603
|
+
curved = "node_params" in parts
|
|
604
|
+
if curved:
|
|
605
|
+
curved_layers.add(layer)
|
|
606
|
+
required = {
|
|
607
|
+
"mean", "basis", "node_params", "rbf_weights", "poly_coeffs",
|
|
608
|
+
"coord_offset", "coord_scale",
|
|
609
|
+
}
|
|
610
|
+
sigma = {"sigma_rbf_weights", "sigma_poly_coeffs"}
|
|
611
|
+
if not required.issubset(parts) or set(parts) - required - sigma:
|
|
612
|
+
raise DrowseArchiveError(
|
|
613
|
+
f"fitted tensor {path.name} layer {layer} has invalid curved fields"
|
|
614
|
+
)
|
|
615
|
+
if bool(set(parts) & sigma) != sigma.issubset(parts):
|
|
616
|
+
raise DrowseArchiveError(
|
|
617
|
+
f"fitted tensor {path.name} layer {layer} has incomplete sigma fields"
|
|
618
|
+
)
|
|
619
|
+
m = domain.embed_dim
|
|
620
|
+
if (
|
|
621
|
+
parts["node_params"] != (node_count, m)
|
|
622
|
+
or parts["rbf_weights"] != (node_count, rank)
|
|
623
|
+
or parts["poly_coeffs"] != (m + 1, rank)
|
|
624
|
+
or parts["coord_offset"] != (m,)
|
|
625
|
+
or parts["coord_scale"] != (m,)
|
|
626
|
+
):
|
|
627
|
+
raise DrowseArchiveError(
|
|
628
|
+
f"fitted tensor {path.name} layer {layer} has invalid curved shapes"
|
|
629
|
+
)
|
|
630
|
+
if sidecar["feature_space"] == "raw" and not sigma.issubset(parts):
|
|
631
|
+
raise DrowseArchiveError(
|
|
632
|
+
f"fitted tensor {path.name} raw curved layer {layer} lacks sigma fields"
|
|
633
|
+
)
|
|
634
|
+
if sigma.issubset(parts) and (
|
|
635
|
+
parts["sigma_rbf_weights"] != (node_count, 1)
|
|
636
|
+
or parts["sigma_poly_coeffs"] != (m + 1, 1)
|
|
637
|
+
):
|
|
638
|
+
raise DrowseArchiveError(
|
|
639
|
+
f"fitted tensor {path.name} layer {layer} has invalid sigma shapes"
|
|
640
|
+
)
|
|
641
|
+
else:
|
|
642
|
+
allowed = {"mean", "basis", "node_coords", "affine_map"}
|
|
643
|
+
if set(parts) - allowed or parts.get("node_coords") != (node_count, rank):
|
|
644
|
+
raise DrowseArchiveError(
|
|
645
|
+
f"fitted tensor {path.name} layer {layer} has invalid affine fields"
|
|
646
|
+
)
|
|
647
|
+
affine_map = parts.get("affine_map")
|
|
648
|
+
if affine_map is None and domain.embed_dim != rank:
|
|
649
|
+
raise DrowseArchiveError(
|
|
650
|
+
f"fitted tensor {path.name} layer {layer} needs affine_map"
|
|
651
|
+
)
|
|
652
|
+
if affine_map is not None and affine_map != (domain.embed_dim, rank):
|
|
653
|
+
raise DrowseArchiveError(
|
|
654
|
+
f"fitted tensor {path.name} layer {layer} has invalid affine_map"
|
|
655
|
+
)
|
|
656
|
+
if curved_layers and curved_layers != set(by_layer):
|
|
657
|
+
raise DrowseArchiveError(
|
|
658
|
+
f"fitted tensor {path.name} mixes affine and curved layers"
|
|
659
|
+
)
|
|
660
|
+
origins = sidecar["origin_per_layer"]
|
|
661
|
+
expected_origins = {str(layer) for layer in curved_layers}
|
|
662
|
+
if set(origins) != expected_origins or any(
|
|
663
|
+
len(value) != domain.intrinsic_dim for value in origins.values()
|
|
664
|
+
):
|
|
665
|
+
raise DrowseArchiveError(f"fitted tensor {path.name} has invalid origins")
|
|
666
|
+
|
|
667
|
+
|
|
668
|
+
def _preflight_manifold_codec_sizes(folder: Path) -> None:
|
|
669
|
+
if folder.is_symlink() or not folder.is_dir():
|
|
670
|
+
raise DrowseArchiveError(f"manifold path {folder} is not a regular directory")
|
|
671
|
+
manifest = folder / "manifold.json"
|
|
672
|
+
if manifest.is_symlink() or not manifest.is_file():
|
|
673
|
+
raise DrowseArchiveError(f"manifold metadata {manifest} is not a regular file")
|
|
674
|
+
raw_manifest = _read_limited(
|
|
675
|
+
manifest,
|
|
676
|
+
maximum=_METADATA_JSON_MAX_BYTES,
|
|
677
|
+
label=f"manifold metadata {manifest}",
|
|
678
|
+
)
|
|
679
|
+
_load_exact_json(raw_manifest, label=f"manifold metadata {manifest}")
|
|
680
|
+
for path in folder.rglob("*.json"):
|
|
681
|
+
if path.is_symlink() or not path.is_file():
|
|
682
|
+
raise DrowseArchiveError(f"manifold JSON path {path} is not a regular file")
|
|
683
|
+
if path == manifest:
|
|
684
|
+
continue
|
|
685
|
+
try:
|
|
686
|
+
relative = path.relative_to(folder)
|
|
687
|
+
except ValueError as exc:
|
|
688
|
+
raise DrowseArchiveError(f"manifold JSON path {path} escapes {folder}") from exc
|
|
689
|
+
maximum = (
|
|
690
|
+
_NODE_JSON_MAX_BYTES
|
|
691
|
+
if relative.parts and relative.parts[0] == "nodes"
|
|
692
|
+
else _METADATA_JSON_MAX_BYTES
|
|
693
|
+
)
|
|
694
|
+
raw = _read_limited(
|
|
695
|
+
path,
|
|
696
|
+
maximum=maximum,
|
|
697
|
+
label=f"manifold JSON {relative}",
|
|
698
|
+
)
|
|
699
|
+
_load_exact_json(raw, label=f"manifold JSON {relative}")
|
|
700
|
+
|
|
701
|
+
|
|
702
|
+
def _validate_extracted_closure(
|
|
703
|
+
root: Path,
|
|
704
|
+
primary: str,
|
|
705
|
+
source_identity: tuple[str, str],
|
|
706
|
+
template: str | None,
|
|
707
|
+
template_identity: tuple[str, str] | None,
|
|
708
|
+
source_provenance: dict[str, Any],
|
|
709
|
+
) -> tuple[ManifoldFolder, TemplateFolder | None]:
|
|
710
|
+
manifold_path = root.joinpath(*PurePosixPath(primary).parts)
|
|
711
|
+
_preflight_manifold_codec_sizes(manifold_path)
|
|
712
|
+
try:
|
|
713
|
+
folder = ManifoldFolder.load(manifold_path)
|
|
714
|
+
except (ManifoldFormatError, OSError, ValueError) as exc:
|
|
715
|
+
raise DrowseArchiveError(f"archive manifold failed validation ({exc})") from exc
|
|
716
|
+
if folder.name != source_identity[1]:
|
|
717
|
+
raise DrowseArchiveError(
|
|
718
|
+
f"archive primary {primary!r} contains manifold identity "
|
|
719
|
+
f"{folder.name!r}"
|
|
720
|
+
)
|
|
721
|
+
expected_source = _source_provenance(folder.source or "local")
|
|
722
|
+
if source_provenance != expected_source:
|
|
723
|
+
raise DrowseArchiveError(
|
|
724
|
+
"pack.json source provenance does not match manifold.json"
|
|
725
|
+
)
|
|
726
|
+
loaded_template: TemplateFolder | None = None
|
|
727
|
+
if folder.template_ref is None:
|
|
728
|
+
if template is not None:
|
|
729
|
+
raise DrowseArchiveError(
|
|
730
|
+
"archive declares a template for a manifold without template_ref"
|
|
731
|
+
)
|
|
732
|
+
else:
|
|
733
|
+
if template is None or template_identity is None:
|
|
734
|
+
raise DrowseArchiveError(
|
|
735
|
+
"templated manifold is missing its template closure"
|
|
736
|
+
)
|
|
737
|
+
expected_ref = "/".join(template_identity)
|
|
738
|
+
if folder.template_ref != expected_ref:
|
|
739
|
+
raise DrowseArchiveError(
|
|
740
|
+
f"manifold template_ref {folder.template_ref!r} does not match "
|
|
741
|
+
f"closure {expected_ref!r}"
|
|
742
|
+
)
|
|
743
|
+
template_path = root.joinpath(*PurePosixPath(template).parts)
|
|
744
|
+
raw_template = _read_limited(
|
|
745
|
+
template_path / "template.json",
|
|
746
|
+
maximum=_METADATA_JSON_MAX_BYTES,
|
|
747
|
+
label="archive template.json",
|
|
748
|
+
)
|
|
749
|
+
_load_exact_json(raw_template, label="archive template.json")
|
|
750
|
+
try:
|
|
751
|
+
loaded_template = TemplateFolder.load(template_path)
|
|
752
|
+
except (OSError, ValueError) as exc:
|
|
753
|
+
raise DrowseArchiveError(
|
|
754
|
+
f"archive template failed validation ({exc})"
|
|
755
|
+
) from exc
|
|
756
|
+
if loaded_template.name != template_identity[1]:
|
|
757
|
+
raise DrowseArchiveError(
|
|
758
|
+
f"archive template path {template!r} contains identity "
|
|
759
|
+
f"{loaded_template.name!r}"
|
|
760
|
+
)
|
|
761
|
+
try:
|
|
762
|
+
node_groups = dict(folder.node_groups())
|
|
763
|
+
except (OSError, ValueError) as exc:
|
|
764
|
+
raise DrowseArchiveError(
|
|
765
|
+
f"archive node corpus failed validation ({exc})"
|
|
766
|
+
) from exc
|
|
767
|
+
if (
|
|
768
|
+
folder.node_labels != loaded_template.node_labels()
|
|
769
|
+
or node_groups != loaded_template.node_corpora()
|
|
770
|
+
):
|
|
771
|
+
raise DrowseArchiveError(
|
|
772
|
+
"templated manifold corpus does not match its template closure"
|
|
773
|
+
)
|
|
774
|
+
expected_files = {
|
|
775
|
+
path.relative_to(manifold_path).as_posix()
|
|
776
|
+
for path in _payload_paths(folder)
|
|
777
|
+
}
|
|
778
|
+
actual_files: set[str] = set()
|
|
779
|
+
for path in manifold_path.rglob("*"):
|
|
780
|
+
if path.is_symlink() or not (path.is_dir() or path.is_file()):
|
|
781
|
+
raise DrowseArchiveError(
|
|
782
|
+
f"archive manifold path {path} is not a regular file or directory"
|
|
783
|
+
)
|
|
784
|
+
if path.is_file():
|
|
785
|
+
actual_files.add(path.relative_to(manifold_path).as_posix())
|
|
786
|
+
if actual_files != expected_files:
|
|
787
|
+
extras = sorted(actual_files - expected_files)
|
|
788
|
+
missing = sorted(expected_files - actual_files)
|
|
789
|
+
raise DrowseArchiveError(
|
|
790
|
+
"archive manifold closure is not exact "
|
|
791
|
+
f"(extra={extras}, missing={missing})"
|
|
792
|
+
)
|
|
793
|
+
template_sha256 = (
|
|
794
|
+
loaded_template.sha256() if loaded_template is not None else None
|
|
795
|
+
)
|
|
796
|
+
for tensor in _fitted_tensor_paths(folder):
|
|
797
|
+
_validate_fitted_tensor(
|
|
798
|
+
tensor,
|
|
799
|
+
folder,
|
|
800
|
+
resolved_template_sha256=template_sha256,
|
|
801
|
+
)
|
|
802
|
+
return folder, loaded_template
|
|
803
|
+
|
|
804
|
+
|
|
805
|
+
def _source_provenance(source: str) -> dict[str, str | None]:
|
|
806
|
+
repository = None
|
|
807
|
+
revision = None
|
|
808
|
+
if source.startswith("hf://"):
|
|
809
|
+
from drowse.io.hf import split_revision
|
|
810
|
+
|
|
811
|
+
repository, revision = split_revision(source[len("hf://"):])
|
|
812
|
+
if revision is None:
|
|
813
|
+
raise DrowseArchiveError(
|
|
814
|
+
"Hugging Face manifold source must be pinned to a revision"
|
|
815
|
+
)
|
|
816
|
+
return _validate_source_provenance({
|
|
817
|
+
"uri": source,
|
|
818
|
+
"repository": repository,
|
|
819
|
+
"revision": revision,
|
|
820
|
+
})
|
|
821
|
+
|
|
822
|
+
|
|
823
|
+
def _fitted_tensor_paths(folder: ManifoldFolder) -> list[Path]:
|
|
824
|
+
from drowse.io.paths import parse_tensor_filename
|
|
825
|
+
|
|
826
|
+
declared = set(folder.files)
|
|
827
|
+
tensors: set[str] = set()
|
|
828
|
+
for relative in declared:
|
|
829
|
+
_validate_member_path(relative)
|
|
830
|
+
if len(PurePosixPath(relative).parts) != 1:
|
|
831
|
+
raise DrowseArchiveError(
|
|
832
|
+
f"manifold files entry {relative!r} is not a top-level fitted file"
|
|
833
|
+
)
|
|
834
|
+
if relative.endswith(".safetensors"):
|
|
835
|
+
if parse_tensor_filename(relative) is None:
|
|
836
|
+
raise DrowseArchiveError(
|
|
837
|
+
f"manifold files entry {relative!r} is not a fitted tensor"
|
|
838
|
+
)
|
|
839
|
+
tensors.add(relative)
|
|
840
|
+
elif relative.endswith(".json"):
|
|
841
|
+
tensor_name = str(Path(relative).with_suffix(".safetensors"))
|
|
842
|
+
if parse_tensor_filename(tensor_name) is None:
|
|
843
|
+
raise DrowseArchiveError(
|
|
844
|
+
f"manifold files entry {relative!r} is not a fitted sidecar"
|
|
845
|
+
)
|
|
846
|
+
else:
|
|
847
|
+
raise DrowseArchiveError(
|
|
848
|
+
f"manifold files entry {relative!r} is not part of manifold v10"
|
|
849
|
+
)
|
|
850
|
+
expected = {
|
|
851
|
+
name
|
|
852
|
+
for tensor in tensors
|
|
853
|
+
for name in (tensor, str(Path(tensor).with_suffix(".json")))
|
|
854
|
+
}
|
|
855
|
+
if declared != expected:
|
|
856
|
+
raise DrowseArchiveError(
|
|
857
|
+
"manifold files must contain complete canonical tensor/sidecar pairs"
|
|
858
|
+
)
|
|
859
|
+
if folder.fit_mode == "baked" and not tensors:
|
|
860
|
+
raise DrowseArchiveError("baked manifold closure has no fitted tensor")
|
|
861
|
+
return [folder.folder / name for name in sorted(tensors)]
|
|
862
|
+
|
|
863
|
+
|
|
864
|
+
def _payload_paths(folder: ManifoldFolder) -> list[Path]:
|
|
865
|
+
_read_limited(
|
|
866
|
+
folder.folder / "manifold.json",
|
|
867
|
+
maximum=_METADATA_JSON_MAX_BYTES,
|
|
868
|
+
label="manifold.json",
|
|
869
|
+
)
|
|
870
|
+
paths = [folder.folder / "manifold.json"]
|
|
871
|
+
if folder.fit_mode != "baked":
|
|
872
|
+
nodes_dir = folder.folder / "nodes"
|
|
873
|
+
if nodes_dir.is_symlink() or not nodes_dir.is_dir():
|
|
874
|
+
raise DrowseArchiveError("manifold nodes path is not a regular directory")
|
|
875
|
+
node_paths = [
|
|
876
|
+
folder.node_path(i) for i in range(len(folder.node_labels))
|
|
877
|
+
]
|
|
878
|
+
for path in node_paths:
|
|
879
|
+
_read_limited(
|
|
880
|
+
path,
|
|
881
|
+
maximum=_NODE_JSON_MAX_BYTES,
|
|
882
|
+
label=f"manifold node {path.name}",
|
|
883
|
+
)
|
|
884
|
+
try:
|
|
885
|
+
folder.node_groups()
|
|
886
|
+
except (OSError, ValueError) as exc:
|
|
887
|
+
raise DrowseArchiveError(
|
|
888
|
+
f"manifold node corpus failed validation ({exc})"
|
|
889
|
+
) from exc
|
|
890
|
+
paths.extend(node_paths)
|
|
891
|
+
for tensor in _fitted_tensor_paths(folder):
|
|
892
|
+
paths.extend((tensor, tensor.with_suffix(".json")))
|
|
893
|
+
unique: dict[Path, None] = {}
|
|
894
|
+
for path in paths:
|
|
895
|
+
if path.is_symlink() or not path.is_file():
|
|
896
|
+
raise DrowseArchiveError(f"manifold closure file {path} is not regular")
|
|
897
|
+
unique[path] = None
|
|
898
|
+
discovered_tensors = set(folder.folder.glob("*.safetensors"))
|
|
899
|
+
expected_tensors = set(_fitted_tensor_paths(folder))
|
|
900
|
+
if discovered_tensors != expected_tensors:
|
|
901
|
+
raise DrowseArchiveError(
|
|
902
|
+
"manifold folder has an unproved or noncanonical fitted tensor"
|
|
903
|
+
)
|
|
904
|
+
paths = sorted(unique)
|
|
905
|
+
if len(paths) + 1 > DROWSE_ARCHIVE_MAX_ENTRIES:
|
|
906
|
+
raise DrowseArchiveError(
|
|
907
|
+
f"manifold closure has more than {DROWSE_ARCHIVE_MAX_ENTRIES - 1} files"
|
|
908
|
+
)
|
|
909
|
+
total = 0
|
|
910
|
+
for path in paths:
|
|
911
|
+
size = path.stat().st_size
|
|
912
|
+
if size > DROWSE_ARCHIVE_MAX_FILE_BYTES:
|
|
913
|
+
raise DrowseArchiveError(f"manifold closure file {path} is larger than 512 MiB")
|
|
914
|
+
total += size
|
|
915
|
+
if total > DROWSE_ARCHIVE_MAX_TOTAL_BYTES:
|
|
916
|
+
raise DrowseArchiveError("manifold closure is larger than 2 GiB")
|
|
917
|
+
return paths
|
|
918
|
+
|
|
919
|
+
|
|
920
|
+
@contextmanager
|
|
921
|
+
def _closure_locks(
|
|
922
|
+
manifold_path: Path, template_path: Path | None,
|
|
923
|
+
) -> Iterator[None]:
|
|
924
|
+
lock_paths = [
|
|
925
|
+
manifold_path.parent / f"{manifold_path.name}.manifest",
|
|
926
|
+
]
|
|
927
|
+
if template_path is not None:
|
|
928
|
+
lock_paths.append(template_path.parent / f"{template_path.name}.template")
|
|
929
|
+
with ExitStack() as stack:
|
|
930
|
+
for lock_path in sorted(lock_paths, key=lambda path: str(path.resolve(strict=False))):
|
|
931
|
+
stack.enter_context(artifact_lock(lock_path))
|
|
932
|
+
for tensor in manifold_folder_tensor_paths(manifold_path):
|
|
933
|
+
stack.enter_context(manifold_pair_lock(tensor))
|
|
934
|
+
yield
|
|
935
|
+
|
|
936
|
+
|
|
937
|
+
def _zip_info(name: str) -> zipfile.ZipInfo:
|
|
938
|
+
info = zipfile.ZipInfo(name, date_time=(1980, 1, 1, 0, 0, 0))
|
|
939
|
+
info.compress_type = zipfile.ZIP_STORED
|
|
940
|
+
info.create_system = 3
|
|
941
|
+
info.external_attr = (stat.S_IFREG | 0o644) << 16
|
|
942
|
+
return info
|
|
943
|
+
|
|
944
|
+
|
|
945
|
+
def _write_zip_path(archive: zipfile.ZipFile, archive_path: str, path: Path) -> None:
|
|
946
|
+
with archive.open(_zip_info(archive_path), "w") as target, open(path, "rb") as source:
|
|
947
|
+
shutil.copyfileobj(source, target, length=1024 * 1024)
|
|
948
|
+
|
|
949
|
+
|
|
950
|
+
def _resolve_transport_template(folder: ManifoldFolder) -> TemplateFolder | None:
|
|
951
|
+
from drowse.io.templates import resolve_template
|
|
952
|
+
|
|
953
|
+
if folder.template_ref is None:
|
|
954
|
+
return None
|
|
955
|
+
parts = folder.template_ref.split("/")
|
|
956
|
+
if len(parts) != 2 or any(
|
|
957
|
+
not NAME_REGEX.fullmatch(component) for component in parts
|
|
958
|
+
):
|
|
959
|
+
raise DrowseArchiveError(
|
|
960
|
+
"Drowse archive requires a namespace-qualified template_ref"
|
|
961
|
+
)
|
|
962
|
+
expected_path = template_dir(parts[0], parts[1])
|
|
963
|
+
template_file = expected_path / "template.json"
|
|
964
|
+
if (
|
|
965
|
+
expected_path.is_symlink()
|
|
966
|
+
or not expected_path.is_dir()
|
|
967
|
+
or template_file.is_symlink()
|
|
968
|
+
or not template_file.is_file()
|
|
969
|
+
):
|
|
970
|
+
raise DrowseArchiveError("referenced template path is not a regular directory")
|
|
971
|
+
raw_template = _read_limited(
|
|
972
|
+
template_file,
|
|
973
|
+
maximum=_METADATA_JSON_MAX_BYTES,
|
|
974
|
+
label="referenced template.json",
|
|
975
|
+
)
|
|
976
|
+
_load_exact_json(raw_template, label="referenced template.json")
|
|
977
|
+
loaded = resolve_template(folder.template_ref)
|
|
978
|
+
if loaded.path is None:
|
|
979
|
+
raise DrowseArchiveError("referenced template has no on-disk path")
|
|
980
|
+
if (
|
|
981
|
+
loaded.name != parts[1]
|
|
982
|
+
or loaded.path.resolve(strict=False) != expected_path.resolve(strict=False)
|
|
983
|
+
or loaded.path.is_symlink()
|
|
984
|
+
):
|
|
985
|
+
raise DrowseArchiveError(
|
|
986
|
+
"referenced template path and embedded identity do not match template_ref"
|
|
987
|
+
)
|
|
988
|
+
return loaded
|
|
989
|
+
|
|
990
|
+
|
|
991
|
+
def export_drowse_archive(
|
|
992
|
+
namespace: str,
|
|
993
|
+
name: str,
|
|
994
|
+
*,
|
|
995
|
+
output: str | Path | None = None,
|
|
996
|
+
) -> Path:
|
|
997
|
+
"""Export one manifold and its exact referenced-template closure."""
|
|
998
|
+
from drowse import __version__
|
|
999
|
+
from drowse.io.bootstrap import materialize_bundled_artifacts
|
|
1000
|
+
_validate_manifold_identity(namespace, name)
|
|
1001
|
+
materialize_bundled_artifacts()
|
|
1002
|
+
folder_path = manifold_dir(namespace, name)
|
|
1003
|
+
if not (folder_path / "manifold.json").is_file():
|
|
1004
|
+
raise FileNotFoundError(f"manifold {namespace}/{name} not found at {folder_path}")
|
|
1005
|
+
destination = (
|
|
1006
|
+
Path(output).expanduser()
|
|
1007
|
+
if output is not None else Path.cwd() / f"{name}.drowse"
|
|
1008
|
+
)
|
|
1009
|
+
if destination.exists() and destination.is_dir():
|
|
1010
|
+
destination = destination / f"{name}.drowse"
|
|
1011
|
+
if destination.suffix.lower() != ".drowse":
|
|
1012
|
+
raise DrowseArchiveError("export path must end in .drowse")
|
|
1013
|
+
if destination.resolve(strict=False).is_relative_to(
|
|
1014
|
+
folder_path.resolve(strict=False)
|
|
1015
|
+
):
|
|
1016
|
+
raise DrowseArchiveError(
|
|
1017
|
+
"Drowse archive export path must be outside its manifold closure"
|
|
1018
|
+
)
|
|
1019
|
+
|
|
1020
|
+
for _attempt in range(8):
|
|
1021
|
+
_preflight_manifold_codec_sizes(folder_path)
|
|
1022
|
+
initial = ManifoldFolder.load(folder_path, verify_manifest=False)
|
|
1023
|
+
initial_template = _resolve_transport_template(initial)
|
|
1024
|
+
initial_template_path = (
|
|
1025
|
+
initial_template.path if initial_template is not None else None
|
|
1026
|
+
)
|
|
1027
|
+
with _closure_locks(folder_path, initial_template_path):
|
|
1028
|
+
_preflight_manifold_codec_sizes(folder_path)
|
|
1029
|
+
folder = ManifoldFolder.load(folder_path)
|
|
1030
|
+
if folder.name != name:
|
|
1031
|
+
raise DrowseArchiveError(
|
|
1032
|
+
f"manifold path {namespace}/{name} contains identity "
|
|
1033
|
+
f"{folder.name!r}"
|
|
1034
|
+
)
|
|
1035
|
+
template_folder = _resolve_transport_template(folder)
|
|
1036
|
+
template_path = (
|
|
1037
|
+
template_folder.path if template_folder is not None else None
|
|
1038
|
+
)
|
|
1039
|
+
if template_path != initial_template_path:
|
|
1040
|
+
continue
|
|
1041
|
+
if template_path is not None and destination.resolve(
|
|
1042
|
+
strict=False,
|
|
1043
|
+
).is_relative_to(template_path.resolve(strict=False)):
|
|
1044
|
+
raise DrowseArchiveError(
|
|
1045
|
+
"Drowse archive export path must be outside its template closure"
|
|
1046
|
+
)
|
|
1047
|
+
destination.parent.mkdir(parents=True, exist_ok=True)
|
|
1048
|
+
if template_folder is not None and (
|
|
1049
|
+
folder.node_labels != template_folder.node_labels()
|
|
1050
|
+
or dict(folder.node_groups()) != template_folder.node_corpora()
|
|
1051
|
+
):
|
|
1052
|
+
raise DrowseArchiveError(
|
|
1053
|
+
"templated manifold corpus does not match its template"
|
|
1054
|
+
)
|
|
1055
|
+
template_sha256 = (
|
|
1056
|
+
template_folder.sha256() if template_folder is not None else None
|
|
1057
|
+
)
|
|
1058
|
+
closure_paths = _payload_paths(folder)
|
|
1059
|
+
for tensor in _fitted_tensor_paths(folder):
|
|
1060
|
+
_validate_fitted_tensor(
|
|
1061
|
+
tensor,
|
|
1062
|
+
folder,
|
|
1063
|
+
resolved_template_sha256=template_sha256,
|
|
1064
|
+
)
|
|
1065
|
+
primary = f"manifolds/{namespace}/{name}"
|
|
1066
|
+
payloads: list[tuple[str, Path]] = [
|
|
1067
|
+
(
|
|
1068
|
+
f"{primary}/{path.relative_to(folder.folder).as_posix()}",
|
|
1069
|
+
path,
|
|
1070
|
+
)
|
|
1071
|
+
for path in closure_paths
|
|
1072
|
+
]
|
|
1073
|
+
template_key = None
|
|
1074
|
+
if template_folder is not None and template_path is not None:
|
|
1075
|
+
template_ns = template_path.parent.name
|
|
1076
|
+
template_key = f"templates/{template_ns}/{template_folder.name}"
|
|
1077
|
+
template_file = template_path / "template.json"
|
|
1078
|
+
if template_file.is_symlink() or not template_file.is_file():
|
|
1079
|
+
raise DrowseArchiveError(
|
|
1080
|
+
"referenced template.json is not a regular file"
|
|
1081
|
+
)
|
|
1082
|
+
_read_limited(
|
|
1083
|
+
template_file,
|
|
1084
|
+
maximum=_METADATA_JSON_MAX_BYTES,
|
|
1085
|
+
label="referenced template.json",
|
|
1086
|
+
)
|
|
1087
|
+
payloads.append((f"{template_key}/template.json", template_file))
|
|
1088
|
+
if len(payloads) + 1 > DROWSE_ARCHIVE_MAX_ENTRIES:
|
|
1089
|
+
raise DrowseArchiveError(
|
|
1090
|
+
f"Drowse archive would exceed {DROWSE_ARCHIVE_MAX_ENTRIES} entries"
|
|
1091
|
+
)
|
|
1092
|
+
payload_bytes = 0
|
|
1093
|
+
for archive_path, path in payloads:
|
|
1094
|
+
_validate_member_path(archive_path)
|
|
1095
|
+
size = path.stat().st_size
|
|
1096
|
+
if size > DROWSE_ARCHIVE_MAX_FILE_BYTES:
|
|
1097
|
+
raise DrowseArchiveError(
|
|
1098
|
+
f"archive payload {archive_path!r} is larger than 512 MiB"
|
|
1099
|
+
)
|
|
1100
|
+
payload_bytes += size
|
|
1101
|
+
files = {
|
|
1102
|
+
archive_path: {
|
|
1103
|
+
"size": path.stat().st_size,
|
|
1104
|
+
"sha256": hash_file(path),
|
|
1105
|
+
}
|
|
1106
|
+
for archive_path, path in payloads
|
|
1107
|
+
}
|
|
1108
|
+
manifest = {
|
|
1109
|
+
"format_version": DROWSE_ARCHIVE_FORMAT_VERSION,
|
|
1110
|
+
"kind": "drowse-manifold",
|
|
1111
|
+
"producer": {"name": "drowse", "version": __version__},
|
|
1112
|
+
"primary": primary,
|
|
1113
|
+
"template": template_key,
|
|
1114
|
+
"source": _source_provenance(folder.source or "local"),
|
|
1115
|
+
"files": files,
|
|
1116
|
+
}
|
|
1117
|
+
raw_manifest = (
|
|
1118
|
+
json.dumps(manifest, sort_keys=True, indent=2) + "\n"
|
|
1119
|
+
).encode()
|
|
1120
|
+
if len(raw_manifest) > _PACK_MANIFEST_MAX_BYTES:
|
|
1121
|
+
raise DrowseArchiveError("pack.json would be larger than 1 MiB")
|
|
1122
|
+
if payload_bytes + len(raw_manifest) > DROWSE_ARCHIVE_MAX_TOTAL_BYTES:
|
|
1123
|
+
raise DrowseArchiveError("Drowse archive would expand beyond 2 GiB")
|
|
1124
|
+
fd, temp_name = tempfile.mkstemp(
|
|
1125
|
+
prefix=f".{destination.name}.",
|
|
1126
|
+
suffix=".tmp",
|
|
1127
|
+
dir=destination.parent,
|
|
1128
|
+
)
|
|
1129
|
+
os.close(fd)
|
|
1130
|
+
temp_path = Path(temp_name)
|
|
1131
|
+
try:
|
|
1132
|
+
with zipfile.ZipFile(temp_path, "w", allowZip64=True) as archive:
|
|
1133
|
+
archive.writestr(_zip_info("pack.json"), raw_manifest)
|
|
1134
|
+
for archive_path, path in sorted(payloads):
|
|
1135
|
+
_write_zip_path(archive, archive_path, path)
|
|
1136
|
+
with open(temp_path, "rb") as handle:
|
|
1137
|
+
os.fsync(handle.fileno())
|
|
1138
|
+
os.replace(temp_path, destination)
|
|
1139
|
+
fsync_directory(destination.parent)
|
|
1140
|
+
finally:
|
|
1141
|
+
temp_path.unlink(missing_ok=True)
|
|
1142
|
+
return destination
|
|
1143
|
+
raise DrowseArchiveError("referenced template changed repeatedly during export")
|
|
1144
|
+
|
|
1145
|
+
|
|
1146
|
+
def _copy_tree(source: Path, destination: Path) -> None:
|
|
1147
|
+
if destination.exists():
|
|
1148
|
+
shutil.rmtree(destination)
|
|
1149
|
+
shutil.copytree(source, destination)
|
|
1150
|
+
files = [path for path in destination.rglob("*") if path.is_file()]
|
|
1151
|
+
for path in files:
|
|
1152
|
+
with open(path, "rb") as handle:
|
|
1153
|
+
os.fsync(handle.fileno())
|
|
1154
|
+
directories = [
|
|
1155
|
+
path for path in destination.rglob("*") if path.is_dir()
|
|
1156
|
+
]
|
|
1157
|
+
for path in sorted(directories, key=lambda item: len(item.parts), reverse=True):
|
|
1158
|
+
fsync_directory(path)
|
|
1159
|
+
fsync_directory(destination)
|
|
1160
|
+
fsync_directory(destination.parent)
|
|
1161
|
+
|
|
1162
|
+
|
|
1163
|
+
def _same_template(source: Path, destination: Path) -> bool:
|
|
1164
|
+
try:
|
|
1165
|
+
entries = list(destination.iterdir())
|
|
1166
|
+
except OSError as exc:
|
|
1167
|
+
raise DrowseArchiveError(
|
|
1168
|
+
f"template target {destination} is unreadable ({exc})"
|
|
1169
|
+
) from exc
|
|
1170
|
+
if len(entries) != 1 or entries[0].name != "template.json":
|
|
1171
|
+
raise DrowseArchiveError(
|
|
1172
|
+
f"template target {destination} is not an exact template closure"
|
|
1173
|
+
)
|
|
1174
|
+
target = entries[0]
|
|
1175
|
+
if target.is_symlink() or not target.is_file():
|
|
1176
|
+
raise DrowseArchiveError(
|
|
1177
|
+
f"template target {target} is not a regular file"
|
|
1178
|
+
)
|
|
1179
|
+
return hash_file(source / "template.json") == hash_file(target)
|
|
1180
|
+
|
|
1181
|
+
|
|
1182
|
+
def _other_template_dependents(
|
|
1183
|
+
root: Path,
|
|
1184
|
+
template_ref: str,
|
|
1185
|
+
*,
|
|
1186
|
+
excluding: Path,
|
|
1187
|
+
) -> list[str]:
|
|
1188
|
+
manifold_root = root / "manifolds"
|
|
1189
|
+
if not manifold_root.exists():
|
|
1190
|
+
return []
|
|
1191
|
+
if manifold_root.is_symlink() or not manifold_root.is_dir():
|
|
1192
|
+
raise DrowseArchiveError(
|
|
1193
|
+
f"Drowse archive manifold root {manifold_root} is not a regular directory"
|
|
1194
|
+
)
|
|
1195
|
+
excluded = excluding.resolve(strict=False)
|
|
1196
|
+
dependents: list[str] = []
|
|
1197
|
+
for namespace in sorted(manifold_root.iterdir()):
|
|
1198
|
+
if not NAME_REGEX.fullmatch(namespace.name):
|
|
1199
|
+
continue
|
|
1200
|
+
if namespace.is_symlink() or not namespace.is_dir():
|
|
1201
|
+
raise DrowseArchiveError(
|
|
1202
|
+
f"Drowse archive manifold namespace {namespace} is not a regular directory"
|
|
1203
|
+
)
|
|
1204
|
+
for candidate in sorted(namespace.iterdir()):
|
|
1205
|
+
if not NAME_REGEX.fullmatch(candidate.name):
|
|
1206
|
+
continue
|
|
1207
|
+
if candidate.resolve(strict=False) == excluded:
|
|
1208
|
+
continue
|
|
1209
|
+
if candidate.is_symlink() or not candidate.is_dir():
|
|
1210
|
+
raise DrowseArchiveError(
|
|
1211
|
+
f"Drowse archive manifold path {candidate} is not a regular directory"
|
|
1212
|
+
)
|
|
1213
|
+
manifest = candidate / "manifold.json"
|
|
1214
|
+
if not manifest.exists():
|
|
1215
|
+
continue
|
|
1216
|
+
if manifest.is_symlink() or not manifest.is_file():
|
|
1217
|
+
raise DrowseArchiveError(
|
|
1218
|
+
f"Drowse archive manifold metadata {manifest} is not a regular file"
|
|
1219
|
+
)
|
|
1220
|
+
try:
|
|
1221
|
+
payload = json.loads(_read_limited(
|
|
1222
|
+
manifest,
|
|
1223
|
+
maximum=_METADATA_JSON_MAX_BYTES,
|
|
1224
|
+
label=f"manifold metadata {manifest}",
|
|
1225
|
+
))
|
|
1226
|
+
except (UnicodeDecodeError, json.JSONDecodeError) as exc:
|
|
1227
|
+
raise DrowseArchiveError(
|
|
1228
|
+
f"manifold metadata {manifest} is invalid ({exc})"
|
|
1229
|
+
) from exc
|
|
1230
|
+
if not isinstance(payload, dict):
|
|
1231
|
+
raise DrowseArchiveError(
|
|
1232
|
+
f"manifold metadata {manifest} must be an object"
|
|
1233
|
+
)
|
|
1234
|
+
if payload.get("template_ref") == template_ref:
|
|
1235
|
+
dependents.append(f"{namespace.name}/{candidate.name}")
|
|
1236
|
+
return dependents
|
|
1237
|
+
|
|
1238
|
+
|
|
1239
|
+
def _reset_installed_manifold_transaction_state(folder: Path) -> None:
|
|
1240
|
+
manifest_path = folder / "manifold.json"
|
|
1241
|
+
try:
|
|
1242
|
+
payload = json.loads(_read_limited(
|
|
1243
|
+
manifest_path,
|
|
1244
|
+
maximum=_METADATA_JSON_MAX_BYTES,
|
|
1245
|
+
label=f"staged manifold metadata {manifest_path}",
|
|
1246
|
+
))
|
|
1247
|
+
except (UnicodeDecodeError, json.JSONDecodeError) as exc:
|
|
1248
|
+
raise DrowseArchiveError(
|
|
1249
|
+
f"staged manifold metadata {manifest_path} is invalid ({exc})"
|
|
1250
|
+
) from exc
|
|
1251
|
+
if not isinstance(payload, dict):
|
|
1252
|
+
raise DrowseArchiveError(
|
|
1253
|
+
f"staged manifold metadata {manifest_path} must be an object"
|
|
1254
|
+
)
|
|
1255
|
+
payload.pop("artifact_id", None)
|
|
1256
|
+
payload.pop("fit_epochs", None)
|
|
1257
|
+
write_json_atomic(manifest_path, payload)
|
|
1258
|
+
|
|
1259
|
+
|
|
1260
|
+
def _transaction_dir(root: Path) -> Path:
|
|
1261
|
+
return root / ".drowse-transactions"
|
|
1262
|
+
|
|
1263
|
+
|
|
1264
|
+
def _validate_transaction_roots(root: Path) -> None:
|
|
1265
|
+
for path, label in (
|
|
1266
|
+
(_transaction_dir(root), "transaction directory"),
|
|
1267
|
+
(root / "manifolds", "manifold root"),
|
|
1268
|
+
(root / "templates", "template root"),
|
|
1269
|
+
):
|
|
1270
|
+
if path.is_symlink():
|
|
1271
|
+
raise DrowseArchiveError(f"Drowse archive {label} {path} is a symbolic link")
|
|
1272
|
+
if path.exists() and not path.is_dir():
|
|
1273
|
+
raise DrowseArchiveError(f"Drowse archive {label} {path} is not a directory")
|
|
1274
|
+
|
|
1275
|
+
|
|
1276
|
+
def _transaction_stage_path(root: Path, token: str, kind: str) -> Path:
|
|
1277
|
+
return _transaction_dir(root) / f"{token}.{kind}.stage"
|
|
1278
|
+
|
|
1279
|
+
|
|
1280
|
+
def _transaction_backup_path(root: Path, token: str, kind: str) -> Path:
|
|
1281
|
+
return _transaction_dir(root) / f"{token}.{kind}.backup"
|
|
1282
|
+
|
|
1283
|
+
|
|
1284
|
+
def _relative_transaction_path(root: Path, path: Path) -> str:
|
|
1285
|
+
root = root.resolve(strict=False)
|
|
1286
|
+
path = path.resolve(strict=False)
|
|
1287
|
+
try:
|
|
1288
|
+
relative = path.relative_to(root).as_posix()
|
|
1289
|
+
except ValueError as exc:
|
|
1290
|
+
raise DrowseArchiveError(f"transaction path {path} escapes {root}") from exc
|
|
1291
|
+
_validate_member_path(relative)
|
|
1292
|
+
return relative
|
|
1293
|
+
|
|
1294
|
+
|
|
1295
|
+
def _resolve_transaction_path(root: Path, value: Any) -> Path:
|
|
1296
|
+
if not isinstance(value, str):
|
|
1297
|
+
raise DrowseArchiveError("transaction journal path must be a string")
|
|
1298
|
+
_validate_member_path(value)
|
|
1299
|
+
path = root.joinpath(*PurePosixPath(value).parts).resolve(strict=False)
|
|
1300
|
+
try:
|
|
1301
|
+
path.relative_to(root.resolve(strict=False))
|
|
1302
|
+
except ValueError as exc:
|
|
1303
|
+
raise DrowseArchiveError(f"transaction journal path {value!r} escapes root") from exc
|
|
1304
|
+
return path
|
|
1305
|
+
|
|
1306
|
+
|
|
1307
|
+
def _write_transaction_journal(path: Path, payload: dict[str, Any]) -> None:
|
|
1308
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
1309
|
+
write_json_atomic(path, payload)
|
|
1310
|
+
fsync_directory(path.parent)
|
|
1311
|
+
|
|
1312
|
+
|
|
1313
|
+
def _load_transaction_journal(
|
|
1314
|
+
root: Path, path: Path,
|
|
1315
|
+
) -> tuple[dict[str, Any], list[dict[str, Any]]]:
|
|
1316
|
+
data = _load_pack_json(_read_limited(
|
|
1317
|
+
path,
|
|
1318
|
+
maximum=_METADATA_JSON_MAX_BYTES,
|
|
1319
|
+
label=f"transaction journal {path}",
|
|
1320
|
+
))
|
|
1321
|
+
if set(data) != {"format_version", "token", "phase", "items"}:
|
|
1322
|
+
raise DrowseArchiveError(f"transaction journal {path} has an invalid schema")
|
|
1323
|
+
if data["format_version"] != _TRANSACTION_FORMAT_VERSION:
|
|
1324
|
+
raise DrowseArchiveError(f"transaction journal {path} has an invalid version")
|
|
1325
|
+
if (
|
|
1326
|
+
not isinstance(data["token"], str)
|
|
1327
|
+
or not re.fullmatch(r"[0-9a-f]{32}", data["token"])
|
|
1328
|
+
or path.stem != data["token"]
|
|
1329
|
+
or data["phase"] not in {
|
|
1330
|
+
"staging", "prepared", "backed_up", "committed",
|
|
1331
|
+
}
|
|
1332
|
+
or not isinstance(data["items"], list)
|
|
1333
|
+
or not 1 <= len(data["items"]) <= 2
|
|
1334
|
+
):
|
|
1335
|
+
raise DrowseArchiveError(f"transaction journal {path} has invalid values")
|
|
1336
|
+
items: list[dict[str, Any]] = []
|
|
1337
|
+
for index, raw in enumerate(data["items"]):
|
|
1338
|
+
if not isinstance(raw, dict) or set(raw) != {
|
|
1339
|
+
"kind", "stage", "target", "backup", "had_existing",
|
|
1340
|
+
}:
|
|
1341
|
+
raise DrowseArchiveError(f"transaction journal {path} has an invalid item")
|
|
1342
|
+
expected_kind = "manifold" if index == 0 else "template"
|
|
1343
|
+
if raw["kind"] != expected_kind or not isinstance(raw["had_existing"], bool):
|
|
1344
|
+
raise DrowseArchiveError(f"transaction journal {path} has an invalid item")
|
|
1345
|
+
target = _resolve_transaction_path(root, raw["target"])
|
|
1346
|
+
expected_root = "manifolds" if expected_kind == "manifold" else "templates"
|
|
1347
|
+
relative_target = target.relative_to(root.resolve(strict=False))
|
|
1348
|
+
if (
|
|
1349
|
+
len(relative_target.parts) != 3
|
|
1350
|
+
or relative_target.parts[0] != expected_root
|
|
1351
|
+
or any(
|
|
1352
|
+
not NAME_REGEX.fullmatch(component)
|
|
1353
|
+
for component in relative_target.parts[1:]
|
|
1354
|
+
)
|
|
1355
|
+
):
|
|
1356
|
+
raise DrowseArchiveError(f"transaction journal {path} has an invalid target")
|
|
1357
|
+
stage = _resolve_transaction_path(root, raw["stage"])
|
|
1358
|
+
backup = _resolve_transaction_path(root, raw["backup"])
|
|
1359
|
+
if (
|
|
1360
|
+
stage != _transaction_stage_path(root, data["token"], expected_kind)
|
|
1361
|
+
or backup
|
|
1362
|
+
!= _transaction_backup_path(root, data["token"], expected_kind)
|
|
1363
|
+
):
|
|
1364
|
+
raise DrowseArchiveError(f"transaction journal {path} has invalid staging paths")
|
|
1365
|
+
items.append({
|
|
1366
|
+
"kind": expected_kind,
|
|
1367
|
+
"stage": stage,
|
|
1368
|
+
"target": target,
|
|
1369
|
+
"backup": backup,
|
|
1370
|
+
"had_existing": raw["had_existing"],
|
|
1371
|
+
})
|
|
1372
|
+
return data, items
|
|
1373
|
+
|
|
1374
|
+
|
|
1375
|
+
def _remove_transaction_tree(path: Path) -> None:
|
|
1376
|
+
if path.is_symlink():
|
|
1377
|
+
raise DrowseArchiveError(f"transaction path {path} is a symbolic link")
|
|
1378
|
+
if path.exists():
|
|
1379
|
+
if path.is_dir() and not path.is_symlink():
|
|
1380
|
+
shutil.rmtree(path)
|
|
1381
|
+
else:
|
|
1382
|
+
raise DrowseArchiveError(f"transaction path {path} is not a directory")
|
|
1383
|
+
|
|
1384
|
+
|
|
1385
|
+
def _recover_transaction_journal(root: Path, journal: Path) -> None:
|
|
1386
|
+
data, items = _load_transaction_journal(root, journal)
|
|
1387
|
+
manifold_target = items[0]["target"]
|
|
1388
|
+
template_target = items[1]["target"] if len(items) == 2 else None
|
|
1389
|
+
with _closure_locks(manifold_target, template_target):
|
|
1390
|
+
committed = data["phase"] == "committed" and all(
|
|
1391
|
+
item["target"].is_dir() and not item["target"].is_symlink()
|
|
1392
|
+
for item in items
|
|
1393
|
+
)
|
|
1394
|
+
if committed:
|
|
1395
|
+
for item in items:
|
|
1396
|
+
_remove_transaction_tree(item["stage"])
|
|
1397
|
+
_remove_transaction_tree(item["backup"])
|
|
1398
|
+
else:
|
|
1399
|
+
for item in reversed(items):
|
|
1400
|
+
target = item["target"]
|
|
1401
|
+
backup = item["backup"]
|
|
1402
|
+
if backup.exists():
|
|
1403
|
+
_remove_transaction_tree(target)
|
|
1404
|
+
backup.rename(target)
|
|
1405
|
+
fsync_directory(target.parent)
|
|
1406
|
+
fsync_directory(backup.parent)
|
|
1407
|
+
elif data["phase"] in {"backed_up", "committed"}:
|
|
1408
|
+
if item["had_existing"]:
|
|
1409
|
+
raise DrowseArchiveError(
|
|
1410
|
+
f"transaction {data['token']} lost backup for {target}"
|
|
1411
|
+
)
|
|
1412
|
+
_remove_transaction_tree(target)
|
|
1413
|
+
_remove_transaction_tree(item["stage"])
|
|
1414
|
+
journal.unlink(missing_ok=True)
|
|
1415
|
+
fsync_directory(journal.parent)
|
|
1416
|
+
|
|
1417
|
+
|
|
1418
|
+
def _recover_legacy_transaction_orphans(root: Path) -> None:
|
|
1419
|
+
for artifact_root, metadata_name in (
|
|
1420
|
+
(root / "manifolds", "manifold.json"),
|
|
1421
|
+
(root / "templates", "template.json"),
|
|
1422
|
+
):
|
|
1423
|
+
if not artifact_root.exists():
|
|
1424
|
+
continue
|
|
1425
|
+
if artifact_root.is_symlink() or not artifact_root.is_dir():
|
|
1426
|
+
raise DrowseArchiveError(
|
|
1427
|
+
f"Drowse archive artifact root {artifact_root} is not a regular directory"
|
|
1428
|
+
)
|
|
1429
|
+
for namespace in sorted(artifact_root.iterdir()):
|
|
1430
|
+
if not namespace.is_dir() or namespace.is_symlink():
|
|
1431
|
+
continue
|
|
1432
|
+
for candidate in sorted(namespace.iterdir()):
|
|
1433
|
+
match = _LEGACY_TRANSACTION_RE.fullmatch(candidate.name)
|
|
1434
|
+
if match is None:
|
|
1435
|
+
continue
|
|
1436
|
+
if candidate.is_symlink() or not candidate.is_dir():
|
|
1437
|
+
raise DrowseArchiveError(
|
|
1438
|
+
f"legacy transaction path {candidate} is not a directory"
|
|
1439
|
+
)
|
|
1440
|
+
metadata = candidate / metadata_name
|
|
1441
|
+
if not metadata.is_file() or metadata.is_symlink():
|
|
1442
|
+
continue
|
|
1443
|
+
try:
|
|
1444
|
+
payload = json.loads(_read_limited(
|
|
1445
|
+
metadata,
|
|
1446
|
+
maximum=_METADATA_JSON_MAX_BYTES,
|
|
1447
|
+
label=f"legacy transaction metadata {metadata}",
|
|
1448
|
+
))
|
|
1449
|
+
except json.JSONDecodeError:
|
|
1450
|
+
continue
|
|
1451
|
+
if not isinstance(payload, dict) or payload.get("name") != match["name"]:
|
|
1452
|
+
continue
|
|
1453
|
+
target = candidate.with_name(match["name"])
|
|
1454
|
+
lock_suffix = (
|
|
1455
|
+
"manifest" if metadata_name == "manifold.json" else "template"
|
|
1456
|
+
)
|
|
1457
|
+
with artifact_lock(target.parent / f"{target.name}.{lock_suffix}"):
|
|
1458
|
+
if match["kind"] == "bak" and not target.exists():
|
|
1459
|
+
candidate.rename(target)
|
|
1460
|
+
fsync_directory(target.parent)
|
|
1461
|
+
else:
|
|
1462
|
+
_remove_transaction_tree(candidate)
|
|
1463
|
+
fsync_directory(candidate.parent)
|
|
1464
|
+
|
|
1465
|
+
|
|
1466
|
+
def _recover_transaction_orphans(root: Path) -> None:
|
|
1467
|
+
directory = _transaction_dir(root)
|
|
1468
|
+
if directory.exists():
|
|
1469
|
+
stage_pattern = re.compile(
|
|
1470
|
+
r"^[0-9a-f]{32}\.(?:manifold|template)\.stage$"
|
|
1471
|
+
)
|
|
1472
|
+
backup_pattern = re.compile(
|
|
1473
|
+
r"^[0-9a-f]{32}\.(?:manifold|template)\.backup$"
|
|
1474
|
+
)
|
|
1475
|
+
for path in sorted(directory.iterdir()):
|
|
1476
|
+
if stage_pattern.fullmatch(path.name):
|
|
1477
|
+
_remove_transaction_tree(path)
|
|
1478
|
+
elif backup_pattern.fullmatch(path.name):
|
|
1479
|
+
raise DrowseArchiveError(
|
|
1480
|
+
f"orphaned transaction backup {path} has no recovery journal"
|
|
1481
|
+
)
|
|
1482
|
+
elif re.fullmatch(r"[0-9a-f]{32}\.json\.tmp", path.name):
|
|
1483
|
+
if path.is_dir() or path.is_symlink():
|
|
1484
|
+
raise DrowseArchiveError(
|
|
1485
|
+
f"transaction temporary path {path} is not a regular file"
|
|
1486
|
+
)
|
|
1487
|
+
path.unlink(missing_ok=True)
|
|
1488
|
+
fsync_directory(directory)
|
|
1489
|
+
_recover_legacy_transaction_orphans(root)
|
|
1490
|
+
|
|
1491
|
+
|
|
1492
|
+
def _recover_transactions_locked(root: Path) -> None:
|
|
1493
|
+
directory = _transaction_dir(root)
|
|
1494
|
+
if directory.exists():
|
|
1495
|
+
for journal in sorted(directory.glob("*.json")):
|
|
1496
|
+
_recover_transaction_journal(root, journal)
|
|
1497
|
+
_recover_transaction_orphans(root)
|
|
1498
|
+
|
|
1499
|
+
|
|
1500
|
+
@contextmanager
|
|
1501
|
+
def _transaction_guard(root: Path) -> Iterator[None]:
|
|
1502
|
+
root = root.resolve(strict=False)
|
|
1503
|
+
root.mkdir(parents=True, exist_ok=True)
|
|
1504
|
+
_validate_transaction_roots(root)
|
|
1505
|
+
with artifact_lock(root / ".drowse-transactions"):
|
|
1506
|
+
_validate_transaction_roots(root)
|
|
1507
|
+
_recover_transactions_locked(root)
|
|
1508
|
+
yield
|
|
1509
|
+
|
|
1510
|
+
|
|
1511
|
+
def recover_drowse_archive_transactions(root: Path | None = None) -> None:
|
|
1512
|
+
"""Recover crash-left multi-artifact install journals under ``root``."""
|
|
1513
|
+
with _transaction_guard(Path(root) if root is not None else drowse_home()):
|
|
1514
|
+
pass
|
|
1515
|
+
|
|
1516
|
+
|
|
1517
|
+
def _transaction_items(
|
|
1518
|
+
root: Path,
|
|
1519
|
+
staged: list[tuple[Path, Path]],
|
|
1520
|
+
*,
|
|
1521
|
+
token: str,
|
|
1522
|
+
) -> list[dict[str, Any]]:
|
|
1523
|
+
items: list[dict[str, Any]] = []
|
|
1524
|
+
for index, (stage, target) in enumerate(staged):
|
|
1525
|
+
kind = "manifold" if index == 0 else "template"
|
|
1526
|
+
if target.is_symlink() or target.exists() and not target.is_dir():
|
|
1527
|
+
raise DrowseArchiveError(
|
|
1528
|
+
f"Drowse archive {kind} target {target} is not a regular directory"
|
|
1529
|
+
)
|
|
1530
|
+
expected_stage = _transaction_stage_path(root, token, kind)
|
|
1531
|
+
if stage.resolve(strict=False) != expected_stage.resolve(strict=False):
|
|
1532
|
+
raise DrowseArchiveError(
|
|
1533
|
+
f"Drowse archive {kind} stage must be outside live artifact namespaces"
|
|
1534
|
+
)
|
|
1535
|
+
backup = _transaction_backup_path(root, token, kind)
|
|
1536
|
+
items.append({
|
|
1537
|
+
"kind": kind,
|
|
1538
|
+
"stage": _relative_transaction_path(root, stage),
|
|
1539
|
+
"target": _relative_transaction_path(root, target),
|
|
1540
|
+
"backup": _relative_transaction_path(root, backup),
|
|
1541
|
+
"had_existing": target.exists(),
|
|
1542
|
+
})
|
|
1543
|
+
return items
|
|
1544
|
+
|
|
1545
|
+
|
|
1546
|
+
def _begin_transaction(
|
|
1547
|
+
staged: list[tuple[Path, Path]], *, token: str, root: Path,
|
|
1548
|
+
) -> Path:
|
|
1549
|
+
items = _transaction_items(root, staged, token=token)
|
|
1550
|
+
journal = _transaction_dir(root) / f"{token}.json"
|
|
1551
|
+
if journal.exists():
|
|
1552
|
+
raise DrowseArchiveError(f"Drowse archive transaction {token} already exists")
|
|
1553
|
+
for item in items:
|
|
1554
|
+
_remove_transaction_tree(_resolve_transaction_path(root, item["stage"]))
|
|
1555
|
+
_remove_transaction_tree(_resolve_transaction_path(root, item["backup"]))
|
|
1556
|
+
_write_transaction_journal(journal, {
|
|
1557
|
+
"format_version": _TRANSACTION_FORMAT_VERSION,
|
|
1558
|
+
"token": token,
|
|
1559
|
+
"phase": "staging",
|
|
1560
|
+
"items": items,
|
|
1561
|
+
})
|
|
1562
|
+
return journal
|
|
1563
|
+
|
|
1564
|
+
|
|
1565
|
+
def _promote_transaction(
|
|
1566
|
+
staged: list[tuple[Path, Path]], *, token: str,
|
|
1567
|
+
journal_root: Path | None = None, transaction_locked: bool = False,
|
|
1568
|
+
) -> None:
|
|
1569
|
+
if not staged or len(staged) > 2:
|
|
1570
|
+
raise DrowseArchiveError("Drowse archive transaction needs one or two targets")
|
|
1571
|
+
if not re.fullmatch(r"[0-9a-f]{32}", token):
|
|
1572
|
+
raise DrowseArchiveError("Drowse archive transaction token is invalid")
|
|
1573
|
+
if journal_root is None:
|
|
1574
|
+
roots: set[Path] = set()
|
|
1575
|
+
for _stage, target in staged:
|
|
1576
|
+
resolved_target = target.resolve(strict=False)
|
|
1577
|
+
if len(resolved_target.parents) < 3:
|
|
1578
|
+
raise DrowseArchiveError("Drowse archive transaction target is too shallow")
|
|
1579
|
+
roots.add(resolved_target.parents[2])
|
|
1580
|
+
if len(roots) != 1:
|
|
1581
|
+
raise DrowseArchiveError("Drowse archive transaction targets have different roots")
|
|
1582
|
+
journal_root = roots.pop()
|
|
1583
|
+
root = journal_root.resolve(strict=False)
|
|
1584
|
+
if not transaction_locked:
|
|
1585
|
+
with _transaction_guard(root):
|
|
1586
|
+
_promote_transaction(
|
|
1587
|
+
staged, token=token, journal_root=root, transaction_locked=True,
|
|
1588
|
+
)
|
|
1589
|
+
return
|
|
1590
|
+
journal = _transaction_dir(root) / f"{token}.json"
|
|
1591
|
+
if not journal.exists():
|
|
1592
|
+
raise DrowseArchiveError(
|
|
1593
|
+
f"Drowse archive transaction {token} has no durable staging journal"
|
|
1594
|
+
)
|
|
1595
|
+
payload, loaded_items = _load_transaction_journal(root, journal)
|
|
1596
|
+
expected_items = _transaction_items(root, staged, token=token)
|
|
1597
|
+
comparable = [
|
|
1598
|
+
{
|
|
1599
|
+
"kind": item["kind"],
|
|
1600
|
+
"stage": _relative_transaction_path(root, item["stage"]),
|
|
1601
|
+
"target": _relative_transaction_path(root, item["target"]),
|
|
1602
|
+
"backup": _relative_transaction_path(root, item["backup"]),
|
|
1603
|
+
"had_existing": item["had_existing"],
|
|
1604
|
+
}
|
|
1605
|
+
for item in loaded_items
|
|
1606
|
+
]
|
|
1607
|
+
if payload["phase"] != "staging" or comparable != expected_items:
|
|
1608
|
+
raise DrowseArchiveError(
|
|
1609
|
+
f"Drowse archive transaction {token} does not match its journal"
|
|
1610
|
+
)
|
|
1611
|
+
items = expected_items
|
|
1612
|
+
if any(
|
|
1613
|
+
(
|
|
1614
|
+
_resolve_transaction_path(root, item["stage"]).is_symlink()
|
|
1615
|
+
or not _resolve_transaction_path(root, item["stage"]).is_dir()
|
|
1616
|
+
)
|
|
1617
|
+
for item in items
|
|
1618
|
+
):
|
|
1619
|
+
raise DrowseArchiveError("Drowse archive transaction has an incomplete stage")
|
|
1620
|
+
payload["phase"] = "prepared"
|
|
1621
|
+
_write_transaction_journal(journal, payload)
|
|
1622
|
+
try:
|
|
1623
|
+
for item in items:
|
|
1624
|
+
target = _resolve_transaction_path(root, item["target"])
|
|
1625
|
+
backup = _resolve_transaction_path(root, item["backup"])
|
|
1626
|
+
if item["had_existing"]:
|
|
1627
|
+
_remove_transaction_tree(backup)
|
|
1628
|
+
target.rename(backup)
|
|
1629
|
+
fsync_directory(target.parent)
|
|
1630
|
+
fsync_directory(backup.parent)
|
|
1631
|
+
payload["phase"] = "backed_up"
|
|
1632
|
+
_write_transaction_journal(journal, payload)
|
|
1633
|
+
for stage, target in staged:
|
|
1634
|
+
stage.rename(target)
|
|
1635
|
+
fsync_directory(target.parent)
|
|
1636
|
+
fsync_directory(stage.parent)
|
|
1637
|
+
payload["phase"] = "committed"
|
|
1638
|
+
_write_transaction_journal(journal, payload)
|
|
1639
|
+
except BaseException as exc:
|
|
1640
|
+
try:
|
|
1641
|
+
_recover_transaction_journal(root, journal)
|
|
1642
|
+
except BaseException as recovery_exc:
|
|
1643
|
+
raise DrowseArchiveError(
|
|
1644
|
+
f"Drowse archive promotion failed and recovery was incomplete "
|
|
1645
|
+
f"({recovery_exc})"
|
|
1646
|
+
) from recovery_exc
|
|
1647
|
+
if isinstance(exc, OSError):
|
|
1648
|
+
raise DrowseArchiveError(
|
|
1649
|
+
f"could not promote Drowse archive transaction ({exc})"
|
|
1650
|
+
) from exc
|
|
1651
|
+
raise
|
|
1652
|
+
_recover_transaction_journal(root, journal)
|
|
1653
|
+
|
|
1654
|
+
|
|
1655
|
+
def install_drowse_archive(
|
|
1656
|
+
archive_path: str | Path,
|
|
1657
|
+
as_: str | None = None,
|
|
1658
|
+
*,
|
|
1659
|
+
force: bool = False,
|
|
1660
|
+
on_progress: ProgressCallback | None = None,
|
|
1661
|
+
) -> Path:
|
|
1662
|
+
"""Verify, stage, and transactionally install a local ``.drowse``."""
|
|
1663
|
+
from drowse.io.hf_manifolds import (
|
|
1664
|
+
ManifoldInstallConflict,
|
|
1665
|
+
_rewrite_staged_manifold_name,
|
|
1666
|
+
)
|
|
1667
|
+
from drowse.io.selectors import invalidate as invalidate_selector_index
|
|
1668
|
+
|
|
1669
|
+
source_archive = Path(archive_path).expanduser()
|
|
1670
|
+
if not source_archive.is_file():
|
|
1671
|
+
raise FileNotFoundError(f"Drowse archive not found: {source_archive}")
|
|
1672
|
+
if source_archive.suffix.lower() not in {".drowse", ".polythetic", ".saklaspack"}:
|
|
1673
|
+
raise DrowseArchiveError("archive path must end in .drowse")
|
|
1674
|
+
_report(on_progress, f"Validating {source_archive.name}...")
|
|
1675
|
+
root = drowse_home()
|
|
1676
|
+
root.mkdir(parents=True, exist_ok=True)
|
|
1677
|
+
try:
|
|
1678
|
+
archive = zipfile.ZipFile(source_archive, "r")
|
|
1679
|
+
except (OSError, zipfile.BadZipFile) as exc:
|
|
1680
|
+
raise DrowseArchiveError(f"could not open {source_archive} ({exc})") from exc
|
|
1681
|
+
with archive:
|
|
1682
|
+
infos = _validate_zip_infos(archive.infolist())
|
|
1683
|
+
pack_info = infos.get("pack.json")
|
|
1684
|
+
if pack_info is None:
|
|
1685
|
+
raise DrowseArchiveError("archive has no pack.json")
|
|
1686
|
+
if pack_info.file_size > _PACK_MANIFEST_MAX_BYTES:
|
|
1687
|
+
raise DrowseArchiveError("pack.json is larger than 1 MiB")
|
|
1688
|
+
try:
|
|
1689
|
+
raw_pack = archive.read(pack_info)
|
|
1690
|
+
except (OSError, RuntimeError, zipfile.BadZipFile) as exc:
|
|
1691
|
+
raise DrowseArchiveError(f"could not read pack.json ({exc})") from exc
|
|
1692
|
+
data = _load_pack_json(raw_pack)
|
|
1693
|
+
primary, source_identity, template, template_identity, files = (
|
|
1694
|
+
_validate_pack_manifest(data, infos)
|
|
1695
|
+
)
|
|
1696
|
+
for name, record in files.items():
|
|
1697
|
+
_stream_entry(archive, infos[name], expected=record)
|
|
1698
|
+
with tempfile.TemporaryDirectory(prefix=".drowse-", dir=root) as temp:
|
|
1699
|
+
extracted = Path(temp)
|
|
1700
|
+
for name, record in files.items():
|
|
1701
|
+
output = extracted.joinpath(*PurePosixPath(name).parts)
|
|
1702
|
+
_stream_entry(archive, infos[name], expected=record, output=output)
|
|
1703
|
+
folder, loaded_template = _validate_extracted_closure(
|
|
1704
|
+
extracted,
|
|
1705
|
+
primary,
|
|
1706
|
+
source_identity,
|
|
1707
|
+
template,
|
|
1708
|
+
template_identity,
|
|
1709
|
+
data["source"],
|
|
1710
|
+
)
|
|
1711
|
+
|
|
1712
|
+
src_ns, src_name = source_identity
|
|
1713
|
+
if as_ is None:
|
|
1714
|
+
dst_ns, dst_name = src_ns, src_name
|
|
1715
|
+
else:
|
|
1716
|
+
parts = as_.split("/")
|
|
1717
|
+
if len(parts) != 2 or any(
|
|
1718
|
+
not NAME_REGEX.fullmatch(component) for component in parts
|
|
1719
|
+
):
|
|
1720
|
+
raise DrowseArchiveError(
|
|
1721
|
+
f"as_ must be '<namespace>/<name>' with both components "
|
|
1722
|
+
f"matching {NAME_REGEX.pattern}"
|
|
1723
|
+
)
|
|
1724
|
+
dst_ns, dst_name = parts
|
|
1725
|
+
_validate_manifold_identity(dst_ns, dst_name)
|
|
1726
|
+
dst = manifold_dir(dst_ns, dst_name)
|
|
1727
|
+
tmpl_dst = (
|
|
1728
|
+
template_dir(*template_identity)
|
|
1729
|
+
if template_identity is not None else None
|
|
1730
|
+
)
|
|
1731
|
+
token = uuid.uuid4().hex
|
|
1732
|
+
manifold_stage = _transaction_stage_path(root, token, "manifold")
|
|
1733
|
+
template_stage = (
|
|
1734
|
+
_transaction_stage_path(root, token, "template")
|
|
1735
|
+
if tmpl_dst is not None else None
|
|
1736
|
+
)
|
|
1737
|
+
with _transaction_guard(root):
|
|
1738
|
+
with _closure_locks(dst, tmpl_dst):
|
|
1739
|
+
if dst.exists() and not force:
|
|
1740
|
+
raise ManifoldInstallConflict(
|
|
1741
|
+
f"{dst} already exists; pass force=True or "
|
|
1742
|
+
"as_=<ns>/<name>"
|
|
1743
|
+
)
|
|
1744
|
+
install_template = False
|
|
1745
|
+
if tmpl_dst is not None and loaded_template is not None:
|
|
1746
|
+
if tmpl_dst.is_symlink() or (
|
|
1747
|
+
tmpl_dst.exists() and not tmpl_dst.is_dir()
|
|
1748
|
+
):
|
|
1749
|
+
raise DrowseArchiveError(
|
|
1750
|
+
f"template target {tmpl_dst} is not a regular directory"
|
|
1751
|
+
)
|
|
1752
|
+
source_template = loaded_template.path
|
|
1753
|
+
assert source_template is not None
|
|
1754
|
+
if tmpl_dst.exists() and _same_template(
|
|
1755
|
+
source_template, tmpl_dst,
|
|
1756
|
+
):
|
|
1757
|
+
install_template = False
|
|
1758
|
+
elif tmpl_dst.exists() and not force:
|
|
1759
|
+
raise ManifoldInstallConflict(
|
|
1760
|
+
f"{tmpl_dst} already contains a different "
|
|
1761
|
+
"referenced template; pass force=True to "
|
|
1762
|
+
"replace the closure"
|
|
1763
|
+
)
|
|
1764
|
+
else:
|
|
1765
|
+
if tmpl_dst.exists():
|
|
1766
|
+
assert template_identity is not None
|
|
1767
|
+
template_ref = "/".join(template_identity)
|
|
1768
|
+
dependents = _other_template_dependents(
|
|
1769
|
+
root,
|
|
1770
|
+
template_ref,
|
|
1771
|
+
excluding=dst,
|
|
1772
|
+
)
|
|
1773
|
+
if dependents:
|
|
1774
|
+
joined = ", ".join(dependents)
|
|
1775
|
+
raise ManifoldInstallConflict(
|
|
1776
|
+
f"cannot replace shared template "
|
|
1777
|
+
f"{template_ref}; referenced by {joined}"
|
|
1778
|
+
)
|
|
1779
|
+
install_template = True
|
|
1780
|
+
staged: list[tuple[Path, Path]] = [(manifold_stage, dst)]
|
|
1781
|
+
if install_template:
|
|
1782
|
+
assert template_stage is not None
|
|
1783
|
+
assert tmpl_dst is not None
|
|
1784
|
+
staged.append((template_stage, tmpl_dst))
|
|
1785
|
+
journal = _begin_transaction(staged, token=token, root=root)
|
|
1786
|
+
try:
|
|
1787
|
+
_report(on_progress, f"Staging {src_ns}/{src_name}...")
|
|
1788
|
+
_copy_tree(folder.folder, manifold_stage)
|
|
1789
|
+
_reset_installed_manifold_transaction_state(manifold_stage)
|
|
1790
|
+
staged_folder = ManifoldFolder.load(manifold_stage)
|
|
1791
|
+
if as_ is not None:
|
|
1792
|
+
rewritten_files = _rewrite_staged_manifold_name(
|
|
1793
|
+
staged_folder, dst_name,
|
|
1794
|
+
)
|
|
1795
|
+
staged_folder.write_metadata(files=rewritten_files)
|
|
1796
|
+
staged_folder = ManifoldFolder.load(manifold_stage)
|
|
1797
|
+
template_sha256 = (
|
|
1798
|
+
loaded_template.sha256()
|
|
1799
|
+
if loaded_template is not None else None
|
|
1800
|
+
)
|
|
1801
|
+
for tensor in _fitted_tensor_paths(staged_folder):
|
|
1802
|
+
_validate_fitted_tensor(
|
|
1803
|
+
tensor,
|
|
1804
|
+
staged_folder,
|
|
1805
|
+
resolved_template_sha256=template_sha256,
|
|
1806
|
+
)
|
|
1807
|
+
if install_template:
|
|
1808
|
+
assert template_stage is not None
|
|
1809
|
+
assert loaded_template is not None
|
|
1810
|
+
assert loaded_template.path is not None
|
|
1811
|
+
_copy_tree(loaded_template.path, template_stage)
|
|
1812
|
+
staged_template = TemplateFolder.load(template_stage)
|
|
1813
|
+
assert template_identity is not None
|
|
1814
|
+
if staged_template.name != template_identity[1]:
|
|
1815
|
+
raise DrowseArchiveError(
|
|
1816
|
+
"staged template identity changed during copy"
|
|
1817
|
+
)
|
|
1818
|
+
_report(on_progress, f"Installing {src_ns}/{src_name}...")
|
|
1819
|
+
_promote_transaction(
|
|
1820
|
+
staged,
|
|
1821
|
+
token=token,
|
|
1822
|
+
journal_root=root,
|
|
1823
|
+
transaction_locked=True,
|
|
1824
|
+
)
|
|
1825
|
+
except BaseException:
|
|
1826
|
+
if journal.exists():
|
|
1827
|
+
_recover_transaction_journal(root, journal)
|
|
1828
|
+
raise
|
|
1829
|
+
invalidate_selector_index()
|
|
1830
|
+
return dst
|