hyperview 0.2.0__tar.gz → 0.4.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 (84) hide show
  1. hyperview-0.4.0/.agents/skills/hyperview-cli/SKILL.md +88 -0
  2. hyperview-0.4.0/.agents/skills/hyperview-cli/references/commands.md +223 -0
  3. hyperview-0.4.0/.agents/skills/hyperview-cli/references/native-panels.md +138 -0
  4. hyperview-0.4.0/.agents/skills/hyperview-cli/references/plugins.md +186 -0
  5. {hyperview-0.2.0 → hyperview-0.4.0}/.gitignore +11 -1
  6. {hyperview-0.2.0 → hyperview-0.4.0}/LICENSE +1 -1
  7. {hyperview-0.2.0 → hyperview-0.4.0}/PKG-INFO +95 -36
  8. hyperview-0.4.0/README.md +186 -0
  9. {hyperview-0.2.0 → hyperview-0.4.0}/pyproject.toml +12 -1
  10. hyperview-0.4.0/src/hyperview/_version.py +24 -0
  11. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/api.py +46 -24
  12. hyperview-0.4.0/src/hyperview/cli.py +799 -0
  13. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/core/dataset.py +342 -186
  14. hyperview-0.4.0/src/hyperview/core/selection.py +309 -0
  15. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/embeddings/__init__.py +2 -3
  16. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/embeddings/engine.py +101 -4
  17. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/embeddings/pipelines.py +108 -39
  18. hyperview-0.4.0/src/hyperview/embeddings/projection.py +467 -0
  19. hyperview-0.4.0/src/hyperview/embeddings/providers/lancedb_providers.py +373 -0
  20. hyperview-0.4.0/src/hyperview/extensions.py +230 -0
  21. hyperview-0.4.0/src/hyperview/runtime.py +967 -0
  22. hyperview-0.4.0/src/hyperview/server/app.py +954 -0
  23. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/server/static/404/index.html +1 -1
  24. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/server/static/404.html +1 -1
  25. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/server/static/__next.__PAGE__.txt +2 -2
  26. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/server/static/__next._full.txt +3 -3
  27. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/server/static/__next._head.txt +1 -1
  28. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/server/static/__next._index.txt +2 -2
  29. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/server/static/__next._tree.txt +2 -2
  30. hyperview-0.2.0/src/hyperview/server/static/_next/static/chunks/462c5e072cd14e02.css → hyperview-0.4.0/src/hyperview/server/static/_next/static/chunks/4899f901f4ca16ad.css +1 -1
  31. hyperview-0.4.0/src/hyperview/server/static/_next/static/chunks/52ce757ecb4458ef.js +8 -0
  32. hyperview-0.4.0/src/hyperview/server/static/_next/static/chunks/661a08547c83f565.js +407 -0
  33. hyperview-0.4.0/src/hyperview/server/static/_next/static/chunks/eac713f252f03efd.js +1 -0
  34. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/server/static/_not-found/__next._full.txt +2 -2
  35. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/server/static/_not-found/__next._head.txt +1 -1
  36. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/server/static/_not-found/__next._index.txt +2 -2
  37. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/server/static/_not-found/__next._not-found.__PAGE__.txt +1 -1
  38. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/server/static/_not-found/__next._not-found.txt +1 -1
  39. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/server/static/_not-found/__next._tree.txt +2 -2
  40. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/server/static/_not-found/index.html +1 -1
  41. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/server/static/_not-found/index.txt +2 -2
  42. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/server/static/index.html +1 -1
  43. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/server/static/index.txt +3 -3
  44. hyperview-0.4.0/src/hyperview/skill_install.py +386 -0
  45. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/storage/backend.py +2 -1
  46. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/storage/lancedb_backend.py +154 -23
  47. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/storage/memory_backend.py +35 -6
  48. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/storage/schema.py +53 -13
  49. hyperview-0.4.0/src/hyperview/tools.py +217 -0
  50. hyperview-0.2.0/README.md +0 -131
  51. hyperview-0.2.0/src/hyperview/_version.py +0 -34
  52. hyperview-0.2.0/src/hyperview/cli.py +0 -314
  53. hyperview-0.2.0/src/hyperview/core/selection.py +0 -53
  54. hyperview-0.2.0/src/hyperview/embeddings/projection.py +0 -267
  55. hyperview-0.2.0/src/hyperview/embeddings/providers/lancedb_providers.py +0 -196
  56. hyperview-0.2.0/src/hyperview/server/app.py +0 -395
  57. hyperview-0.2.0/src/hyperview/server/static/_next/static/chunks/4543baba6321cb86.js +0 -301
  58. hyperview-0.2.0/src/hyperview/server/static/_next/static/chunks/7f11a0afb44e4703.js +0 -13
  59. hyperview-0.2.0/src/hyperview/server/static/_next/static/chunks/80cd550edf03d788.js +0 -1
  60. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/__init__.py +0 -0
  61. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/core/__init__.py +0 -0
  62. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/core/sample.py +0 -0
  63. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/embeddings/compute.py +0 -0
  64. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/embeddings/providers/__init__.py +0 -0
  65. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/server/__init__.py +0 -0
  66. {hyperview-0.2.0/src/hyperview/server/static/_next/static/u9HWgMoM1R5w0owC62Blr → hyperview-0.4.0/src/hyperview/server/static/_next/static/CKEuiDkzE3bKkDKRxIGUO}/_buildManifest.js +0 -0
  67. {hyperview-0.2.0/src/hyperview/server/static/_next/static/u9HWgMoM1R5w0owC62Blr → hyperview-0.4.0/src/hyperview/server/static/_next/static/CKEuiDkzE3bKkDKRxIGUO}/_clientMiddlewareManifest.json +0 -0
  68. {hyperview-0.2.0/src/hyperview/server/static/_next/static/u9HWgMoM1R5w0owC62Blr → hyperview-0.4.0/src/hyperview/server/static/_next/static/CKEuiDkzE3bKkDKRxIGUO}/_ssgManifest.js +0 -0
  69. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/server/static/_next/static/chunks/567993cf36cd4ab1.js +0 -0
  70. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/server/static/_next/static/chunks/86c1fc4cf542f408.js +0 -0
  71. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/server/static/_next/static/chunks/a6dad97d9634a72d.js +0 -0
  72. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/server/static/_next/static/chunks/a6dad97d9634a72d.js.map +0 -0
  73. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/server/static/_next/static/chunks/e954ba82c0a04100.js +0 -0
  74. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/server/static/_next/static/chunks/f29dd35a99c216ea.js +0 -0
  75. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/server/static/_next/static/chunks/turbopack-cb59e03a04a579d1.js +0 -0
  76. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/server/static/_next/static/media/1bffadaabf893a1e-s.7cd81963.woff2 +0 -0
  77. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/server/static/_next/static/media/2bbe8d2671613f1f-s.76dcb0b2.woff2 +0 -0
  78. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/server/static/_next/static/media/2c55a0e60120577a-s.2a48534a.woff2 +0 -0
  79. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/server/static/_next/static/media/5476f68d60460930-s.c995e352.woff2 +0 -0
  80. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/server/static/_next/static/media/83afe278b6a6bb3c-s.p.3a6ba036.woff2 +0 -0
  81. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/server/static/_next/static/media/9c72aa0f40e4eef8-s.18a48cbc.woff2 +0 -0
  82. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/server/static/_next/static/media/ad66f9afd8947f86-s.7a40eb73.woff2 +0 -0
  83. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/storage/__init__.py +0 -0
  84. {hyperview-0.2.0 → hyperview-0.4.0}/src/hyperview/storage/config.py +0 -0
