* @brief Appends meta.fetchScriptingDocs + meta.howTo + meta.loadSkill. */
| 2214 | * @brief Appends meta.fetchScriptingDocs + meta.howTo + meta.loadSkill. |
| 2215 | */ |
| 2216 | static void appendReferenceMetaTools(QJsonArray& out) |
| 2217 | { |
| 2218 | { |
| 2219 | auto kindProp = |
| 2220 | stringProp(QStringLiteral("Which scripting reference to fetch. The doc kinds return the " |
| 2221 | "canonical API surface, idiomatic patterns, and worked examples " |
| 2222 | "for that scripting context. sdk_js / sdk_lua return the actual " |
| 2223 | "generated SerialStudio SDK source -- the authoritative listing " |
| 2224 | "of every callable (io.*, tableGet, deviceWrite, notify*, delay, " |
| 2225 | "SerialStudio.Hex, ...); fetch these to confirm exact signatures."), |
| 2226 | QJsonArray{QStringLiteral("frame_parser_js"), |
| 2227 | QStringLiteral("frame_parser_lua"), |
| 2228 | QStringLiteral("transform_js"), |
| 2229 | QStringLiteral("transform_lua"), |
| 2230 | QStringLiteral("output_widget_js"), |
| 2231 | QStringLiteral("painter_js"), |
| 2232 | QStringLiteral("control_script_js"), |
| 2233 | QStringLiteral("sdk_js"), |
| 2234 | QStringLiteral("sdk_lua")}); |
| 2235 | auto schema = objectSchemaWithProperty(QStringLiteral("kind"), kindProp, true); |
| 2236 | out.append(makeMetaTool(QStringLiteral("meta.fetchScriptingDocs"), |
| 2237 | QStringLiteral("Fetch the Serial Studio scripting reference for one " |
| 2238 | "scripting context (frame parser JS / " |
| 2239 | "Lua, value transform JS / Lua, output-widget JS, " |
| 2240 | "painter JS, control script JS, or the generated " |
| 2241 | "SDK source). Call this BEFORE writing or modifying " |
| 2242 | "any user script -- the available APIs differ " |
| 2243 | "between contexts and you must not invent function " |
| 2244 | "names. Returns markdown."), |
| 2245 | schema)); |
| 2246 | } |
| 2247 | |
| 2248 | { |
| 2249 | QJsonArray taskEnum; |
| 2250 | for (const auto& t : AI::ContextBuilder::howToTasks()) |
| 2251 | taskEnum.append(t); |
| 2252 | |
| 2253 | auto taskProp = |
| 2254 | stringProp(QStringLiteral("Which workflow recipe to fetch. Each returns a numbered list " |
| 2255 | "of the exact tool calls to make in order, with the parameters " |
| 2256 | "and gotchas that the API surface alone won't tell you."), |
| 2257 | taskEnum); |
| 2258 | auto schema = objectSchemaWithProperty(QStringLiteral("task"), taskProp, true); |
| 2259 | out.append(makeMetaTool(QStringLiteral("meta.howTo"), |
| 2260 | QStringLiteral("Fetch a step-by-step recipe for a common Serial " |
| 2261 | "Studio workflow. Call this BEFORE acting on any " |
| 2262 | "request that matches one of the recipe ids " |
| 2263 | "(adding a painter, building an executive " |
| 2264 | "dashboard, attaching an output widget, etc). " |
| 2265 | "Recipes are short and authoritative -- follow " |
| 2266 | "them in order rather than improvising."), |
| 2267 | schema)); |
| 2268 | } |
| 2269 | |
| 2270 | { |
| 2271 | QJsonArray skillEnum; |
| 2272 | for (const auto& s : AI::ContextBuilder::skillIds()) |
| 2273 | skillEnum.append(s); |
no test coverage detected