@ultrst-armada/kloks 1.4.7 → 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.7",
5
- "sourceCommit": "d3bee7220338a9aec6b9787a5308b8dbb2766693",
4
+ "version": "1.5.1",
5
+ "sourceCommit": "df4285ad26bbf5f16acaca63ba43fe4e40740051",
6
6
  "releaseWorkflow": "npm Release",
7
- "workflowRunId": "39538959938"
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.7",
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,14 +1,3 @@
1
- // src/workspace/WorkspaceCanonical.ts
2
- function formatCanonicalWorkspaceFolderName(appName, userName, workspaceName) {
3
- const safeApp = appName.replace(/[^a-zA-Z0-9]/g, "_").toLowerCase();
4
- const safeUser = userName.replace(/[^a-zA-Z0-9]/g, "_").toLowerCase();
5
- const safeWs = workspaceName.replace(/[^a-zA-Z0-9]/g, "_").toLowerCase();
6
- return `ultrst_${safeApp}_${safeUser}_${safeWs}`;
7
- }
8
- function sanitizeWorkspaceName(name) {
9
- return name.replace(/[^a-zA-Z0-9-_\s]/g, "").trim();
10
- }
11
-
12
1
  // src/core/unifiedDb.ts
13
2
  var neon;
14
3
  function cleanDbUrl(url) {
@@ -729,8 +718,6 @@ async function getWorkspaceStorageDetails(workspaceId, env) {
729
718
  }
730
719
 
731
720
  export {
732
- formatCanonicalWorkspaceFolderName,
733
- sanitizeWorkspaceName,
734
721
  cleanDbUrl,
735
722
  getUnifiedDbUrl,
736
723
  queryUnifiedDb,
@@ -0,0 +1,15 @@
1
+ // src/workspace/WorkspaceCanonical.ts
2
+ function formatCanonicalWorkspaceFolderName(appName, userName, workspaceName) {
3
+ const safeApp = appName.replace(/[^a-zA-Z0-9]/g, "_").toLowerCase();
4
+ const safeUser = userName.replace(/[^a-zA-Z0-9]/g, "_").toLowerCase();
5
+ const safeWs = workspaceName.replace(/[^a-zA-Z0-9]/g, "_").toLowerCase();
6
+ return `ultrst_${safeApp}_${safeUser}_${safeWs}`;
7
+ }
8
+ function sanitizeWorkspaceName(name) {
9
+ return name.replace(/[^a-zA-Z0-9-_\s]/g, "").trim();
10
+ }
11
+
12
+ export {
13
+ formatCanonicalWorkspaceFolderName,
14
+ sanitizeWorkspaceName
15
+ };
@@ -12,7 +12,7 @@ import {
12
12
  readWorkspaceFile,
13
13
  updateWorkspace,
14
14
  writeWorkspaceFile
15
- } from "./chunk-ZO3PZGNQ.js";
15
+ } from "./chunk-E72GXBXF.js";
16
16
 
17
17
  // src/workspace/WorkspaceFS.ts
18
18
  import { SkipoBase } from "@ultrst-armada/kloks/functions";
@@ -1,3 +1,6 @@
1
+ import {
2
+ workspaceGraphService
3
+ } from "./chunk-DBZVGMJ7.js";
1
4
  import {
2
5
  getSrklAccounts,
3
6
  srklListBackblazeBuckets
@@ -8,16 +11,18 @@ import {
8
11
  import {
9
12
  b2ListBuckets
10
13
  } from "./chunk-4QEMALXF.js";
14
+ import {
15
+ formatCanonicalWorkspaceFolderName,
16
+ sanitizeWorkspaceName
17
+ } from "./chunk-FZKBTF34.js";
11
18
  import {
12
19
  createWorkspace,
13
20
  deleteWorkspace,
14
21
  findUserWorkspace,
15
- formatCanonicalWorkspaceFolderName,
16
22
  getWorkspaces,
17
23
  queryUnifiedDb,
18
- sanitizeWorkspaceName,
19
24
  updateWorkspace
20
- } from "./chunk-ZO3PZGNQ.js";
25
+ } from "./chunk-E72GXBXF.js";
21
26
  import {
22
27
  RateLimiter,
23
28
  SessionManager,
@@ -332,6 +337,64 @@ var SrklServiceFacade = {
332
337
  };
333
338
  var krnlSrklServiceDefinition = SrklServiceDefinition;
334
339
  var krnlSrklServiceFacade = SrklServiceFacade;
340
+ var WorkspaceGraphServiceDefinition = createServiceDefinition({
341
+ id: "kloks.backend.workspaceGraph",
342
+ name: "WorkspaceGraphService",
343
+ version: "1.0.0",
344
+ operations: {
345
+ listGraphs: {
346
+ id: "WorkspaceGraphService.listGraphs",
347
+ name: "listGraphs",
348
+ handler: async (input) => workspaceGraphService.listGraphs(input.userId, input.workspaceId)
349
+ },
350
+ createGraph: {
351
+ id: "WorkspaceGraphService.createGraph",
352
+ name: "createGraph",
353
+ handler: async (input) => workspaceGraphService.createGraph(input.userId, input.workspaceId, { name: input.name })
354
+ },
355
+ getGraph: {
356
+ id: "WorkspaceGraphService.getGraph",
357
+ name: "getGraph",
358
+ handler: async (input) => workspaceGraphService.getGraph(input.userId, input.workspaceId, input.slug)
359
+ },
360
+ saveGraph: {
361
+ id: "WorkspaceGraphService.saveGraph",
362
+ name: "saveGraph",
363
+ handler: async (input) => workspaceGraphService.saveGraph(input.userId, input.workspaceId, input.slug, input)
364
+ },
365
+ deleteGraph: {
366
+ id: "WorkspaceGraphService.deleteGraph",
367
+ name: "deleteGraph",
368
+ handler: async (input) => workspaceGraphService.deleteGraph(input.userId, input.workspaceId, input.slug)
369
+ },
370
+ duplicateGraph: {
371
+ id: "WorkspaceGraphService.duplicateGraph",
372
+ name: "duplicateGraph",
373
+ handler: async (input) => workspaceGraphService.duplicateGraph(input.userId, input.workspaceId, input.slug, input.newName)
374
+ },
375
+ clearGraph: {
376
+ id: "WorkspaceGraphService.clearGraph",
377
+ name: "clearGraph",
378
+ handler: async (input) => workspaceGraphService.clearGraph(input.userId, input.workspaceId, input.slug)
379
+ }
380
+ }
381
+ });
382
+ var workspaceGraphServiceInstance = createService(WorkspaceGraphServiceDefinition);
383
+ var WorkspaceGraphServiceFacade = {
384
+ id: WorkspaceGraphServiceDefinition.id,
385
+ name: WorkspaceGraphServiceDefinition.name,
386
+ version: WorkspaceGraphServiceDefinition.version,
387
+ runtime: "server",
388
+ deployment: "local",
389
+ definition: WorkspaceGraphServiceDefinition,
390
+ createInstance: () => createService(WorkspaceGraphServiceDefinition),
391
+ execute: async (op, input) => {
392
+ await workspaceGraphServiceInstance.start();
393
+ return workspaceGraphServiceInstance.call(op, input);
394
+ }
395
+ };
396
+ var krnlWorkspaceGraphServiceDefinition = WorkspaceGraphServiceDefinition;
397
+ var krnlWorkspaceGraphServiceFacade = WorkspaceGraphServiceFacade;
335
398
 
336
399
  export {
337
400
  AuthServiceDefinition,
@@ -361,5 +424,9 @@ export {
361
424
  SrklServiceDefinition,
362
425
  SrklServiceFacade,
363
426
  krnlSrklServiceDefinition,
364
- krnlSrklServiceFacade
427
+ krnlSrklServiceFacade,
428
+ WorkspaceGraphServiceDefinition,
429
+ WorkspaceGraphServiceFacade,
430
+ krnlWorkspaceGraphServiceDefinition,
431
+ krnlWorkspaceGraphServiceFacade
365
432
  };
@@ -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
+ };
@@ -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
+ };
@@ -10,9 +10,10 @@ export { A as AuthContext, B as BackendClient, a as BackendClientOptions, b as B
10
10
  export { BackendContract, BackendRegistry, CallbackDefinition, ConcurrencyConflictError, ConcurrencyManager, DomainContract, EventDefinition, HealthMonitor, IdempotencyManager, InProcessExecutor, JobDefinition, JobHandler, JobScheduler, LoadBalancer, LockManager, OperationDefinition, RemoteExecutor, RemoteExecutorOptions, createEmptyContract } from './connectivity/index.js';
11
11
  export { BackendClientInstance, BackendProvider, BackendProviderProps, useBackend, useBackendClient } from './client/index.js';
12
12
  export { AdaptedStorageConnection, AppAccountManifest, AppServiceDeclaration, CANONICAL_SRKL_URL, CredentialRegistryMap, EcosystemAccount, EcosystemAccountsRequest, EcosystemAccountsResponse, EcosystemServiceCategory, KeyMaterial, ServiceAccountEntry, SrklClient, SrklClientOptions, SrklCredentialRegistry, SrklEcosystemQueryOptions, SrklEcosystemResponse, SrklServiceAccount, SrklVaultAccessClient, SrklVaultAccessResponse, UseSrklServicesOptions, UseSrklServicesResult, VaultAccessClientOptions, createSrklClient, decryptVaultBufferInBrowser, getPrimarySrklDeploymentUrl, getSrklAccounts, globalCredentialRegistry, hexToBytes, srklListBackblazeBuckets, srklService, syncSrklAccounts, useSrklServices } from './srkl/index.js';
13
- export { CompositeBackend, EndpointGenerator, GeneratedEndpointSummary, LOCAL_STORAGE_GRAPHS_PREFIX, LocalService, NodeGraphPersistenceService, NodeGraphValidationResult, RemoteServiceProxy, SaveGraphOptions, UniversalAppEntity, UniversalGraphEdge, UniversalGraphNode, UniversalNodeGraphDocument, UniversalStorageConnection, createBackend, createCompositeService, createLocalService, createRemoteService, exportGraphAsJsonFile, nodeGraphPersistence, parseGraphJsonFile, validateGraphDocument } from './services/index.js';
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
- export { AuthServiceDefinition, AuthServiceFacade, ControlPlaneServiceDefinition, ControlPlaneServiceFacade, DatabaseServiceDefinition, DatabaseServiceFacade, GeminiServiceDefinition, GeminiServiceFacade, SrklServiceDefinition, SrklServiceFacade, StorageServiceDefinition, StorageServiceFacade, WorkspaceServiceDefinition, WorkspaceServiceFacade, krnlAuthServiceDefinition, krnlAuthServiceFacade, krnlControlPlaneServiceDefinition, krnlControlPlaneServiceFacade, krnlDatabaseServiceDefinition, krnlDatabaseServiceFacade, krnlGeminiServiceDefinition, krnlGeminiServiceFacade, krnlSrklServiceDefinition, krnlSrklServiceFacade, krnlStorageServiceDefinition, krnlStorageServiceFacade, krnlWorkspaceServiceDefinition, krnlWorkspaceServiceFacade } from './krnl-services.js';
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,
@@ -27,7 +41,7 @@ import {
27
41
  setWorkingWorkspaceConfig,
28
42
  syncWorkspace,
29
43
  workingWorkspaceService
30
- } from "./chunk-DULUHQ5S.js";
44
+ } from "./chunk-GPXV4GBD.js";
31
45
  import {
32
46
  AuthServiceDefinition,
33
47
  AuthServiceFacade,
@@ -41,6 +55,8 @@ import {
41
55
  SrklServiceFacade,
42
56
  StorageServiceDefinition,
43
57
  StorageServiceFacade,
58
+ WorkspaceGraphServiceDefinition,
59
+ WorkspaceGraphServiceFacade,
44
60
  WorkspaceServiceDefinition,
45
61
  WorkspaceServiceFacade,
46
62
  krnlAuthServiceDefinition,
@@ -55,9 +71,14 @@ import {
55
71
  krnlSrklServiceFacade,
56
72
  krnlStorageServiceDefinition,
57
73
  krnlStorageServiceFacade,
74
+ krnlWorkspaceGraphServiceDefinition,
75
+ krnlWorkspaceGraphServiceFacade,
58
76
  krnlWorkspaceServiceDefinition,
59
77
  krnlWorkspaceServiceFacade
60
- } from "./chunk-ZRYACED2.js";
78
+ } from "./chunk-GQUNN7SA.js";
79
+ import {
80
+ workspaceGraphService
81
+ } from "./chunk-DBZVGMJ7.js";
61
82
  import {
62
83
  getPrimarySrklDeploymentUrl,
63
84
  getSrklAccounts,
@@ -85,6 +106,10 @@ import {
85
106
  b2ListFileNames,
86
107
  b2UploadFile
87
108
  } from "./chunk-4QEMALXF.js";
109
+ import {
110
+ formatCanonicalWorkspaceFolderName,
111
+ sanitizeWorkspaceName
112
+ } from "./chunk-FZKBTF34.js";
88
113
  import {
89
114
  b2DeleteFileVersion,
90
115
  b2DeleteFolder,
@@ -95,7 +120,6 @@ import {
95
120
  deleteWorkspaceFile,
96
121
  deleteWorkspaceFolder,
97
122
  findUserWorkspace,
98
- formatCanonicalWorkspaceFolderName,
99
123
  getB2BucketId,
100
124
  getUnifiedDbUrl,
101
125
  getWorkspaceFolderPrefix,
@@ -108,14 +132,13 @@ import {
108
132
  readWorkspaceFile,
109
133
  renameAppInWorkspaceData,
110
134
  resolveWorkspaceConnection,
111
- sanitizeWorkspaceName,
112
135
  saveWorkspaceData,
113
136
  syncWorkspaceCreateToBucket,
114
137
  syncWorkspaceDataToBucket,
115
138
  syncWorkspaceDeleteToBucket,
116
139
  updateWorkspace,
117
140
  writeWorkspaceFile
118
- } from "./chunk-ZO3PZGNQ.js";
141
+ } from "./chunk-E72GXBXF.js";
119
142
  import {
120
143
  BaseApiRoute,
121
144
  createSSEResponse,
@@ -172,19 +195,17 @@ import {
172
195
  resolveSystemDatabaseClusterNodes
173
196
  } from "./chunk-RCCQ7IRM.js";
174
197
  import {
175
- CompositeBackend,
176
- EndpointGenerator,
177
- LOCAL_STORAGE_GRAPHS_PREFIX,
178
- NodeGraphPersistenceService,
179
- createBackend,
180
- createCompositeService,
181
- createLocalService,
182
- createRemoteService,
183
- exportGraphAsJsonFile,
184
- nodeGraphPersistence,
185
- parseGraphJsonFile,
186
- validateGraphDocument
187
- } from "./chunk-7B24ZWB3.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";
188
209
  import "./chunk-TY32TUNI.js";
189
210
 
190
211
  // src/data/BaseDataProvider.ts
@@ -4367,6 +4388,9 @@ export {
4367
4388
  DatabaseClusterManager,
4368
4389
  DatabaseServiceDefinition,
4369
4390
  DatabaseServiceFacade,
4391
+ DevelopmentRuntime,
4392
+ DevelopmentServiceDefinition,
4393
+ DevelopmentServiceFacade,
4370
4394
  EndpointGenerator,
4371
4395
  EventBus,
4372
4396
  FrontendSession,
@@ -4374,6 +4398,9 @@ export {
4374
4398
  GRAPHS_ROOT,
4375
4399
  GeminiServiceDefinition,
4376
4400
  GeminiServiceFacade,
4401
+ GitHubActionsClient,
4402
+ GitHubActionsServiceDefinition,
4403
+ GitHubActionsServiceFacade,
4377
4404
  HTTPTransport,
4378
4405
  HealthMonitor,
4379
4406
  IdempotencyManager,
@@ -4412,10 +4439,15 @@ export {
4412
4439
  VercelResourceFetcher,
4413
4440
  WORKSPACE_ASSETS_ROOT,
4414
4441
  WORKSPACE_ROOT,
4442
+ WebContainerRuntime,
4443
+ WebContainerServiceDefinition,
4444
+ WebContainerServiceFacade,
4415
4445
  WebSocketTransport,
4416
4446
  WorkingWorkspaceService,
4417
4447
  WorkspaceCloneSyncEngine,
4418
4448
  WorkspaceFS,
4449
+ WorkspaceGraphServiceDefinition,
4450
+ WorkspaceGraphServiceFacade,
4419
4451
  WorkspaceServiceDefinition,
4420
4452
  WorkspaceServiceFacade,
4421
4453
  authorizeB2,
@@ -4527,6 +4559,8 @@ export {
4527
4559
  krnlSrklServiceFacade,
4528
4560
  krnlStorageServiceDefinition,
4529
4561
  krnlStorageServiceFacade,
4562
+ krnlWorkspaceGraphServiceDefinition,
4563
+ krnlWorkspaceGraphServiceFacade,
4530
4564
  krnlWorkspaceServiceDefinition,
4531
4565
  krnlWorkspaceServiceFacade,
4532
4566
  listAllGraphPackages,
@@ -4556,6 +4590,7 @@ export {
4556
4590
  renameAppInWorkspaceData,
4557
4591
  renameS3Folder,
4558
4592
  resolveBackblazeEndpoint,
4593
+ resolveDevelopmentCommand,
4559
4594
  resolveDynamicRouteFromDb,
4560
4595
  resolveSystemDatabaseClusterNodes,
4561
4596
  resolveSystemDatabaseUrl,
@@ -4599,5 +4634,6 @@ export {
4599
4634
  withAuth,
4600
4635
  withCors,
4601
4636
  workingWorkspaceService,
4637
+ workspaceGraphService,
4602
4638
  writeWorkspaceFile
4603
4639
  };
@@ -155,5 +155,27 @@ declare const krnlSrklServiceFacade: {
155
155
  createInstance: () => _ultrst_armada_krnl.ServiceInstance<Record<string, unknown>, Record<string, unknown>>;
156
156
  execute: <TIn = unknown, TOut = unknown>(op: string, input?: TIn) => Promise<TOut>;
157
157
  };
158
+ declare const WorkspaceGraphServiceDefinition: ServiceDefinition;
159
+ declare const WorkspaceGraphServiceFacade: {
160
+ id: string;
161
+ name: string;
162
+ version: string;
163
+ runtime: "server";
164
+ deployment: "local";
165
+ definition: ServiceDefinition<Record<string, unknown>, Record<string, unknown>>;
166
+ createInstance: () => _ultrst_armada_krnl.ServiceInstance<Record<string, unknown>, Record<string, unknown>>;
167
+ execute: <TIn = unknown, TOut = unknown>(op: string, input?: TIn) => Promise<TOut>;
168
+ };
169
+ declare const krnlWorkspaceGraphServiceDefinition: ServiceDefinition<Record<string, unknown>, Record<string, unknown>>;
170
+ declare const krnlWorkspaceGraphServiceFacade: {
171
+ id: string;
172
+ name: string;
173
+ version: string;
174
+ runtime: "server";
175
+ deployment: "local";
176
+ definition: ServiceDefinition<Record<string, unknown>, Record<string, unknown>>;
177
+ createInstance: () => _ultrst_armada_krnl.ServiceInstance<Record<string, unknown>, Record<string, unknown>>;
178
+ execute: <TIn = unknown, TOut = unknown>(op: string, input?: TIn) => Promise<TOut>;
179
+ };
158
180
 
159
- export { AuthServiceDefinition, AuthServiceFacade, ControlPlaneServiceDefinition, ControlPlaneServiceFacade, DatabaseServiceDefinition, DatabaseServiceFacade, GeminiServiceDefinition, GeminiServiceFacade, SrklServiceDefinition, SrklServiceFacade, StorageServiceDefinition, StorageServiceFacade, WorkspaceServiceDefinition, WorkspaceServiceFacade, krnlAuthServiceDefinition, krnlAuthServiceFacade, krnlControlPlaneServiceDefinition, krnlControlPlaneServiceFacade, krnlDatabaseServiceDefinition, krnlDatabaseServiceFacade, krnlGeminiServiceDefinition, krnlGeminiServiceFacade, krnlSrklServiceDefinition, krnlSrklServiceFacade, krnlStorageServiceDefinition, krnlStorageServiceFacade, krnlWorkspaceServiceDefinition, krnlWorkspaceServiceFacade };
181
+ 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 };
@@ -11,6 +11,8 @@ import {
11
11
  SrklServiceFacade,
12
12
  StorageServiceDefinition,
13
13
  StorageServiceFacade,
14
+ WorkspaceGraphServiceDefinition,
15
+ WorkspaceGraphServiceFacade,
14
16
  WorkspaceServiceDefinition,
15
17
  WorkspaceServiceFacade,
16
18
  krnlAuthServiceDefinition,
@@ -25,13 +27,17 @@ import {
25
27
  krnlSrklServiceFacade,
26
28
  krnlStorageServiceDefinition,
27
29
  krnlStorageServiceFacade,
30
+ krnlWorkspaceGraphServiceDefinition,
31
+ krnlWorkspaceGraphServiceFacade,
28
32
  krnlWorkspaceServiceDefinition,
29
33
  krnlWorkspaceServiceFacade
30
- } from "./chunk-ZRYACED2.js";
34
+ } from "./chunk-GQUNN7SA.js";
35
+ import "./chunk-DBZVGMJ7.js";
31
36
  import "./chunk-VDROUXFT.js";
32
37
  import "./chunk-J2J24JVC.js";
33
38
  import "./chunk-4QEMALXF.js";
34
- import "./chunk-ZO3PZGNQ.js";
39
+ import "./chunk-FZKBTF34.js";
40
+ import "./chunk-E72GXBXF.js";
35
41
  import "./chunk-ZDH4XI7W.js";
36
42
  import "./chunk-TY32TUNI.js";
37
43
  export {
@@ -47,6 +53,8 @@ export {
47
53
  SrklServiceFacade,
48
54
  StorageServiceDefinition,
49
55
  StorageServiceFacade,
56
+ WorkspaceGraphServiceDefinition,
57
+ WorkspaceGraphServiceFacade,
50
58
  WorkspaceServiceDefinition,
51
59
  WorkspaceServiceFacade,
52
60
  krnlAuthServiceDefinition,
@@ -61,6 +69,8 @@ export {
61
69
  krnlSrklServiceFacade,
62
70
  krnlStorageServiceDefinition,
63
71
  krnlStorageServiceFacade,
72
+ krnlWorkspaceGraphServiceDefinition,
73
+ krnlWorkspaceGraphServiceFacade,
64
74
  krnlWorkspaceServiceDefinition,
65
75
  krnlWorkspaceServiceFacade
66
76
  };
@@ -228,4 +228,67 @@ declare class NodeGraphPersistenceService {
228
228
  }
229
229
  declare const nodeGraphPersistence: NodeGraphPersistenceService;
230
230
 
231
- export { CompositeBackend, EndpointGenerator, type GeneratedEndpointSummary, LOCAL_STORAGE_GRAPHS_PREFIX, type LocalService, NodeGraphPersistenceService, type NodeGraphValidationResult, type RemoteServiceProxy, type SaveGraphOptions, type UniversalAppEntity, type UniversalGraphEdge, type UniversalGraphNode, type UniversalNodeGraphDocument, type UniversalStorageConnection, createBackend, createCompositeService, createLocalService, createRemoteService, exportGraphAsJsonFile, nodeGraphPersistence, parseGraphJsonFile, validateGraphDocument };
231
+ /**
232
+ * @file workspaceGraphService.ts
233
+ * @description Universal workspace-scoped graph persistence service.
234
+ *
235
+ * This service owns graph documents and storage only. It does not know about
236
+ * BRWLR, Playwright, ZX, node factories, or any application-specific node type.
237
+ */
238
+
239
+ interface WorkspaceGraphDocument extends UniversalNodeGraphDocument {
240
+ workspaceId: string;
241
+ graphId: string;
242
+ graphSlug: string;
243
+ }
244
+ interface WorkspaceGraphSummary {
245
+ id: string;
246
+ name: string;
247
+ slug: string;
248
+ createdAt: string;
249
+ updatedAt: string;
250
+ nodeCount: number;
251
+ }
252
+ declare const workspaceGraphService: {
253
+ listGraphs(userId: string, workspaceId: string): Promise<{
254
+ success: true;
255
+ graphs: WorkspaceGraphSummary[];
256
+ }>;
257
+ createGraph(userId: string, workspaceId: string, input: {
258
+ name?: string;
259
+ }): Promise<{
260
+ success: true;
261
+ graph: WorkspaceGraphDocument;
262
+ graphs: any;
263
+ }>;
264
+ getGraph(userId: string, workspaceId: string, slug: string): Promise<{
265
+ success: true;
266
+ graph: WorkspaceGraphDocument;
267
+ }>;
268
+ saveGraph(userId: string, workspaceId: string, slug: string, patch: {
269
+ nodes?: UniversalGraphNode[];
270
+ edges?: UniversalGraphEdge[];
271
+ name?: string;
272
+ }): Promise<{
273
+ success: true;
274
+ graph: WorkspaceGraphDocument;
275
+ }>;
276
+ deleteGraph(userId: string, workspaceId: string, slug: string): Promise<{
277
+ success: true;
278
+ deletedSlug: string;
279
+ graphs: any;
280
+ }>;
281
+ duplicateGraph(userId: string, workspaceId: string, slug: string, newName?: string): Promise<{
282
+ success: true;
283
+ graph: WorkspaceGraphDocument;
284
+ graphs: any;
285
+ }>;
286
+ clearGraph(userId: string, workspaceId: string, slug: string): Promise<any>;
287
+ getGraphDocument(userId: string, workspaceId: string, slug: string): Promise<any>;
288
+ saveGraphDocument(userId: string, workspaceId: string, document: WorkspaceGraphDocument): Promise<{
289
+ success: true;
290
+ graph: WorkspaceGraphDocument;
291
+ }>;
292
+ };
293
+
294
+ export { CompositeBackend, EndpointGenerator, type GeneratedEndpointSummary, LOCAL_STORAGE_GRAPHS_PREFIX, type LocalService, NodeGraphPersistenceService, type NodeGraphValidationResult, type RemoteServiceProxy, type SaveGraphOptions, type UniversalAppEntity, type UniversalGraphEdge, type UniversalGraphNode, type UniversalNodeGraphDocument, type UniversalStorageConnection, type WorkspaceGraphDocument, type WorkspaceGraphSummary, createBackend, createCompositeService, createLocalService, createRemoteService, exportGraphAsJsonFile, nodeGraphPersistence, parseGraphJsonFile, validateGraphDocument, workspaceGraphService };
@@ -11,7 +11,12 @@ import {
11
11
  nodeGraphPersistence,
12
12
  parseGraphJsonFile,
13
13
  validateGraphDocument
14
- } from "../chunk-7B24ZWB3.js";
14
+ } from "../chunk-RBF2OGMC.js";
15
+ import {
16
+ workspaceGraphService
17
+ } from "../chunk-DBZVGMJ7.js";
18
+ import "../chunk-J2J24JVC.js";
19
+ import "../chunk-E72GXBXF.js";
15
20
  import "../chunk-TY32TUNI.js";
16
21
  export {
17
22
  CompositeBackend,
@@ -25,5 +30,6 @@ export {
25
30
  exportGraphAsJsonFile,
26
31
  nodeGraphPersistence,
27
32
  parseGraphJsonFile,
28
- validateGraphDocument
33
+ validateGraphDocument,
34
+ workspaceGraphService
29
35
  };
@@ -6,11 +6,12 @@ import {
6
6
  WorkspaceFS,
7
7
  remoteWorkspaceService,
8
8
  workingWorkspaceService
9
- } from "../chunk-DULUHQ5S.js";
9
+ } from "../chunk-GPXV4GBD.js";
10
10
  import {
11
11
  formatCanonicalWorkspaceFolderName,
12
12
  sanitizeWorkspaceName
13
- } from "../chunk-ZO3PZGNQ.js";
13
+ } from "../chunk-FZKBTF34.js";
14
+ import "../chunk-E72GXBXF.js";
14
15
  export {
15
16
  RemoteWorkspaceService,
16
17
  SyncEngine,
@@ -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",