@niwa-labs/cockpit 0.0.0-stage → 0.0.0
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.
- package/LICENSE +21 -0
- package/README.md +70 -2
- package/dist/app/.vite/manifest.json +721 -0
- package/dist/app/assets/THIRD-PARTY-LICENSES.txt +5854 -0
- package/dist/app/assets/bat-qdxAdBWQ.js +1 -0
- package/dist/app/assets/c-DaO8xguW.js +1 -0
- package/dist/app/assets/client-CqGaja2F.js +9 -0
- package/dist/app/assets/compiler-runtime-B62encMk.js +1 -0
- package/dist/app/assets/core-DF97Z7zr.js +1 -0
- package/dist/app/assets/css-C8fQr_0Q.js +1 -0
- package/dist/app/assets/diff-woXpYk--.js +1 -0
- package/dist/app/assets/docker-IyjqRm3v.js +1 -0
- package/dist/app/assets/engine-oniguruma-BU67eM-Y.js +1 -0
- package/dist/app/assets/external-3Rxd0SJP.js +2 -0
- package/dist/app/assets/git-commit-BSykSTBG.js +1 -0
- package/dist/app/assets/git-rebase-DvpTQI6c.js +1 -0
- package/dist/app/assets/github-dark-C-LZuMrd.js +1 -0
- package/dist/app/assets/github-light-EUqPIrTm.js +1 -0
- package/dist/app/assets/go-rLFTqkRN.js +1 -0
- package/dist/app/assets/highlighted-body-PUFBAJJF-RvytTUUg.js +1 -0
- package/dist/app/assets/highlights-C9MPLq0H.js +7 -0
- package/dist/app/assets/html-wSbaAAK3.js +1 -0
- package/dist/app/assets/index-D0l4u9Yl.js +2 -0
- package/dist/app/assets/index-Dp9wV1Up.css +2 -0
- package/dist/app/assets/ini-B5eOa1yu.js +1 -0
- package/dist/app/assets/java-DmZF03nx.js +1 -0
- package/dist/app/assets/javascript-BgS3c2Ky.js +1 -0
- package/dist/app/assets/json-qhed-kSA.js +1 -0
- package/dist/app/assets/jsonc-CYpm1nAK.js +1 -0
- package/dist/app/assets/jsonl-CmCQp5Yx.js +1 -0
- package/dist/app/assets/jsx-Bz0zcwM4.js +1 -0
- package/dist/app/assets/jsx-runtime-LKYXHABd.js +1 -0
- package/dist/app/assets/langs-CTXVLlNI.js +1 -0
- package/dist/app/assets/lib-DMtK1EFU.js +1 -0
- package/dist/app/assets/lib-PPAYf6WD.js +1 -0
- package/dist/app/assets/loader-DDR9v23h.js +1 -0
- package/dist/app/assets/lua-xZcbXUE9.js +1 -0
- package/dist/app/assets/make-Dixweg8N.js +1 -0
- package/dist/app/assets/markdown-BYOwaDjH.js +1 -0
- package/dist/app/assets/mermaid-XW76GIA2-C39yhGJP.js +1 -0
- package/dist/app/assets/no-eval-9acd78d5.js +1 -0
- package/dist/app/assets/perl-BpHc_Aa4.js +1 -0
- package/dist/app/assets/php-CH66Z0i5.js +1 -0
- package/dist/app/assets/pierre-dark-B2jZWvHG.js +1 -0
- package/dist/app/assets/pierre-dark-CpLgRqie.js +1 -0
- package/dist/app/assets/pierre-dark-protanopia-deuteranopia-B35FxJx-.js +1 -0
- package/dist/app/assets/pierre-dark-soft-kZQmAZld.js +1 -0
- package/dist/app/assets/pierre-dark-tritanopia-CpjhbsIL.js +1 -0
- package/dist/app/assets/pierre-dark-vibrant-CpQYzh95.js +1 -0
- package/dist/app/assets/pierre-light-CoaEpmwp.js +1 -0
- package/dist/app/assets/pierre-light-Vf__O3ev.js +1 -0
- package/dist/app/assets/pierre-light-protanopia-deuteranopia-0fSaH845.js +1 -0
- package/dist/app/assets/pierre-light-soft-lWLdNTOI.js +1 -0
- package/dist/app/assets/pierre-light-tritanopia-CEbqgOJL.js +1 -0
- package/dist/app/assets/pierre-light-vibrant-D80Fkn33.js +1 -0
- package/dist/app/assets/powershell-QtSnmXcu.js +1 -0
- package/dist/app/assets/preload-helper-tvnSqkfO.js +1 -0
- package/dist/app/assets/python-gzcpVVnB.js +1 -0
- package/dist/app/assets/queryClient-DPJ6RZmv.js +1 -0
- package/dist/app/assets/react-DlmbjZJV.js +1 -0
- package/dist/app/assets/react-dom-1flDk5uq.js +1 -0
- package/dist/app/assets/regexp-Cw_s_VJJ.js +1 -0
- package/dist/app/assets/rolldown-runtime-XKyaHtl9.js +1 -0
- package/dist/app/assets/rust-DpiIf5JO.js +1 -0
- package/dist/app/assets/schemas-BsajqvGl.js +56 -0
- package/dist/app/assets/shared-niwa-labs-cockpit-sdk-B6gGY8_p.js +1 -0
- package/dist/app/assets/shared-niwa-labs-ui-kit-BqwXfZ-k.js +1 -0
- package/dist/app/assets/shared-react-Ojf16aWM.js +1 -0
- package/dist/app/assets/shared-react-compiler-runtime-D7BRtLYR.js +1 -0
- package/dist/app/assets/shared-react-dom-Cg_L1swf.js +1 -0
- package/dist/app/assets/shared-react-dom-client-C_uj9tet.js +1 -0
- package/dist/app/assets/shared-react-jsx-runtime-BEyx6EY5.js +1 -0
- package/dist/app/assets/shared-tanstack-react-query-BbYc93EQ.js +1 -0
- package/dist/app/assets/shared-zod-Dn1MT-dD.js +1 -0
- package/dist/app/assets/shared-zod-v4-Dn1MT-dD.js +1 -0
- package/dist/app/assets/shellscript-CLZ0U2zV.js +1 -0
- package/dist/app/assets/shiki-BsFKNNqF.js +2 -0
- package/dist/app/assets/sql-CEbI0hMM.js +1 -0
- package/dist/app/assets/src-BTDVPzTV.js +4 -0
- package/dist/app/assets/src-DU6ROjwp.js +495 -0
- package/dist/app/assets/stream-tokenizer-DWHhKoEw.js +4 -0
- package/dist/app/assets/themes-CjnYVIZg.js +2 -0
- package/dist/app/assets/toml-CcmNWLt0.js +1 -0
- package/dist/app/assets/tsx-udAQXfEw.js +1 -0
- package/dist/app/assets/typescript-bsJCZSQ-.js +1 -0
- package/dist/app/assets/useMutation-CT-WiGT6.js +1 -0
- package/dist/app/assets/wasm-4KdTHw0F.js +1 -0
- package/dist/app/assets/xml-D6KT6h9Z.js +1 -0
- package/dist/app/assets/yaml-rwi0_p6S.js +1 -0
- package/dist/app/assets/zig-CMLA9XwU.js +1 -0
- package/dist/app/index.html +29 -0
- package/package.json +38 -4
- package/src/index.ts +199 -0
- package/src/shared-modules.ts +55 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Niwa Labs contributors
|
|
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.
|
package/README.md
CHANGED
|
@@ -1,3 +1,71 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @niwa-labs/cockpit
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The cockpit application: a React 19 app, built with Vite 8 and the React Compiler, routed with
|
|
4
|
+
TanStack Router and reading the host through TanStack Query. `niwa web` serves it.
|
|
5
|
+
|
|
6
|
+
It is a frame. The pages come from the client modules that plugins offer: each plugin exports a
|
|
7
|
+
`./cockpit` module made with `definePlugin` from `@niwa-labs/cockpit-sdk`, and the host lists the
|
|
8
|
+
modules in `niwa.cockpit.catalog`.
|
|
9
|
+
|
|
10
|
+
## Start
|
|
11
|
+
|
|
12
|
+
1. Ask the web server who is looking (`/api/viewer`), what the host lists (`/api/catalogue`) and
|
|
13
|
+
where its journal ends (`/api/info`).
|
|
14
|
+
2. Start the record feed a backlog before the end of the journal.
|
|
15
|
+
3. Import every listed module and run its `setup`. A module that cannot be imported, or throws,
|
|
16
|
+
is left out and shown as a fault; the others load.
|
|
17
|
+
4. Only then make the router, from the pages the modules registered. No module is added later.
|
|
18
|
+
|
|
19
|
+
The shell is the navigation, the status bar of the feed, the faults and the place a page is drawn
|
|
20
|
+
in. Plugins can contribute to the home status strip (`home.summary`), work column (`home.main`),
|
|
21
|
+
or sidebar (`home.tile`). The project selector passes the chosen directory to each contribution.
|
|
22
|
+
A plugin can register page commands. The client renders the current host input schema on demand
|
|
23
|
+
and uses the viewer’s grants to determine which commands to show. The journal, at `/journal`,
|
|
24
|
+
shows the latest records newest first: each is drawn by the view a module gave its type in the
|
|
25
|
+
`record.view` slot, and by a plain row when no module did.
|
|
26
|
+
|
|
27
|
+
`/`, `/journal` and the addresses the web server answers itself (`/api`, `/assets`, `/modules`,
|
|
28
|
+
`/feed`, `/trace` and the rest) are the cockpit's: a module that asks for a page there is left out
|
|
29
|
+
and reported.
|
|
30
|
+
|
|
31
|
+
## One copy of the libraries
|
|
32
|
+
|
|
33
|
+
The build has one entry for each shared module: React, its JSX and compiler runtimes, React DOM,
|
|
34
|
+
TanStack Query, the SDK, the kit and zod (both `zod` and `zod/v4`, default export included). The
|
|
35
|
+
page carries an import map that names exactly these, and a client module is built with exactly
|
|
36
|
+
these specifiers left as imports, so the app and every module read the same copy. Any other
|
|
37
|
+
subpath of one of these packages is refused when the module is built.
|
|
38
|
+
|
|
39
|
+
The page allows scripts only from its own origin, and no `eval`: a classic script ahead of the
|
|
40
|
+
modules makes zod check the plain way instead of compiling its checks.
|
|
41
|
+
|
|
42
|
+
## From the host's side
|
|
43
|
+
|
|
44
|
+
The entry (`@niwa-labs/cockpit`) imports no React. `cockpitApp()` answers the folder of the built app
|
|
45
|
+
and the import map that `serveWeb` takes as `app`.
|
|
46
|
+
|
|
47
|
+
- A checkout builds the app from its sources into `dist/builds/<id>`, where the id is a hash of
|
|
48
|
+
the content of everything the build reads: the package's own sources, the SDK, the kit and the
|
|
49
|
+
`src/cockpit` folder of each plugin, which the stylesheet scans for classes. A state of the sources
|
|
50
|
+
that has a build is not built again. A folder is never changed after it is complete, so a server
|
|
51
|
+
keeps its files while the sources change and another server starts; old folders are left to be
|
|
52
|
+
deleted by hand.
|
|
53
|
+
- An installed package has no sources. It serves `dist/app`, which packing builds (`prepack`) and
|
|
54
|
+
ships, and needs neither Vite nor the plugins of its build.
|
|
55
|
+
|
|
56
|
+
The built app includes third-party code, grammars and themes under their own
|
|
57
|
+
licenses. The build writes their attributions to
|
|
58
|
+
`dist/app/assets/THIRD-PARTY-LICENSES.txt`, which also ships in the package
|
|
59
|
+
archive. See the [notice sources in the Niwa repository](https://github.com/niwa-labs/niwa/blob/main/packages/cockpit/notices/README.md)
|
|
60
|
+
for the upstream copies used by the build.
|
|
61
|
+
|
|
62
|
+
```sh
|
|
63
|
+
bun run build # in this package: writes dist/app, the app that packing ships
|
|
64
|
+
```
|
|
65
|
+
## Code highlighting
|
|
66
|
+
|
|
67
|
+
The installed Cockpit highlights common Markdown code fences locally, including
|
|
68
|
+
JavaScript, TypeScript, JSX, TSX, JSON, YAML, TOML, Bash, Python, Go, Rust,
|
|
69
|
+
and diffs. Other fences remain readable and copyable as code. File diffs use
|
|
70
|
+
Pierre Highlights and have their own language support. Both work offline
|
|
71
|
+
after installation.
|