@ultrst-armada/kloks 1.24.5 → 1.24.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/.krusbl-release-attestation.json +3 -3
  2. package/README.md +11 -0
  3. package/package.json +15 -12
  4. package/packages/audio-midi/dist/index.js +16 -16
  5. package/packages/backend/dist/ai-inference/index.js +0 -1
  6. package/packages/backend/dist/ai-keys/index.js +0 -1
  7. package/packages/backend/dist/ai-models/index.js +0 -1
  8. package/packages/backend/dist/ai-provider/index.js +0 -1
  9. package/packages/backend/dist/ai-routing/index.js +0 -1
  10. package/packages/backend/dist/ai-tools/index.js +0 -1
  11. package/packages/backend/dist/api/index.js +0 -1
  12. package/packages/backend/dist/auth/index.d.ts +5 -74
  13. package/packages/backend/dist/auth/index.js +16 -19
  14. package/packages/backend/dist/{chunk-2OPIDIIB.js → chunk-3VWBZEMG.js} +26 -2
  15. package/packages/backend/dist/chunk-ED32WV3T.js +75 -0
  16. package/packages/backend/dist/chunk-EO5VUYYU.js +20 -0
  17. package/packages/backend/dist/{chunk-B3VJ4HDV.js → chunk-JOTDEFRG.js} +1 -1
  18. package/packages/backend/dist/{chunk-OB65KZ2M.js → chunk-M45KQRPR.js} +1 -1
  19. package/packages/backend/dist/{chunk-AHJ2EWQW.js → chunk-Q7ZJSEII.js} +2 -21
  20. package/packages/backend/dist/chunk-SXDYW3QA.js +579 -0
  21. package/packages/backend/dist/client/index.js +0 -1
  22. package/packages/backend/dist/connectivity/index.js +0 -1
  23. package/packages/backend/dist/control-plane/index.d.ts +3 -3
  24. package/packages/backend/dist/control-plane/index.js +0 -1
  25. package/packages/backend/dist/development/client.d.ts +20 -6
  26. package/packages/backend/dist/development/client.js +42 -28
  27. package/packages/backend/dist/development/index.d.ts +20 -6
  28. package/packages/backend/dist/development/index.js +43 -32
  29. package/packages/backend/dist/development/playwrightInspectionService.js +2 -3
  30. package/packages/backend/dist/development/playwrightInspectionTypes.d.ts +1 -0
  31. package/packages/backend/dist/index.d.ts +3 -54
  32. package/packages/backend/dist/index.js +20 -103
  33. package/packages/backend/dist/krnl-ai-services.js +2 -3
  34. package/packages/backend/dist/krnl-services.js +3 -4
  35. package/packages/backend/dist/services/index.js +2 -3
  36. package/packages/backend/dist/srkl/index.js +0 -1
  37. package/packages/backend/dist/storage/index.js +0 -1
  38. package/packages/backend/dist/workspace/index.js +0 -1
  39. package/packages/backend/package.json +3 -10
  40. package/packages/client/dist/auth.d.ts +1 -0
  41. package/packages/client/dist/auth.js +22 -0
  42. package/packages/client/dist/chunk-B4WOPCRZ.js +26 -0
  43. package/packages/client/dist/index.d.ts +2 -0
  44. package/packages/client/dist/index.js +19 -1
  45. package/packages/client/package.json +8 -2
  46. package/packages/fod/dist/index.d.ts +11 -1
  47. package/packages/fod/dist/index.js +2 -0
  48. package/packages/fod/package.json +2 -3
  49. package/packages/functions/dist/index.js +16 -16
  50. package/packages/functions/package.json +2 -1
  51. package/packages/services/dist/index.d.ts +46 -1
  52. package/packages/services/dist/index.js +96 -18
  53. package/packages/services/kloks.manifest.json +19 -0
  54. package/packages/state-graph/dist/index.js +39 -39
  55. package/packages/backend/dist/BaseAccountProvider-DduKf5HG.d.ts +0 -66
  56. package/packages/backend/dist/chunk-2HCQ2SIR.js +0 -213
  57. package/packages/backend/dist/chunk-A3BE6ROS.js +0 -180
  58. package/packages/backend/dist/chunk-MWSYNRNZ.js +0 -871
  59. package/packages/backend/dist/chunk-QGM4M3NI.js +0 -37
  60. package/packages/backend/dist/dist-XMSSRYDR.js +0 -899
  61. package/packages/backend/dist/transformers.node-HWHOAE4H.js +0 -43879
@@ -3,7 +3,7 @@ import "./chunk-QGM4M3NI.js";
3
3
  // ../../node_modules/.pnpm/@ultrst-armada+krnl@1.0.9_@types+node@22.20.5/node_modules/@ultrst-armada/krnl/packages/core/dist/index.js
4
4
  import { randomUUID } from "crypto";
5
5
 
