@ultrst-armada/kloks 1.21.0 → 1.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.krusbl-release-attestation.json +3 -3
- package/package.json +4 -4
- package/packages/audio-midi/dist/{audioClipEngine-BOT33JKI.js → audioClipEngine-E5ODQNYR.js} +3 -2
- package/packages/audio-midi/dist/{audioInputManager-BLDGGLAR.js → audioInputManager-OOH3TOJ6.js} +2 -1
- package/packages/audio-midi/dist/{chunk-N55BWOC6.js → chunk-2U7VIADS.js} +1 -1
- package/packages/audio-midi/dist/{chunk-3GRGELA4.js → chunk-3FXNT6PF.js} +2 -2
- package/packages/audio-midi/dist/chunk-QGM4M3NI.js +37 -0
- package/packages/audio-midi/dist/dist-XMSSRYDR.js +899 -0
- package/packages/audio-midi/dist/index.js +534 -75
- package/packages/audio-midi/dist/transformers.node-HWHOAE4H.js +43879 -0
- package/packages/audio-midi/package.json +1 -1
- package/packages/backend/dist/ai-inference/index.js +1 -0
- package/packages/backend/dist/ai-keys/index.d.ts +1 -0
- package/packages/backend/dist/ai-keys/index.js +2 -1
- package/packages/backend/dist/ai-models/index.js +3 -2
- package/packages/backend/dist/ai-provider/index.js +1 -0
- package/packages/backend/dist/ai-routing/index.js +4 -3
- package/packages/backend/dist/ai-tools/index.js +1 -0
- package/packages/backend/dist/api/index.js +1 -0
- package/packages/backend/dist/auth/index.js +1 -0
- package/packages/backend/dist/{chunk-RBF2OGMC.js → chunk-B3VJ4HDV.js} +4 -15
- package/packages/backend/dist/{chunk-OYVHKYJW.js → chunk-IJ5QNZCY.js} +1 -1
- package/packages/backend/dist/{chunk-4WUVDLIQ.js → chunk-LMWXONZG.js} +1 -1
- package/packages/backend/dist/chunk-MWSYNRNZ.js +871 -0
- package/packages/backend/dist/{chunk-4ONX56XS.js → chunk-NB2X3HEX.js} +26 -14
- package/packages/backend/dist/{chunk-RSKFM7AC.js → chunk-OB65KZ2M.js} +8 -5
- package/packages/backend/dist/{chunk-F7JDIU2C.js → chunk-P7H6TIEA.js} +3 -0
- package/packages/backend/dist/{chunk-UYXROZPP.js → chunk-PT6J6UEU.js} +2 -2
- package/packages/backend/dist/chunk-QGM4M3NI.js +37 -0
- package/packages/backend/dist/client/index.js +1 -0
- package/packages/backend/dist/connectivity/index.js +1 -0
- package/packages/backend/dist/control-plane/index.js +1 -0
- package/packages/backend/dist/development/index.js +3 -2
- package/packages/backend/dist/dist-XMSSRYDR.js +899 -0
- package/packages/backend/dist/index.js +77 -76
- package/packages/backend/dist/krnl-ai-services.d.ts +12 -2
- package/packages/backend/dist/krnl-ai-services.js +6 -5
- package/packages/backend/dist/krnl-services.d.ts +8 -0
- package/packages/backend/dist/krnl-services.js +7 -6
- package/packages/backend/dist/services/index.d.ts +2 -3
- package/packages/backend/dist/services/index.js +4 -3
- package/packages/backend/dist/srkl/index.js +1 -0
- package/packages/backend/dist/storage/index.js +8 -7
- package/packages/backend/dist/transformers.node-HWHOAE4H.js +43879 -0
- package/packages/backend/dist/workspace/index.js +3 -2
- package/packages/backend/package.json +5 -5
- package/packages/client/package.json +1 -1
- package/packages/contracts/package.json +1 -1
- package/packages/fod/dist/index.js +2 -2
- package/packages/fod/package.json +24 -13
- package/packages/functions/dist/chunk-QGM4M3NI.js +37 -0
- package/packages/functions/dist/dist-XMSSRYDR.js +899 -0
- package/packages/functions/dist/index.d.ts +2 -0
- package/packages/functions/dist/index.js +581 -94
- package/packages/functions/dist/transformers.node-HWHOAE4H.js +43879 -0
- package/packages/functions/package.json +1 -1
- package/packages/orchestrations/package.json +3 -3
- package/packages/services/dist/chunk-QGM4M3NI.js +37 -0
- package/packages/services/dist/dist-XMSSRYDR.js +899 -0
- package/packages/services/dist/index.d.ts +55 -8
- package/packages/services/dist/index.js +640 -85
- package/packages/services/dist/transformers.node-HWHOAE4H.js +43879 -0
- package/packages/services/package.json +1 -1
- package/packages/state-graph/dist/chunk-QGM4M3NI.js +37 -0
- package/packages/state-graph/dist/dist-XMSSRYDR.js +899 -0
- package/packages/state-graph/dist/domain/index.js +1 -0
- package/packages/state-graph/dist/index.js +602 -119
- package/packages/state-graph/dist/rules/index.js +1 -0
- package/packages/state-graph/dist/spatial/index.js +1 -0
- package/packages/state-graph/dist/state/index.js +1 -0
- package/packages/state-graph/dist/store/index.js +1 -0
- package/packages/state-graph/dist/transformers.node-HWHOAE4H.js +43879 -0
- package/packages/state-graph/package.json +1 -1
- package/packages/backend/dist/chunk-TY32TUNI.js +0 -376
- package/packages/backend/dist/{chunk-2XTHJI4I.js → chunk-6DNGLKAV.js} +3 -3
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
AudioClipEngine,
|
|
3
3
|
audioClipEngine,
|
|
4
4
|
generatePresetAudioBuffer
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-2U7VIADS.js";
|
|
6
6
|
import {
|
|
7
7
|
AudioContainerGraphNode,
|
|
8
8
|
AudioEffects,
|
|
@@ -35,9 +35,305 @@ import {
|
|
|
35
35
|
multiChannelOutputRouter,
|
|
36
36
|
playSyntheticDrumVoice,
|
|
37
37
|
synthEngine
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-3FXNT6PF.js";
|
|
39
|
+
import "./chunk-QGM4M3NI.js";
|
|
39
40
|
|
|
40
|
-
// ../../node_modules/.pnpm/@ultrst-armada+krnl@1.0.
|
|
41
|
+
// ../../node_modules/.pnpm/@ultrst-armada+krnl@1.0.9_@types+node@22.20.5/node_modules/@ultrst-armada/krnl/packages/core/dist/index.js
|
|
42
|
+
import { randomUUID } from "crypto";
|
|
43
|
+
|
|
44
|
+
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/define-api.js
|
|
45
|
+
function defineApi(definition) {
|
|
46
|
+
const properties = Object.fromEntries(definition.parameters.map((parameter) => [
|
|
47
|
+
parameter.name,
|
|
48
|
+
{
|
|
49
|
+
...parameter.schema,
|
|
50
|
+
description: parameter.description
|
|
51
|
+
}
|
|
52
|
+
]));
|
|
53
|
+
return Object.freeze({
|
|
54
|
+
...definition,
|
|
55
|
+
inputSchema: {
|
|
56
|
+
type: "object",
|
|
57
|
+
description: `Arguments for ${definition.name}.`,
|
|
58
|
+
properties,
|
|
59
|
+
required: definition.parameters.filter((parameter) => parameter.required).map((parameter) => parameter.name),
|
|
60
|
+
additionalProperties: false
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/array-apis.js
|
|
66
|
+
var array = { type: "array" };
|
|
67
|
+
var integer = { type: "integer" };
|
|
68
|
+
var arrayApis = [
|
|
69
|
+
defineApi({ id: "gutts.arrays.compact", name: "compact", category: "arrays", description: "Removes null and undefined values from an array while preserving the remaining values and their order.", parameters: [{ name: "values", description: "The array whose nullish elements should be removed.", required: true, schema: array }], output: { type: "array", description: "The array without null or undefined elements." }, semantics: { deterministic: true, pure: true, sideEffects: false } }),
|
|
70
|
+
defineApi({ id: "gutts.arrays.unique", name: "unique", category: "arrays", description: "Removes duplicate values from an array while preserving the first occurrence of each value.", parameters: [{ name: "values", description: "The array from which duplicate values should be removed.", required: true, schema: array }], output: { type: "array", description: "The array containing only the first occurrence of each value." }, semantics: { deterministic: true, pure: true, sideEffects: false } }),
|
|
71
|
+
defineApi({ id: "gutts.arrays.chunk", name: "chunk", category: "arrays", description: "Splits an array into consecutive subarrays of the requested maximum size.", parameters: [{ name: "values", description: "The array to split into chunks.", required: true, schema: array }, { name: "size", description: "The positive integer maximum number of elements in each chunk.", required: true, schema: integer }], output: { type: "array", items: array, description: "An array of consecutive subarrays." }, semantics: { deterministic: true, pure: true, sideEffects: false }, errors: ["Throws RangeError when size is not a positive integer."] }),
|
|
72
|
+
defineApi({ id: "gutts.arrays.flatten", name: "flatten", category: "arrays", description: "Flattens one level of nested arrays into a single array.", parameters: [{ name: "values", description: "The array containing values or one-level nested arrays.", required: true, schema: array }], output: { type: "array", description: "The flattened array." }, semantics: { deterministic: true, pure: true, sideEffects: false } }),
|
|
73
|
+
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 } })
|
|
74
|
+
];
|
|
75
|
+
|
|
76
|
+
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/json-apis.js
|
|
77
|
+
var json = { type: "object", description: "A JSON-compatible value." };
|
|
78
|
+
var jsonApis = [
|
|
79
|
+
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 } }),
|
|
80
|
+
defineApi({ id: "gutts.json.parseJson", name: "parseJson", category: "json", description: "Parses a JSON text string into a JSON-compatible value.", parameters: [{ name: "text", description: "The JSON document to parse.", required: true, schema: { type: "string" } }], output: json, semantics: { deterministic: true, pure: true, sideEffects: false }, errors: ["Throws SyntaxError when text is not valid JSON."] }),
|
|
81
|
+
defineApi({ id: "gutts.json.tryParseJson", name: "tryParseJson", category: "json", description: "Attempts to parse JSON text and returns undefined instead of throwing when parsing fails.", parameters: [{ name: "text", description: "The JSON document to parse.", required: true, schema: { type: "string" } }], output: { description: "The parsed JSON value, or undefined when parsing fails." }, semantics: { deterministic: true, pure: true, sideEffects: false } }),
|
|
82
|
+
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."] })
|
|
83
|
+
];
|
|
84
|
+
|
|
85
|
+
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/number-apis.js
|
|
86
|
+
var numberApis = [
|
|
87
|
+
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."] }),
|
|
88
|
+
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."] }),
|
|
89
|
+
defineApi({ id: "gutts.numbers.roundTo", name: "roundTo", category: "numbers", description: "Rounds a number to a specified non-negative number of decimal places.", parameters: [{ name: "value", description: "The number to round.", required: true, schema: { type: "number" } }, { name: "decimals", description: "The non-negative integer number of decimal places.", required: false, schema: { type: "integer" } }], output: { type: "number", description: "The rounded number." }, semantics: { deterministic: true, pure: true, sideEffects: false }, errors: ["Throws RangeError when decimals is negative or not an integer."] }),
|
|
90
|
+
defineApi({ id: "gutts.numbers.isFiniteNumber", name: "isFiniteNumber", category: "numbers", description: "Checks whether a value is a JavaScript number and is finite.", parameters: [{ name: "value", description: "The value to test.", required: true, schema: {} }], output: { type: "boolean", description: "True only for finite JavaScript numbers." }, semantics: { deterministic: true, pure: true, sideEffects: false } }),
|
|
91
|
+
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 } })
|
|
92
|
+
];
|
|
93
|
+
|
|
94
|
+
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/object-apis.js
|
|
95
|
+
var objectApis = [
|
|
96
|
+
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 } }),
|
|
97
|
+
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 } }),
|
|
98
|
+
defineApi({ id: "gutts.objects.omit", name: "omit", category: "objects", description: "Creates an object without requested properties.", parameters: [{ name: "value", description: "The source object.", required: true, schema: { type: "object" } }, { name: "keys", description: "The property keys to remove.", required: true, schema: { type: "array", items: { type: "string" } } }], output: { type: "object" }, semantics: { deterministic: true, pure: true, sideEffects: false } }),
|
|
99
|
+
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 } })
|
|
100
|
+
];
|
|
101
|
+
|
|
102
|
+
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/string-apis.js
|
|
103
|
+
var string = { type: "string" };
|
|
104
|
+
var stringApis = [
|
|
105
|
+
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 } }),
|
|
106
|
+
defineApi({ id: "gutts.strings.isNonBlank", name: "isNonBlank", category: "strings", description: "Checks whether a string contains at least one non-whitespace character.", parameters: [{ name: "value", description: "The string to inspect.", required: true, schema: string }], output: { type: "boolean" }, semantics: { deterministic: true, pure: true, sideEffects: false } }),
|
|
107
|
+
defineApi({ id: "gutts.strings.isEmail", name: "isEmail", category: "strings", description: "Checks whether a string conforms to the email-address validation rules used by GutTS.", parameters: [{ name: "value", description: "The string to validate as an email address.", required: true, schema: string }], output: { type: "boolean" }, semantics: { deterministic: true, pure: true, sideEffects: false } }),
|
|
108
|
+
defineApi({ id: "gutts.strings.startsWithAny", name: "startsWithAny", category: "strings", description: "Checks whether a string starts with at least one supplied prefix.", parameters: [{ name: "value", description: "The string to inspect.", required: true, schema: string }, { name: "prefixes", description: "The prefixes to test.", required: true, schema: { type: "array", items: string } }], output: { type: "boolean" }, semantics: { deterministic: true, pure: true, sideEffects: false } }),
|
|
109
|
+
defineApi({ id: "gutts.strings.endsWithAny", name: "endsWithAny", category: "strings", description: "Checks whether a string ends with at least one supplied suffix.", parameters: [{ name: "value", description: "The string to inspect.", required: true, schema: string }, { name: "suffixes", description: "The suffixes to test.", required: true, schema: { type: "array", items: string } }], output: { type: "boolean" }, semantics: { deterministic: true, pure: true, sideEffects: false } }),
|
|
110
|
+
defineApi({ id: "gutts.strings.capitalize", name: "capitalize", category: "strings", description: "Capitalizes a string using the library's existing capitalization behavior.", parameters: [{ name: "value", description: "The string to capitalize.", required: true, schema: string }], output: { type: "string" }, semantics: { deterministic: true, pure: true, sideEffects: false } }),
|
|
111
|
+
defineApi({ id: "gutts.strings.camelCase", name: "camelCase", category: "strings", description: "Converts a string into lower camel case.", parameters: [{ name: "value", description: "The string to convert.", required: true, schema: string }], output: { type: "string" }, semantics: { deterministic: true, pure: true, sideEffects: false } }),
|
|
112
|
+
defineApi({ id: "gutts.strings.kebabCase", name: "kebabCase", category: "strings", description: "Converts a string into lower kebab case.", parameters: [{ name: "value", description: "The string to convert.", required: true, schema: string }], output: { type: "string" }, semantics: { deterministic: true, pure: true, sideEffects: false } }),
|
|
113
|
+
defineApi({ id: "gutts.strings.snakeCase", name: "snakeCase", category: "strings", description: "Converts a string into lower snake case.", parameters: [{ name: "value", description: "The string to convert.", required: true, schema: string }], output: { type: "string" }, semantics: { deterministic: true, pure: true, sideEffects: false } }),
|
|
114
|
+
defineApi({ id: "gutts.strings.truncate", name: "truncate", category: "strings", description: "Shortens a string to a maximum length and appends a suffix when truncation is required.", parameters: [{ name: "value", description: "The string to shorten.", required: true, schema: string }, { name: "maxLength", description: "The non-negative maximum output length.", 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 maxLength is negative."] }),
|
|
115
|
+
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."] })
|
|
116
|
+
];
|
|
117
|
+
|
|
118
|
+
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/url-apis.js
|
|
119
|
+
var string2 = { type: "string" };
|
|
120
|
+
var urlApis = [
|
|
121
|
+
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 } }),
|
|
122
|
+
defineApi({ id: "gutts.urls.joinUrl", name: "joinUrl", category: "urls", description: "Joins a base URL-like string and path segments using single separators.", parameters: [{ name: "base", description: "The base URL or path.", required: true, schema: string2 }, { name: "parts", description: "The path segments to append.", required: true, schema: { type: "array", items: string2 } }], output: { type: "string" }, semantics: { deterministic: true, pure: true, sideEffects: false } }),
|
|
123
|
+
defineApi({ id: "gutts.urls.getQueryParam", name: "getQueryParam", category: "urls", description: "Reads one query-string parameter from a URL.", parameters: [{ name: "url", description: "The URL to inspect.", required: true, schema: string2 }, { name: "key", description: "The query parameter name.", required: true, schema: string2 }], output: { type: "string", description: "The value, or null when absent." }, semantics: { deterministic: true, pure: true, sideEffects: false } }),
|
|
124
|
+
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."] })
|
|
125
|
+
];
|
|
126
|
+
|
|
127
|
+
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/needle3/index.js
|
|
128
|
+
var needle3Metadata = {
|
|
129
|
+
id: "model.cactus-needle3",
|
|
130
|
+
name: "Needle 3",
|
|
131
|
+
provider: "Cactus Compute",
|
|
132
|
+
version: "3",
|
|
133
|
+
description: "Tiny structured inference model for tool selection, argument extraction, classification, and embeddings.",
|
|
134
|
+
examples: ["select a tool", "extract fields", "classify an intent"],
|
|
135
|
+
avoidWhen: "Avoid for open-ended long-form generation or complex multi-step reasoning.",
|
|
136
|
+
whenToUse: "Use when natural language must be mapped to a small tool set or structured schema.",
|
|
137
|
+
size: { min: 8, max: 29, unit: "MB", qualifier: "range" },
|
|
138
|
+
capabilities: ["tool-selection", "argument-extraction", "classification", "structured-output", "embeddings"],
|
|
139
|
+
input: "Natural-language text with optional tools or extraction schema",
|
|
140
|
+
output: "Structured JSON or embedding vector",
|
|
141
|
+
runtime: "Cactus Needle runtime adapter",
|
|
142
|
+
modelUri: "Cactus-Compute/needle3"
|
|
143
|
+
};
|
|
144
|
+
var needle3CompleteApi = defineApi({
|
|
145
|
+
id: "model.cactus-needle3.complete",
|
|
146
|
+
name: "Needle3.complete",
|
|
147
|
+
category: "models",
|
|
148
|
+
description: "Select tools or extract structured data from natural-language input.",
|
|
149
|
+
parameters: [
|
|
150
|
+
{ name: "prompt", description: "Natural-language input.", required: true, schema: { type: "string" } },
|
|
151
|
+
{ name: "tools", description: "Optional tool definitions.", required: false, schema: { type: "array" } },
|
|
152
|
+
{ name: "schema", description: "Optional extraction schema.", required: false, schema: { type: "object" } }
|
|
153
|
+
],
|
|
154
|
+
output: { type: "object", description: "Structured model result." },
|
|
155
|
+
semantics: { deterministic: false, pure: false, sideEffects: false }
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/runtimes/ettin-head.js
|
|
159
|
+
import fs from "fs";
|
|
160
|
+
import path from "path";
|
|
161
|
+
import os from "os";
|
|
162
|
+
|
|
163
|
+
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/smollm2/index.js
|
|
164
|
+
var smolLM2Metadata = {
|
|
165
|
+
id: "model.smollm2-135m-instruct",
|
|
166
|
+
name: "SmolLM2-135M-Instruct",
|
|
167
|
+
provider: "Hugging Face",
|
|
168
|
+
version: "135M",
|
|
169
|
+
description: "Compact instruction-tuned language model for general text generation.",
|
|
170
|
+
examples: ["summarize text", "rewrite text", "draft a short response"],
|
|
171
|
+
avoidWhen: "Avoid for high-stakes reasoning, broad factual knowledge, or tasks requiring large context.",
|
|
172
|
+
whenToUse: "Use for short general-purpose text generation when a local model is preferred.",
|
|
173
|
+
size: { value: 105, unit: "MB", qualifier: "artifact" },
|
|
174
|
+
capabilities: ["text-generation", "instruction-following"],
|
|
175
|
+
input: "Natural-language prompt",
|
|
176
|
+
output: "Generated natural-language text",
|
|
177
|
+
runtime: "ModelRuntime adapter",
|
|
178
|
+
modelUri: "HuggingFaceTB/SmolLM2-135M-Instruct",
|
|
179
|
+
license: "Apache-2.0"
|
|
180
|
+
};
|
|
181
|
+
var smolLM2GenerateApi = defineApi({
|
|
182
|
+
id: "model.smollm2-135m-instruct.generate",
|
|
183
|
+
name: "SmolLM2-135M-Instruct.generate",
|
|
184
|
+
category: "models",
|
|
185
|
+
description: "Generate natural-language text with SmolLM2-135M-Instruct.",
|
|
186
|
+
parameters: [
|
|
187
|
+
{ name: "prompt", description: "Prompt supplied to the model.", required: true, schema: { type: "string" } },
|
|
188
|
+
{ name: "maxNewTokens", description: "Maximum number of new tokens.", required: false, schema: { type: "number" } }
|
|
189
|
+
],
|
|
190
|
+
output: { type: "string", description: "Generated natural-language text." },
|
|
191
|
+
semantics: { deterministic: false, pure: false, sideEffects: false },
|
|
192
|
+
errors: ["Model load failure", "Inference failure"]
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/whistle/index.js
|
|
196
|
+
var whistleMetadata = {
|
|
197
|
+
id: "model.cactus-whistle",
|
|
198
|
+
name: "Whistle",
|
|
199
|
+
provider: "Cactus Compute",
|
|
200
|
+
version: "1",
|
|
201
|
+
description: "Compact CPU speech-recognition model for on-device transcription.",
|
|
202
|
+
examples: ["transcribe a voice note", "transcribe a command"],
|
|
203
|
+
avoidWhen: "Avoid when audio understanding beyond transcription is required.",
|
|
204
|
+
whenToUse: "Use for local speech-to-text when low resource use and privacy matter.",
|
|
205
|
+
size: { value: 16.9, unit: "MB", qualifier: "artifact" },
|
|
206
|
+
capabilities: ["speech-to-text", "on-device", "cpu"],
|
|
207
|
+
input: "Audio bytes",
|
|
208
|
+
output: "Transcribed natural-language text",
|
|
209
|
+
runtime: "Cactus Needle runtime adapter",
|
|
210
|
+
modelUri: "Cactus-Compute/whistle"
|
|
211
|
+
};
|
|
212
|
+
var whistleTranscribeApi = defineApi({
|
|
213
|
+
id: "model.cactus-whistle.transcribe",
|
|
214
|
+
name: "Whistle.transcribe",
|
|
215
|
+
category: "models",
|
|
216
|
+
description: "Transcribe speech audio into natural-language text.",
|
|
217
|
+
parameters: [
|
|
218
|
+
{ name: "audio", description: "Audio bytes supplied to the speech model.", required: true, schema: { type: "string" } },
|
|
219
|
+
{ name: "language", description: "Optional language identifier.", required: false, schema: { type: "string" } }
|
|
220
|
+
],
|
|
221
|
+
output: { type: "string", description: "Transcribed text." },
|
|
222
|
+
semantics: { deterministic: true, pure: false, sideEffects: false }
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/ettin/index.js
|
|
226
|
+
var defineEttin = (id2, name, parameters, description) => ({
|
|
227
|
+
id: id2,
|
|
228
|
+
name,
|
|
229
|
+
provider: "Hugging Face",
|
|
230
|
+
version: String(parameters),
|
|
231
|
+
description,
|
|
232
|
+
examples: ["rank search results", "order retrieved documents by relevance"],
|
|
233
|
+
whenToUse: "Use for cross-encoder reranking when candidate texts must be sorted by semantic relevance.",
|
|
234
|
+
avoidWhen: "Avoid for text generation, embeddings, or transcription.",
|
|
235
|
+
size: { value: parameters * 1e6, unit: "parameters", qualifier: "parameters" },
|
|
236
|
+
capabilities: ["reranking", "relevance-scoring"],
|
|
237
|
+
input: "Query and candidate texts",
|
|
238
|
+
output: "Candidate relevance scores",
|
|
239
|
+
runtime: "ModelRuntime adapter",
|
|
240
|
+
modelUri: `cross-encoder/ettin-reranker-${parameters}m-v1`,
|
|
241
|
+
license: "Apache-2.0"
|
|
242
|
+
});
|
|
243
|
+
var ettinReranker17MMetadata = defineEttin("model.ettin-reranker-17m", "Ettin-Reranker-17M", 17, "Very small relevance model for ranking candidate text.");
|
|
244
|
+
var ettinReranker32MMetadata = defineEttin("model.ettin-reranker-32m", "Ettin-Reranker-32M", 32, "Small relevance model for ranking candidate text.");
|
|
245
|
+
var ettinReranker68MMetadata = defineEttin("model.ettin-reranker-68m", "Ettin-Reranker-68M", 68, "Compact relevance model for higher-quality candidate ranking.");
|
|
246
|
+
var ettinReranker150MMetadata = defineEttin("model.ettin-reranker-150m", "Ettin-Reranker-150M", 150, "Larger compact relevance model for candidate ranking.");
|
|
247
|
+
var ettinRerankApi = defineApi({
|
|
248
|
+
id: "model.ettin-reranker.rerank",
|
|
249
|
+
name: "EttinReranker.rerank",
|
|
250
|
+
category: "models",
|
|
251
|
+
description: "Rank candidate texts by relevance to a query.",
|
|
252
|
+
parameters: [
|
|
253
|
+
{ name: "query", description: "Query text.", required: true, schema: { type: "string" } },
|
|
254
|
+
{ name: "candidates", description: "Candidate texts to rank.", required: true, schema: { type: "array", items: { type: "string" } } }
|
|
255
|
+
],
|
|
256
|
+
output: { type: "array", description: "Relevance scores in candidate order.", items: { type: "number" } },
|
|
257
|
+
semantics: { deterministic: true, pure: false, sideEffects: false }
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/minilm/index.js
|
|
261
|
+
var miniLML6Metadata = {
|
|
262
|
+
id: "model.minilm-l6-v2",
|
|
263
|
+
name: "MiniLM-L6-v2",
|
|
264
|
+
provider: "Sentence Transformers",
|
|
265
|
+
version: "L6-v2",
|
|
266
|
+
description: "Compact sentence embedding model for semantic similarity.",
|
|
267
|
+
examples: ["compare two texts", "match a query to a short description"],
|
|
268
|
+
avoidWhen: "Avoid when generation, extraction, or tool calling is required.",
|
|
269
|
+
whenToUse: "Use for lightweight semantic similarity and embedding-based matching.",
|
|
270
|
+
size: { value: 227e5, unit: "parameters", qualifier: "parameters" },
|
|
271
|
+
capabilities: ["embeddings", "semantic-similarity"],
|
|
272
|
+
input: "Two text strings",
|
|
273
|
+
output: "Similarity score",
|
|
274
|
+
runtime: "ModelRuntime adapter",
|
|
275
|
+
modelUri: "sentence-transformers/all-MiniLM-L6-v2",
|
|
276
|
+
license: "Apache-2.0"
|
|
277
|
+
};
|
|
278
|
+
var miniLMSimilarityApi = defineApi({
|
|
279
|
+
id: "model.minilm-l6-v2.similarity",
|
|
280
|
+
name: "MiniLM-L6-v2.similarity",
|
|
281
|
+
category: "models",
|
|
282
|
+
description: "Compute semantic similarity between two texts.",
|
|
283
|
+
parameters: [
|
|
284
|
+
{ name: "left", description: "First text.", required: true, schema: { type: "string" } },
|
|
285
|
+
{ name: "right", description: "Second text.", required: true, schema: { type: "string" } }
|
|
286
|
+
],
|
|
287
|
+
output: { type: "number", description: "Semantic similarity score." },
|
|
288
|
+
semantics: { deterministic: true, pure: false, sideEffects: false }
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/api-registry.js
|
|
292
|
+
var guttsApiDefinitions = Object.freeze([
|
|
293
|
+
...arrayApis,
|
|
294
|
+
...jsonApis,
|
|
295
|
+
...numberApis,
|
|
296
|
+
...objectApis,
|
|
297
|
+
...stringApis,
|
|
298
|
+
...urlApis,
|
|
299
|
+
smolLM2GenerateApi,
|
|
300
|
+
needle3CompleteApi,
|
|
301
|
+
whistleTranscribeApi,
|
|
302
|
+
ettinRerankApi,
|
|
303
|
+
miniLMSimilarityApi
|
|
304
|
+
]);
|
|
305
|
+
var guttsApiById = Object.freeze(Object.fromEntries(guttsApiDefinitions.map((api) => [api.id, api])));
|
|
306
|
+
|
|
307
|
+
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/fod-node-provider.js
|
|
308
|
+
var schemaType = (schema) => String(schema?.type ?? "any");
|
|
309
|
+
function guttsApiToFodNode(api) {
|
|
310
|
+
return {
|
|
311
|
+
type: `gutts/${api.id}`,
|
|
312
|
+
label: api.name,
|
|
313
|
+
description: api.description,
|
|
314
|
+
category: "gutts",
|
|
315
|
+
group: api.category,
|
|
316
|
+
inputs: api.parameters.map((parameter) => ({ id: parameter.name, name: parameter.name, direction: "input", dataType: schemaType(parameter.schema), required: parameter.required, description: parameter.description, schema: parameter.schema })),
|
|
317
|
+
outputs: [{ id: "result", name: "result", direction: "output", dataType: schemaType(api.output), ...api.output.description ? { description: api.output.description } : {}, schema: api.output }],
|
|
318
|
+
metadata: { apiId: api.id, package: "@dinilmusick/gutts", semantics: api.semantics }
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
var guttsFodNodeDefinitions = Object.freeze(guttsApiDefinitions.map(guttsApiToFodNode));
|
|
322
|
+
|
|
323
|
+
// ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/model-registry.js
|
|
324
|
+
var guttsModelDefinitions = Object.freeze([
|
|
325
|
+
smolLM2Metadata,
|
|
326
|
+
needle3Metadata,
|
|
327
|
+
whistleMetadata,
|
|
328
|
+
ettinReranker17MMetadata,
|
|
329
|
+
ettinReranker32MMetadata,
|
|
330
|
+
ettinReranker68MMetadata,
|
|
331
|
+
ettinReranker150MMetadata,
|
|
332
|
+
miniLML6Metadata
|
|
333
|
+
]);
|
|
334
|
+
var guttsModelById = Object.freeze(Object.fromEntries(guttsModelDefinitions.map((model) => [model.id, model])));
|
|
335
|
+
|
|
336
|
+
// ../../node_modules/.pnpm/@ultrst-armada+krnl@1.0.9_@types+node@22.20.5/node_modules/@ultrst-armada/krnl/packages/core/dist/index.js
|
|
41
337
|
var ServiceStateStore = class {
|
|
42
338
|
state;
|
|
43
339
|
listeners = /* @__PURE__ */ new Set();
|
|
@@ -64,33 +360,6 @@ var ServiceStateStore = class {
|
|
|
64
360
|
this.state = { ...newState || {} };
|
|
65
361
|
}
|
|
66
362
|
};
|
|
67
|
-
var ServiceEventBus = class {
|
|
68
|
-
handlers = /* @__PURE__ */ new Map();
|
|
69
|
-
on(event, handler) {
|
|
70
|
-
if (!this.handlers.has(event)) {
|
|
71
|
-
this.handlers.set(event, /* @__PURE__ */ new Set());
|
|
72
|
-
}
|
|
73
|
-
const set = this.handlers.get(event);
|
|
74
|
-
set.add(handler);
|
|
75
|
-
return () => {
|
|
76
|
-
set.delete(handler);
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
emit(event, payload) {
|
|
80
|
-
const set = this.handlers.get(event);
|
|
81
|
-
if (!set) return;
|
|
82
|
-
for (const handler of Array.from(set)) {
|
|
83
|
-
try {
|
|
84
|
-
handler(payload);
|
|
85
|
-
} catch (err) {
|
|
86
|
-
console.error(`[ServiceEventBus] Handler error for '${event}':`, err);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
clear() {
|
|
91
|
-
this.handlers.clear();
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
363
|
var TRANSITIONS = {
|
|
95
364
|
uninitialized: ["initializing"],
|
|
96
365
|
initializing: ["ready", "uninitialized"],
|
|
@@ -125,14 +394,228 @@ var LifecycleManager = class {
|
|
|
125
394
|
}
|
|
126
395
|
}
|
|
127
396
|
};
|
|
397
|
+
var runtimeProcess = typeof globalThis !== "undefined" ? globalThis.process : void 0;
|
|
398
|
+
var runtimePerformance = typeof globalThis !== "undefined" ? globalThis.performance : void 0;
|
|
399
|
+
function telemetryNow() {
|
|
400
|
+
return runtimePerformance?.now ? runtimePerformance.now() : Date.now();
|
|
401
|
+
}
|
|
402
|
+
function sampleResources() {
|
|
403
|
+
const memory = runtimeProcess?.memoryUsage?.();
|
|
404
|
+
const cpu = runtimeProcess?.cpuUsage?.();
|
|
405
|
+
const eventLoop = runtimePerformance?.eventLoopUtilization?.();
|
|
406
|
+
return {
|
|
407
|
+
cpuUserMicros: cpu?.user,
|
|
408
|
+
cpuSystemMicros: cpu?.system,
|
|
409
|
+
heapUsedBytes: memory?.heapUsed,
|
|
410
|
+
heapTotalBytes: memory?.heapTotal,
|
|
411
|
+
rssBytes: memory?.rss,
|
|
412
|
+
externalBytes: memory?.external,
|
|
413
|
+
arrayBuffersBytes: memory?.arrayBuffers,
|
|
414
|
+
eventLoopUtilization: eventLoop?.utilization,
|
|
415
|
+
scope: memory || cpu || eventLoop ? "process" : "runtime"
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
function deltaResources(start, end) {
|
|
419
|
+
const delta = (a, b) => a === void 0 || b === void 0 ? void 0 : b - a;
|
|
420
|
+
return {
|
|
421
|
+
cpuUserMicros: delta(start.cpuUserMicros, end.cpuUserMicros),
|
|
422
|
+
cpuSystemMicros: delta(start.cpuSystemMicros, end.cpuSystemMicros),
|
|
423
|
+
heapUsedBytes: delta(start.heapUsedBytes, end.heapUsedBytes),
|
|
424
|
+
heapTotalBytes: delta(start.heapTotalBytes, end.heapTotalBytes),
|
|
425
|
+
rssBytes: delta(start.rssBytes, end.rssBytes),
|
|
426
|
+
externalBytes: delta(start.externalBytes, end.externalBytes),
|
|
427
|
+
arrayBuffersBytes: delta(start.arrayBuffersBytes, end.arrayBuffersBytes),
|
|
428
|
+
eventLoopUtilization: delta(start.eventLoopUtilization, end.eventLoopUtilization),
|
|
429
|
+
scope: start.scope
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
var id = (prefix) => `${prefix}_${randomUUID()}`;
|
|
433
|
+
function percentiles(values) {
|
|
434
|
+
if (!values.length) return { min: 0, mean: 0, p50: 0, p90: 0, p95: 0, p99: 0, max: 0 };
|
|
435
|
+
const sorted = [...values].sort((a, b) => a - b);
|
|
436
|
+
const pick2 = (p) => sorted[Math.min(sorted.length - 1, Math.floor((sorted.length - 1) * p))];
|
|
437
|
+
return {
|
|
438
|
+
min: sorted[0],
|
|
439
|
+
mean: sorted.reduce((sum2, value) => sum2 + value, 0) / sorted.length,
|
|
440
|
+
p50: pick2(0.5),
|
|
441
|
+
p90: pick2(0.9),
|
|
442
|
+
p95: pick2(0.95),
|
|
443
|
+
p99: pick2(0.99),
|
|
444
|
+
max: sorted[sorted.length - 1]
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
var TelemetryController = class {
|
|
448
|
+
constructor(serviceId, options = {}) {
|
|
449
|
+
this.serviceId = serviceId;
|
|
450
|
+
this.mode = options.mode ?? "off";
|
|
451
|
+
this.maxSamples = Math.max(1, options.maxSamples ?? 2048);
|
|
452
|
+
this.maxRecentInvocations = Math.max(1, options.maxRecentInvocations ?? 100);
|
|
453
|
+
}
|
|
454
|
+
serviceId;
|
|
455
|
+
mode;
|
|
456
|
+
maxSamples;
|
|
457
|
+
maxRecentInvocations;
|
|
458
|
+
samples = [];
|
|
459
|
+
active = /* @__PURE__ */ new Map();
|
|
460
|
+
totalInvocationCount = 0;
|
|
461
|
+
totalSuccessCount = 0;
|
|
462
|
+
totalErrorCount = 0;
|
|
463
|
+
lastInvocationAt;
|
|
464
|
+
enable(mode = "standard") {
|
|
465
|
+
this.mode = mode;
|
|
466
|
+
}
|
|
467
|
+
disable() {
|
|
468
|
+
this.mode = "off";
|
|
469
|
+
this.active.clear();
|
|
470
|
+
}
|
|
471
|
+
setMode(mode) {
|
|
472
|
+
this.mode = mode;
|
|
473
|
+
if (mode === "off") this.active.clear();
|
|
474
|
+
}
|
|
475
|
+
getMode() {
|
|
476
|
+
return this.mode;
|
|
477
|
+
}
|
|
478
|
+
status() {
|
|
479
|
+
return {
|
|
480
|
+
enabled: this.mode !== "off",
|
|
481
|
+
mode: this.mode,
|
|
482
|
+
serviceId: this.serviceId,
|
|
483
|
+
invocationCount: this.totalInvocationCount,
|
|
484
|
+
activeInvocations: this.active.size,
|
|
485
|
+
lastInvocationAt: this.lastInvocationAt
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
begin(target, kind, correlationId, parentSpanId) {
|
|
489
|
+
if (this.mode === "off") {
|
|
490
|
+
return {
|
|
491
|
+
invocationId: "",
|
|
492
|
+
traceId: "",
|
|
493
|
+
spanId: "",
|
|
494
|
+
parentSpanId,
|
|
495
|
+
end: () => void 0
|
|
496
|
+
};
|
|
497
|
+
}
|
|
498
|
+
const invocationId = id("inv");
|
|
499
|
+
const spanId = id("span");
|
|
500
|
+
const traceId = parentSpanId ? this.findTraceId(parentSpanId) ?? id("trace") : id("trace");
|
|
501
|
+
const active = {
|
|
502
|
+
invocationId,
|
|
503
|
+
traceId,
|
|
504
|
+
spanId,
|
|
505
|
+
parentSpanId,
|
|
506
|
+
serviceId: this.serviceId,
|
|
507
|
+
target,
|
|
508
|
+
kind,
|
|
509
|
+
correlationId,
|
|
510
|
+
startedAt: telemetryNow(),
|
|
511
|
+
resourcesStart: this.mode === "standard" ? void 0 : sampleResources()
|
|
512
|
+
};
|
|
513
|
+
this.active.set(invocationId, active);
|
|
514
|
+
return {
|
|
515
|
+
invocationId,
|
|
516
|
+
traceId,
|
|
517
|
+
spanId,
|
|
518
|
+
parentSpanId,
|
|
519
|
+
end: (error) => this.finish(active, error)
|
|
520
|
+
};
|
|
521
|
+
}
|
|
522
|
+
reset() {
|
|
523
|
+
this.samples.length = 0;
|
|
524
|
+
this.active.clear();
|
|
525
|
+
this.totalInvocationCount = 0;
|
|
526
|
+
this.totalSuccessCount = 0;
|
|
527
|
+
this.totalErrorCount = 0;
|
|
528
|
+
this.lastInvocationAt = void 0;
|
|
529
|
+
}
|
|
530
|
+
snapshot() {
|
|
531
|
+
const invocations = this.samples.slice();
|
|
532
|
+
const durations = invocations.map((item) => item.durationMs);
|
|
533
|
+
const targetMap = /* @__PURE__ */ new Map();
|
|
534
|
+
for (const invocation of invocations) {
|
|
535
|
+
const key = `${invocation.kind}:${invocation.target}`;
|
|
536
|
+
const group = targetMap.get(key) ?? [];
|
|
537
|
+
group.push(invocation);
|
|
538
|
+
targetMap.set(key, group);
|
|
539
|
+
}
|
|
540
|
+
const targets = [...targetMap.values()].map((group) => ({
|
|
541
|
+
target: group[0].target,
|
|
542
|
+
kind: group[0].kind,
|
|
543
|
+
count: group.length,
|
|
544
|
+
successCount: group.filter((item) => item.status === "completed").length,
|
|
545
|
+
errorCount: group.filter((item) => item.status === "failed").length,
|
|
546
|
+
durationMs: percentiles(group.map((item) => item.durationMs)),
|
|
547
|
+
lastInvocationAt: group[group.length - 1]?.completedAt
|
|
548
|
+
}));
|
|
549
|
+
return {
|
|
550
|
+
serviceId: this.serviceId,
|
|
551
|
+
mode: this.mode,
|
|
552
|
+
capturedAt: Date.now(),
|
|
553
|
+
status: this.status(),
|
|
554
|
+
totals: {
|
|
555
|
+
invocationCount: this.totalInvocationCount,
|
|
556
|
+
successCount: this.totalSuccessCount,
|
|
557
|
+
errorCount: this.totalErrorCount,
|
|
558
|
+
durationMs: percentiles(durations)
|
|
559
|
+
},
|
|
560
|
+
targets,
|
|
561
|
+
activeInvocations: this.active.size,
|
|
562
|
+
recentInvocations: invocations.slice(-this.maxRecentInvocations)
|
|
563
|
+
};
|
|
564
|
+
}
|
|
565
|
+
functionality(name) {
|
|
566
|
+
return this.snapshot().targets.find((target) => target.kind === "functionality" && target.target === name);
|
|
567
|
+
}
|
|
568
|
+
functionalities() {
|
|
569
|
+
return this.snapshot().targets.filter((target) => target.kind === "functionality");
|
|
570
|
+
}
|
|
571
|
+
findTraceId(parentSpanId) {
|
|
572
|
+
for (let index = this.samples.length - 1; index >= 0; index -= 1) {
|
|
573
|
+
if (this.samples[index].spanId === parentSpanId) return this.samples[index].traceId;
|
|
574
|
+
}
|
|
575
|
+
for (const active of this.active.values()) {
|
|
576
|
+
if (active.spanId === parentSpanId) return active.traceId;
|
|
577
|
+
}
|
|
578
|
+
return void 0;
|
|
579
|
+
}
|
|
580
|
+
finish(active, error) {
|
|
581
|
+
if (!this.active.delete(active.invocationId)) return;
|
|
582
|
+
const completedAt = telemetryNow();
|
|
583
|
+
const resourcesEnd = this.mode === "standard" ? void 0 : sampleResources();
|
|
584
|
+
const invocation = {
|
|
585
|
+
invocationId: active.invocationId,
|
|
586
|
+
traceId: active.traceId,
|
|
587
|
+
spanId: active.spanId,
|
|
588
|
+
parentSpanId: active.parentSpanId,
|
|
589
|
+
serviceId: active.serviceId,
|
|
590
|
+
target: active.target,
|
|
591
|
+
kind: active.kind,
|
|
592
|
+
correlationId: active.correlationId,
|
|
593
|
+
startedAt: active.startedAt,
|
|
594
|
+
completedAt,
|
|
595
|
+
durationMs: Math.max(0, completedAt - active.startedAt),
|
|
596
|
+
status: error === void 0 ? "completed" : "failed",
|
|
597
|
+
error: error === void 0 ? void 0 : {
|
|
598
|
+
name: error instanceof Error ? error.name : "Error",
|
|
599
|
+
message: error instanceof Error ? error.message : String(error)
|
|
600
|
+
},
|
|
601
|
+
resources: active.resourcesStart && resourcesEnd ? { start: active.resourcesStart, end: resourcesEnd, delta: deltaResources(active.resourcesStart, resourcesEnd) } : void 0
|
|
602
|
+
};
|
|
603
|
+
this.samples.push(invocation);
|
|
604
|
+
this.totalInvocationCount += 1;
|
|
605
|
+
if (invocation.status === "completed") this.totalSuccessCount += 1;
|
|
606
|
+
else this.totalErrorCount += 1;
|
|
607
|
+
if (this.samples.length > this.maxSamples) this.samples.splice(0, this.samples.length - this.maxSamples);
|
|
608
|
+
this.lastInvocationAt = Date.now();
|
|
609
|
+
}
|
|
610
|
+
};
|
|
128
611
|
var ServiceInstance = class {
|
|
129
612
|
constructor(definition) {
|
|
130
613
|
this.definition = definition;
|
|
131
614
|
this.id = definition.id;
|
|
132
615
|
this.name = definition.name;
|
|
133
616
|
this.version = definition.version;
|
|
617
|
+
this.telemetry = new TelemetryController(this.id);
|
|
134
618
|
this.lifecycle = new LifecycleManager();
|
|
135
|
-
this.eventBus = new ServiceEventBus();
|
|
136
619
|
if (definition.state) {
|
|
137
620
|
this.stateStore = new ServiceStateStore(definition.state.initial);
|
|
138
621
|
}
|
|
@@ -141,8 +624,8 @@ var ServiceInstance = class {
|
|
|
141
624
|
id;
|
|
142
625
|
name;
|
|
143
626
|
version;
|
|
627
|
+
telemetry;
|
|
144
628
|
stateStore;
|
|
145
|
-
eventBus;
|
|
146
629
|
lifecycle;
|
|
147
630
|
initialized = false;
|
|
148
631
|
disposed = false;
|
|
@@ -206,7 +689,19 @@ var ServiceInstance = class {
|
|
|
206
689
|
if (!operation) {
|
|
207
690
|
throw new Error("[Service:" + this.name + "] Operation '" + op + "' not found.");
|
|
208
691
|
}
|
|
209
|
-
|
|
692
|
+
if (ctx.metadata?.__krnlTelemetryInternal === true) {
|
|
693
|
+
return await operation.handler(input, ctx);
|
|
694
|
+
}
|
|
695
|
+
const parentSpanId = typeof ctx.metadata?.__krnlTelemetryParentSpanId === "string" ? ctx.metadata.__krnlTelemetryParentSpanId : void 0;
|
|
696
|
+
const handle = this.telemetry.begin(op, "service", ctx.correlationId, parentSpanId);
|
|
697
|
+
try {
|
|
698
|
+
const output = await operation.handler(input, ctx);
|
|
699
|
+
handle.end();
|
|
700
|
+
return output;
|
|
701
|
+
} catch (error) {
|
|
702
|
+
handle.end(error);
|
|
703
|
+
throw error;
|
|
704
|
+
}
|
|
210
705
|
}
|
|
211
706
|
getState() {
|
|
212
707
|
return this.stateStore?.getState() ?? Object.freeze({});
|
|
@@ -218,12 +713,6 @@ var ServiceInstance = class {
|
|
|
218
713
|
}
|
|
219
714
|
this.stateStore.setState(mutation);
|
|
220
715
|
}
|
|
221
|
-
on(event, handler) {
|
|
222
|
-
return this.eventBus.on(event, handler);
|
|
223
|
-
}
|
|
224
|
-
emit(event, payload) {
|
|
225
|
-
this.eventBus.emit(event, payload);
|
|
226
|
-
}
|
|
227
716
|
};
|
|
228
717
|
function assertRecord(value, field) {
|
|
229
718
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
@@ -257,12 +746,6 @@ function validateServiceDefinition(definition) {
|
|
|
257
746
|
throw new Error("[Service:" + definition.name + "] Operation '" + key + "' must define a handler.");
|
|
258
747
|
}
|
|
259
748
|
}
|
|
260
|
-
for (const [key, event] of Object.entries(definition.events ?? {})) {
|
|
261
|
-
if (!event || typeof event !== "object") {
|
|
262
|
-
throw new Error("[Service:" + definition.name + "] Invalid event '" + key + "'.");
|
|
263
|
-
}
|
|
264
|
-
assertNonEmptyString(event.name, "events." + key + ".name");
|
|
265
|
-
}
|
|
266
749
|
for (const [key, schema] of Object.entries(definition.inputs ?? {})) assertRecord(schema, "inputs." + key);
|
|
267
750
|
for (const [key, schema] of Object.entries(definition.outputs ?? {})) assertRecord(schema, "outputs." + key);
|
|
268
751
|
if (definition.state?.schema !== void 0) assertRecord(definition.state.schema, "state.schema");
|
|
@@ -2142,17 +2625,17 @@ var OscManager = class {
|
|
|
2142
2625
|
this.notifyDeviceListeners();
|
|
2143
2626
|
return newDevice;
|
|
2144
2627
|
}
|
|
2145
|
-
updateDevice(
|
|
2146
|
-
this.devices = this.devices.map((dev) => dev.id ===
|
|
2628
|
+
updateDevice(id2, updates) {
|
|
2629
|
+
this.devices = this.devices.map((dev) => dev.id === id2 ? { ...dev, ...updates } : dev);
|
|
2147
2630
|
this.notifyDeviceListeners();
|
|
2148
2631
|
}
|
|
2149
|
-
removeDevice(
|
|
2150
|
-
this.devices = this.devices.filter((dev) => dev.id !==
|
|
2632
|
+
removeDevice(id2) {
|
|
2633
|
+
this.devices = this.devices.filter((dev) => dev.id !== id2);
|
|
2151
2634
|
this.notifyDeviceListeners();
|
|
2152
2635
|
}
|
|
2153
|
-
toggleDevice(
|
|
2636
|
+
toggleDevice(id2) {
|
|
2154
2637
|
this.devices = this.devices.map(
|
|
2155
|
-
(dev) => dev.id ===
|
|
2638
|
+
(dev) => dev.id === id2 ? {
|
|
2156
2639
|
...dev,
|
|
2157
2640
|
enabled: !dev.enabled,
|
|
2158
2641
|
status: !dev.enabled ? "listening" : "disconnected"
|
|
@@ -2413,18 +2896,11 @@ function createAudioHardwareService(manager = new AudioInputManager()) {
|
|
|
2413
2896
|
...manager.getState()
|
|
2414
2897
|
}
|
|
2415
2898
|
},
|
|
2416
|
-
events: {
|
|
2417
|
-
stateChange: {
|
|
2418
|
-
name: "stateChange",
|
|
2419
|
-
description: "Emitted when audio hardware devices or context state change"
|
|
2420
|
-
}
|
|
2421
|
-
},
|
|
2422
2899
|
lifecycle: {
|
|
2423
2900
|
onInit: () => {
|
|
2424
2901
|
manager.subscribe((nextState) => {
|
|
2425
2902
|
if (svcRef) {
|
|
2426
2903
|
svcRef.setState({ ...nextState });
|
|
2427
|
-
svcRef.emit("stateChange", nextState);
|
|
2428
2904
|
}
|
|
2429
2905
|
});
|
|
2430
2906
|
},
|
|
@@ -2516,25 +2992,11 @@ function createMidiService(manager = new MidiManager()) {
|
|
|
2516
2992
|
...manager.getState()
|
|
2517
2993
|
}
|
|
2518
2994
|
},
|
|
2519
|
-
events: {
|
|
2520
|
-
midiEvent: {
|
|
2521
|
-
name: "midiEvent",
|
|
2522
|
-
description: "Hardware or virtual MIDI event stream"
|
|
2523
|
-
},
|
|
2524
|
-
stateChange: {
|
|
2525
|
-
name: "stateChange",
|
|
2526
|
-
description: "MIDI port connection state change"
|
|
2527
|
-
}
|
|
2528
|
-
},
|
|
2529
2995
|
lifecycle: {
|
|
2530
2996
|
onInit: () => {
|
|
2531
|
-
manager.subscribeEvents((ev) => {
|
|
2532
|
-
if (svcRef) svcRef.emit("midiEvent", ev);
|
|
2533
|
-
});
|
|
2534
2997
|
manager.subscribeState((st) => {
|
|
2535
2998
|
if (svcRef) {
|
|
2536
2999
|
svcRef.setState({ ...st });
|
|
2537
|
-
svcRef.emit("stateChange", st);
|
|
2538
3000
|
}
|
|
2539
3001
|
});
|
|
2540
3002
|
},
|
|
@@ -2564,9 +3026,6 @@ function createMidiService(manager = new MidiManager()) {
|
|
|
2564
3026
|
const cmd = payload.command || payload.midiCommand || "NOTE_ON";
|
|
2565
3027
|
manager.emitVirtualMidi({ ...payload, command: cmd });
|
|
2566
3028
|
unsub();
|
|
2567
|
-
if (captured && svcRef) {
|
|
2568
|
-
svcRef.emit("midiEvent", captured);
|
|
2569
|
-
}
|
|
2570
3029
|
return { midiEvent: captured, success: true };
|
|
2571
3030
|
}
|
|
2572
3031
|
},
|