@kvman/sdk 0.1.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.
Files changed (55) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +15 -0
  3. package/dist/ctx.d.ts +142 -0
  4. package/dist/ctx.d.ts.map +1 -0
  5. package/dist/ctx.js +2 -0
  6. package/dist/ctx.js.map +1 -0
  7. package/dist/envelope.d.ts +285 -0
  8. package/dist/envelope.d.ts.map +1 -0
  9. package/dist/envelope.js +25 -0
  10. package/dist/envelope.js.map +1 -0
  11. package/dist/index.d.ts +14 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +14 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/json.d.ts +14 -0
  16. package/dist/json.d.ts.map +1 -0
  17. package/dist/json.js +4 -0
  18. package/dist/json.js.map +1 -0
  19. package/dist/kernel-api.d.ts +550 -0
  20. package/dist/kernel-api.d.ts.map +1 -0
  21. package/dist/kernel-api.js +110 -0
  22. package/dist/kernel-api.js.map +1 -0
  23. package/dist/manifest.d.ts +34 -0
  24. package/dist/manifest.d.ts.map +1 -0
  25. package/dist/manifest.js +25 -0
  26. package/dist/manifest.js.map +1 -0
  27. package/dist/preset.d.ts +38 -0
  28. package/dist/preset.d.ts.map +1 -0
  29. package/dist/preset.js +26 -0
  30. package/dist/preset.js.map +1 -0
  31. package/dist/problem.d.ts +63 -0
  32. package/dist/problem.d.ts.map +1 -0
  33. package/dist/problem.js +45 -0
  34. package/dist/problem.js.map +1 -0
  35. package/dist/registrations.d.ts +92 -0
  36. package/dist/registrations.d.ts.map +1 -0
  37. package/dist/registrations.js +2 -0
  38. package/dist/registrations.js.map +1 -0
  39. package/dist/registry.d.ts +24 -0
  40. package/dist/registry.d.ts.map +1 -0
  41. package/dist/registry.js +2 -0
  42. package/dist/registry.js.map +1 -0
  43. package/dist/rows.d.ts +113 -0
  44. package/dist/rows.d.ts.map +1 -0
  45. package/dist/rows.js +53 -0
  46. package/dist/rows.js.map +1 -0
  47. package/dist/store.d.ts +90 -0
  48. package/dist/store.d.ts.map +1 -0
  49. package/dist/store.js +2 -0
  50. package/dist/store.js.map +1 -0
  51. package/dist/web.d.ts +158 -0
  52. package/dist/web.d.ts.map +1 -0
  53. package/dist/web.js +2 -0
  54. package/dist/web.js.map +1 -0
  55. package/package.json +39 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ahmed Deif
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 ADDED
@@ -0,0 +1,15 @@
1
+ # @kvman/sdk
2
+
3
+ The extension API of [kvman](https://github.com/ibndeif/kvman): the `ctx` types, `z` (zod), and the shared shapes (preset, extension manifest, Problem, job, envelope). `@kvman/sdk/web` is the API of an extension's web components.
4
+
5
+ An extension lists it as a peer dependency, and kvman supplies its own copy at run time:
6
+
7
+ ```json
8
+ { "peerDependencies": { "@kvman/sdk": "^0.1.0" } }
9
+ ```
10
+
11
+ Start with [Getting started](https://github.com/ibndeif/kvman/blob/main/docs/developers/getting-started.md) and [The SDK](https://github.com/ibndeif/kvman/blob/main/docs/developers/sdk.md).
12
+
13
+ ## License
14
+
15
+ MIT
package/dist/ctx.d.ts ADDED
@@ -0,0 +1,142 @@
1
+ import type { z } from 'zod';
2
+ import type { Json } from './json.ts';
3
+ import type { ProblemError } from './problem.ts';
4
+ import type { CommandRegistration, HandlerPoint, HandlerRegistration, QueryRegistration, SettingRegistration, SettingScope } from './registrations.ts';
5
+ import type { CommandInputOf, InputOf, OutputOf, SettingValueOf } from './registry.ts';
6
+ import type { Caller, File, Workspace } from './rows.ts';
7
+ import type { Store } from './store.ts';
8
+ /** The job a handler is running (plan 03 §3.3). */
9
+ export type CurrentJob = {
10
+ /** The job id (UUIDv7); a sync job has one too, but no row. */
11
+ id: string;
12
+ /** The id of the first job of this sync chain. */
13
+ rootId: string;
14
+ /** The job's workspace. */
15
+ workspace: Workspace;
16
+ /** Who started the job. */
17
+ caller: Caller;
18
+ /** Aborted on cancel, timeout, or shutdown. */
19
+ signal: AbortSignal;
20
+ /** Sends a progress chunk (JSON, at most 64 KiB) to the stream of `rootId`. */
21
+ progress(data: Json): void;
22
+ };
23
+ /** When a scheduled command runs: once at a date, or on a cron; the same `key` again replaces the schedule. */
24
+ export type ScheduleTiming = {
25
+ at: Date;
26
+ key?: string;
27
+ } | {
28
+ cron: string;
29
+ key?: string;
30
+ };
31
+ /** Schedules a command and resolves to the schedule id; `cancel` deletes a schedule. */
32
+ export type ScheduleCall = {
33
+ <Name extends string>(name: Name, input: CommandInputOf<Name>, timing: ScheduleTiming): Promise<string>;
34
+ /** Deletes a schedule. */
35
+ cancel(id: string): Promise<void>;
36
+ };
37
+ /** Files the kernel keeps (plan 02 §2.7). */
38
+ export type Files = {
39
+ /** Stores a file in the job's workspace and returns its row. */
40
+ write(name: string, data: Uint8Array | string, type: string): Promise<File>;
41
+ /** The file's row. */
42
+ get(id: string): Promise<File>;
43
+ /** The file's content. */
44
+ read(id: string): Promise<Buffer>;
45
+ /** The file's absolute path, for streaming. */
46
+ path(id: string): Promise<string>;
47
+ /** Deletes a file this extension owns, or a user upload. */
48
+ unlink(id: string): Promise<void>;
49
+ };
50
+ /** Settings: any key can be read; only the extension's own keys can be written. */
51
+ export type SettingsAccess = {
52
+ /** The key's value: workspace, else global, else preset, else default. */
53
+ get<Key extends string>(key: Key): Promise<SettingValueOf<Key>>;
54
+ /** Sets one of this extension's keys in a scope the key allows. */
55
+ set<Key extends string>(key: Key, value: SettingValueOf<Key>, options: {
56
+ scope: SettingScope;
57
+ }): Promise<void>;
58
+ };
59
+ /** This extension's secrets, home-wide, kept only in `secrets.json`. */
60
+ export type Secrets = {
61
+ /** The secret, or `undefined` when none is set. */
62
+ get(name: string): Promise<string | undefined>;
63
+ /** Sets a secret. */
64
+ set(name: string, value: string): Promise<void>;
65
+ /** Deletes a secret. */
66
+ delete(name: string): Promise<void>;
67
+ };
68
+ /** A long-lived process started through `ctx.processes`. */
69
+ export type ProcessInfo = {
70
+ name: string;
71
+ pid: number;
72
+ startedAt: string;
73
+ };
74
+ /** How to start a long-lived process. */
75
+ export type ProcessStart = {
76
+ command: string;
77
+ args?: readonly string[];
78
+ cwd?: string;
79
+ env?: Readonly<Record<string, string>>;
80
+ };
81
+ /** Long-lived child processes, per extension and workspace (plan 02 §2.16). */
82
+ export type Processes = {
83
+ /** Starts a process; a running one with the same name fails `PROCESS_RUNNING`. */
84
+ start(name: string, options: ProcessStart): Promise<ProcessInfo>;
85
+ /** Stops a process and its children. */
86
+ stop(name: string): Promise<void>;
87
+ /** This extension's processes in the workspace. */
88
+ list(): Promise<ProcessInfo[]>;
89
+ /** The last lines of a process's output. */
90
+ log(name: string, options?: {
91
+ tail?: number;
92
+ }): Promise<string>;
93
+ };
94
+ /** Fields of a log line: never payloads, settings values, or secrets. */
95
+ export type LogFields = Readonly<Record<string, Json>>;
96
+ /** Writes lines to `logs/kvman.log`, tagged with the extension and, inside a handler, the job id. */
97
+ export type Log = {
98
+ /** Writes a debug line. */
99
+ debug(message: string, fields?: LogFields): void;
100
+ /** Writes an info line. */
101
+ info(message: string, fields?: LogFields): void;
102
+ /** Writes a warning line. */
103
+ warn(message: string, fields?: LogFields): void;
104
+ /** Writes an error line. */
105
+ error(message: string, fields?: LogFields): void;
106
+ };
107
+ /** The whole API an extension sees; its entry receives it once per worker. */
108
+ export type Ctx = {
109
+ /** Registers a command; the name starts with the extension's namespace. */
110
+ registerCommand<Input extends z.ZodType, Output extends z.ZodType>(name: string, registration: CommandRegistration<Input, Output>): void;
111
+ /** Registers a query; the name starts with the extension's namespace. */
112
+ registerQuery<Input extends z.ZodType, Output extends z.ZodType>(name: string, registration: QueryRegistration<Input, Output>): void;
113
+ /** Registers a setting key; the key starts with the extension's namespace. */
114
+ registerSetting<Schema extends z.ZodType>(key: string, registration: SettingRegistration<Schema>): void;
115
+ /** Registers a handler for one of the kernel's points. */
116
+ registerHandler<Point extends HandlerPoint>(point: Point, registration: HandlerRegistration<Point>): void;
117
+ /** Runs a command or query now and resolves to its output. */
118
+ exec<Name extends string>(name: Name, input: InputOf<Name>): Promise<OutputOf<Name>>;
119
+ /** Queues a command and resolves to its job id. */
120
+ execAsync<Name extends string>(name: Name, input: CommandInputOf<Name>): Promise<string>;
121
+ /** Schedules a command. */
122
+ schedule: ScheduleCall;
123
+ /** Cancels a job. */
124
+ cancel(jobId: string): Promise<void>;
125
+ /** Makes a ProblemError to throw; `code` is `<namespace>/UPPER_SNAKE`, and it is never retried. */
126
+ problem(code: string, params?: Readonly<Record<string, Json>>): ProblemError;
127
+ /** The current job; outside a handler it fails `NO_JOB`. */
128
+ readonly job: CurrentJob;
129
+ /** The extension's store. */
130
+ store: Store;
131
+ /** Files the kernel keeps. */
132
+ files: Files;
133
+ /** Settings. */
134
+ settings: SettingsAccess;
135
+ /** The extension's secrets. */
136
+ secrets: Secrets;
137
+ /** Long-lived child processes. */
138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YAAY,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,mBAAmB,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;IAC1G,8DAA8D;IAC9D,IAAI,CAAC,IAAI,SAAS,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IACrF,mDAAmD;IACnD,SAAS,CAAC,IAAI,SAAS,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACzF,2BAA2B;IAC3B,QAAQ,EAAE,YAAY,CAAC;IACvB,qBAAqB;IACrB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,mGAAmG;IACnG,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,GAAG,YAAY,CAAC;IAC7E,4DAA4D;IAC5D,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC;IACzB,6BAA6B;IAC7B,KAAK,EAAE,KAAK,CAAC;IACb,8BAA8B;IAC9B,KAAK,EAAE,KAAK,CAAC;IACb,gBAAgB;IAChB,QAAQ,EAAE,cAAc,CAAC;IACzB,+BAA+B;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,kCAAkC;IAClC,SAAS,EAAE,SAAS,CAAC;IACrB,eAAe;IACf,GAAG,EAAE,GAAG,CAAC;CACV,CAAC"}
package/dist/ctx.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ctx.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ctx.js","sourceRoot":"","sources":["../src/ctx.ts"],"names":[],"mappings":""}
@@ -0,0 +1,285 @@
1
+ import { z } from 'zod';
2
+ /** Accepts a failed HTTP answer: the Problem, and the job id when a command or query failed. */
3
+ export declare const failureEnvelopeSchema: z.ZodObject<{
4
+ ok: z.ZodLiteral<false>;
5
+ problem: z.ZodObject<{
6
+ code: z.ZodUnion<readonly [z.ZodEnum<{
7
+ VALIDATION_FAILED: "VALIDATION_FAILED";
8
+ NOT_FOUND: "NOT_FOUND";
9
+ NOT_PUBLIC: "NOT_PUBLIC";
10
+ NOT_A_COMMAND: "NOT_A_COMMAND";
11
+ READ_ONLY: "READ_ONLY";
12
+ NO_JOB: "NO_JOB";
13
+ TOO_LARGE: "TOO_LARGE";
14
+ TOO_DEEP: "TOO_DEEP";
15
+ TIMEOUT: "TIMEOUT";
16
+ CANCELLED: "CANCELLED";
17
+ WORKER_CRASHED: "WORKER_CRASHED";
18
+ INTERRUPTED: "INTERRUPTED";
19
+ HANDLER_FAILED: "HANDLER_FAILED";
20
+ FORBIDDEN_ORIGIN: "FORBIDDEN_ORIGIN";
21
+ PROCESS_RUNNING: "PROCESS_RUNNING";
22
+ PORT_IN_USE: "PORT_IN_USE";
23
+ EXTENSION_INVALID: "EXTENSION_INVALID";
24
+ KVMAN_RUNNING: "KVMAN_RUNNING";
25
+ }>, z.ZodString]>;
26
+ message: z.ZodString;
27
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./json.ts").Json, unknown, z.core.$ZodTypeInternals<import("./json.ts").Json, unknown>>>>;
28
+ }, z.core.$strict>;
29
+ jobId: z.ZodOptional<z.ZodUUID>;
30
+ }, z.core.$strict>;
31
+ /** Makes the schema of an HTTP answer: `{ ok: true, …data }` or the failure envelope. */
32
+ export declare function envelopeSchema<Shape extends z.ZodRawShape>(data: Shape): z.ZodDiscriminatedUnion<[z.ZodObject<{
33
+ ok: z.ZodLiteral<true>;
34
+ } & Shape extends infer T ? { -readonly [P in keyof T]: T[P]; } : never, z.core.$strict>, z.ZodObject<{
35
+ ok: z.ZodLiteral<false>;
36
+ problem: z.ZodObject<{
37
+ code: z.ZodUnion<readonly [z.ZodEnum<{
38
+ VALIDATION_FAILED: "VALIDATION_FAILED";
39
+ NOT_FOUND: "NOT_FOUND";
40
+ NOT_PUBLIC: "NOT_PUBLIC";
41
+ NOT_A_COMMAND: "NOT_A_COMMAND";
42
+ READ_ONLY: "READ_ONLY";
43
+ NO_JOB: "NO_JOB";
44
+ TOO_LARGE: "TOO_LARGE";
45
+ TOO_DEEP: "TOO_DEEP";
46
+ TIMEOUT: "TIMEOUT";
47
+ CANCELLED: "CANCELLED";
48
+ WORKER_CRASHED: "WORKER_CRASHED";
49
+ INTERRUPTED: "INTERRUPTED";
50
+ HANDLER_FAILED: "HANDLER_FAILED";
51
+ FORBIDDEN_ORIGIN: "FORBIDDEN_ORIGIN";
52
+ PROCESS_RUNNING: "PROCESS_RUNNING";
53
+ PORT_IN_USE: "PORT_IN_USE";
54
+ EXTENSION_INVALID: "EXTENSION_INVALID";
55
+ KVMAN_RUNNING: "KVMAN_RUNNING";
56
+ }>, z.ZodString]>;
57
+ message: z.ZodString;
58
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./json.ts").Json, unknown, z.core.$ZodTypeInternals<import("./json.ts").Json, unknown>>>>;
59
+ }, z.core.$strict>;
60
+ jobId: z.ZodOptional<z.ZodUUID>;
61
+ }, z.core.$strict>], "ok">;
62
+ /** Accepts the answer of a sync command or a query. */
63
+ export declare const outputEnvelopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
64
+ ok: z.ZodLiteral<true>;
65
+ output: z.ZodType<import("./json.ts").Json, unknown, z.core.$ZodTypeInternals<import("./json.ts").Json, unknown>>;
66
+ jobId: z.ZodUUID;
67
+ }, z.core.$strict>, z.ZodObject<{
68
+ ok: z.ZodLiteral<false>;
69
+ problem: z.ZodObject<{
70
+ code: z.ZodUnion<readonly [z.ZodEnum<{
71
+ VALIDATION_FAILED: "VALIDATION_FAILED";
72
+ NOT_FOUND: "NOT_FOUND";
73
+ NOT_PUBLIC: "NOT_PUBLIC";
74
+ NOT_A_COMMAND: "NOT_A_COMMAND";
75
+ READ_ONLY: "READ_ONLY";
76
+ NO_JOB: "NO_JOB";
77
+ TOO_LARGE: "TOO_LARGE";
78
+ TOO_DEEP: "TOO_DEEP";
79
+ TIMEOUT: "TIMEOUT";
80
+ CANCELLED: "CANCELLED";
81
+ WORKER_CRASHED: "WORKER_CRASHED";
82
+ INTERRUPTED: "INTERRUPTED";
83
+ HANDLER_FAILED: "HANDLER_FAILED";
84
+ FORBIDDEN_ORIGIN: "FORBIDDEN_ORIGIN";
85
+ PROCESS_RUNNING: "PROCESS_RUNNING";
86
+ PORT_IN_USE: "PORT_IN_USE";
87
+ EXTENSION_INVALID: "EXTENSION_INVALID";
88
+ KVMAN_RUNNING: "KVMAN_RUNNING";
89
+ }>, z.ZodString]>;
90
+ message: z.ZodString;
91
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./json.ts").Json, unknown, z.core.$ZodTypeInternals<import("./json.ts").Json, unknown>>>>;
92
+ }, z.core.$strict>;
93
+ jobId: z.ZodOptional<z.ZodUUID>;
94
+ }, z.core.$strict>], "ok">;
95
+ /** Accepts the answer of a command queued with `async: true`. */
96
+ export declare const queuedEnvelopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
97
+ ok: z.ZodLiteral<true>;
98
+ jobId: z.ZodUUID;
99
+ }, z.core.$strict>, z.ZodObject<{
100
+ ok: z.ZodLiteral<false>;
101
+ problem: z.ZodObject<{
102
+ code: z.ZodUnion<readonly [z.ZodEnum<{
103
+ VALIDATION_FAILED: "VALIDATION_FAILED";
104
+ NOT_FOUND: "NOT_FOUND";
105
+ NOT_PUBLIC: "NOT_PUBLIC";
106
+ NOT_A_COMMAND: "NOT_A_COMMAND";
107
+ READ_ONLY: "READ_ONLY";
108
+ NO_JOB: "NO_JOB";
109
+ TOO_LARGE: "TOO_LARGE";
110
+ TOO_DEEP: "TOO_DEEP";
111
+ TIMEOUT: "TIMEOUT";
112
+ CANCELLED: "CANCELLED";
113
+ WORKER_CRASHED: "WORKER_CRASHED";
114
+ INTERRUPTED: "INTERRUPTED";
115
+ HANDLER_FAILED: "HANDLER_FAILED";
116
+ FORBIDDEN_ORIGIN: "FORBIDDEN_ORIGIN";
117
+ PROCESS_RUNNING: "PROCESS_RUNNING";
118
+ PORT_IN_USE: "PORT_IN_USE";
119
+ EXTENSION_INVALID: "EXTENSION_INVALID";
120
+ KVMAN_RUNNING: "KVMAN_RUNNING";
121
+ }>, z.ZodString]>;
122
+ message: z.ZodString;
123
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./json.ts").Json, unknown, z.core.$ZodTypeInternals<import("./json.ts").Json, unknown>>>>;
124
+ }, z.core.$strict>;
125
+ jobId: z.ZodOptional<z.ZodUUID>;
126
+ }, z.core.$strict>], "ok">;
127
+ /** Accepts the answer of `GET /api/jobs/:id`. */
128
+ export declare const jobEnvelopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
129
+ ok: z.ZodLiteral<true>;
130
+ job: z.ZodObject<{
131
+ id: z.ZodUUID;
132
+ name: z.ZodString;
133
+ input: z.ZodType<import("./json.ts").Json, unknown, z.core.$ZodTypeInternals<import("./json.ts").Json, unknown>>;
134
+ workspaceId: z.ZodString;
135
+ caller: z.ZodDiscriminatedUnion<[z.ZodObject<{
136
+ kind: z.ZodLiteral<"user">;
137
+ }, z.core.$strict>, z.ZodObject<{
138
+ kind: z.ZodLiteral<"extension">;
139
+ name: z.ZodString;
140
+ }, z.core.$strict>, z.ZodObject<{
141
+ kind: z.ZodLiteral<"kernel">;
142
+ }, z.core.$strict>], "kind">;
143
+ status: z.ZodEnum<{
144
+ queued: "queued";
145
+ running: "running";
146
+ succeeded: "succeeded";
147
+ failed: "failed";
148
+ cancelled: "cancelled";
149
+ }>;
150
+ attempts: z.ZodNumber;
151
+ retries: z.ZodNumber;
152
+ output: z.ZodOptional<z.ZodType<import("./json.ts").Json, unknown, z.core.$ZodTypeInternals<import("./json.ts").Json, unknown>>>;
153
+ problem: z.ZodOptional<z.ZodObject<{
154
+ code: z.ZodUnion<readonly [z.ZodEnum<{
155
+ VALIDATION_FAILED: "VALIDATION_FAILED";
156
+ NOT_FOUND: "NOT_FOUND";
157
+ NOT_PUBLIC: "NOT_PUBLIC";
158
+ NOT_A_COMMAND: "NOT_A_COMMAND";
159
+ READ_ONLY: "READ_ONLY";
160
+ NO_JOB: "NO_JOB";
161
+ TOO_LARGE: "TOO_LARGE";
162
+ TOO_DEEP: "TOO_DEEP";
163
+ TIMEOUT: "TIMEOUT";
164
+ CANCELLED: "CANCELLED";
165
+ WORKER_CRASHED: "WORKER_CRASHED";
166
+ INTERRUPTED: "INTERRUPTED";
167
+ HANDLER_FAILED: "HANDLER_FAILED";
168
+ FORBIDDEN_ORIGIN: "FORBIDDEN_ORIGIN";
169
+ PROCESS_RUNNING: "PROCESS_RUNNING";
170
+ PORT_IN_USE: "PORT_IN_USE";
171
+ EXTENSION_INVALID: "EXTENSION_INVALID";
172
+ KVMAN_RUNNING: "KVMAN_RUNNING";
173
+ }>, z.ZodString]>;
174
+ message: z.ZodString;
175
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./json.ts").Json, unknown, z.core.$ZodTypeInternals<import("./json.ts").Json, unknown>>>>;
176
+ }, z.core.$strict>>;
177
+ createdAt: z.ZodISODateTime;
178
+ startedAt: z.ZodOptional<z.ZodISODateTime>;
179
+ endedAt: z.ZodOptional<z.ZodISODateTime>;
180
+ }, z.core.$strict>;
181
+ }, z.core.$strict>, z.ZodObject<{
182
+ ok: z.ZodLiteral<false>;
183
+ problem: z.ZodObject<{
184
+ code: z.ZodUnion<readonly [z.ZodEnum<{
185
+ VALIDATION_FAILED: "VALIDATION_FAILED";
186
+ NOT_FOUND: "NOT_FOUND";
187
+ NOT_PUBLIC: "NOT_PUBLIC";
188
+ NOT_A_COMMAND: "NOT_A_COMMAND";
189
+ READ_ONLY: "READ_ONLY";
190
+ NO_JOB: "NO_JOB";
191
+ TOO_LARGE: "TOO_LARGE";
192
+ TOO_DEEP: "TOO_DEEP";
193
+ TIMEOUT: "TIMEOUT";
194
+ CANCELLED: "CANCELLED";
195
+ WORKER_CRASHED: "WORKER_CRASHED";
196
+ INTERRUPTED: "INTERRUPTED";
197
+ HANDLER_FAILED: "HANDLER_FAILED";
198
+ FORBIDDEN_ORIGIN: "FORBIDDEN_ORIGIN";
199
+ PROCESS_RUNNING: "PROCESS_RUNNING";
200
+ PORT_IN_USE: "PORT_IN_USE";
201
+ EXTENSION_INVALID: "EXTENSION_INVALID";
202
+ KVMAN_RUNNING: "KVMAN_RUNNING";
203
+ }>, z.ZodString]>;
204
+ message: z.ZodString;
205
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./json.ts").Json, unknown, z.core.$ZodTypeInternals<import("./json.ts").Json, unknown>>>>;
206
+ }, z.core.$strict>;
207
+ jobId: z.ZodOptional<z.ZodUUID>;
208
+ }, z.core.$strict>], "ok">;
209
+ /** Accepts the answer of a file upload. */
210
+ export declare const fileEnvelopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
211
+ ok: z.ZodLiteral<true>;
212
+ file: z.ZodObject<{
213
+ id: z.ZodUUID;
214
+ name: z.ZodString;
215
+ type: z.ZodString;
216
+ size: z.ZodNumber;
217
+ owner: z.ZodDiscriminatedUnion<[z.ZodObject<{
218
+ kind: z.ZodLiteral<"user">;
219
+ }, z.core.$strict>, z.ZodObject<{
220
+ kind: z.ZodLiteral<"extension">;
221
+ name: z.ZodString;
222
+ }, z.core.$strict>], "kind">;
223
+ workspaceId: z.ZodString;
224
+ createdAt: z.ZodISODateTime;
225
+ }, z.core.$strict>;
226
+ }, z.core.$strict>, z.ZodObject<{
227
+ ok: z.ZodLiteral<false>;
228
+ problem: z.ZodObject<{
229
+ code: z.ZodUnion<readonly [z.ZodEnum<{
230
+ VALIDATION_FAILED: "VALIDATION_FAILED";
231
+ NOT_FOUND: "NOT_FOUND";
232
+ NOT_PUBLIC: "NOT_PUBLIC";
233
+ NOT_A_COMMAND: "NOT_A_COMMAND";
234
+ READ_ONLY: "READ_ONLY";
235
+ NO_JOB: "NO_JOB";
236
+ TOO_LARGE: "TOO_LARGE";
237
+ TOO_DEEP: "TOO_DEEP";
238
+ TIMEOUT: "TIMEOUT";
239
+ CANCELLED: "CANCELLED";
240
+ WORKER_CRASHED: "WORKER_CRASHED";
241
+ INTERRUPTED: "INTERRUPTED";
242
+ HANDLER_FAILED: "HANDLER_FAILED";
243
+ FORBIDDEN_ORIGIN: "FORBIDDEN_ORIGIN";
244
+ PROCESS_RUNNING: "PROCESS_RUNNING";
245
+ PORT_IN_USE: "PORT_IN_USE";
246
+ EXTENSION_INVALID: "EXTENSION_INVALID";
247
+ KVMAN_RUNNING: "KVMAN_RUNNING";
248
+ }>, z.ZodString]>;
249
+ message: z.ZodString;
250
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./json.ts").Json, unknown, z.core.$ZodTypeInternals<import("./json.ts").Json, unknown>>>>;
251
+ }, z.core.$strict>;
252
+ jobId: z.ZodOptional<z.ZodUUID>;
253
+ }, z.core.$strict>], "ok">;
254
+ /** Accepts an answer that carries no data, such as a cancel. */
255
+ export declare const emptyEnvelopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
256
+ ok: z.ZodLiteral<true>;
257
+ }, z.core.$strict>, z.ZodObject<{
258
+ ok: z.ZodLiteral<false>;
259
+ problem: z.ZodObject<{
260
+ code: z.ZodUnion<readonly [z.ZodEnum<{
261
+ VALIDATION_FAILED: "VALIDATION_FAILED";
262
+ NOT_FOUND: "NOT_FOUND";
263
+ NOT_PUBLIC: "NOT_PUBLIC";
264
+ NOT_A_COMMAND: "NOT_A_COMMAND";
265
+ READ_ONLY: "READ_ONLY";
266
+ NO_JOB: "NO_JOB";
267
+ TOO_LARGE: "TOO_LARGE";
268
+ TOO_DEEP: "TOO_DEEP";
269
+ TIMEOUT: "TIMEOUT";
270
+ CANCELLED: "CANCELLED";
271
+ WORKER_CRASHED: "WORKER_CRASHED";
272
+ INTERRUPTED: "INTERRUPTED";
273
+ HANDLER_FAILED: "HANDLER_FAILED";
274
+ FORBIDDEN_ORIGIN: "FORBIDDEN_ORIGIN";
275
+ PROCESS_RUNNING: "PROCESS_RUNNING";
276
+ PORT_IN_USE: "PORT_IN_USE";
277
+ EXTENSION_INVALID: "EXTENSION_INVALID";
278
+ KVMAN_RUNNING: "KVMAN_RUNNING";
279
+ }>, z.ZodString]>;
280
+ message: z.ZodString;
281
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./json.ts").Json, unknown, z.core.$ZodTypeInternals<import("./json.ts").Json, unknown>>>>;
282
+ }, z.core.$strict>;
283
+ jobId: z.ZodOptional<z.ZodUUID>;
284
+ }, z.core.$strict>], "ok">;
285
+ //# sourceMappingURL=envelope.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"envelope.d.ts","sourceRoot":"","sources":["../src/envelope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,gGAAgG;AAChG,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAIhC,CAAC;AAEH,yFAAyF;AACzF,wBAAgB,cAAc,CAAC,KAAK,SAAS,CAAC,CAAC,WAAW,EAAE,IAAI,EAAE,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAEtE;AAED,uDAAuD;AACvD,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAA0D,CAAC;AAE5F,iEAAiE;AACjE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAAsC,CAAC;AAExE,iDAAiD;AACjD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAAqC,CAAC;AAEpE,2CAA2C;AAC3C,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAAuC,CAAC;AAEvE,gEAAgE;AAChE,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAAqB,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { z } from 'zod';
2
+ import { jsonSchema } from "./json.js";
3
+ import { problemSchema } from "./problem.js";
4
+ import { fileSchema, idSchema, jobSchema } from "./rows.js";
5
+ /** Accepts a failed HTTP answer: the Problem, and the job id when a command or query failed. */
6
+ export const failureEnvelopeSchema = z.strictObject({
7
+ ok: z.literal(false),
8
+ problem: problemSchema,
9
+ jobId: idSchema.optional(),
10
+ });
11
+ /** Makes the schema of an HTTP answer: `{ ok: true, …data }` or the failure envelope. */
12
+ export function envelopeSchema(data) {
13
+ return z.discriminatedUnion('ok', [z.strictObject({ ok: z.literal(true), ...data }), failureEnvelopeSchema]);
14
+ }
15
+ /** Accepts the answer of a sync command or a query. */
16
+ export const outputEnvelopeSchema = envelopeSchema({ output: jsonSchema, jobId: idSchema });
17
+ /** Accepts the answer of a command queued with `async: true`. */
18
+ export const queuedEnvelopeSchema = envelopeSchema({ jobId: idSchema });
19
+ /** Accepts the answer of `GET /api/jobs/:id`. */
20
+ export const jobEnvelopeSchema = envelopeSchema({ job: jobSchema });
21
+ /** Accepts the answer of a file upload. */
22
+ export const fileEnvelopeSchema = envelopeSchema({ file: fileSchema });
23
+ /** Accepts an answer that carries no data, such as a cancel. */
24
+ export const emptyEnvelopeSchema = envelopeSchema({});
25
+ //# sourceMappingURL=envelope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"envelope.js","sourceRoot":"","sources":["../src/envelope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,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from './ctx.ts';
4
+ export * from './envelope.ts';
5
+ export * from './json.ts';
6
+ export * from './kernel-api.ts';
7
+ export * from './manifest.ts';
8
+ export * from './preset.ts';
9
+ export * from './problem.ts';
10
+ export * from './registrations.ts';
11
+ export * from './registry.ts';
12
+ export * from './rows.ts';
13
+ export * from './store.ts';
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qGAAqG;AACrG,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,14 @@
1
+ /** zod, shared by the kernel and every extension; build schemas with it, never with your own zod. */
2
+ export { z } from 'zod';
3
+ export * from "./ctx.js";
4
+ export * from "./envelope.js";
5
+ export * from "./json.js";
6
+ export * from "./kernel-api.js";
7
+ export * from "./manifest.js";
8
+ export * from "./preset.js";
9
+ export * from "./problem.js";
10
+ export * from "./registrations.js";
11
+ export * from "./registry.js";
12
+ export * from "./rows.js";
13
+ export * from "./store.js";
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qGAAqG;AACrG,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC"}
package/dist/json.d.ts ADDED
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+ /** A JSON value that is not an array or object. */
3
+ export type JsonPrimitive = string | number | boolean | null;
4
+ /** Any JSON value; an object field may be `undefined` (as zod infers optional fields), which JSON leaves out. */
5
+ export type Json = JsonPrimitive | Json[] | {
6
+ [key: string]: Json | undefined;
7
+ };
8
+ /** A JSON object; a field may be `undefined`, which JSON leaves out. */
9
+ export type JsonObject = {
10
+ [key: string]: Json | undefined;
11
+ };
12
+ /** Accepts any JSON value: finite numbers, strings, booleans, null, arrays, and plain objects. */
13
+ export declare const jsonSchema: z.ZodType<Json>;
14
+ //# sourceMappingURL=json.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../src/json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,mDAAmD;AACnD,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAE7D,iHAAiH;AACjH,MAAM,MAAM,IAAI,GAAG,aAAa,GAAG,IAAI,EAAE,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;CAAE,CAAC;AAEhF,wEAAwE;AACxE,MAAM,MAAM,UAAU,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;CAAE,CAAC;AAE7D,kGAAkG;AAClG,eAAO,MAAM,UAAU,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAEtC,CAAC"}
package/dist/json.js ADDED
@@ -0,0 +1,4 @@
1
+ import { z } from 'zod';
2
+ /** Accepts any JSON value: finite numbers, strings, booleans, null, arrays, and plain objects. */
3
+ export const jsonSchema = z.lazy(() => z.union([z.string(), z.number(), z.boolean(), z.null(), z.array(jsonSchema), z.record(z.string(), jsonSchema)]));
4
+ //# sourceMappingURL=json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.js","sourceRoot":"","sources":["../src/json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB,kGAAkG;AAClG,MAAM,CAAC,MAAM,UAAU,GAAoB,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CACrD,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC,CAChH,CAAC"}