@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.
Files changed (75) hide show
  1. package/.krusbl-release-attestation.json +3 -3
  2. package/package.json +4 -4
  3. package/packages/audio-midi/dist/{audioClipEngine-BOT33JKI.js → audioClipEngine-E5ODQNYR.js} +3 -2
  4. package/packages/audio-midi/dist/{audioInputManager-BLDGGLAR.js → audioInputManager-OOH3TOJ6.js} +2 -1
  5. package/packages/audio-midi/dist/{chunk-N55BWOC6.js → chunk-2U7VIADS.js} +1 -1
  6. package/packages/audio-midi/dist/{chunk-3GRGELA4.js → chunk-3FXNT6PF.js} +2 -2
  7. package/packages/audio-midi/dist/chunk-QGM4M3NI.js +37 -0
  8. package/packages/audio-midi/dist/dist-XMSSRYDR.js +899 -0
  9. package/packages/audio-midi/dist/index.js +534 -75
  10. package/packages/audio-midi/dist/transformers.node-HWHOAE4H.js +43879 -0
  11. package/packages/audio-midi/package.json +1 -1
  12. package/packages/backend/dist/ai-inference/index.js +1 -0
  13. package/packages/backend/dist/ai-keys/index.d.ts +1 -0
  14. package/packages/backend/dist/ai-keys/index.js +2 -1
  15. package/packages/backend/dist/ai-models/index.js +3 -2
  16. package/packages/backend/dist/ai-provider/index.js +1 -0
  17. package/packages/backend/dist/ai-routing/index.js +4 -3
  18. package/packages/backend/dist/ai-tools/index.js +1 -0
  19. package/packages/backend/dist/api/index.js +1 -0
  20. package/packages/backend/dist/auth/index.js +1 -0
  21. package/packages/backend/dist/{chunk-RBF2OGMC.js → chunk-B3VJ4HDV.js} +4 -15
  22. package/packages/backend/dist/{chunk-OYVHKYJW.js → chunk-IJ5QNZCY.js} +1 -1
  23. package/packages/backend/dist/{chunk-4WUVDLIQ.js → chunk-LMWXONZG.js} +1 -1
  24. package/packages/backend/dist/chunk-MWSYNRNZ.js +871 -0
  25. package/packages/backend/dist/{chunk-4ONX56XS.js → chunk-NB2X3HEX.js} +26 -14
  26. package/packages/backend/dist/{chunk-RSKFM7AC.js → chunk-OB65KZ2M.js} +8 -5
  27. package/packages/backend/dist/{chunk-F7JDIU2C.js → chunk-P7H6TIEA.js} +3 -0
  28. package/packages/backend/dist/{chunk-UYXROZPP.js → chunk-PT6J6UEU.js} +2 -2
  29. package/packages/backend/dist/chunk-QGM4M3NI.js +37 -0
  30. package/packages/backend/dist/client/index.js +1 -0
  31. package/packages/backend/dist/connectivity/index.js +1 -0
  32. package/packages/backend/dist/control-plane/index.js +1 -0
  33. package/packages/backend/dist/development/index.js +3 -2
  34. package/packages/backend/dist/dist-XMSSRYDR.js +899 -0
  35. package/packages/backend/dist/index.js +77 -76
  36. package/packages/backend/dist/krnl-ai-services.d.ts +12 -2
  37. package/packages/backend/dist/krnl-ai-services.js +6 -5
  38. package/packages/backend/dist/krnl-services.d.ts +8 -0
  39. package/packages/backend/dist/krnl-services.js +7 -6
  40. package/packages/backend/dist/services/index.d.ts +2 -3
  41. package/packages/backend/dist/services/index.js +4 -3
  42. package/packages/backend/dist/srkl/index.js +1 -0
  43. package/packages/backend/dist/storage/index.js +8 -7
  44. package/packages/backend/dist/transformers.node-HWHOAE4H.js +43879 -0
  45. package/packages/backend/dist/workspace/index.js +3 -2
  46. package/packages/backend/package.json +5 -5
  47. package/packages/client/package.json +1 -1
  48. package/packages/contracts/package.json +1 -1
  49. package/packages/fod/dist/index.js +2 -2
  50. package/packages/fod/package.json +24 -13
  51. package/packages/functions/dist/chunk-QGM4M3NI.js +37 -0
  52. package/packages/functions/dist/dist-XMSSRYDR.js +899 -0
  53. package/packages/functions/dist/index.d.ts +2 -0
  54. package/packages/functions/dist/index.js +581 -94
  55. package/packages/functions/dist/transformers.node-HWHOAE4H.js +43879 -0
  56. package/packages/functions/package.json +1 -1
  57. package/packages/orchestrations/package.json +3 -3
  58. package/packages/services/dist/chunk-QGM4M3NI.js +37 -0
  59. package/packages/services/dist/dist-XMSSRYDR.js +899 -0
  60. package/packages/services/dist/index.d.ts +55 -8
  61. package/packages/services/dist/index.js +640 -85
  62. package/packages/services/dist/transformers.node-HWHOAE4H.js +43879 -0
  63. package/packages/services/package.json +1 -1
  64. package/packages/state-graph/dist/chunk-QGM4M3NI.js +37 -0
  65. package/packages/state-graph/dist/dist-XMSSRYDR.js +899 -0
  66. package/packages/state-graph/dist/domain/index.js +1 -0
  67. package/packages/state-graph/dist/index.js +602 -119
  68. package/packages/state-graph/dist/rules/index.js +1 -0
  69. package/packages/state-graph/dist/spatial/index.js +1 -0
  70. package/packages/state-graph/dist/state/index.js +1 -0
  71. package/packages/state-graph/dist/store/index.js +1 -0
  72. package/packages/state-graph/dist/transformers.node-HWHOAE4H.js +43879 -0
  73. package/packages/state-graph/package.json +1 -1
  74. package/packages/backend/dist/chunk-TY32TUNI.js +0 -376
  75. package/packages/backend/dist/{chunk-2XTHJI4I.js → chunk-6DNGLKAV.js} +3 -3
