@ultrst-armada/kloks 1.5.1 → 1.5.2

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.5.1",
5
- "sourceCommit": "df4285ad26bbf5f16acaca63ba43fe4e40740051",
4
+ "version": "1.5.2",
5
+ "sourceCommit": "07f2e1a49da642bbfd42cd79422306c93195493f",
6
6
  "releaseWorkflow": "npm Release",
7
- "workflowRunId": "39943915592"
7
+ "workflowRunId": "39969373482"
8
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultrst-armada/kloks",
3
- "version": "1.5.1",
3
+ "version": "1.5.2",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -284,6 +284,86 @@ var DevelopmentServiceFacade = {
284
284
  }
285
285
  };
286
286
 
287
+ // src/development/codeValidationService.ts
288
+ var COMMANDS2 = {
289
+ syntax: { command: "pnpm", args: ["exec", "tsc", "--noEmit"] },
290
+ lint: { command: "pnpm", args: ["run", "lint", "--if-present"] },
291
+ test: { command: "pnpm", args: ["run", "test", "--if-present"] },
292
+ build: { command: "pnpm", args: ["run", "build", "--if-present"] },
293
+ krnl: { command: "pnpm", args: ["exec", "krnl", "validate"] },
294
+ frnl: { command: "pnpm", args: ["exec", "frnl", "validate"] }
295
+ };
296
+ var DEFAULT_LAYERS = ["syntax", "lint", "krnl", "frnl"];
297
+ var commandText = (command, args) => [command, ...args].join(" ");
298
+ var CodeValidationRuntime = class {
299
+ constructor(runtime3 = new WebContainerRuntime()) {
300
+ this.runtime = runtime3;
301
+ }
302
+ runtime;
303
+ async validate(input = {}) {
304
+ if (input.files) await this.runtime.mount(input.files);
305
+ const diagnostics = [];
306
+ if (input.install) {
307
+ const installed = await this.runtime.runCommand("pnpm", ["install", "--no-frozen-lockfile"], input.cwd, input.env);
308
+ diagnostics.push({ layer: "lint", ok: installed.exitCode === 0, exitCode: installed.exitCode, output: installed.output, command: "pnpm install --no-frozen-lockfile" });
309
+ if (installed.exitCode !== 0) return { ok: false, diagnostics, failedLayers: ["lint"] };
310
+ }
311
+ const layers = input.layers?.length ? input.layers : DEFAULT_LAYERS;
312
+ for (const layer of layers) {
313
+ if (layer === "law-l9") {
314
+ diagnostics.push(await this.validateLawL9(input.cwd, input.maxLines ?? 200));
315
+ continue;
316
+ }
317
+ const spec = COMMANDS2[layer];
318
+ const result = await this.runtime.runCommand(spec.command, spec.args, input.cwd, input.env);
319
+ diagnostics.push({ layer, ok: result.exitCode === 0, exitCode: result.exitCode, output: result.output, command: commandText(spec.command, spec.args) });
320
+ if (result.exitCode !== 0) break;
321
+ }
322
+ return { ok: diagnostics.every((item) => item.ok), diagnostics, failedLayers: diagnostics.filter((item) => !item.ok).map((item) => item.layer) };
323
+ }
324
+ async validateLawL9(cwd = ".", maxLines = 200) {
325
+ const script = `python3 -c 'import os,sys; bad=[]; root="src"; [bad.append(os.path.join(r,f)+": "+str(len(open(os.path.join(r,f),encoding="utf-8",errors="ignore").readlines()))+" lines") for r,_,fs in os.walk(root) for f in fs if f.endswith((".ts",".tsx",".js",".jsx")) and not f.endswith(".d.ts") and len(open(os.path.join(r,f),encoding="utf-8",errors="ignore").readlines())>200]; print("\\n".join(bad)); sys.exit(1 if bad else 0)'`;
326
+ const result = await this.runtime.runCommand("sh", ["-lc", script], cwd);
327
+ return { layer: "law-l9", ok: result.exitCode === 0, exitCode: result.exitCode, output: result.output, command: script };
328
+ }
329
+ };
330
+ var runtime2 = new CodeValidationRuntime();
331
+ var CodeValidationServiceDefinition = createServiceDefinition({
332
+ id: "kloks.backend.codeValidation",
333
+ name: "CodeValidationService",
334
+ version: "1.0.0",
335
+ operations: { validate: { id: "CodeValidationService.validate", name: "validate", handler: async (input) => runtime2.validate(input) } }
336
+ });
337
+ var CodeValidationServiceFacade = {
338
+ id: CodeValidationServiceDefinition.id,
339
+ name: CodeValidationServiceDefinition.name,
340
+ version: CodeValidationServiceDefinition.version,
341
+ runtime: "client",
342
+ deployment: "local",
343
+ definition: CodeValidationServiceDefinition,
344
+ createInstance: () => createService(CodeValidationServiceDefinition),
345
+ execute: async (op, input) => {
346
+ const instance = createService(CodeValidationServiceDefinition);
347
+ await instance.start();
348
+ return instance.call(op, input);
349
+ }
350
+ };
351
+
352
+ // src/development/codeDiagnosticsService.ts
353
+ var CodeDiagnosticsService = class {
354
+ constructor(runtime3 = new WebContainerRuntime()) {
355
+ this.runtime = runtime3;
356
+ }
357
+ runtime;
358
+ async diagnostics(input = {}) {
359
+ const args = ["exec", "tsc", "--noEmit", "--pretty", "false"];
360
+ if (input.file) args.push(input.file);
361
+ const result = await this.runtime.runCommand("pnpm", args, input.cwd);
362
+ return { ok: result.exitCode === 0, output: result.output, command: ["pnpm", ...args].join(" ") };
363
+ }
364
+ };
365
+ var codeDiagnosticsService = new CodeDiagnosticsService();
366
+
287
367
  export {
288
368
  GitHubActionsClient,
289
369
  GitHubActionsServiceDefinition,
@@ -294,5 +374,10 @@ export {
294
374
  resolveDevelopmentCommand,
295
375
  DevelopmentServiceDefinition,
296
376
  DevelopmentRuntime,
297
- DevelopmentServiceFacade
377
+ DevelopmentServiceFacade,
378
+ CodeValidationRuntime,
379
+ CodeValidationServiceDefinition,
380
+ CodeValidationServiceFacade,
381
+ CodeDiagnosticsService,
382
+ codeDiagnosticsService
298
383
  };
@@ -143,4 +143,60 @@ declare const DevelopmentServiceFacade: {
143
143
  execute: <TIn = unknown, TOut = unknown>(op: string, input?: TIn) => Promise<TOut>;
144
144
  };
145
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 };
146
+ type ValidationLayer = 'syntax' | 'lint' | 'test' | 'build' | 'krnl' | 'frnl' | 'law-l9';
147
+ interface CodeValidationInput {
148
+ layers?: ValidationLayer[];
149
+ cwd?: string;
150
+ env?: Record<string, string>;
151
+ maxLines?: number;
152
+ files?: Record<string, unknown>;
153
+ install?: boolean;
154
+ }
155
+ interface ValidationDiagnostic {
156
+ layer: ValidationLayer;
157
+ ok: boolean;
158
+ exitCode: number;
159
+ output: string;
160
+ command: string;
161
+ }
162
+ interface CodeValidationResult {
163
+ ok: boolean;
164
+ diagnostics: ValidationDiagnostic[];
165
+ failedLayers: ValidationLayer[];
166
+ }
167
+
168
+ declare class CodeValidationRuntime {
169
+ private readonly runtime;
170
+ constructor(runtime?: WebContainerRuntime);
171
+ validate(input?: CodeValidationInput): Promise<CodeValidationResult>;
172
+ private validateLawL9;
173
+ }
174
+ declare const CodeValidationServiceDefinition: ServiceDefinition;
175
+ declare const CodeValidationServiceFacade: {
176
+ id: string;
177
+ name: string;
178
+ version: string;
179
+ runtime: "client";
180
+ deployment: "local";
181
+ definition: ServiceDefinition<Record<string, unknown>, Record<string, unknown>>;
182
+ createInstance: () => _ultrst_armada_krnl.ServiceInstance<Record<string, unknown>, Record<string, unknown>>;
183
+ execute: <TIn = CodeValidationInput, TOut = CodeValidationResult>(op: string, input?: TIn) => Promise<TOut>;
184
+ };
185
+
186
+ interface CodeDiagnosticsInput {
187
+ cwd?: string;
188
+ file?: string;
189
+ }
190
+ interface CodeDiagnosticsResult {
191
+ ok: boolean;
192
+ output: string;
193
+ command: string;
194
+ }
195
+ declare class CodeDiagnosticsService {
196
+ private readonly runtime;
197
+ constructor(runtime?: WebContainerRuntime);
198
+ diagnostics(input?: CodeDiagnosticsInput): Promise<CodeDiagnosticsResult>;
199
+ }
200
+ declare const codeDiagnosticsService: CodeDiagnosticsService;
201
+
202
+ export { type CodeDiagnosticsInput, type CodeDiagnosticsResult, CodeDiagnosticsService, type CodeValidationInput, type CodeValidationResult, CodeValidationRuntime, CodeValidationServiceDefinition, CodeValidationServiceFacade, type DevelopmentProvider, type DevelopmentRequest, type DevelopmentResult, DevelopmentRuntime, type DevelopmentServiceContract, DevelopmentServiceDefinition, DevelopmentServiceFacade, type DevelopmentTask, GitHubActionsClient, type GitHubActionsConfig, GitHubActionsServiceDefinition, GitHubActionsServiceFacade, type ValidationDiagnostic, type ValidationLayer, type WebContainerCommand, type WebContainerRunCommandInput, WebContainerRuntime, WebContainerServiceDefinition, WebContainerServiceFacade, type WorkflowRun, codeDiagnosticsService, resolveDevelopmentCommand };
@@ -1,4 +1,8 @@
1
1
  import {
2
+ CodeDiagnosticsService,
3
+ CodeValidationRuntime,
4
+ CodeValidationServiceDefinition,
5
+ CodeValidationServiceFacade,
2
6
  DevelopmentRuntime,
3
7
  DevelopmentServiceDefinition,
4
8
  DevelopmentServiceFacade,
@@ -8,10 +12,15 @@ import {
8
12
  WebContainerRuntime,
9
13
  WebContainerServiceDefinition,
10
14
  WebContainerServiceFacade,
15
+ codeDiagnosticsService,
11
16
  resolveDevelopmentCommand
12
- } from "../chunk-OVTXAGL6.js";
17
+ } from "../chunk-3Z7EUZWE.js";
13
18
  import "../chunk-TY32TUNI.js";
