diff --git a/plugins/eritan561006-png/minimax-aerospace-design/.minimax-plugin/plugin.json b/plugins/eritan561006-png/minimax-aerospace-design/.minimax-plugin/plugin.json new file mode 100644 index 00000000..5654112e --- /dev/null +++ b/plugins/eritan561006-png/minimax-aerospace-design/.minimax-plugin/plugin.json @@ -0,0 +1,33 @@ +{ + "schemaVersion": 1, + "name": "minimax-aerospace-design", + "displayName": "MiniMax 航空航天设计", + "version": "1.0.0", + "description": "非武器用途的航空航天科研与工程设计插件:内置 minimax_aerospace_design_prompt 提示词生成工具(MCP)、编辑器上方的设计提示词面板,并配套总体设计、三维建模、几何分析、结果可视化流程技能与独立几何审查子代理。", + "author": "MiniMax370608", + "icon": "icon.png", + "darkIcon": "icon-dark.png", + "category": "Science & Healthcare", + "exampleQueries": [ + "帮我生成一段小型民用无人机巡航段机翼设计的工程提示词。", + "用 SolidWorks 建立参数化机翼梁并生成工程图。", + "审查这个三维装配的干涉与质量属性,指出结构风险。" + ], + "apps": [], + "mcpServers": [ + "minimax-aerospace-design.mcp.json" + ], + "skills": [ + "skills/aerospace-design-prompt/SKILL.md", + "skills/aerospace-research-design/SKILL.md", + "skills/aerospace-3d-modeling/SKILL.md", + "skills/aerospace-3d-analysis/SKILL.md", + "skills/aerospace-3d-modeling-visualizer/SKILL.md" + ], + "agents": [ + "agents/geometry-reviewer.md" + ], + "hooks": [ + "hooks/hooks.json" + ] +} diff --git a/plugins/eritan561006-png/minimax-aerospace-design/LICENSE b/plugins/eritan561006-png/minimax-aerospace-design/LICENSE new file mode 100644 index 00000000..125be1b8 --- /dev/null +++ b/plugins/eritan561006-png/minimax-aerospace-design/LICENSE @@ -0,0 +1,192 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + Copyright 2026 MCode Plugins contributors + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/plugins/eritan561006-png/minimax-aerospace-design/README.md b/plugins/eritan561006-png/minimax-aerospace-design/README.md new file mode 100644 index 00000000..ad2706cc --- /dev/null +++ b/plugins/eritan561006-png/minimax-aerospace-design/README.md @@ -0,0 +1,73 @@ +# Minimax Aerospace Design + +Non-weapon aerospace research and engineering design for MiniMax Code. It turns a vague +aerospace requirement into a structured, reproducible Chinese engineering brief, and then +carries that brief through parametric CAD, aerodynamic, structural and thermal analysis. + +## Try it + +```text +帮我生成一段小型民用无人机巡航段机翼设计的工程提示词。 +``` + +Expected result: the `minimax_aerospace_design_prompt` tool returns one complete Chinese +prompt that fixes the task, the constraints, the toolchain policy, the deliverables and the +output format for the engineering work. Paste it into the composer, or let the agent execute +it with the Skills below. + +## What is included + +- **MCP server `minimax-aerospace-design`** - one tool, `minimax_aerospace_design_prompt`. + It takes a `task` (required), an optional `cad_tool` (leave it empty or pass + `recommend one` to have the toolchain recommended) and optional `deliverables`. + The server is a single standard-library Python script: no dependencies, no build step. +- **Skill `minimax-aerospace-design`** - the entry point that routes a request to the right + workflow. +- **Skill `aerospace-design-prompt`** - when to call the tool and how to run the workflow the + generated brief defines. +- **Skill `aerospace-research-design`** - requirement clarification, design review, standards + checking, and the boundary between concept work, simulation and certification. +- **Skill `aerospace-3d-modeling`** - parametric CAD parts and assemblies, engineering drawings, + STEP/STL/FCStd/SLDPRT export, and model verification. +- **Skill `aerospace-3d-analysis`** - aerodynamic geometry and CFD hand-off, structural load + cases and finite-element setup, thermal behaviour, and traceable engineering statements. +- **Skill `aerospace-3d-modeling-visualizer`** - optional panel that renders an existing + model-verification result. The business Skill stays complete on its own. + +## Requirements + +- `python3` (Python 3.9 or newer) on `PATH`. The MCP server uses only the standard library. +- No account, no API key, no paid service, no install script, no native binary. + +## Supported platforms + +macOS, Linux and Windows, wherever `python3` is available. On Windows, expose the launcher as +`python3` if the default name differs. + +## Data and network + +- The MCP server runs locally over stdio and makes no network requests. +- No credentials are read, stored or required; no telemetry is sent. +- The generated brief stays on the machine that produced it. + +## Scope + +Civil, academic and student non-weapon aerospace work only. The Skills decline weapon, +munition, targeting and strike-optimisation requests, and never present a simulation result as +an airworthiness, structural-safety or flight-safety conclusion. + +## Compatibility note + +This package ships two manifests: the portable Agent Plugins 1.0 one (`plugin.json` and +`mcp.json`) and the MiniMax one (`.minimax-plugin/plugin.json`). MiniMax Code reads the valid +root `plugin.json` first, so **installing this package directly from GitHub gives you the +Skills and the MCP server only**. + +The following declarations live in the MiniMax manifest and therefore apply only to installs that +keep `.minimax-plugin/plugin.json`: the composer band and designer panel (the `hooks/` +extension), the `geometry-reviewer` subagent, the icons, the category and the example queries. +See `docs/plugin-compatibility.md` in the repository for the two runtime layouts. + +## License + +Apache-2.0. See `LICENSE`. diff --git a/plugins/eritan561006-png/minimax-aerospace-design/agents/geometry-reviewer.md b/plugins/eritan561006-png/minimax-aerospace-design/agents/geometry-reviewer.md new file mode 100644 index 00000000..e82eb6af --- /dev/null +++ b/plugins/eritan561006-png/minimax-aerospace-design/agents/geometry-reviewer.md @@ -0,0 +1,65 @@ +--- +name: geometry-reviewer +description: Independently reviews an aerospace 3D model or modelling plan for geometry errors, assembly interference, mass-property plausibility and drawing completeness, without modifying it. Delegate here for a second, non-authoring opinion before a 3D deliverable is released or exported. +tools: [read, grep, glob, bash] +mcpServers: [solidworks, blender, cq-viewer] +skills: [aerospace-research-design] +x-mavis: + displayName: 几何审查员 +--- + +You are an independent aerospace geometry reviewer. You did not author the model +under review, and you do not modify it. + +## Scope + +Non-weapon aerospace work only: civil, academic and student projects. Decline +weapon, munition, targeting or strike-optimisation reviews and say so plainly. + +## How to work + +1. Establish what you are reviewing: the model file, its export, the parameter + table, the drawing set, or only a written plan. State which, and adjust your + confidence accordingly. +2. Work from the artifact, not from the author's description of it. If you can + query the CAD or mesh engines (SolidWorks, Blender, CQ-Viewer), use them to + read the real geometry: feature tree, mass properties, interference, surface + inspection, render views. +3. If the geometry is not reachable, say so plainly and review the plan and + parameters instead. Never invent measurements, masses, clearances or results. + +## What to check + +- **Units and frames** - one unit system throughout, coordinate system and origin + stated, no silent mix of mm with m, no sign confusion in a symmetric feature. +- **Parameter integrity** - every dimension traceable to a parameter row; no + hard-coded values hidden in the feature tree; assumptions flagged. +- **Feature tree** - driving sketches fully defined, feature order sensible, + no unexplained suppressed features, loft and sweep sections matched. +- **Mass properties** - volume and mass plausible for the material and scale; + compare with a density x volume estimate and report the deviation. +- **Interference and clearance** - mating parts do not interfere; required fit + classes and clearances are stated and met. +- **Manufacturability** - features the chosen process can actually produce; + wall thickness, draft, radii and tolerances consistent with the process. +- **Drawing completeness** - views, dimensions, datums, tolerances, material + callouts and title block present; every dimension traceable to the model. +- **Analysis readiness** - watertight and mesh-ready if the model is destined + for CFD or FEA; tessellation tolerance defensible against the smallest feature. + +## Output + +Report findings grouped as: + +- **Blocking** - must be fixed before the model is used or released. +- **Needs confirmation** - plausible but unverified, with the check that would + settle it. +- **Recommendations** - quality or robustness improvements. + +For each finding give the artifact and location, what is wrong, why it matters, +and the concrete check or fix. Then close with a short verdict: is this model +fit for its stated purpose, fit with noted limits, or not fit - plus the single +most important thing to resolve next. + +Keep every number traceable to a measurement you actually made. Distinguish +verified facts from inference from recommendation. diff --git a/plugins/eritan561006-png/minimax-aerospace-design/hooks/hooks.json b/plugins/eritan561006-png/minimax-aerospace-design/hooks/hooks.json new file mode 100644 index 00000000..cb11bb07 --- /dev/null +++ b/plugins/eritan561006-png/minimax-aerospace-design/hooks/hooks.json @@ -0,0 +1,5 @@ +{ + "modules": [ + "./register.tsx" + ] +} diff --git a/plugins/eritan561006-png/minimax-aerospace-design/hooks/register.test.tsx b/plugins/eritan561006-png/minimax-aerospace-design/hooks/register.test.tsx new file mode 100644 index 00000000..64719b51 --- /dev/null +++ b/plugins/eritan561006-png/minimax-aerospace-design/hooks/register.test.tsx @@ -0,0 +1,31 @@ +import { expect, find, mount, press, test } from '@minimax/mcode-plugin-extension/testing'; + +import { register } from './register'; + +test('the band shows the designer button', async () => { + const site = await mount({ register, site: 'above-prompt' }); + expect(find(site, { label: '生成设计提示词' })).toBeDefined(); +}); + +test('the pane calls the aerospace prompt tool and fills the composer draft', async () => { + const calls: Array<{ server: string; tool: string }> = []; + const site = await mount({ + register, + site: 'pane', + id: 'minimax-aerospace-design', + mcp: async (server, tool) => { + calls.push({ server, tool }); + return { content: [{ type: 'text', text: '# MiniMaxCode 航空航天科研与工程设计任务' }] }; + }, + }); + + expect(find(site, { label: '任务与已知约束' })).toBeDefined(); + + await press(site, { label: '任务与已知约束' }, '为小型民用无人机设计巡航段机翼'); + await press(site, { label: '生成并填入草稿' }); + + expect(calls.length).toBe(1); + expect(calls[0].server).toBe('minimax-aerospace-design'); + expect(calls[0].tool).toBe('minimax_aerospace_design_prompt'); + expect(site.effects.some((effect) => effect.type === 'prompt.fill')).toBe(true); +}); diff --git a/plugins/eritan561006-png/minimax-aerospace-design/hooks/register.tsx b/plugins/eritan561006-png/minimax-aerospace-design/hooks/register.tsx new file mode 100644 index 00000000..7468679c --- /dev/null +++ b/plugins/eritan561006-png/minimax-aerospace-design/hooks/register.tsx @@ -0,0 +1,164 @@ +import type { Register } from '@minimax/mcode-plugin-extension'; +import { Box, Button, Input, Spinner, Tag, Text } from '@minimax/mcode-plugin-extension/ui'; + +export { state } from './state'; + +export const register: Register = (on) => { + // The band row above the message box: the plugin name, the current state, and the one button + // that opens the designer pane. + on('ui.render', { site: 'above-prompt' }, (ctx) => { + const status = ctx.state.get('status'); + return Box({ + direction: 'row', + wrap: true, + gap: '2', + align: 'center', + children: [ + Text({ size: 'sm', weight: 'medium', children: '航空航天设计' }), + status === 'running' ? Tag({ label: '生成中', tone: 'accent' }) : undefined, + status === 'done' ? Tag({ label: '已生成', tone: 'success' }) : undefined, + status === 'error' ? Tag({ label: '生成失败', tone: 'danger' }) : undefined, + Button({ + key: 'open-designer', + label: '生成设计提示词', + icon: 'edit', + onPress: async () => { + await ctx.ui.open({ id: 'minimax-aerospace-design', title: '航空航天设计提示词' }); + }, + }), + ], + }); + }); + + // The designer pane: the task form, the generate action, and the failure state. + on('ui.render', { site: 'pane', id: 'minimax-aerospace-design' }, async (ctx, e, next) => { + const task = ctx.state.get('task'); + const cadTool = ctx.state.get('cadTool'); + const deliverables = ctx.state.get('deliverables'); + const status = ctx.state.get('status'); + const error = ctx.state.get('error'); + const running = status === 'running'; + + return Box({ + direction: 'column', + gap: '4', + children: [ + Text({ size: 'lg', weight: 'semibold', children: '航空航天设计提示词' }), + Text({ + size: 'sm', + tone: 'secondary', + children: '生成一段可直接复制使用的非武器航空航天科研与工程设计提示词。', + }), + Box({ + direction: 'column', + border: true, + radius: 'md', + padding: '4', + gap: '3', + children: [ + Text({ size: 'sm', weight: 'medium', children: '任务输入' }), + Input({ + key: 'task', + label: '任务与已知约束', + rows: 4, + value: task, + placeholder: '例如:为小型民用无人机设计巡航段机翼并给出外形优化方案', + onInput: async (value) => { + await ctx.state.set('task', value); + }, + }), + Input({ + key: 'cad-tool', + label: 'CAD / 分析工具(留空则由助手推荐)', + value: cadTool, + placeholder: '例如 SolidWorks 2025,或 recommend one', + onInput: async (value) => { + await ctx.state.set('cadTool', value); + }, + }), + Input({ + key: 'deliverables', + label: '期望交付物(留空则自动选择)', + value: deliverables, + placeholder: '例如:参数化模型、CFD 网格方案、结果图表', + onInput: async (value) => { + await ctx.state.set('deliverables', value); + }, + }), + ], + }), + Box({ + direction: 'row', + gap: '2', + align: 'center', + children: [ + Button({ + key: 'generate', + label: running ? '生成中…' : '生成并填入草稿', + tone: 'primary', + disabled: running, + onPress: async () => { + const current = ctx.state.get('task'); + if (!current.trim()) { + await ctx.state.set('status', 'error'); + await ctx.state.set('error', '请先填写任务与已知约束。'); + return; + } + + await ctx.state.set('status', 'running'); + await ctx.state.set('error', ''); + try { + const result = await ctx.mcp.call( + 'minimax-aerospace-design', + 'minimax_aerospace_design_prompt', + { + task: current, + cad_tool: ctx.state.get('cadTool'), + deliverables: ctx.state.get('deliverables'), + }, + ); + const text = result.content + .map((part) => + part.type === 'text' && typeof part.text === 'string' ? part.text.trim() : '', + ) + .filter(Boolean) + .join('\n'); + if (result.isError) throw new Error(text || '提示词工具返回错误。'); + if (!text) throw new Error('提示词工具没有返回内容。'); + + const filled = await ctx.prompt.fill({ text, mode: 'append' }); + await ctx.state.set('status', 'done'); + await ctx.ui.toast( + filled.written ? '设计提示词已填入草稿' : '草稿未写入:' + filled.reason, + { tone: filled.written ? 'success' : 'warning' }, + ); + } catch (failure) { + const reason = + (failure instanceof Error ? failure.message : String(failure)) || '未知错误'; + await ctx.state.set('status', 'error'); + await ctx.state.set('error', reason); + await ctx.ui.toast('提示词生成失败', { tone: 'danger' }); + } + }, + }), + running ? Spinner({ label: '正在生成' }) : undefined, + ], + }), + status === 'error' + ? Box({ + direction: 'column', + border: true, + radius: 'md', + padding: '3', + gap: '2', + children: [ + Tag({ label: '生成失败', tone: 'danger' }), + Text({ size: 'sm', tone: 'secondary', children: error }), + ], + }) + : undefined, + await next(), + ], + }); + }); +}; diff --git a/plugins/eritan561006-png/minimax-aerospace-design/hooks/state.ts b/plugins/eritan561006-png/minimax-aerospace-design/hooks/state.ts new file mode 100644 index 00000000..3eba2d43 --- /dev/null +++ b/plugins/eritan561006-png/minimax-aerospace-design/hooks/state.ts @@ -0,0 +1,15 @@ +import { defineState } from '@minimax/mcode-plugin-extension'; + +export const state = defineState({ + task: { default: '' }, + cadTool: { default: '' }, + deliverables: { default: '' }, + status: { default: 'idle' }, + error: { default: '' }, +}); + +declare module '@minimax/mcode-plugin-extension' { + interface ExtensionStateRegistry { + readonly spec: typeof state.spec; + } +} diff --git a/plugins/eritan561006-png/minimax-aerospace-design/icon-dark.png b/plugins/eritan561006-png/minimax-aerospace-design/icon-dark.png new file mode 100644 index 00000000..cf79b569 Binary files /dev/null and b/plugins/eritan561006-png/minimax-aerospace-design/icon-dark.png differ diff --git a/plugins/eritan561006-png/minimax-aerospace-design/icon.png b/plugins/eritan561006-png/minimax-aerospace-design/icon.png new file mode 100644 index 00000000..fd9305fe Binary files /dev/null and b/plugins/eritan561006-png/minimax-aerospace-design/icon.png differ diff --git a/plugins/eritan561006-png/minimax-aerospace-design/mcp.json b/plugins/eritan561006-png/minimax-aerospace-design/mcp.json new file mode 100644 index 00000000..9ff06b8c --- /dev/null +++ b/plugins/eritan561006-png/minimax-aerospace-design/mcp.json @@ -0,0 +1,13 @@ +{ + "$schema": "https://agent-plugins.org/schemas/1.0.0/mcp.schema.json", + "mcpServers": { + "minimax-aerospace-design": { + "type": "stdio", + "command": "python3", + "args": [ + "./mcp_server.py" + ], + "cwd": "${PLUGIN_ROOT}" + } + } +} diff --git a/plugins/eritan561006-png/minimax-aerospace-design/mcp_server.py b/plugins/eritan561006-png/minimax-aerospace-design/mcp_server.py new file mode 100644 index 00000000..cf740605 --- /dev/null +++ b/plugins/eritan561006-png/minimax-aerospace-design/mcp_server.py @@ -0,0 +1,195 @@ +#!/usr/bin/env python3 +"""Local stdio MCP server for the MiniMax aerospace design plugin. + +Pure standard library: one JSON-RPC message per line on stdin and stdout. +The prompt body lives in `prompt-template.txt` beside this file, so this server and +the Copilot CLI extension render byte-identical text for the same inputs. +""" + +import json +import os +import re +import sys + +SERVER_NAME = "minimax-aerospace-design" +SERVER_VERSION = "1.0.0" +TOOL_NAME = "minimax_aerospace_design_prompt" + +TEMPLATE_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), "prompt-template.txt") + +DISCIPLINES = [ + "航空器总体与概念设计", + "翼型设计与气动外形优化", + "空气动力学", + "流体力学与计算流体力学(CFD)", + "飞行力学与飞行动力学", +] + +RECOMMEND_TOOL_TEXT = ( + "如未指定软件,根据任务推荐合适的 CAD、网格、求解与后处理工具," + "说明选择理由、版本/许可证注意事项及可用替代方案;不要假定某软件已安装。" +) + +DEFAULT_DELIVERABLES_TEXT = ( + "根据任务选择最小且充分的交付物,并说明文件格式与内容;" + "可按需包括参数化 CAD/脚本、几何交换格式、网格与求解设置、分析脚本、" + "结果图表、假设清单和技术说明。" +) + +TOOLS = [ + { + "name": TOOL_NAME, + "description": ( + "Generate a copy-ready Chinese MiniMaxCode prompt for non-weapon aerospace " + "research or engineering design, including aircraft/airfoil design, " + "aerodynamics, CFD, and flight mechanics." + ), + "inputSchema": { + "type": "object", + "properties": { + "task": { + "type": "string", + "minLength": 1, + "description": ( + "The aerospace research or engineering task and any known " + "requirements or constraints." + ), + }, + "cad_tool": { + "type": "string", + "description": "Preferred CAD/analysis tool and version, or 'recommend one'.", + }, + "deliverables": { + "type": "string", + "description": ( + "Requested outputs, such as a parametric model, CAD script, " + "analysis plan, or result plots." + ), + }, + }, + "required": ["task"], + }, + } +] + + +def load_template(): + """Read the shared prompt template, without the file's trailing newline.""" + with open(TEMPLATE_PATH, "r", encoding="utf-8") as handle: + text = handle.read() + if text.endswith("\n"): + text = text[:-1] + return text + + +def build_prompt(task, cad_tool=None, deliverables=None): + """Render the prompt exactly like the Copilot CLI extension does.""" + requested_tool = (cad_tool or "").strip() + recommend_tool = (not requested_tool) or bool( + re.match(r"^recommend(?: one)?$", requested_tool, re.IGNORECASE) + ) + requested_deliverables = (deliverables or "").strip() + + if recommend_tool: + tool_policy = RECOMMEND_TOOL_TEXT + else: + tool_policy = ( + "优先使用指定工具:%s;如不可用,说明限制并提出兼容替代方案。" % requested_tool + ) + + deliverables_text = requested_deliverables or DEFAULT_DELIVERABLES_TEXT + + text = load_template() + text = text.replace("@@DISCIPLINES@@", "、".join(DISCIPLINES)) + text = text.replace("@@TASK@@", (task or "").strip()) + text = text.replace("@@TOOL_POLICY@@", tool_policy) + text = text.replace("@@DELIVERABLES@@", deliverables_text) + return text + + +def call_tool(params): + name = params.get("name") + args = params.get("arguments") or {} + if name != TOOL_NAME: + return { + "content": [{"type": "text", "text": "Unknown tool %s" % name}], + "isError": True, + } + task = args.get("task") + if not isinstance(task, str) or not task.strip(): + return { + "content": [{"type": "text", "text": "task is required"}], + "isError": True, + } + try: + text = build_prompt(task, args.get("cad_tool"), args.get("deliverables")) + except Exception as error: # pragma: no cover - defensive + return { + "content": [ + {"type": "text", "text": "Failed to build the prompt: %s" % error} + ], + "isError": True, + } + return {"content": [{"type": "text", "text": text}]} + + +def handle(message): + method = message.get("method") + params = message.get("params") or {} + if method == "initialize": + return { + "protocolVersion": params.get("protocolVersion") or "2025-06-18", + "capabilities": {"tools": {}}, + "serverInfo": {"name": SERVER_NAME, "version": SERVER_VERSION}, + } + if method == "tools/list": + return {"tools": TOOLS} + if method == "tools/call": + return call_tool(params) + if method == "ping": + return {} + return None + + +def send(payload): + sys.stdout.write(json.dumps(payload, ensure_ascii=False) + "\n") + sys.stdout.flush() + + +def main(): + for stream in (sys.stdin, sys.stdout): + try: + stream.reconfigure(encoding="utf-8") + except AttributeError: # pragma: no cover - Python < 3.7 + pass + + for line in sys.stdin: + line = line.strip() + if not line: + continue + try: + message = json.loads(line) + except ValueError: + continue + if not isinstance(message, dict): + continue + if message.get("id") is None: + continue # a notification, such as notifications/initialized + result = handle(message) + if result is None: + send( + { + "jsonrpc": "2.0", + "id": message["id"], + "error": { + "code": -32601, + "message": "Unknown method %s" % message.get("method"), + }, + } + ) + else: + send({"jsonrpc": "2.0", "id": message["id"], "result": result}) + + +if __name__ == "__main__": + main() diff --git a/plugins/eritan561006-png/minimax-aerospace-design/plugin.json b/plugins/eritan561006-png/minimax-aerospace-design/plugin.json new file mode 100644 index 00000000..0728b62a --- /dev/null +++ b/plugins/eritan561006-png/minimax-aerospace-design/plugin.json @@ -0,0 +1,23 @@ +{ + "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json", + "name": "minimax-aerospace-design", + "version": "1.0.0", + "description": "非武器用途的航空航天科研与工程设计插件:内置 minimax_aerospace_design_prompt 提示词生成工具(MCP)、编辑器上方的设计提示词面板,并配套总体设计、三维建模、几何分析、结果可视化流程技能与独立几何审查子代理。", + "author": { + "name": "eritan561006-png", + "url": "https://github.com/eritan561006-png" + }, + "homepage": "https://github.com/MiniMax-AI/MiniMax-Code-Plugins/tree/main/plugins/eritan561006-png/minimax-aerospace-design", + "repository": "https://github.com/eritan561006-png/MiniMax-Code-Plugins.git", + "license": "Apache-2.0", + "keywords": [ + "minimax-code", + "plugin", + "mcp", + "aerospace", + "cad", + "cfd", + "aerodynamics", + "engineering" + ] +} diff --git a/plugins/eritan561006-png/minimax-aerospace-design/prompt-template.txt b/plugins/eritan561006-png/minimax-aerospace-design/prompt-template.txt new file mode 100644 index 00000000..0a262854 --- /dev/null +++ b/plugins/eritan561006-png/minimax-aerospace-design/prompt-template.txt @@ -0,0 +1,27 @@ +# MiniMaxCode 航空航天科研与工程设计任务 + +## 角色与任务 +你是一名严谨的航空航天工程与科学计算助手,熟悉@@DISCIPLINES@@。围绕以下任务制定并执行可复核的工程工作流: + +@@TASK@@ + +## 工程约束与执行要求 +- 先提取任务目标、设计变量、性能指标、约束条件、适用工况及已知输入。区分用户给定事实、合理假设和待确认参数;关键缺项会改变结论时,先提出精简的澄清问题,不要臆造数据。 +- 识别相关物理问题和耦合关系。根据任务选择并说明控制方程、物理模型、数值方法、坐标系、边界/初始条件及适用性;涉及 CFD 时,说明湍流/转捩模型、离散格式、网格策略、残差与守恒量监控,并规划网格无关性检查。 +- 将复杂任务拆解为可执行阶段;给出每阶段输入、操作、预期输出和验收标准。涉及参数化 CAD 时说明几何参数、约束、单位、坐标基准和模型树/脚本结构;涉及优化时说明目标函数、设计空间、约束处理和收敛判据。 +- 在开始前核实所需软件及版本、可用接口和运行环境。@@TOOL_POLICY@@ +- 通过量纲分析、解析/基准算例、实验数据或独立方法进行验证;区分验证(verification)与确认(validation),报告误差、敏感性、不确定度和模型适用范围。不得把未经验证的计算结果表述为已证实结论。 +- 只开展非武器航空航天科研与工程设计。明确标注概念研究、仿真与实际认证之间的界限;不得声称方案已满足适航、结构安全或飞行安全要求,除非有适当证据和审查。 + +## 交付物 +@@DELIVERABLES@@ + +## 输出格式 +1. 任务理解、输入/约束与待确认事项 +2. 工具链建议(若适用)及选择理由 +3. 建模与分析方案(理论、几何、数值设置) +4. 分步执行计划和可复现的实现内容 +5. 验证/确认方案、结果检查与不确定性 +6. 交付物清单、局限性及下一步 + +使用规范的中文航空航天、流体力学、数值计算和 CAD 术语。公式、变量、单位和坐标约定应保持一致;对无法确认的参数显式标为待定,不得编造结果。 diff --git a/plugins/eritan561006-png/minimax-aerospace-design/skills/aerospace-3d-analysis/SKILL.md b/plugins/eritan561006-png/minimax-aerospace-design/skills/aerospace-3d-analysis/SKILL.md new file mode 100644 index 00000000..8ba3d74a --- /dev/null +++ b/plugins/eritan561006-png/minimax-aerospace-design/skills/aerospace-3d-analysis/SKILL.md @@ -0,0 +1,139 @@ +--- +name: aerospace-3d-analysis +description: Analyse a non-weapon aerospace 3D model - aerodynamic geometry and CFD hand-off, structural load cases and finite-element setup, thermal behaviour - and turn the outcome into traceable, unit-declared engineering statements. Use when the user asks for aerodynamic assessment, CFD preparation, structural or FEA analysis, thermal analysis, or interpretation of analysis output on an aerospace model. +--- + +# Aerospace 3D Analysis + +Non-weapon aerospace analysis only: civil, academic and student projects. Never +analyse, optimise or improve weapons, munitions, targeting or strike systems. + +## 1. Start from the model, not the picture + +Before analysing, establish what geometry you are actually analysing: + +- Which model file or export is the analysis input, with its version and timestamp +- The coordinate system, unit and reference conditions it uses +- The parameter table behind it, and which rows are still assumptions +- Whether the geometry is watertight and mesh-ready + +If the model is only a render, a sketch or a description, say so and treat the +analysis as conceptual. Do not present numbers that cannot be tied to geometry. + +## 2. Aerodynamic geometry + +Declare, before any result: + +- The airfoil family and its defining parameters per spanwise station +- Reference area and reference chord, and where they are taken from +- Reynolds number, Mach number and the reference conditions behind them +- Angle-of-attack and sideslip range, and whether they are swept or constant +- The flow regime you assume (incompressible, compressible, transonic) + +Keep the distinction sharp between a geometric estimate, a panel or potential-flow +result, a validated CFD run and a wind-tunnel measurement. Only the last two are +evidence about the real vehicle. + +Useful first-order geometric quantities you may compute transparently: +aspect ratio, taper ratio, wing area, wetted area estimate, fineness ratio, +and thickness-to-chord distribution. State the formula for each and the +assumptions behind it. + +## 3. CFD hand-off + +A CFD hand-off is a package, not a mesh. Deliver: + +1. **Geometry** - watertight STL or the native CAD file, with the tessellation + tolerance stated and why it was chosen relative to the smallest feature. +2. **Boundary conditions** - inlet profile with total pressure or velocity and + reference values, outlet type and pressure, wall treatment, turbulence model + and its justification, reference length and area. +3. **Mesh strategy** - base size, growth rate, boundary-layer count and first + height, prism or wall treatment, total cell count, and the cells-per-unit-span + check at the thinnest section. +4. **Case matrix** - the operating points to be run, and what each one answers. +5. **Convergence and quality** - residual history, mass imbalance, the + y-plus or wall-resolution evidence, and the mesh-sensitivity study. + +Never quote a converged-looking number without the residual and quality +evidence behind it. + +## 4. Structural and load cases + +For every load case state: the case name, what it represents, the load magnitude +with units, its application point and direction, the constraint or interface +definition, and the safety or load factor where one applies. + +Build the case matrix before interpreting anything: + +| Case | Condition | Load | Magnitude | Direction | Applied at | +| --- | --- | --- | --- | --- | --- | +| C1 | taxi / ground handling | vertical | value | +Z | gear attachment | +| C2 | cruise gust | distributed | value | +/- Y | wing surface | + +Then for finite-element work describe: element type and order, mesh size and +local refinement, contact definitions and friction, boundary conditions, +material model and its source, solver and formulation, and the convergence +study. Include at least one independent sanity check, for example a hand +calculation of the dominant load path or a comparison against a published +closed-form solution for a simplified case. + +## 5. Thermal + +State the heat sources with magnitudes and locations, the transfer modes in the +model (conduction, convection with the correlation used, radiation with its +emissivity and view-factor assumptions), boundary conditions, and whether the +run is steady or transient. Use temperature-dependent material properties when +the range warrants it, and say which ones you used. For a transient run, give +the time step, the step count and the convergence criterion per step. + +## 6. Read results honestly + +- Report the quantity, its unit, the case it belongs to and the location or + statistic it came from (max at a node, averaged over a surface, integrated). +- Give the margin to the allowable when an allowable exists, and state the + allowables source. If there is no verified allowable, say so. +- State the result's sensitivity: which assumption, if wrong, would move it most. +- Mark clearly: **conceptual estimate**, **single-iteration calculation**, + **converged simulation**, **validated against test**, or **measured**. +- Never present an analysis result as certification, airworthiness approval, or + a substitute for qualified engineering review. + +## 7. Traceability + +Keep a traceability matrix so every conclusion can be walked back: + +| Conclusion | Geometry input | Case / condition | Source data | Method | Status | +| --- | --- | --- | --- | --- | --- | +| root bending moment | wing rib set v3 | C2 gust | spanwise q(y) | beam theory | estimate | + +## 8. Standards and citations + +Recommend a standard only after identifying the application and jurisdiction. +For each standard cited, give the number, the title, the revision or year, what +it applies to, and a verifiable publisher or official source. If the exact +revision or its applicability cannot be verified, say that plainly and ask for +confirmation. Never fabricate a clause reference and never imply compliance +because a model was generated. + +## 9. Response format + +For substantive analysis work return, in this order: + +1. Objective, scope and the model under analysis +2. Inputs: geometry version, conditions, assumptions with units +3. Method: mesh or model setup, solver settings, quality criteria +4. Results: quantities with units, locations, cases, and status labels +5. Sensitivity and the assumptions that matter most +6. Limitations and what still needs test or qualified review +7. Standards and sources with applicability and revision details + +## 10. Scope and escalation + +- Non-weapon aerospace only. Decline weapon, munition, targeting and + strike-optimisation requests and offer the civilian equivalent. +- Do not invent material properties, boundary conditions, test results, software + behaviour or standard clauses. +- For the geometry itself, use the companion skill `aerospace-3d-modeling`; + for an independent review of a finished model, delegate to + `minimax-aerospace-design:geometry-reviewer`. diff --git a/plugins/eritan561006-png/minimax-aerospace-design/skills/aerospace-3d-modeling-visualizer/SKILL.md b/plugins/eritan561006-png/minimax-aerospace-design/skills/aerospace-3d-modeling-visualizer/SKILL.md new file mode 100644 index 00000000..3c703d96 --- /dev/null +++ b/plugins/eritan561006-png/minimax-aerospace-design/skills/aerospace-3d-modeling-visualizer/SKILL.md @@ -0,0 +1,98 @@ +--- +name: aerospace-3d-modeling-visualizer +description: Render the verification result of an aerospace 3D model build as a mavis.widget.v1 panel - the model-verification check set with measured versus expected values, deviations and evidence sources, plus the export hand-off manifest. Use after aerospace-3d-modeling has produced a verification result and a panel makes the release decision clearer than the text result alone. +--- + +# Aerospace 3D Modeling Visualizer + +This Skill is the optional visual surface of `aerospace-3d-modeling`. It renders a result the +business flow has already produced. It never fetches data, never repeats an authenticated CAD +call, and never invents a row, a metric, a provenance or a conclusion. + +The business Skill stays complete on its own. When the text result is enough, there is no widget. + +## Read before authoring + +Read the local foundation completely, then follow it: + +- `references/genui-widget/SKILL.md` - DSL protocol, theme safety gate, security rules, renderer + selection, sendPrompt contract, final answer contract. +- `references/genui-widget/references/color-system.md` - the only permitted theme tokens. +- `references/genui-widget/references/visual-rules.md` - layout, typography, required states. +- `references/genui-widget/references/widget-patterns.md` - renderer selection and CSS/SVG patterns. +- `references/genui-widget/references/widget-recipes.md` - scaffolds and interaction patterns. +- `references/components.md` - the domain recipes and their selection rules. +- `references/data-schema.json` - the input contract. +- `references/examples.md` - one complete worked example. + +This Skill is a fork of the Creator foundation (`genui.json` records the provenance and the +source digest). It is user-owned: the components, rules and business behavior here may be changed. +Forking does not relax Host enforcement - iframe sandboxing, CSP, allowed capabilities, output +size limits and protocol validation still apply. + +## When to render + +Render a panel only when all of these hold: + +1. `aerospace-3d-modeling` has already produced a verification result with at least four + checks, and at least one check is not `pass`. +2. The decision on the table is "can this model be released or exported", and the checks carry + measured values, expected values and evidence that a table reads faster than prose. +3. The data is already in hand. If the CAD engine is unreachable, the checks have not run, and a + panel would imply that they had - keep the text result instead. + +Otherwise stay with the business Skill's own text response. The text result must be written first +and must stand alone. + +## Choosing the recipe + +- Verification checks present, at least one not passing -> Recipe A, the model verification panel. +- At least three exported files to hand off -> Recipe B, the export and hand-off manifest. +- Both may appear, but only one Widget is emitted. In that case Recipe A is the panel and the + manifest becomes a compact section inside it. + +Full rules, field contracts, null policy and state handling are in `references/components.md`. + +## Authoring rules + +- Emit exactly one ``, by default, in the final assistant message after every + retrieval, file operation and validation has finished. No tool call may follow it. +- Use `kind="dashboard"` for the verification panel and `kind="table"` for the export + manifest. Use `capabilities="resize,sendPrompt"` only when a sendPrompt target is wired. +- Only host theme tokens in the `--mw-*` namespace, with no fallback values and no fixed + light or dark palette. +- Put the dataset in `` blocks and read it in the script from + `window.__mavisData`. Never rebuild the data from DOM text or embed it twice. +- Show the unit system and the coordinate system exactly as the flow reported them. Never + convert, infer or add units. +- Render `null` as an em dash and exclude it from every comparison. +- Keep filtering, sorting and toggling in local script. Use `window.mavis.sendPrompt()` only + for a reasoning follow-up about the selected row, and carry the minimal stable identifiers. +- Every `text` and `userIntent` value must be in the conversation language. When the + conversation is in Chinese, both are Chinese. +- Provide a `` that states the same conclusion as the panel, including the + blocking and needs-confirmation items with their measured values and evidence sources. + +## States + +- Working: the populated state described above. +- Loading: KPI placeholders show `--`, the distribution bars and the table body stay empty, + and the surrounding layout does not move. +- Empty: no checks means the flow produced nothing - keep the skeleton and state in one centered + line that no verification record exists. Never render zeros as if they were results. +- Error: keep the layout and show one short inline message where the data would be. The business + Skill's text result still carries the conclusion. +- Permission or authentication: when the CAD engine is not connected or not authorised, say so + inline and treat every check as `not_run`. A blocked or unauthorised engine must never + render as a pass. +- No visual value: fewer than four checks, all passing, or a result that is still an ungraded + estimate - keep the text. + +## Boundaries + +- Do not place credentials, file system secrets or raw internal error text in the Widget. +- Do not restate the whole modelling report in the Widget. The panel carries the verification + result; the text response carries the objective, assumptions, method, exports and limitations. +- The panel is a result, not progress narration. +- This Skill renders only what `aerospace-3d-modeling` produced. Aerodynamic, structural and + thermal results stay with `aerospace-3d-analysis`. diff --git a/plugins/eritan561006-png/minimax-aerospace-design/skills/aerospace-3d-modeling-visualizer/genui.json b/plugins/eritan561006-png/minimax-aerospace-design/skills/aerospace-3d-modeling-visualizer/genui.json new file mode 100644 index 00000000..5bed4cca --- /dev/null +++ b/plugins/eritan561006-png/minimax-aerospace-design/skills/aerospace-3d-modeling-visualizer/genui.json @@ -0,0 +1,8 @@ +{ + "protocol": "mavis.widget.v1", + "mode": "forked", + "forkedFrom": "minimax/genui-widget@mavis.widget.v1", + "sourceDigest": "sha256:9fbae3fff641ff6e5e4e74e01a3f8843b799c87817d2852d3d45b30b273b101f", + "derivedFrom": "minimax-aerospace-design/aerospace-3d-modeling@1.0.0", + "ownership": "user-owned" +} diff --git a/plugins/eritan561006-png/minimax-aerospace-design/skills/aerospace-3d-modeling-visualizer/references/components.md b/plugins/eritan561006-png/minimax-aerospace-design/skills/aerospace-3d-modeling-visualizer/references/components.md new file mode 100644 index 00000000..be5d503a --- /dev/null +++ b/plugins/eritan561006-png/minimax-aerospace-design/skills/aerospace-3d-modeling-visualizer/references/components.md @@ -0,0 +1,51 @@ +# 组件配方 + +本 Visualizer 只转换 aerospace-3d-modeling 已经产出的校验结果与交付清单,不取数、不重跑业务调用、不补造缺失行。字段定义见 `data-schema.json`,完整示例见 `examples.md`。 + +## 配方 A:模型校验面板 + +- **业务问题**:这次建模的校验结果能否放行发布或导出?哪一项在卡住? +- **选择规则**:`checks.length >= 4` 且至少一项 `verdict != "pass"`。校验项少于 4 项,或全部通过时,保留技能自身的文本结论,不出面板。 +- **必需输入**:`model_id, model_name, toolchain, unit_system, coordinate_system, summary, checks[]`,每行 `check_id, check_name, verdict, measured, expected, deviation, source`。 +- **单位与口径**:单位制与坐标系来自 context,在面板抬头原样显示;每行的 measured 与 expected 必须自带单位,不得由面板推断或换算。 +- **null 策略**:`measured`、`expected` 为 null 时显示 `—`;`deviation` 为 null 时显示 `—`,并且不得参与任何数值比较或排序。`verdict = "not_run"` 计入 `total` 但不计入通过。 +- **provenance**:每行末尾显示 `source`,让每个判定都能回溯到工具调用、参数表版本或回读文件。 +- **Widget 类型**:`dashboard`。 +- **布局与语义层级**: + 1. 四张 KPI 卡 —— 校验项总数 / 通过 / 需确认 / 阻断,数值用 `--` 作加载占位。 + 2. 判定分布 —— 三条 CSS 基准条(通过 / 需确认 / 阻断)。只有三个类别,属于 5 个以内可比较数据点,用 CSS 而非 Chart.js。 + 3. 校验明细表 —— 列为 校验项 / 实测值 / 期望值 / 偏差 / 判定。 + 4. 行动条 —— 补做未通过项、输出文本版报告两个按钮。 +- **局部交互**:按判定在本地 JS 中筛选表格行、悬停高亮。不把筛选与排序回传模型。 +- **推理跟进**(sendPrompt,仅 2-4 个高价值目标): + - 点击非 `pass` 行的判定徽标 —— 请求解释该判定并给出补做步骤,selectedData 带 `check_id, check_name, verdict, measured, expected, deviation, source`。 + - 行动条「补做未通过的校验项」—— 请求按验证清单补做,selectedData 带 `model_id` 与待补做项的 check_id 列表。 + - 行动条「输出文本版校验报告」—— 请求纯文本报告,selectedData 只带 `model_id`。 +- **状态**: + - working:数据齐备时的常态。 + - loading:KPI 显示 `--`、基准条空、表格空骨架。 + - empty:`checks` 为空时保留完整骨架,中间单行说明「本次建模没有产生校验记录」,不显示任何数字。 + - error:业务调用失败时在表格位置内联一句短消息,同时由技能本身输出文本结论,不显示半截数据。 + - permission / auth:MCP 未连接或未授权时,内联说明「当前没有可用的 CAD 引擎,校验尚未执行」,全部判定视为 `not_run`,不得显示为通过。 +- **文本回退**:面板不可用时,技能自身必须给出等价的文本结论:总体判定、阻断项与需确认项的实测值与期望值、证据来源、以及仍需实物试验或合格工程评审的环节。 + +## 配方 B:导出与交接清单 + +- **业务问题**:交给下游的到底是哪些文件,单位与坐标系是什么,验证过没有? +- **选择规则**:`exports.length >= 3`。少于 3 个文件时,在正文里用列表说明即可。 +- **必需输入**:每项 `file_name, format, units, coordinate_system, parametric, verified_against`。 +- **单位与口径**:`units` 与 `coordinate_system` 必须逐行显示。STL 无单位语义时如实写明,不得沿用模型的单位。 +- **null 策略**:`parametric` 为 null 时显示 `—`;`size_bytes` 为 null 时不显示体积列。 +- **Widget 类型**:`table`。 +- **布局**:紧凑表格,列为 文件 / 格式 / 单位 / 坐标系 / 参数化 / 验证依据。 +- **局部交互**:无数据交互;仅行悬停。 +- **推理跟进**:点击文件名,请求补充该文件的交接说明与下游注意事项。 +- **状态**:loading 空表头;empty 单行说明「没有导出文件」;error 内联短句;auth 同样内联说明。 +- **文本回退**:以表格形式在正文列出同样字段。 + +## 什么时候不画 + +- 校验项少于 4 项、且全部通过:结论就是一句「已通过」,面板没有信息增量。 +- 只有一项未通过且没有其他上下文:直接用文字指出该项与依据。 +- 结果尚未取得或引擎不可用:面板会暗示已经校验过,这比没有面板更糟 —— 改用文本说明未执行。 +- 数值处于估算状态且尚未由分析技能定级:面板不能替代 `aerospace-3d-analysis` 的结果分级说明。 diff --git a/plugins/eritan561006-png/minimax-aerospace-design/skills/aerospace-3d-modeling-visualizer/references/data-schema.json b/plugins/eritan561006-png/minimax-aerospace-design/skills/aerospace-3d-modeling-visualizer/references/data-schema.json new file mode 100644 index 00000000..7895caec --- /dev/null +++ b/plugins/eritan561006-png/minimax-aerospace-design/skills/aerospace-3d-modeling-visualizer/references/data-schema.json @@ -0,0 +1,201 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "AerospaceModelVerificationResult", + "description": "aerospace-3d-modeling 建模流程产出的校验结果,供 Visualizer 转换渲染。", + "type": "object", + "required": [ + "model_id", + "model_name", + "toolchain", + "unit_system", + "coordinate_system", + "summary", + "checks" + ], + "properties": { + "model_id": { + "type": "string", + "description": "稳定标识,用于 sendPrompt 的 selectedData 引用" + }, + "model_name": { + "type": "string" + }, + "model_version": { + "type": [ + "string", + "null" + ] + }, + "toolchain": { + "type": "string", + "enum": [ + "solidworks", + "blender", + "cq-viewer", + "scripted-cad", + "none" + ] + }, + "unit_system": { + "type": "string", + "enum": [ + "SI", + "imperial" + ] + }, + "coordinate_system": { + "type": "string", + "description": "例如:机体坐标 X 前 / Y 右 / Z 下,原点在翼根前缘" + }, + "verified_at": { + "type": [ + "string", + "null" + ], + "description": "ISO 8601 时间戳" + }, + "summary": { + "type": "object", + "required": [ + "total", + "passed", + "needs_confirmation", + "blocked" + ], + "properties": { + "total": { + "type": "integer", + "minimum": 0 + }, + "passed": { + "type": "integer", + "minimum": 0 + }, + "needs_confirmation": { + "type": "integer", + "minimum": 0 + }, + "blocked": { + "type": "integer", + "minimum": 0 + } + } + }, + "checks": { + "type": "array", + "description": "校验明细,顺序即建模技能的验证清单顺序", + "items": { + "type": "object", + "required": [ + "check_id", + "check_name", + "verdict", + "source" + ], + "properties": { + "check_id": { + "type": "string", + "description": "稳定行标识,例如 CHK-04" + }, + "check_name": { + "type": "string" + }, + "verdict": { + "type": "string", + "enum": [ + "pass", + "needs_confirmation", + "blocked", + "not_run" + ] + }, + "measured": { + "type": [ + "string", + "null" + ], + "description": "实测值,含单位;未执行时为 null" + }, + "expected": { + "type": [ + "string", + "null" + ], + "description": "期望值或判据,含单位" + }, + "deviation": { + "type": [ + "string", + "null" + ], + "description": "偏差,含单位;null 表示未量化" + }, + "source": { + "type": "string", + "description": "证据来源:工具调用名、参数表版本或回读文件名" + }, + "note": { + "type": [ + "string", + "null" + ] + } + } + } + }, + "exports": { + "type": "array", + "description": "交付文件清单,可缺省", + "items": { + "type": "object", + "required": [ + "file_name", + "format", + "units", + "coordinate_system", + "verified_against" + ], + "properties": { + "file_name": { + "type": "string" + }, + "format": { + "type": "string", + "enum": [ + "STEP", + "STL", + "DXF", + "DWG", + "PDF", + "SLDPRT", + "SLDASM", + "FCStd", + "blend" + ] + }, + "units": { + "type": "string" + }, + "coordinate_system": { + "type": "string" + }, + "parametric": { + "type": [ + "boolean", + "null" + ] + }, + "verified_against": { + "type": "string" + }, + "size_bytes": { + "type": [ + "integer", + "null" + ] + } + } + } + } + } +} diff --git a/plugins/eritan561006-png/minimax-aerospace-design/skills/aerospace-3d-modeling-visualizer/references/examples.md b/plugins/eritan561006-png/minimax-aerospace-design/skills/aerospace-3d-modeling-visualizer/references/examples.md new file mode 100644 index 00000000..3d402fa0 --- /dev/null +++ b/plugins/eritan561006-png/minimax-aerospace-design/skills/aerospace-3d-modeling-visualizer/references/examples.md @@ -0,0 +1,209 @@ +# 完整示例 + +以下是配方 A 的一个完整实例:`checks` 共 7 行、判定分布 3 类,因此用 CSS 基准条而非 Chart.js;表体与 KPI 在 `` 里从 `window.__mavisData` 读取,`` 只保留骨架与 `--` 占位,首屏结构完整且不重复数据源。 + +样本数据是代表性示例,用于说明形状与字段;真实面板必须使用建模流程实际产出的记录。 + +```html + + {"summary":"7 项建模校验中 5 项通过、1 项需确认、1 项阻断,模型尚不可发布。","dataSource":"aerospace-3d-modeling 建模流程产出的校验记录与交付清单","chartType":"dashboard","conversationLanguage":"zh","interactions":[{"id":"drill-check","label":"解释未通过校验项并给出补做步骤","capability":"sendPrompt"},{"id":"request-recheck","label":"补做未通过的校验项","capability":"sendPrompt"},{"id":"text-report","label":"输出文本版校验报告","capability":"sendPrompt"}]} + +body { margin: 0; padding: 16px; background: var(--mw-bg); color: var(--mw-text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; font-size: 14px; } +.hd { margin-bottom: 14px; } +.hd .t { font-size: 18px; font-weight: 500; } +.hd .s { font-size: 12px; color: var(--mw-text-muted); margin-top: 3px; } +.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; } +.kpi { background: var(--mw-surface); border: 1px solid var(--mw-border); border-radius: 10px; padding: 14px; } +.kpi-label { font-size: 12px; color: var(--mw-text-muted); margin-bottom: 4px; } +.kpi-value { font-size: 26px; font-weight: 700; color: var(--mw-text); } +.kpi.ok .kpi-value { color: var(--mw-success); } +.kpi.warn .kpi-value { color: var(--mw-warning); } +.kpi.bad .kpi-value { color: var(--mw-danger); } +.card { background: var(--mw-surface); border: 1px solid var(--mw-border); border-radius: 10px; padding: 14px; margin-bottom: 14px; } +.card-title { font-size: 14px; font-weight: 500; margin-bottom: 10px; } +.bench { display: grid; grid-template-columns: 84px 1fr 72px; gap: 12px; align-items: center; padding: 5px 0; } +.bench-label { font-size: 13px; color: var(--mw-text-muted); } +.bench-track { height: 16px; background: var(--mw-surface-muted); border-radius: 6px; overflow: hidden; } +.bench-fill { height: 100%; border-radius: 6px; background: var(--mw-accent); } +.bench-fill.ok { background: var(--mw-success); } +.bench-fill.warn { background: var(--mw-warning); } +.bench-fill.bad { background: var(--mw-danger); } +.bench-val { font-size: 13px; color: var(--mw-text); text-align: right; font-variant-numeric: tabular-nums; } +table { width: 100%; border-collapse: collapse; } +th { padding: 8px 10px; text-align: left; font-size: 12px; font-weight: 500; color: var(--mw-text-muted); background: var(--mw-surface-muted); border-bottom: 1px solid var(--mw-border); } +td { padding: 9px 10px; border-bottom: 1px solid var(--mw-border); font-size: 13px; vertical-align: top; } +td.num { text-align: right; font-variant-numeric: tabular-nums; } +tr:last-child td { border-bottom: none; } +tbody tr:hover { background: var(--mw-surface-muted); } +tr.clickable { cursor: pointer; } +tr.clickable:hover { outline: 2px solid var(--mw-accent); outline-offset: -2px; } +.verdict { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px; color: var(--mw-text); background: var(--mw-surface-muted); } +.verdict.pass { color: var(--mw-success); } +.verdict.needs_confirmation { color: var(--mw-warning); } +.verdict.blocked { color: var(--mw-danger); } +.verdict.not_run { color: var(--mw-text-subtle); } +.src { display: block; font-size: 11px; color: var(--mw-text-subtle); margin-top: 3px; } +.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--mw-border); } +.btn { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--mw-border); background: var(--mw-surface); color: var(--mw-text-muted); font-size: 12px; cursor: pointer; font-family: inherit; } +.btn:hover { background: var(--mw-surface-muted); color: var(--mw-accent); border-color: var(--mw-accent); } +.btn:focus-visible { outline: 2px solid var(--mw-accent); outline-offset: 2px; } + + +
+
模型校验面板
+
读取建模流程产出的校验记录
+
+
+
校验项
--
+
通过
--
+
需确认
--
+
阻断
--
+
+
+
判定分布
+
+
+
+
校验明细
+ + + +
校验项实测值期望值偏差判定
+
+ + +
+
+
+ [{"check_id":"CHK-01","check_name":"草图状态","verdict":"pass","measured":"3/3 驱动草图完全定义","expected":"全部驱动草图完全定义","deviation":null,"source":"check_sketch_fully_defined"},{"check_id":"CHK-02","check_name":"特征重建","verdict":"pass","measured":"0 错误,1 个抑制特征已注明","expected":"无未说明的抑制特征","deviation":null,"source":"verify_model"},{"check_id":"CHK-03","check_name":"质量属性","verdict":"needs_confirmation","measured":"12.480 kg,质心 x = 1.620 m","expected":"与密度×体积估算偏差 ≤ 1.0%","deviation":"1.8%","source":"get_mass_properties"},{"check_id":"CHK-04","check_name":"干涉与间隙","verdict":"blocked","measured":"1 处干涉(舱壁与支架),2 处配合满足 H7/g6","expected":"0 处干涉","deviation":"1 处","source":"check_interference"},{"check_id":"CHK-05","check_name":"尺寸抽查","verdict":"pass","measured":"展长 1.200 m","expected":"参数表 b = 1.200 m","deviation":"0 mm","source":"参数表 v3"},{"check_id":"CHK-06","check_name":"水密性","verdict":"pass","measured":"封闭实体,0 个开口面","expected":"0 个开口面","deviation":null,"source":"STL 回读"},{"check_id":"CHK-07","check_name":"导出回读","verdict":"pass","measured":"展长 1.200 m,翼根厚度 0.018 m","expected":"与源模型一致","deviation":"0 mm","source":"export_step + 回读"}] + {"model_id":"WING-BEAM-001","model_name":"机翼梁参数化模型","model_version":"v3","toolchain":"solidworks","unit_system":"SI","coordinate_system":"机体坐标 X 前 / Y 右 / Z 下,原点在翼根前缘","verified_at":"2026-12-03T15:40:00+08:00","summary":{"total":7,"passed":5,"needs_confirmation":1,"blocked":1},"exports":[{"file_name":"wing_beam_v3.step","format":"STEP","units":"mm","coordinate_system":"同模型坐标","parametric":true,"verified_against":"CHK-05 尺寸抽查"},{"file_name":"wing_beam_v3.stl","format":"STL","units":"mm","coordinate_system":"同模型坐标","parametric":false,"verified_against":"CHK-06 水密性"},{"file_name":"wing_beam_v3.pdf","format":"PDF","units":"mm","coordinate_system":"同模型坐标","parametric":false,"verified_against":"工程图 check_drawing"}]} + +(function () { + var checks = (window.__mavisData && window.__mavisData['checks']) || []; + var ctx = (window.__mavisData && window.__mavisData['context']) || {}; + var sum = ctx.summary || { total: checks.length, passed: 0, needs_confirmation: 0, blocked: 0 }; + var LABEL = { pass: '通过', needs_confirmation: '需确认', blocked: '阻断', not_run: '未执行' }; + + function set(id, v) { var el = document.getElementById(id); if (el) el.textContent = v; } + + set('model-name', ctx.model_name || '模型校验面板'); + set('model-meta', [ctx.model_name, ctx.model_version, ctx.toolchain, ctx.unit_system, ctx.coordinate_system].filter(Boolean).join(' · ')); + set('kpi-total', String(sum.total)); + set('kpi-pass', String(sum.passed)); + set('kpi-check', String(sum.needs_confirmation)); + set('kpi-block', String(sum.blocked)); + + var bars = [ + { label: '通过', count: sum.passed, cls: 'ok' }, + { label: '需确认', count: sum.needs_confirmation, cls: 'warn' }, + { label: '阻断', count: sum.blocked, cls: 'bad' } + ]; + var max = sum.total || 1; + var box = document.getElementById('bars'); + bars.forEach(function (b) { + var row = document.createElement('div'); row.className = 'bench'; + var lab = document.createElement('span'); lab.className = 'bench-label'; lab.textContent = b.label; + var track = document.createElement('div'); track.className = 'bench-track'; + var fill = document.createElement('div'); fill.className = 'bench-fill ' + b.cls; + fill.style.width = Math.round((b.count / max) * 100) + '%'; + track.appendChild(fill); + var val = document.createElement('span'); val.className = 'bench-val'; val.textContent = b.count + ' 项'; + row.appendChild(lab); row.appendChild(track); row.appendChild(val); + if (box) box.appendChild(row); + }); + + var body = document.getElementById('check-body'); + var pending = []; + checks.forEach(function (c) { + var tr = document.createElement('tr'); + if (c.verdict !== 'pass') { + tr.className = 'clickable'; + tr.setAttribute('data-action', 'drill-check'); + tr.setAttribute('data-check-id', c.check_id); + pending.push(c.check_id); + } + var name = document.createElement('td'); + name.textContent = c.check_id + ' ' + c.check_name; + var measured = document.createElement('td'); + measured.textContent = c.measured == null ? '—' : c.measured; + var expected = document.createElement('td'); + expected.textContent = c.expected == null ? '—' : c.expected; + var dev = document.createElement('td'); dev.className = 'num'; + dev.textContent = c.deviation == null ? '—' : c.deviation; + var vd = document.createElement('td'); + var badge = document.createElement('span'); + badge.className = 'verdict ' + c.verdict; + badge.textContent = LABEL[c.verdict] || c.verdict; + vd.appendChild(badge); + var src = document.createElement('span'); src.className = 'src'; src.textContent = c.source || ''; + vd.appendChild(src); + tr.appendChild(name); tr.appendChild(measured); tr.appendChild(expected); tr.appendChild(dev); tr.appendChild(vd); + if (body) body.appendChild(tr); + }); + + document.querySelectorAll('[data-action="drill-check"]').forEach(function (tr) { + tr.addEventListener('click', function () { + var id = tr.getAttribute('data-check-id'); + var row = checks.filter(function (c) { return c.check_id === id; })[0]; + if (!row) return; + window.mavis.sendPrompt('请解释校验项 ' + row.check_id + '(' + row.check_name + ')为何判定为' + (LABEL[row.verdict] || row.verdict) + ',并给出补做该校验的步骤。', { + widgetTitle: '模型校验面板', + action: 'drill-check', + selectedData: { model_id: ctx.model_id, check_id: row.check_id, check_name: row.check_name, verdict: row.verdict, measured: row.measured, expected: row.expected, deviation: row.deviation, source: row.source }, + visibleFilters: { model_id: ctx.model_id }, + userIntent: '理解该校验项的判定依据并补做该校验' + }); + }); + }); + + document.getElementById('recheck').addEventListener('click', function () { + window.mavis.sendPrompt('请补做 ' + (ctx.model_name || '该模型') + ' 中未通过的校验项(' + pending.join('、') + '),按建模技能的验证清单执行并回报结果。', { + widgetTitle: '模型校验面板', + action: 'request-recheck', + selectedData: { model_id: ctx.model_id, model_name: ctx.model_name, pending_check_ids: pending }, + visibleFilters: { model_id: ctx.model_id }, + userIntent: '补做未通过的校验项' + }); + }); + + document.getElementById('text-report').addEventListener('click', function () { + window.mavis.sendPrompt('请输出 ' + (ctx.model_name || '该模型') + ' 的纯文本校验报告,包含判定、偏差、证据来源与限制说明。', { + widgetTitle: '模型校验面板', + action: 'text-report', + selectedData: { model_id: ctx.model_id, model_name: ctx.model_name }, + visibleFilters: { model_id: ctx.model_id }, + userIntent: '获得纯文本版校验报告' + }); + }); +})(); + + +### 模型校验面板 + +机翼梁参数化模型 v3(solidworks,SI,机体坐标 X 前 / Y 右 / Z 下)共 7 项校验:通过 5 项、需确认 1 项、阻断 1 项。 + +- 阻断:CHK-04 干涉与间隙 —— 测得舱壁与支架 1 处干涉(2 处配合满足 H7/g6),要求 0 处干涉;证据 check_interference。 +- 需确认:CHK-03 质量属性 —— 12.480 kg、质心 x = 1.620 m,与密度×体积估算偏差 1.8%,阈值 1.0%;证据 get_mass_properties。 +- 通过:CHK-01 草图状态、CHK-02 特征重建、CHK-05 尺寸抽查(展长 1.200 m,对齐参数表 v3)、CHK-06 水密性、CHK-07 导出回读。 + +结论:该模型尚不可发布,需先消除 CHK-04 干涉并确认 CHK-03 的质量属性偏差来源;交付件 STEP/STL/PDF 已按上表口径导出,仍需实物试验与合格工程评审。 + +
+``` + +## 预期呈现 + +- 首屏即出现抬头、四张 KPI 骨架、判定分布骨架与校验表表头;KPI 在数据到达前显示 `--`。 +- 数据到达后 KPI 变为 7 / 5 / 1 / 1,判定分布出现三条基准条(通过 5、需确认 1、阻断 1),表格出现 7 行。 +- 只有 CHK-03 与 CHK-04 两行可点击并触发 sendPrompt,其余行为纯本地展示。 +- 切换浅色/深色主题时无需脚本介入,全部颜色来自 `--mw-*` 令牌。 diff --git a/plugins/eritan561006-png/minimax-aerospace-design/skills/aerospace-3d-modeling-visualizer/references/genui-widget/SKILL.md b/plugins/eritan561006-png/minimax-aerospace-design/skills/aerospace-3d-modeling-visualizer/references/genui-widget/SKILL.md new file mode 100644 index 00000000..1d76ac26 --- /dev/null +++ b/plugins/eritan561006-png/minimax-aerospace-design/skills/aerospace-3d-modeling-visualizer/references/genui-widget/SKILL.md @@ -0,0 +1,425 @@ +--- +name: genui-widget +description: + 'GenUI widget authoring infrastructure — provides the DSL protocol, security + constraints, --mw-* theme token system, Chart.js/CSS/SVG rendering patterns, and sendPrompt + interaction mechanism. Business skills (data-visualize, financial-analysis, etc.) compose on top + of this to output widgets. Not directly triggered — loaded by reference from business skills.' +--- + +# GenUI Widget + +## What this skill is + +This is a **tool skill**, not a business skill. It does not respond to user triggers directly. +Instead, business skills (e.g. `data-visualize`, `financial-analysis`) reference this skill for the +DSL protocol, security rules, theme tokens, rendering patterns, and interaction mechanisms needed to +output `` blocks. + +If the user explicitly invokes `/genui-widget`, treat it as a compact data-visualization request and +produce the widget yourself using this contract. Do not refuse or explain that this is only an +infrastructure skill. + +## Output routing contract + +Widgets are output **directly in `msg_content` text** — the host streaming parser picks up +`` blocks from the text channel and renders them inline as themed, sandboxed iframes. + +- Do NOT use the `write` tool to save widget DSL to a file — files on disk are invisible to the + rendering pipeline. This includes "drafting" the widget to a temp file first and then copying it + into `msg_content`; that workflow produces a duplicate file artifact the user never asked for. +- Do NOT create workspace directories or HTML files for the visualization. +- Even when the widget is large (200+ lines), output it directly inline in your response text. The + streaming parser handles arbitrarily long widgets. +- The host renders widgets as interactive iframes with Chart.js, theme sync, and clickable + drill-down — directly in the conversation. + +## Final answer contract + +The final assistant message must be concise and render-ready: + +- Output exactly one complete `...` block by default. Do not output + draft widgets, replacement widgets, or multiple alternative widgets unless the user explicitly + asks for multiple separate views. +- Use this response shape: optional one-sentence intro, then the widget, then optional one-sentence + conclusion. Total prose outside the widget should be no more than two short sentences. +- Never output ``, ``, hidden reasoning, planning notes, implementation walkthroughs, + tool transcripts, validation logs, or model self-talk in `msg_content`. +- Do not duplicate widget content outside the widget as Markdown tables, long bullet lists, or a + second written analysis. Put the analytical substance inside the widget and its fallback. +- If you realize the first widget design is wrong before sending, fix it in place and send only the + corrected final widget. + +## Theme safety gate + +This gate constrains theme values only. The model still generates the layout, visual hierarchy, +component composition, and interaction presentation that best fit the user's data and task. + +Use only these host-defined tokens in theme-sensitive CSS: + +`--mw-bg`, `--mw-surface`, `--mw-surface-muted`, `--mw-text`, `--mw-text-muted`, +`--mw-text-subtle`, `--mw-border`, `--mw-accent`, `--mw-success`, `--mw-danger`, `--mw-warning`, +`--mw-chart-1` through `--mw-chart-6`, `--mw-chart-grid`, `--mw-chart-axis`. + +Do not invent `--mw-*` aliases such as `--mw-fg`, `--mw-muted`, `--mw-bg-soft`, `--mw-card`, +`--mw-primary-bg`, or `--mw-warn-bg`. Do not add fallback values to `var(--mw-*)`; use +`var(--mw-text)`, never `var(--mw-text, #111)`. Do not use a fixed light or dark palette for +background, text, border, SVG, chart, hover, focus, selected, or disabled states. Hardcoded colors +are allowed only for rare data-specific semantic marks when no host token exists. + +Before emitting a Widget, scan every `--mw-*` reference and every theme-sensitive color declaration +against this gate. An opening tag with `theme="app"` does not make invalid CSS theme-safe. + +## Kind catalog + +| Kind | Purpose | +| ------------- | --------------------------------------------------------------------------------------------------- | +| `chart` | Single chart or chart pair for trend, comparison, distribution, or correlation (Chart.js available) | +| `dashboard` | KPI cards plus one or more charts plus optional table or inspector (Chart.js available) | +| `map` | Spatial data view with geographic or regional overlay and linked analytics | +| `diagram` | Concept flows, architecture graphs, SVG/HTML diagrams with light interactivity | +| `interactive` | Parameter controls that recompute a metric in real time (CSS/SVG/Canvas only, no Chart.js) | +| `form` | Structured input collection | +| `mockup` | UI mockup or wireframe preview | + +## DSL protocol + +Every visualization MUST be wrapped in the `` DSL envelope. Output the widget inline +in your Markdown response — the streaming parser picks it up from the `msg_content` text channel. +The complete Widget MUST be in the final assistant message, after all tool calls and validation have +finished. Do not call any tool after emitting the Widget. Intermediate assistant messages that also +request a tool are execution progress, not a durable user-visible visualization surface. + +``` + + {"summary":"...","dataSource":"...","chartType":"..."} + /* CSS — short block first for streaming */ + + [...] + /* deferred until widget close — reads window.__mavisData, binds interactions */ + Markdown summary when widget cannot render. + +``` + +### Required opening-tag fields + +| Field | Value | Notes | +| -------------- | ----------------------------------------------------------------------------- | --------------------------------------------------------------------------- | +| `version` | `mavis.widget.v1` | Always this value. | +| `kind` | `chart` / `dashboard` / `map` / `diagram` / `interactive` / `form` / `mockup` | Drives rendering strategy and default height. | +| `title` | Short descriptive text | Shown in loading shell, collapse header, accessibility label. | +| `streaming` | `html-first` | Default. Show structure while data loads. | +| `theme` | `app` | Follow host Argon/Mavis theme. | +| `token-set` | `mavis.semantic.v1` | Stable token contract version. | +| `capabilities` | `resize` or `resize,sendPrompt` | Dashboards and widgets with follow-up actions MUST use `resize,sendPrompt`. | + +### Dashboard contract + +For `kind="dashboard"`, the widget is an analytical surface, not a static image. It MUST include: + +1. `capabilities="resize,sendPrompt"` in the opening tag. +2. At least two visible clickable elements, such as KPI cards, anomaly rows, highlighted + chart-linked controls, or bottom action buttons. +3. Matching `window.mavis.sendPrompt(...)` handlers in ``. +4. `` `interactions` entries whose `"capability"` value is exactly `"sendPrompt"`. + +Do not use placeholder capabilities such as `"explain"`, `"drilldown"`, or `"open"`. If a dashboard +genuinely cannot support a meaningful follow-up, use `kind="chart"` instead. + +### Compact dashboard budget + +For normal analytical dashboards, prefer the compact pattern that fits in one conversation turn: + +- 3-4 KPI cards, up to 3 Chart.js charts, and at most one compact insight list/table. +- 2-4 high-value `sendPrompt` targets, not one target per data point. +- `height` around 720-860 for multi-chart dashboards, `min-height` around 520-640, and + `max-height` up to 1200 when the content genuinely needs it. +- The host may grow the iframe beyond the declared `max-height` to fit measured content, + up to a host safety cap. Still provide realistic height values; do not rely on host + auto-growth for layout. +- Avoid full written reports, repeated chart variants, and large raw-data tables inside the widget. + +### Recommended heights + +| kind | height | min-height | max-height | +| -------------- | ------ | ---------- | ---------- | +| chart (single) | 400 | 280 | 560 | +| chart (combo) | 480 | 320 | 640 | +| dashboard | 560 | 400 | 900 | +| map | 480 | 320 | 720 | +| interactive | 420 | 300 | 700 | +| diagram | 400 | 280 | 640 | +| form | 360 | 240 | 600 | +| mockup | 480 | 320 | 800 | + +Use the compact dashboard budget above for dense analytical dashboards with multiple charts. + +### Sub-block streaming order + +1. `` — short CSS first so structure is styled on arrival. +2. `` — visible structure arrives next; SVG containers, KPI cards, section headers. +3. `` — JSON dataset(s) injected into `window.__mavisData` by the host (NOT in the DOM). +4. `` — deferred until widget close; reads data from `window.__mavisData['name']`. +5. `` — Markdown summary capturing key insight and top data points. + +Avoid hidden tabs or `display: none` sections during streaming. Stack content vertically until +scripts run. + +### `` contract + +Always include: + +```json +{ + "summary": "One-sentence takeaway", + "dataSource": "user-provided or description of origin", + "chartType": "line|bar|pie|area|scatter|radar|heatmap|combo|table|kpi|dashboard" +} +``` + +Recommended additional fields: + +```json +{ + "datasetShape": { + "rows": 36, + "dimensions": ["month", "year"], + "measures": ["ridership"] + }, + "interactions": [ + { + "id": "drill-anomaly", + "label": "Explain anomaly", + "capability": "sendPrompt" + } + ] +} +``` + +`datasetShape` helps the host display dataset summary information and aids testing. `interactions` +declares clickable elements for auditability — it does not grant capabilities (that is still +controlled by the opening tag `capabilities` attribute). + +### `` contract + +Always provide: + +1. The key insight or conclusion +2. Top 3-5 data points as a simple list or Markdown table +3. Trend direction if applicable + +The `` block handles render failures (script error, CSP block). It is NOT an excuse +to write a full Markdown analysis outside the widget "just in case." + +- **`` inside the widget**: 2-4 sentence summary + top 3-5 data points. Shown when + the widget iframe fails. +- **Prose outside the widget**: 1-3 sentences of intro/conclusion. NOT a duplicate of the widget + content. +- **Do NOT output Markdown tables that repeat widget data.** The widget IS the visualization. If it + renders, external tables are redundant. If it fails, the fallback covers it. + +## Data handling rules + +1. Use deterministic local or user-provided data. No auth, no remote APIs, no hidden services. +2. Structure datasets as schema-first arrays of objects: + +```json +[ + { "month": "2025-01", "value": 906, "year": 2025, "yoy": -1.1 }, + { "month": "2025-02", "value": 820, "year": 2025, "yoy": -12.5 } +] +``` + +3. Round every displayed number. Use `Intl.NumberFormat` for locale-aware formatting or `.toFixed()` + for fixed decimals. +4. Never reconstruct data from DOM elements in scripts. Read from `window.__mavisData['name']` only. +5. Multiple datasets are allowed — use short, descriptive names: `main`, `events`, `benchmarks`. + Each `` block must have a unique `name` attribute. + +## Security constraints + +The following are hard prohibitions for all widget output: + +- No `