exp-runtime-creator 0.6.0__tar.gz

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.
Files changed (35) hide show
  1. exp_runtime_creator-0.6.0/LICENSE +21 -0
  2. exp_runtime_creator-0.6.0/MANIFEST.in +5 -0
  3. exp_runtime_creator-0.6.0/PKG-INFO +75 -0
  4. exp_runtime_creator-0.6.0/README.md +33 -0
  5. exp_runtime_creator-0.6.0/pyproject.toml +33 -0
  6. exp_runtime_creator-0.6.0/setup.cfg +4 -0
  7. exp_runtime_creator-0.6.0/src/exp_runtime/creator/__init__.py +8 -0
  8. exp_runtime_creator-0.6.0/src/exp_runtime/creator/__main__.py +69 -0
  9. exp_runtime_creator-0.6.0/src/exp_runtime/creator/assets.py +56 -0
  10. exp_runtime_creator-0.6.0/src/exp_runtime/creator/catalog.py +30 -0
  11. exp_runtime_creator-0.6.0/src/exp_runtime/creator/compiler.py +448 -0
  12. exp_runtime_creator-0.6.0/src/exp_runtime/creator/debugger.py +123 -0
  13. exp_runtime_creator-0.6.0/src/exp_runtime/creator/diagnostics.py +86 -0
  14. exp_runtime_creator-0.6.0/src/exp_runtime/creator/editing.py +80 -0
  15. exp_runtime_creator-0.6.0/src/exp_runtime/creator/expressions.py +81 -0
  16. exp_runtime_creator-0.6.0/src/exp_runtime/creator/features.py +90 -0
  17. exp_runtime_creator-0.6.0/src/exp_runtime/creator/graph.py +124 -0
  18. exp_runtime_creator-0.6.0/src/exp_runtime/creator/kiwi-hammer.svg +73 -0
  19. exp_runtime_creator-0.6.0/src/exp_runtime/creator/live.py +116 -0
  20. exp_runtime_creator-0.6.0/src/exp_runtime/creator/mcp_results.py +53 -0
  21. exp_runtime_creator-0.6.0/src/exp_runtime/creator/mcp_server.py +428 -0
  22. exp_runtime_creator-0.6.0/src/exp_runtime/creator/mcp_types.py +49 -0
  23. exp_runtime_creator-0.6.0/src/exp_runtime/creator/media.py +144 -0
  24. exp_runtime_creator-0.6.0/src/exp_runtime/creator/minigames.py +149 -0
  25. exp_runtime_creator-0.6.0/src/exp_runtime/creator/model.py +377 -0
  26. exp_runtime_creator-0.6.0/src/exp_runtime/creator/native.py +174 -0
  27. exp_runtime_creator-0.6.0/src/exp_runtime/creator/operations.py +83 -0
  28. exp_runtime_creator-0.6.0/src/exp_runtime/creator/panels.py +221 -0
  29. exp_runtime_creator-0.6.0/src/exp_runtime/creator/playtest.py +185 -0
  30. exp_runtime_creator-0.6.0/src/exp_runtime/creator/preview.py +30 -0
  31. exp_runtime_creator-0.6.0/src/exp_runtime/creator/schema.py +102 -0
  32. exp_runtime_creator-0.6.0/src/exp_runtime/creator/sharing.py +169 -0
  33. exp_runtime_creator-0.6.0/src/exp_runtime/creator/ui.py +1041 -0
  34. exp_runtime_creator-0.6.0/src/exp_runtime/creator/workspace.py +271 -0
  35. exp_runtime_creator-0.6.0/src/exp_runtime_creator.egg-info/SOURCES.txt +32 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Josh Mcdaniel
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,5 @@
1
+ # Only authored component source, metadata and license.
2
+ global-exclude *
3
+ include LICENSE README.md pyproject.toml MANIFEST.in
4
+ recursive-include src/exp_runtime *.py
5
+ include src/exp_runtime/creator/kiwi-hammer.svg
@@ -0,0 +1,75 @@
1
+ Metadata-Version: 2.4
2
+ Name: exp-runtime-creator
3
+ Version: 0.6.0
4
+ Summary: Visual desktop episode creator and native EXP compiler for EXP Runtime
5
+ License: MIT License
6
+
7
+ Copyright (c) 2025 Josh Mcdaniel
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
26
+
27
+ Requires-Python: >=3.10
28
+ Description-Content-Type: text/markdown
29
+ License-File: LICENSE
30
+ Requires-Dist: exp-runtime-formats==0.6.0
31
+ Provides-Extra: mcp
32
+ Requires-Dist: mcp<2,>=1.28; extra == "mcp"
33
+ Requires-Dist: exp-runtime-player[desktop]==0.6.0; extra == "mcp"
34
+ Requires-Dist: exp-runtime-shs==0.6.0; extra == "mcp"
35
+ Requires-Dist: exp-runtime-cod==0.6.0; extra == "mcp"
36
+ Provides-Extra: desktop
37
+ Requires-Dist: PySide6-Essentials<7,>=6.10; extra == "desktop"
38
+ Requires-Dist: exp-runtime-player[desktop]==0.6.0; extra == "desktop"
39
+ Requires-Dist: exp-runtime-shs==0.6.0; extra == "desktop"
40
+ Requires-Dist: exp-runtime-cod==0.6.0; extra == "desktop"
41
+ Dynamic: license-file
42
+
43
+ # EXP Runtime Creator
44
+
45
+ Optional visual desktop editor for new SHS and CoD episodes. Author dialogue,
46
+ choices, branches, characters, audio, minigames and translations, save portable projects and export native CSPUD/KiWi EXP
47
+ files for EXP Runtime and the original games. Original-slot export preserves
48
+ an existing episode's catalog IDs. Native KiWi loader/VM checks pass for SHS
49
+ Android, SHS iOS and CoD iOS; full original-app playback remains unverified.
50
+
51
+ Install the desktop editor with pip, then launch it:
52
+
53
+ ```sh
54
+ python -m pip install 'exp-runtime-creator[desktop]>=0.6.0'
55
+ exp-creator
56
+ ```
57
+
58
+ Standalone Creator downloads are also included in the v0.6.0 GitHub release
59
+ for Windows, Linux and macOS (Apple Silicon and Intel).
60
+
61
+ The Python authoring API needs only `exp-runtime-formats`. The `desktop` extra
62
+ adds Qt, the shared player and both game adapters. No game assets are included.
63
+ Preview uses an imported game library and temporary saves. The independent
64
+ `mcp` extra adds a stdio server, production playtesting and isolated player
65
+ rendering/audio previews. It includes pygame but does not install Qt.
66
+ Run `exp-creator-mcp --workspace /path/to/stories`.
67
+
68
+ Install both extras with `python -m pip install 'exp-runtime-creator[desktop,mcp]>=0.6.0'`
69
+ to use the editor and MCP server together.
70
+
71
+ Open a saved workspace project in the desktop creator to share live edits with
72
+ an MCP client. Models see unsaved work, their edits appear immediately, and
73
+ desktop undo/redo covers both. Save in the editor to write the shared project.
74
+
75
+ See the project README and `docs/CREATOR.md` in the source repository.
@@ -0,0 +1,33 @@
1
+ # EXP Runtime Creator
2
+
3
+ Optional visual desktop editor for new SHS and CoD episodes. Author dialogue,
4
+ choices, branches, characters, audio, minigames and translations, save portable projects and export native CSPUD/KiWi EXP
5
+ files for EXP Runtime and the original games. Original-slot export preserves
6
+ an existing episode's catalog IDs. Native KiWi loader/VM checks pass for SHS
7
+ Android, SHS iOS and CoD iOS; full original-app playback remains unverified.
8
+
9
+ Install the desktop editor with pip, then launch it:
10
+
11
+ ```sh
12
+ python -m pip install 'exp-runtime-creator[desktop]>=0.6.0'
13
+ exp-creator
14
+ ```
15
+
16
+ Standalone Creator downloads are also included in the v0.6.0 GitHub release
17
+ for Windows, Linux and macOS (Apple Silicon and Intel).
18
+
19
+ The Python authoring API needs only `exp-runtime-formats`. The `desktop` extra
20
+ adds Qt, the shared player and both game adapters. No game assets are included.
21
+ Preview uses an imported game library and temporary saves. The independent
22
+ `mcp` extra adds a stdio server, production playtesting and isolated player
23
+ rendering/audio previews. It includes pygame but does not install Qt.
24
+ Run `exp-creator-mcp --workspace /path/to/stories`.
25
+
26
+ Install both extras with `python -m pip install 'exp-runtime-creator[desktop,mcp]>=0.6.0'`
27
+ to use the editor and MCP server together.
28
+
29
+ Open a saved workspace project in the desktop creator to share live edits with
30
+ an MCP client. Models see unsaved work, their edits appear immediately, and
31
+ desktop undo/redo covers both. Save in the editor to write the shared project.
32
+
33
+ See the project README and `docs/CREATOR.md` in the source repository.
@@ -0,0 +1,33 @@
1
+ [build-system]
2
+ requires = ["setuptools >= 61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "exp-runtime-creator"
7
+ version = "0.6.0"
8
+ description = "Visual desktop episode creator and native EXP compiler for EXP Runtime"
9
+ readme = "README.md"
10
+ license = {file = "LICENSE"}
11
+ requires-python = ">=3.10"
12
+ dependencies = ["exp-runtime-formats==0.6.0"]
13
+
14
+ [project.optional-dependencies]
15
+ mcp = ["mcp>=1.28,<2", "exp-runtime-player[desktop]==0.6.0", "exp-runtime-shs==0.6.0", "exp-runtime-cod==0.6.0"]
16
+ desktop = ["PySide6-Essentials>=6.10,<7", "exp-runtime-player[desktop]==0.6.0", "exp-runtime-shs==0.6.0", "exp-runtime-cod==0.6.0"]
17
+
18
+ [project.scripts]
19
+ exp-creator-mcp = "exp_runtime.creator.mcp_server:main"
20
+
21
+ [project.gui-scripts]
22
+ exp-creator = "exp_runtime.creator.__main__:main"
23
+
24
+ [tool.setuptools]
25
+ include-package-data = false
26
+
27
+ [tool.setuptools.packages.find]
28
+ where = ["src"]
29
+ include = ["exp_runtime", "exp_runtime.*"]
30
+ namespaces = true
31
+
32
+ [tool.setuptools.package-data]
33
+ "exp_runtime.creator" = ["kiwi-hammer.svg"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,8 @@
1
+ """Episode authoring API. Importing this module does not initialize a GUI."""
2
+ from .model import Asset, Character, Choice, Node, Project, ProjectError, load_project, save_project
3
+ from .compiler import compile_project, compile_details, export_project, export_native_slot
4
+
5
+ from .native import import_exp
6
+
7
+ __all__ = ['Asset', 'Character', 'Choice', 'Node', 'Project', 'ProjectError', 'load_project',
8
+ 'save_project', 'compile_project', 'compile_details', 'export_project', 'export_native_slot', 'import_exp']
@@ -0,0 +1,69 @@
1
+ """Desktop entry point and headless project export command."""
2
+ import argparse
3
+ from pathlib import Path
4
+
5
+ from exp_runtime.exp import ContentError
6
+ from .compiler import export_project, export_native_slot
7
+ from .model import load_project, save_project
8
+
9
+
10
+ def main(argv=None):
11
+ parser = argparse.ArgumentParser(description='EXP Runtime episode creator')
12
+ parser.add_argument('project', nargs='?', type=Path, help='Editable .expproj document')
13
+ parser.add_argument('--import-exp', type=Path, help='Import an EXP; save to the project argument')
14
+ parser.add_argument('--language', choices=('en', 'fr', 'it', 'de', 'es'), help='Story language for export')
15
+ parser.add_argument('--smoke-test', action='store_true', help=argparse.SUPPRESS)
16
+ parser.add_argument('--export', type=Path, help='Compile a project without starting the GUI')
17
+ parser.add_argument('--native-slot', type=Path, help='With --export, retain this original EXP catalog identity')
18
+ parser.add_argument('--preview', type=Path, help=argparse.SUPPRESS)
19
+ parser.add_argument('--library', type=Path, help=argparse.SUPPRESS)
20
+ parser.add_argument('--game', choices=('shs', 'cod'), default='shs', help=argparse.SUPPRESS)
21
+ args = parser.parse_args(argv)
22
+ try:
23
+ if args.smoke_test:
24
+ from PySide6.QtWidgets import QApplication
25
+ from .ui import Editor
26
+ from .compiler import compile_project
27
+ app = QApplication.instance() or QApplication([])
28
+ editor = Editor(discover_library=False); editor.show(); app.processEvents()
29
+ assert compile_project(editor.project)
30
+ assert not editor.grab().isNull()
31
+ editor.close(); app.processEvents()
32
+ return
33
+ if args.import_exp:
34
+ if not args.project: parser.error('--import-exp requires an output .expproj path')
35
+ from .native import import_exp
36
+ if args.project.exists(): parser.error('Import destination already exists')
37
+ save_project(import_exp(args.import_exp.read_bytes(), game=args.game), args.project)
38
+ return
39
+ if args.export:
40
+ if not args.project:
41
+ parser.error('--export requires an .expproj document')
42
+ project = load_project(args.project)
43
+ if args.language: project.language = args.language
44
+ if args.native_slot:
45
+ export_native_slot(project, args.native_slot, args.export)
46
+ else:
47
+ export_project(project, args.export)
48
+ return
49
+ if args.native_slot:
50
+ parser.error('--native-slot requires --export')
51
+ if args.preview:
52
+ if not args.library:
53
+ parser.error('--preview requires --library')
54
+ from .preview import play_preview
55
+ play_preview(args.preview, args.library, args.game)
56
+ return
57
+ try:
58
+ from .ui import launch
59
+ except ModuleNotFoundError as error:
60
+ if error.name and error.name.startswith('PySide6'):
61
+ parser.error('The visual editor requires exp-runtime[creator] or exp-runtime-creator[desktop]')
62
+ raise
63
+ launch(args.project)
64
+ except (ContentError, OSError) as error:
65
+ parser.error(str(error))
66
+
67
+
68
+ if __name__ == '__main__':
69
+ main()
@@ -0,0 +1,56 @@
1
+ """Read-only access to a user's already imported game library."""
2
+ from io import BytesIO
3
+
4
+ from .model import Asset, ProjectError
5
+
6
+
7
+ def player_library(game):
8
+ """Find a usable library through the player's remembered/default location."""
9
+ from exp_runtime.content import ContentError, ContentLibrary
10
+ from exp_runtime.launcher import default_library
11
+ try:
12
+ path = default_library(game)
13
+ with ContentLibrary(path) as library:
14
+ if library.game_id == game:
15
+ return str(path.resolve())
16
+ except (ContentError, OSError):
17
+ pass
18
+ return ''
19
+
20
+
21
+ def image_png(data: bytes) -> bytes:
22
+ """Decode a single original image for the browser or an embedded copy."""
23
+ from PIL import Image
24
+ from exp_runtime.ui_assets import ImagePack
25
+ if data.startswith((b'\x89PNG', b'\xff\xd8')):
26
+ with Image.open(BytesIO(data)) as image:
27
+ image.load()
28
+ image = image.convert('RGBA')
29
+ else:
30
+ pack = ImagePack.parse(data)
31
+ if len(pack.images) != 1 or pack.images[0].mode != 'RGBA':
32
+ raise ProjectError('Select a single portrait or background, not a UI atlas')
33
+ frame = pack.images[0]
34
+ image = Image.frombytes('RGBA', (frame.width, frame.height), frame.pixels)
35
+ output = BytesIO()
36
+ image.save(output, format='PNG')
37
+ return output.getvalue()
38
+
39
+
40
+ def import_library_image(project, library, resource, episode=None):
41
+ if library.game_id != project.game:
42
+ raise ProjectError('The library must match the project game')
43
+ if resource < 25000:
44
+ image_png(library.read_asset(resource)) # Reject scripts, fonts and atlases.
45
+ existing = next((asset for asset in project.assets if asset.id == resource), None)
46
+ if existing:
47
+ return existing
48
+ asset = Asset(resource, f'Base image {resource}')
49
+ project.assets.append(asset)
50
+ return asset
51
+ if resource < 26000 or episode is None:
52
+ raise ProjectError('Select an episode image with an ID of 26000 or higher')
53
+ # Copy to a reserved local slot: no dependency on the source episode,
54
+ # and no accidental expression variants from neighboring original IDs.
55
+ png = image_png(episode.read_asset(resource))
56
+ return project.add_image(f'Episode image {resource}', png)
@@ -0,0 +1,30 @@
1
+ """Paginated, content-derived asset discovery. Never guess original names."""
2
+ from exp_runtime.content import ContentLibrary
3
+ from .graph import page
4
+ from .media import inspect_asset
5
+
6
+
7
+ def library_assets(workspace, library, *, episode=None, kind=None, query='', offset=0, limit=50):
8
+ page(offset, limit)
9
+ with ContentLibrary(workspace.path(library)) as content:
10
+ resources = content.open_episode(episode) if episode else content
11
+ read = resources.archive.read if episode else content.read_asset
12
+ ids = sorted(resources.archive.entries if episode else content.base_members.keys() | content.music_members.keys())
13
+ found = []
14
+ # Metadata is derived only for matching IDs. A type filter requires
15
+ # inspection, so bound every scan and return a continuation offset.
16
+ index = offset
17
+ while index < len(ids) and index < offset + 200 and len(found) < limit:
18
+ resource = ids[index]; index += 1
19
+ if query.casefold() not in str(resource): continue
20
+ info = inspect_asset(read(resource))
21
+ if kind and info['type'] != kind: continue
22
+ found.append(dict(id=resource, name=None, **info))
23
+ return dict(assets=found, total_resources=len(ids), scanned=index - offset,
24
+ next_offset=index if index < len(ids) else None)
25
+
26
+
27
+ def read_asset(workspace, library, resource, episode=None):
28
+ with ContentLibrary(workspace.path(library)) as content:
29
+ resources = content.open_episode(episode) if episode else content
30
+ return resources.archive.read(resource) if episode else content.read_asset(resource)