@@ -7,6 +7,15 @@ 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";
10
19
  import {
11
20
  AttractionEngine,
12
21
  GhostInferenceEngine,
@@ -22,15 +31,6 @@ import {
22
31
  WireTypeRegistry,
23
32
  initializeDefaultGraphRules
24
33
  } 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,
@@ -58,8 +58,304 @@ import {
58
58
  import {
59
59
  CompatibilityMatrix
60
60
  } from "./chunk-ISFNY7EZ.js";
61
+ import "./chunk-QGM4M3NI.js";
62
+
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
+ import { randomUUID } from "crypto";
65
+
66
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/define-api.js
67
+ function defineApi(definition) {
68
+ const properties = Object.fromEntries(definition.parameters.map((parameter) => [
69
+ parameter.name,
70
+ {
71
+ ...parameter.schema,
72
+ description: parameter.description
73
+ }
74
+ ]));
75
+ return Object.freeze({
76
+ ...definition,
77
+ inputSchema: {
78
+ type: "object",
79
+ description: `Arguments for ${definition.name}.`,
80
+ properties,
81
+ required: definition.parameters.filter((parameter) => parameter.required).map((parameter) => parameter.name),
82
+ additionalProperties: false
83
+ }
84
+ });
85
+ }
86
+
87
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/array-apis.js
88
+ var array = { type: "array" };
89
+ var integer = { type: "integer" };
90
+ var arrayApis = [
91
+ 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 } }),
92
+ 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 } }),
93
+ 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."] }),
94
+ 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 } }),
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
+ ];
97
+
98
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/json-apis.js
99
+ var json = { type: "object", description: "A JSON-compatible value." };
100
+ var jsonApis = [
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 } }),
102
+ 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."] }),
103
+ 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 } }),
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
+ ];
106
+
107
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/number-apis.js
108
+ var numberApis = [
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
+ 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."] }),
111
+ 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."] }),
112
+ 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 } }),
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
+ ];
115
+
116
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/object-apis.js
117
+ var objectApis = [
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
+ 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 } }),
120
+ 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 } }),
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
+ ];
123
+
124
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/string-apis.js
125
+ var string = { type: "string" };
126
+ var stringApis = [
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 } }),
128
+ 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 } }),
129
+ 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 } }),
130
+ 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 } }),
131
+ 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 } }),
132
+ 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 } }),
133
+ 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 } }),
134
+ 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 } }),
135
+ 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 } }),
136
+ 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."] }),
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
+ ];
139
+
140
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/url-apis.js
141
+ var string2 = { type: "string" };
142
+ var urlApis = [
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 } }),
144
+ 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 } }),
145
+ 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 } }),
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
+ ];
148
+
149
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/needle3/index.js
150
+ var needle3Metadata = {
151
+ id: "model.cactus-needle3",
152
+ name: "Needle 3",
153
+ provider: "Cactus Compute",
154
+ version: "3",
155
+ description: "Tiny structured inference model for tool selection, argument extraction, classification, and embeddings.",
156
+ examples: ["select a tool", "extract fields", "classify an intent"],
157
+ avoidWhen: "Avoid for open-ended long-form generation or complex multi-step reasoning.",
158
+ whenToUse: "Use when natural language must be mapped to a small tool set or structured schema.",
159
+ size: { min: 8, max: 29, unit: "MB", qualifier: "range" },
160
+ capabilities: ["tool-selection", "argument-extraction", "classification", "structured-output", "embeddings"],
161
+ input: "Natural-language text with optional tools or extraction schema",
162
+ output: "Structured JSON or embedding vector",
163
+ runtime: "Cactus Needle runtime adapter",
164
+ modelUri: "Cactus-Compute/needle3"
165
+ };
166
+ var needle3CompleteApi = defineApi({
167
+ id: "model.cactus-needle3.complete",
168
+ name: "Needle3.complete",
169
+ category: "models",
170
+ description: "Select tools or extract structured data from natural-language input.",
171
+ parameters: [
172
+ { name: "prompt", description: "Natural-language input.", required: true, schema: { type: "string" } },
173
+ { name: "tools", description: "Optional tool definitions.", required: false, schema: { type: "array" } },
174
+ { name: "schema", description: "Optional extraction schema.", required: false, schema: { type: "object" } }
175
+ ],
176
+ output: { type: "object", description: "Structured model result." },
177
+ semantics: { deterministic: false, pure: false, sideEffects: false }
178
+ });
179
+
180
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/runtimes/ettin-head.js
181
+ import fs from "fs";
182
+ import path from "path";
183
+ import os from "os";
184
+
185
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/smollm2/index.js
186
+ var smolLM2Metadata = {
187
+ id: "model.smollm2-135m-instruct",
188
+ name: "SmolLM2-135M-Instruct",
189
+ provider: "Hugging Face",
190
+ version: "135M",
191
+ description: "Compact instruction-tuned language model for general text generation.",
192
+ examples: ["summarize text", "rewrite text", "draft a short response"],
193
+ avoidWhen: "Avoid for high-stakes reasoning, broad factual knowledge, or tasks requiring large context.",
194
+ whenToUse: "Use for short general-purpose text generation when a local model is preferred.",
195
+ size: { value: 105, unit: "MB", qualifier: "artifact" },
196
+ capabilities: ["text-generation", "instruction-following"],
197
+ input: "Natural-language prompt",
198
+ output: "Generated natural-language text",
199
+ runtime: "ModelRuntime adapter",
200
+ modelUri: "HuggingFaceTB/SmolLM2-135M-Instruct",
201
+ license: "Apache-2.0"
202
+ };
203
+ var smolLM2GenerateApi = defineApi({
204
+ id: "model.smollm2-135m-instruct.generate",
205
+ name: "SmolLM2-135M-Instruct.generate",
206
+ category: "models",
207
+ description: "Generate natural-language text with SmolLM2-135M-Instruct.",
208
+ parameters: [
209
+ { name: "prompt", description: "Prompt supplied to the model.", required: true, schema: { type: "string" } },
210
+ { name: "maxNewTokens", description: "Maximum number of new tokens.", required: false, schema: { type: "number" } }
211
+ ],
212
+ output: { type: "string", description: "Generated natural-language text." },
213
+ semantics: { deterministic: false, pure: false, sideEffects: false },
214
+ errors: ["Model load failure", "Inference failure"]
215
+ });
216
+
217
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/whistle/index.js
218
+ var whistleMetadata = {
219
+ id: "model.cactus-whistle",
220
+ name: "Whistle",
221
+ provider: "Cactus Compute",
222
+ version: "1",
223
+ description: "Compact CPU speech-recognition model for on-device transcription.",
224
+ examples: ["transcribe a voice note", "transcribe a command"],
225
+ avoidWhen: "Avoid when audio understanding beyond transcription is required.",
226
+ whenToUse: "Use for local speech-to-text when low resource use and privacy matter.",
227
+ size: { value: 16.9, unit: "MB", qualifier: "artifact" },
228
+ capabilities: ["speech-to-text", "on-device", "cpu"],
229
+ input: "Audio bytes",
230
+ output: "Transcribed natural-language text",
231
+ runtime: "Cactus Needle runtime adapter",
232
+ modelUri: "Cactus-Compute/whistle"
233
+ };
234
+ var whistleTranscribeApi = defineApi({
235
+ id: "model.cactus-whistle.transcribe",
236
+ name: "Whistle.transcribe",
237
+ category: "models",
238
+ description: "Transcribe speech audio into natural-language text.",
239
+ parameters: [
240
+ { name: "audio", description: "Audio bytes supplied to the speech model.", required: true, schema: { type: "string" } },
241
+ { name: "language", description: "Optional language identifier.", required: false, schema: { type: "string" } }
242
+ ],
243
+ output: { type: "string", description: "Transcribed text." },
244
+ semantics: { deterministic: true, pure: false, sideEffects: false }
245
+ });
246
+
247
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/ettin/index.js
248
+ var defineEttin = (id2, name, parameters, description) => ({
249
+ id: id2,
250
+ name,
251
+ provider: "Hugging Face",
252
+ version: String(parameters),
253
+ description,
254
+ examples: ["rank search results", "order retrieved documents by relevance"],
255
+ whenToUse: "Use for cross-encoder reranking when candidate texts must be sorted by semantic relevance.",
256
+ avoidWhen: "Avoid for text generation, embeddings, or transcription.",
257
+ size: { value: parameters * 1e6, unit: "parameters", qualifier: "parameters" },
258
+ capabilities: ["reranking", "relevance-scoring"],
259
+ input: "Query and candidate texts",
260
+ output: "Candidate relevance scores",
261
+ runtime: "ModelRuntime adapter",
262
+ modelUri: `cross-encoder/ettin-reranker-${parameters}m-v1`,
263
+ license: "Apache-2.0"
264
+ });
265
+ var ettinReranker17MMetadata = defineEttin("model.ettin-reranker-17m", "Ettin-Reranker-17M", 17, "Very small relevance model for ranking candidate text.");
266
+ var ettinReranker32MMetadata = defineEttin("model.ettin-reranker-32m", "Ettin-Reranker-32M", 32, "Small relevance model for ranking candidate text.");
267
+ var ettinReranker68MMetadata = defineEttin("model.ettin-reranker-68m", "Ettin-Reranker-68M", 68, "Compact relevance model for higher-quality candidate ranking.");
268
+ var ettinReranker150MMetadata = defineEttin("model.ettin-reranker-150m", "Ettin-Reranker-150M", 150, "Larger compact relevance model for candidate ranking.");
269
+ var ettinRerankApi = defineApi({
270
+ id: "model.ettin-reranker.rerank",
271
+ name: "EttinReranker.rerank",
272
+ category: "models",
273
+ description: "Rank candidate texts by relevance to a query.",
274
+ parameters: [
275
+ { name: "query", description: "Query text.", required: true, schema: { type: "string" } },
276
+ { name: "candidates", description: "Candidate texts to rank.", required: true, schema: { type: "array", items: { type: "string" } } }
277
+ ],
278
+ output: { type: "array", description: "Relevance scores in candidate order.", items: { type: "number" } },
279
+ semantics: { deterministic: true, pure: false, sideEffects: false }
280
+ });
281
+
282
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/minilm/index.js
283
+ var miniLML6Metadata = {
284
+ id: "model.minilm-l6-v2",
285
+ name: "MiniLM-L6-v2",
286
+ provider: "Sentence Transformers",
287
+ version: "L6-v2",
288
+ description: "Compact sentence embedding model for semantic similarity.",
289
+ examples: ["compare two texts", "match a query to a short description"],
290
+ avoidWhen: "Avoid when generation, extraction, or tool calling is required.",
291
+ whenToUse: "Use for lightweight semantic similarity and embedding-based matching.",
292
+ size: { value: 227e5, unit: "parameters", qualifier: "parameters" },
293
+ capabilities: ["embeddings", "semantic-similarity"],
294
+ input: "Two text strings",
295
+ output: "Similarity score",
296
+ runtime: "ModelRuntime adapter",
297
+ modelUri: "sentence-transformers/all-MiniLM-L6-v2",
298
+ license: "Apache-2.0"
299
+ };
300
+ var miniLMSimilarityApi = defineApi({
301
+ id: "model.minilm-l6-v2.similarity",
302
+ name: "MiniLM-L6-v2.similarity",
303
+ category: "models",
304
+ description: "Compute semantic similarity between two texts.",
305
+ parameters: [
306
+ { name: "left", description: "First text.", required: true, schema: { type: "string" } },
307
+ { name: "right", description: "Second text.", required: true, schema: { type: "string" } }
308
+ ],
309
+ output: { type: "number", description: "Semantic similarity score." },
310
+ semantics: { deterministic: true, pure: false, sideEffects: false }
311
+ });
312
+
313
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/api-registry.js
314
+ var guttsApiDefinitions = Object.freeze([
315
+ ...arrayApis,
316
+ ...jsonApis,
317
+ ...numberApis,
318
+ ...objectApis,
319
+ ...stringApis,
320
+ ...urlApis,
321
+ smolLM2GenerateApi,
322
+ needle3CompleteApi,
323
+ whistleTranscribeApi,
324
+ ettinRerankApi,
325
+ miniLMSimilarityApi
326
+ ]);
327
+ var guttsApiById = Object.freeze(Object.fromEntries(guttsApiDefinitions.map((api) => [api.id, api])));
61
328
 