6
- // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/define-api.js
6
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/define-api.js
7
7
  function defineApi(definition) {
8
8
  const properties = Object.fromEntries(definition.parameters.map((parameter) => [
9
9
  parameter.name,
@@ -24,7 +24,7 @@ function defineApi(definition) {
24
24
  });
25
25
  }
26
26
 
27
- // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/array-apis.js
27
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/array-apis.js
28
28
  var array = { type: "array" };
29
29
  var integer = { type: "integer" };
30
30
  var arrayApis = [
@@ -35,7 +35,7 @@ var arrayApis = [
35
35
  defineApi({ id: "gutts.arrays.last", name: "last", category: "arrays", description: "Returns the final element of an array, or undefined when the array is empty.", parameters: [{ name: "values", description: "The array whose final element should be returned.", required: true, schema: array }], output: { description: "The final array element, or undefined for an empty array." }, semantics: { deterministic: true, pure: true, sideEffects: false } })
36
36
  ];
37
37
 
38
- // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/json-apis.js
38
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/json-apis.js
39
39
  var json = { type: "object", description: "A JSON-compatible value." };
40
40
  var jsonApis = [
41
41
  defineApi({ id: "gutts.json.isJsonValue", name: "isJsonValue", category: "json", description: "Checks whether an unknown value can be represented as a finite JSON value.", parameters: [{ name: "value", description: "The value to validate as JSON-compatible data.", required: true, schema: {} }], output: { type: "boolean", description: "True when the value is a valid JSON value." }, semantics: { deterministic: true, pure: true, sideEffects: false } }),
@@ -44,7 +44,7 @@ var jsonApis = [
44
44
  defineApi({ id: "gutts.json.stringifyJson", name: "stringifyJson", category: "json", description: "Serializes a JSON-compatible value into JSON text, optionally using indentation.", parameters: [{ name: "value", description: "The JSON-compatible value to serialize.", required: true, schema: {} }, { name: "space", description: "Optional number of indentation spaces to use in the serialized output.", required: false, schema: { type: "number" } }], output: { type: "string", description: "The serialized JSON text." }, semantics: { deterministic: true, pure: true, sideEffects: false }, errors: ["Throws TypeError when the value cannot be serialized as JSON."] })
45
45
  ];
46
46
 
47
- // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/number-apis.js
47
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/number-apis.js
48
48
  var numberApis = [
49
49
  defineApi({ id: "gutts.numbers.clamp", name: "clamp", category: "numbers", description: "Restricts a numeric value to an inclusive minimum and maximum range.", parameters: [{ name: "value", description: "The numeric value to constrain.", required: true, schema: { type: "number" } }, { name: "min", description: "The inclusive lower bound.", required: true, schema: { type: "number" } }, { name: "max", description: "The inclusive upper bound.", required: true, schema: { type: "number" } }], output: { type: "number", description: "The value constrained to the inclusive range." }, semantics: { deterministic: true, pure: true, sideEffects: false }, errors: ["Throws RangeError when min exceeds max."] }),
50
50
  defineApi({ id: "gutts.numbers.inRange", name: "inRange", category: "numbers", description: "Checks whether a numeric value falls within the configured range.", parameters: [{ name: "value", description: "The numeric value to test.", required: true, schema: { type: "number" } }, { name: "min", description: "The lower range boundary.", required: true, schema: { type: "number" } }, { name: "max", description: "The upper range boundary.", required: true, schema: { type: "number" } }], output: { type: "boolean", description: "Whether the value is inside the range." }, semantics: { deterministic: true, pure: true, sideEffects: false }, errors: ["Throws RangeError when min exceeds max."] }),
@@ -53,7 +53,7 @@ var numberApis = [
53
53
  defineApi({ id: "gutts.numbers.sum", name: "sum", category: "numbers", description: "Adds all numbers in an array and returns their total.", parameters: [{ name: "values", description: "The numeric values to add.", required: true, schema: { type: "array", items: { type: "number" } } }], output: { type: "number", description: "The sum of all input numbers." }, semantics: { deterministic: true, pure: true, sideEffects: false } })
54
54
  ];
55
55
 
56
- // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/object-apis.js
56
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/object-apis.js
57
57
  var objectApis = [
58
58
  defineApi({ id: "gutts.objects.hasOwn", name: "hasOwn", category: "objects", description: "Checks whether an object contains a requested property.", parameters: [{ name: "value", description: "The object to inspect.", required: true, schema: { type: "object" } }, { name: "key", description: "The property key to look for.", required: true, schema: { type: "string" } }], output: { type: "boolean" }, semantics: { deterministic: true, pure: true, sideEffects: false } }),
59
59
  defineApi({ id: "gutts.objects.pick", name: "pick", category: "objects", description: "Creates an object containing only requested properties.", parameters: [{ name: "value", description: "The source object.", required: true, schema: { type: "object" } }, { name: "keys", description: "The property keys to retain.", required: true, schema: { type: "array", items: { type: "string" } } }], output: { type: "object" }, semantics: { deterministic: true, pure: true, sideEffects: false } }),
@@ -61,7 +61,7 @@ var objectApis = [
61
61
  defineApi({ id: "gutts.objects.isPlainObject", name: "isPlainObject", category: "objects", description: "Checks whether a value is a plain JavaScript object.", parameters: [{ name: "value", description: "The value to classify.", required: true, schema: {} }], output: { type: "boolean" }, semantics: { deterministic: true, pure: true, sideEffects: false } })
62
62
  ];
63
63
 
64
- // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/string-apis.js
64
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/string-apis.js
65
65
  var string = { type: "string" };
66
66
  var stringApis = [
67
67
  defineApi({ id: "gutts.strings.isBlank", name: "isBlank", category: "strings", description: "Checks whether a string contains no non-whitespace characters.", parameters: [{ name: "value", description: "The string to inspect.", required: true, schema: string }], output: { type: "boolean" }, semantics: { deterministic: true, pure: true, sideEffects: false } }),
@@ -77,7 +77,7 @@ var stringApis = [
77
77
  defineApi({ id: "gutts.strings.truncateWords", name: "truncateWords", category: "strings", description: "Shortens a string to a maximum number of words and appends a suffix when truncation is required.", parameters: [{ name: "value", description: "The string to shorten.", required: true, schema: string }, { name: "maxWords", description: "The non-negative maximum number of words.", required: true, schema: { type: "number" } }, { name: "suffix", description: "The suffix used when truncation occurs.", required: false, schema: string }], output: { type: "string" }, semantics: { deterministic: true, pure: true, sideEffects: false }, errors: ["Throws RangeError when maxWords is negative."] })
78
78
  ];
79
79
 
80
- // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/url-apis.js
80
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/url-apis.js
81
81
  var string2 = { type: "string" };
82
82
  var urlApis = [
83
83
  defineApi({ id: "gutts.urls.isUrl", name: "isUrl", category: "urls", description: "Checks whether a string can be parsed as a URL by the standard URL constructor.", parameters: [{ name: "value", description: "The string to validate.", required: true, schema: string2 }], output: { type: "boolean" }, semantics: { deterministic: true, pure: true, sideEffects: false } }),
@@ -86,7 +86,7 @@ var urlApis = [
86
86
  defineApi({ id: "gutts.urls.setQueryParam", name: "setQueryParam", category: "urls", description: "Returns a URL with one query-string parameter set to the supplied value.", parameters: [{ name: "url", description: "The URL to modify.", required: true, schema: string2 }, { name: "key", description: "The query parameter name.", required: true, schema: string2 }, { name: "value", description: "The query parameter value.", required: true, schema: string2 }], output: { type: "string" }, semantics: { deterministic: true, pure: true, sideEffects: false }, errors: ["Throws when url cannot be parsed as a URL."] })
87
87
  ];
88
88
 
89
- // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/needle3/index.js
89
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/needle3/index.js
90
90
  var needle3Metadata = {
91
91
  id: "model.cactus-needle3",
92
92
  name: "Needle 3",
@@ -117,12 +117,12 @@ var needle3CompleteApi = defineApi({
117
117
  semantics: { deterministic: false, pure: false, sideEffects: false }
118
118
  });
119
119
 
120
- // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/runtimes/ettin-head.js
120
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/runtimes/ettin-head.js
121
121
  import fs from "fs";
122
122
  import path from "path";
123
123
  import os from "os";
124
124
 
125
- // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/smollm2/index.js
125
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/smollm2/index.js
126
126
  var smolLM2Metadata = {
127
127
  id: "model.smollm2-135m-instruct",
128
128
  name: "SmolLM2-135M-Instruct",
@@ -154,7 +154,7 @@ var smolLM2GenerateApi = defineApi({
154
154
  errors: ["Model load failure", "Inference failure"]
155
155
  });
156
156
 
157
- // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/whistle/index.js
157
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/whistle/index.js
158
158
  var whistleMetadata = {
159
159
  id: "model.cactus-whistle",
160
160
  name: "Whistle",
@@ -184,7 +184,7 @@ var whistleTranscribeApi = defineApi({
184
184
  semantics: { deterministic: true, pure: false, sideEffects: false }
185
185
  });
186
186
 
187
- // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/ettin/index.js
187
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/ettin/index.js
188
188
  var defineEttin = (id2, name, parameters, description) => ({
189
189
  id: id2,
190
190
  name,
@@ -219,7 +219,7 @@ var ettinRerankApi = defineApi({
219
219
  semantics: { deterministic: true, pure: false, sideEffects: false }
220
220
  });
221
221
 
222
- // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/minilm/index.js
222
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/minilm/index.js
223
223
  var miniLML6Metadata = {
224
224
  id: "model.minilm-l6-v2",
225
225
  name: "MiniLM-L6-v2",
@@ -250,7 +250,7 @@ var miniLMSimilarityApi = defineApi({
250
250
  semantics: { deterministic: true, pure: false, sideEffects: false }
251
251
  });
252
252
 
253
- // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/api-registry.js
253
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/api-registry.js
254
254
  var guttsApiDefinitions = Object.freeze([
255
255
  ...arrayApis,
256
256
  ...jsonApis,
@@ -266,7 +266,7 @@ var guttsApiDefinitions = Object.freeze([
266
266
  ]);
267
267
  var guttsApiById = Object.freeze(Object.fromEntries(guttsApiDefinitions.map((api) => [api.id, api])));
268
268
 
269
- // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/fod-node-provider.js
269
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/fod-node-provider.js
270
270
  var schemaType = (schema) => String(schema?.type ?? "any");
271
271
  function guttsApiToFodNode(api) {
272
272
  return {
@@ -282,7 +282,7 @@ function guttsApiToFodNode(api) {
282
282
  }
283
283
  var guttsFodNodeDefinitions = Object.freeze(guttsApiDefinitions.map(guttsApiToFodNode));
284
284
 
285
- // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/model-registry.js
285
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/model-registry.js
286
286
  var guttsModelDefinitions = Object.freeze([
287
287
  smolLM2Metadata,
288
288
  needle3Metadata,
@@ -28,6 +28,7 @@
28
28
  "zod": "^3.24.1"
29
29
  },
30
30
  "devDependencies": {
31
- "@ultrst-armada/krnl": "^1.0.9"
31
+ "@ultrst-armada/krnl": "^1.0.9",
32
+ "@types/node": "^22.0.0"
32
33
  }
33
34
  }
@@ -524,6 +524,51 @@ declare class CommandVerificationProvider {
524
524
  verify(steps: readonly VerificationStep[]): Promise<VerificationReport>;
525
525
  }
526
526
 
527
+ type ServiceMatchClass = 'exact' | 'compatible' | 'related' | 'none';
528
+ interface ServiceOperationIdentity {
529
+ id?: string;
530
+ name: string;
531
+ description?: string;
532
+ inputs?: Record<string, string>;
533
+ outputs?: Record<string, string>;
534
+ }
535
+ interface ServiceIdentity {
536
+ id: string;
537
+ name: string;
538
+ version: string;
539
+ description: string;
540
+ operations: ServiceOperationIdentity[];
541
+ capabilities?: string[];
542
+ source?: {
543
+ repository?: string;
544
+ path?: string;
545
+ sha?: string;
546
+ };
547
+ }
548
+ interface ServiceMatchEvidence {
549
+ kind: 'identity' | 'operations' | 'inputs' | 'outputs' | 'text' | 'version';
550
+ score: number;
551
+ detail: string;
552
+ }
553
+ interface ServiceMatch {
554
+ candidate: ServiceIdentity;
555
+ similarity: number;
556
+ matchClass: ServiceMatchClass;
557
+ reuseRecommendation: 'reuse-exact' | 'reuse-compatible' | 'inspect-related' | 'implement-new';
558
+ evidence: ServiceMatchEvidence[];
559
+ }
560
+ declare const buildServiceIdentity: (service: ServiceIdentity) => ServiceIdentity;
561
+ declare const compareServices: (query: ServiceIdentity, candidate: ServiceIdentity) => ServiceMatch;
562
+ declare class KLOKSServiceIndex {
563
+ private readonly services;
564
+ register(service: ServiceIdentity): ServiceIdentity;
565
+ registerMany(services: ServiceIdentity[]): void;
566
+ get(id: string): ServiceIdentity | undefined;
567
+ list(): ServiceIdentity[];
568
+ findMatches(query: ServiceIdentity, minimumClass?: ServiceMatchClass): ServiceMatch[];
569
+ recommendReuse(query: ServiceIdentity): ServiceMatch | null;
570
+ }
571
+
527
572
  interface ServiceFacade<TState extends Record<string, unknown> = Record<string, unknown>, TEvents extends Record<string, unknown> = Record<string, unknown>> {
528
573
  readonly id: string;
529
574
  readonly name: string;
@@ -580,4 +625,4 @@ declare const krnlServiceDDefinition: ServiceDefinition<Record<string, unknown>,
580
625
  declare const krnlServiceDFacade: ServiceFacade<Record<string, unknown>, Record<string, unknown>>;
581
626
  declare const krnlExposeServiceD: typeof exposeServiceD;
582
627
 
583
- export { AuthClientServiceDefinition, AuthClientServiceFacade, type AuthListener, AuthService, AuthServiceUISchema, CLEAN_DATABASE_CLUSTER, CommandVerificationProvider, type CounterState, DEFAULT_CONNECTIONS, type EcosystemServiceCategory, type GitHubFile, GitHubVcsProvider, type GitHubVcsProviderOptions, type IAuthStore, LocalExecutionProvider, type LocalExecutionRequest, type LocalExecutionResult, LocalWorkspaceProvider, type MathInput, MonacoIdeServiceDefinition, MonacoIdeServiceFacade, type ProtocolExposureHandle, STORAGE_KEY_CONNECTIONS, ServiceADefinition, ServiceAFacade, ServiceBDefinition, ServiceBFacade, ServiceCDefinition, ServiceCFacade, ServiceDDefinition, ServiceDFacade, type ServiceFacade, type SrklAccount, SrklAccountClient, type SrklAccountClientOptions, type SrklAccountManifest, type SrklAccountSyncResult, StorageClientServiceDefinition, StorageClientServiceFacade, StorageService, StorageServiceUISchema, SystemDbClientServiceDefinition, SystemDbClientServiceFacade, SystemDbService, SystemDbServiceUISchema, type SystemEnvironmentStatus, type SystemTelemetry, type TelemetryEvents, UIAuthoringServiceDefinition, UIAuthoringServiceFacade, type VerificationReport, type VerificationStep, type Workspace, authService, clearSession, createMonacoIdeService, createServiceB, createServiceC, createSrklAccountClient, createUIAuthoringService, createWorkspace, deleteWorkspace, exposeServiceD, fetchWorkspaces, krnlAuthClientServiceDefinition, krnlAuthClientServiceFacade, krnlCreateServiceB, krnlCreateServiceC, krnlExposeServiceD, krnlServiceADefinition, krnlServiceAFacade, krnlServiceBDefinition, krnlServiceBFacade, krnlServiceCDefinition, krnlServiceCFacade, krnlServiceDDefinition, krnlServiceDFacade, krnlStorageClientServiceDefinition, krnlStorageClientServiceFacade, krnlSystemDbClientServiceDefinition, krnlSystemDbClientServiceFacade, loadDatabase, loginAdmin, loginUser, mergeSrklAccounts, persistDatabase, register, restoreSession, setActiveWorkspace, setSession, storageService, systemDbService, updateWorkspace, verifyPassword };
628
+ export { AuthClientServiceDefinition, AuthClientServiceFacade, type AuthListener, AuthService, AuthServiceUISchema, CLEAN_DATABASE_CLUSTER, CommandVerificationProvider, type CounterState, DEFAULT_CONNECTIONS, type EcosystemServiceCategory, type GitHubFile, GitHubVcsProvider, type GitHubVcsProviderOptions, type IAuthStore, KLOKSServiceIndex, LocalExecutionProvider, type LocalExecutionRequest, type LocalExecutionResult, LocalWorkspaceProvider, type MathInput, MonacoIdeServiceDefinition, MonacoIdeServiceFacade, type ProtocolExposureHandle, STORAGE_KEY_CONNECTIONS, ServiceADefinition, ServiceAFacade, ServiceBDefinition, ServiceBFacade, ServiceCDefinition, ServiceCFacade, ServiceDDefinition, ServiceDFacade, type ServiceFacade, type ServiceIdentity, type ServiceMatch, type ServiceMatchClass, type ServiceMatchEvidence, type ServiceOperationIdentity, type SrklAccount, SrklAccountClient, type SrklAccountClientOptions, type SrklAccountManifest, type SrklAccountSyncResult, StorageClientServiceDefinition, StorageClientServiceFacade, StorageService, StorageServiceUISchema, SystemDbClientServiceDefinition, SystemDbClientServiceFacade, SystemDbService, SystemDbServiceUISchema, type SystemEnvironmentStatus, type SystemTelemetry, type TelemetryEvents, UIAuthoringServiceDefinition, UIAuthoringServiceFacade, type VerificationReport, type VerificationStep, type Workspace, authService, buildServiceIdentity, clearSession, compareServices, createMonacoIdeService, createServiceB, createServiceC, createSrklAccountClient, createUIAuthoringService, createWorkspace, deleteWorkspace, exposeServiceD, fetchWorkspaces, krnlAuthClientServiceDefinition, krnlAuthClientServiceFacade, krnlCreateServiceB, krnlCreateServiceC, krnlExposeServiceD, krnlServiceADefinition, krnlServiceAFacade, krnlServiceBDefinition, krnlServiceBFacade, krnlServiceCDefinition, krnlServiceCFacade, krnlServiceDDefinition, krnlServiceDFacade, krnlStorageClientServiceDefinition, krnlStorageClientServiceFacade, krnlSystemDbClientServiceDefinition, krnlSystemDbClientServiceFacade, loadDatabase, loginAdmin, loginUser, mergeSrklAccounts, persistDatabase, register, restoreSession, setActiveWorkspace, setSession, storageService, systemDbService, updateWorkspace, verifyPassword };
@@ -4,7 +4,7 @@ import "./chunk-QGM4M3NI.js";
4
4
  import { randomUUID } from "crypto";
5
5
  import http from "http";
6
6
 
7
- // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/define-api.js
7
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/define-api.js
8
8
  function defineApi(definition) {
9
9
  const properties = Object.fromEntries(definition.parameters.map((parameter) => [
10
10
  parameter.name,
@@ -25,7 +25,7 @@ function defineApi(definition) {
25
25
  });
26
26
  }
27
27
 
28
- // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/array-apis.js
28
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/array-apis.js
29
29
  var array = { type: "array" };
30
30
  var integer = { type: "integer" };
31
31
  var arrayApis = [
@@ -36,7 +36,7 @@ var arrayApis = [
36
36
  defineApi({ id: "gutts.arrays.last", name: "last", category: "arrays", description: "Returns the final element of an array, or undefined when the array is empty.", parameters: [{ name: "values", description: "The array whose final element should be returned.", required: true, schema: array }], output: { description: "The final array element, or undefined for an empty array." }, semantics: { deterministic: true, pure: true, sideEffects: false } })
37
37
  ];
38
38
 
39
- // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/json-apis.js
39
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/json-apis.js
40
40
  var json = { type: "object", description: "A JSON-compatible value." };
41
41
  var jsonApis = [
42
42
  defineApi({ id: "gutts.json.isJsonValue", name: "isJsonValue", category: "json", description: "Checks whether an unknown value can be represented as a finite JSON value.", parameters: [{ name: "value", description: "The value to validate as JSON-compatible data.", required: true, schema: {} }], output: { type: "boolean", description: "True when the value is a valid JSON value." }, semantics: { deterministic: true, pure: true, sideEffects: false } }),
@@ -45,7 +45,7 @@ var jsonApis = [
45
45
  defineApi({ id: "gutts.json.stringifyJson", name: "stringifyJson", category: "json", description: "Serializes a JSON-compatible value into JSON text, optionally using indentation.", parameters: [{ name: "value", description: "The JSON-compatible value to serialize.", required: true, schema: {} }, { name: "space", description: "Optional number of indentation spaces to use in the serialized output.", required: false, schema: { type: "number" } }], output: { type: "string", description: "The serialized JSON text." }, semantics: { deterministic: true, pure: true, sideEffects: false }, errors: ["Throws TypeError when the value cannot be serialized as JSON."] })
46
46
  ];
47
47
 
48
- // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/number-apis.js
48
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/number-apis.js
49
49
  var numberApis = [
50
50
  defineApi({ id: "gutts.numbers.clamp", name: "clamp", category: "numbers", description: "Restricts a numeric value to an inclusive minimum and maximum range.", parameters: [{ name: "value", description: "The numeric value to constrain.", required: true, schema: { type: "number" } }, { name: "min", description: "The inclusive lower bound.", required: true, schema: { type: "number" } }, { name: "max", description: "The inclusive upper bound.", required: true, schema: { type: "number" } }], output: { type: "number", description: "The value constrained to the inclusive range." }, semantics: { deterministic: true, pure: true, sideEffects: false }, errors: ["Throws RangeError when min exceeds max."] }),
51
51
  defineApi({ id: "gutts.numbers.inRange", name: "inRange", category: "numbers", description: "Checks whether a numeric value falls within the configured range.", parameters: [{ name: "value", description: "The numeric value to test.", required: true, schema: { type: "number" } }, { name: "min", description: "The lower range boundary.", required: true, schema: { type: "number" } }, { name: "max", description: "The upper range boundary.", required: true, schema: { type: "number" } }], output: { type: "boolean", description: "Whether the value is inside the range." }, semantics: { deterministic: true, pure: true, sideEffects: false }, errors: ["Throws RangeError when min exceeds max."] }),
@@ -54,7 +54,7 @@ var numberApis = [
54
54
  defineApi({ id: "gutts.numbers.sum", name: "sum", category: "numbers", description: "Adds all numbers in an array and returns their total.", parameters: [{ name: "values", description: "The numeric values to add.", required: true, schema: { type: "array", items: { type: "number" } } }], output: { type: "number", description: "The sum of all input numbers." }, semantics: { deterministic: true, pure: true, sideEffects: false } })
55
55
  ];
56
56
 
57
- // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/object-apis.js
57
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/object-apis.js
58
58
  var objectApis = [
59
59
  defineApi({ id: "gutts.objects.hasOwn", name: "hasOwn", category: "objects", description: "Checks whether an object contains a requested property.", parameters: [{ name: "value", description: "The object to inspect.", required: true, schema: { type: "object" } }, { name: "key", description: "The property key to look for.", required: true, schema: { type: "string" } }], output: { type: "boolean" }, semantics: { deterministic: true, pure: true, sideEffects: false } }),
60
60
  defineApi({ id: "gutts.objects.pick", name: "pick", category: "objects", description: "Creates an object containing only requested properties.", parameters: [{ name: "value", description: "The source object.", required: true, schema: { type: "object" } }, { name: "keys", description: "The property keys to retain.", required: true, schema: { type: "array", items: { type: "string" } } }], output: { type: "object" }, semantics: { deterministic: true, pure: true, sideEffects: false } }),
@@ -62,7 +62,7 @@ var objectApis = [
62
62
  defineApi({ id: "gutts.objects.isPlainObject", name: "isPlainObject", category: "objects", description: "Checks whether a value is a plain JavaScript object.", parameters: [{ name: "value", description: "The value to classify.", required: true, schema: {} }], output: { type: "boolean" }, semantics: { deterministic: true, pure: true, sideEffects: false } })
63
63
  ];
64
64
 
65
- // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/string-apis.js
65
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/string-apis.js
66
66
  var string = { type: "string" };
67
67
  var stringApis = [
68
68
  defineApi({ id: "gutts.strings.isBlank", name: "isBlank", category: "strings", description: "Checks whether a string contains no non-whitespace characters.", parameters: [{ name: "value", description: "The string to inspect.", required: true, schema: string }], output: { type: "boolean" }, semantics: { deterministic: true, pure: true, sideEffects: false } }),
@@ -78,7 +78,7 @@ var stringApis = [
78
78
  defineApi({ id: "gutts.strings.truncateWords", name: "truncateWords", category: "strings", description: "Shortens a string to a maximum number of words and appends a suffix when truncation is required.", parameters: [{ name: "value", description: "The string to shorten.", required: true, schema: string }, { name: "maxWords", description: "The non-negative maximum number of words.", required: true, schema: { type: "number" } }, { name: "suffix", description: "The suffix used when truncation occurs.", required: false, schema: string }], output: { type: "string" }, semantics: { deterministic: true, pure: true, sideEffects: false }, errors: ["Throws RangeError when maxWords is negative."] })
79
79
  ];
80
80
 
81
- // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/url-apis.js
81
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/url-apis.js
82
82
  var string2 = { type: "string" };
83
83
  var urlApis = [
84
84
  defineApi({ id: "gutts.urls.isUrl", name: "isUrl", category: "urls", description: "Checks whether a string can be parsed as a URL by the standard URL constructor.", parameters: [{ name: "value", description: "The string to validate.", required: true, schema: string2 }], output: { type: "boolean" }, semantics: { deterministic: true, pure: true, sideEffects: false } }),
@@ -87,7 +87,7 @@ var urlApis = [
87
87
  defineApi({ id: "gutts.urls.setQueryParam", name: "setQueryParam", category: "urls", description: "Returns a URL with one query-string parameter set to the supplied value.", parameters: [{ name: "url", description: "The URL to modify.", required: true, schema: string2 }, { name: "key", description: "The query parameter name.", required: true, schema: string2 }, { name: "value", description: "The query parameter value.", required: true, schema: string2 }], output: { type: "string" }, semantics: { deterministic: true, pure: true, sideEffects: false }, errors: ["Throws when url cannot be parsed as a URL."] })
88
88
  ];
89
89
 
90
- // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/needle3/index.js
90
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/needle3/index.js
91
91
  var needle3Metadata = {
92
92
  id: "model.cactus-needle3",
93
93
  name: "Needle 3",
@@ -118,12 +118,12 @@ var needle3CompleteApi = defineApi({
118
118
  semantics: { deterministic: false, pure: false, sideEffects: false }
119
119
  });
120
120
 
121
- // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/runtimes/ettin-head.js
121
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/runtimes/ettin-head.js
122
122
  import fs from "fs";
123
123
  import path from "path";
124
124
  import os from "os";
125
125
 
126
- // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/smollm2/index.js
126
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/smollm2/index.js
127
127
  var smolLM2Metadata = {
128
128
  id: "model.smollm2-135m-instruct",
129
129
  name: "SmolLM2-135M-Instruct",
@@ -155,7 +155,7 @@ var smolLM2GenerateApi = defineApi({
155
155
  errors: ["Model load failure", "Inference failure"]
156
156
  });
157
157
 
158
- // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/whistle/index.js
158
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/whistle/index.js
159
159
  var whistleMetadata = {
160
160
  id: "model.cactus-whistle",
161
161
  name: "Whistle",
@@ -185,7 +185,7 @@ var whistleTranscribeApi = defineApi({
185
185
  semantics: { deterministic: true, pure: false, sideEffects: false }
186
186
  });
187
187
 
188
- // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/ettin/index.js
188
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/ettin/index.js
189
189
  var defineEttin = (id2, name, parameters, description) => ({
190
190
  id: id2,
191
191
  name,
@@ -220,7 +220,7 @@ var ettinRerankApi = defineApi({
220
220
  semantics: { deterministic: true, pure: false, sideEffects: false }
221
221
  });
222
222
 
223
- // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/minilm/index.js
223
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/minilm/index.js
224
224
  var miniLML6Metadata = {
225
225
  id: "model.minilm-l6-v2",
226
226
  name: "MiniLM-L6-v2",
@@ -251,7 +251,7 @@ var miniLMSimilarityApi = defineApi({
251
251
  semantics: { deterministic: true, pure: false, sideEffects: false }
252
252
  });
253
253
 
254
- // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/api-registry.js
254
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/api-registry.js
255
255
  var guttsApiDefinitions = Object.freeze([
256
256
  ...arrayApis,
257
257
  ...jsonApis,
@@ -267,7 +267,7 @@ var guttsApiDefinitions = Object.freeze([
267
267
  ]);
268
268
  var guttsApiById = Object.freeze(Object.fromEntries(guttsApiDefinitions.map((api) => [api.id, api])));
269
269
 
270
- // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/fod-node-provider.js
270
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/fod-node-provider.js
271
271
  var schemaType = (schema) => String(schema?.type ?? "any");
272
272
  function guttsApiToFodNode(api) {
273
273
  return {
@@ -283,7 +283,7 @@ function guttsApiToFodNode(api) {
283
283
  }
284
284
  var guttsFodNodeDefinitions = Object.freeze(guttsApiDefinitions.map(guttsApiToFodNode));
285
285
 
286
- // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/model-registry.js
286
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/model-registry.js
287
287
  var guttsModelDefinitions = Object.freeze([
288
288
  smolLM2Metadata,
289
289
  needle3Metadata,
@@ -2178,13 +2178,13 @@ function buildMonacoIdeServiceDefinition(getService) {
2178
2178
  handler: async (input, ctx) => {
2179
2179
  const current = getService().getState().sessions[input.sessionId];
2180
2180
  if (!current) throw new Error(`Unknown Monaco session: ${input.sessionId}`);
2181
- const document = {
2181
+ const document2 = {
2182
2182
  ...current.document,
2183
2183
  value: input.value,
2184
2184
  language: input.language || current.document.language,
2185
2185
  version: current.document.version + 1
2186
2186
  };
2187
- const session = { ...current, document, updatedAt: Date.now() };
2187
+ const session = { ...current, document: document2, updatedAt: Date.now() };
2188
2188
  getService().setState({ ...getService().getState(), sessions: { ...getService().getState().sessions, [session.sessionId]: session } });
2189
2189
  return session;
2190
2190
  }
@@ -2913,6 +2913,81 @@ var CommandVerificationProvider = class {
2913
2913
  }
2914
2914
  };
2915
2915
 
2916
+ // src/serviceDiscovery.ts
2917
+ var STOP_WORDS = /* @__PURE__ */ new Set(["a", "an", "and", "api", "for", "of", "service", "the", "to", "with"]);
2918
+ var normalize = (value) => value.trim().toLowerCase().replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[^a-z0-9]+/g, " ").replace(/\s+/g, " ").trim();
2919
+ var tokens = (value) => new Set(normalize(value).split(" ").filter((token) => token && !STOP_WORDS.has(token)));
2920
+ var jaccard = (left, right) => {
2921
+ if (!left.size && !right.size) return 1;
2922
+ const intersection = [...left].filter((token) => right.has(token)).length;
2923
+ const union = (/* @__PURE__ */ new Set([...left, ...right])).size;
2924
+ return union ? intersection / union : 0;
2925
+ };
2926
+ var mapEqual = (left = {}, right = {}) => {
2927
+ const keys = Object.keys(left).sort();
2928
+ const other = Object.keys(right).sort();
2929
+ return keys.length === other.length && keys.every((key) => key === other[key] && left[key] === right[key]);
2930
+ };
2931
+ var operationSignature = (operation) => [normalize(operation.name), ...Object.entries(operation.inputs ?? {}).sort().map(([key, value]) => `in:${normalize(key)}:${normalize(value)}`), ...Object.entries(operation.outputs ?? {}).sort().map(([key, value]) => `out:${normalize(key)}:${normalize(value)}`)].join("|");
2932
+ var operationMatch = (left, right) => {
2933
+ if (normalize(left.name) !== normalize(right.name)) return 0;
2934
+ const inputs = mapEqual(left.inputs, right.inputs) ? 1 : jaccard(tokens(Object.keys(left.inputs ?? {}).join(" ")), tokens(Object.keys(right.inputs ?? {}).join(" ")));
2935
+ const outputs = mapEqual(left.outputs, right.outputs) ? 1 : jaccard(tokens(Object.keys(left.outputs ?? {}).join(" ")), tokens(Object.keys(right.outputs ?? {}).join(" ")));
2936
+ return (inputs + outputs) / 2;
2937
+ };
2938
+ var buildServiceIdentity = (service) => ({ ...service, id: normalize(service.id).replace(/ /g, "."), name: service.name.trim(), version: service.version.trim(), description: service.description.trim(), operations: [...service.operations].sort((a, b) => normalize(a.name).localeCompare(normalize(b.name))), capabilities: [...service.capabilities ?? []].map(normalize).sort() });
2939
+ var compareServices = (query, candidate) => {
2940
+ const left = buildServiceIdentity(query);
2941
+ const right = buildServiceIdentity(candidate);
2942
+ const evidence = [];
2943
+ const sameId = left.id === right.id;
2944
+ const leftOps = new Map(left.operations.map((operation) => [normalize(operation.name), operation]));
2945
+ const rightOps = new Map(right.operations.map((operation) => [normalize(operation.name), operation]));
2946
+ const shared = [...leftOps.keys()].filter((name) => rightOps.has(name));
2947
+ const operationScores = shared.map((name) => operationMatch(leftOps.get(name), rightOps.get(name)));
2948
+ const operationCoverage = Math.max(leftOps.size, rightOps.size) ? shared.length / Math.max(leftOps.size, rightOps.size) : 1;
2949
+ const candidateCoverage = rightOps.size ? shared.length / rightOps.size : 1;
2950
+ const operationCompatibility = operationScores.length ? operationScores.reduce((sum2, score) => sum2 + score, 0) / operationScores.length : 0;
2951
+ const textScore = jaccard(tokens(left.name), tokens(right.name)) * 0.55 + jaccard(tokens(left.description), tokens(right.description)) * 0.45;
2952
+ const capabilityScore = jaccard(new Set(left.capabilities ?? []), new Set(right.capabilities ?? []));
2953
+ const versionEqual = left.version === right.version;
2954
+ if (sameId) evidence.push({ kind: "identity", score: 1, detail: "Canonical service IDs match." });
2955
+ if (shared.length) evidence.push({ kind: "operations", score: operationCoverage, detail: `${shared.length}/${Math.max(leftOps.size, rightOps.size)} operation names overlap.` });
2956
+ if (operationCompatibility) evidence.push({ kind: "inputs", score: operationCompatibility, detail: "Shared operations have compatible input/output shapes." });
2957
+ if (capabilityScore) evidence.push({ kind: "text", score: capabilityScore, detail: "Capability sets overlap." });
2958
+ if (textScore) evidence.push({ kind: "text", score: textScore, detail: "Name and description are semantically related by normalized token overlap." });
2959
+ evidence.push({ kind: "version", score: versionEqual ? 1 : 0, detail: versionEqual ? "Versions match." : `Versions differ: ${left.version} vs ${right.version}.` });
2960
+ const exact = sameId && left.operations.length === right.operations.length && left.operations.every((operation) => operationSignature(operation) === operationSignature(rightOps.get(normalize(operation.name))));
2961
+ const compatible = !exact && candidateCoverage >= 0.75 && operationCompatibility >= 0.75;
2962
+ const similarity = Number(((sameId ? 1 : 0) * 0.35 + operationCoverage * 0.3 + operationCompatibility * 0.2 + textScore * 0.1 + capabilityScore * 0.05).toFixed(4));
2963
+ const matchClass = exact ? "exact" : compatible ? "compatible" : similarity >= 0.35 ? "related" : "none";
2964
+ return { candidate: right, similarity, matchClass, reuseRecommendation: matchClass === "exact" ? "reuse-exact" : matchClass === "compatible" ? "reuse-compatible" : matchClass === "related" ? "inspect-related" : "implement-new", evidence };
2965
+ };
2966
+ var KLOKSServiceIndex = class {
2967
+ services = /* @__PURE__ */ new Map();
2968
+ register(service) {
2969
+ const normalized = buildServiceIdentity(service);
2970
+ this.services.set(normalized.id, normalized);
2971
+ return normalized;
2972
+ }
2973
+ registerMany(services) {
2974
+ services.forEach((service) => this.register(service));
2975
+ }
2976
+ get(id2) {
2977
+ return this.services.get(normalize(id2).replace(/ /g, "."));
2978
+ }
2979
+ list() {
2980
+ return [...this.services.values()];
2981
+ }
2982
+ findMatches(query, minimumClass = "none") {
2983
+ const rank = { none: 0, related: 1, compatible: 2, exact: 3 };
2984
+ return this.list().map((candidate) => compareServices(query, candidate)).filter((match) => rank[match.matchClass] >= rank[minimumClass]).sort((a, b) => b.similarity - a.similarity);
2985
+ }
2986
+ recommendReuse(query) {
2987
+ return this.findMatches(query).find((match) => match.matchClass !== "none") ?? null;
2988
+ }
2989
+ };
2990
+
2916
2991
  // src/index.ts
2917
2992
  var ServiceADefinition = createServiceDefinition({
2918
2993
  id: "kloks.service.a",
@@ -3141,6 +3216,7 @@ export {
3141
3216
  CommandVerificationProvider,
3142
3217
  DEFAULT_CONNECTIONS,
3143
3218
  GitHubVcsProvider,
3219
+ KLOKSServiceIndex,
3144
3220
  LocalExecutionProvider,
3145
3221
  LocalWorkspaceProvider,
3146
3222
  MonacoIdeServiceDefinition,
@@ -3166,7 +3242,9 @@ export {
3166
3242
  UIAuthoringServiceDefinition,
3167
3243
  UIAuthoringServiceFacade,
3168
3244
  authService,
3245
+ buildServiceIdentity,
3169
3246
  clearSession,
3247
+ compareServices,
3170
3248
  createMonacoIdeService,
3171
3249
  createServiceB,
3172
3250
  createServiceC,
@@ -151,6 +151,25 @@
151
151
  "BackendFacade.services"
152
152
  ]
153
153
  }
154
+ },
155
+ {
156
+ "id": "kloks.serviceDiscovery",
157
+ "name": "KLOKS Service Discovery",
158
+ "version": "1.0.0",
159
+ "description": "Canonical machine-readable service identity, deterministic duplicate detection, semantic matching and reuse recommendations.",
160
+ "backend": {
161
+ "package": "@kloks/services",
162
+ "export": "KLOKSServiceIndex",
163
+ "facade": "KLOKSServiceIndex"
164
+ },
165
+ "modes": [
166
+ "backend"
167
+ ],
168
+ "targets": {
169
+ "backend": [
170
+ "BackendFacade.services"
171
+ ]
172
+ }
154
173
  }
155
174
  ]
156
175
  }