@nhtio/adk 0.1.0-master-f0aa531d

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 (297) hide show
  1. package/LICENSE.md +9 -0
  2. package/README.md +3 -0
  3. package/batteries/index.d.ts +28 -0
  4. package/batteries/llm/index.d.ts +11 -0
  5. package/batteries/llm/openai_chat_completions/adapter.cjs +916 -0
  6. package/batteries/llm/openai_chat_completions/adapter.cjs.map +1 -0
  7. package/batteries/llm/openai_chat_completions/adapter.d.ts +101 -0
  8. package/batteries/llm/openai_chat_completions/adapter.mjs +914 -0
  9. package/batteries/llm/openai_chat_completions/adapter.mjs.map +1 -0
  10. package/batteries/llm/openai_chat_completions/exceptions.cjs +89 -0
  11. package/batteries/llm/openai_chat_completions/exceptions.cjs.map +1 -0
  12. package/batteries/llm/openai_chat_completions/exceptions.d.ts +97 -0
  13. package/batteries/llm/openai_chat_completions/exceptions.mjs +81 -0
  14. package/batteries/llm/openai_chat_completions/exceptions.mjs.map +1 -0
  15. package/batteries/llm/openai_chat_completions/helpers.cjs +819 -0
  16. package/batteries/llm/openai_chat_completions/helpers.cjs.map +1 -0
  17. package/batteries/llm/openai_chat_completions/helpers.d.ts +233 -0
  18. package/batteries/llm/openai_chat_completions/helpers.mjs +783 -0
  19. package/batteries/llm/openai_chat_completions/helpers.mjs.map +1 -0
  20. package/batteries/llm/openai_chat_completions/index.d.ts +27 -0
  21. package/batteries/llm/openai_chat_completions/types.cjs +1 -0
  22. package/batteries/llm/openai_chat_completions/types.d.ts +524 -0
  23. package/batteries/llm/openai_chat_completions/types.mjs +0 -0
  24. package/batteries/llm/openai_chat_completions/validation.cjs +190 -0
  25. package/batteries/llm/openai_chat_completions/validation.cjs.map +1 -0
  26. package/batteries/llm/openai_chat_completions/validation.d.ts +31 -0
  27. package/batteries/llm/openai_chat_completions/validation.mjs +187 -0
  28. package/batteries/llm/openai_chat_completions/validation.mjs.map +1 -0
  29. package/batteries/llm/openai_chat_completions.cjs +51 -0
  30. package/batteries/llm/openai_chat_completions.mjs +5 -0
  31. package/batteries/llm/webllm_chat_completions/adapter.cjs +658 -0
  32. package/batteries/llm/webllm_chat_completions/adapter.cjs.map +1 -0
  33. package/batteries/llm/webllm_chat_completions/adapter.d.ts +103 -0
  34. package/batteries/llm/webllm_chat_completions/adapter.mjs +656 -0
  35. package/batteries/llm/webllm_chat_completions/adapter.mjs.map +1 -0
  36. package/batteries/llm/webllm_chat_completions/exceptions.cjs +70 -0
  37. package/batteries/llm/webllm_chat_completions/exceptions.cjs.map +1 -0
  38. package/batteries/llm/webllm_chat_completions/exceptions.d.ts +74 -0
  39. package/batteries/llm/webllm_chat_completions/exceptions.mjs +65 -0
  40. package/batteries/llm/webllm_chat_completions/exceptions.mjs.map +1 -0
  41. package/batteries/llm/webllm_chat_completions/helpers.cjs +38 -0
  42. package/batteries/llm/webllm_chat_completions/helpers.d.ts +6 -0
  43. package/batteries/llm/webllm_chat_completions/helpers.mjs +2 -0
  44. package/batteries/llm/webllm_chat_completions/index.d.ts +25 -0
  45. package/batteries/llm/webllm_chat_completions/types.d.ts +31 -0
  46. package/batteries/llm/webllm_chat_completions/validation.cjs +115 -0
  47. package/batteries/llm/webllm_chat_completions/validation.cjs.map +1 -0
  48. package/batteries/llm/webllm_chat_completions/validation.d.ts +8 -0
  49. package/batteries/llm/webllm_chat_completions/validation.mjs +112 -0
  50. package/batteries/llm/webllm_chat_completions/validation.mjs.map +1 -0
  51. package/batteries/llm/webllm_chat_completions.cjs +50 -0
  52. package/batteries/llm/webllm_chat_completions.mjs +6 -0
  53. package/batteries/llm.cjs +63 -0
  54. package/batteries/llm.mjs +10 -0
  55. package/batteries/storage/flydrive/index.d.ts +167 -0
  56. package/batteries/storage/flydrive.cjs +249 -0
  57. package/batteries/storage/flydrive.cjs.map +1 -0
  58. package/batteries/storage/flydrive.mjs +249 -0
  59. package/batteries/storage/flydrive.mjs.map +1 -0
  60. package/batteries/storage/in_memory/index.d.ts +106 -0
  61. package/batteries/storage/in_memory.cjs +121 -0
  62. package/batteries/storage/in_memory.cjs.map +1 -0
  63. package/batteries/storage/in_memory.mjs +119 -0
  64. package/batteries/storage/in_memory.mjs.map +1 -0
  65. package/batteries/storage/index.d.ts +18 -0
  66. package/batteries/storage/opfs/index.d.ts +299 -0
  67. package/batteries/storage/opfs.cjs +368 -0
  68. package/batteries/storage/opfs.cjs.map +1 -0
  69. package/batteries/storage/opfs.mjs +366 -0
  70. package/batteries/storage/opfs.mjs.map +1 -0
  71. package/batteries/storage.cjs +4 -0
  72. package/batteries/storage.mjs +2 -0
  73. package/batteries/tools/color/index.d.ts +37 -0
  74. package/batteries/tools/color.cjs +659 -0
  75. package/batteries/tools/color.cjs.map +1 -0
  76. package/batteries/tools/color.mjs +655 -0
  77. package/batteries/tools/color.mjs.map +1 -0
  78. package/batteries/tools/comparison/index.d.ts +29 -0
  79. package/batteries/tools/comparison.cjs +171 -0
  80. package/batteries/tools/comparison.cjs.map +1 -0
  81. package/batteries/tools/comparison.mjs +168 -0
  82. package/batteries/tools/comparison.mjs.map +1 -0
  83. package/batteries/tools/data_structure/index.d.ts +30 -0
  84. package/batteries/tools/data_structure.cjs +270 -0
  85. package/batteries/tools/data_structure.cjs.map +1 -0
  86. package/batteries/tools/data_structure.mjs +267 -0
  87. package/batteries/tools/data_structure.mjs.map +1 -0
  88. package/batteries/tools/datetime_extended/index.d.ts +51 -0
  89. package/batteries/tools/datetime_extended.cjs +309 -0
  90. package/batteries/tools/datetime_extended.cjs.map +1 -0
  91. package/batteries/tools/datetime_extended.mjs +302 -0
  92. package/batteries/tools/datetime_extended.mjs.map +1 -0
  93. package/batteries/tools/datetime_math/index.d.ts +36 -0
  94. package/batteries/tools/datetime_math.cjs +175 -0
  95. package/batteries/tools/datetime_math.cjs.map +1 -0
  96. package/batteries/tools/datetime_math.mjs +171 -0
  97. package/batteries/tools/datetime_math.mjs.map +1 -0
  98. package/batteries/tools/encoding/index.d.ts +36 -0
  99. package/batteries/tools/encoding.cjs +156 -0
  100. package/batteries/tools/encoding.cjs.map +1 -0
  101. package/batteries/tools/encoding.mjs +152 -0
  102. package/batteries/tools/encoding.mjs.map +1 -0
  103. package/batteries/tools/formatting/index.d.ts +28 -0
  104. package/batteries/tools/formatting.cjs +120 -0
  105. package/batteries/tools/formatting.cjs.map +1 -0
  106. package/batteries/tools/formatting.mjs +117 -0
  107. package/batteries/tools/formatting.mjs.map +1 -0
  108. package/batteries/tools/geo_basics/index.d.ts +33 -0
  109. package/batteries/tools/geo_basics.cjs +136 -0
  110. package/batteries/tools/geo_basics.cjs.map +1 -0
  111. package/batteries/tools/geo_basics.mjs +132 -0
  112. package/batteries/tools/geo_basics.mjs.map +1 -0
  113. package/batteries/tools/index.d.ts +32 -0
  114. package/batteries/tools/math/index.d.ts +37 -0
  115. package/batteries/tools/math.cjs +136 -0
  116. package/batteries/tools/math.cjs.map +1 -0
  117. package/batteries/tools/math.mjs +133 -0
  118. package/batteries/tools/math.mjs.map +1 -0
  119. package/batteries/tools/memory/index.d.ts +73 -0
  120. package/batteries/tools/memory.cjs +193 -0
  121. package/batteries/tools/memory.cjs.map +1 -0
  122. package/batteries/tools/memory.mjs +187 -0
  123. package/batteries/tools/memory.mjs.map +1 -0
  124. package/batteries/tools/parsing/index.d.ts +47 -0
  125. package/batteries/tools/parsing.cjs +191 -0
  126. package/batteries/tools/parsing.cjs.map +1 -0
  127. package/batteries/tools/parsing.mjs +185 -0
  128. package/batteries/tools/parsing.mjs.map +1 -0
  129. package/batteries/tools/retrievables/index.d.ts +81 -0
  130. package/batteries/tools/retrievables.cjs +215 -0
  131. package/batteries/tools/retrievables.cjs.map +1 -0
  132. package/batteries/tools/retrievables.mjs +209 -0
  133. package/batteries/tools/retrievables.mjs.map +1 -0
  134. package/batteries/tools/standing_instructions/index.d.ts +64 -0
  135. package/batteries/tools/standing_instructions.cjs +126 -0
  136. package/batteries/tools/standing_instructions.cjs.map +1 -0
  137. package/batteries/tools/standing_instructions.mjs +121 -0
  138. package/batteries/tools/standing_instructions.mjs.map +1 -0
  139. package/batteries/tools/statistics/index.d.ts +46 -0
  140. package/batteries/tools/statistics.cjs +253 -0
  141. package/batteries/tools/statistics.cjs.map +1 -0
  142. package/batteries/tools/statistics.mjs +248 -0
  143. package/batteries/tools/statistics.mjs.map +1 -0
  144. package/batteries/tools/string_processing/index.d.ts +29 -0
  145. package/batteries/tools/string_processing.cjs +154 -0
  146. package/batteries/tools/string_processing.cjs.map +1 -0
  147. package/batteries/tools/string_processing.mjs +151 -0
  148. package/batteries/tools/string_processing.mjs.map +1 -0
  149. package/batteries/tools/structured_data/index.d.ts +34 -0
  150. package/batteries/tools/structured_data.cjs +189 -0
  151. package/batteries/tools/structured_data.cjs.map +1 -0
  152. package/batteries/tools/structured_data.mjs +185 -0
  153. package/batteries/tools/structured_data.mjs.map +1 -0
  154. package/batteries/tools/text_analysis/index.d.ts +31 -0
  155. package/batteries/tools/text_analysis.cjs +120 -0
  156. package/batteries/tools/text_analysis.cjs.map +1 -0
  157. package/batteries/tools/text_analysis.mjs +117 -0
  158. package/batteries/tools/text_analysis.mjs.map +1 -0
  159. package/batteries/tools/text_comparison/index.d.ts +28 -0
  160. package/batteries/tools/text_comparison.cjs +96 -0
  161. package/batteries/tools/text_comparison.cjs.map +1 -0
  162. package/batteries/tools/text_comparison.mjs +93 -0
  163. package/batteries/tools/text_comparison.mjs.map +1 -0
  164. package/batteries/tools/time/index.d.ts +27 -0
  165. package/batteries/tools/time.cjs +63 -0
  166. package/batteries/tools/time.cjs.map +1 -0
  167. package/batteries/tools/time.mjs +60 -0
  168. package/batteries/tools/time.mjs.map +1 -0
  169. package/batteries/tools/unit_conversion/index.d.ts +19 -0
  170. package/batteries/tools/unit_conversion.cjs +452 -0
  171. package/batteries/tools/unit_conversion.cjs.map +1 -0
  172. package/batteries/tools/unit_conversion.mjs +450 -0
  173. package/batteries/tools/unit_conversion.mjs.map +1 -0
  174. package/batteries/tools.cjs +80 -0
  175. package/batteries/tools.mjs +21 -0
  176. package/batteries.cjs +142 -0
  177. package/batteries.mjs +30 -0
  178. package/chunk-KmRHZBOW.js +35 -0
  179. package/common-DeZaonK1.mjs +208 -0
  180. package/common-DeZaonK1.mjs.map +1 -0
  181. package/common-Od8edUXU.js +232 -0
  182. package/common-Od8edUXU.js.map +1 -0
  183. package/common.cjs +31 -0
  184. package/common.d.ts +108 -0
  185. package/common.mjs +8 -0
  186. package/dispatch_runner-9j6bXHL3.mjs +1609 -0
  187. package/dispatch_runner-9j6bXHL3.mjs.map +1 -0
  188. package/dispatch_runner-CsoH0nld.js +1627 -0
  189. package/dispatch_runner-CsoH0nld.js.map +1 -0
  190. package/dispatch_runner.cjs +3 -0
  191. package/dispatch_runner.d.ts +17 -0
  192. package/dispatch_runner.mjs +2 -0
  193. package/exceptions-D5YrO9Vm.js +280 -0
  194. package/exceptions-D5YrO9Vm.js.map +1 -0
  195. package/exceptions-NrzIHw_R.mjs +244 -0
  196. package/exceptions-NrzIHw_R.mjs.map +1 -0
  197. package/exceptions.cjs +33 -0
  198. package/exceptions.d.ts +52 -0
  199. package/exceptions.mjs +3 -0
  200. package/factories.cjs +4 -0
  201. package/factories.d.ts +39 -0
  202. package/factories.mjs +2 -0
  203. package/forge.cjs +9 -0
  204. package/forge.d.ts +49 -0
  205. package/forge.mjs +5 -0
  206. package/guards.cjs +96 -0
  207. package/guards.cjs.map +1 -0
  208. package/guards.d.ts +83 -0
  209. package/guards.mjs +72 -0
  210. package/guards.mjs.map +1 -0
  211. package/index.cjs +107 -0
  212. package/index.cjs.map +1 -0
  213. package/index.d.ts +18 -0
  214. package/index.mjs +31 -0
  215. package/index.mjs.map +1 -0
  216. package/lib/classes/artifact_tool.d.ts +129 -0
  217. package/lib/classes/base_exception.d.ts +83 -0
  218. package/lib/classes/identity.d.ts +71 -0
  219. package/lib/classes/media.d.ts +326 -0
  220. package/lib/classes/memory.d.ts +72 -0
  221. package/lib/classes/message.d.ts +137 -0
  222. package/lib/classes/registry.d.ts +79 -0
  223. package/lib/classes/retrievable.d.ts +100 -0
  224. package/lib/classes/spooled_artifact.d.ts +296 -0
  225. package/lib/classes/spooled_json_artifact.d.ts +158 -0
  226. package/lib/classes/spooled_markdown_artifact.d.ts +202 -0
  227. package/lib/classes/thought.d.ts +142 -0
  228. package/lib/classes/tokenizable.d.ts +124 -0
  229. package/lib/classes/tool.d.ts +228 -0
  230. package/lib/classes/tool_call.d.ts +190 -0
  231. package/lib/classes/tool_registry.d.ts +159 -0
  232. package/lib/classes/turn_gate.d.ts +109 -0
  233. package/lib/contracts/dispatch_context.d.ts +345 -0
  234. package/lib/contracts/media_reader.d.ts +60 -0
  235. package/lib/contracts/spool_reader.d.ts +80 -0
  236. package/lib/contracts/spooled_artifact_constructor.d.ts +38 -0
  237. package/lib/contracts/turn_runner_config.d.ts +101 -0
  238. package/lib/contracts/turn_runner_context.d.ts +267 -0
  239. package/lib/dispatch_runner.d.ts +98 -0
  240. package/lib/exceptions/runtime.d.ts +370 -0
  241. package/lib/helpers/media_readers.d.ts +39 -0
  242. package/lib/turn_runner.d.ts +144 -0
  243. package/lib/types/dispatch_context.d.ts +233 -0
  244. package/lib/types/dispatch_runner.d.ts +387 -0
  245. package/lib/types/turn_runner.d.ts +322 -0
  246. package/lib/utils/canonical_json.d.ts +18 -0
  247. package/lib/utils/exceptions.d.ts +78 -0
  248. package/lib/utils/guards.d.ts +32 -0
  249. package/lib/utils/validation.d.ts +77 -0
  250. package/package.json +334 -0
  251. package/runtime-BJVkrGQe.js +519 -0
  252. package/runtime-BJVkrGQe.js.map +1 -0
  253. package/runtime-CrEPIFgr.mjs +346 -0
  254. package/runtime-CrEPIFgr.mjs.map +1 -0
  255. package/skills/adk-assembly/SKILL.md +109 -0
  256. package/skills/adk-assembly/references/assembly-contract.md +66 -0
  257. package/skills/adk-assembly/references/executors-tools-pipelines-events.md +113 -0
  258. package/skills/adk-assembly/references/first-integration.md +93 -0
  259. package/skills/adk-assembly/references/storage-and-context.md +102 -0
  260. package/spooled_artifact-C5ZtGxuJ.mjs +544 -0
  261. package/spooled_artifact-C5ZtGxuJ.mjs.map +1 -0
  262. package/spooled_artifact-Cm9Te22K.js +568 -0
  263. package/spooled_artifact-Cm9Te22K.js.map +1 -0
  264. package/spooled_artifact.cjs +7 -0
  265. package/spooled_artifact.d.ts +40 -0
  266. package/spooled_artifact.mjs +3 -0
  267. package/spooled_markdown_artifact-BpUJol0W.mjs +771 -0
  268. package/spooled_markdown_artifact-BpUJol0W.mjs.map +1 -0
  269. package/spooled_markdown_artifact-RRB113sy.js +786 -0
  270. package/spooled_markdown_artifact-RRB113sy.js.map +1 -0
  271. package/thought-CDb457b4.mjs +470 -0
  272. package/thought-CDb457b4.mjs.map +1 -0
  273. package/thought-DuN2PgdO.js +494 -0
  274. package/thought-DuN2PgdO.js.map +1 -0
  275. package/tool-COSeH8I6.js +302 -0
  276. package/tool-COSeH8I6.js.map +1 -0
  277. package/tool-D2WB1EA1.mjs +296 -0
  278. package/tool-D2WB1EA1.mjs.map +1 -0
  279. package/tool_call-BKyyxGaZ.mjs +578 -0
  280. package/tool_call-BKyyxGaZ.mjs.map +1 -0
  281. package/tool_call-DFgzcVcU.js +608 -0
  282. package/tool_call-DFgzcVcU.js.map +1 -0
  283. package/tool_registry-Dkfprsck.js +641 -0
  284. package/tool_registry-Dkfprsck.js.map +1 -0
  285. package/tool_registry-DqLOyGyG.mjs +592 -0
  286. package/tool_registry-DqLOyGyG.mjs.map +1 -0
  287. package/turn_runner-CMm2BHdX.js +615 -0
  288. package/turn_runner-CMm2BHdX.js.map +1 -0
  289. package/turn_runner-y7eyEcJH.mjs +603 -0
  290. package/turn_runner-y7eyEcJH.mjs.map +1 -0
  291. package/turn_runner.cjs +3 -0
  292. package/turn_runner.d.ts +21 -0
  293. package/turn_runner.mjs +2 -0
  294. package/types.cjs +1 -0
  295. package/types.d.ts +56 -0
  296. package/types.mjs +0 -0
  297. package/vite-env.d.ts +23 -0
