@ultrst-armada/kloks 1.24.4 → 1.24.8
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.
- package/.krusbl-release-attestation.json +3 -3
- package/README.md +11 -0
- package/package.json +15 -12
- package/packages/audio-midi/dist/index.js +16 -16
- package/packages/backend/dist/ai-inference/index.js +0 -1
- package/packages/backend/dist/ai-keys/index.js +0 -1
- package/packages/backend/dist/ai-models/index.js +0 -1
- package/packages/backend/dist/ai-provider/index.js +0 -1
- package/packages/backend/dist/ai-routing/index.js +0 -1
- package/packages/backend/dist/ai-tools/index.js +0 -1
- package/packages/backend/dist/api/index.js +0 -1
- package/packages/backend/dist/auth/index.d.ts +5 -74
- package/packages/backend/dist/auth/index.js +16 -19
- package/packages/backend/dist/{chunk-2OPIDIIB.js → chunk-3VWBZEMG.js} +26 -2
- package/packages/backend/dist/{chunk-AHJ2EWQW.js → chunk-6D55GT3L.js} +9 -28
- package/packages/backend/dist/chunk-ED32WV3T.js +75 -0
- package/packages/backend/dist/chunk-EO5VUYYU.js +20 -0
- package/packages/backend/dist/{chunk-B3VJ4HDV.js → chunk-JOTDEFRG.js} +1 -1
- package/packages/backend/dist/{chunk-OB65KZ2M.js → chunk-M45KQRPR.js} +1 -1
- package/packages/backend/dist/chunk-SXDYW3QA.js +579 -0
- package/packages/backend/dist/client/index.js +0 -1
- package/packages/backend/dist/connectivity/index.js +0 -1
- package/packages/backend/dist/control-plane/index.d.ts +3 -3
- package/packages/backend/dist/control-plane/index.js +0 -1
- package/packages/backend/dist/development/client.d.ts +20 -6
- package/packages/backend/dist/development/client.js +42 -28
- package/packages/backend/dist/development/index.d.ts +20 -6
- package/packages/backend/dist/development/index.js +652 -30
- package/packages/backend/dist/development/playwrightInspectionService.js +2 -3
- package/packages/backend/dist/development/playwrightInspectionTypes.d.ts +1 -0
- package/packages/backend/dist/index.d.ts +3 -57
- package/packages/backend/dist/index.js +44 -188
- package/packages/backend/dist/krnl-ai-services.js +2 -3
- package/packages/backend/dist/krnl-services.js +6 -7
- package/packages/backend/dist/services/index.js +4 -5
- package/packages/backend/dist/srkl/index.js +1 -2
- package/packages/backend/dist/storage/index.js +0 -1
- package/packages/backend/dist/workspace/index.js +0 -1
- package/packages/backend/package.json +3 -10
- package/packages/client/dist/index.d.ts +2 -0
- package/packages/client/dist/index.js +29 -1
- package/packages/client/package.json +2 -1
- package/packages/fod/dist/index.d.ts +11 -1
- package/packages/fod/dist/index.js +2 -0
- package/packages/fod/package.json +2 -3
- package/packages/functions/dist/index.js +16 -16
- package/packages/functions/package.json +2 -1
- package/packages/services/dist/index.d.ts +46 -1
- package/packages/services/dist/index.js +96 -18
- package/packages/services/kloks.manifest.json +19 -0
- package/packages/state-graph/dist/index.js +25 -25
- package/packages/backend/dist/BaseAccountProvider-DduKf5HG.d.ts +0 -66
- package/packages/backend/dist/chunk-2HCQ2SIR.js +0 -213
- package/packages/backend/dist/chunk-A3BE6ROS.js +0 -180
- package/packages/backend/dist/chunk-FJ5LZFBV.js +0 -667
- package/packages/backend/dist/chunk-MWSYNRNZ.js +0 -871
- package/packages/backend/dist/chunk-QGM4M3NI.js +0 -37
- package/packages/backend/dist/dist-XMSSRYDR.js +0 -899
- package/packages/backend/dist/transformers.node-HWHOAE4H.js +0 -43879
- package/packages/backend/dist/{chunk-IGZB4RYT.js → chunk-R6ZNF6FW.js} +3 -3
|
@@ -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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
|
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
|
}
|
|
@@ -7,15 +7,6 @@ import {
|
|
|
7
7
|
instantiateSubgraph
|
|
8
8
|
} from "./chunk-S22PMERU.js";
|
|
9
9
|
import "./chunk-RHRXPY2U.js";
|
|
10
|
-
import {
|
|
11
|
-
LifecycleCycleError,
|
|
12
|
-
LifecycleGraph,
|
|
13
|
-
SKIPO_STATE,
|
|
14
|
-
SkipoStateEngine,
|
|
15
|
-
useLifecycleScope,
|
|
16
|
-
useSkipoBind,
|
|
17
|
-
useSkipoState
|
|
18
|
-
} from "./chunk-EW4ACSZB.js";
|
|
19
10
|
import {
|
|
20
11
|
AttractionEngine,
|
|
21
12
|
GhostInferenceEngine,
|
|
@@ -31,6 +22,15 @@ import {
|
|
|
31
22
|
WireTypeRegistry,
|
|
32
23
|
initializeDefaultGraphRules
|
|
33
24
|
} from "./chunk-TZOL3RN7.js";
|
|
25
|
+
import {
|
|
26
|
+
LifecycleCycleError,
|
|
27
|
+
LifecycleGraph,
|
|
28
|
+
SKIPO_STATE,
|
|
29
|
+
SkipoStateEngine,
|
|
30
|
+
useLifecycleScope,
|
|
31
|
+
useSkipoBind,
|
|
32
|
+
useSkipoState
|
|
33
|
+
} from "./chunk-EW4ACSZB.js";
|
|
34
34
|
import {
|
|
35
35
|
CommandApi,
|
|
36
36
|
GhostStore,
|
|
@@ -63,7 +63,7 @@ import "./chunk-QGM4M3NI.js";
|
|
|
63
63
|
// ../../node_modules/.pnpm/@ultrst-armada+krnl@1.0.9_@types+node@22.20.5/node_modules/@ultrst-armada/krnl/packages/core/dist/index.js
|
|
64
64
|
import { randomUUID } from "crypto";
|
|
65
65
|
|
|
66
|
-
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.
|
|
66
|
+
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/define-api.js
|
|
67
67
|
function defineApi(definition) {
|
|
68
68
|
const properties = Object.fromEntries(definition.parameters.map((parameter) => [
|
|
69
69
|
parameter.name,
|
|
@@ -84,7 +84,7 @@ function defineApi(definition) {
|
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.
|
|
87
|
+
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/array-apis.js
|
|
88
88
|
var array = { type: "array" };
|
|
89
89
|
var integer = { type: "integer" };
|
|
90
90
|
var arrayApis = [
|
|
@@ -95,7 +95,7 @@ var arrayApis = [
|
|
|
95
95
|
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 } })
|
|
96
96
|
];
|
|
97
97
|
|
|
98
|
-
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.
|
|
98
|
+
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/json-apis.js
|
|
99
99
|
var json = { type: "object", description: "A JSON-compatible value." };
|
|
100
100
|
var jsonApis = [
|
|
101
101
|
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 } }),
|
|
@@ -104,7 +104,7 @@ var jsonApis = [
|
|
|
104
104
|
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."] })
|
|
105
105
|
];
|
|
106
106
|
|
|
107
|
-
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.
|
|
107
|
+
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/number-apis.js
|
|
108
108
|
var numberApis = [
|
|
109
109
|
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."] }),
|
|
110
110
|
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."] }),
|
|
@@ -113,7 +113,7 @@ var numberApis = [
|
|
|
113
113
|
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 } })
|
|
114
114
|
];
|
|
115
115
|
|
|
116
|
-
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.
|
|
116
|
+
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/object-apis.js
|
|
117
117
|
var objectApis = [
|
|
118
118
|
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 } }),
|
|
119
119
|
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 } }),
|
|
@@ -121,7 +121,7 @@ var objectApis = [
|
|
|
121
121
|
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 } })
|
|
122
122
|
];
|
|
123
123
|
|
|
124
|
-
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.
|
|
124
|
+
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/string-apis.js
|
|
125
125
|
var string = { type: "string" };
|
|
126
126
|
var stringApis = [
|
|
127
127
|
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 } }),
|
|
@@ -137,7 +137,7 @@ var stringApis = [
|
|
|
137
137
|
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."] })
|
|
138
138
|
];
|
|
139
139
|
|
|
140
|
-
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.
|
|
140
|
+
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/url-apis.js
|
|
141
141
|
var string2 = { type: "string" };
|
|
142
142
|
var urlApis = [
|
|
143
143
|
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 } }),
|
|
@@ -146,7 +146,7 @@ var urlApis = [
|
|
|
146
146
|
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."] })
|
|
147
147
|
];
|
|
148
148
|
|
|
149
|
-
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.
|
|
149
|
+
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/needle3/index.js
|
|
150
150
|
var needle3Metadata = {
|
|
151
151
|
id: "model.cactus-needle3",
|
|
152
152
|
name: "Needle 3",
|
|
@@ -177,12 +177,12 @@ var needle3CompleteApi = defineApi({
|
|
|
177
177
|
semantics: { deterministic: false, pure: false, sideEffects: false }
|
|
178
178
|
});
|
|
179
179
|
|
|
180
|
-
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.
|
|
180
|
+
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/runtimes/ettin-head.js
|
|
181
181
|
import fs from "fs";
|
|
182
182
|
import path from "path";
|
|
183
183
|
import os from "os";
|
|
184
184
|
|
|
185
|
-
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.
|
|
185
|
+
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/smollm2/index.js
|
|
186
186
|
var smolLM2Metadata = {
|
|
187
187
|
id: "model.smollm2-135m-instruct",
|
|
188
188
|
name: "SmolLM2-135M-Instruct",
|
|
@@ -214,7 +214,7 @@ var smolLM2GenerateApi = defineApi({
|
|
|
214
214
|
errors: ["Model load failure", "Inference failure"]
|
|
215
215
|
});
|
|
216
216
|
|
|
217
|
-
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.
|
|
217
|
+
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/whistle/index.js
|
|
218
218
|
var whistleMetadata = {
|
|
219
219
|
id: "model.cactus-whistle",
|
|
220
220
|
name: "Whistle",
|
|
@@ -244,7 +244,7 @@ var whistleTranscribeApi = defineApi({
|
|
|
244
244
|
semantics: { deterministic: true, pure: false, sideEffects: false }
|
|
245
245
|
});
|
|
246
246
|
|
|
247
|
-
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.
|
|
247
|
+
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/ettin/index.js
|
|
248
248
|
var defineEttin = (id2, name, parameters, description) => ({
|
|
249
249
|
id: id2,
|
|
250
250
|
name,
|
|
@@ -279,7 +279,7 @@ var ettinRerankApi = defineApi({
|
|
|
279
279
|
semantics: { deterministic: true, pure: false, sideEffects: false }
|
|
280
280
|
});
|
|
281
281
|
|
|
282
|
-
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.
|
|
282
|
+
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/minilm/index.js
|
|
283
283
|
var miniLML6Metadata = {
|
|
284
284
|
id: "model.minilm-l6-v2",
|
|
285
285
|
name: "MiniLM-L6-v2",
|
|
@@ -310,7 +310,7 @@ var miniLMSimilarityApi = defineApi({
|
|
|
310
310
|
semantics: { deterministic: true, pure: false, sideEffects: false }
|
|
311
311
|
});
|
|
312
312
|
|
|
313
|
-
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.
|
|
313
|
+
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/api-registry.js
|
|
314
314
|
var guttsApiDefinitions = Object.freeze([
|
|
315
315
|
...arrayApis,
|
|
316
316
|
...jsonApis,
|
|
@@ -326,7 +326,7 @@ var guttsApiDefinitions = Object.freeze([
|
|
|
326
326
|
]);
|
|
327
327
|
var guttsApiById = Object.freeze(Object.fromEntries(guttsApiDefinitions.map((api) => [api.id, api])));
|
|
328
328
|
|
|
329
|
-
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.
|
|
329
|
+
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/fod-node-provider.js
|
|
330
330
|
var schemaType = (schema) => String(schema?.type ?? "any");
|
|
331
331
|
function guttsApiToFodNode(api) {
|
|
332
332
|
return {
|
|
@@ -342,7 +342,7 @@ function guttsApiToFodNode(api) {
|
|
|
342
342
|
}
|
|
343
343
|
var guttsFodNodeDefinitions = Object.freeze(guttsApiDefinitions.map(guttsApiToFodNode));
|
|
344
344
|
|
|
345
|
-
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.
|
|
345
|
+
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.4.3_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/model-registry.js
|
|
346
346
|
var guttsModelDefinitions = Object.freeze([
|
|
347
347
|
smolLM2Metadata,
|
|
348
348
|
needle3Metadata,
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { SkipoBase } from '@ultrst-armada/kloks/functions';
|
|
2
|
-
|
|
3
|
-
type UserRole = 'user' | 'admin';
|
|
4
|
-
interface User {
|
|
5
|
-
id: string;
|
|
6
|
-
email: string;
|
|
7
|
-
passwordHash: string;
|
|
8
|
-
role: UserRole;
|
|
9
|
-
displayName?: string;
|
|
10
|
-
createdAt: number;
|
|
11
|
-
updatedAt: number;
|
|
12
|
-
}
|
|
13
|
-
interface AuthCredentials {
|
|
14
|
-
email: string;
|
|
15
|
-
password: string;
|
|
16
|
-
}
|
|
17
|
-
interface AuthSession {
|
|
18
|
-
token: string;
|
|
19
|
-
userId: string;
|
|
20
|
-
role: UserRole;
|
|
21
|
-
expiresAt: number;
|
|
22
|
-
}
|
|
23
|
-
interface SignupInput {
|
|
24
|
-
email: string;
|
|
25
|
-
password: string;
|
|
26
|
-
displayName?: string;
|
|
27
|
-
}
|
|
28
|
-
interface CreateUserData {
|
|
29
|
-
email: string;
|
|
30
|
-
passwordHash: string;
|
|
31
|
-
role: UserRole;
|
|
32
|
-
displayName?: string;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
declare class SessionManager {
|
|
36
|
-
private ttl;
|
|
37
|
-
constructor(ttlMs?: number);
|
|
38
|
-
generateToken(userId: string): string;
|
|
39
|
-
createSession(userId: string, role: UserRole): AuthSession;
|
|
40
|
-
isValid(session: AuthSession): boolean;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
declare class RateLimiter {
|
|
44
|
-
private attempts;
|
|
45
|
-
private windowMs;
|
|
46
|
-
private maxUser;
|
|
47
|
-
private maxAdmin;
|
|
48
|
-
constructor(windowMs?: number, maxUser?: number, maxAdmin?: number);
|
|
49
|
-
check(identifier: string, isAdminAttempt?: boolean): void;
|
|
50
|
-
reset(identifier: string): void;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
declare abstract class BaseAccountProvider extends SkipoBase {
|
|
54
|
-
protected rateLimiter: RateLimiter;
|
|
55
|
-
protected sessionManager: SessionManager;
|
|
56
|
-
abstract findUserByEmail(email: string): Promise<User | null>;
|
|
57
|
-
abstract findUserById(id: string): Promise<User | null>;
|
|
58
|
-
abstract createUser(data: CreateUserData): Promise<User>;
|
|
59
|
-
abstract updateUser(id: string, data: Partial<User>): Promise<User>;
|
|
60
|
-
abstract listUsers(): Promise<User[]>;
|
|
61
|
-
authenticate(credentials: AuthCredentials): Promise<AuthSession>;
|
|
62
|
-
signup(input: SignupInput): Promise<User>;
|
|
63
|
-
verifySession(token: string | null): Promise<AuthSession | null>;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export { type AuthCredentials as A, BaseAccountProvider as B, type CreateUserData as C, RateLimiter as R, SessionManager as S, type User as U, type AuthSession as a, type SignupInput as b, type UserRole as c };
|