14
19
  export {
20
+ CodeDiagnosticsService,
21
+ CodeValidationRuntime,
22
+ CodeValidationServiceDefinition,
23
+ CodeValidationServiceFacade,
15
24
  DevelopmentRuntime,
16
25
  DevelopmentServiceDefinition,
17
26
  DevelopmentServiceFacade,
@@ -21,5 +30,6 @@ export {
21
30
  WebContainerRuntime,
22
31
  WebContainerServiceDefinition,
23
32
  WebContainerServiceFacade,
33
+ codeDiagnosticsService,
24
34
  resolveDevelopmentCommand
25
35
  };
@@ -13,7 +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
+ export { CodeDiagnosticsInput, CodeDiagnosticsResult, CodeDiagnosticsService, CodeValidationInput, CodeValidationResult, CodeValidationRuntime, CodeValidationServiceDefinition, CodeValidationServiceFacade, DevelopmentProvider, DevelopmentRequest, DevelopmentResult, DevelopmentRuntime, DevelopmentServiceContract, DevelopmentServiceDefinition, DevelopmentServiceFacade, DevelopmentTask, GitHubActionsClient, GitHubActionsConfig, GitHubActionsServiceDefinition, GitHubActionsServiceFacade, ValidationDiagnostic, ValidationLayer, WebContainerCommand, WebContainerRunCommandInput, WebContainerRuntime, WebContainerServiceDefinition, WebContainerServiceFacade, WorkflowRun, codeDiagnosticsService, resolveDevelopmentCommand } from './development/index.js';
17
17
  export { EndpointDescriptor, IService, ProtocolAdapter, ServiceDefinition } from '@ultrst-armada/krnl';
18
18
  import 'react';
19
19
 
@@ -195,6 +195,10 @@ import {
195
195
  resolveSystemDatabaseClusterNodes
196
196
  } from "./chunk-RCCQ7IRM.js";
197
197
  import {
198
+ CodeDiagnosticsService,
199
+ CodeValidationRuntime,
200
+ CodeValidationServiceDefinition,
201
+ CodeValidationServiceFacade,
198
202
  DevelopmentRuntime,
199
203
  DevelopmentServiceDefinition,
200
204
  DevelopmentServiceFacade,
@@ -204,8 +208,9 @@ import {
204
208
  WebContainerRuntime,
205
209
  WebContainerServiceDefinition,
206
210
  WebContainerServiceFacade,
211
+ codeDiagnosticsService,
207
212
  resolveDevelopmentCommand
208
- } from "./chunk-OVTXAGL6.js";
213
+ } from "./chunk-3Z7EUZWE.js";
209
214
  import "./chunk-TY32TUNI.js";
210
215
 
211
216
  // src/data/BaseDataProvider.ts
@@ -4379,6 +4384,10 @@ export {
4379
4384
  CANONICAL_SRKL_URL,
4380
4385
  CallbackRegistry,
4381
4386
  CloudflareResourceFetcher,
4387
+ CodeDiagnosticsService,
4388
+ CodeValidationRuntime,
4389
+ CodeValidationServiceDefinition,
4390
+ CodeValidationServiceFacade,
4382
4391
  CompositeBackend,
4383
4392
  ConcurrencyConflictError,
4384
4393
  ConcurrencyManager,
@@ -4460,6 +4469,7 @@ export {
4460
4469
  buildProjectObservability,
4461
4470
  buildProjectsList,
4462
4471
  cleanDbUrl,
4472
+ codeDiagnosticsService,
4463
4473
  computeDeploymentFinalWeight,
4464
4474
  computeUsageWeightScore,
4465
4475
  configureStarterProjectTemplate,
@@ -258,6 +258,59 @@
258
258
  },
259
259
  "dependencies": [
260
260
  "github-actions",
261
+ "web-container",
262
+ "code-validation"
263
+ ]
264
+ },
265
+ {
266
+ "id": "code-validation",
267
+ "name": "Code Validation & Diagnostics",
268
+ "version": "1.0.0",
269
+ "description": "Shared syntax, lint, test, build, KrnlTS, FrnlTS and Law L9 validation pipeline backed by the canonical WebContainer runtime.",
270
+ "backend": {
271
+ "package": "@ultrst-armada/kloks",
272
+ "subpath": "development",
273
+ "export": "CodeValidationServiceFacade",
274
+ "facade": "CodeValidationServiceFacade"
275
+ },
276
+ "modes": [
277
+ "fullstack"
278
+ ],
279
+ "targets": {
280
+ "backend": [
281
+ "App.main-content"
282
+ ],
283
+ "frontend": [
284
+ "App.main-content"
285
+ ]
286
+ },
287
+ "dependencies": [
288
+ "web-container"
289
+ ]
290
+ },
291
+ {
292
+ "id": "code-diagnostics",
293
+ "name": "TypeScript Code Diagnostics",
294
+ "version": "1.0.0",
295
+ "description": "Editor-facing TypeScript diagnostics runner for authored source.",
296
+ "backend": {
297
+ "package": "@ultrst-armada/kloks",
298
+ "subpath": "development",
299
+ "export": "codeDiagnosticsService",
300
+ "facade": "codeDiagnosticsService"
301
+ },
302
+ "modes": [
303
+ "fullstack"
304
+ ],
305
+ "targets": {
306
+ "backend": [
307
+ "App.main-content"
308
+ ],
309
+ "frontend": [
310
+ "App.main-content"
311
+ ]
312
+ },
313
+ "dependencies": [
261
314
  "web-container"
262
315
  ]
263
316
  }
@@ -7,21 +7,6 @@ import {
7
7
  instantiateSubgraph
8
8
  } from "./chunk-S22PMERU.js";
9
9
  import "./chunk-RHRXPY2U.js";
10
- import {
11
- AttractionEngine,
12
- GhostInferenceEngine,
13
- GhostLayoutResolver,
14
- GhostTracePathBuilder,
15
- calculateSocketCoordinates,
16
- getBeamPoints,
17
- useMagneticTraces
18
- } from "./chunk-JXDJZSFW.js";
19
- import {
20
- ConnectionRuleStore,
21
- HandleTypeRegistry,
22
- WireTypeRegistry,
23
- initializeDefaultGraphRules
24
- } from "./chunk-TZOL3RN7.js";
25
10
  import {
26
11
  LifecycleCycleError,
27
12
  LifecycleGraph,
@@ -45,6 +30,21 @@ import {
45
30
  CustomViewWindow,
46
31
  DEFAULT_GRAPH_SETTINGS
47
32
  } from "./chunk-KG6QYS26.js";
33
+ import {
34
+ AttractionEngine,
35
+ GhostInferenceEngine,
36
+ GhostLayoutResolver,
37
+ GhostTracePathBuilder,
38
+ calculateSocketCoordinates,
39
+ getBeamPoints,
40
+ useMagneticTraces
41
+ } from "./chunk-JXDJZSFW.js";
42
+ import {
43
+ ConnectionRuleStore,
44
+ HandleTypeRegistry,
45
+ WireTypeRegistry,
46
+ initializeDefaultGraphRules
47
+ } from "./chunk-TZOL3RN7.js";
48
48
  import {
49
49
  AutoSolidify,
50
50
  SpatialEngine,