@kahitsan/plugin-sdk 0.3.0 → 0.4.0-staging.17
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 +20 -0
- package/README.md +76 -0
- package/bin/cli.mjs +6 -4
- package/dist/index.js +1 -1
- package/package.json +29 -6
- package/shell/_build/.vite/manifest.json +189 -0
- package/shell/_build/.vite/manifest.json.br +0 -0
- package/shell/_build/.vite/manifest.json.gz +0 -0
- package/shell/_build/assets/_...slug_-BcdF4l5Z.js +1 -0
- package/shell/_build/assets/_...slug_-BcdF4l5Z.js.br +0 -0
- package/shell/_build/assets/_...slug_-BcdF4l5Z.js.gz +0 -0
- package/shell/_build/assets/api-keys-BNWgFkG0.js +1 -0
- package/shell/_build/assets/auth-DnjIzX2B.js +70 -0
- package/shell/_build/assets/auth-DnjIzX2B.js.br +0 -0
- package/shell/_build/assets/auth-DnjIzX2B.js.gz +0 -0
- package/shell/_build/assets/client-BmadCoeU.css +1 -0
- package/shell/_build/assets/client-BmadCoeU.css.br +0 -0
- package/shell/_build/assets/client-BmadCoeU.css.gz +0 -0
- package/shell/_build/assets/client-StEn6jq1.js +2 -0
- package/shell/_build/assets/client-StEn6jq1.js.br +0 -0
- package/shell/_build/assets/client-StEn6jq1.js.gz +0 -0
- package/shell/_build/assets/components-CWmQ2MDX.js +1 -0
- package/shell/_build/assets/dashboard-pbkizuaa.js +1 -0
- package/shell/_build/assets/index-CwObwzl5.js +1 -0
- package/shell/_build/assets/login-pbkizuaa.js +1 -0
- package/shell/_build/assets/members-49i-57sG.js +1 -0
- package/shell/_build/assets/plugin-ui-CBTroTyb.js +10 -0
- package/shell/_build/assets/plugin-ui-CBTroTyb.js.br +0 -0
- package/shell/_build/assets/plugin-ui-CBTroTyb.js.gz +0 -0
- package/shell/_build/assets/register-pbkizuaa.js +1 -0
- package/shell/_build/assets/routing-C6AwqsGL.js +1 -0
- package/shell/_build/assets/routing-C6AwqsGL.js.br +0 -0
- package/shell/_build/assets/routing-C6AwqsGL.js.gz +0 -0
- package/shell/_build/assets/settings-pbkizuaa.js +1 -0
- package/shell/_build/assets/users-pbkizuaa.js +1 -0
- package/shell/_build/assets/workspace-nav-fkYL3-AV.js +1 -0
- package/shell/_build/assets/workspace-nav-fkYL3-AV.js.br +0 -0
- package/shell/_build/assets/workspace-nav-fkYL3-AV.js.gz +0 -0
- package/shell/_build/assets/workspace-settings-pbkizuaa.js +1 -0
- package/shell/_build/assets/workspaces-pbkizuaa.js +1 -0
- package/shell/_headers +20 -0
- package/shell/_redirects +4 -0
- package/shell/_server/assets/app-BmadCoeU.css +1 -0
- package/shell/_server/assets/app-BmadCoeU.css.br +0 -0
- package/shell/_server/assets/app-BmadCoeU.css.gz +0 -0
- package/shell/apple-touch-icon.png +0 -0
- package/shell/dev/apple-touch-icon.png +0 -0
- package/shell/dev/favicon-32.png +0 -0
- package/shell/dev/favicon.ico +0 -0
- package/shell/dev/manifest.webmanifest +31 -0
- package/shell/dev/pwa-192.png +0 -0
- package/shell/dev/pwa-512-maskable.png +0 -0
- package/shell/dev/pwa-512.png +0 -0
- package/shell/favicon-32.png +0 -0
- package/shell/favicon.ico +0 -0
- package/shell/index.html +1 -0
- package/shell/index.html.br +7 -0
- package/shell/index.html.gz +0 -0
- package/shell/manifest.webmanifest +31 -0
- package/shell/pwa-192.png +0 -0
- package/shell/pwa-512-maskable.png +0 -0
- package/shell/pwa-512.png +0 -0
- package/shell/sw.js +103 -0
- package/shell/sw.js.br +0 -0
- package/shell/sw.js.gz +0 -0
- package/src/dev/dev-host.ts +3 -1
- package/src/dev/serve.ts +141 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
@kahitsan/plugin-sdk — PROPRIETARY & CONFIDENTIAL
|
|
2
|
+
Copyright (c) KahitSan Corp. All rights reserved. Licensed, not sold.
|
|
3
|
+
|
|
4
|
+
This software is the property of KahitSan Corp. and is provided to authorized
|
|
5
|
+
licensees solely to build, run, and test plugins for the Hilinga ERP platform.
|
|
6
|
+
|
|
7
|
+
The published runtime (`dist/index.js`) is intentionally OBFUSCATED to protect
|
|
8
|
+
trade secrets. De-obfuscating, decompiling, reverse-engineering, beautifying, or
|
|
9
|
+
reconstructing its source is STRICTLY PROHIBITED by this license and by law,
|
|
10
|
+
including anti-circumvention statutes (e.g. 17 U.S.C. § 1201 / DMCA and
|
|
11
|
+
equivalents).
|
|
12
|
+
|
|
13
|
+
No part of this package may be copied, modified, redistributed, sublicensed, or
|
|
14
|
+
used to create a competing product without the prior written permission of
|
|
15
|
+
KahitSan Corp. (https://kahitsan.com).
|
|
16
|
+
|
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
IMPLIED. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
19
|
+
CLAIM, DAMAGES, OR OTHER LIABILITY ARISING FROM, OUT OF, OR IN CONNECTION WITH
|
|
20
|
+
THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# @kahitsan/plugin-sdk
|
|
2
|
+
|
|
3
|
+
The author surface + dev toolkit for building [Hilinga](https://www.hilinga.com) ERP plugins —
|
|
4
|
+
build, run, and test a plugin locally against a **kernel-identical dev shell**, with **no kernel
|
|
5
|
+
source required**.
|
|
6
|
+
|
|
7
|
+
Hilinga is a kernel (`kserp`) plus process-isolated plugins. Each plugin is its own repo with its
|
|
8
|
+
own API routes, UI bundle, Postgres schema, migrations, and pm2 process. This package is the single
|
|
9
|
+
public specifier a plugin author installs: it provides the server bootstrap, the workspace-scoped
|
|
10
|
+
data surface, auth/permission guards, the cross-plugin RPC + wire-protocol verify surface, and a Bun
|
|
11
|
+
dev toolkit that boots your plugin inside the real, kernel-identical app shell.
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install @kahitsan/plugin-sdk
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## The dev toolkit
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npx @kahitsan/plugin-sdk <pluginDir> [<pluginDir> …]
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Boots a dev-kernel mediator + each plugin on [Bun](https://bun.sh) (local SQLite + a synthetic
|
|
26
|
+
logged-in admin) **entirely from the installed package** — no kernel checkout, no Postgres. It also
|
|
27
|
+
serves the prebuilt **kernel-identical host-UI shell** (sidebar, plugin route renderer, the settings
|
|
28
|
+
gear + modal — the real visual app), so you develop against what production actually renders.
|
|
29
|
+
|
|
30
|
+
Pass several plugin dirs to exercise the **contract between plugins** locally — does B expose the
|
|
31
|
+
method A consumes?
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npx @kahitsan/plugin-sdk ./kplugin_transactions ./kplugin_payees
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Requires [Bun](https://bun.sh). `Ctrl-C` stops every plugin.
|
|
38
|
+
|
|
39
|
+
## The server surface — `createPluginServer`
|
|
40
|
+
|
|
41
|
+
`createPluginServer` is the one shared bootstrap. It collapses a plugin's hand-written
|
|
42
|
+
`server/main.ts` (manifest + port + pg pool + migrations + identity verify + RLS tenant context +
|
|
43
|
+
services + routers + listen) into a single call, and is the seam the Express → Bun + WS transport
|
|
44
|
+
cutover moves through. Opt-in capabilities (each gated by the kernel + consent model at runtime):
|
|
45
|
+
|
|
46
|
+
- `settings` — a plugin's private, workspace-scoped KV store (`ctx.settings`)
|
|
47
|
+
- `assets` — the kernel object store (`ctx.assets`)
|
|
48
|
+
- `kernel` — the kernel-data read channel (`ctx.kernel.workspace.get()`)
|
|
49
|
+
- `plugins` — the mediated inter-plugin call surface (`ctx.plugins.get(peer).call(...)`)
|
|
50
|
+
- `events` — emit a domain event the kernel fans out (`ctx.events.emit(topic, payload)`)
|
|
51
|
+
- `flows` — the §9 node-step flow authoring DSL (`buildFlow`, `defineFlow`), imported from
|
|
52
|
+
`@kahitsan/plugin-sdk/flow` (a browser-safe subpath with no Node built-ins, for plugin UI bundles)
|
|
53
|
+
|
|
54
|
+
The package **never** includes `signIdentity` (the identity-forging capability) or any shared
|
|
55
|
+
secret — that is the one genuine package-level boundary, enforced by the build's leak gate.
|
|
56
|
+
|
|
57
|
+
## Authoring guide
|
|
58
|
+
|
|
59
|
+
The full new-plugin walkthrough lives in the Hilinga docs: **<https://kdocs.kahitsan.com>**
|
|
60
|
+
(`create-plugin/step-1…6`) and in-app at `/docs/plugins`.
|
|
61
|
+
|
|
62
|
+
## Publishing (maintainers)
|
|
63
|
+
|
|
64
|
+
This repo publishes `@kahitsan/plugin-sdk` to public npm **independently of any kernel deploy**,
|
|
65
|
+
and builds with **ZERO live kernel** — no submodule, no `KERNEL_REPO_TOKEN`. The minimal `@ks-erp`
|
|
66
|
+
runtime/type surface the SDK inlines is **vendored** at `src/vendor-kernel/` (regenerate it from a
|
|
67
|
+
kernel checkout with `node sync-vendor.mjs <path-to-kserp>`), and the toolkit host-UI shell source
|
|
68
|
+
lives at `shell-src/` (`kserp/src` built with `KSERP_TOOLKIT=1`; its only kernel coupling is two
|
|
69
|
+
pure nav helpers vendored under `shell-src/kernel/`). `build.mjs` produces a self-contained,
|
|
70
|
+
obfuscated `dist/` and runs the K1/K2 leak gate over both the JS and the `.d.ts`; `npm run
|
|
71
|
+
build:shell` builds the kernel-identical static shell from `shell-src/`. CI is
|
|
72
|
+
`.github/workflows/publish-sdk.yml`.
|
|
73
|
+
|
|
74
|
+
## License
|
|
75
|
+
|
|
76
|
+
Proprietary. Copyright (c) KahitSan Corp. All rights reserved. Licensed, not sold.
|
package/bin/cli.mjs
CHANGED
|
@@ -35,10 +35,12 @@ if (dirs.length === 0 || wantsHelp) {
|
|
|
35
35
|
process.exit(wantsHelp ? 0 : 2);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
//
|
|
39
|
-
//
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
// serve.ts is the FULL launcher: it boots the plugins + the dev-kernel AND serves the
|
|
39
|
+
// prebuilt kernel-identical host-UI shell (shipped at <pkg>/shell), so the developer
|
|
40
|
+
// gets the real visual app — not just the backend — entirely from the installed
|
|
41
|
+
// package, no kernel checkout. (dev-host.ts remains the headless/backend-only variant.)
|
|
42
|
+
const launcher = join(here, "..", "src", "dev", "serve.ts");
|
|
43
|
+
const child = spawn("bun", [launcher, ...dirs], { stdio: "inherit" });
|
|
42
44
|
child.on("error", (err) => {
|
|
43
45
|
if (err && err.code === "ENOENT") {
|
|
44
46
|
console.error(
|