62
- // ../../node_modules/.pnpm/@ultrst-armada+krnl@1.0.3/node_modules/@ultrst-armada/krnl/packages/core/dist/index.js
329
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/api/fod-node-provider.js
330
+ var schemaType = (schema) => String(schema?.type ?? "any");
331
+ function guttsApiToFodNode(api) {
332
+ return {
333
+ type: `gutts/${api.id}`,
334
+ label: api.name,
335
+ description: api.description,
336
+ category: "gutts",
337
+ group: api.category,
338
+ 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 })),
339
+ outputs: [{ id: "result", name: "result", direction: "output", dataType: schemaType(api.output), ...api.output.description ? { description: api.output.description } : {}, schema: api.output }],
340
+ metadata: { apiId: api.id, package: "@dinilmusick/gutts", semantics: api.semantics }
341
+ };
342
+ }
343
+ var guttsFodNodeDefinitions = Object.freeze(guttsApiDefinitions.map(guttsApiToFodNode));
344
+
345
+ // ../../node_modules/.pnpm/@dinilmusick+gutts@1.1.0_@types+node@22.20.5/node_modules/@dinilmusick/gutts/dist/models/model-registry.js
346
+ var guttsModelDefinitions = Object.freeze([
347
+ smolLM2Metadata,
348
+ needle3Metadata,
349
+ whistleMetadata,
350
+ ettinReranker17MMetadata,
351
+ ettinReranker32MMetadata,
352
+ ettinReranker68MMetadata,
353
+ ettinReranker150MMetadata,
354
+ miniLML6Metadata
355
+ ]);
356
+ var guttsModelById = Object.freeze(Object.fromEntries(guttsModelDefinitions.map((model) => [model.id, model])));
357
+
358
+ // ../../node_modules/.pnpm/@ultrst-armada+krnl@1.0.9_@types+node@22.20.5/node_modules/@ultrst-armada/krnl/packages/core/dist/index.js
63
359
  var ServiceStateStore = class {
64
360
  state;
65
361
  listeners = /* @__PURE__ */ new Set();
@@ -86,33 +382,6 @@ var ServiceStateStore = class {
86
382
  this.state = { ...newState || {} };
87
383
  }
88
384
  };
