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