@huaqiu/dsh-hqsch 0.4.8

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 (64) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +43 -0
  3. package/cordis.patch.yml +13 -0
  4. package/lib/index.d.mts +98 -0
  5. package/lib/index.mjs +159 -0
  6. package/package.json +40 -0
  7. package/skills/hqsch-scenario-b/AGENTS.md +209 -0
  8. package/skills/hqsch-scenario-b/CLAUDE.md +209 -0
  9. package/skills/hqsch-scenario-b/INSTALL.md +140 -0
  10. package/skills/hqsch-scenario-b/SKILL.md +107 -0
  11. package/skills/hqsch-scenario-b/SYSTEM-PROMPT.md +209 -0
  12. package/skills/hqsch-scenario-b/docs/circuit-pattern-layout.md +304 -0
  13. package/skills/hqsch-scenario-b/docs/editing-a-circuit.md +167 -0
  14. package/skills/hqsch-scenario-b/docs/part-search.md +244 -0
  15. package/skills/hqsch-scenario-b/docs/placement-conventions.md +714 -0
  16. package/skills/hqsch-scenario-b/docs/property-conventions.md +225 -0
  17. package/skills/hqsch-scenario-b/docs/quickstart.md +99 -0
  18. package/skills/hqsch-scenario-b/docs/reading-a-circuit.md +317 -0
  19. package/skills/hqsch-scenario-b/docs/rpc/canvas-auto-connect-objects-by-id.md +98 -0
  20. package/skills/hqsch-scenario-b/docs/rpc/canvas-delete-objects-by-ids.md +94 -0
  21. package/skills/hqsch-scenario-b/docs/rpc/canvas-find-object-by-property.md +101 -0
  22. package/skills/hqsch-scenario-b/docs/rpc/canvas-list-wire-segments.md +94 -0
  23. package/skills/hqsch-scenario-b/docs/rpc/canvas-mirror-objects-by-ids.md +96 -0
  24. package/skills/hqsch-scenario-b/docs/rpc/canvas-rotate-objects-by-ids.md +94 -0
  25. package/skills/hqsch-scenario-b/docs/rpc/canvas-set-object-property.md +99 -0
  26. package/skills/hqsch-scenario-b/docs/rpc/canvas-zoom-all.md +92 -0
  27. package/skills/hqsch-scenario-b/docs/rpc/find-find-object.md +96 -0
  28. package/skills/hqsch-scenario-b/docs/rpc/kernel-get-snapshot.md +104 -0
  29. package/skills/hqsch-scenario-b/docs/rpc/netlist-get-active-page-net-list.md +87 -0
  30. package/skills/hqsch-scenario-b/docs/rpc/netlist-get-port-pairing.md +34 -0
  31. package/skills/hqsch-scenario-b/docs/rpc/obj-place-place-pin-stub-wire-and-net-alias.md +114 -0
  32. package/skills/hqsch-scenario-b/docs/rpc/pattern-layout-apply-circuit-pattern.md +125 -0
  33. package/skills/hqsch-scenario-b/docs/rpc/pattern-layout-get-page-occupancy.md +100 -0
  34. package/skills/hqsch-scenario-b/docs/rpc/pattern-layout-list-circuit-patterns.md +97 -0
  35. package/skills/hqsch-scenario-b/docs/rpc/placement-list-part-libraries.md +94 -0
  36. package/skills/hqsch-scenario-b/docs/rpc/placement-list-symbol-libraries.md +94 -0
  37. package/skills/hqsch-scenario-b/docs/rpc/placement-place-kicad-symbol.md +105 -0
  38. package/skills/hqsch-scenario-b/docs/rpc/placement-place-part-from-library.md +106 -0
  39. package/skills/hqsch-scenario-b/docs/rpc/placement-place-symbol-from-library.md +108 -0
  40. package/skills/hqsch-scenario-b/docs/rpc/project-get-active-project.md +96 -0
  41. package/skills/hqsch-scenario-b/docs/rpc/project-list-open-projects.md +99 -0
  42. package/skills/hqsch-scenario-b/docs/rpc-availability.md +97 -0
  43. package/skills/hqsch-scenario-b/docs/rpc-index/canvas.md +81 -0
  44. package/skills/hqsch-scenario-b/docs/rpc-index/find.md +36 -0
  45. package/skills/hqsch-scenario-b/docs/rpc-index/kernel.md +36 -0
  46. package/skills/hqsch-scenario-b/docs/rpc-index/netlist.md +38 -0
  47. package/skills/hqsch-scenario-b/docs/rpc-index/obj-place.md +76 -0
  48. package/skills/hqsch-scenario-b/docs/rpc-index/pattern-layout.md +38 -0
  49. package/skills/hqsch-scenario-b/docs/rpc-index/placement.md +48 -0
  50. package/skills/hqsch-scenario-b/docs/rpc-index/project.md +47 -0
  51. package/skills/hqsch-scenario-b/docs/serialization.md +60 -0
  52. package/skills/hqsch-scenario-b/docs/skill-dependencies.md +93 -0
  53. package/skills/hqsch-scenario-b/skill.json +13 -0
  54. package/skills/hqsch-scenario-b/template/package.json +16 -0
  55. package/skills/hqsch-scenario-b/template/scripts/edit-property-by-ref.ts +44 -0
  56. package/skills/hqsch-scenario-b/template/scripts/fix-designators.ts +52 -0
  57. package/skills/hqsch-scenario-b/template/scripts/hello.ts +46 -0
  58. package/skills/hqsch-scenario-b/template/scripts/read-circuit.ts +357 -0
  59. package/skills/hqsch-scenario-b/template/scripts/replace-part-by-ref.ts +44 -0
  60. package/skills/hqsch-scenario-b/template/scripts/rewire-pin-by-ref.ts +42 -0
  61. package/skills/hqsch-scenario-b/template/tsconfig.json +11 -0
  62. package/src/config.ts +25 -0
  63. package/src/index.ts +186 -0
  64. package/src/paths.ts +48 -0