89
- var ServiceEventBus = class {
90
- handlers = /* @__PURE__ */ new Map();
91
- on(event, handler) {
92
- if (!this.handlers.has(event)) {
93
- this.handlers.set(event, /* @__PURE__ */ new Set());
94
- }
95
- const set = this.handlers.get(event);
96
- set.add(handler);
97
- return () => {
98
- set.delete(handler);
99
- };
100
- }
101
- emit(event, payload) {
102
- const set = this.handlers.get(event);
103
- if (!set) return;
104
- for (const handler of Array.from(set)) {
105
- try {
106
- handler(payload);
107
- } catch (err) {
108
- console.error(`[ServiceEventBus] Handler error for '${event}':`, err);
109
- }
110
- }
111
- }
112
- clear() {
113
- this.handlers.clear();
114
- }
115
- };
116
385
  var TRANSITIONS = {
117
386
  uninitialized: ["initializing"],
118
387
  initializing: ["ready", "uninitialized"],
@@ -147,14 +416,228 @@ var LifecycleManager = class {
147
416
  }
148
417
  }
149
418
  };
419
+ var runtimeProcess = typeof globalThis !== "undefined" ? globalThis.process : void 0;
420
+ var runtimePerformance = typeof globalThis !== "undefined" ? globalThis.performance : void 0;
421
+ function telemetryNow() {
422
+ return runtimePerformance?.now ? runtimePerformance.now() : Date.now();
423
+ }
424
+ function sampleResources() {
425
+ const memory = runtimeProcess?.memoryUsage?.();
426
+ const cpu = runtimeProcess?.cpuUsage?.();
427
+ const eventLoop = runtimePerformance?.eventLoopUtilization?.();
428
+ return {
429
+ cpuUserMicros: cpu?.user,
430
+ cpuSystemMicros: cpu?.system,
431
+ heapUsedBytes: memory?.heapUsed,
432
+ heapTotalBytes: memory?.heapTotal,
433
+ rssBytes: memory?.rss,
434
+ externalBytes: memory?.external,
435
+ arrayBuffersBytes: memory?.arrayBuffers,
436
+ eventLoopUtilization: eventLoop?.utilization,
437
+ scope: memory || cpu || eventLoop ? "process" : "runtime"
438
+ };
439
+ }
440
+ function deltaResources(start, end) {
441
+ const delta = (a, b) => a === void 0 || b === void 0 ? void 0 : b - a;
442
+ return {
443
+ cpuUserMicros: delta(start.cpuUserMicros, end.cpuUserMicros),
444
+ cpuSystemMicros: delta(start.cpuSystemMicros, end.cpuSystemMicros),
445
+ heapUsedBytes: delta(start.heapUsedBytes, end.heapUsedBytes),
446
+ heapTotalBytes: delta(start.heapTotalBytes, end.heapTotalBytes),
447
+ rssBytes: delta(start.rssBytes, end.rssBytes),
448
+ externalBytes: delta(start.externalBytes, end.externalBytes),
449
+ arrayBuffersBytes: delta(start.arrayBuffersBytes, end.arrayBuffersBytes),
450
+ eventLoopUtilization: delta(start.eventLoopUtilization, end.eventLoopUtilization),
451
+ scope: start.scope
452
+ };
453
+ }
454
+ var id = (prefix) => `${prefix}_${randomUUID()}`;
455
+ function percentiles(values) {
456
+ if (!values.length) return { min: 0, mean: 0, p50: 0, p90: 0, p95: 0, p99: 0, max: 0 };
457
+ const sorted = [...values].sort((a, b) => a - b);
458
+ const pick2 = (p) => sorted[Math.min(sorted.length - 1, Math.floor((sorted.length - 1) * p))];
459
+ return {
460
+ min: sorted[0],
461
+ mean: sorted.reduce((sum2, value) => sum2 + value, 0) / sorted.length,
462
+ p50: pick2(0.5),
463
+ p90: pick2(0.9),
464
+ p95: pick2(0.95),
465
+ p99: pick2(0.99),
466
+ max: sorted[sorted.length - 1]
467
+ };
468
+ }
469
+ var TelemetryController = class {
470
+ constructor(serviceId, options = {}) {
471
+ this.serviceId = serviceId;
472
+ this.mode = options.mode ?? "off";
473
+ this.maxSamples = Math.max(1, options.maxSamples ?? 2048);
474
+ this.maxRecentInvocations = Math.max(1, options.maxRecentInvocations ?? 100);
475
+ }
476
+ serviceId;
477
+ mode;
478
+ maxSamples;
479
+ maxRecentInvocations;
480
+ samples = [];
481
+ active = /* @__PURE__ */ new Map();
482
+ totalInvocationCount = 0;
483
+ totalSuccessCount = 0;
484
+ totalErrorCount = 0;
485
+ lastInvocationAt;
486
+ enable(mode = "standard") {
487
+ this.mode = mode;
488
+ }
489
+ disable() {
490
+ this.mode = "off";
491
+ this.active.clear();
492
+ }
493
+ setMode(mode) {
494
+ this.mode = mode;
495
+ if (mode === "off") this.active.clear();
496
+ }
497
+ getMode() {
498
+ return this.mode;
499
+ }
500
+ status() {
501
+ return {
502
+ enabled: this.mode !== "off",
503
+ mode: this.mode,
504
+ serviceId: this.serviceId,
505
+ invocationCount: this.totalInvocationCount,
506
+ activeInvocations: this.active.size,
507
+ lastInvocationAt: this.lastInvocationAt
508
+ };
509
+ }
510
+ begin(target, kind, correlationId, parentSpanId) {
511
+ if (this.mode === "off") {
512
+ return {
513
+ invocationId: "",
514
+ traceId: "",
515
+ spanId: "",
516
+ parentSpanId,
517
+ end: () => void 0
518
+ };
519
+ }
520
+ const invocationId = id("inv");
521
+ const spanId = id("span");
522
+ const traceId = parentSpanId ? this.findTraceId(parentSpanId) ?? id("trace") : id("trace");
523
+ const active = {
524
+ invocationId,
525
+ traceId,
526
+ spanId,
527
+ parentSpanId,
528
+ serviceId: this.serviceId,
529
+ target,
530
+ kind,
531
+ correlationId,
532
+ startedAt: telemetryNow(),
533
+ resourcesStart: this.mode === "standard" ? void 0 : sampleResources()
534
+ };
535
+ this.active.set(invocationId, active);
536
+ return {
537
+ invocationId,
538
+ traceId,
539
+ spanId,
540
+ parentSpanId,
541
+ end: (error) => this.finish(active, error)
542
+ };
543
+ }
544
+ reset() {
545
+ this.samples.length = 0;
546
+ this.active.clear();
547
+ this.totalInvocationCount = 0;
548
+ this.totalSuccessCount = 0;
549
+ this.totalErrorCount = 0;
550
+ this.lastInvocationAt = void 0;
551
+ }
552
+ snapshot() {
553
+ const invocations = this.samples.slice();
554
+ const durations = invocations.map((item) => item.durationMs);
555
+ const targetMap = /* @__PURE__ */ new Map();
556
+ for (const invocation of invocations) {
557
+ const key = `${invocation.kind}:${invocation.target}`;
558
+ const group = targetMap.get(key) ?? [];
559
+ group.push(invocation);
560
+ targetMap.set(key, group);
561
+ }
562
+ const targets = [...targetMap.values()].map((group) => ({
563
+ target: group[0].target,
564
+ kind: group[0].kind,
565
+ count: group.length,
566
+ successCount: group.filter((item) => item.status === "completed").length,
567
+ errorCount: group.filter((item) => item.status === "failed").length,
568
+ durationMs: percentiles(group.map((item) => item.durationMs)),
569
+ lastInvocationAt: group[group.length - 1]?.completedAt
570
+ }));
571
+ return {
572
+ serviceId: this.serviceId,
573
+ mode: this.mode,
574
+ capturedAt: Date.now(),
575
+ status: this.status(),
576
+ totals: {
577
+ invocationCount: this.totalInvocationCount,
578
+ successCount: this.totalSuccessCount,
579
+ errorCount: this.totalErrorCount,
580
+ durationMs: percentiles(durations)
581
+ },
582
+ targets,
583
+ activeInvocations: this.active.size,
584
+ recentInvocations: invocations.slice(-this.maxRecentInvocations)
585
+ };
586
+ }
587
+ functionality(name) {
588
+ return this.snapshot().targets.find((target) => target.kind === "functionality" && target.target === name);
589
+ }
590
+ functionalities() {
591
+ return this.snapshot().targets.filter((target) => target.kind === "functionality");
592
+ }
593
+ findTraceId(parentSpanId) {
594
+ for (let index = this.samples.length - 1; index >= 0; index -= 1) {
595
+ if (this.samples[index].spanId === parentSpanId) return this.samples[index].traceId;
596
+ }
597
+ for (const active of this.active.values()) {
598
+ if (active.spanId === parentSpanId) return active.traceId;
599
+ }
600
+ return void 0;
601
+ }
602
+ finish(active, error) {
603
+ if (!this.active.delete(active.invocationId)) return;
604
+ const completedAt = telemetryNow();
605
+ const resourcesEnd = this.mode === "standard" ? void 0 : sampleResources();
606
+ const invocation = {
607
+ invocationId: active.invocationId,
608
+ traceId: active.traceId,
609
+ spanId: active.spanId,
610
+ parentSpanId: active.parentSpanId,
611
+ serviceId: active.serviceId,
612
+ target: active.target,
613
+ kind: active.kind,
614
+ correlationId: active.correlationId,
615
+ startedAt: active.startedAt,
616
+ completedAt,
617
+ durationMs: Math.max(0, completedAt - active.startedAt),
618
+ status: error === void 0 ? "completed" : "failed",
619
+ error: error === void 0 ? void 0 : {
620
+ name: error instanceof Error ? error.name : "Error",
621
+ message: error instanceof Error ? error.message : String(error)
622
+ },
623
+ resources: active.resourcesStart && resourcesEnd ? { start: active.resourcesStart, end: resourcesEnd, delta: deltaResources(active.resourcesStart, resourcesEnd) } : void 0
624
+ };
625
+ this.samples.push(invocation);
626
+ this.totalInvocationCount += 1;
627
+ if (invocation.status === "completed") this.totalSuccessCount += 1;
628
+ else this.totalErrorCount += 1;
629
+ if (this.samples.length > this.maxSamples) this.samples.splice(0, this.samples.length - this.maxSamples);
630
+ this.lastInvocationAt = Date.now();
631
+ }
632
+ };
150
633
  var ServiceInstance = class {
151
634
  constructor(definition) {
152
635
  this.definition = definition;
153
636
  this.id = definition.id;
154
637
  this.name = definition.name;
155
638
  this.version = definition.version;
639
+ this.telemetry = new TelemetryController(this.id);
156
640
  this.lifecycle = new LifecycleManager();
157
- this.eventBus = new ServiceEventBus();
158
641
  if (definition.state) {
159
642
  this.stateStore = new ServiceStateStore(definition.state.initial);
160
643
  }
@@ -163,8 +646,8 @@ var ServiceInstance = class {
163
646
  id;
164
647
  name;
165
648
  version;
649
+ telemetry;
166
650
  stateStore;
167
- eventBus;
168
651
  lifecycle;
169
652
  initialized = false;
170
653
  disposed = false;
@@ -228,7 +711,19 @@ var ServiceInstance = class {
228
711
  if (!operation) {
229
712
  throw new Error("[Service:" + this.name + "] Operation '" + op + "' not found.");
230
713
  }
231
- return await operation.handler(input, ctx);
714
+ if (ctx.metadata?.__krnlTelemetryInternal === true) {
715
+ return await operation.handler(input, ctx);
716
+ }
717
+ const parentSpanId = typeof ctx.metadata?.__krnlTelemetryParentSpanId === "string" ? ctx.metadata.__krnlTelemetryParentSpanId : void 0;
718
+ const handle = this.telemetry.begin(op, "service", ctx.correlationId, parentSpanId);
719
+ try {
720
+ const output = await operation.handler(input, ctx);
721
+ handle.end();
722
+ return output;
723
+ } catch (error) {
724
+ handle.end(error);
725
+ throw error;
726
+ }
232
727
  }
233
728
  getState() {
234
729
  return this.stateStore?.getState() ?? Object.freeze({});
@@ -240,12 +735,6 @@ var ServiceInstance = class {
240
735
  }
241
736
  this.stateStore.setState(mutation);
242
737
  }
243
- on(event, handler) {
244
- return this.eventBus.on(event, handler);
245
- }
246
- emit(event, payload) {
247
- this.eventBus.emit(event, payload);
248
- }
249
738
  };
250
739
  function assertRecord(value, field) {
251
740
  if (!value || typeof value !== "object" || Array.isArray(value)) {
@@ -279,12 +768,6 @@ function validateServiceDefinition(definition) {
279
768
  throw new Error("[Service:" + definition.name + "] Operation '" + key + "' must define a handler.");
280
769
  }
281
770
  }
282
- for (const [key, event] of Object.entries(definition.events ?? {})) {
283
- if (!event || typeof event !== "object") {
284
- throw new Error("[Service:" + definition.name + "] Invalid event '" + key + "'.");
285
- }
286
- assertNonEmptyString(event.name, "events." + key + ".name");
287
- }
288
771
  for (const [key, schema] of Object.entries(definition.inputs ?? {})) assertRecord(schema, "inputs." + key);
289
772
  for (const [key, schema] of Object.entries(definition.outputs ?? {})) assertRecord(schema, "outputs." + key);
290
773
  if (definition.state?.schema !== void 0) assertRecord(definition.state.schema, "state.schema");
@@ -674,8 +1157,8 @@ var GraphEntityParent = class {
674
1157
  updatedAt;
675
1158
  metadata;
676
1159
  eventListeners;
677
- constructor(id, name, assetType, metadata = {}) {
678
- this.id = id;
1160
+ constructor(id2, name, assetType, metadata = {}) {
1161
+ this.id = id2;
679
1162
  this.name = name;
680
1163
  this.assetType = assetType;
681
1164
  this.isActive = true;
@@ -3518,7 +4001,7 @@ function getEffectsAffectingWire(conn, nodes) {
3518
4001
  const effectNodes = nodes.filter((n) => n.type === "effect" && n.active);
3519
4002
  const activeEffects = effectNodes.filter((effect) => isWireAffectedByEffect(effect, conn, fromNode, toNode));
3520
4003
  if (conn.effectOrder && conn.effectOrder.length > 0) {
3521
- const orderMap = new Map(conn.effectOrder.map((id, index) => [id, index]));
4004
+ const orderMap = new Map(conn.effectOrder.map((id2, index) => [id2, index]));
3522
4005
  return activeEffects.sort((a, b) => {
3523
4006
  const orderA = orderMap.has(a.id) ? orderMap.get(a.id) : 9999;
3524
4007
  const orderB = orderMap.has(b.id) ? orderMap.get(b.id) : 9999;
@@ -3559,9 +4042,9 @@ function validateProjectGraph(nodes, connections) {
3559
4042
  nodes.forEach((n) => {
3560
4043
  idCounts.set(n.id, (idCounts.get(n.id) || 0) + 1);
3561
4044
  });
3562
- idCounts.forEach((count, id) => {
4045
+ idCounts.forEach((count, id2) => {
3563
4046
  if (count > 1) {
3564
- issues.push({ id: `dup-node-${id}`, type: "error", message: `Duplicate node ID detected: ${id}`, sourceId: id });
4047
+ issues.push({ id: `dup-node-${id2}`, type: "error", message: `Duplicate node ID detected: ${id2}`, sourceId: id2 });
3565
4048
  }
3566
4049
  });
3567
4050
  connections.forEach((conn) => {
@@ -4886,8 +5369,8 @@ var UIElementBase = class extends GraphEntityParent {
4886
5369
  isHighlighted;
4887
5370
  tooltipText;
4888
5371
  tooltipDir;
4889
- constructor(id, name, themeRole, variant = "primary", size = "md", metadata = {}) {
4890
- super(id, name, "ui", metadata);
5372
+ constructor(id2, name, themeRole, variant = "primary", size = "md", metadata = {}) {
5373
+ super(id2, name, "ui", metadata);
4891
5374
  this.themeRole = themeRole;
4892
5375
  this.variant = variant;
4893
5376
  this.size = size;
@@ -5140,14 +5623,14 @@ var MagneticGraphManager = class {
5140
5623
  getLandmarks() {
5141
5624
  return Array.from(this.landmarks.values());
5142
5625
  }
5143
- removeLandmark(id) {
5144
- this.landmarks.delete(id);
5626
+ removeLandmark(id2) {
5627
+ this.landmarks.delete(id2);
5145
5628
  }
5146
5629
  };
5147
5630
 
5148
5631
  // src/engine/functions/containerFactory.ts
5149
5632
  function createContainerNode(type, index, bpm, position, audioFormat) {
5150
- const id = `cont-${Date.now()}`;
5633
+ const id2 = `cont-${Date.now()}`;
5151
5634
  const pos = position || [
5152
5635
  (Math.random() - 0.5) * 8,
5153
5636
  0.5,
@@ -5155,7 +5638,7 @@ function createContainerNode(type, index, bpm, position, audioFormat) {
5155
5638
  ];
5156
5639
  const finalAudioFormat = audioFormat || (type === "audio" ? "mono" : void 0);
5157
5640
  const base = {
5158
- id,
5641
+ id: id2,
5159
5642
  type: "container",
5160
5643
  containerType: type,
5161
5644
  audioFormat: finalAudioFormat,
@@ -5229,7 +5712,7 @@ function createContainerNode(type, index, bpm, position, audioFormat) {
5229
5712
  return base;
5230
5713
  }
5231
5714
  function createRecorderNode(recorderType, index, position, recordingMode = "standard") {
5232
- const id = `rec-${Date.now()}`;
5715
+ const id2 = `rec-${Date.now()}`;
5233
5716
  const pos = position || [
5234
5717
  (Math.random() - 0.5) * 8,
5235
5718
  0.5,
@@ -5242,7 +5725,7 @@ function createRecorderNode(recorderType, index, position, recordingMode = "stan
5242
5725
  const isRetrospective = recordingMode === "retrospective";
5243
5726
  const typeName = effectiveType === "audio_stereo" ? `Audio Recorder Stereo` : effectiveType === "audio_mono" ? `Audio Recorder Mono` : effectiveType === "midi" ? `MIDI Recorder` : `Curve Recorder`;
5244
5727
  return {
5245
- id,
5728
+ id: id2,
5246
5729
  type: "recorder",
5247
5730
  name: isRetrospective ? `Retrospective ${typeName} ${index}` : `${typeName} ${index}`,
5248
5731
  position: pos,
@@ -5272,7 +5755,7 @@ function createRecorderNode(recorderType, index, position, recordingMode = "stan
5272
5755
  };
5273
5756
  }
5274
5757
  function createPlayerNode(playerType, index, position) {
5275
- const id = `ply-${Date.now()}`;
5758
+ const id2 = `ply-${Date.now()}`;
5276
5759
  const pos = position || [
5277
5760
  (Math.random() - 0.5) * 8,
5278
5761
  0.5,
@@ -5281,7 +5764,7 @@ function createPlayerNode(playerType, index, position) {
5281
5764
  const effectiveType = playerType === "audio" ? "audio_stereo" : playerType;
5282
5765
  const isAudio = effectiveType === "audio_stereo" || effectiveType === "audio_mono";
5283
5766
  return {
5284
- id,
5767
+ id: id2,
5285
5768
  type: "player",
5286
5769
  name: effectiveType === "audio_stereo" ? `Audio Stereo Player ${index}` : effectiveType === "audio_mono" ? `Audio Mono Player ${index}` : effectiveType === "midi" ? `MIDI Player ${index}` : `Curve Player ${index}`,
5287
5770
  position: pos,
@@ -5302,14 +5785,14 @@ function createPlayerNode(playerType, index, position) {
5302
5785
  };
5303
5786
  }
5304
5787
  function createSamplerNode(index, position) {
5305
- const id = `smp-${Date.now()}`;
5788
+ const id2 = `smp-${Date.now()}`;
5306
5789
  const pos = position || [
5307
5790
  (Math.random() - 0.5) * 8,
5308
5791
  0.5,
5309
5792
  (Math.random() - 0.5) * 8
5310
5793
  ];
5311
5794
  return {
5312
- id,
5795
+ id: id2,
5313
5796
  type: "sampler",
5314
5797
  name: `Sampler Engine ${index}`,
5315
5798
  position: pos,
@@ -5338,14 +5821,14 @@ function createSamplerNode(index, position) {
5338
5821
  };
5339
5822
  }
5340
5823
  function createAudioPadsNode(index, position) {
5341
- const id = `pads-${Date.now()}`;
5824
+ const id2 = `pads-${Date.now()}`;
5342
5825
  const pos = position || [
5343
5826
  (Math.random() - 0.5) * 8,
5344
5827
  0.5,
5345
5828
  (Math.random() - 0.5) * 8
5346
5829
  ];
5347
5830
  return {
5348
- id,
5831
+ id: id2,
5349
5832
  type: "audio_pads",
5350
5833
  name: `Audio Pads ${index}`,
5351
5834
  position: pos,
@@ -5691,9 +6174,9 @@ var WorkspaceGraphRegistry = class {
5691
6174
  this.saveWorkspaceGraph(gDef);
5692
6175
  }
5693
6176
  static getWorkspaceGraphs() {
5694
- const unique = /* @__PURE__ */ new Map();
5695
- this.inMemoryGraphs.forEach((g) => unique.set(g.id, g));
5696
- return Array.from(unique.values());
6177
+ const unique2 = /* @__PURE__ */ new Map();
6178
+ this.inMemoryGraphs.forEach((g) => unique2.set(g.id, g));
6179
+ return Array.from(unique2.values());
5697
6180
  }
5698
6181
  static getGraphDefinition(idOrName) {
5699
6182
  return this.inMemoryGraphs.get(idOrName);
@@ -5703,8 +6186,8 @@ var WorkspaceGraphRegistry = class {
5703
6186
  this.inMemoryGraphs.set(graph.name, graph);
5704
6187
  this.persistToLocalStorage();
5705
6188
  }
5706
- static deleteWorkspaceGraph(id) {
5707
- const existing = this.inMemoryGraphs.get(id);
6189
+ static deleteWorkspaceGraph(id2) {
6190
+ const existing = this.inMemoryGraphs.get(id2);
5708
6191
  if (existing) {
5709
6192
  this.inMemoryGraphs.delete(existing.id);
5710
6193
  this.inMemoryGraphs.delete(existing.name);
@@ -6997,8 +7480,8 @@ var dynamicArchetypeRegistry = /* @__PURE__ */ new Map();
6997
7480
  function registerNodeArchetype(archetype) {
6998
7481
  dynamicArchetypeRegistry.set(archetype.id, archetype);
6999
7482
  }
7000
- function unregisterNodeArchetype(id) {
7001
- dynamicArchetypeRegistry.delete(id);
7483
+ function unregisterNodeArchetype(id2) {
7484
+ dynamicArchetypeRegistry.delete(id2);
7002
7485
  }
7003
7486
  function getAllNodeArchetypes() {
7004
7487
  if (dynamicArchetypeRegistry.size === 0) {
@@ -7370,9 +7853,9 @@ function validateGraphImport(existingGraphs, targetGraphId, candidateImportId) {
7370
7853
  };
7371
7854
  }
7372
7855
  const adj = /* @__PURE__ */ new Map();
7373
- for (const [id, graph] of Object.entries(existingGraphs)) {
7856
+ for (const [id2, graph] of Object.entries(existingGraphs)) {
7374
7857
  const list = Array.isArray(graph.importedGraphIds) ? [...graph.importedGraphIds] : [];
7375
- adj.set(id, list);
7858
+ adj.set(id2, list);
7376
7859
  }
7377
7860
  if (!adj.has(targetGraphId)) adj.set(targetGraphId, []);
7378
7861
  if (!adj.has(candidateImportId)) adj.set(candidateImportId, []);
@@ -7404,7 +7887,7 @@ function validateGraphImport(existingGraphs, targetGraphId, candidateImportId) {
7404
7887
  currentPath.length = 0;
7405
7888
  const cycle = detectCycle(node);
7406
7889
  if (cycle) {
7407
- const names = cycle.map((id) => existingGraphs[id]?.name || id);
7890
+ const names = cycle.map((id2) => existingGraphs[id2]?.name || id2);
7408
7891
  return {
7409
7892
  valid: false,
7410
7893
  error: `Circular dependency detected: ${names.join(" \u2794 ")}`,
@@ -7761,8 +8244,8 @@ var CanonicalAudioInputEndpoint = class {
7761
8244
  cachedTimeData = null;
7762
8245
  cachedFreqData = null;
7763
8246
  listeners = /* @__PURE__ */ new Set();
7764
- constructor(id, name, channel = 1) {
7765
- this.id = id;
8247
+ constructor(id2, name, channel = 1) {
8248
+ this.id = id2;
7766
8249
  this.name = name;
7767
8250
  this.channel = channel;
7768
8251
  }
@@ -7843,11 +8326,11 @@ var CanonicalAudioInputEndpoint = class {
7843
8326
  }
7844
8327
  this.analyser.getByteFrequencyData(this.cachedFreqData);
7845
8328
  let maxVal = 0;
7846
- let sum = 0;
8329
+ let sum2 = 0;
7847
8330
  for (let i = 0; i < this.cachedFreqData.length; i++) {
7848
8331
  const v = this.cachedFreqData[i];
7849
8332
  if (v > maxVal) maxVal = v;
7850
- sum += v;
8333
+ sum2 += v;
7851
8334
  }
7852
8335
  this.sampleCount = this.cachedFreqData.length;
7853
8336
  if (maxVal === 0) {
@@ -7856,7 +8339,7 @@ var CanonicalAudioInputEndpoint = class {
7856
8339
  this.level = this.noiseFloor;
7857
8340
  } else {
7858
8341
  const maxNorm = maxVal / 255;
7859
- const avgNorm = sum / this.cachedFreqData.length / 255;
8342
+ const avgNorm = sum2 / this.cachedFreqData.length / 255;
7860
8343
  this.peak = maxNorm;
7861
8344
  this.rms = avgNorm;
7862
8345
  this.level = calculateAudioMeterLevel(maxNorm, avgNorm, this.gain);
@@ -7911,8 +8394,8 @@ var CanonicalMidiInputEndpoint = class {
7911
8394
  noteHistory = [];
7912
8395
  listeners = /* @__PURE__ */ new Set();
7913
8396
  eventListeners = /* @__PURE__ */ new Set();
7914
- constructor(id, name) {
7915
- this.id = id;
8397
+ constructor(id2, name) {
8398
+ this.id = id2;
7916
8399
  this.name = name;
7917
8400
  }
7918
8401
  subscribe(fn) {
@@ -8016,32 +8499,32 @@ var TopLevelIoRegistry = class {
8016
8499
  notifyRegistry() {
8017
8500
  this.registryListeners.forEach((fn) => fn());
8018
8501
  }
8019
- getOrCreateAudioEndpoint(id, name, channel = 1) {
8020
- let ep = this.audioEndpoints.get(id);
8502
+ getOrCreateAudioEndpoint(id2, name, channel = 1) {
8503
+ let ep = this.audioEndpoints.get(id2);
8021
8504
  if (!ep) {
8022
- ep = new CanonicalAudioInputEndpoint(id, name, channel);
8023
- this.audioEndpoints.set(id, ep);
8505
+ ep = new CanonicalAudioInputEndpoint(id2, name, channel);
8506
+ this.audioEndpoints.set(id2, ep);
8024
8507
  this.notifyRegistry();
8025
8508
  }
8026
8509
  return ep;
8027
8510
  }
8028
- getAudioEndpoint(id) {
8029
- return this.audioEndpoints.get(id);
8511
+ getAudioEndpoint(id2) {
8512
+ return this.audioEndpoints.get(id2);
8030
8513
  }
8031
8514
  getAllAudioEndpoints() {
8032
8515
  return Array.from(this.audioEndpoints.values());
8033
8516
  }
8034
- getOrCreateMidiEndpoint(id, name) {
8035
- let ep = this.midiEndpoints.get(id);
8517
+ getOrCreateMidiEndpoint(id2, name) {
8518
+ let ep = this.midiEndpoints.get(id2);
8036
8519
  if (!ep) {
8037
- ep = new CanonicalMidiInputEndpoint(id, name);
8038
- this.midiEndpoints.set(id, ep);
8520
+ ep = new CanonicalMidiInputEndpoint(id2, name);
8521
+ this.midiEndpoints.set(id2, ep);
8039
8522
  this.notifyRegistry();
8040
8523
  }
8041
8524
  return ep;
8042
8525
  }
8043
- getMidiEndpoint(id) {
8044
- return this.midiEndpoints.get(id);
8526
+ getMidiEndpoint(id2) {
8527
+ return this.midiEndpoints.get(id2);
8045
8528
  }
8046
8529
  getAllMidiEndpoints() {
8047
8530
  return Array.from(this.midiEndpoints.values());
@@ -8162,26 +8645,26 @@ var AudioBusDriver = class {
8162
8645
  }
8163
8646
  const data = this.sharedAnalyserBuffer;
8164
8647
  analyser.getByteFrequencyData(data);
8165
- let sum = 0;
8648
+ let sum2 = 0;
8166
8649
  let maxVal = 0;
8167
8650
  for (let i = 0; i < data.length; i++) {
8168
8651
  const v = data[i];
8169
- sum += v;
8652
+ sum2 += v;
8170
8653
  if (v > maxVal) maxVal = v;
8171
8654
  }
8172
8655
  if (maxVal === 0) return 0;
8173
8656
  const maxNorm = maxVal / 255;
8174
- const avgNorm = sum / data.length / 255;
8657
+ const avgNorm = sum2 / data.length / 255;
8175
8658
  return Math.min(1, (maxNorm * 0.75 + avgNorm * 0.25) * 1.8);
8176
8659
  }
8177
8660
  updateMonitoring(ctx, masterGainNode, nodes, _connections, isNodeConnectedToOutput) {
8178
8661
  if (!this.channelSplitter) return;
8179
- this.activeMonitorGains.forEach((gain, id) => {
8662
+ this.activeMonitorGains.forEach((gain, id2) => {
8180
8663
  try {
8181
8664
  gain.disconnect();
8182
8665
  } catch {
8183
8666
  }
8184
- this.activeMonitorGains.delete(id);
8667
+ this.activeMonitorGains.delete(id2);
8185
8668
  });
8186
8669
  }
8187
8670
  cleanup() {
@@ -8847,9 +9330,9 @@ function encodeFloat32ToWavBase64(sampleRate, numChannels, channelData) {
8847
9330
  const dataSize = numSamples * blockAlign;
8848
9331
  const arrayBuffer = new ArrayBuffer(44 + dataSize);
8849
9332
  const view = new DataView(arrayBuffer);
8850
- function writeString(offset2, string) {
8851
- for (let i = 0; i < string.length; i++) {
8852
- view.setUint8(offset2 + i, string.charCodeAt(i));
9333
+ function writeString(offset2, string3) {
9334
+ for (let i = 0; i < string3.length; i++) {
9335
+ view.setUint8(offset2 + i, string3.charCodeAt(i));
8853
9336
  }
8854
9337
  }
8855
9338
  writeString(0, "RIFF");
@@ -8878,8 +9361,8 @@ function encodeFloat32ToWavBase64(sampleRate, numChannels, channelData) {
8878
9361
  let binary = "";
8879
9362
  const chunkSize = 8192;
8880
9363
  for (let i = 0; i < bytes.length; i += chunkSize) {
8881
- const chunk = bytes.subarray(i, i + chunkSize);
8882
- binary += String.fromCharCode.apply(null, Array.from(chunk));
9364
+ const chunk2 = bytes.subarray(i, i + chunkSize);
9365
+ binary += String.fromCharCode.apply(null, Array.from(chunk2));
8883
9366
  }
8884
9367
  return btoa(binary);
8885
9368
  }
@@ -9016,15 +9499,15 @@ function saveCustomMidiNames(names) {
9016
9499
  if (typeof window === "undefined") return;
9017
9500
  localStorage.setItem(CUSTOM_NAMES_KEY, JSON.stringify(names));
9018
9501
  }
9019
- function getCustomMidiName(id) {
9020
- return getCustomMidiNames()[id];
9502
+ function getCustomMidiName(id2) {
9503
+ return getCustomMidiNames()[id2];
9021
9504
  }
9022
- function setCustomMidiName(id, name) {
9505
+ function setCustomMidiName(id2, name) {
9023
9506
  const current = getCustomMidiNames();
9024
9507
  if (!name.trim()) {
9025
- delete current[id];
9508
+ delete current[id2];
9026
9509
  } else {
9027
- current[id] = name.trim();
9510
+ current[id2] = name.trim();
9028
9511
  }
9029
9512
  saveCustomMidiNames(current);
9030
9513
  }
@@ -9053,9 +9536,9 @@ function createVirtualMidiDevice(name) {
9053
9536
  saveVirtualMidiDevices(devices);
9054
9537
  return newDevice;
9055
9538
  }
9056
- function deleteVirtualMidiDevice(id) {
9539
+ function deleteVirtualMidiDevice(id2) {
9057
9540
  const devices = getVirtualMidiDevices();
9058
- const filtered = devices.filter((d) => d.id !== id);
9541
+ const filtered = devices.filter((d) => d.id !== id2);
9059
9542
  saveVirtualMidiDevices(filtered);
9060
9543
  }
9061
9544
  function getNamedMidiProfiles() {
@@ -9093,9 +9576,9 @@ function updateNamedMidiProfile(updated) {
9093
9576
  saveNamedMidiProfiles(profiles);
9094
9577
  }
9095
9578
  }
9096
- function deleteNamedMidiProfile(id) {
9579
+ function deleteNamedMidiProfile(id2) {
9097
9580
  const profiles = getNamedMidiProfiles();
9098
- const filtered = profiles.filter((p) => p.id !== id);
9581
+ const filtered = profiles.filter((p) => p.id !== id2);
9099
9582
  saveNamedMidiProfiles(filtered);
9100
9583
  }
9101
9584
  function getResolvedMidiDevices(physicalDevices) {