@khal-os/types 1.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 +94 -0
- package/README.md +19 -0
- package/dist/index.cjs +33 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +191 -0
- package/dist/index.d.ts +191 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/package.json +33 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
Elastic License 2.0 (ELv2)
|
|
2
|
+
|
|
3
|
+
Copyright 2026 KhalOS
|
|
4
|
+
|
|
5
|
+
## Acceptance
|
|
6
|
+
|
|
7
|
+
In order to get any license under these terms, you must agree to them as both
|
|
8
|
+
strict obligations and conditions to all your licenses.
|
|
9
|
+
|
|
10
|
+
## Copyright License
|
|
11
|
+
|
|
12
|
+
The licensor grants you a non-exclusive, royalty-free, worldwide,
|
|
13
|
+
non-sublicensable, non-transferable license to use, copy, distribute, make
|
|
14
|
+
available, and prepare derivative works of the software, in each case subject
|
|
15
|
+
to the limitations and conditions below.
|
|
16
|
+
|
|
17
|
+
## Limitations
|
|
18
|
+
|
|
19
|
+
You may not provide the software to third parties as a hosted or managed
|
|
20
|
+
service, where the service provides users with access to any substantial set
|
|
21
|
+
of the features or functionality of the software.
|
|
22
|
+
|
|
23
|
+
You may not move, change, disable, or circumvent the license key functionality
|
|
24
|
+
in the software, and you may not remove or obscure any functionality in the
|
|
25
|
+
software that is protected by the license key.
|
|
26
|
+
|
|
27
|
+
You may not alter, remove, or obscure any licensing, copyright, or other
|
|
28
|
+
notices of the licensor in the software. Any use of the licensor's trademarks
|
|
29
|
+
is subject to applicable law.
|
|
30
|
+
|
|
31
|
+
## Patents
|
|
32
|
+
|
|
33
|
+
The licensor grants you a license, under any patent claims the licensor can
|
|
34
|
+
license, or becomes able to license, to make, have made, use, sell, offer for
|
|
35
|
+
sale, import and have imported the software, in each case subject to the
|
|
36
|
+
limitations and conditions in this license. This license does not cover any
|
|
37
|
+
patent claims that you cause to be infringed by modifications or additions to
|
|
38
|
+
the software. If you or your company make any written claim that the software
|
|
39
|
+
infringes or contributes to infringement of any patent, your patent license
|
|
40
|
+
for the software granted under these terms ends immediately. If your company
|
|
41
|
+
makes such a claim, your patent license ends immediately for work on behalf
|
|
42
|
+
of your company.
|
|
43
|
+
|
|
44
|
+
## Notices
|
|
45
|
+
|
|
46
|
+
You must ensure that anyone who gets a copy of any part of the software from
|
|
47
|
+
you also gets a copy of these terms.
|
|
48
|
+
|
|
49
|
+
If you modify the software, you must include in any modified copies of the
|
|
50
|
+
software prominent notices stating that you have modified the software.
|
|
51
|
+
|
|
52
|
+
## No Other Rights
|
|
53
|
+
|
|
54
|
+
These terms do not imply any licenses other than those expressly granted in
|
|
55
|
+
these terms.
|
|
56
|
+
|
|
57
|
+
## Termination
|
|
58
|
+
|
|
59
|
+
If you use the software in violation of these terms, such use is not licensed,
|
|
60
|
+
and your licenses will automatically terminate. If the licensor provides you
|
|
61
|
+
with a notice of your violation, and you cease all violation of this license
|
|
62
|
+
no later than 30 days after you receive that notice, your licenses will be
|
|
63
|
+
reinstated retroactively. However, if you violate these terms after such
|
|
64
|
+
reinstatement, any additional violation of these terms will cause your licenses
|
|
65
|
+
to terminate automatically and permanently.
|
|
66
|
+
|
|
67
|
+
## No Liability
|
|
68
|
+
|
|
69
|
+
As far as the law allows, the software comes as is, without any warranty or
|
|
70
|
+
condition, and the licensor will not be liable to you for any damages arising
|
|
71
|
+
out of these terms or the use or nature of the software, under any kind of
|
|
72
|
+
legal claim.
|
|
73
|
+
|
|
74
|
+
## Definitions
|
|
75
|
+
|
|
76
|
+
The **licensor** is the entity offering these terms, and the **software** is
|
|
77
|
+
the software the licensor makes available under these terms, including any
|
|
78
|
+
portion of it.
|
|
79
|
+
|
|
80
|
+
**You** refers to the individual or entity agreeing to these terms.
|
|
81
|
+
|
|
82
|
+
**Your company** is any legal entity, sole proprietorship, or other kind of
|
|
83
|
+
organization that you work for, plus all organizations that have control over,
|
|
84
|
+
are under the control of, or are under common control with that organization.
|
|
85
|
+
**Control** means ownership of substantially all the assets of an entity, or
|
|
86
|
+
the power to direct its management and policies by vote, contract, or
|
|
87
|
+
otherwise. Control can be direct or indirect.
|
|
88
|
+
|
|
89
|
+
**Your licenses** are all the licenses granted to you for the software under
|
|
90
|
+
these terms.
|
|
91
|
+
|
|
92
|
+
**Use** means anything you do with the software requiring one of your licenses.
|
|
93
|
+
|
|
94
|
+
**Trademark** means trademarks, service marks, and similar rights.
|
package/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# @khal-os/types
|
|
2
|
+
|
|
3
|
+
Shared TypeScript type definitions for the KhalOS ecosystem. Includes types for authentication, app manifests, NATS messaging, and role definitions.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @khal-os/types
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import type { KhalAppManifest, KhalRole, NatsSubject } from '@khal-os/types';
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## License
|
|
18
|
+
|
|
19
|
+
[Elastic License 2.0 (ELv2)](./LICENSE)
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
ROLE_HIERARCHY: () => ROLE_HIERARCHY
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(index_exports);
|
|
26
|
+
|
|
27
|
+
// src/roles.ts
|
|
28
|
+
var ROLE_HIERARCHY = ["member", "platform-dev", "platform-admin", "platform-owner"];
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
ROLE_HIERARCHY
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/roles.ts"],"sourcesContent":["export type { KhalAuth } from './auth';\nexport type {\n\tAppDeployConfig,\n\tAppDesktopConfig,\n\tAppEnvVar,\n\tAppManifest,\n\tAppManifestView,\n\tAppServiceConfig,\n\tAppTauriConfig,\n\tServiceHealthConfig,\n} from './manifest';\nexport type { ConnectionState } from './nats';\nexport type { Role } from './roles';\nexport { ROLE_HIERARCHY } from './roles';\n","/** Canonical role hierarchy from least to most privileged. */\nexport const ROLE_HIERARCHY = ['member', 'platform-dev', 'platform-admin', 'platform-owner'] as const;\nexport type Role = (typeof ROLE_HIERARCHY)[number];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCO,IAAM,iBAAiB,CAAC,UAAU,gBAAgB,kBAAkB,gBAAgB;","names":[]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/** Authenticated user state returned by `useKhalAuth`. */
|
|
2
|
+
interface KhalAuth {
|
|
3
|
+
userId: string;
|
|
4
|
+
orgId: string;
|
|
5
|
+
role: string;
|
|
6
|
+
permissions: string[];
|
|
7
|
+
loading: boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/** Canonical role hierarchy from least to most privileged. */
|
|
11
|
+
declare const ROLE_HIERARCHY: readonly ["member", "platform-dev", "platform-admin", "platform-owner"];
|
|
12
|
+
type Role = (typeof ROLE_HIERARCHY)[number];
|
|
13
|
+
|
|
14
|
+
/** Desktop integration metadata for an app. */
|
|
15
|
+
interface AppDesktopConfig {
|
|
16
|
+
/** Path to the app icon (relative to the public directory). */
|
|
17
|
+
icon: string;
|
|
18
|
+
/** Categories for desktop launcher grouping. */
|
|
19
|
+
categories: string[];
|
|
20
|
+
/** Short description shown in the desktop launcher. */
|
|
21
|
+
comment: string;
|
|
22
|
+
}
|
|
23
|
+
/** A single view within an app manifest. */
|
|
24
|
+
interface AppManifestView {
|
|
25
|
+
/** Unique view identifier within the app. */
|
|
26
|
+
id: string;
|
|
27
|
+
/** Human-readable label for the view. */
|
|
28
|
+
label: string;
|
|
29
|
+
/** Permission string required to access this view. */
|
|
30
|
+
permission: string;
|
|
31
|
+
/** Minimum role level required. */
|
|
32
|
+
minRole: Role;
|
|
33
|
+
/** NATS subject segment after `khal.<orgId>.` for this view's services. */
|
|
34
|
+
natsPrefix?: string;
|
|
35
|
+
/** Default window dimensions. */
|
|
36
|
+
defaultSize: {
|
|
37
|
+
width: number;
|
|
38
|
+
height: number;
|
|
39
|
+
};
|
|
40
|
+
/** Relative path to the view's React component. */
|
|
41
|
+
component: string;
|
|
42
|
+
}
|
|
43
|
+
/** Health check configuration for a service. */
|
|
44
|
+
interface ServiceHealthConfig {
|
|
45
|
+
/** Check type: tcp (connect to port), http (GET endpoint), command (run shell). */
|
|
46
|
+
type: 'tcp' | 'http' | 'command';
|
|
47
|
+
/** Target: port number for tcp, URL for http, shell command for command. */
|
|
48
|
+
target: string | number;
|
|
49
|
+
/** Check interval in milliseconds (default: 30000). */
|
|
50
|
+
interval?: number;
|
|
51
|
+
/** Timeout in milliseconds (default: 5000). */
|
|
52
|
+
timeout?: number;
|
|
53
|
+
}
|
|
54
|
+
/** Service declaration within an app manifest. */
|
|
55
|
+
interface AppServiceConfig {
|
|
56
|
+
/** Service name (must be unique across the app). */
|
|
57
|
+
name: string;
|
|
58
|
+
/** Shell command to start the service (alternative to entry). */
|
|
59
|
+
command?: string;
|
|
60
|
+
/** Entry point file path relative to the package root. */
|
|
61
|
+
entry?: string;
|
|
62
|
+
/** Runtime environment. */
|
|
63
|
+
runtime?: 'node' | 'python';
|
|
64
|
+
/** Health check configuration. */
|
|
65
|
+
health?: ServiceHealthConfig;
|
|
66
|
+
/** Restart policy. */
|
|
67
|
+
restart?: 'always' | 'on-failure' | 'never';
|
|
68
|
+
/** Ports the service binds to internally. Khal assigns proxy ports. */
|
|
69
|
+
ports?: number[];
|
|
70
|
+
}
|
|
71
|
+
/** Environment variable declaration for app configuration. */
|
|
72
|
+
interface AppEnvVar {
|
|
73
|
+
/** Variable name (e.g., "API_KEY"). */
|
|
74
|
+
key: string;
|
|
75
|
+
/** Human-readable description shown in the config UI. */
|
|
76
|
+
description: string;
|
|
77
|
+
/** Whether the variable is required for the app to run. */
|
|
78
|
+
required: boolean;
|
|
79
|
+
/** Default value if not configured. */
|
|
80
|
+
default?: string;
|
|
81
|
+
/** Value type — affects config UI rendering and validation. */
|
|
82
|
+
type?: 'string' | 'number' | 'boolean' | 'secret' | 'url';
|
|
83
|
+
/** Storage: 'config' for plain ConfigMap, 'vault' for Kubernetes Secret. */
|
|
84
|
+
visibility?: 'config' | 'vault';
|
|
85
|
+
}
|
|
86
|
+
/** Kubernetes deployment configuration for apps with backends. */
|
|
87
|
+
interface AppDeployConfig {
|
|
88
|
+
/** Dockerfile path relative to app root (default: "Dockerfile"). */
|
|
89
|
+
dockerfile?: string;
|
|
90
|
+
/** Build args passed to docker build. */
|
|
91
|
+
buildArgs?: Record<string, string>;
|
|
92
|
+
/** Container port the app listens on. */
|
|
93
|
+
port?: number;
|
|
94
|
+
/** Resource requests and limits for the pod. */
|
|
95
|
+
resources?: {
|
|
96
|
+
requests?: {
|
|
97
|
+
cpu?: string;
|
|
98
|
+
memory?: string;
|
|
99
|
+
};
|
|
100
|
+
limits?: {
|
|
101
|
+
cpu?: string;
|
|
102
|
+
memory?: string;
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
/** Replica count (default: 1). */
|
|
106
|
+
replicas?: number;
|
|
107
|
+
/** Health check path for k8s readiness/liveness probes. */
|
|
108
|
+
healthPath?: string;
|
|
109
|
+
/** Ingress configuration for per-app routing. */
|
|
110
|
+
ingress?: {
|
|
111
|
+
/** Subdomain prefix: <value>.apps.<domain>. Defaults to app id. */
|
|
112
|
+
subdomain?: string;
|
|
113
|
+
/** Additional path prefixes to route to this app. */
|
|
114
|
+
pathPrefixes?: string[];
|
|
115
|
+
};
|
|
116
|
+
/** Horizontal Pod Autoscaler configuration. */
|
|
117
|
+
autoscaling?: {
|
|
118
|
+
enabled: boolean;
|
|
119
|
+
minReplicas?: number;
|
|
120
|
+
maxReplicas?: number;
|
|
121
|
+
targetCPU?: number;
|
|
122
|
+
};
|
|
123
|
+
/** Environment sources injected at runtime from k8s resources. */
|
|
124
|
+
envFrom?: Array<{
|
|
125
|
+
secretRef?: string;
|
|
126
|
+
configMapRef?: string;
|
|
127
|
+
}>;
|
|
128
|
+
}
|
|
129
|
+
/** Tauri standalone export configuration. */
|
|
130
|
+
interface AppTauriConfig {
|
|
131
|
+
/** Whether this app supports standalone Tauri export. */
|
|
132
|
+
exportable: boolean;
|
|
133
|
+
/** Path to src-tauri/ directory (default: "./src-tauri"). */
|
|
134
|
+
tauriDir?: string;
|
|
135
|
+
/** App name for the exported binary. */
|
|
136
|
+
appName?: string;
|
|
137
|
+
/** App icon path relative to app root. */
|
|
138
|
+
icon?: string;
|
|
139
|
+
/** Window configuration for standalone mode. */
|
|
140
|
+
window?: {
|
|
141
|
+
width?: number;
|
|
142
|
+
height?: number;
|
|
143
|
+
title?: string;
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Full app manifest — the type for `manifest.ts` files in KhalOS app packages.
|
|
148
|
+
*
|
|
149
|
+
* Every app package must export a default manifest conforming to this shape.
|
|
150
|
+
* Use `defineManifest()` for compile-time validation and autocomplete.
|
|
151
|
+
*
|
|
152
|
+
* The JSON equivalent (`khal-app.json`) uses the same shape and is the
|
|
153
|
+
* language-agnostic install-time contract that the marketplace reads.
|
|
154
|
+
*/
|
|
155
|
+
interface AppManifest {
|
|
156
|
+
/** Unique app identifier (must match the package directory name). */
|
|
157
|
+
id: string;
|
|
158
|
+
/** One or more views the app exposes. */
|
|
159
|
+
views: AppManifestView[];
|
|
160
|
+
/** Desktop integration configuration. */
|
|
161
|
+
desktop: AppDesktopConfig;
|
|
162
|
+
/** Backend services this app runs. Optional — pure UI apps have no services. */
|
|
163
|
+
services?: AppServiceConfig[];
|
|
164
|
+
/** Schema version for forward compatibility (default: 1). */
|
|
165
|
+
schemaVersion?: number;
|
|
166
|
+
/** Human-readable app name. */
|
|
167
|
+
name?: string;
|
|
168
|
+
/** Semantic version of the app. */
|
|
169
|
+
version?: string;
|
|
170
|
+
/** Short description for the marketplace listing. */
|
|
171
|
+
description?: string;
|
|
172
|
+
/** Author name or organization. */
|
|
173
|
+
author?: string;
|
|
174
|
+
/** SPDX license identifier. */
|
|
175
|
+
license?: string;
|
|
176
|
+
/** Source repository URL. */
|
|
177
|
+
repository?: string;
|
|
178
|
+
/** Minimum KhalOS host version required. */
|
|
179
|
+
minHostVersion?: string;
|
|
180
|
+
/** Environment variables the app needs — auto-generates config UI. */
|
|
181
|
+
env?: AppEnvVar[];
|
|
182
|
+
/** Native Kubernetes deployment configuration. */
|
|
183
|
+
deploy?: AppDeployConfig;
|
|
184
|
+
/** Tauri standalone export configuration. */
|
|
185
|
+
tauri?: AppTauriConfig;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/** Connection states reported by the WS relay. */
|
|
189
|
+
type ConnectionState = 'connected' | 'reconnecting' | 'disconnected' | 'auth_expired' | 'version_mismatch';
|
|
190
|
+
|
|
191
|
+
export { type AppDeployConfig, type AppDesktopConfig, type AppEnvVar, type AppManifest, type AppManifestView, type AppServiceConfig, type AppTauriConfig, type ConnectionState, type KhalAuth, ROLE_HIERARCHY, type Role, type ServiceHealthConfig };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/** Authenticated user state returned by `useKhalAuth`. */
|
|
2
|
+
interface KhalAuth {
|
|
3
|
+
userId: string;
|
|
4
|
+
orgId: string;
|
|
5
|
+
role: string;
|
|
6
|
+
permissions: string[];
|
|
7
|
+
loading: boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/** Canonical role hierarchy from least to most privileged. */
|
|
11
|
+
declare const ROLE_HIERARCHY: readonly ["member", "platform-dev", "platform-admin", "platform-owner"];
|
|
12
|
+
type Role = (typeof ROLE_HIERARCHY)[number];
|
|
13
|
+
|
|
14
|
+
/** Desktop integration metadata for an app. */
|
|
15
|
+
interface AppDesktopConfig {
|
|
16
|
+
/** Path to the app icon (relative to the public directory). */
|
|
17
|
+
icon: string;
|
|
18
|
+
/** Categories for desktop launcher grouping. */
|
|
19
|
+
categories: string[];
|
|
20
|
+
/** Short description shown in the desktop launcher. */
|
|
21
|
+
comment: string;
|
|
22
|
+
}
|
|
23
|
+
/** A single view within an app manifest. */
|
|
24
|
+
interface AppManifestView {
|
|
25
|
+
/** Unique view identifier within the app. */
|
|
26
|
+
id: string;
|
|
27
|
+
/** Human-readable label for the view. */
|
|
28
|
+
label: string;
|
|
29
|
+
/** Permission string required to access this view. */
|
|
30
|
+
permission: string;
|
|
31
|
+
/** Minimum role level required. */
|
|
32
|
+
minRole: Role;
|
|
33
|
+
/** NATS subject segment after `khal.<orgId>.` for this view's services. */
|
|
34
|
+
natsPrefix?: string;
|
|
35
|
+
/** Default window dimensions. */
|
|
36
|
+
defaultSize: {
|
|
37
|
+
width: number;
|
|
38
|
+
height: number;
|
|
39
|
+
};
|
|
40
|
+
/** Relative path to the view's React component. */
|
|
41
|
+
component: string;
|
|
42
|
+
}
|
|
43
|
+
/** Health check configuration for a service. */
|
|
44
|
+
interface ServiceHealthConfig {
|
|
45
|
+
/** Check type: tcp (connect to port), http (GET endpoint), command (run shell). */
|
|
46
|
+
type: 'tcp' | 'http' | 'command';
|
|
47
|
+
/** Target: port number for tcp, URL for http, shell command for command. */
|
|
48
|
+
target: string | number;
|
|
49
|
+
/** Check interval in milliseconds (default: 30000). */
|
|
50
|
+
interval?: number;
|
|
51
|
+
/** Timeout in milliseconds (default: 5000). */
|
|
52
|
+
timeout?: number;
|
|
53
|
+
}
|
|
54
|
+
/** Service declaration within an app manifest. */
|
|
55
|
+
interface AppServiceConfig {
|
|
56
|
+
/** Service name (must be unique across the app). */
|
|
57
|
+
name: string;
|
|
58
|
+
/** Shell command to start the service (alternative to entry). */
|
|
59
|
+
command?: string;
|
|
60
|
+
/** Entry point file path relative to the package root. */
|
|
61
|
+
entry?: string;
|
|
62
|
+
/** Runtime environment. */
|
|
63
|
+
runtime?: 'node' | 'python';
|
|
64
|
+
/** Health check configuration. */
|
|
65
|
+
health?: ServiceHealthConfig;
|
|
66
|
+
/** Restart policy. */
|
|
67
|
+
restart?: 'always' | 'on-failure' | 'never';
|
|
68
|
+
/** Ports the service binds to internally. Khal assigns proxy ports. */
|
|
69
|
+
ports?: number[];
|
|
70
|
+
}
|
|
71
|
+
/** Environment variable declaration for app configuration. */
|
|
72
|
+
interface AppEnvVar {
|
|
73
|
+
/** Variable name (e.g., "API_KEY"). */
|
|
74
|
+
key: string;
|
|
75
|
+
/** Human-readable description shown in the config UI. */
|
|
76
|
+
description: string;
|
|
77
|
+
/** Whether the variable is required for the app to run. */
|
|
78
|
+
required: boolean;
|
|
79
|
+
/** Default value if not configured. */
|
|
80
|
+
default?: string;
|
|
81
|
+
/** Value type — affects config UI rendering and validation. */
|
|
82
|
+
type?: 'string' | 'number' | 'boolean' | 'secret' | 'url';
|
|
83
|
+
/** Storage: 'config' for plain ConfigMap, 'vault' for Kubernetes Secret. */
|
|
84
|
+
visibility?: 'config' | 'vault';
|
|
85
|
+
}
|
|
86
|
+
/** Kubernetes deployment configuration for apps with backends. */
|
|
87
|
+
interface AppDeployConfig {
|
|
88
|
+
/** Dockerfile path relative to app root (default: "Dockerfile"). */
|
|
89
|
+
dockerfile?: string;
|
|
90
|
+
/** Build args passed to docker build. */
|
|
91
|
+
buildArgs?: Record<string, string>;
|
|
92
|
+
/** Container port the app listens on. */
|
|
93
|
+
port?: number;
|
|
94
|
+
/** Resource requests and limits for the pod. */
|
|
95
|
+
resources?: {
|
|
96
|
+
requests?: {
|
|
97
|
+
cpu?: string;
|
|
98
|
+
memory?: string;
|
|
99
|
+
};
|
|
100
|
+
limits?: {
|
|
101
|
+
cpu?: string;
|
|
102
|
+
memory?: string;
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
/** Replica count (default: 1). */
|
|
106
|
+
replicas?: number;
|
|
107
|
+
/** Health check path for k8s readiness/liveness probes. */
|
|
108
|
+
healthPath?: string;
|
|
109
|
+
/** Ingress configuration for per-app routing. */
|
|
110
|
+
ingress?: {
|
|
111
|
+
/** Subdomain prefix: <value>.apps.<domain>. Defaults to app id. */
|
|
112
|
+
subdomain?: string;
|
|
113
|
+
/** Additional path prefixes to route to this app. */
|
|
114
|
+
pathPrefixes?: string[];
|
|
115
|
+
};
|
|
116
|
+
/** Horizontal Pod Autoscaler configuration. */
|
|
117
|
+
autoscaling?: {
|
|
118
|
+
enabled: boolean;
|
|
119
|
+
minReplicas?: number;
|
|
120
|
+
maxReplicas?: number;
|
|
121
|
+
targetCPU?: number;
|
|
122
|
+
};
|
|
123
|
+
/** Environment sources injected at runtime from k8s resources. */
|
|
124
|
+
envFrom?: Array<{
|
|
125
|
+
secretRef?: string;
|
|
126
|
+
configMapRef?: string;
|
|
127
|
+
}>;
|
|
128
|
+
}
|
|
129
|
+
/** Tauri standalone export configuration. */
|
|
130
|
+
interface AppTauriConfig {
|
|
131
|
+
/** Whether this app supports standalone Tauri export. */
|
|
132
|
+
exportable: boolean;
|
|
133
|
+
/** Path to src-tauri/ directory (default: "./src-tauri"). */
|
|
134
|
+
tauriDir?: string;
|
|
135
|
+
/** App name for the exported binary. */
|
|
136
|
+
appName?: string;
|
|
137
|
+
/** App icon path relative to app root. */
|
|
138
|
+
icon?: string;
|
|
139
|
+
/** Window configuration for standalone mode. */
|
|
140
|
+
window?: {
|
|
141
|
+
width?: number;
|
|
142
|
+
height?: number;
|
|
143
|
+
title?: string;
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Full app manifest — the type for `manifest.ts` files in KhalOS app packages.
|
|
148
|
+
*
|
|
149
|
+
* Every app package must export a default manifest conforming to this shape.
|
|
150
|
+
* Use `defineManifest()` for compile-time validation and autocomplete.
|
|
151
|
+
*
|
|
152
|
+
* The JSON equivalent (`khal-app.json`) uses the same shape and is the
|
|
153
|
+
* language-agnostic install-time contract that the marketplace reads.
|
|
154
|
+
*/
|
|
155
|
+
interface AppManifest {
|
|
156
|
+
/** Unique app identifier (must match the package directory name). */
|
|
157
|
+
id: string;
|
|
158
|
+
/** One or more views the app exposes. */
|
|
159
|
+
views: AppManifestView[];
|
|
160
|
+
/** Desktop integration configuration. */
|
|
161
|
+
desktop: AppDesktopConfig;
|
|
162
|
+
/** Backend services this app runs. Optional — pure UI apps have no services. */
|
|
163
|
+
services?: AppServiceConfig[];
|
|
164
|
+
/** Schema version for forward compatibility (default: 1). */
|
|
165
|
+
schemaVersion?: number;
|
|
166
|
+
/** Human-readable app name. */
|
|
167
|
+
name?: string;
|
|
168
|
+
/** Semantic version of the app. */
|
|
169
|
+
version?: string;
|
|
170
|
+
/** Short description for the marketplace listing. */
|
|
171
|
+
description?: string;
|
|
172
|
+
/** Author name or organization. */
|
|
173
|
+
author?: string;
|
|
174
|
+
/** SPDX license identifier. */
|
|
175
|
+
license?: string;
|
|
176
|
+
/** Source repository URL. */
|
|
177
|
+
repository?: string;
|
|
178
|
+
/** Minimum KhalOS host version required. */
|
|
179
|
+
minHostVersion?: string;
|
|
180
|
+
/** Environment variables the app needs — auto-generates config UI. */
|
|
181
|
+
env?: AppEnvVar[];
|
|
182
|
+
/** Native Kubernetes deployment configuration. */
|
|
183
|
+
deploy?: AppDeployConfig;
|
|
184
|
+
/** Tauri standalone export configuration. */
|
|
185
|
+
tauri?: AppTauriConfig;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/** Connection states reported by the WS relay. */
|
|
189
|
+
type ConnectionState = 'connected' | 'reconnecting' | 'disconnected' | 'auth_expired' | 'version_mismatch';
|
|
190
|
+
|
|
191
|
+
export { type AppDeployConfig, type AppDesktopConfig, type AppEnvVar, type AppManifest, type AppManifestView, type AppServiceConfig, type AppTauriConfig, type ConnectionState, type KhalAuth, ROLE_HIERARCHY, type Role, type ServiceHealthConfig };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/roles.ts"],"sourcesContent":["/** Canonical role hierarchy from least to most privileged. */\nexport const ROLE_HIERARCHY = ['member', 'platform-dev', 'platform-admin', 'platform-owner'] as const;\nexport type Role = (typeof ROLE_HIERARCHY)[number];\n"],"mappings":";AACO,IAAM,iBAAiB,CAAC,UAAU,gBAAgB,kBAAkB,gBAAgB;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@khal-os/types",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"private": false,
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"default": "./dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"require": {
|
|
16
|
+
"types": "./dist/index.d.cts",
|
|
17
|
+
"default": "./dist/index.cjs"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist",
|
|
23
|
+
"README.md",
|
|
24
|
+
"LICENSE"
|
|
25
|
+
],
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
},
|
|
29
|
+
"license": "Elastic-2.0",
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "tsup"
|
|
32
|
+
}
|
|
33
|
+
}
|