@@ -0,0 +1,244 @@
1
+ ---
2
+ name: eda-part-search
3
+ metadata:
4
+ category: part-search
5
+ scope: capability
6
+ description: >-
7
+ Search and inspect electronic components and EDA models (symbol, footprint, 3D, simulation) plus supply-chain data. Invoke when the user needs to find an MPN, compare parts, or obtain model URLs before schematic placement — always call search before getEdaModels or PlaceKicadSymbol.
8
+ version: 0.1.0
9
+ vendor: Huaqiu Electronics
10
+ providers:
11
+ - huaqiu
12
+ tags:
13
+ - eda
14
+ - huaqiu
15
+ - part-search
16
+ - components
17
+ - mpn
18
+ - symbol
19
+ - footprint
20
+ entry: "@huaqiu/huaqiu-client"
21
+ manifest: "@huaqiu/huaqiu-client/skill.json"
22
+ ---
23
+
24
+ # EDA Part Search
25
+
26
+ Hand-authored capability skill for **searching and inspecting electronic
27
+ components** and their EDA models. Use this when an agent needs to turn a
28
+ vague functional need ("I need a 32-bit MCU around 72 MHz") or a partial MPN
29
+ into concrete, EDA-ready part identities backed by a schematic symbol, PCB
30
+ footprint, 3D model, and supply-chain availability.
31
+
32
+ > **This is a capability skill, not a protobuf-generated skill.** The 121
33
+ > generated EDA capabilities (BOM, ERC, canvas, placement, …) live in
34
+ > sibling folders and are regenerated from the Connect-ES SDK surface. This
35
+ > skill is hand-authored because its value is *agent reasoning* — when to
36
+ > search, how to constrain a query, how to verify EDA-model coverage, and
37
+ > when to fall back — none of which is expressible in a protobuf contract.
38
+
39
+ ## When to Use
40
+
41
+ Use this capability when the user, a playbook, or another skill needs to:
42
+
43
+ - **Find a component** by keyword, partial MPN, or functional description
44
+ (e.g. "STM32F103", "0402 10k resistor", "32-bit microcontroller 72MHz").
45
+ - **Compare candidate MPNs** for the same functional role and pick one.
46
+ - **Inspect a part's specifications** — attributes, categories, datasheets,
47
+ package, tags — before committing to it in a design.
48
+ - **Retrieve EDA models** — confirm a schematic symbol / PCB footprint / 3D
49
+ model / simulation model exists and obtain the URL to fetch it.
50
+ - **Inspect supply-chain information** — stock, MOQ, lead time, price breaks,
51
+ distributor links — for procurement or availability gating.
52
+
53
+ Do **not** use this skill for:
54
+
55
+ - Placing a part you already fully identified onto the canvas — use
56
+ [`placement-place-kicad-symbol`](../placement/place-kicad-symbol/SKILL.md)
57
+ after `get_hqsch_part_models` returns symbol/footprint URLs (maps to
58
+ `SCH_PlaceKicadSymbolFromResource`). Fall back to
59
+ [`placement-place-part-from-library`](../placement/place-part-from-library/SKILL.md)
60
+ only when online search has no suitable match.
61
+ - Editing object properties of an already-placed part — use
62
+ [`canvas-set-object-property`](../canvas/set-object-property/SKILL.md).
63
+ - BOM extraction from an existing schematic — use
64
+ [`bom-get-bom`](../bom/get-bom/SKILL.md). Part search is for *discovery*;
65
+ BOM is for *what is already placed*.
66
+
67
+ ## The Semantic Workflow
68
+
69
+ Part search is a **progressive retrieval** capability. Never call
70
+ `get_hqsch_part` or `get_hqsch_part_models` with a keyword you invented —
71
+ always start from `search_hqsch_parts` and drill down using the
72
+ `manufacturerId` + `mpn` pair the search returns.
73
+
74
+ ```
75
+ user need (keyword / partial MPN / description)
76
+ │
77
+ ▼
78
+ 1. search_hqsch_parts → candidate list (MPN, mfr, package, model flags)
79
+ │ pick a candidate
80
+ ▼
81
+ 2. get_hqsch_part → full detail (attributes, datasheets, tags)
82
+ │ confirm it fits
83
+ ▼
84
+ 3. get_hqsch_part_models → EDA model metadata (symbol/footprint/3D URLs)
85
+ │ optional, for procurement
86
+ ▼
87
+ 4. get_hqsch_supply_chain → stock / MOQ / lead time / price breaks
88
+ ```
89
+
90
+ **Why this order matters:**
91
+
92
+ - `search` is fuzzy and paginated; it returns *just enough* to choose a
93
+ candidate (MPN, manufacturer, package, model-availability flags). It is
94
+ cheap and cached for ~1 minute.
95
+ - `get_hqsch_part` requires the *exact* `(manufacturerId, mpn)` pair that
96
+ `search` returned — partial identifiers are rejected. It returns the full
97
+ detail blob and is cached for ~10 minutes.
98
+ - `get_hqsch_part_models` returns *only* the EDA model URLs — call it when
99
+ you already know the part and just need to know which models exist and
100
+ where to fetch them. Cached ~10 minutes.
101
+ - `get_hqsch_supply_chain` returns volatile stock/price data — call it last,
102
+ only when procurement or availability gating is actually needed. Cached
103
+ ~1 minute.
104
+
105
+ Skipping `search` and jumping to `get_hqsch_part` with a guessed MPN almost
106
+ always fails: Huaqiu manufacturer IDs are opaque numeric strings (e.g.
107
+ `7189` = STMicroelectronics) that the agent cannot guess. Always discover
108
+ them through `search`.
109
+
110
+ ## Available Tools
111
+
112
+ This skill is exposed to agents as four DSH tools registered by the
113
+ `@huaqiu/dsh-tool-part-search` plugin. Each tool calls HQ Edge's internal
114
+ `/api/hqsch/parts/*` API — **agents never contact the upstream Huaqiu host
115
+ directly.** The underlying implementation lives in
116
+ [`@huaqiu/huaqiu-client`](https://www.npmjs.com/package/@huaqiu/huaqiu-client)
117
+ under the `parts` namespace (built on the reusable `@huaqiu/part-search`
118
+ package), and HQ Edge is the single owner of the Huaqiu integration.
119
+
120
+ | Tool | Operation | Progressive step | Detail |
121
+ | --- | --- | --- | --- |
122
+ | [`search_hqsch_parts`](references/search.md) | search | 1 — discover candidates | Keyword → paginated candidate list with model-availability flags |
123
+ | [`get_hqsch_part`](references/part-detail.md) | detail | 2 — inspect a candidate | Full part detail by `(manufacturerId, mpn)` |
124
+ | [`get_hqsch_part_models`](references/eda-models.md) | models | 3 — verify EDA coverage | Symbol / footprint / 3D / simulation URLs only |
125
+ | [`get_hqsch_supply_chain`](references/supply-chain.md) | supply-chain | 4 — procurement | Stock / MOQ / lead time / price breaks (batched) |
126
+
127
+ Full parameter tables, response shapes, and worked examples for each tool
128
+ are in the [references/](references/) subfolders.
129
+
130
+ ## Query Strategy
131
+
132
+ ### Prefer exact MPN, then constrain, then go fuzzy
133
+
134
+ 1. **Exact / partial MPN** — if the user gives an MPN or partial MPN
135
+ (`STM32F103`, `LMV761`), search with that string directly. Matching is
136
+ fuzzy, so related grades/packages will also surface.
137
+ 2. **Constrained specification search** — if no MPN is known, describe the
138
+ part functionally (`32-bit microcontroller 72MHz LQFP64`) and combine
139
+ with the `requirements` filter to insist on the EDA models you need:
140
+ ```json
141
+ {
142
+ "query": "32-bit microcontroller 72MHz",
143
+ "requirements": { "symbol": true, "footprint": true }
144
+ }
145
+ ```
146
+ 3. **Package + value** for passives — `0402 10k resistor`, `0805 100nF cap`.
147
+ The search index understands common package codes.
148
+
149
+ ### Always insist on the EDA models you actually need
150
+
151
+ By default `search_hqsch_parts` returns only parts that have *some* EDA
152
+ model (`require_eda_model` defaults to `true`). For a real PCB design you
153
+ usually need **both** a symbol and a footprint — set `requirements`:
154
+
155
+ ```json
156
+ { "query": "STM32F103", "requirements": { "symbol": true, "footprint": true } }
157
+ ```
158
+
159
+ Set `require_eda_model: false` only for research / market-survey tasks where
160
+ you explicitly want parts without EDA models (e.g. checking whether a
161
+ competitor's part is catalogued at all).
162
+
163
+ ### Don't over-page
164
+
165
+ `search_hqsch_parts` returns up to 50 items per page. If the first page
166
+ doesn't contain a usable candidate, **refine the query** before paging
167
+ forward — adding package code, manufacturer, or a `requirements` filter is
168
+ almost always more effective than scanning page 2+.
169
+
170
+ ## Response Language
171
+
172
+ All four tools accept a `language` field (`"zh"` default, `"en"` available).
173
+ Use `"en"` when the agent's working language or the downstream report is
174
+ English; `"zh"` for HQSCH-native workflows. Descriptions, category names,
175
+ and tag labels are translated; technical fields (MPN, manufacturer id,
176
+ URLs) are not.
177
+
178
+ ## Worked Example: "Find an STM32F103 for a USB HID gadget"
179
+
180
+ ```
181
+ Step 1 — search with EDA-model requirements
182
+ search_hqsch_parts({
183
+ "query": "STM32F103",
184
+ "requirements": { "symbol": true, "footprint": true, "model3d": true },
185
+ "page_size": 10
186
+ })
187
+ → returns candidates incl. STM32F103C8T6 (mfr 7189, LQFP48, all models ✓)
188
+
189
+ Step 2 — inspect the chosen candidate
190
+ get_hqsch_part({
191
+ "manufacturer_id": "7189",
192
+ "mpn": "STM32F103C8T6"
193
+ })
194
+ → confirms core/clk/flash/USB attributes, links the datasheet
195
+
196
+ Step 3 — fetch model URLs (for the placement step later)
197
+ get_hqsch_part_models({
198
+ "manufacturer_id": "7189",
199
+ "mpn": "STM32F103C8T6"
200
+ })
201
+ → returns symbol URL, footprint URL, 3D URL
202
+
203
+ Step 4 — (optional, procurement) check availability
204
+ get_hqsch_supply_chain({
205
+ "parts": [{ "manufacturer_id": "7189", "mpn": "STM32F103C8T6" }]
206
+ })
207
+ → stock / MOQ / price breaks
208
+ ```
209
+
210
+ Once step 3 returns model URLs, hand off to
211
+ [`placement-place-kicad-symbol`](../placement/place-kicad-symbol/SKILL.md)
212
+ (`PlaceKicadSymbol` → `SCH_PlaceKicadSymbolFromResource`) to drop the symbol on
213
+ the canvas. Part search's job ends at returning the model metadata; only fall
214
+ back to [`placement-place-part-from-library`](../placement/place-part-from-library/SKILL.md)
215
+ when online search finds no usable candidate.
216
+
217
+ ## Underlying Implementation
218
+
219
+ | Layer | Owner | Responsibility |
220
+ | --- | --- | --- |
221
+ | This skill (`skills/eda/part-search`) | AI Systems Team | Agent knowledge: when/how to search, workflow, query strategy |
222
+ | `@huaqiu/huaqiu-client` (`.parts` namespace) | Huaqiu AI Platform | Thin executable client boundary for HQ EDA / HQSCH |
223
+ | `@huaqiu/part-search` (this skill's runtime impl) | Huaqiu AI Platform | Raw Huaqiu HTTP client + normalized domain models + zod schemas |
224
+ | HQ Edge `/api/hqsch/parts/*` | HQ Edge Server | HTTP API with caching, validation, error envelope — consumed by HQSCH and the DSH plugin |
225
+ | `@huaqiu/dsh-tool-part-search` | HQ Edge Server | DSH adapter: registers the four agent tools, calls HQ Edge only |
226
+
227
+ Agents and skills must address part search **only** through the four tools
228
+ above. They must not attempt to call `@huaqiu/huaqiu-client` directly from
229
+ skill text, and the DSH plugin must not contact the upstream Huaqiu host —
230
+ HQ Edge is the single integration owner.
231
+
232
+ ## Related Skills
233
+
234
+ - [`placement-place-kicad-symbol`](../placement/place-kicad-symbol/SKILL.md) — **preferred:** place part from online EDA models (`SCH_PlaceKicadSymbolFromResource`).
235
+ - [`placement-place-part-from-library`](../placement/place-part-from-library/SKILL.md) — fallback: place from local/builtin part library.
236
+ - [`bom-get-bom`](../bom/get-bom/SKILL.md) — extract the BOM of parts already placed (not discovery).
237
+ - [`erc-run-checks`](../erc/run-checks/SKILL.md) — validate the design after parts are placed.
238
+
239
+ ## References
240
+
241
+ - [Search reference](references/search.md) — `search_hqsch_parts` parameters, response, examples.
242
+ - [Part detail reference](references/part-detail.md) — `get_hqsch_part`.
243
+ - [EDA models reference](references/eda-models.md) — `get_hqsch_part_models`.
244
+ - [Supply chain reference](references/supply-chain.md) — `get_hqsch_supply_chain`.