@ultrst-armada/kloks 1.4.8 → 1.5.1

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.
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schema": 1,
3
3
  "packageName": "@ultrst-armada/kloks",
4
- "version": "1.4.8",
5
- "sourceCommit": "6ab0d5dfede2344d9dd35ce366b67ac44b808401",
4
+ "version": "1.5.1",
5
+ "sourceCommit": "df4285ad26bbf5f16acaca63ba43fe4e40740051",
6
6
  "releaseWorkflow": "npm Release",
7
- "workflowRunId": "39557640590"
7
+ "workflowRunId": "39943915592"
8
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultrst-armada/kloks",
3
- "version": "1.4.8",
3
+ "version": "1.5.1",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -104,6 +104,11 @@
104
104
  "types": "./packages/client/dist/index.d.ts",
105
105
  "import": "./packages/client/dist/index.js",
106
106
  "default": "./packages/client/dist/index.js"
107
+ },
108
+ "./development": {
109
+ "types": "./packages/backend/dist/development/index.d.ts",
110
+ "import": "./packages/backend/dist/development/index.js",
111
+ "default": "./packages/backend/dist/development/index.js"
107
112
  }
108
113
  },
109
114
  "scripts": {
@@ -119,7 +124,8 @@
119
124
  "bcryptjs": "^2.4.3",
120
125
  "ws": "^8.18.0",
121
126
  "zod": "^3.24.1",
122
- "zustand": "^5.0.15"
127
+ "zustand": "^5.0.15",
128
+ "@webcontainer/api": "^1.6.4"
123
129
  },
