@ultrst-armada/kloks 1.5.2 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schema": 1,
3
3
  "packageName": "@ultrst-armada/kloks",
4
- "version": "1.5.2",
5
- "sourceCommit": "07f2e1a49da642bbfd42cd79422306c93195493f",
4
+ "version": "1.6.0",
5
+ "sourceCommit": "a44775f58baed156dbc5590d9d920e6b582f2eee",
6
6
  "releaseWorkflow": "npm Release",
7
- "workflowRunId": "39969373482"
7
+ "workflowRunId": "39983348775"
8
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultrst-armada/kloks",
3
- "version": "1.5.2",
3
+ "version": "1.6.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -169,6 +169,10 @@ var WebContainerRuntime = class {
169
169
  release();
170
170
  }
171
171
  }
172
+ async spawnCommand(command, args = [], cwd, env) {
173
+ const container = await this.boot();
174
+ return container.spawn(command, args, { cwd, env });
175
+ }
172
176
  async teardown() {
173
177
  const container = this.container;
174
178
  this.container = null;
@@ -239,7 +243,8 @@ var DevelopmentServiceDefinition = createServiceDefinition({
239
243
  name: "describeProviders",
240
244
  handler: async () => ({
241
245
  providers: [
242
- { id: "webcontainer", capabilities: ["install", "lint", "test", "build", "validate", "check"] },
246
+ { id: "webcontainer", capabilities: ["install", "lint", "test", "build", "validate", "check", "process-host"] },
247
+ { id: "typescript-language-server", capabilities: ["lsp", "diagnostics", "completion", "hover", "definition", "references", "rename", "symbols"] },
243
248
  { id: "github-actions", capabilities: ["dispatch", "observe", "rerun", "cancel"] }
244
249
  ]
245
250
  })
@@ -296,8 +301,8 @@ var COMMANDS2 = {
296
301
  var DEFAULT_LAYERS = ["syntax", "lint", "krnl", "frnl"];
297
302
  var commandText = (command, args) => [command, ...args].join(" ");
298
303
  var CodeValidationRuntime = class {
299
- constructor(runtime3 = new WebContainerRuntime()) {
300
- this.runtime = runtime3;
304
+ constructor(runtime4 = new WebContainerRuntime()) {
305
+ this.runtime = runtime4;
301
306
  }
302
307
  runtime;
303
308
  async validate(input = {}) {
@@ -351,8 +356,8 @@ var CodeValidationServiceFacade = {
351
356
 
352
357
  // src/development/codeDiagnosticsService.ts
353
358
  var CodeDiagnosticsService = class {
354
- constructor(runtime3 = new WebContainerRuntime()) {
355
- this.runtime = runtime3;
359
+ constructor(runtime4 = new WebContainerRuntime()) {
360
+ this.runtime = runtime4;
356
361
  }
357
362
  runtime;
358
363
  async diagnostics(input = {}) {
@@ -364,6 +369,139 @@ var CodeDiagnosticsService = class {
364
369
  };
365
370
  var codeDiagnosticsService = new CodeDiagnosticsService();
366
371
 
372
+ // src/development/typescriptLanguageServerService.ts
373
+ var TYPESCRIPT_LANGUAGE_SERVER_PACKAGE = "typescript-language-server";
374
+ var TYPESCRIPT_LANGUAGE_SERVER_VERSION = "6.0.2";
375
+ var PACKAGE = TYPESCRIPT_LANGUAGE_SERVER_PACKAGE;
376
+ var DEFAULT_VERSION = TYPESCRIPT_LANGUAGE_SERVER_VERSION;
377
+ var TypeScriptLanguageServerRuntime = class {
378
+ constructor(runtime4 = new WebContainerRuntime()) {
379
+ this.runtime = runtime4;
380
+ }
381
+ runtime;
382
+ process = null;
383
+ writer = null;
384
+ pending = /* @__PURE__ */ new Map();
385
+ buffer = "";
386
+ cwd = ".";
387
+ version = DEFAULT_VERSION;
388
+ async start(input = {}) {
389
+ if (this.process) return this.status();
390
+ this.cwd = input.cwd ?? ".";
391
+ this.version = input.version ?? DEFAULT_VERSION;
392
+ if (input.install !== false) {
393
+ await this.runtime.runCommand("pnpm", ["add", "-D", "typescript@7.0.2", PACKAGE + "@" + this.version], this.cwd);
394
+ }
395
+ this.process = await this.runtime.spawnCommand("pnpm", ["exec", PACKAGE, "--stdio"], this.cwd);
396
+ this.writer = this.process.input.getWriter();
397
+ void this.readOutput(this.process.output);
398
+ return this.status();
399
+ }
400
+ async request(input) {
401
+ await this.ensureRunning();
402
+ const promise = new Promise((resolve, reject) => {
403
+ this.pending.set(input.id, { resolve, reject });
404
+ });
405
+ await this.write(input);
406
+ return promise;
407
+ }
408
+ async notify(input) {
409
+ await this.ensureRunning();
410
+ await this.write(input);
411
+ return { sent: true };
412
+ }
413
+ async stop() {
414
+ const process = this.process;
415
+ this.process = null;
416
+ this.writer?.releaseLock();
417
+ this.writer = null;
418
+ for (const pending of this.pending.values()) pending.reject(new Error("Language server stopped"));
419
+ this.pending.clear();
420
+ if (process) await process.kill();
421
+ return { stopped: true };
422
+ }
423
+ status() {
424
+ return { running: Boolean(this.process), cwd: this.cwd, package: PACKAGE, version: this.version };
425
+ }
426
+ async ensureRunning() {
427
+ if (!this.process) await this.start({ cwd: this.cwd, install: false, version: this.version });
428
+ }
429
+ async write(message) {
430
+ if (!this.writer) throw new Error("Language server input is unavailable");
431
+ const body = JSON.stringify({ jsonrpc: "2.0", ...message });
432
+ const frame = "Content-Length: " + new TextEncoder().encode(body).byteLength + "\r\n\r\n" + body;
433
+ await this.writer.write(frame);
434
+ }
435
+ async readOutput(output) {
436
+ const reader = output.getReader();
437
+ try {
438
+ while (true) {
439
+ const next = await reader.read();
440
+ if (next.done) break;
441
+ this.buffer += next.value;
442
+ this.consumeFrames();
443
+ }
444
+ } catch (error) {
445
+ for (const pending of this.pending.values()) pending.reject(error instanceof Error ? error : new Error(String(error)));
446
+ this.pending.clear();
447
+ } finally {
448
+ reader.releaseLock();
449
+ this.process = null;
450
+ this.writer?.releaseLock();
451
+ this.writer = null;
452
+ }
453
+ }
454
+ consumeFrames() {
455
+ while (true) {
456
+ const separator = this.buffer.indexOf("\r\n\r\n");
457
+ if (separator < 0) return;
458
+ const header = this.buffer.slice(0, separator);
459
+ const match = header.match(/Content-Length:\s*(\d+)/i);
460
+ if (!match) {
461
+ this.buffer = this.buffer.slice(separator + 4);
462
+ continue;
463
+ }
464
+ const length = Number(match[1]);
465
+ const start = separator + 4;
466
+ if (this.buffer.length - start < length) return;
467
+ const body = this.buffer.slice(start, start + length);
468
+ this.buffer = this.buffer.slice(start + length);
469
+ const response = JSON.parse(body);
470
+ if (response.id !== void 0 && response.id !== null) {
471
+ this.pending.get(response.id)?.resolve(response);
472
+ this.pending.delete(response.id);
473
+ }
474
+ }
475
+ }
476
+ };
477
+ var runtime3 = new TypeScriptLanguageServerRuntime();
478
+ var TypeScriptLanguageServerServiceDefinition = createServiceDefinition({
479
+ id: "kloks.backend.typescriptLanguageServer",
480
+ name: "TypeScriptLanguageServerService",
481
+ version: "1.0.0",
482
+ operations: {
483
+ start: { id: "TypeScriptLanguageServerService.start", name: "start", handler: async (input) => runtime3.start(input) },
484
+ request: { id: "TypeScriptLanguageServerService.request", name: "request", handler: async (input) => runtime3.request(input) },
485
+ notify: { id: "TypeScriptLanguageServerService.notify", name: "notify", handler: async (input) => runtime3.notify(input) },
486
+ stop: { id: "TypeScriptLanguageServerService.stop", name: "stop", handler: async () => runtime3.stop() },
487
+ status: { id: "TypeScriptLanguageServerService.status", name: "status", handler: async () => runtime3.status() }
488
+ }
489
+ });
490
+ var TypeScriptLanguageServerServiceFacade = {
491
+ id: TypeScriptLanguageServerServiceDefinition.id,
492
+ name: TypeScriptLanguageServerServiceDefinition.name,
493
+ version: TypeScriptLanguageServerServiceDefinition.version,
494
+ runtime: "client",
495
+ deployment: "local",
496
+ definition: TypeScriptLanguageServerServiceDefinition,
497
+ createInstance: () => createService(TypeScriptLanguageServerServiceDefinition),
498
+ execute: async (op, input) => {
499
+ const instance = createService(TypeScriptLanguageServerServiceDefinition);
500
+ await instance.start();
501
+ return instance.call(op, input);
502
+ }
503
+ };
504
+
367
505
  export {
368
506
  GitHubActionsClient,
369
507
  GitHubActionsServiceDefinition,
@@ -379,5 +517,9 @@ export {
379
517
  CodeValidationServiceDefinition,
380
518
  CodeValidationServiceFacade,
381
519
  CodeDiagnosticsService,
382
- codeDiagnosticsService
520
+ codeDiagnosticsService,
521
+ TYPESCRIPT_LANGUAGE_SERVER_PACKAGE,
522
+ TYPESCRIPT_LANGUAGE_SERVER_VERSION,
523
+ TypeScriptLanguageServerServiceDefinition,
524
+ TypeScriptLanguageServerServiceFacade
383
525
  };
@@ -108,6 +108,7 @@ declare class WebContainerRuntime {
108
108
  exitCode: any;
109
109
  output: string;
110
110
  }>;
111
+ spawnCommand(command: string, args?: string[], cwd?: string, env?: Record<string, string | number | boolean>): Promise<any>;
111
112
  teardown(): Promise<{
112
113
  tornDown: boolean;
113
114
  }>;
@@ -199,4 +200,49 @@ declare class CodeDiagnosticsService {
199
200
  }
200
201
  declare const codeDiagnosticsService: CodeDiagnosticsService;
201
202
 
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 };
203
+ interface TypeScriptLanguageServerStartInput {
204
+ cwd?: string;
205
+ install?: boolean;
206
+ version?: string;
207
+ }
208
+ interface TypeScriptLanguageServerRequestInput {
209
+ id: number | string;
210
+ method: string;
211
+ params?: unknown;
212
+ }
213
+ interface TypeScriptLanguageServerNotificationInput {
214
+ method: string;
215
+ params?: unknown;
216
+ }
217
+ interface TypeScriptLanguageServerResponse {
218
+ jsonrpc: '2.0';
219
+ id?: number | string | null;
220
+ result?: unknown;
221
+ error?: {
222
+ code: number;
223
+ message: string;
224
+ data?: unknown;
225
+ };
226
+ }
227
+ interface TypeScriptLanguageServerStatus {
228
+ running: boolean;
229
+ cwd?: string;
230
+ package: string;
231
+ version: string;
232
+ }
233
+
234
+ declare const TYPESCRIPT_LANGUAGE_SERVER_PACKAGE = "typescript-language-server";
235
+ declare const TYPESCRIPT_LANGUAGE_SERVER_VERSION = "6.0.2";
236
+ declare const TypeScriptLanguageServerServiceDefinition: ServiceDefinition;
237
+ declare const TypeScriptLanguageServerServiceFacade: {
238
+ id: string;
239
+ name: string;
240
+ version: string;
241
+ runtime: "client";
242
+ deployment: "local";
243
+ definition: ServiceDefinition<Record<string, unknown>, Record<string, unknown>>;
244
+ createInstance: () => _ultrst_armada_krnl.ServiceInstance<Record<string, unknown>, Record<string, unknown>>;
245
+ execute: <TIn = unknown, TOut = unknown>(op: string, input?: TIn) => Promise<TOut>;
246
+ };
247
+
248
+ 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, TYPESCRIPT_LANGUAGE_SERVER_PACKAGE, TYPESCRIPT_LANGUAGE_SERVER_VERSION, type TypeScriptLanguageServerNotificationInput, type TypeScriptLanguageServerRequestInput, type TypeScriptLanguageServerResponse, TypeScriptLanguageServerServiceDefinition, TypeScriptLanguageServerServiceFacade, type TypeScriptLanguageServerStartInput, type TypeScriptLanguageServerStatus, type ValidationDiagnostic, type ValidationLayer, type WebContainerCommand, type WebContainerRunCommandInput, WebContainerRuntime, WebContainerServiceDefinition, WebContainerServiceFacade, type WorkflowRun, codeDiagnosticsService, resolveDevelopmentCommand };
@@ -9,12 +9,16 @@ import {
9
9
  GitHubActionsClient,
10
10
  GitHubActionsServiceDefinition,
11
11
  GitHubActionsServiceFacade,
12
+ TYPESCRIPT_LANGUAGE_SERVER_PACKAGE,
13
+ TYPESCRIPT_LANGUAGE_SERVER_VERSION,
14
+ TypeScriptLanguageServerServiceDefinition,
15
+ TypeScriptLanguageServerServiceFacade,
12
16
  WebContainerRuntime,
13
17
  WebContainerServiceDefinition,
14
18
  WebContainerServiceFacade,
15
19
  codeDiagnosticsService,
16
20
  resolveDevelopmentCommand
17
- } from "../chunk-3Z7EUZWE.js";
21
+ } from "../chunk-3HZYAZF4.js";
18
22
  import "../chunk-TY32TUNI.js";
19
23
  export {
20
24
  CodeDiagnosticsService,
@@ -27,6 +31,10 @@ export {
27
31
  GitHubActionsClient,
28
32
  GitHubActionsServiceDefinition,
29
33
  GitHubActionsServiceFacade,
34
+ TYPESCRIPT_LANGUAGE_SERVER_PACKAGE,
35
+ TYPESCRIPT_LANGUAGE_SERVER_VERSION,
36
+ TypeScriptLanguageServerServiceDefinition,
37
+ TypeScriptLanguageServerServiceFacade,
30
38
  WebContainerRuntime,
31
39
  WebContainerServiceDefinition,
32
40
  WebContainerServiceFacade,
@@ -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 { 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';
16
+ export { CodeDiagnosticsInput, CodeDiagnosticsResult, CodeDiagnosticsService, CodeValidationInput, CodeValidationResult, CodeValidationRuntime, CodeValidationServiceDefinition, CodeValidationServiceFacade, DevelopmentProvider, DevelopmentRequest, DevelopmentResult, DevelopmentRuntime, DevelopmentServiceContract, DevelopmentServiceDefinition, DevelopmentServiceFacade, DevelopmentTask, GitHubActionsClient, GitHubActionsConfig, GitHubActionsServiceDefinition, GitHubActionsServiceFacade, TYPESCRIPT_LANGUAGE_SERVER_PACKAGE, TYPESCRIPT_LANGUAGE_SERVER_VERSION, TypeScriptLanguageServerNotificationInput, TypeScriptLanguageServerRequestInput, TypeScriptLanguageServerResponse, TypeScriptLanguageServerServiceDefinition, TypeScriptLanguageServerServiceFacade, TypeScriptLanguageServerStartInput, TypeScriptLanguageServerStatus, 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
 
@@ -205,12 +205,16 @@ import {
205
205
  GitHubActionsClient,
206
206
  GitHubActionsServiceDefinition,
207
207
  GitHubActionsServiceFacade,
208
+ TYPESCRIPT_LANGUAGE_SERVER_PACKAGE,
209
+ TYPESCRIPT_LANGUAGE_SERVER_VERSION,
210
+ TypeScriptLanguageServerServiceDefinition,
211
+ TypeScriptLanguageServerServiceFacade,
208
212
  WebContainerRuntime,
209
213
  WebContainerServiceDefinition,
210
214
  WebContainerServiceFacade,
211
215
  codeDiagnosticsService,
212
216
  resolveDevelopmentCommand
213
- } from "./chunk-3Z7EUZWE.js";
217
+ } from "./chunk-3HZYAZF4.js";
214
218
  import "./chunk-TY32TUNI.js";
215
219
 
216
220
  // src/data/BaseDataProvider.ts
@@ -4445,6 +4449,10 @@ export {
4445
4449
  StorageServiceFacade,
4446
4450
  SupabaseStorageAdapter,
4447
4451
  SyncEngine,
4452
+ TYPESCRIPT_LANGUAGE_SERVER_PACKAGE,
4453
+ TYPESCRIPT_LANGUAGE_SERVER_VERSION,
4454
+ TypeScriptLanguageServerServiceDefinition,
4455
+ TypeScriptLanguageServerServiceFacade,
4448
4456
  VercelResourceFetcher,
4449
4457
  WORKSPACE_ASSETS_ROOT,
4450
4458
  WORKSPACE_ROOT,
@@ -266,7 +266,7 @@
266
266
  "id": "code-validation",
267
267
  "name": "Code Validation & Diagnostics",
268
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.",
269
+ "description": "Shared syntax, lint, test, build, KrnlTS, FrnlTS and Law L9 validation pipeline backed by the canonical WebContainer runtime; diagnostics are consumable by IDEs and agents.",
270
270
  "backend": {
271
271
  "package": "@ultrst-armada/kloks",
272
272
  "subpath": "development",
@@ -313,6 +313,32 @@
313
313
  "dependencies": [
314
314
  "web-container"
315
315
  ]
316
+ },
317
+ {
318
+ "id": "typescript-language-server",
319
+ "name": "TypeScript Language Server",
320
+ "version": "1.0.0",
321
+ "description": "Reusable TypeScript Language Server Protocol service provisioned into a development runtime and consumable by IDEs and agents.",
322
+ "backend": {
323
+ "package": "@ultrst-armada/kloks",
324
+ "subpath": "development",
325
+ "export": "TypeScriptLanguageServerServiceFacade",
326
+ "facade": "TypeScriptLanguageServerServiceFacade"
327
+ },
328
+ "modes": [
329
+ "fullstack"
330
+ ],
331
+ "targets": {
332
+ "backend": [
333
+ "App.main-content"
334
+ ],
335
+ "frontend": [
336
+ "App.main-content"
337
+ ]
338
+ },
339
+ "dependencies": [
340
+ "web-container"
341
+ ]
316
342
  }
317
343
  ]
318
344
  }