jusi 0.1.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.
- jusi-0.1.0/.gitignore +32 -0
- jusi-0.1.0/CONTRIBUTING.md +46 -0
- jusi-0.1.0/LICENSE +21 -0
- jusi-0.1.0/PKG-INFO +136 -0
- jusi-0.1.0/README.md +87 -0
- jusi-0.1.0/docs/architecture.md +205 -0
- jusi-0.1.0/docs/backend-map.md +548 -0
- jusi-0.1.0/docs/client-runtime-pivot.md +106 -0
- jusi-0.1.0/docs/plugins.md +231 -0
- jusi-0.1.0/docs/protocol.md +666 -0
- jusi-0.1.0/docs/session-lifecycle.md +105 -0
- jusi-0.1.0/pyproject.toml +53 -0
- jusi-0.1.0/scripts/smoke_managed_runtime.py +186 -0
- jusi-0.1.0/src/jusi/__init__.py +6 -0
- jusi-0.1.0/src/jusi/__main__.py +25 -0
- jusi-0.1.0/src/jusi/application/__init__.py +2 -0
- jusi-0.1.0/src/jusi/application/errors.py +17 -0
- jusi-0.1.0/src/jusi/application/ports.py +188 -0
- jusi-0.1.0/src/jusi/application/use_cases.py +995 -0
- jusi-0.1.0/src/jusi/domain/__init__.py +2 -0
- jusi-0.1.0/src/jusi/domain/models.py +147 -0
- jusi-0.1.0/src/jusi/infrastructure/__init__.py +2 -0
- jusi-0.1.0/src/jusi/infrastructure/client_process.py +129 -0
- jusi-0.1.0/src/jusi/infrastructure/client_runtime.py +661 -0
- jusi-0.1.0/src/jusi/infrastructure/client_runtime_constants.py +4 -0
- jusi-0.1.0/src/jusi/infrastructure/client_runtime_controller.py +91 -0
- jusi-0.1.0/src/jusi/infrastructure/client_runtime_entrypoint.py +15 -0
- jusi-0.1.0/src/jusi/infrastructure/client_runtime_handshake.py +29 -0
- jusi-0.1.0/src/jusi/infrastructure/client_runtime_host.py +299 -0
- jusi-0.1.0/src/jusi/infrastructure/client_runtime_launcher.py +153 -0
- jusi-0.1.0/src/jusi/infrastructure/client_runtime_protocol.py +136 -0
- jusi-0.1.0/src/jusi/infrastructure/client_runtime_session.py +8 -0
- jusi-0.1.0/src/jusi/infrastructure/client_runtime_startup.py +75 -0
- jusi-0.1.0/src/jusi/infrastructure/client_runtime_updates.py +55 -0
- jusi-0.1.0/src/jusi/infrastructure/client_view.py +310 -0
- jusi-0.1.0/src/jusi/infrastructure/debug_timing.py +45 -0
- jusi-0.1.0/src/jusi/infrastructure/handler_worker_startup.py +18 -0
- jusi-0.1.0/src/jusi/infrastructure/inprocess_handler_controller.py +114 -0
- jusi-0.1.0/src/jusi/infrastructure/native_terminal_transport.py +73 -0
- jusi-0.1.0/src/jusi/infrastructure/plugin_runtime.py +171 -0
- jusi-0.1.0/src/jusi/infrastructure/runtime.py +1421 -0
- jusi-0.1.0/src/jusi/infrastructure/runtime_runner_base.py +49 -0
- jusi-0.1.0/src/jusi/infrastructure/runtime_supervisor.py +45 -0
- jusi-0.1.0/src/jusi/infrastructure/transcript_runtime_session.py +169 -0
- jusi-0.1.0/src/jusi/interfaces/__init__.py +2 -0
- jusi-0.1.0/src/jusi/interfaces/events.py +12 -0
- jusi-0.1.0/src/jusi/interfaces/protocol.py +496 -0
- jusi-0.1.0/src/jusi/interfaces/server.py +971 -0
- jusi-0.1.0/src/jusi/interfaces/stdio.py +87 -0
- jusi-0.1.0/src/jusi/kernel.py +41 -0
- jusi-0.1.0/src/jusi/plugins.py +537 -0
- jusi-0.1.0/src/jusi/visidata_support.py +217 -0
- jusi-0.1.0/src/jusi_vd/__init__.py +2 -0
- jusi-0.1.0/src/jusi_vd/kernel.py +26 -0
- jusi-0.1.0/src/jusi_vd/plugin.py +108 -0
- jusi-0.1.0/src/jusi_vd/runner.py +56 -0
- jusi-0.1.0/tests/test_client_process.py +326 -0
- jusi-0.1.0/tests/test_client_runtime_controller.py +124 -0
- jusi-0.1.0/tests/test_client_runtime_entrypoint.py +34 -0
- jusi-0.1.0/tests/test_client_runtime_handshake.py +24 -0
- jusi-0.1.0/tests/test_client_runtime_host.py +107 -0
- jusi-0.1.0/tests/test_client_runtime_launcher.py +412 -0
- jusi-0.1.0/tests/test_client_runtime_updates.py +45 -0
- jusi-0.1.0/tests/test_managed_runtime.py +2064 -0
- jusi-0.1.0/tests/test_plugins.py +1165 -0
- jusi-0.1.0/tests/test_runtime_runner_base.py +22 -0
- jusi-0.1.0/tests/test_runtime_supervisor.py +27 -0
- jusi-0.1.0/tests/test_start_session.py +2036 -0
- jusi-0.1.0/tests/test_stdio_runtime.py +76 -0
jusi-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
.local/
|
|
2
|
+
|
|
3
|
+
# Python bytecode and caches
|
|
4
|
+
__pycache__/
|
|
5
|
+
*.py[cod]
|
|
6
|
+
*$py.class
|
|
7
|
+
|
|
8
|
+
# Virtual environments
|
|
9
|
+
.venv/
|
|
10
|
+
venv/
|
|
11
|
+
venv1/
|
|
12
|
+
venv2/
|
|
13
|
+
env/
|
|
14
|
+
ENV/
|
|
15
|
+
|
|
16
|
+
# Build artifacts
|
|
17
|
+
build/
|
|
18
|
+
dist/
|
|
19
|
+
*.egg-info/
|
|
20
|
+
.eggs/
|
|
21
|
+
Dockerfile
|
|
22
|
+
|
|
23
|
+
# Test and tooling caches
|
|
24
|
+
.pytest_cache/
|
|
25
|
+
.mypy_cache/
|
|
26
|
+
.ruff_cache/
|
|
27
|
+
.coverage
|
|
28
|
+
.coverage.*
|
|
29
|
+
htmlcov/
|
|
30
|
+
|
|
31
|
+
# OS/editor noise
|
|
32
|
+
.DS_Store
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
## Development Environment
|
|
4
|
+
|
|
5
|
+
Use an editable install in a virtual environment.
|
|
6
|
+
|
|
7
|
+
Example:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
python -m venv .venv
|
|
11
|
+
. .venv/bin/activate
|
|
12
|
+
python -m pip install -e .
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
An editable install is the preferred workflow because bundled plugins such as
|
|
16
|
+
`jusi_vd` are discovered through installed package metadata.
|
|
17
|
+
|
|
18
|
+
## Running Tests
|
|
19
|
+
|
|
20
|
+
Run the backend test suite through the active environment.
|
|
21
|
+
|
|
22
|
+
Example:
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
python -m unittest
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
For focused work, run only the affected test modules.
|
|
29
|
+
|
|
30
|
+
## Documentation
|
|
31
|
+
|
|
32
|
+
Public-facing docs should:
|
|
33
|
+
|
|
34
|
+
- describe the current supported contract
|
|
35
|
+
- avoid local repository path references
|
|
36
|
+
- avoid historical or migration framing unless strictly necessary
|
|
37
|
+
- treat the editor side as a regular Vim/Neovim plugin rather than a local sibling checkout
|
|
38
|
+
|
|
39
|
+
## Repository Scope
|
|
40
|
+
|
|
41
|
+
This repository is the backend component.
|
|
42
|
+
|
|
43
|
+
Plugin-specific behavior that does not belong in core should live in:
|
|
44
|
+
|
|
45
|
+
- a bundled first-party package when it is part of the supported base experience
|
|
46
|
+
- a separate plugin package/repository when it is not core backend functionality
|
jusi-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 notawhaleble
|
|
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.
|
jusi-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: jusi
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Standalone backend for Jusivim notebook execution
|
|
5
|
+
Project-URL: Homepage, https://github.com/notawhaleble/jusi
|
|
6
|
+
Project-URL: Repository, https://github.com/notawhaleble/jusi
|
|
7
|
+
Project-URL: Issues, https://github.com/notawhaleble/jusi/issues
|
|
8
|
+
Author: OpenAI Codex
|
|
9
|
+
Author-email: notawhaleble <ponival@gmail.com>
|
|
10
|
+
Maintainer-email: notawhaleble <ponival@gmail.com>
|
|
11
|
+
License: MIT License
|
|
12
|
+
|
|
13
|
+
Copyright (c) 2024 notawhaleble
|
|
14
|
+
|
|
15
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
16
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
17
|
+
in the Software without restriction, including without limitation the rights
|
|
18
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
19
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
20
|
+
furnished to do so, subject to the following conditions:
|
|
21
|
+
|
|
22
|
+
The above copyright notice and this permission notice shall be included in all
|
|
23
|
+
copies or substantial portions of the Software.
|
|
24
|
+
|
|
25
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
26
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
27
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
28
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
29
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
30
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
31
|
+
SOFTWARE.
|
|
32
|
+
License-File: LICENSE
|
|
33
|
+
Keywords: jupyter,neovim,notebook,vim
|
|
34
|
+
Classifier: Development Status :: 3 - Alpha
|
|
35
|
+
Classifier: Intended Audience :: Developers
|
|
36
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
37
|
+
Classifier: Programming Language :: Python :: 3
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
40
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
41
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
42
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
43
|
+
Classifier: Topic :: Text Editors
|
|
44
|
+
Requires-Python: >=3.9
|
|
45
|
+
Requires-Dist: ipykernel<7,>=6
|
|
46
|
+
Requires-Dist: jupyter-client<9,>=8
|
|
47
|
+
Requires-Dist: visidata<4,>=3
|
|
48
|
+
Description-Content-Type: text/markdown
|
|
49
|
+
|
|
50
|
+
# Jusi
|
|
51
|
+
|
|
52
|
+
Jusi is the Python backend for notebook-style execution used by the `jusivim` Vim/Neovim plugin.
|
|
53
|
+
|
|
54
|
+
It is responsible for:
|
|
55
|
+
|
|
56
|
+
- kernel lifecycle management
|
|
57
|
+
- notebook execution coordination
|
|
58
|
+
- per-cell client lifecycle
|
|
59
|
+
- plugin handler supervision
|
|
60
|
+
- protocol events and transport metadata for the editor side
|
|
61
|
+
|
|
62
|
+
Jusi is designed as part of a two-component system:
|
|
63
|
+
|
|
64
|
+
- `jusivim` editor plugin
|
|
65
|
+
- Jusi backend
|
|
66
|
+
|
|
67
|
+
The backend may run locally or remotely depending on the selected session target.
|
|
68
|
+
|
|
69
|
+
## Entrypoints
|
|
70
|
+
|
|
71
|
+
Primary editor-facing entrypoint:
|
|
72
|
+
|
|
73
|
+
- backend root process: `python -m jusi`
|
|
74
|
+
|
|
75
|
+
Internal/support entrypoints used by the backend and `jusivim`:
|
|
76
|
+
|
|
77
|
+
- native terminal attach: `python -m jusi client-process terminal-attach`
|
|
78
|
+
- plugin runtime starter: `python -m jusi plugin-runtime`
|
|
79
|
+
- transcript runtime entrypoint: `python -m jusi client-runtime`
|
|
80
|
+
|
|
81
|
+
Normal usage is through `jusivim`, which starts and talks to the backend over the Jusi protocol.
|
|
82
|
+
|
|
83
|
+
## Protocol Features
|
|
84
|
+
|
|
85
|
+
The backend protocol supports:
|
|
86
|
+
|
|
87
|
+
- session start and attach
|
|
88
|
+
- cell execution
|
|
89
|
+
- interrupt and input reply
|
|
90
|
+
- disconnect and reconnect
|
|
91
|
+
- client inspection and shutdown
|
|
92
|
+
- structured handler messaging for plugin follow-up and completion
|
|
93
|
+
- native terminal transport advertisement for interactive handlers
|
|
94
|
+
|
|
95
|
+
Session metadata may also include:
|
|
96
|
+
|
|
97
|
+
- `plugin_specs`
|
|
98
|
+
- editor-facing presentation defaults keyed by magic name
|
|
99
|
+
- `palette`
|
|
100
|
+
- editor-facing plugin creation metadata keyed by magic name
|
|
101
|
+
|
|
102
|
+
Cell metadata may include:
|
|
103
|
+
|
|
104
|
+
- `presentation`
|
|
105
|
+
- authoritative post-handoff presentation metadata for an executed cell
|
|
106
|
+
- `runtime_mode`
|
|
107
|
+
- backend-owned runtime mode such as `transcript` or `handler`
|
|
108
|
+
|
|
109
|
+
## Repository Layout
|
|
110
|
+
|
|
111
|
+
- `src/jusi/domain/`
|
|
112
|
+
- core models and policies
|
|
113
|
+
- `src/jusi/application/`
|
|
114
|
+
- use cases and service interfaces
|
|
115
|
+
- `src/jusi/infrastructure/`
|
|
116
|
+
- Jupyter/runtime integration and process management
|
|
117
|
+
- `src/jusi/interfaces/`
|
|
118
|
+
- protocol parsing and server entrypoints
|
|
119
|
+
- `src/jusi_vd/`
|
|
120
|
+
- bundled first-party `%%vd` plugin
|
|
121
|
+
- `docs/`
|
|
122
|
+
- protocol and architecture reference
|
|
123
|
+
- `tests/`
|
|
124
|
+
- backend test suite
|
|
125
|
+
|
|
126
|
+
## Documentation
|
|
127
|
+
|
|
128
|
+
- [Protocol](docs/protocol.md)
|
|
129
|
+
- [Session Lifecycle](docs/session-lifecycle.md)
|
|
130
|
+
- [Plugin Contract](docs/plugins.md)
|
|
131
|
+
- [Architecture](docs/architecture.md)
|
|
132
|
+
- [Backend Map](docs/backend-map.md)
|
|
133
|
+
|
|
134
|
+
## Contributing
|
|
135
|
+
|
|
136
|
+
Development workflow and contributor notes live in [CONTRIBUTING.md](CONTRIBUTING.md).
|
jusi-0.1.0/README.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Jusi
|
|
2
|
+
|
|
3
|
+
Jusi is the Python backend for notebook-style execution used by the `jusivim` Vim/Neovim plugin.
|
|
4
|
+
|
|
5
|
+
It is responsible for:
|
|
6
|
+
|
|
7
|
+
- kernel lifecycle management
|
|
8
|
+
- notebook execution coordination
|
|
9
|
+
- per-cell client lifecycle
|
|
10
|
+
- plugin handler supervision
|
|
11
|
+
- protocol events and transport metadata for the editor side
|
|
12
|
+
|
|
13
|
+
Jusi is designed as part of a two-component system:
|
|
14
|
+
|
|
15
|
+
- `jusivim` editor plugin
|
|
16
|
+
- Jusi backend
|
|
17
|
+
|
|
18
|
+
The backend may run locally or remotely depending on the selected session target.
|
|
19
|
+
|
|
20
|
+
## Entrypoints
|
|
21
|
+
|
|
22
|
+
Primary editor-facing entrypoint:
|
|
23
|
+
|
|
24
|
+
- backend root process: `python -m jusi`
|
|
25
|
+
|
|
26
|
+
Internal/support entrypoints used by the backend and `jusivim`:
|
|
27
|
+
|
|
28
|
+
- native terminal attach: `python -m jusi client-process terminal-attach`
|
|
29
|
+
- plugin runtime starter: `python -m jusi plugin-runtime`
|
|
30
|
+
- transcript runtime entrypoint: `python -m jusi client-runtime`
|
|
31
|
+
|
|
32
|
+
Normal usage is through `jusivim`, which starts and talks to the backend over the Jusi protocol.
|
|
33
|
+
|
|
34
|
+
## Protocol Features
|
|
35
|
+
|
|
36
|
+
The backend protocol supports:
|
|
37
|
+
|
|
38
|
+
- session start and attach
|
|
39
|
+
- cell execution
|
|
40
|
+
- interrupt and input reply
|
|
41
|
+
- disconnect and reconnect
|
|
42
|
+
- client inspection and shutdown
|
|
43
|
+
- structured handler messaging for plugin follow-up and completion
|
|
44
|
+
- native terminal transport advertisement for interactive handlers
|
|
45
|
+
|
|
46
|
+
Session metadata may also include:
|
|
47
|
+
|
|
48
|
+
- `plugin_specs`
|
|
49
|
+
- editor-facing presentation defaults keyed by magic name
|
|
50
|
+
- `palette`
|
|
51
|
+
- editor-facing plugin creation metadata keyed by magic name
|
|
52
|
+
|
|
53
|
+
Cell metadata may include:
|
|
54
|
+
|
|
55
|
+
- `presentation`
|
|
56
|
+
- authoritative post-handoff presentation metadata for an executed cell
|
|
57
|
+
- `runtime_mode`
|
|
58
|
+
- backend-owned runtime mode such as `transcript` or `handler`
|
|
59
|
+
|
|
60
|
+
## Repository Layout
|
|
61
|
+
|
|
62
|
+
- `src/jusi/domain/`
|
|
63
|
+
- core models and policies
|
|
64
|
+
- `src/jusi/application/`
|
|
65
|
+
- use cases and service interfaces
|
|
66
|
+
- `src/jusi/infrastructure/`
|
|
67
|
+
- Jupyter/runtime integration and process management
|
|
68
|
+
- `src/jusi/interfaces/`
|
|
69
|
+
- protocol parsing and server entrypoints
|
|
70
|
+
- `src/jusi_vd/`
|
|
71
|
+
- bundled first-party `%%vd` plugin
|
|
72
|
+
- `docs/`
|
|
73
|
+
- protocol and architecture reference
|
|
74
|
+
- `tests/`
|
|
75
|
+
- backend test suite
|
|
76
|
+
|
|
77
|
+
## Documentation
|
|
78
|
+
|
|
79
|
+
- [Protocol](docs/protocol.md)
|
|
80
|
+
- [Session Lifecycle](docs/session-lifecycle.md)
|
|
81
|
+
- [Plugin Contract](docs/plugins.md)
|
|
82
|
+
- [Architecture](docs/architecture.md)
|
|
83
|
+
- [Backend Map](docs/backend-map.md)
|
|
84
|
+
|
|
85
|
+
## Contributing
|
|
86
|
+
|
|
87
|
+
Development workflow and contributor notes live in [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
# Jusi Backend Architecture
|
|
2
|
+
|
|
3
|
+
## Goal
|
|
4
|
+
|
|
5
|
+
Jusi is the standalone backend process for notebook execution used by the `jusivim` editor plugin.
|
|
6
|
+
|
|
7
|
+
## Design Principles
|
|
8
|
+
|
|
9
|
+
- backend domain logic must not depend on Vim rendering details
|
|
10
|
+
- transport is an adapter concern
|
|
11
|
+
- state transitions must be explicit and observable
|
|
12
|
+
- protocol must stay stable enough for editor/backend coordination
|
|
13
|
+
- deployment is conceptually two-component:
|
|
14
|
+
- `jusivim` editor plugin
|
|
15
|
+
- Jusi backend
|
|
16
|
+
|
|
17
|
+
## Deployment Direction
|
|
18
|
+
|
|
19
|
+
- the editor plugin starts the backend
|
|
20
|
+
- backend is not treated as a separately user-managed daemon in the normal workflow
|
|
21
|
+
- backend may run locally or remotely depending on workflow
|
|
22
|
+
- remote support does not require a third mandatory user-facing helper component
|
|
23
|
+
|
|
24
|
+
## Runtime Vocabulary
|
|
25
|
+
|
|
26
|
+
Use these terms consistently:
|
|
27
|
+
|
|
28
|
+
- `backend root process`
|
|
29
|
+
- the main `jusi` process started by the editor plugin
|
|
30
|
+
- entrypoint: `python -m jusi`
|
|
31
|
+
- `session runtime state`
|
|
32
|
+
- in-memory supervision state held by the backend root process for the session
|
|
33
|
+
- tracks live per-session resources rather than acting as a multi-session registry
|
|
34
|
+
- `client runtime`
|
|
35
|
+
- a backend runtime entrypoint used for transcript-host compatibility paths
|
|
36
|
+
- entrypoint: `python -m jusi client-runtime`
|
|
37
|
+
- normal notebook execution uses backend-owned in-process transcript state rather than a dedicated client-runtime child
|
|
38
|
+
- `kernel handle`
|
|
39
|
+
- the execution-side resource for the session
|
|
40
|
+
- may be a managed child process, an attached external connection, or another runtime handle
|
|
41
|
+
|
|
42
|
+
The backend-side single-session structure is not a `registry`.
|
|
43
|
+
That word suggests one process indexing many independent session records, which is not the backend shape here.
|
|
44
|
+
|
|
45
|
+
## Session Model
|
|
46
|
+
|
|
47
|
+
Backend core keeps explicit session `target` and nothing more in the durable session record:
|
|
48
|
+
|
|
49
|
+
- `source`
|
|
50
|
+
- `alias`
|
|
51
|
+
- `kind`
|
|
52
|
+
- `value`
|
|
53
|
+
- `config`
|
|
54
|
+
|
|
55
|
+
Interpretation:
|
|
56
|
+
|
|
57
|
+
- `target` describes what session/kernel environment the backend starts or attaches to
|
|
58
|
+
- backend residence is an editor-plugin transport concern
|
|
59
|
+
- sessions are durable/reconnectable by default
|
|
60
|
+
- one backend root process supervises one durable session record
|
|
61
|
+
- that same root process may also supervise multiple child client runtimes for that session
|
|
62
|
+
- the editor plugin may keep the real persisted reconnectables list across editor lifetimes
|
|
63
|
+
- durable ids are backend-generated with high-entropy `sess-...` values rather than local counters
|
|
64
|
+
|
|
65
|
+
## Runtime Slice
|
|
66
|
+
|
|
67
|
+
- `start_session` starts a backend-owned session
|
|
68
|
+
- `attach_session` exists as a real backend path, but is intentionally narrow:
|
|
69
|
+
- only `target.kind=connection_file` is executable today
|
|
70
|
+
- managed runtime supports that same narrow attach slice against a real external connection file
|
|
71
|
+
- managed attached sessions use a small connection-file sidecar registry to coordinate stop fanout across peer Jusi root processes
|
|
72
|
+
- that same sidecar carries the shared disconnect timeout deadline for attached peers
|
|
73
|
+
- `execute_cell` allocates the real execution client directly for that cell
|
|
74
|
+
- `disconnect_session` preserves durable session identity as `disconnected`
|
|
75
|
+
- `reconnect_session` restores the durable session linkage without inventing false execution ownership
|
|
76
|
+
- backend root process drives editor-link liveness with backend-issued healthchecks and converts missed replies into the normal disconnect/timeout path
|
|
77
|
+
- session-level health and teardown decisions remain centralized in the backend root process rather than delegated to clients making independent suicide decisions
|
|
78
|
+
|
|
79
|
+
## Layering
|
|
80
|
+
|
|
81
|
+
### Domain
|
|
82
|
+
|
|
83
|
+
Owns:
|
|
84
|
+
|
|
85
|
+
- session state
|
|
86
|
+
- session target
|
|
87
|
+
- cell execution state
|
|
88
|
+
|
|
89
|
+
### Application
|
|
90
|
+
|
|
91
|
+
Owns use cases:
|
|
92
|
+
|
|
93
|
+
- start session
|
|
94
|
+
- attach session
|
|
95
|
+
- reconnect session
|
|
96
|
+
- execute cell
|
|
97
|
+
- interrupt execution
|
|
98
|
+
- stop session
|
|
99
|
+
|
|
100
|
+
### Infrastructure
|
|
101
|
+
|
|
102
|
+
Implements:
|
|
103
|
+
|
|
104
|
+
- Jupyter/runtime integration
|
|
105
|
+
- process supervision
|
|
106
|
+
- stdio transport loop
|
|
107
|
+
- persistence if introduced later
|
|
108
|
+
|
|
109
|
+
### Interfaces
|
|
110
|
+
|
|
111
|
+
Owns:
|
|
112
|
+
|
|
113
|
+
- protocol parsing
|
|
114
|
+
- event encoding
|
|
115
|
+
- backend entrypoints
|
|
116
|
+
|
|
117
|
+
## Plugin Direction
|
|
118
|
+
|
|
119
|
+
Handler/plugin support is not modeled as “just another runtime” or “just a renderer taxonomy”.
|
|
120
|
+
|
|
121
|
+
- a plugin has at least:
|
|
122
|
+
- magic command definition
|
|
123
|
+
- display handler
|
|
124
|
+
- backend core provides:
|
|
125
|
+
- session/client lifecycle framing
|
|
126
|
+
- plugin discoverability/loading
|
|
127
|
+
- status consistency
|
|
128
|
+
- a structured plugin/editor communication channel
|
|
129
|
+
- plugin display handlers and their runtime processes own:
|
|
130
|
+
- plugin-specific interaction logic
|
|
131
|
+
- follow-up/completion semantics
|
|
132
|
+
- mode transitions, for example VisiData-like navigation into shell-like interaction
|
|
133
|
+
|
|
134
|
+
See [plugins.md](plugins.md) for the plugin contract.
|
|
135
|
+
|
|
136
|
+
## Handler Activation
|
|
137
|
+
|
|
138
|
+
Handler-owned execution follows this model:
|
|
139
|
+
|
|
140
|
+
- every cell still enters through the Jupyter kernel
|
|
141
|
+
- handler takeover is driven by a kernel-emitted Jusi handoff mime payload
|
|
142
|
+
- backend root process validates that handoff against the registered handler spec
|
|
143
|
+
- backend root process can replace the initial `transcript` client runtime with a `handler` client runtime for that cell/client
|
|
144
|
+
- that handler runtime owns the live plugin handler for that client lifetime
|
|
145
|
+
- normal handler exit maps to cell status `done`
|
|
146
|
+
- unexpected handler death maps to cell status `error`
|
|
147
|
+
- interrupt for handler-owned cells is a structured handler interrupt first
|
|
148
|
+
- follow-up/completion apply only while the handler is alive
|
|
149
|
+
|
|
150
|
+
Handler startup context is intentionally small:
|
|
151
|
+
|
|
152
|
+
- `notebook_id`
|
|
153
|
+
- `session_id`
|
|
154
|
+
- `client_id`
|
|
155
|
+
- `cell_id`
|
|
156
|
+
- `handler_id`
|
|
157
|
+
- explicit `magic_name`
|
|
158
|
+
- raw kernel handoff payload and metadata
|
|
159
|
+
|
|
160
|
+
The backend root process remains the router and supervisor for handler/editor traffic.
|
|
161
|
+
|
|
162
|
+
## Native Terminal Transport
|
|
163
|
+
|
|
164
|
+
Interactive terminal-hosted plugins use native terminal attachment rather than notebook-buffer terminal emulation.
|
|
165
|
+
|
|
166
|
+
- backend root process still owns session and handler lifecycle
|
|
167
|
+
- handler-owned clients use native terminal as the default editor plane
|
|
168
|
+
- when a handler becomes terminal-backed, backend provisions a dedicated terminal client substrate for that `client_id`
|
|
169
|
+
- the editor plugin receives terminal-client metadata from backend and launches a real terminal buffer against that process command
|
|
170
|
+
- terminal transport flows through that native terminal job attachment, not through `handler_message terminal_bytes`
|
|
171
|
+
- `handler_message` stays available for:
|
|
172
|
+
- follow-up
|
|
173
|
+
- completion
|
|
174
|
+
- plugin commands
|
|
175
|
+
- other control semantics that are not raw terminal traffic
|
|
176
|
+
|
|
177
|
+
Terminal-backed clients still remain within the normal Jusi client model:
|
|
178
|
+
|
|
179
|
+
- `session_id`
|
|
180
|
+
- `client_id`
|
|
181
|
+
- optional `handler_id`
|
|
182
|
+
|
|
183
|
+
The terminal bridge/client runtime maps back to those ids so stop/disconnect/cleanup stay centralized in backend supervision.
|
|
184
|
+
|
|
185
|
+
Backend advertises terminal-backed clients explicitly through normal client transport metadata:
|
|
186
|
+
|
|
187
|
+
- cell-owned active client remains a normal backend client
|
|
188
|
+
- backend emits client metadata indicating:
|
|
189
|
+
- transport kind `native_terminal`
|
|
190
|
+
- attach command for the terminal buffer
|
|
191
|
+
- the owning `session_id`
|
|
192
|
+
- the owning `client_id`
|
|
193
|
+
- optional `handler_id`
|
|
194
|
+
|
|
195
|
+
`inspect_client` remains a debug/recovery seam rather than the hot rendering path for native-terminal clients.
|
|
196
|
+
|
|
197
|
+
## Runtime Ownership
|
|
198
|
+
|
|
199
|
+
Backend root owns:
|
|
200
|
+
|
|
201
|
+
- in-process transcript state for plain kernel cells
|
|
202
|
+
- in-process handler control for live handler cells
|
|
203
|
+
|
|
204
|
+
The only remaining intentional child on the live plugin path is
|
|
205
|
+
`plugin-runtime`.
|