124
130
  "peerDependencies": {
125
131
  "@neondatabase/serverless": "^0.10.0 || ^1.0.0",
@@ -0,0 +1,159 @@
1
+ import {
2
+ StorageAdapterFactory
3
+ } from "./chunk-J2J24JVC.js";
4
+ import {
5
+ findUserWorkspace
6
+ } from "./chunk-E72GXBXF.js";
7
+
8
+ // src/services/workspaceGraphService.ts
9
+ function slugify(name) {
10
+ const value = String(name || "").trim().replace(/[/\\]+/g, "_").replace(/[<>:"|?*]/g, "").slice(0, 80);
11
+ return value || "New Graph";
12
+ }
13
+ function storage() {
14
+ return StorageAdapterFactory.create({
15
+ provider: "local_fs",
16
+ basePath: process.env.KLOKS_GRAPH_STORAGE_ROOT || "./workspaces-data"
17
+ });
18
+ }
19
+ function graphPath(workspaceId, slug) {
20
+ return `workspaces/${workspaceId}/graphs/${slug}.graph.json`;
21
+ }
22
+ async function assertWorkspace(userId, workspaceId) {
23
+ const result = await findUserWorkspace(workspaceId);
24
+ if (!result.workspace || !result.user || result.user.id !== userId) {
25
+ throw new Error(`Workspace ${workspaceId} does not exist`);
26
+ }
27
+ return result.workspace;
28
+ }
29
+ async function readGraph(workspaceId, slug) {
30
+ const adapter = storage();
31
+ const path = graphPath(workspaceId, slug);
32
+ if (!await adapter.exists(path)) return null;
33
+ const raw = new TextDecoder().decode(await adapter.read(path));
34
+ return JSON.parse(raw);
35
+ }
36
+ async function writeGraph(document) {
37
+ const adapter = storage();
38
+ await adapter.write(graphPath(document.workspaceId, document.graphSlug), JSON.stringify(document, null, 2), "application/json");
39
+ }
40
+ function toDocument(workspaceId, id, name, slug, nodes = [], edges = [], createdAt = (/* @__PURE__ */ new Date()).toISOString()) {
41
+ const now = (/* @__PURE__ */ new Date()).toISOString();
42
+ return {
43
+ $schema: "https://skipo.dev/schemas/node-graph.v1.json",
44
+ version: "1.0.0",
45
+ appId: workspaceId,
46
+ appName: name,
47
+ createdAt,
48
+ updatedAt: now,
49
+ exportedAt: now,
50
+ workspaceId,
51
+ graphId: id,
52
+ graphSlug: slug,
53
+ graph: { nodes, edges }
54
+ };
55
+ }
56
+ var workspaceGraphService = {
57
+ async listGraphs(userId, workspaceId) {
58
+ await assertWorkspace(userId, workspaceId);
59
+ const adapter = storage();
60
+ const files = await adapter.list(`workspaces/${workspaceId}/graphs`);
61
+ const graphs = [];
62
+ for (const file of files.filter((item) => item.path.endsWith(".graph.json"))) {
63
+ try {
64
+ const raw = new TextDecoder().decode(await adapter.read(file.path));
65
+ const graph = JSON.parse(raw);
66
+ graphs.push({
67
+ id: graph.graphId,
68
+ name: graph.appName,
69
+ slug: graph.graphSlug,
70
+ createdAt: graph.createdAt,
71
+ updatedAt: graph.updatedAt,
72
+ nodeCount: graph.graph.nodes.length
73
+ });
74
+ } catch {
75
+ }
76
+ }
77
+ graphs.sort((a, b) => a.createdAt.localeCompare(b.createdAt));
78
+ return { success: true, graphs };
79
+ },
80
+ async createGraph(userId, workspaceId, input) {
81
+ await assertWorkspace(userId, workspaceId);
82
+ const targetName = String(input?.name || "").trim().slice(0, 80) || "New Graph";
83
+ const baseSlug = slugify(targetName);
84
+ let slug = baseSlug;
85
+ let n = 2;
86
+ while (await readGraph(workspaceId, slug)) slug = `${baseSlug} (${n++})`;
87
+ const graph = toDocument(workspaceId, `graph-${Date.now()}`, targetName, slug);
88
+ await writeGraph(graph);
89
+ return { success: true, graph, graphs: (await this.listGraphs(userId, workspaceId)).graphs };
90
+ },
91
+ async getGraph(userId, workspaceId, slug) {
92
+ await assertWorkspace(userId, workspaceId);
93
+ const graph = await readGraph(workspaceId, slug);
94
+ if (!graph) throw new Error(`Graph "${slug}" not found`);
95
+ return { success: true, graph };
96
+ },
97
+ async saveGraph(userId, workspaceId, slug, patch) {
98
+ await assertWorkspace(userId, workspaceId);
99
+ const existing = await readGraph(workspaceId, slug);
100
+ if (!existing) throw new Error(`Graph "${slug}" not found`);
101
+ const next = {
102
+ ...existing,
103
+ appName: typeof patch.name === "string" && patch.name.trim() ? patch.name.trim().slice(0, 80) : existing.appName,
104
+ graph: {
105
+ nodes: Array.isArray(patch.nodes) ? patch.nodes : existing.graph.nodes,
106
+ edges: Array.isArray(patch.edges) ? patch.edges : existing.graph.edges
107
+ },
108
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
109
+ exportedAt: (/* @__PURE__ */ new Date()).toISOString()
110
+ };
111
+ await writeGraph(next);
112
+ return { success: true, graph: next };
113
+ },
114
+ async deleteGraph(userId, workspaceId, slug) {
115
+ await assertWorkspace(userId, workspaceId);
116
+ const adapter = storage();
117
+ const path = graphPath(workspaceId, slug);
118
+ if (!await adapter.exists(path)) throw new Error(`Graph "${slug}" not found`);
119
+ await adapter.delete(path);
120
+ return { success: true, deletedSlug: slug, graphs: (await this.listGraphs(userId, workspaceId)).graphs };
121
+ },
122
+ async duplicateGraph(userId, workspaceId, slug, newName) {
123
+ const existing = (await this.getGraph(userId, workspaceId, slug)).graph;
124
+ const targetName = (newName || `${existing.appName} (Copy)`).trim().slice(0, 80);
125
+ const baseSlug = slugify(targetName);
126
+ let newSlug = baseSlug;
127
+ let n = 2;
128
+ while (await readGraph(workspaceId, newSlug)) newSlug = `${baseSlug} (${n++})`;
129
+ const now = (/* @__PURE__ */ new Date()).toISOString();
130
+ const graph = {
131
+ ...JSON.parse(JSON.stringify(existing)),
132
+ graphId: `graph-${Date.now()}`,
133
+ graphSlug: newSlug,
134
+ appName: targetName,
135
+ createdAt: now,
136
+ updatedAt: now,
137
+ exportedAt: now
138
+ };
139
+ await writeGraph(graph);
140
+ return { success: true, graph, graphs: (await this.listGraphs(userId, workspaceId)).graphs };
141
+ },
142
+ async clearGraph(userId, workspaceId, slug) {
143
+ const existing = (await this.getGraph(userId, workspaceId, slug)).graph;
144
+ return this.saveGraph(userId, workspaceId, slug, { nodes: [], edges: [] });
145
+ },
146
+ async getGraphDocument(userId, workspaceId, slug) {
147
+ return (await this.getGraph(userId, workspaceId, slug)).graph;
148
+ },
149
+ async saveGraphDocument(userId, workspaceId, document) {
150
+ await assertWorkspace(userId, workspaceId);
151
+ if (document.workspaceId !== workspaceId) throw new Error("Graph workspace mismatch");
152
+ await writeGraph({ ...document, updatedAt: (/* @__PURE__ */ new Date()).toISOString(), exportedAt: (/* @__PURE__ */ new Date()).toISOString() });
153
+ return { success: true, graph: document };
154
+ }
155
+ };
156
+
157
+ export {
158
+ workspaceGraphService
159
+ };
@@ -1,7 +1,13 @@
1
+ import {
2
+ workspaceGraphService
3
+ } from "./chunk-DBZVGMJ7.js";
1
4
  import {
2
5
  getSrklAccounts,
3
6
  srklListBackblazeBuckets
4
7
  } from "./chunk-VDROUXFT.js";
8
+ import {
9
+ StorageAdapterFactory
10
+ } from "./chunk-J2J24JVC.js";
5
11
  import {
6
12
  b2ListBuckets
7
13
  } from "./chunk-4QEMALXF.js";
@@ -9,20 +15,6 @@ import {
9
15
  formatCanonicalWorkspaceFolderName,
10
16
  sanitizeWorkspaceName
11
17
  } from "./chunk-FZKBTF34.js";
12
- import {
13
- RateLimiter,
14
- SessionManager,
15
- loginSystemUser,
16
- resolveUserFromToken
17
- } from "./chunk-ZDH4XI7W.js";
18
- import {
19
- createService,
20
- createServiceDefinition,
21
- workspaceGraphService
22
- } from "./chunk-ZFCEXTNI.js";
23
- import {
24
- StorageAdapterFactory
25
- } from "./chunk-J2J24JVC.js";
26
18
  import {
27
19
  createWorkspace,
28
20
  deleteWorkspace,
@@ -31,6 +23,16 @@ import {
31
23
  queryUnifiedDb,
32
24
  updateWorkspace
33
25
  } from "./chunk-E72GXBXF.js";
26
+ import {
27
+ RateLimiter,
28
+ SessionManager,
29
+ loginSystemUser,
30
+ resolveUserFromToken
31
+ } from "./chunk-ZDH4XI7W.js";
32
+ import {
33
+ createService,
34
+ createServiceDefinition
35
+ } from "./chunk-TY32TUNI.js";
34
36
 
35
37
  // src/krnl-services.ts
36
38
  var AuthServiceDefinition = createServiceDefinition({
@@ -0,0 +1,298 @@
1
+ import {
2
+ createService,
3
+ createServiceDefinition
4
+ } from "./chunk-TY32TUNI.js";
5
+
6
+ // src/development/githubActionsService.ts
7
+ var GitHubActionsClient = class {
8
+ constructor(config) {
9
+ this.config = config;
10
+ this.baseUrl = config.apiBaseUrl ?? "https://api.github.com";
11
+ this.fetchImpl = config.fetchImpl ?? fetch;
12
+ }
13
+ config;
14
+ baseUrl;
15
+ fetchImpl;
16
+ async request(path, init = {}) {
17
+ const response = await this.fetchImpl(this.baseUrl + path, {
18
+ ...init,
19
+ headers: {
20
+ Accept: "application/vnd.github+json",
21
+ Authorization: `Bearer ${this.config.token}`,
22
+ "X-GitHub-Api-Version": "2022-11-28",
23
+ ...init.headers ?? {}
24
+ }
25
+ });
26
+ const text = await response.text();
27
+ const data = text ? JSON.parse(text) : void 0;
28
+ if (!response.ok) {
29
+ throw new Error(`GitHub Actions request failed (${response.status}): ${data?.message ?? response.statusText}`);
30
+ }
31
+ return data;
32
+ }
33
+ listWorkflowRuns(repository, workflowId, branch) {
34
+ const suffix = workflowId ? `/actions/workflows/${workflowId}/runs` : "/actions/runs";
35
+ const query = branch ? `?branch=${encodeURIComponent(branch)}` : "";
36
+ return this.request(`/repos/${repository}${suffix}${query}`);
37
+ }
38
+ getWorkflowRun(repository, runId) {
39
+ return this.request(`/repos/${repository}/actions/runs/${runId}`);
40
+ }
41
+ getWorkflowJobs(repository, runId) {
42
+ return this.request(
43
+ `/repos/${repository}/actions/runs/${runId}/jobs`
44
+ );
45
+ }
46
+ getJobLogs(repository, jobId) {
47
+ return this.request(`/repos/${repository}/actions/jobs/${jobId}/logs`);
48
+ }
49
+ listArtifacts(repository, runId) {
50
+ const path = runId ? `/repos/${repository}/actions/runs/${runId}/artifacts` : `/repos/${repository}/actions/artifacts`;
51
+ return this.request(path);
52
+ }
53
+ dispatchWorkflow(repository, workflowId, ref, inputs = {}) {
54
+ return this.request(`/repos/${repository}/actions/workflows/${workflowId}/dispatches`, {
55
+ method: "POST",
56
+ body: JSON.stringify({ ref, inputs }),
57
+ headers: { "Content-Type": "application/json" }
58
+ });
59
+ }
60
+ rerunWorkflow(repository, runId) {
61
+ return this.request(`/repos/${repository}/actions/runs/${runId}/rerun`, { method: "POST" });
62
+ }
63
+ rerunFailedJobs(repository, runId) {
64
+ return this.request(`/repos/${repository}/actions/runs/${runId}/rerun-failed-jobs`, { method: "POST" });
65
+ }
66
+ cancelWorkflow(repository, runId) {
67
+ return this.request(`/repos/${repository}/actions/runs/${runId}/cancel`, { method: "POST" });
68
+ }
69
+ };
70
+ var GitHubActionsServiceDefinition = createServiceDefinition({
71
+ id: "kloks.backend.githubActions",
72
+ name: "GitHubActionsService",
73
+ version: "1.0.0",
74
+ operations: {
75
+ listWorkflowRuns: { id: "GitHubActionsService.listWorkflowRuns", name: "listWorkflowRuns", handler: async (i) => new GitHubActionsClient({ token: i.token }).listWorkflowRuns(i.repository, i.workflowId, i.branch) },
76
+ getWorkflowRun: { id: "GitHubActionsService.getWorkflowRun", name: "getWorkflowRun", handler: async (i) => new GitHubActionsClient({ token: i.token }).getWorkflowRun(i.repository, i.runId) },
77
+ getWorkflowJobs: { id: "GitHubActionsService.getWorkflowJobs", name: "getWorkflowJobs", handler: async (i) => new GitHubActionsClient({ token: i.token }).getWorkflowJobs(i.repository, i.runId) },
78
+ getJobLogs: { id: "GitHubActionsService.getJobLogs", name: "getJobLogs", handler: async (i) => new GitHubActionsClient({ token: i.token }).getJobLogs(i.repository, i.jobId) },
79
+ listArtifacts: { id: "GitHubActionsService.listArtifacts", name: "listArtifacts", handler: async (i) => new GitHubActionsClient({ token: i.token }).listArtifacts(i.repository, i.runId) },
80
+ dispatchWorkflow: { id: "GitHubActionsService.dispatchWorkflow", name: "dispatchWorkflow", handler: async (i) => new GitHubActionsClient({ token: i.token }).dispatchWorkflow(i.repository, i.workflowId, i.ref, i.inputs) },
81
+ rerunWorkflow: { id: "GitHubActionsService.rerunWorkflow", name: "rerunWorkflow", handler: async (i) => new GitHubActionsClient({ token: i.token }).rerunWorkflow(i.repository, i.runId) },
82
+ rerunFailedJobs: { id: "GitHubActionsService.rerunFailedJobs", name: "rerunFailedJobs", handler: async (i) => new GitHubActionsClient({ token: i.token }).rerunFailedJobs(i.repository, i.runId) },
83
+ cancelWorkflow: { id: "GitHubActionsService.cancelWorkflow", name: "cancelWorkflow", handler: async (i) => new GitHubActionsClient({ token: i.token }).cancelWorkflow(i.repository, i.runId) }
84
+ }
85
+ });
86
+ var GitHubActionsServiceFacade = {
87
+ id: GitHubActionsServiceDefinition.id,
88
+ name: GitHubActionsServiceDefinition.name,
89
+ version: GitHubActionsServiceDefinition.version,
90
+ runtime: "server",
91
+ deployment: "remote",
92
+ definition: GitHubActionsServiceDefinition,
93
+ createInstance: () => createService(GitHubActionsServiceDefinition),
94
+ execute: async (op, input) => {
95
+ const instance = createService(GitHubActionsServiceDefinition);
96
+ await instance.start();
97
+ return instance.call(op, input);
98
+ }
99
+ };
100
+
101
+ // src/development/webContainerService.ts
102
+ var COMMANDS = {
103
+ install: { command: "pnpm", args: ["install", "--no-frozen-lockfile"] },
104
+ lint: { command: "pnpm", args: ["lint"] },
105
+ test: { command: "pnpm", args: ["test"] },
106
+ build: { command: "pnpm", args: ["build"] },
107
+ validate: { command: "pnpm", args: ["lint"] },
108
+ check: { command: "pnpm", args: ["lint"] }
109
+ };
110
+ var runQueue = Promise.resolve();
111
+ var WebContainerRuntime = class {
112
+ container = null;
113
+ instancePromise = null;
114
+ async boot() {
115
+ if (typeof window !== "undefined" && !window.crossOriginIsolated) {
116
+ throw new Error("WebContainer requires a cross-origin-isolated page. Ensure COOP=same-origin and COEP=require-corp are served.");
117
+ }
118
+ if (this.container) return this.container;
119
+ if (!this.instancePromise) {
120
+ this.instancePromise = import("@webcontainer/api").then(async (module) => {
121
+ const container = await module.WebContainer.boot({
122
+ coep: "require-corp",
123
+ workdirName: "kloks-development"
124
+ });
125
+ this.container = container;
126
+ return container;
127
+ }).catch((error) => {
128
+ this.instancePromise = null;
129
+ throw error;
130
+ });
131
+ }
132
+ return this.instancePromise;
133
+ }
134
+ async mount(files) {
135
+ const container = await this.boot();
136
+ await container.mount(files);
137
+ return { mounted: true };
138
+ }
139
+ async runProcess(command, args, cwd, env) {
140
+ const container = await this.boot();
141
+ const process = await container.spawn(command, args, { cwd, env });
142
+ let output = "";
143
+ const reader = process.output.getReader();
144
+ try {
145
+ while (true) {
146
+ const next = await reader.read();
147
+ if (next.done) break;
148
+ output += next.value;
149
+ }
150
+ } finally {
151
+ reader.releaseLock();
152
+ }
153
+ return { exitCode: await process.exit, output };
154
+ }
155
+ async run(task, cwd, env) {
156
+ const spec = COMMANDS[task];
157
+ return this.runCommand(spec.command, spec.args, cwd, env);
158
+ }
159
+ async runCommand(command, args = [], cwd, env) {
160
+ const previous = runQueue;
161
+ let release;
162
+ runQueue = new Promise((resolve) => {
163
+ release = resolve;
164
+ });
165
+ await previous;
166
+ try {
167
+ return await this.runProcess(command, args, cwd, env);
168
+ } finally {
169
+ release();
170
+ }
171
+ }
172
+ async teardown() {
173
+ const container = this.container;
174
+ this.container = null;
175
+ this.instancePromise = null;
176
+ container?.teardown();
177
+ return { tornDown: true };
178
+ }
179
+ };
180
+ var runtime = new WebContainerRuntime();
181
+ var WebContainerServiceDefinition = createServiceDefinition({
182
+ id: "kloks.backend.webContainer",
183
+ name: "WebContainerService",
184
+ version: "1.1.0",
185
+ operations: {
186
+ boot: { id: "WebContainerService.boot", name: "boot", handler: async () => {
187
+ await runtime.boot();
188
+ return { ready: true };
189
+ } },
190
+ mount: { id: "WebContainerService.mount", name: "mount", handler: async (input) => runtime.mount(input.files) },
191
+ run: { id: "WebContainerService.run", name: "run", handler: async (input) => runtime.run(input.task, input.cwd, input.env) },
192
+ runCommand: { id: "WebContainerService.runCommand", name: "runCommand", handler: async (input) => runtime.runCommand(input.command, input.args, input.cwd, input.env) },
193
+ teardown: { id: "WebContainerService.teardown", name: "teardown", handler: async () => runtime.teardown() },
194
+ command: { id: "WebContainerService.command", name: "command", handler: async (input) => ({ task: input.task, command: COMMANDS[input.task] }) }
195
+ }
196
+ });
197
+ var WebContainerServiceFacade = {
198
+ id: WebContainerServiceDefinition.id,
199
+ name: WebContainerServiceDefinition.name,
200
+ version: WebContainerServiceDefinition.version,
201
+ runtime: "client",
202
+ deployment: "local",
203
+ definition: WebContainerServiceDefinition,
204
+ createInstance: () => createService(WebContainerServiceDefinition),
205
+ execute: async (op, input) => {
206
+ const instance = createService(WebContainerServiceDefinition);
207
+ await instance.start();
208
+ return instance.call(op, input);
209
+ }
210
+ };
211
+
212
+ // src/development/developmentService.ts
213
+ function resolveDevelopmentCommand(task) {
214
+ const commands = {
215
+ install: ["pnpm", ["install", "--no-frozen-lockfile"]],
216
+ lint: ["pnpm", ["lint"]],
217
+ test: ["pnpm", ["test"]],
218
+ build: ["pnpm", ["build"]],
219
+ validate: ["pnpm", ["validate"]],
220
+ check: ["pnpm", ["lint"]]
221
+ };
222
+ return commands[task];
223
+ }
224
+ var DevelopmentServiceDefinition = createServiceDefinition({
225
+ id: "kloks.backend.development",
226
+ name: "DevelopmentService",
227
+ version: "1.0.0",
228
+ operations: {
229
+ plan: {
230
+ id: "DevelopmentService.plan",
231
+ name: "plan",
232
+ handler: async (input) => {
233
+ const [command, args] = resolveDevelopmentCommand(input.task);
234
+ return { task: input.task, command, args };
235
+ }
236
+ },
237
+ describeProviders: {
238
+ id: "DevelopmentService.describeProviders",
239
+ name: "describeProviders",
240
+ handler: async () => ({
241
+ providers: [
242
+ { id: "webcontainer", capabilities: ["install", "lint", "test", "build", "validate", "check"] },
243
+ { id: "github-actions", capabilities: ["dispatch", "observe", "rerun", "cancel"] }
244
+ ]
245
+ })
246
+ }
247
+ }
248
+ });
249
+ var DevelopmentRuntime = class {
250
+ constructor(webContainer = new WebContainerRuntime(), githubActions) {
251
+ this.webContainer = webContainer;
252
+ this.githubActions = githubActions;
253
+ }
254
+ webContainer;
255
+ githubActions;
256
+ async run(request) {
257
+ if (request.provider === "webcontainer") {
258
+ const [command, args] = resolveDevelopmentCommand(request.task);
259
+ const result = await this.webContainer.run(request.task, request.cwd, request.env);
260
+ return { provider: request.provider, task: request.task, ok: result.exitCode === 0, exitCode: result.exitCode, output: result.output };
261
+ }
262
+ if (!this.githubActions || !request.repository || !request.workflowId || !request.ref) {
263
+ throw new Error("GitHub Actions execution requires repository, workflowId, ref, and an authenticated client");
264
+ }
265
+ await this.githubActions.dispatchWorkflow(request.repository, request.workflowId, request.ref, {
266
+ task: request.task,
267
+ ...request.workflowInputs ?? {}
268
+ });
269
+ return { provider: request.provider, task: request.task, ok: true, output: "Workflow dispatched; observe its run for final status." };
270
+ }
271
+ };
272
+ var DevelopmentServiceFacade = {
273
+ id: DevelopmentServiceDefinition.id,
274
+ name: DevelopmentServiceDefinition.name,
275
+ version: DevelopmentServiceDefinition.version,
276
+ runtime: "server",
277
+ deployment: "local",
278
+ definition: DevelopmentServiceDefinition,
279
+ createInstance: () => createService(DevelopmentServiceDefinition),
280
+ execute: async (op, input) => {
281
+ const instance = createService(DevelopmentServiceDefinition);
282
+ await instance.start();
283
+ return instance.call(op, input);
284
+ }
285
+ };
286
+
287
+ export {
288
+ GitHubActionsClient,
289
+ GitHubActionsServiceDefinition,
290
+ GitHubActionsServiceFacade,
291
+ WebContainerRuntime,
292
+ WebContainerServiceDefinition,
293
+ WebContainerServiceFacade,
294
+ resolveDevelopmentCommand,
295
+ DevelopmentServiceDefinition,
296
+ DevelopmentRuntime,
297
+ DevelopmentServiceFacade
298
+ };
@@ -2,7 +2,7 @@ import {
2
2
  createService,
3
3
  createServiceDefinition,
4
4
  createServiceProxy
5
- } from "./chunk-ZFCEXTNI.js";
5
+ } from "./chunk-TY32TUNI.js";
6
6
 
7
7
  // src/services/ServiceBoundary.ts
8
8
  function createLocalService(definition) {
@@ -1,10 +1,3 @@
1
- import {
2
- StorageAdapterFactory
3
- } from "./chunk-J2J24JVC.js";
4
- import {
5
- findUserWorkspace
6
- } from "./chunk-E72GXBXF.js";
7
-
8
1
  // ../../node_modules/.pnpm/@ultrst-armada+krnl@1.0.3/node_modules/@ultrst-armada/krnl/packages/core/dist/index.js
9
2
  var ServiceStateStore = class {
10
3
  state;
@@ -376,158 +369,8 @@ function createServiceProxy(definition, adapter, endpoint) {
376
369
  }
377
370
  var asyncHooks = globalThis.process?.getBuiltinModule?.("node:async_hooks");
378
371
 
379
- // src/services/workspaceGraphService.ts
380
- function slugify(name) {
381
- const value = String(name || "").trim().replace(/[/\\]+/g, "_").replace(/[<>:"|?*]/g, "").slice(0, 80);
382
- return value || "New Graph";
383
- }
384
- function storage() {
385
- return StorageAdapterFactory.create({
386
- provider: "local_fs",
387
- basePath: process.env.KLOKS_GRAPH_STORAGE_ROOT || "./workspaces-data"
388
- });
389
- }
390
- function graphPath(workspaceId, slug) {
391
- return `workspaces/${workspaceId}/graphs/${slug}.graph.json`;
392
- }
393
- async function assertWorkspace(userId, workspaceId) {
394
- const result = await findUserWorkspace(workspaceId);
395
- if (!result.workspace || !result.user || result.user.id !== userId) {
396
- throw new Error(`Workspace ${workspaceId} does not exist`);
397
- }
398
- return result.workspace;
399
- }
400
- async function readGraph(workspaceId, slug) {
401
- const adapter = storage();
402
- const path = graphPath(workspaceId, slug);
403
- if (!await adapter.exists(path)) return null;
404
- const raw = new TextDecoder().decode(await adapter.read(path));
405
- return JSON.parse(raw);
406
- }
407
- async function writeGraph(document) {
408
- const adapter = storage();
409
- await adapter.write(graphPath(document.workspaceId, document.graphSlug), JSON.stringify(document, null, 2), "application/json");
410
- }
411
- function toDocument(workspaceId, id, name, slug, nodes = [], edges = [], createdAt = (/* @__PURE__ */ new Date()).toISOString()) {
412
- const now = (/* @__PURE__ */ new Date()).toISOString();
413
- return {
414
- $schema: "https://skipo.dev/schemas/node-graph.v1.json",
415
- version: "1.0.0",
416
- appId: workspaceId,
417
- appName: name,
418
- createdAt,
419
- updatedAt: now,
420
- exportedAt: now,
421
- workspaceId,
422
- graphId: id,
423
- graphSlug: slug,
424
- graph: { nodes, edges }
425
- };
426
- }
427
- var workspaceGraphService = {
428
- async listGraphs(userId, workspaceId) {
429
- await assertWorkspace(userId, workspaceId);
430
- const adapter = storage();
431
- const files = await adapter.list(`workspaces/${workspaceId}/graphs`);
432
- const graphs = [];
433
- for (const file of files.filter((item) => item.path.endsWith(".graph.json"))) {
434
- try {
435
- const raw = new TextDecoder().decode(await adapter.read(file.path));
436
- const graph = JSON.parse(raw);
437
- graphs.push({
438
- id: graph.graphId,
439
- name: graph.appName,
440
- slug: graph.graphSlug,
441
- createdAt: graph.createdAt,
442
- updatedAt: graph.updatedAt,
443
- nodeCount: graph.graph.nodes.length
444
- });
445
- } catch {
446
- }
447
- }
448
- graphs.sort((a, b) => a.createdAt.localeCompare(b.createdAt));
449
- return { success: true, graphs };
450
- },
451
- async createGraph(userId, workspaceId, input) {
452
- await assertWorkspace(userId, workspaceId);
453
- const targetName = String(input?.name || "").trim().slice(0, 80) || "New Graph";
454
- const baseSlug = slugify(targetName);
455
- let slug = baseSlug;
456
- let n = 2;
457
- while (await readGraph(workspaceId, slug)) slug = `${baseSlug} (${n++})`;
458
- const graph = toDocument(workspaceId, `graph-${Date.now()}`, targetName, slug);
459
- await writeGraph(graph);
460
- return { success: true, graph, graphs: (await this.listGraphs(userId, workspaceId)).graphs };
461
- },
462
- async getGraph(userId, workspaceId, slug) {
463
- await assertWorkspace(userId, workspaceId);
464
- const graph = await readGraph(workspaceId, slug);
465
- if (!graph) throw new Error(`Graph "${slug}" not found`);
466
- return { success: true, graph };
467
- },
468
- async saveGraph(userId, workspaceId, slug, patch) {
469
- await assertWorkspace(userId, workspaceId);
470
- const existing = await readGraph(workspaceId, slug);
471
- if (!existing) throw new Error(`Graph "${slug}" not found`);
472
- const next = {
473
- ...existing,
474
- appName: typeof patch.name === "string" && patch.name.trim() ? patch.name.trim().slice(0, 80) : existing.appName,
475
- graph: {
476
- nodes: Array.isArray(patch.nodes) ? patch.nodes : existing.graph.nodes,
477
- edges: Array.isArray(patch.edges) ? patch.edges : existing.graph.edges
478
- },
479
- updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
480
- exportedAt: (/* @__PURE__ */ new Date()).toISOString()
481
- };
482
- await writeGraph(next);
483
- return { success: true, graph: next };
484
- },
485
- async deleteGraph(userId, workspaceId, slug) {
486
- await assertWorkspace(userId, workspaceId);
487
- const adapter = storage();
488
- const path = graphPath(workspaceId, slug);
489
- if (!await adapter.exists(path)) throw new Error(`Graph "${slug}" not found`);
490
- await adapter.delete(path);
491
- return { success: true, deletedSlug: slug, graphs: (await this.listGraphs(userId, workspaceId)).graphs };
492
- },
493
- async duplicateGraph(userId, workspaceId, slug, newName) {
494
- const existing = (await this.getGraph(userId, workspaceId, slug)).graph;
495
- const targetName = (newName || `${existing.appName} (Copy)`).trim().slice(0, 80);
496
- const baseSlug = slugify(targetName);
497
- let newSlug = baseSlug;
498
- let n = 2;
499
- while (await readGraph(workspaceId, newSlug)) newSlug = `${baseSlug} (${n++})`;
500
- const now = (/* @__PURE__ */ new Date()).toISOString();
501
- const graph = {
502
- ...JSON.parse(JSON.stringify(existing)),
503
- graphId: `graph-${Date.now()}`,
504
- graphSlug: newSlug,
505
- appName: targetName,
506
- createdAt: now,
507
- updatedAt: now,
508
- exportedAt: now
509
- };
510
- await writeGraph(graph);
511
- return { success: true, graph, graphs: (await this.listGraphs(userId, workspaceId)).graphs };
512
- },
513
- async clearGraph(userId, workspaceId, slug) {
514
- const existing = (await this.getGraph(userId, workspaceId, slug)).graph;
515
- return this.saveGraph(userId, workspaceId, slug, { nodes: [], edges: [] });
516
- },
517
- async getGraphDocument(userId, workspaceId, slug) {
518
- return (await this.getGraph(userId, workspaceId, slug)).graph;
519
- },
520
- async saveGraphDocument(userId, workspaceId, document) {
521
- await assertWorkspace(userId, workspaceId);
522
- if (document.workspaceId !== workspaceId) throw new Error("Graph workspace mismatch");
523
- await writeGraph({ ...document, updatedAt: (/* @__PURE__ */ new Date()).toISOString(), exportedAt: (/* @__PURE__ */ new Date()).toISOString() });
524
- return { success: true, graph: document };
525
- }
526
- };
527
-
528
372
  export {
529
373
  createServiceDefinition,
530
374
  createService,
531
- createServiceProxy,
532
- workspaceGraphService
375
+ createServiceProxy
533
376
  };
@@ -0,0 +1,146 @@
1
+ import * as _ultrst_armada_krnl from '@ultrst-armada/krnl';
2
+ import { ServiceDefinition } from '@ultrst-armada/krnl';
3
+
4
+ type DevelopmentProvider = 'webcontainer' | 'github-actions';
5
+ type DevelopmentTask = 'install' | 'lint' | 'test' | 'build' | 'validate' | 'check';
6
+ interface DevelopmentRequest {
7
+ provider: DevelopmentProvider;
8
+ task: DevelopmentTask;
9
+ repository?: string;
10
+ ref?: string;
11
+ workflowId?: string | number;
12
+ workflowInputs?: Record<string, string>;
13
+ cwd?: string;
14
+ env?: Record<string, string>;
15
+ }
16
+ interface DevelopmentResult {
17
+ provider: DevelopmentProvider;
18
+ task: DevelopmentTask;
19
+ ok: boolean;
20
+ exitCode?: number;
21
+ output?: string;
22
+ runId?: number;
23
+ url?: string;
24
+ }
25
+ interface WebContainerCommand {
26
+ command: string;
27
+ args: string[];
28
+ }
29
+ interface DevelopmentServiceContract {
30
+ definition: ServiceDefinition;
31
+ }
32
+
33
+ interface GitHubActionsConfig {
34
+ token: string;
35
+ apiBaseUrl?: string;
36
+ fetchImpl?: typeof fetch;
37
+ }
38
+ interface WorkflowRun {
39
+ id: number;
40
+ name?: string;
41
+ status?: string;
42
+ conclusion?: string | null;
43
+ html_url?: string;
44
+ }
45
+ declare class GitHubActionsClient {
46
+ private readonly config;
47
+ private readonly baseUrl;
48
+ private readonly fetchImpl;
49
+ constructor(config: GitHubActionsConfig);
50
+ private request;
51
+ listWorkflowRuns(repository: string, workflowId?: string | number, branch?: string): Promise<{
52
+ workflow_runs: WorkflowRun[];
53
+ }>;
54
+ getWorkflowRun(repository: string, runId: number): Promise<WorkflowRun>;
55
+ getWorkflowJobs(repository: string, runId: number): Promise<{
56
+ jobs: Array<{
57
+ id: number;
58
+ name: string;
59
+ status: string;
60
+ conclusion?: string | null;
61
+ }>;
62
+ }>;
63
+ getJobLogs(repository: string, jobId: number): Promise<string>;
64
+ listArtifacts(repository: string, runId?: number): Promise<{
65
+ artifacts: Array<{
66
+ id: number;
67
+ name: string;
68
+ expired: boolean;
69
+ }>;
70
+ }>;
71
+ dispatchWorkflow(repository: string, workflowId: string | number, ref: string, inputs?: Record<string, string>): Promise<void>;
72
+ rerunWorkflow(repository: string, runId: number): Promise<void>;
73
+ rerunFailedJobs(repository: string, runId: number): Promise<void>;
74
+ cancelWorkflow(repository: string, runId: number): Promise<void>;
75
+ }
76
+ declare const GitHubActionsServiceDefinition: ServiceDefinition;
77
+ declare const GitHubActionsServiceFacade: {
78
+ id: string;
79
+ name: string;
80
+ version: string;
81
+ runtime: "server";
82
+ deployment: "remote";
83
+ definition: ServiceDefinition<Record<string, unknown>, Record<string, unknown>>;
84
+ createInstance: () => _ultrst_armada_krnl.ServiceInstance<Record<string, unknown>, Record<string, unknown>>;
85
+ execute: <TIn = unknown, TOut = unknown>(op: string, input?: TIn) => Promise<TOut>;
86
+ };
87
+
88
+ declare const COMMANDS: Record<string, WebContainerCommand>;
89
+ interface WebContainerRunCommandInput {
90
+ command: string;
91
+ args?: string[];
92
+ cwd?: string;
93
+ env?: Record<string, string | number | boolean>;
94
+ }
95
+ declare class WebContainerRuntime {
96
+ private container;
97
+ private instancePromise;
98
+ boot(): Promise<any>;
99
+ mount(files: Record<string, unknown>): Promise<{
100
+ mounted: boolean;
101
+ }>;
102
+ private runProcess;
103
+ run(task: keyof typeof COMMANDS, cwd?: string, env?: Record<string, string>): Promise<{
104
+ exitCode: any;
105
+ output: string;
106
+ }>;
107
+ runCommand(command: string, args?: string[], cwd?: string, env?: Record<string, string | number | boolean>): Promise<{
108
+ exitCode: any;
109
+ output: string;
110
+ }>;
111
+ teardown(): Promise<{
112
+ tornDown: boolean;
113
+ }>;
114
+ }
115
+ declare const WebContainerServiceDefinition: ServiceDefinition;
116
+ declare const WebContainerServiceFacade: {
117
+ id: string;
118
+ name: string;
119
+ version: string;
120
+ runtime: "client";
121
+ deployment: "local";
122
+ definition: ServiceDefinition<Record<string, unknown>, Record<string, unknown>>;
123
+ createInstance: () => _ultrst_armada_krnl.ServiceInstance<Record<string, unknown>, Record<string, unknown>>;
124
+ execute: <TIn = unknown, TOut = unknown>(op: string, input?: TIn) => Promise<TOut>;
125
+ };
126
+
127
+ declare function resolveDevelopmentCommand(task: DevelopmentRequest['task']): [string, string[]];
128
+ declare const DevelopmentServiceDefinition: ServiceDefinition;
129
+ declare class DevelopmentRuntime {
130
+ private readonly webContainer;
131
+ private readonly githubActions?;
132
+ constructor(webContainer?: WebContainerRuntime, githubActions?: GitHubActionsClient);
133
+ run(request: DevelopmentRequest): Promise<DevelopmentResult>;
134
+ }
135
+ declare const DevelopmentServiceFacade: {
136
+ id: string;
137
+ name: string;
138
+ version: string;
139
+ runtime: "server";
140
+ deployment: "local";
141
+ definition: ServiceDefinition<Record<string, unknown>, Record<string, unknown>>;
142
+ createInstance: () => _ultrst_armada_krnl.ServiceInstance<Record<string, unknown>, Record<string, unknown>>;
143
+ execute: <TIn = unknown, TOut = unknown>(op: string, input?: TIn) => Promise<TOut>;
144
+ };
145
+
146
+ export { type DevelopmentProvider, type DevelopmentRequest, type DevelopmentResult, DevelopmentRuntime, type DevelopmentServiceContract, DevelopmentServiceDefinition, DevelopmentServiceFacade, type DevelopmentTask, GitHubActionsClient, type GitHubActionsConfig, GitHubActionsServiceDefinition, GitHubActionsServiceFacade, type WebContainerCommand, type WebContainerRunCommandInput, WebContainerRuntime, WebContainerServiceDefinition, WebContainerServiceFacade, type WorkflowRun, resolveDevelopmentCommand };
@@ -0,0 +1,25 @@
1
+ import {
2
+ DevelopmentRuntime,
3
+ DevelopmentServiceDefinition,
4
+ DevelopmentServiceFacade,
5
+ GitHubActionsClient,
6
+ GitHubActionsServiceDefinition,
7
+ GitHubActionsServiceFacade,
8
+ WebContainerRuntime,
9
+ WebContainerServiceDefinition,
10
+ WebContainerServiceFacade,
11
+ resolveDevelopmentCommand
12
+ } from "../chunk-OVTXAGL6.js";
13
+ import "../chunk-TY32TUNI.js";
14
+ export {
15
+ DevelopmentRuntime,
16
+ DevelopmentServiceDefinition,
17
+ DevelopmentServiceFacade,
18
+ GitHubActionsClient,
19
+ GitHubActionsServiceDefinition,
20
+ GitHubActionsServiceFacade,
21
+ WebContainerRuntime,
22
+ WebContainerServiceDefinition,
23
+ WebContainerServiceFacade,
24
+ resolveDevelopmentCommand
25
+ };
@@ -13,6 +13,7 @@ export { AdaptedStorageConnection, AppAccountManifest, AppServiceDeclaration, CA
13
13
  export { CompositeBackend, EndpointGenerator, GeneratedEndpointSummary, LOCAL_STORAGE_GRAPHS_PREFIX, LocalService, NodeGraphPersistenceService, NodeGraphValidationResult, RemoteServiceProxy, SaveGraphOptions, UniversalAppEntity, UniversalGraphEdge, UniversalGraphNode, UniversalNodeGraphDocument, UniversalStorageConnection, WorkspaceGraphDocument, WorkspaceGraphSummary, createBackend, createCompositeService, createLocalService, createRemoteService, exportGraphAsJsonFile, nodeGraphPersistence, parseGraphJsonFile, validateGraphDocument, workspaceGraphService } from './services/index.js';
14
14
  import { AssetDataType as AssetDataType$1, AssetChannelType as AssetChannelType$1, GraphFolderInfo as GraphFolderInfo$1, GraphAssetItem as GraphAssetItem$1, SpaceNode, NodeConnection, DawProject } from '@ultrst-armada/kloks/state-graph';
15
15
  export { AuthServiceDefinition, AuthServiceFacade, ControlPlaneServiceDefinition, ControlPlaneServiceFacade, DatabaseServiceDefinition, DatabaseServiceFacade, GeminiServiceDefinition, GeminiServiceFacade, SrklServiceDefinition, SrklServiceFacade, StorageServiceDefinition, StorageServiceFacade, WorkspaceGraphServiceDefinition, WorkspaceGraphServiceFacade, WorkspaceServiceDefinition, WorkspaceServiceFacade, krnlAuthServiceDefinition, krnlAuthServiceFacade, krnlControlPlaneServiceDefinition, krnlControlPlaneServiceFacade, krnlDatabaseServiceDefinition, krnlDatabaseServiceFacade, krnlGeminiServiceDefinition, krnlGeminiServiceFacade, krnlSrklServiceDefinition, krnlSrklServiceFacade, krnlStorageServiceDefinition, krnlStorageServiceFacade, krnlWorkspaceGraphServiceDefinition, krnlWorkspaceGraphServiceFacade, krnlWorkspaceServiceDefinition, krnlWorkspaceServiceFacade } from './krnl-services.js';
16
+ export { DevelopmentProvider, DevelopmentRequest, DevelopmentResult, DevelopmentRuntime, DevelopmentServiceContract, DevelopmentServiceDefinition, DevelopmentServiceFacade, DevelopmentTask, GitHubActionsClient, GitHubActionsConfig, GitHubActionsServiceDefinition, GitHubActionsServiceFacade, WebContainerCommand, WebContainerRunCommandInput, WebContainerRuntime, WebContainerServiceDefinition, WebContainerServiceFacade, WorkflowRun, resolveDevelopmentCommand } from './development/index.js';
16
17
  export { EndpointDescriptor, IService, ProtocolAdapter, ServiceDefinition } from '@ultrst-armada/krnl';
17
18
  import 'react';
18
19
 
@@ -1,3 +1,17 @@
1
+ import {
2
+ CompositeBackend,
3
+ EndpointGenerator,
4
+ LOCAL_STORAGE_GRAPHS_PREFIX,
5
+ NodeGraphPersistenceService,
6
+ createBackend,
7
+ createCompositeService,
8
+ createLocalService,
9
+ createRemoteService,
10
+ exportGraphAsJsonFile,
11
+ nodeGraphPersistence,
12
+ parseGraphJsonFile,
13
+ validateGraphDocument
14
+ } from "./chunk-RBF2OGMC.js";
1
15
  import {
2
16
  CANONICAL_SRKL_URL,
3
17
  SrklClient,
@@ -61,12 +75,30 @@ import {
61
75
  krnlWorkspaceGraphServiceFacade,
62
76
  krnlWorkspaceServiceDefinition,
63
77
  krnlWorkspaceServiceFacade
64
- } from "./chunk-KYBO7FGP.js";
78
+ } from "./chunk-GQUNN7SA.js";
79
+ import {
80
+ workspaceGraphService
81
+ } from "./chunk-DBZVGMJ7.js";
65
82
  import {
66
83
  getPrimarySrklDeploymentUrl,
67
84
  getSrklAccounts,
68
85
  srklListBackblazeBuckets
69
86
  } from "./chunk-VDROUXFT.js";
87
+ import {
88
+ BackblazeB2Adapter,
89
+ BaseStorageAdapter,
90
+ LocalFSAdapter,
91
+ S3Adapter,
92
+ StorageAdapterFactory,
93
+ SupabaseStorageAdapter,
94
+ ensureS3DirectoryMarker,
95
+ isSecretMasked,
96
+ normalizeBackblazeCredentials,
97
+ permanentDeleteS3Folder,
98
+ permanentDeleteS3Object,
99
+ renameS3Folder,
100
+ resolveBackblazeEndpoint
101
+ } from "./chunk-J2J24JVC.js";
70
102
  import {
71
103
  authorizeB2,
72
104
  b2DownloadFile,
@@ -78,6 +110,35 @@ import {
78
110
  formatCanonicalWorkspaceFolderName,
79
111
  sanitizeWorkspaceName
80
112
  } from "./chunk-FZKBTF34.js";
113
+ import {
114
+ b2DeleteFileVersion,
115
+ b2DeleteFolder,
116
+ b2ListBuckets as b2ListBuckets2,
117
+ cleanDbUrl,
118
+ createWorkspace,
119
+ deleteWorkspace,
120
+ deleteWorkspaceFile,
121
+ deleteWorkspaceFolder,
122
+ findUserWorkspace,
123
+ getB2BucketId,
124
+ getUnifiedDbUrl,
125
+ getWorkspaceFolderPrefix,
126
+ getWorkspaceStorageDetails,
127
+ getWorkspaces,
128
+ isB2Workspace,
129
+ listWorkspaceFiles,
130
+ loadWorkspaceData,
131
+ queryUnifiedDb,
132
+ readWorkspaceFile,
133
+ renameAppInWorkspaceData,
134
+ resolveWorkspaceConnection,
135
+ saveWorkspaceData,
136
+ syncWorkspaceCreateToBucket,
137
+ syncWorkspaceDataToBucket,
138
+ syncWorkspaceDeleteToBucket,
139
+ updateWorkspace,
140
+ writeWorkspaceFile
141
+ } from "./chunk-E72GXBXF.js";
81
142
  import {
82
143
  BaseApiRoute,
83
144
  createSSEResponse,
@@ -96,6 +157,11 @@ import {
96
157
  loginSystemUser,
97
158
  resolveUserFromToken
98
159
  } from "./chunk-ZDH4XI7W.js";
160
+ import {
161
+ BackendProvider,
162
+ useBackend,
163
+ useBackendClient
164
+ } from "./chunk-G3ZOSXUR.js";
99
165
  import {
100
166
  BackendRegistry,
101
167
  ConcurrencyConflictError,
@@ -109,19 +175,6 @@ import {
109
175
  RemoteExecutor,
110
176
  createEmptyContract
111
177
  } from "./chunk-5E6JRFUH.js";
112
- import {
113
- AuditLogger,
114
- ControlPlaneManager,
115
- DatabaseClusterManager,
116
- detectDatabaseEngine,
117
- getSystemDatabaseUrls,
118
- resolveSystemDatabaseClusterNodes
119
- } from "./chunk-RCCQ7IRM.js";
120
- import {
121
- BackendProvider,
122
- useBackend,
123
- useBackendClient
124
- } from "./chunk-G3ZOSXUR.js";
125
178
  import {
126
179
  BackendClient,
127
180
  BackendResolver,
@@ -134,66 +187,26 @@ import {
134
187
  createBackendClient
135
188
  } from "./chunk-NIP22V2G.js";
136
189
  import {
137
- CompositeBackend,
138
- EndpointGenerator,
139
- LOCAL_STORAGE_GRAPHS_PREFIX,
140
- NodeGraphPersistenceService,
141
- createBackend,
142
- createCompositeService,
143
- createLocalService,
144
- createRemoteService,
145
- exportGraphAsJsonFile,
146
- nodeGraphPersistence,
147
- parseGraphJsonFile,
148
- validateGraphDocument
149
- } from "./chunk-R27SHBHK.js";
150
- import {
151
- workspaceGraphService
152
- } from "./chunk-ZFCEXTNI.js";
153
- import {
154
- BackblazeB2Adapter,
155
- BaseStorageAdapter,
156
- LocalFSAdapter,
157
- S3Adapter,
158
- StorageAdapterFactory,
159
- SupabaseStorageAdapter,
160
- ensureS3DirectoryMarker,
161
- isSecretMasked,
162
- normalizeBackblazeCredentials,
163
- permanentDeleteS3Folder,
164
- permanentDeleteS3Object,
165
- renameS3Folder,
166
- resolveBackblazeEndpoint
167
- } from "./chunk-J2J24JVC.js";
190
+ AuditLogger,
191
+ ControlPlaneManager,
192
+ DatabaseClusterManager,
193
+ detectDatabaseEngine,
194
+ getSystemDatabaseUrls,
195
+ resolveSystemDatabaseClusterNodes
196
+ } from "./chunk-RCCQ7IRM.js";
168
197
  import {
169
- b2DeleteFileVersion,
170
- b2DeleteFolder,
171
- b2ListBuckets as b2ListBuckets2,
172
- cleanDbUrl,
173
- createWorkspace,
174
- deleteWorkspace,
175
- deleteWorkspaceFile,
176
- deleteWorkspaceFolder,
177
- findUserWorkspace,
178
- getB2BucketId,
179
- getUnifiedDbUrl,
180
- getWorkspaceFolderPrefix,
181
- getWorkspaceStorageDetails,
182
- getWorkspaces,
183
- isB2Workspace,
184
- listWorkspaceFiles,
185
- loadWorkspaceData,
186
- queryUnifiedDb,
187
- readWorkspaceFile,
188
- renameAppInWorkspaceData,
189
- resolveWorkspaceConnection,
190
- saveWorkspaceData,
191
- syncWorkspaceCreateToBucket,
192
- syncWorkspaceDataToBucket,
193
- syncWorkspaceDeleteToBucket,
194
- updateWorkspace,
195
- writeWorkspaceFile
196
- } from "./chunk-E72GXBXF.js";
198
+ DevelopmentRuntime,
199
+ DevelopmentServiceDefinition,
200
+ DevelopmentServiceFacade,
201
+ GitHubActionsClient,
202
+ GitHubActionsServiceDefinition,
203
+ GitHubActionsServiceFacade,
204
+ WebContainerRuntime,
205
+ WebContainerServiceDefinition,
206
+ WebContainerServiceFacade,
207
+ resolveDevelopmentCommand
208
+ } from "./chunk-OVTXAGL6.js";
209
+ import "./chunk-TY32TUNI.js";
197
210
 
198
211
  // src/data/BaseDataProvider.ts
199
212
  import { SkipoBase } from "@ultrst-armada/kloks/functions";
@@ -4375,6 +4388,9 @@ export {
4375
4388
  DatabaseClusterManager,
4376
4389
  DatabaseServiceDefinition,
4377
4390
  DatabaseServiceFacade,
4391
+ DevelopmentRuntime,
4392
+ DevelopmentServiceDefinition,
4393
+ DevelopmentServiceFacade,
4378
4394
  EndpointGenerator,
4379
4395
  EventBus,
4380
4396
  FrontendSession,
@@ -4382,6 +4398,9 @@ export {
4382
4398
  GRAPHS_ROOT,
4383
4399
  GeminiServiceDefinition,
4384
4400
  GeminiServiceFacade,
4401
+ GitHubActionsClient,
4402
+ GitHubActionsServiceDefinition,
4403
+ GitHubActionsServiceFacade,
4385
4404
  HTTPTransport,
4386
4405
  HealthMonitor,
4387
4406
  IdempotencyManager,
@@ -4420,6 +4439,9 @@ export {
4420
4439
  VercelResourceFetcher,
4421
4440
  WORKSPACE_ASSETS_ROOT,
4422
4441
  WORKSPACE_ROOT,
4442
+ WebContainerRuntime,
4443
+ WebContainerServiceDefinition,
4444
+ WebContainerServiceFacade,
4423
4445
  WebSocketTransport,
4424
4446
  WorkingWorkspaceService,
4425
4447
  WorkspaceCloneSyncEngine,
@@ -4568,6 +4590,7 @@ export {
4568
4590
  renameAppInWorkspaceData,
4569
4591
  renameS3Folder,
4570
4592
  resolveBackblazeEndpoint,
4593
+ resolveDevelopmentCommand,
4571
4594
  resolveDynamicRouteFromDb,
4572
4595
  resolveSystemDatabaseClusterNodes,
4573
4596
  resolveSystemDatabaseUrl,
@@ -31,14 +31,15 @@ import {
31
31
  krnlWorkspaceGraphServiceFacade,
32
32
  krnlWorkspaceServiceDefinition,
33
33
  krnlWorkspaceServiceFacade
34
- } from "./chunk-KYBO7FGP.js";
34
+ } from "./chunk-GQUNN7SA.js";
35
+ import "./chunk-DBZVGMJ7.js";
35
36
  import "./chunk-VDROUXFT.js";
37
+ import "./chunk-J2J24JVC.js";
36
38
  import "./chunk-4QEMALXF.js";
37
39
  import "./chunk-FZKBTF34.js";
38
- import "./chunk-ZDH4XI7W.js";
39
- import "./chunk-ZFCEXTNI.js";
40
- import "./chunk-J2J24JVC.js";
41
40
  import "./chunk-E72GXBXF.js";
41
+ import "./chunk-ZDH4XI7W.js";
42
+ import "./chunk-TY32TUNI.js";
42
43
  export {
43
44
  AuthServiceDefinition,
44
45
  AuthServiceFacade,
@@ -11,12 +11,13 @@ import {
11
11
  nodeGraphPersistence,
12
12
  parseGraphJsonFile,
13
13
  validateGraphDocument
14
- } from "../chunk-R27SHBHK.js";
14
+ } from "../chunk-RBF2OGMC.js";
15
15
  import {
16
16
  workspaceGraphService
17
- } from "../chunk-ZFCEXTNI.js";
17
+ } from "../chunk-DBZVGMJ7.js";
18
18
  import "../chunk-J2J24JVC.js";
19
19
  import "../chunk-E72GXBXF.js";
20
+ import "../chunk-TY32TUNI.js";
20
21
  export {
21
22
  CompositeBackend,
22
23
  EndpointGenerator,
@@ -1,11 +1,4 @@
1
1
  import "../chunk-LS3HWJBX.js";
2
- import {
3
- authorizeB2,
4
- b2DownloadFile,
5
- b2ListBuckets,
6
- b2ListFileNames,
7
- b2UploadFile
8
- } from "../chunk-4QEMALXF.js";
9
2
  import {
10
3
  BackblazeB2Adapter,
11
4
  BaseStorageAdapter,
@@ -21,6 +14,13 @@ import {
21
14
  renameS3Folder,
22
15
  resolveBackblazeEndpoint
23
16
  } from "../chunk-J2J24JVC.js";
17
+ import {
18
+ authorizeB2,
19
+ b2DownloadFile,
20
+ b2ListBuckets,
21
+ b2ListFileNames,
22
+ b2UploadFile
23
+ } from "../chunk-4QEMALXF.js";
24
24
  export {
25
25
  BackblazeB2Adapter,
26
26
  BaseStorageAdapter,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://skipo.dev/schemas/kloks-manifest.v1.json",
3
3
  "package": "@kloks/backend",
4
- "version": "1.0.0",
4
+ "version": "1.1.0",
5
5
  "services": [
6
6
  {
7
7
  "id": "auth",
@@ -192,6 +192,74 @@
192
192
  ]
193
193
  },
194
194
  "dependencies": []
195
+ },
196
+ {
197
+ "id": "github-actions",
198
+ "name": "GitHub Actions Execution",
199
+ "version": "1.0.0",
200
+ "description": "Authenticated GitHub Actions workflow dispatch, observation, logs, artifacts, cancellation and rerun service.",
201
+ "backend": {
202
+ "package": "@ultrst-armada/kloks",
203
+ "subpath": "development",
204
+ "export": "GitHubActionsServiceFacade",
205
+ "facade": "GitHubActionsServiceFacade"
206
+ },
207
+ "modes": [
208
+ "backend",
209
+ "fullstack"
210
+ ],
211
+ "targets": {
212
+ "backend": [
213
+ "BackendFacade.services"
214
+ ]
215
+ },
216
+ "dependencies": []
217
+ },
218
+ {
219
+ "id": "web-container",
220
+ "name": "WebContainer Runtime",
221
+ "version": "1.1.0",
222
+ "description": "Canonical browser WebContainer lifecycle, filesystem mounting and arbitrary development command execution.",
223
+ "backend": {
224
+ "package": "@ultrst-armada/kloks",
225
+ "subpath": "development",
226
+ "export": "WebContainerServiceFacade",
227
+ "facade": "WebContainerServiceFacade"
228
+ },
229
+ "modes": [
230
+ "fullstack"
231
+ ],
232
+ "targets": {
233
+ "backend": [
234
+ "App.main-content"
235
+ ]
236
+ },
237
+ "dependencies": []
238
+ },
239
+ {
240
+ "id": "development",
241
+ "name": "Development & Validation",
242
+ "version": "1.0.0",
243
+ "description": "Provider-neutral development execution planning and validation across WebContainer and GitHub Actions.",
244
+ "backend": {
245
+ "package": "@ultrst-armada/kloks",
246
+ "subpath": "development",
247
+ "export": "DevelopmentServiceFacade",
248
+ "facade": "DevelopmentServiceFacade"
249
+ },
250
+ "modes": [
251
+ "backend",
252
+ "fullstack"
253
+ ],
254
+ "targets": {
255
+ "backend": [
256
+ "BackendFacade.services"
257
+ ]
258
+ },
259
+ "dependencies": [
260
+ "github-actions",
261
+ "web-container"
262
+ ]
195
263
  }
196
264
  ]
197
265
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kloks/backend",
3
- "version": "1.0.0",
4
- "description": "Kloks Backend Services \u2014 Auth, Storage, Workspace, Control Plane, API, Connectivity & Execution built on KrnlTS",
3
+ "version": "1.1.0",
4
+ "description": "Kloks Backend Services — Auth, Storage, Workspace, Control Plane, API, Connectivity & Execution built on KrnlTS",
5
5
  "type": "module",
6
6
  "private": false,
7
7
  "publishConfig": {
@@ -67,16 +67,22 @@
67
67
  "import": "./dist/krnl-services.js",
68
68
  "types": "./dist/krnl-services.d.ts",
69
69
  "default": "./dist/krnl-services.js"
70
+ },
71
+ "./development": {
72
+ "import": "./dist/development/index.js",
73
+ "types": "./dist/development/index.d.ts",
74
+ "default": "./dist/development/index.js"
70
75
  }
71
76
  },
72
77
  "scripts": {
73
- "build": "tsup src/index.ts src/krnl-services.ts src/services/index.ts src/auth/index.ts src/storage/index.ts src/workspace/index.ts src/control-plane/index.ts src/api/index.ts src/connectivity/index.ts src/client/index.ts src/srkl/index.ts --format esm --dts --clean --external @kloks/functions --external react --external @kloks/state-graph --external @neondatabase/serverless --external @supabase/supabase-js --external @aws-sdk/client-s3 --external @aws-sdk/lib-storage --external bcryptjs --external better-sqlite3 --external zod --external ws",
78
+ "build": "tsup src/index.ts src/krnl-services.ts src/services/index.ts src/auth/index.ts src/storage/index.ts src/workspace/index.ts src/control-plane/index.ts src/api/index.ts src/connectivity/index.ts src/client/index.ts src/srkl/index.ts src/development/index.ts --format esm --dts --clean --external @kloks/functions --external react --external @kloks/state-graph --external @neondatabase/serverless --external @supabase/supabase-js --external @aws-sdk/client-s3 --external @aws-sdk/lib-storage --external bcryptjs --external better-sqlite3 --external zod --external ws --external @webcontainer/api",
74
79
  "typecheck": "tsc --noEmit",
75
80
  "clean": "rm -rf dist"
76
81
  },
77
82
  "dependencies": {
78
83
  "@kloks/functions": "workspace:*",
79
- "@kloks/state-graph": "workspace:*"
84
+ "@kloks/state-graph": "workspace:*",
85
+ "@webcontainer/api": "^1.6.4"
80
86
  },
81
87
  "peerDependencies": {
82
88
  "better-sqlite3": "^11.0.0",