@@ -0,0 +1,659 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ require("../../chunk-KmRHZBOW.js");
3
+ require("../../common-Od8edUXU.js");
4
+ const require_tool = require("../../tool-COSeH8I6.js");
5
+ let _nhtio_validation = require("@nhtio/validation");
6
+ //#region src/batteries/tools/color/index.ts
7
+ /**
8
+ * Pre-constructed tools for color conversion and palette-oriented calculations.
9
+ *
10
+ * @module @nhtio/adk/batteries/tools/color
11
+ *
12
+ * @remarks
13
+ * Pre-constructed bundled tools for the `color` category. Import individually, the whole
14
+ * category, or import every tool via `@nhtio/adk/batteries`.
15
+ */
16
+ function hexToRgb(hex) {
17
+ const cleaned = hex.replace(/^#/, "");
18
+ let r;
19
+ let g;
20
+ let b;
21
+ if (cleaned.length === 3) {
22
+ r = Number.parseInt(cleaned[0] + cleaned[0], 16);
23
+ g = Number.parseInt(cleaned[1] + cleaned[1], 16);
24
+ b = Number.parseInt(cleaned[2] + cleaned[2], 16);
25
+ } else if (cleaned.length === 6) {
26
+ r = Number.parseInt(cleaned.slice(0, 2), 16);
27
+ g = Number.parseInt(cleaned.slice(2, 4), 16);
28
+ b = Number.parseInt(cleaned.slice(4, 6), 16);
29
+ } else return null;
30
+ if (Number.isNaN(r) || Number.isNaN(g) || Number.isNaN(b)) return null;
31
+ return {
32
+ r,
33
+ g,
34
+ b
35
+ };
36
+ }
37
+ function parseRgbString(input) {
38
+ const match = input.match(/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i);
39
+ if (!match) return null;
40
+ const r = Number.parseInt(match[1], 10);
41
+ const g = Number.parseInt(match[2], 10);
42
+ const b = Number.parseInt(match[3], 10);
43
+ if (r > 255 || g > 255 || b > 255) return null;
44
+ return {
45
+ r,
46
+ g,
47
+ b
48
+ };
49
+ }
50
+ function parseHslString(input) {
51
+ const match = input.match(/^hsl\(\s*(\d+)\s*,\s*(\d+)%?\s*,\s*(\d+)%?\s*\)$/i);
52
+ if (!match) return null;
53
+ return {
54
+ h: Number.parseInt(match[1], 10) % 360,
55
+ s: Math.min(100, Number.parseInt(match[2], 10)),
56
+ l: Math.min(100, Number.parseInt(match[3], 10))
57
+ };
58
+ }
59
+ var NAMED_COLORS = {
60
+ "black": "#000000",
61
+ "white": "#FFFFFF",
62
+ "transparent": "#FFFFFF",
63
+ "aqua": "#00FFFF",
64
+ "magenta": "#FF00FF",
65
+ "fuchsia": "#FF00FF",
66
+ "silver": "#C0C0C0",
67
+ "maroon": "#800000",
68
+ "olive": "#808000",
69
+ "navy": "#000080",
70
+ "coral": "#FF7F50",
71
+ "crimson": "#DC143C",
72
+ "gold": "#FFD700",
73
+ "ivory": "#FFFFF0",
74
+ "khaki": "#F0E68C",
75
+ "lavender": "#E6E6FA",
76
+ "plum": "#DDA0DD",
77
+ "salmon": "#FA8072",
78
+ "sienna": "#A0522D",
79
+ "tan": "#D2B48C",
80
+ "tomato": "#FF6347",
81
+ "turquoise": "#40E0D0",
82
+ "violet": "#EE82EE",
83
+ "wheat": "#F5DEB3",
84
+ "red": "#F44336",
85
+ "red-lighten-5": "#FFEBEE",
86
+ "red-lighten-4": "#FFCDD2",
87
+ "red-lighten-3": "#EF9A9A",
88
+ "red-lighten-2": "#E57373",
89
+ "red-lighten-1": "#EF5350",
90
+ "red-darken-1": "#E53935",
91
+ "red-darken-2": "#D32F2F",
92
+ "red-darken-3": "#C62828",
93
+ "red-darken-4": "#B71C1C",
94
+ "red-accent-1": "#FF8A80",
95
+ "red-accent-2": "#FF5252",
96
+ "red-accent-3": "#FF1744",
97
+ "red-accent-4": "#D50000",
98
+ "pink": "#E91E63",
99
+ "pink-lighten-5": "#FCE4EC",
100
+ "pink-lighten-4": "#F8BBD0",
101
+ "pink-lighten-3": "#F48FB1",
102
+ "pink-lighten-2": "#F06292",
103
+ "pink-lighten-1": "#EC407A",
104
+ "pink-darken-1": "#D81B60",
105
+ "pink-darken-2": "#C2185B",
106
+ "pink-darken-3": "#AD1457",
107
+ "pink-darken-4": "#880E4F",
108
+ "pink-accent-1": "#FF80AB",
109
+ "pink-accent-2": "#FF4081",
110
+ "pink-accent-3": "#F50057",
111
+ "pink-accent-4": "#C51162",
112
+ "purple": "#9C27B0",
113
+ "purple-lighten-5": "#F3E5F5",
114
+ "purple-lighten-4": "#E1BEE7",
115
+ "purple-lighten-3": "#CE93D8",
116
+ "purple-lighten-2": "#BA68C8",
117
+ "purple-lighten-1": "#AB47BC",
118
+ "purple-darken-1": "#8E24AA",
119
+ "purple-darken-2": "#7B1FA2",
120
+ "purple-darken-3": "#6A1B9A",
121
+ "purple-darken-4": "#4A148C",
122
+ "purple-accent-1": "#EA80FC",
123
+ "purple-accent-2": "#E040FB",
124
+ "purple-accent-3": "#D500F9",
125
+ "purple-accent-4": "#AA00FF",
126
+ "deep-purple": "#673AB7",
127
+ "deep-purple-lighten-5": "#EDE7F6",
128
+ "deep-purple-lighten-4": "#D1C4E9",
129
+ "deep-purple-lighten-3": "#B39DDB",
130
+ "deep-purple-lighten-2": "#9575CD",
131
+ "deep-purple-lighten-1": "#7E57C2",
132
+ "deep-purple-darken-1": "#5E35B1",
133
+ "deep-purple-darken-2": "#512DA8",
134
+ "deep-purple-darken-3": "#4527A0",
135
+ "deep-purple-darken-4": "#311B92",
136
+ "deep-purple-accent-1": "#B388FF",
137
+ "deep-purple-accent-2": "#7C4DFF",
138
+ "deep-purple-accent-3": "#651FFF",
139
+ "deep-purple-accent-4": "#6200EA",
140
+ "indigo": "#3F51B5",
141
+ "indigo-lighten-5": "#E8EAF6",
142
+ "indigo-lighten-4": "#C5CAE9",
143
+ "indigo-lighten-3": "#9FA8DA",
144
+ "indigo-lighten-2": "#7986CB",
145
+ "indigo-lighten-1": "#5C6BC0",
146
+ "indigo-darken-1": "#3949AB",
147
+ "indigo-darken-2": "#303F9F",
148
+ "indigo-darken-3": "#283593",
149
+ "indigo-darken-4": "#1A237E",
150
+ "indigo-accent-1": "#8C9EFF",
151
+ "indigo-accent-2": "#536DFE",
152
+ "indigo-accent-3": "#3D5AFE",
153
+ "indigo-accent-4": "#304FFE",
154
+ "blue": "#2196F3",
155
+ "blue-lighten-5": "#E3F2FD",
156
+ "blue-lighten-4": "#BBDEFB",
157
+ "blue-lighten-3": "#90CAF9",
158
+ "blue-lighten-2": "#64B5F6",
159
+ "blue-lighten-1": "#42A5F5",
160
+ "blue-darken-1": "#1E88E5",
161
+ "blue-darken-2": "#1976D2",
162
+ "blue-darken-3": "#1565C0",
163
+ "blue-darken-4": "#0D47A1",
164
+ "blue-accent-1": "#82B1FF",
165
+ "blue-accent-2": "#448AFF",
166
+ "blue-accent-3": "#2979FF",
167
+ "blue-accent-4": "#2962FF",
168
+ "light-blue": "#03A9F4",
169
+ "light-blue-lighten-5": "#E1F5FE",
170
+ "light-blue-lighten-4": "#B3E5FC",
171
+ "light-blue-lighten-3": "#81D4FA",
172
+ "light-blue-lighten-2": "#4FC3F7",
173
+ "light-blue-lighten-1": "#29B6F6",
174
+ "light-blue-darken-1": "#039BE5",
175
+ "light-blue-darken-2": "#0288D1",
176
+ "light-blue-darken-3": "#0277BD",
177
+ "light-blue-darken-4": "#01579B",
178
+ "light-blue-accent-1": "#80D8FF",
179
+ "light-blue-accent-2": "#40C4FF",
180
+ "light-blue-accent-3": "#00B0FF",
181
+ "light-blue-accent-4": "#0091EA",
182
+ "cyan": "#00BCD4",
183
+ "cyan-lighten-5": "#E0F7FA",
184
+ "cyan-lighten-4": "#B2EBF2",
185
+ "cyan-lighten-3": "#80DEEA",
186
+ "cyan-lighten-2": "#4DD0E1",
187
+ "cyan-lighten-1": "#26C6DA",
188
+ "cyan-darken-1": "#00ACC1",
189
+ "cyan-darken-2": "#0097A7",
190
+ "cyan-darken-3": "#00838F",
191
+ "cyan-darken-4": "#006064",
192
+ "cyan-accent-1": "#84FFFF",
193
+ "cyan-accent-2": "#18FFFF",
194
+ "cyan-accent-3": "#00E5FF",
195
+ "cyan-accent-4": "#00B8D4",
196
+ "teal": "#009688",
197
+ "teal-lighten-5": "#E0F2F1",
198
+ "teal-lighten-4": "#B2DFDB",
199
+ "teal-lighten-3": "#80CBC4",
200
+ "teal-lighten-2": "#4DB6AC",
201
+ "teal-lighten-1": "#26A69A",
202
+ "teal-darken-1": "#00897B",
203
+ "teal-darken-2": "#00796B",
204
+ "teal-darken-3": "#00695C",
205
+ "teal-darken-4": "#004D40",
206
+ "teal-accent-1": "#A7FFEB",
207
+ "teal-accent-2": "#64FFDA",
208
+ "teal-accent-3": "#1DE9B6",
209
+ "teal-accent-4": "#00BFA5",
210
+ "green": "#4CAF50",
211
+ "green-lighten-5": "#E8F5E9",
212
+ "green-lighten-4": "#C8E6C9",
213
+ "green-lighten-3": "#A5D6A7",
214
+ "green-lighten-2": "#81C784",
215
+ "green-lighten-1": "#66BB6A",
216
+ "green-darken-1": "#43A047",
217
+ "green-darken-2": "#388E3C",
218
+ "green-darken-3": "#2E7D32",
219
+ "green-darken-4": "#1B5E20",
220
+ "green-accent-1": "#B9F6CA",
221
+ "green-accent-2": "#69F0AE",
222
+ "green-accent-3": "#00E676",
223
+ "green-accent-4": "#00C853",
224
+ "light-green": "#8BC34A",
225
+ "light-green-lighten-5": "#F1F8E9",
226
+ "light-green-lighten-4": "#DCEDC8",
227
+ "light-green-lighten-3": "#C5E1A5",
228
+ "light-green-lighten-2": "#AED581",
229
+ "light-green-lighten-1": "#9CCC65",
230
+ "light-green-darken-1": "#7CB342",
231
+ "light-green-darken-2": "#689F38",
232
+ "light-green-darken-3": "#558B2F",
233
+ "light-green-darken-4": "#33691E",
234
+ "light-green-accent-1": "#CCFF90",
235
+ "light-green-accent-2": "#B2FF59",
236
+ "light-green-accent-3": "#76FF03",
237
+ "light-green-accent-4": "#64DD17",
238
+ "lime": "#CDDC39",
239
+ "lime-lighten-5": "#F9FBE7",
240
+ "lime-lighten-4": "#F0F4C3",
241
+ "lime-lighten-3": "#E6EE9C",
242
+ "lime-lighten-2": "#DCE775",
243
+ "lime-lighten-1": "#D4E157",
244
+ "lime-darken-1": "#C0CA33",
245
+ "lime-darken-2": "#AFB42B",
246
+ "lime-darken-3": "#9E9D24",
247
+ "lime-darken-4": "#827717",
248
+ "lime-accent-1": "#F4FF81",
249
+ "lime-accent-2": "#EEFF41",
250
+ "lime-accent-3": "#C6FF00",
251
+ "lime-accent-4": "#AEEA00",
252
+ "yellow": "#FFEB3B",
253
+ "yellow-lighten-5": "#FFFDE7",
254
+ "yellow-lighten-4": "#FFF9C4",
255
+ "yellow-lighten-3": "#FFF59D",
256
+ "yellow-lighten-2": "#FFF176",
257
+ "yellow-lighten-1": "#FFEE58",
258
+ "yellow-darken-1": "#FDD835",
259
+ "yellow-darken-2": "#FBC02D",
260
+ "yellow-darken-3": "#F9A825",
261
+ "yellow-darken-4": "#F57F17",
262
+ "yellow-accent-1": "#FFFF8D",
263
+ "yellow-accent-2": "#FFFF00",
264
+ "yellow-accent-3": "#FFEA00",
265
+ "yellow-accent-4": "#FFD600",
266
+ "amber": "#FFC107",
267
+ "amber-lighten-5": "#FFF8E1",
268
+ "amber-lighten-4": "#FFECB3",
269
+ "amber-lighten-3": "#FFE082",
270
+ "amber-lighten-2": "#FFD54F",
271
+ "amber-lighten-1": "#FFCA28",
272
+ "amber-darken-1": "#FFB300",
273
+ "amber-darken-2": "#FFA000",
274
+ "amber-darken-3": "#FF8F00",
275
+ "amber-darken-4": "#FF6F00",
276
+ "amber-accent-1": "#FFE57F",
277
+ "amber-accent-2": "#FFD740",
278
+ "amber-accent-3": "#FFC400",
279
+ "amber-accent-4": "#FFAB00",
280
+ "orange": "#FF9800",
281
+ "orange-lighten-5": "#FFF3E0",
282
+ "orange-lighten-4": "#FFE0B2",
283
+ "orange-lighten-3": "#FFCC80",
284
+ "orange-lighten-2": "#FFB74D",
285
+ "orange-lighten-1": "#FFA726",
286
+ "orange-darken-1": "#FB8C00",
287
+ "orange-darken-2": "#F57C00",
288
+ "orange-darken-3": "#EF6C00",
289
+ "orange-darken-4": "#E65100",
290
+ "orange-accent-1": "#FFD180",
291
+ "orange-accent-2": "#FFAB40",
292
+ "orange-accent-3": "#FF9100",
293
+ "orange-accent-4": "#FF6D00",
294
+ "deep-orange": "#FF5722",
295
+ "deep-orange-lighten-5": "#FBE9E7",
296
+ "deep-orange-lighten-4": "#FFCCBC",
297
+ "deep-orange-lighten-3": "#FFAB91",
298
+ "deep-orange-lighten-2": "#FF8A65",
299
+ "deep-orange-lighten-1": "#FF7043",
300
+ "deep-orange-darken-1": "#F4511E",
301
+ "deep-orange-darken-2": "#E64A19",
302
+ "deep-orange-darken-3": "#D84315",
303
+ "deep-orange-darken-4": "#BF360C",
304
+ "deep-orange-accent-1": "#FF9E80",
305
+ "deep-orange-accent-2": "#FF6E40",
306
+ "deep-orange-accent-3": "#FF3D00",
307
+ "deep-orange-accent-4": "#DD2C00",
308
+ "brown": "#795548",
309
+ "brown-lighten-5": "#EFEBE9",
310
+ "brown-lighten-4": "#D7CCC8",
311
+ "brown-lighten-3": "#BCAAA4",
312
+ "brown-lighten-2": "#A1887F",
313
+ "brown-lighten-1": "#8D6E63",
314
+ "brown-darken-1": "#6D4C41",
315
+ "brown-darken-2": "#5D4037",
316
+ "brown-darken-3": "#4E342E",
317
+ "brown-darken-4": "#3E2723",
318
+ "blue-grey": "#607D8B",
319
+ "blue-grey-lighten-5": "#ECEFF1",
320
+ "blue-grey-lighten-4": "#CFD8DC",
321
+ "blue-grey-lighten-3": "#B0BEC5",
322
+ "blue-grey-lighten-2": "#90A4AE",
323
+ "blue-grey-lighten-1": "#78909C",
324
+ "blue-grey-darken-1": "#546E7A",
325
+ "blue-grey-darken-2": "#455A64",
326
+ "blue-grey-darken-3": "#37474F",
327
+ "blue-grey-darken-4": "#263238",
328
+ "grey": "#9E9E9E",
329
+ "gray": "#9E9E9E",
330
+ "grey-lighten-5": "#FAFAFA",
331
+ "grey-lighten-4": "#F5F5F5",
332
+ "grey-lighten-3": "#EEEEEE",
333
+ "grey-lighten-2": "#E0E0E0",
334
+ "grey-lighten-1": "#BDBDBD",
335
+ "grey-darken-1": "#757575",
336
+ "grey-darken-2": "#616161",
337
+ "grey-darken-3": "#424242",
338
+ "grey-darken-4": "#212121"
339
+ };
340
+ function parseColor(input) {
341
+ const trimmed = input.trim();
342
+ const lower = trimmed.toLowerCase();
343
+ if (NAMED_COLORS[lower]) return hexToRgb(NAMED_COLORS[lower]);
344
+ if (trimmed.startsWith("#")) return hexToRgb(trimmed);
345
+ if (lower.startsWith("rgb(")) return parseRgbString(trimmed);
346
+ if (lower.startsWith("hsl(")) {
347
+ const hsl = parseHslString(trimmed);
348
+ return hsl ? hslToRgb(hsl) : null;
349
+ }
350
+ return hexToRgb(trimmed);
351
+ }
352
+ function rgbToHex(rgb) {
353
+ const toHex = (n) => Math.round(Math.max(0, Math.min(255, n))).toString(16).padStart(2, "0");
354
+ return `#${toHex(rgb.r)}${toHex(rgb.g)}${toHex(rgb.b)}`;
355
+ }
356
+ function rgbToHsl(rgb) {
357
+ const r = rgb.r / 255;
358
+ const g = rgb.g / 255;
359
+ const b = rgb.b / 255;
360
+ const max = Math.max(r, g, b);
361
+ const min = Math.min(r, g, b);
362
+ const l = (max + min) / 2;
363
+ if (max === min) return {
364
+ h: 0,
365
+ s: 0,
366
+ l: Math.round(l * 100)
367
+ };
368
+ const d = max - min;
369
+ const s = l > .5 ? d / (2 - max - min) : d / (max + min);
370
+ let h = 0;
371
+ if (max === r) h = ((g - b) / d + (g < b ? 6 : 0)) / 6;
372
+ else if (max === g) h = ((b - r) / d + 2) / 6;
373
+ else h = ((r - g) / d + 4) / 6;
374
+ return {
375
+ h: Math.round(h * 360),
376
+ s: Math.round(s * 100),
377
+ l: Math.round(l * 100)
378
+ };
379
+ }
380
+ function hslToRgb(hsl) {
381
+ const h = hsl.h / 360;
382
+ const s = hsl.s / 100;
383
+ const l = hsl.l / 100;
384
+ if (s === 0) {
385
+ const v = Math.round(l * 255);
386
+ return {
387
+ r: v,
388
+ g: v,
389
+ b: v
390
+ };
391
+ }
392
+ const hue2rgb = (p, q, t) => {
393
+ if (t < 0) t += 1;
394
+ if (t > 1) t -= 1;
395
+ if (t < 1 / 6) return p + (q - p) * 6 * t;
396
+ if (t < 1 / 2) return q;
397
+ if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
398
+ return p;
399
+ };
400
+ const q = l < .5 ? l * (1 + s) : l + s - l * s;
401
+ const p = 2 * l - q;
402
+ return {
403
+ r: Math.round(hue2rgb(p, q, h + 1 / 3) * 255),
404
+ g: Math.round(hue2rgb(p, q, h) * 255),
405
+ b: Math.round(hue2rgb(p, q, h - 1 / 3) * 255)
406
+ };
407
+ }
408
+ function relativeLuminance(rgb) {
409
+ const srgb = [
410
+ rgb.r,
411
+ rgb.g,
412
+ rgb.b
413
+ ].map((c) => {
414
+ const s = c / 255;
415
+ return s <= .03928 ? s / 12.92 : Math.pow((s + .055) / 1.055, 2.4);
416
+ });
417
+ return .2126 * srgb[0] + .7152 * srgb[1] + .0722 * srgb[2];
418
+ }
419
+ function contrastRatio(c1, c2) {
420
+ const l1 = relativeLuminance(c1);
421
+ const l2 = relativeLuminance(c2);
422
+ const lighter = Math.max(l1, l2);
423
+ const darker = Math.min(l1, l2);
424
+ return (lighter + .05) / (darker + .05);
425
+ }
426
+ function rotateHue(hsl, degrees) {
427
+ return {
428
+ h: (hsl.h + degrees + 360) % 360,
429
+ s: hsl.s,
430
+ l: hsl.l
431
+ };
432
+ }
433
+ function formatColor(rgb) {
434
+ const hex = rgbToHex(rgb);
435
+ const hsl = rgbToHsl(rgb);
436
+ return `${hex} / rgb(${rgb.r}, ${rgb.g}, ${rgb.b}) / hsl(${hsl.h}, ${hsl.s}%, ${hsl.l}%)`;
437
+ }
438
+ /**
439
+ * Compute the WCAG 2.1 contrast ratio between two colours.
440
+ *
441
+ * @remarks
442
+ * Accepts hex (`#rgb`, `#rrggbb`), `rgb()`, `hsl()`, or one of the CSS / Material Design named
443
+ * colours. Reports the ratio and pass/fail against WCAG AA and AAA at both normal and large text
444
+ * sizes. If the foreground/background combination fails AA Normal (4.5:1), the tool suggests
445
+ * lightened or darkened variants that would pass.
446
+ */
447
+ var colorContrastTool = new require_tool.Tool({
448
+ name: "color_contrast",
449
+ description: "Check the contrast ratio between two colors for WCAG accessibility compliance. Reports the contrast ratio and pass/fail for WCAG AA and AAA levels.",
450
+ inputSchema: _nhtio_validation.validator.object({
451
+ foreground: _nhtio_validation.validator.string().required().description("Foreground color (hex, rgb(), hsl(), or named color)."),
452
+ background: _nhtio_validation.validator.string().required().description("Background color (hex, rgb(), hsl(), or named color).")
453
+ }),
454
+ handler: async (args) => {
455
+ const { foreground, background } = args;
456
+ const fg = parseColor(foreground);
457
+ const bg = parseColor(background);
458
+ if (!fg) return `Error: could not parse foreground color "${foreground}".`;
459
+ if (!bg) return `Error: could not parse background color "${background}".`;
460
+ const ratio = contrastRatio(fg, bg);
461
+ const rounded = Math.round(ratio * 100) / 100;
462
+ const aaLargeText = ratio >= 3;
463
+ const aaNormalText = ratio >= 4.5;
464
+ const aaaLargeText = ratio >= 4.5;
465
+ const aaaNormalText = ratio >= 7;
466
+ const lines = [
467
+ `Foreground: ${formatColor(fg)}`,
468
+ `Background: ${formatColor(bg)}`,
469
+ `Contrast ratio: ${rounded}:1`,
470
+ "",
471
+ "WCAG 2.1 compliance:",
472
+ ` AA Normal text (4.5:1): ${aaNormalText ? "PASS" : "FAIL"}`,
473
+ ` AA Large text (3.0:1): ${aaLargeText ? "PASS" : "FAIL"}`,
474
+ ` AAA Normal text (7.0:1): ${aaaNormalText ? "PASS" : "FAIL"}`,
475
+ ` AAA Large text (4.5:1): ${aaaLargeText ? "PASS" : "FAIL"}`
476
+ ];
477
+ if (!aaNormalText) {
478
+ const fgHsl = rgbToHsl(fg);
479
+ const bgHsl = rgbToHsl(bg);
480
+ const fgLighter = fgHsl.l > bgHsl.l;
481
+ const suggestions = [];
482
+ if (fgLighter) {
483
+ const lighter = hslToRgb({
484
+ ...fgHsl,
485
+ l: Math.min(100, fgHsl.l + 15)
486
+ });
487
+ const darkerBg = hslToRgb({
488
+ ...bgHsl,
489
+ l: Math.max(0, bgHsl.l - 15)
490
+ });
491
+ if (contrastRatio(lighter, bg) >= 4.5) suggestions.push(` Lighten foreground to ${rgbToHex(lighter)} (ratio: ${Math.round(contrastRatio(lighter, bg) * 100) / 100}:1)`);
492
+ if (contrastRatio(fg, darkerBg) >= 4.5) suggestions.push(` Darken background to ${rgbToHex(darkerBg)} (ratio: ${Math.round(contrastRatio(fg, darkerBg) * 100) / 100}:1)`);
493
+ } else {
494
+ const darker = hslToRgb({
495
+ ...fgHsl,
496
+ l: Math.max(0, fgHsl.l - 15)
497
+ });
498
+ const lighterBg = hslToRgb({
499
+ ...bgHsl,
500
+ l: Math.min(100, bgHsl.l + 15)
501
+ });
502
+ if (contrastRatio(darker, bg) >= 4.5) suggestions.push(` Darken foreground to ${rgbToHex(darker)} (ratio: ${Math.round(contrastRatio(darker, bg) * 100) / 100}:1)`);
503
+ if (contrastRatio(fg, lighterBg) >= 4.5) suggestions.push(` Lighten background to ${rgbToHex(lighterBg)} (ratio: ${Math.round(contrastRatio(fg, lighterBg) * 100) / 100}:1)`);
504
+ }
505
+ if (suggestions.length > 0) {
506
+ lines.push("", "Suggestions to reach AA Normal (4.5:1):");
507
+ lines.push(...suggestions);
508
+ }
509
+ }
510
+ return lines.join("\n");
511
+ }
512
+ });
513
+ /**
514
+ * Generate a colour palette from a base colour using a named harmony.
515
+ *
516
+ * @remarks
517
+ * Supported schemes: `complementary`, `analogous`, `triadic`, `split-complementary`,
518
+ * `monochromatic`. Each entry reports its hex, rgb, and hsl forms, plus the contrast ratio
519
+ * relative to the base colour.
520
+ */
521
+ var colorSchemeTool = new require_tool.Tool({
522
+ name: "color_scheme",
523
+ description: "Generate a color palette from a base color. Supports complementary, analogous, triadic, split-complementary, and monochromatic schemes.",
524
+ inputSchema: _nhtio_validation.validator.object({
525
+ color: _nhtio_validation.validator.string().required().description("Base color (hex, rgb(), hsl(), or named color)."),
526
+ scheme: _nhtio_validation.validator.string().valid("complementary", "analogous", "triadic", "split-complementary", "monochromatic").required().description("Type of color scheme to generate.")
527
+ }),
528
+ handler: async (args) => {
529
+ const { color, scheme } = args;
530
+ const rgb = parseColor(color);
531
+ if (!rgb) return `Error: could not parse color "${color}".`;
532
+ const hsl = rgbToHsl(rgb);
533
+ const palette = [{
534
+ label: "Base",
535
+ rgb
536
+ }];
537
+ switch (scheme) {
538
+ case "complementary":
539
+ palette.push({
540
+ label: "Complement",
541
+ rgb: hslToRgb(rotateHue(hsl, 180))
542
+ });
543
+ break;
544
+ case "analogous":
545
+ palette.push({
546
+ label: "Analogous -30",
547
+ rgb: hslToRgb(rotateHue(hsl, -30))
548
+ });
549
+ palette.push({
550
+ label: "Analogous +30",
551
+ rgb: hslToRgb(rotateHue(hsl, 30))
552
+ });
553
+ break;
554
+ case "triadic":
555
+ palette.push({
556
+ label: "Triadic +120",
557
+ rgb: hslToRgb(rotateHue(hsl, 120))
558
+ });
559
+ palette.push({
560
+ label: "Triadic +240",
561
+ rgb: hslToRgb(rotateHue(hsl, 240))
562
+ });
563
+ break;
564
+ case "split-complementary":
565
+ palette.push({
566
+ label: "Split +150",
567
+ rgb: hslToRgb(rotateHue(hsl, 150))
568
+ });
569
+ palette.push({
570
+ label: "Split +210",
571
+ rgb: hslToRgb(rotateHue(hsl, 210))
572
+ });
573
+ break;
574
+ case "monochromatic":
575
+ palette.push({
576
+ label: "Light",
577
+ rgb: hslToRgb({
578
+ ...hsl,
579
+ l: Math.min(100, hsl.l + 20)
580
+ })
581
+ });
582
+ palette.push({
583
+ label: "Lighter",
584
+ rgb: hslToRgb({
585
+ ...hsl,
586
+ l: Math.min(100, hsl.l + 35)
587
+ })
588
+ });
589
+ palette.push({
590
+ label: "Dark",
591
+ rgb: hslToRgb({
592
+ ...hsl,
593
+ l: Math.max(0, hsl.l - 20)
594
+ })
595
+ });
596
+ palette.push({
597
+ label: "Darker",
598
+ rgb: hslToRgb({
599
+ ...hsl,
600
+ l: Math.max(0, hsl.l - 35)
601
+ })
602
+ });
603
+ break;
604
+ }
605
+ const lines = [`Color scheme: ${scheme}`, ""];
606
+ for (const entry of palette) lines.push(`${entry.label}: ${formatColor(entry.rgb)}`);
607
+ if (palette.length > 1) {
608
+ lines.push("", "Contrast ratios with base:");
609
+ for (const entry of palette.slice(1)) {
610
+ const ratio = Math.round(contrastRatio(rgb, entry.rgb) * 100) / 100;
611
+ lines.push(` ${entry.label}: ${ratio}:1`);
612
+ }
613
+ }
614
+ return lines.join("\n");
615
+ }
616
+ });
617
+ /**
618
+ * Lighten or darken a colour by a percentage of HSL lightness.
619
+ *
620
+ * @remarks
621
+ * `amount` is clamped to `[1, 100]`; `steps` is clamped to `[1, 10]`. With `steps > 1` the tool
622
+ * emits a ramp of progressively-adjusted colours, useful for generating tint/shade scales.
623
+ */
624
+ var colorAdjustTool = new require_tool.Tool({
625
+ name: "color_adjust",
626
+ description: "Lighten or darken a color by a specified amount. Returns the adjusted color in hex, rgb, and hsl formats. Can generate multiple steps for a tint/shade scale.",
627
+ inputSchema: _nhtio_validation.validator.object({
628
+ color: _nhtio_validation.validator.string().required().description("Color to adjust (hex, rgb(), hsl(), or named color)."),
629
+ action: _nhtio_validation.validator.string().valid("lighten", "darken").required().description("Whether to lighten or darken the color."),
630
+ amount: _nhtio_validation.validator.number().default(15).description("Amount to adjust per step (1-100, percentage of lightness). Default: 15."),
631
+ steps: _nhtio_validation.validator.number().default(1).description("Generate multiple steps of adjustment (1-10). Default: 1.")
632
+ }),
633
+ handler: async (args) => {
634
+ const { color, action, amount: rawAmount, steps: rawSteps } = args;
635
+ const rgb = parseColor(color);
636
+ if (!rgb) return `Error: could not parse color "${color}".`;
637
+ const amount = Math.max(1, Math.min(100, rawAmount));
638
+ const steps = Math.max(1, Math.min(10, rawSteps));
639
+ const hsl = rgbToHsl(rgb);
640
+ const lines = [`Original: ${formatColor(rgb)}`];
641
+ for (let i = 1; i <= steps; i++) {
642
+ const delta = amount * i;
643
+ const newL = action === "lighten" ? Math.min(100, hsl.l + delta) : Math.max(0, hsl.l - delta);
644
+ const adjusted = hslToRgb({
645
+ ...hsl,
646
+ l: newL
647
+ });
648
+ const label = steps === 1 ? `${action === "lighten" ? "Lightened" : "Darkened"} (${delta}%)` : `Step ${i} (${action} ${delta}%)`;
649
+ lines.push(`${label}: ${formatColor(adjusted)}`);
650
+ }
651
+ return lines.join("\n");
652
+ }
653
+ });
654
+ //#endregion
655
+ exports.colorAdjustTool = colorAdjustTool;
656
+ exports.colorContrastTool = colorContrastTool;
657
+ exports.colorSchemeTool = colorSchemeTool;
658
+
659
+ //# sourceMappingURL=color.cjs.map