@@ -0,0 +1,88 @@
1
+ ---
2
+ name: hyperview-cli
3
+ description: Use HyperView's control-plane CLI for hyperview serve, dataset create, workspace create, embeddings compute, layouts compute, runtime jobs, ui layout set, ui selection set, ui panel add, extension add, tools run, native module panels, backend tools, and local HyperView plugin workflows.
4
+ license: MIT
5
+ compatibility: Requires Python 3.10+ and the hyperview CLI (`uv tool install hyperview`). Runtime-control commands require a running HyperView server.
6
+ metadata:
7
+ homepage: https://github.com/Hyper3Labs/HyperView
8
+ ---
9
+
10
+ # HyperView CLI
11
+
12
+ Use the `hyperview` CLI as the primary agent interface to HyperView.
13
+
14
+ ## Install the Skill
15
+
16
+ For users who installed HyperView from a package, install or refresh this agent skill with:
17
+
18
+ ```bash
19
+ uv tool install --upgrade hyperview && hyperview skill install
20
+ ```
21
+
22
+ Re-running `hyperview skill install` replaces old HyperView skill copies. By default this installs into detected agent locations plus the universal `~/.agents/skills/` fallback. Limit targets with repeated `--agent` flags such as `--agent claude-code`, `--agent github-copilot`, `--agent cursor`, or `--agent universal`; use `--all-known` when you explicitly want every known agent profile. Use `--scope project` to write project-local skills such as `.claude/skills/`, `.github/skills/`, `.cursor/skills/`, or `.agents/skills/` depending on the selected agent.
23
+
24
+ ## When to use it
25
+
26
+ - Create or inspect a persisted dataset.
27
+ - Create or inspect a workspace.
28
+ - Set the single dataset attached to a workspace.
29
+ - Start or control a running HyperView runtime.
30
+ - Register a custom embedding provider.
31
+ - Compute embeddings or layouts without restarting the UI.
32
+ - Switch the active workspace, layout, or selection in a running session.
33
+ - Add or remove agent-authored native module panels from local files.
34
+ - Create, install, reload, or test a local plugin/extension with Python backend tools and a frontend panel.
35
+
36
+ ## Core workflow
37
+
38
+ 1. Create a workspace, usually with its dataset in the same command.
39
+ 2. Create the dataset if it does not exist yet.
40
+ 3. Start or target a running `hyperview serve` runtime.
41
+ 4. Register a provider if needed.
42
+ 5. Submit embedding or layout jobs through the runtime.
43
+ 6. Use `hyperview ui ...` commands to switch what the live UI shows.
44
+ 7. For plugins, create an extension folder and install it into the running workspace.
45
+
46
+ ## Current model
47
+
48
+ - One dataset per workspace.
49
+ - Datasets are created separately from workspaces.
50
+ - The workspace owns the dataset selection.
51
+ - `ui layout set` changes the active layout and the frontend opens the matching built-in scatter panel.
52
+ - Runtime-added panels can be typed scatter instances bound to explicit layout keys, or native module panels loaded into the host React tree.
53
+ - Runtime-added panels use the stable `HyperViewPanelSDK` surface on `window`.
54
+ - Plugins are repo-local extension folders with `extension.toml`, optional Python tools, and optional native panel modules.
55
+ - Plugin panels call backend tools through `HyperViewPanelSDK.hooks.useTool()` or `hyperview tools run`.
56
+ - In practice, create datasets and workspaces before starting the runtime for that workspace. The current runtime loads workspace registry state on startup.
57
+
58
+ Read [references/commands.md](references/commands.md) for command recipes covering datasets, workspaces, providers, embeddings, layouts, runtime UI state, selections, and jobs.
59
+ Read [references/native-panels.md](references/native-panels.md) when the task involves authoring or registering a custom panel.
60
+ Read [references/plugins.md](references/plugins.md) when the task involves backend-plus-frontend plugins/extensions.
61
+
62
+ ## Agent guidance
63
+
64
+ - Prefer CLI commands over direct file edits when the goal is to operate a running HyperView session.
65
+ - Treat dataset creation and workspace binding as separate steps when needed: `dataset create ...` creates persisted data, `workspace create --dataset ...` or `workspace set-dataset ...` binds it to a workspace.
66
+ - Prefer `workspace create --dataset ...` over separate create and dataset-attach calls when setting up a new workspace.
67
+ - For custom module panels, have the agent write panel modules outside the app source tree, for example under `agent-context/`, and then add them through `hyperview ui panel add --module-file ...`.
68
+ - For side-by-side embedding comparisons, add typed scatter panels through `hyperview ui panel add --kind scatter --layout-key ... --reference-panel-id ... --direction right`.
69
+ - For plugins, prefer `.hyperview/extensions/<plugin-name>/` in the project root. `hyperview serve` auto-discovers those folders and attaches them to the launched workspace, so they can live in version control with the dataset/project code.
70
+ - Tools can write files under `ctx.extension_storage` and return `ctx.url_for(path)` for panel-renderable artifact URLs.
71
+ - Keep plugins self-contained: `extension.toml`, `tools.py`, `panel.js` or `panel.jsx`, and any local assets in the same folder.
72
+ - Prefer `--json` output when chaining commands or inspecting results programmatically.
73
+ - Wait for embedding/layout jobs to finish before issuing layout-switch commands that depend on their results.
74
+ - Use `hyperview jobs list` or `hyperview jobs inspect <job-id>` if a compute command is long-running or you started it with `--no-wait`.
75
+ - For provider args, use repeated `--provider-arg key=value` flags.
76
+ - Treat the workspace as the durable unit. Changing datasets means setting a new workspace dataset, not switching among many datasets inside one workspace.
77
+ - Prefer native module panels over raw HTML. The panel system no longer relies on iframes.
78
+ - The first `uv run hyperview ...` invocation in a session can take 30+ seconds (torch/datasets imports). Allow generous timeouts and avoid sending SIGINT.
79
+
80
+ ## Inspecting runtime state
81
+
82
+ The runtime exposes JSON discovery endpoints alongside the CLI. Use them to obtain layout keys, sample IDs, and registered tools/panels for follow-up commands:
83
+
84
+ - `GET /api/runtime?workspace_id=<ws>` &mdash; full snapshot. Read `workspace.ui.active_layout_key`, `workspace.ui.selected_ids`, `workspace.ui.custom_panels[*].data.module_src`, and registered `extensions`/`tools`.
85
+ - `GET /api/embeddings?workspace_id=<ws>` &mdash; the active or default layout, including `layout_key`, `geometry`, and sample `ids`. Use the returned `layout_key` for `hyperview ui layout set --layout-key ...` and pick from `ids` for `hyperview ui selection set --ids ...`.
86
+ - `GET /api/tools` &mdash; registered tool URIs (also returned by `hyperview tools list --json`).
87
+
88
+ Layout keys encode geometry and dimension as a substring (e.g. `..._euclidean_umap__2d_...`, `..._hyperbolic_umap__3d_...`). Match on those substrings when filtering by geometry/dimension.
@@ -0,0 +1,223 @@
1
+ # Commands
2
+
3
+ Use `--json` when chaining commands or inspecting results programmatically.
4
+
5
+ ## Skill Installer
6
+
7
+ Install the packaged HyperView agent skill for detected agents plus the universal fallback:
8
+
9
+ ```bash
10
+ hyperview skill install
11
+ ```
12
+
13
+ Refresh installed copies after upgrading HyperView by running install again:
14
+
15
+ ```bash
16
+ uv tool install --upgrade hyperview && hyperview skill install
17
+ ```
18
+
19
+ Limit to specific agent targets:
20
+
21
+ ```bash
22
+ hyperview skill install --agent claude-code --yes # ~/.claude/skills/
23
+ hyperview skill install --agent github-copilot --yes # ~/.copilot/skills/
24
+ hyperview skill install --agent cursor --yes # ~/.cursor/skills/
25
+ hyperview skill install --agent universal --yes # ~/.agents/skills/
26
+ ```
27
+
28
+ Install for every known profile explicitly:
29
+
30
+ ```bash
31
+ hyperview skill install --all-known --yes
32
+ ```
33
+
34
+ Install into a repo for project-shared discovery:
35
+
36
+ ```bash
37
+ hyperview skill install --scope project --agent github-copilot --yes # .github/skills/
38
+ hyperview skill install --scope project --agent claude-code --yes # .claude/skills/
39
+ hyperview skill install --scope project --agent cursor --yes # .cursor/skills/
40
+ hyperview skill install --scope project --agent universal --yes # .agents/skills/
41
+ ```
42
+
43
+ Preview destinations without writing files:
44
+
45
+ ```bash
46
+ hyperview skill install --dry-run --json
47
+ ```
48
+
49
+ This is different from `hyperview extension add`, which installs a runtime plugin into a running HyperView workspace.
50
+
51
+ ## Datasets and Workspaces
52
+
53
+ Create a persisted dataset from Hugging Face:
54
+
55
+ ```bash
56
+ hyperview dataset create cifar10_demo \
57
+ --hf-dataset uoft-cs/cifar10 \
58
+ --split train \
59
+ --image-key img \
60
+ --label-key label
61
+ ```
62
+
63
+ Create a persisted dataset from a local image directory:
64
+
65
+ ```bash
66
+ hyperview dataset create local_assets_demo \
67
+ --images-dir assets
68
+ ```
69
+
70
+ Create a workspace with its dataset in one step:
71
+
72
+ ```bash
73
+ hyperview workspace create research \
74
+ --dataset cifar10_demo \
75
+ --activate
76
+ ```
77
+
78
+ Change the dataset attached to a workspace:
79
+
80
+ ```bash
81
+ hyperview workspace set-dataset research imagenette_clip_20260411
82
+ ```
83
+
84
+ Start the runtime:
85
+
86
+ ```bash
87
+ hyperview serve --workspace research --dataset cifar10_demo --no-browser
88
+ ```
89
+
90
+ Check a running runtime:
91
+
92
+ ```bash
93
+ hyperview status --json
94
+ ```
95
+
96
+ ## Providers, Embeddings, and Layouts
97
+
98
+ Register a custom provider:
99
+
100
+ ```bash
101
+ hyperview provider register my-provider \
102
+ --import-path my_pkg.provider:MyProvider
103
+ ```
104
+
105
+ Compute checkpoint-backed embeddings and a layout:
106
+
107
+ ```bash
108
+ hyperview embeddings compute \
109
+ --workspace research \
110
+ --dataset cifar10_demo \
111
+ --provider my-provider \
112
+ --model-id experiment-a \
113
+ --checkpoint /path/to/checkpoint.json \
114
+ --layout euclidean:2d
115
+ ```
116
+
117
+ Add a new layout to an existing embedding space:
118
+
119
+ ```bash
120
+ hyperview layouts compute \
121
+ --workspace research \
122
+ --dataset cifar10_demo \
123
+ --space-key <space-key> \
124
+ --layout euclidean:3d
125
+ ```
126
+
127
+ Inspect long-running jobs:
128
+
129
+ ```bash
130
+ hyperview jobs list --json
131
+ hyperview jobs inspect <job-id> --json
132
+ ```
133
+
134
+ ## Runtime UI
135
+
136
+ Discover an existing layout key and sample IDs before mutating runtime state:
137
+
138
+ ```bash
139
+ curl --max-time 2 'http://127.0.0.1:6262/api/runtime?workspace_id=research' | jq '.workspace.ui'
140
+ curl --max-time 2 'http://127.0.0.1:6262/api/embeddings?workspace_id=research' | jq '{layout_key, geometry, ids: (.ids[:3])}'
141
+ ```
142
+
143
+ If no layout exists yet (`active_layout_key` is `null` and `/api/embeddings` returns nothing), create one with `hyperview embeddings compute ... --layout euclidean:2d` (creates embeddings + layout) or `hyperview layouts compute ... --space-key <space-key> --layout euclidean:2d` (adds a layout to an existing embedding space).
144
+
145
+ Switch the live UI to a layout and selection:
146
+
147
+ ```bash
148
+ hyperview ui layout set --workspace research --layout-key <layout-key>
149
+ hyperview ui selection set --workspace research --ids sample-1,sample-8
150
+ ```
151
+
152
+ `--layout-key` must be an existing layout (use the `layout_key` returned by `/api/embeddings`). When the chosen layout is Euclidean 3D, HyperView opens or focuses the Euclidean 3D scatter panel.
153
+
154
+ Add a native panel from a local JavaScript module file:
155
+
156
+ ```bash
157
+ hyperview ui panel add \
158
+ --workspace research \
159
+ --panel-id label-histogram \
160
+ --title "Label Histogram" \
161
+ --position right \
162
+ --module-file agent-context/panels/label-histogram/index.js
163
+ ```
164
+
165
+ Add two runtime scatter panels bound to explicit layouts, side by side:
166
+
167
+ ```bash
168
+ hyperview ui panel add \
169
+ --workspace research \
170
+ --panel-id uncha-poincare \
171
+ --title "UNCHA" \
172
+ --kind scatter \
173
+ --layout-key <uncha-poincare-layout-key> \
174
+ --position center
175
+
176
+ hyperview ui panel add \
177
+ --workspace research \
178
+ --panel-id hycoclip-poincare \
179
+ --title "HyCoCLIP" \
180
+ --kind scatter \
181
+ --layout-key <hycoclip-poincare-layout-key> \
182
+ --position center \
183
+ --reference-panel-id uncha-poincare \
184
+ --direction right
185
+ ```
186
+
187
+ Remove a runtime panel by id:
188
+
189
+ ```bash
190
+ hyperview ui panel remove \
191
+ --workspace research \
192
+ --panel-id hycoclip-poincare
193
+ ```
194
+
195
+ ## Plugins and Tools
196
+
197
+ Create backend-plus-frontend plugins under `.hyperview/extensions/<name>/` so they can be versioned with the project and auto-attached on `hyperview serve`. For a server that is already running, install one explicitly:
198
+
199
+ ```bash
200
+ hyperview extension add .hyperview/extensions/selection-profile \
201
+ --workspace research \
202
+ --json
203
+ ```
204
+
205
+ Inspect and run installed plugin tools:
206
+
207
+ ```bash
208
+ hyperview extension list --json
209
+ # => {"extensions":[{"name":"selection-profile","folder":"...","workspace_id":"research","panels":["selection-profile"],"tools":[{"uri":"selection_profile.summarize",...}]}]}
210
+
211
+ hyperview tools list --json
212
+ hyperview tools run selection_profile.summarize \
213
+ --workspace research \
214
+ --param 'sample_ids=["sample-1","sample-8"]' \
215
+ --json
216
+ ```
217
+
218
+ `--param key=value` parses the value as JSON, then falls back to a raw string if JSON parsing fails. Use:
219
+
220
+ - `--param 'top_k=5'` for numbers
221
+ - `--param 'enabled=true'` for booleans
222
+ - `--param 'name=foo'` for short strings (raw fallback) or `--param 'name="foo bar"'` for explicit JSON strings
223
+ - `--param 'ids=["a","b"]'` or `--param 'opts={"k":1}'` for arrays/objects
@@ -0,0 +1,138 @@
1
+ # Native Panels
2
+
3
+ Use this guide when writing a custom HyperView panel that should behave like a native built-in panel. If the panel also needs backend Python tools, use [plugins.md](plugins.md) instead.
4
+
5
+ ## Model
6
+
7
+ HyperView no longer treats runtime-added panels as iframe HTML pages.
8
+
9
+ Runtime panels are now native module panels:
10
+
11
+ - the user writes a local JavaScript module file
12
+ - the module is registered through the CLI with `hyperview ui panel add --module-file ...`
13
+ - HyperView loads that module directly into the host React tree
14
+ - the module can use the stable `window.HyperViewPanelSDK` surface
15
+
16
+ Built-in panels and runtime panels now share the same host panel system.
17
+
18
+ ## Panel Module Contract
19
+
20
+ A runtime panel module must export either:
21
+
22
+ - a default React component
23
+ - or a named export `Panel`
24
+
25
+ The module runs in the browser and should use the SDK from `window.HyperViewPanelSDK`.
26
+
27
+ Minimal example:
28
+
29
+ ```js
30
+ const sdk = globalThis.HyperViewPanelSDK;
31
+ const { React, components, hooks } = sdk;
32
+ const { Panel, PanelToolbar } = components;
33
+ const { usePanelRuntimeState } = hooks;
34
+
35
+ export default function MyPanel() {
36
+ const { runtimeDatasetName } = usePanelRuntimeState();
37
+
38
+ return React.createElement(
39
+ Panel,
40
+ { className: "h-full" },
41
+ React.createElement(PanelToolbar, {
42
+ items: [{ id: "dataset", label: "Dataset", value: runtimeDatasetName || "unknown" }],
43
+ }),
44
+ React.createElement("div", { style: { padding: 12 } }, "Hello from a native panel")
45
+ );
46
+ }
47
+ ```
48
+
49
+ ## Stable SDK Surface
50
+
51
+ Current global SDK fields:
52
+
53
+ - `React`
54
+ - `components.Panel`
55
+ - `components.PanelHeader`
56
+ - `components.PanelTitle`
57
+ - `components.PanelToolbar`
58
+ - `components.PanelToolbarButton`
59
+ - `components.PanelToolbarMenu`
60
+ - `hooks.usePanelClient()`
61
+ - `hooks.usePanelCommands()`
62
+ - `hooks.usePanelDatasetInfo()`
63
+ - `hooks.usePanelRuntimeState()`
64
+ - `hooks.usePanelSamples()`
65
+ - `hooks.usePanelSamplesView()`
66
+ - `hooks.usePanelSelection()`
67
+ - `hooks.usePanelUiState()`
68
+ - `hooks.useTool(uri)`
69
+ - `createClient(workspaceId)`
70
+
71
+ Important distinction:
72
+
73
+ - `usePanelSamplesView()` gives access to host-managed collection state and is the best hook for panels that should stay synchronized with the visible HyperView UI.
74
+ - `usePanelClient()` or `createClient()` is the escape hatch for direct backend reads and control-plane calls.
75
+ - `useTool(uri)` calls an installed backend tool registered by an extension and returns `{ loading, result, error, run, reset }`.
76
+
77
+ ### Hook return shapes
78
+
79
+ Verified against the current `panel-sdk` surface:
80
+
81
+ - `usePanelSelection()` → `{ selectedIds: string[], selectionSource: SelectionUpdateSource, setSelection(ids: string[], source?: SelectionUpdateSource): void, clearSelection(): void }`
82
+ - `usePanelCommands()` → `{ setLabelFilter, setHoveredId, clearLassoSelection, clearSelection(): void, setSelection(ids: string[], source?: SelectionUpdateSource): void, focusPanel(panelId: string): boolean, closePanel(panelId: string): boolean }`
83
+ - `usePanelRuntimeState()` → `{ activeWorkspaceId, runtimeDatasetName, activeLayoutKey, requestedLayoutKey, workspaces, customPanels }`
84
+ - `usePanelUiState()` → `{ sampleGridSize, setSampleGridSize, scatterLabelOverlayMode, setScatterLabelOverlayMode }`
85
+ - `usePanelDatasetInfo()` / `usePanelSamples()` / `usePanelSamplesView()` → host-managed dataset and view state
86
+ - `useTool(uri)` → `{ loading: boolean, result: TResult | null, error: string | null, run(params?): Promise<TResult | null>, reset(): void }`
87
+ - `usePanelClient()` → low-level client; pair with `createClient(workspaceId)` for direct API calls.
88
+
89
+ To clear the current selection from a panel use `usePanelSelection().clearSelection()` or `usePanelCommands().setSelection([])`.
90
+
91
+ ## Placement
92
+
93
+ Native runtime panels can be added in:
94
+
95
+ - `right`
96
+ - `bottom`
97
+ - `center`
98
+
99
+ Center placement lets a runtime panel behave like a normal center tab.
100
+
101
+ ## CLI Registration
102
+
103
+ Register a panel module into a running workspace:
104
+
105
+ ```bash
106
+ hyperview ui panel add \
107
+ --host 127.0.0.1 \
108
+ --port 6262 \
109
+ --workspace imagenette-cli-20260412 \
110
+ --panel-id native-label-histogram \
111
+ --title "Native Label Histogram" \
112
+ --position right \
113
+ --module-file agent-context/panels/native-label-histogram/index.js
114
+ ```
115
+
116
+ ## Verification
117
+
118
+ After `hyperview ui panel add ...`:
119
+
120
+ - `curl 'http://127.0.0.1:6262/api/runtime?workspace_id=<ws>'` should list the panel under `workspace.ui.custom_panels[*]` with `data.module_src` set to a `/api/panels/content/<ws>/<panel-id>/<file>` URL.
121
+ - Fetching `data.module_src` should return `application/javascript` with your module body.
122
+ - The panel should appear in the live UI in the requested `position` slot.
123
+
124
+ ## Good Practices
125
+
126
+ - Prefer native module panels over HTML or iframe content.
127
+ - Use `usePanelSamplesView()` for view-synchronized behavior.
128
+ - Use `usePanelCommands()` for host interactions such as label filtering or selection changes.
129
+ - Use `usePanelClient()` only for data that is not already available through the host state.
130
+ - Keep the panel self-contained under `agent-context/panels/<panel-name>/`.
131
+ - If the panel needs sibling assets, keep them next to the module and reference them with relative URLs.
132
+ - Do not render a second title/header inside a normal Dockview runtime panel unless there is a strong reason. Dockview already provides the tab title. Built-in center and runtime panels should usually start with the standardized `PanelToolbar` row.
133
+
134
+ ## Current Limitation
135
+
136
+ Runtime module panels should currently be authored as browser-loadable JavaScript modules.
137
+
138
+ If an agent wants TypeScript or JSX ergonomics, it should bundle or transpile to JavaScript before registration.
@@ -0,0 +1,186 @@
1
+ # Plugins
2
+
3
+ Use this guide when creating a HyperView plugin that includes backend Python tools and a frontend panel.
4
+
5
+ ## Model
6
+
7
+ A plugin is a local extension folder with an `extension.toml` manifest. One folder can register Python tools, native panel modules, or both.
8
+
9
+ Preferred shape for agent-authored, project-versioned plugins:
10
+
11
+ ```text
12
+ .hyperview/extensions/selection-profile/
13
+ extension.toml
14
+ tools.py
15
+ panel.jsx
16
+ ```
17
+
18
+ Use `.hyperview/extensions/<name>/` by default. `hyperview serve` auto-discovers those folders from the project root, even when launched from a nested directory. Use `agent-context/extensions/<name>/` only for scratch or explicit local installs that should not attach automatically on launch.
19
+
20
+ ## Manifest
21
+
22
+ Use a stable extension `name`. Tool-generated artifacts are served by extension name through `ctx.url_for(...)`, while panel modules are served by panel id.
23
+
24
+ ```toml
25
+ name = "selection-profile"
26
+ description = "Selection profile panel"
27
+
28
+ [[tools]]
29
+ file = "tools.py"
30
+
31
+ [[panels]]
32
+ id = "selection-profile"
33
+ title = "Selection Profile"
34
+ position = "right"
35
+ file = "panel.jsx"
36
+ ```
37
+
38
+ Valid panel positions are `right`, `bottom`, and `center`.
39
+
40
+ ## Backend Tools
41
+
42
+ Tools are plain Python functions decorated with `@tool("namespace.name")`. The first argument is a `RunContext`.
43
+
44
+ ```python
45
+ from __future__ import annotations
46
+
47
+ from collections import Counter
48
+ from typing import Any
49
+
50
+ from hyperview.tools import RunContext, tool
51
+
52
+
53
+ @tool("selection_profile.summarize")
54
+ def summarize_selection(ctx: RunContext, *, sample_ids: list[str] | None = None) -> dict[str, Any]:
55
+ if ctx.dataset is None:
56
+ raise ValueError("No active dataset")
57
+
58
+ ids = sample_ids or ctx.workspace.ui.selected_ids
59
+ selected_samples = ctx.dataset.get_samples_by_ids(ids) if ids else []
60
+ label_counts = Counter(sample.label or "unlabeled" for sample in selected_samples)
61
+
62
+ return {
63
+ "dataset": ctx.dataset.name,
64
+ "selection_count": len(selected_samples),
65
+ "labels": [
66
+ {"label": label, "count": count}
67
+ for label, count in label_counts.most_common(8)
68
+ ],
69
+ }
70
+ ```
71
+
72
+ Use `ctx.dataset` for active dataset reads, `ctx.workspace` for workspace UI state, `ctx.extension_storage` for per-plugin writable files, `ctx.url_for(path)` for renderable artifact URLs, and `ctx.submit_job(...)` for long-running work.
73
+
74
+ ### RunContext and Sample shapes
75
+
76
+ - `ctx.dataset` &mdash; the active `Dataset`. Iterate samples with `for s in ctx.dataset.samples:` (returns `list[Sample]`). Look up by id with `ctx.dataset.get_samples_by_ids(ids)`.
77
+ - `ctx.workspace.ui.selected_ids` &mdash; current selection (`list[str]`).
78
+ - `ctx.extension_storage` &mdash; `pathlib.Path` to a writable per-plugin folder.
79
+ - `ctx.url_for(path)` &mdash; returns a fetchable URL for a file under `extension_storage`.
80
+ - `ctx.submit_job(...)` &mdash; schedule long-running work; returns a job handle.
81
+
82
+ `Sample` (from `hyperview.core.sample`) exposes:
83
+
84
+ - `sample.id: str`
85
+ - `sample.label: str | None`
86
+ - `sample.metadata: dict[str, Any]`
87
+
88
+ ## Frontend Panel
89
+
90
+ Panel modules must be browser-loadable JavaScript modules. They export a default React component or named `Panel`, and use `globalThis.HyperViewPanelSDK` rather than importing from app internals.
91
+
92
+ ```js
93
+ const sdk = globalThis.HyperViewPanelSDK;
94
+ if (!sdk) throw new Error("HyperViewPanelSDK is not available on window.");
95
+
96
+ const { React, components, hooks } = sdk;
97
+ const { Panel, PanelToolbar, PanelToolbarButton } = components;
98
+ const { usePanelSelection, useTool } = hooks;
99
+
100
+ export default function SelectionProfilePanel() {
101
+ const { selectedIds } = usePanelSelection();
102
+ const profile = useTool("selection_profile.summarize");
103
+ const selectionKey = selectedIds.join("|");
104
+
105
+ React.useEffect(() => {
106
+ profile.run({ sample_ids: selectedIds });
107
+ }, [profile.run, selectionKey]);
108
+
109
+ const result = profile.result;
110
+
111
+ return React.createElement(
112
+ Panel,
113
+ { className: "h-full" },
114
+ React.createElement(PanelToolbar, {
115
+ items: [
116
+ { id: "selection", label: "Selection", value: String(selectedIds.length) },
117
+ { id: "status", label: "Status", value: profile.loading ? "running" : result ? "ready" : "idle" },
118
+ ],
119
+ actions: React.createElement(PanelToolbarButton, { onClick: () => profile.run({ sample_ids: selectedIds }) }, "Refresh"),
120
+ }),
121
+ React.createElement("pre", { style: { padding: 12, overflow: "auto" } }, JSON.stringify(result, null, 2))
122
+ );
123
+ }
124
+ ```
125
+
126
+ Available SDK hooks include `usePanelRuntimeState`, `usePanelDatasetInfo`, `usePanelSamplesView`, `usePanelSelection`, `usePanelCommands`, `usePanelUiState`, `usePanelClient`, and `useTool`.
127
+
128
+ `useTool(uri)` returns `{ run, result, loading, error, reset }`. Call `run(params)` to invoke the tool; `result` holds the last successful return value, `loading` is true while a call is in flight, and `error` is the last failure message (or `null`). See [native-panels.md](native-panels.md#hook-return-shapes) for the full hook return shape table.
129
+
130
+ ## CLI Workflow
131
+
132
+ Start a runtime for an existing workspace and dataset:
133
+
134
+ ```bash
135
+ hyperview serve --workspace research --dataset cifar10_demo --no-browser
136
+ ```
137
+
138
+ If the plugin already exists under `.hyperview/extensions/`, starting `hyperview serve` attaches it automatically. For a server that is already running, install or reload the plugin explicitly:
139
+
140
+ ```bash
141
+ hyperview extension add .hyperview/extensions/selection-profile \
142
+ --workspace research \
143
+ --json
144
+ ```
145
+
146
+ Inspect the result:
147
+
148
+ ```bash
149
+ hyperview extension list --json
150
+ hyperview tools list --json
151
+ curl --max-time 2 'http://127.0.0.1:6262/api/runtime?workspace_id=research'
152
+ ```
153
+
154
+ Run a tool directly:
155
+
156
+ ```bash
157
+ hyperview tools run selection_profile.summarize \
158
+ --workspace research \
159
+ --param 'sample_ids=["sample-1","sample-8"]' \
160
+ --json
161
+ ```
162
+
163
+ Reload after editing files:
164
+
165
+ ```bash
166
+ hyperview extension reload selection-profile --json
167
+ ```
168
+
169
+ ## Verification
170
+
171
+ A good plugin smoke test proves all of these paths:
172
+
173
+ - `extension add` returns the plugin with expected tools and panels.
174
+ - `GET /api/tools` (or `hyperview tools list --json`) includes the tool URI.
175
+ - `hyperview tools run ...` returns data from the active dataset.
176
+ - Tool-generated files under `ctx.extension_storage` are fetchable from URLs returned by `ctx.url_for(...)`.
177
+ - `GET /api/runtime?workspace_id=<workspace>` includes the panel under `workspace.ui.custom_panels[*]` with `data.module_src` set to a `/api/panels/content/<workspace>/<panel-id>/<file>` URL.
178
+ - Fetching `data.module_src` returns `application/javascript` with your module body.
179
+ - In the browser, the panel imports successfully and a `useTool()` call returns a result.
180
+
181
+ ## Constraints
182
+
183
+ - Treat plugins as trusted local code. Python tools are imported and executed in the HyperView runtime process.
184
+ - Do not use bare npm imports in panel modules unless you bundle first.
185
+ - Keep plugin source outside `frontend/src`; the runtime loads it from local files.
186
+ - Keep plugin examples small and high-level. Avoid private HyperView APIs in user-facing examples.
@@ -63,6 +63,7 @@ scripts_ignored/
63
63
 
64
64
  # AI Context (Agent files)
65
65
  .claude/
66
+ agent-context/
66
67
  context/
67
68
  CLAUDE.md
68
69
  TASKS.md
@@ -74,10 +75,19 @@ AGENTS.md
74
75
  .github/hooks/
75
76
  .github/skills/
76
77
  .agents/
78
+ !.agents/
79
+ !.agents/skills/
80
+ .agents/skills/*
81
+ !.agents/skills/hyperview-cli/
82
+ !.agents/skills/hyperview-cli/**
77
83
  .specstory/
78
84
 
79
85
  # Deployment repo (managed as a separate nested git repository)
80
- deploy/
86
+ hyper-models/
87
+ hyperview-spaces/
88
+ eval/
89
+ hyper-lrp/
81
90
 
82
91
  # Generated version file (hatch-vcs)
83
92
  src/hyperview/_version.py
93
+ node_modules/
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 Matin Mahmood
3
+ Copyright (c) 2025 Hyper3Labs
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal