app
Parts Search
Public Made by Adomby adom
One search box across Mouser, DigiKey and JLCPCB: parallel queries, side-by-side product photos, and a Mouser-preferred recommendation that reasons around stock and lead time.
← Commit history
v2.0.9: Module 2.4.0: the panel gutter check now measures against the containing block
6 files changed
+54−97
Cargo.lock+1−1@@ -10,7 +10,7 @@ checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" [[package]] name = "adom-parts-search"-version = "2.0.8"+version = "2.0.9" dependencies = [ "base64", "clap",
Cargo.toml+1−1@@ -1,6 +1,6 @@ [package] name = "adom-parts-search"-version = "2.0.8"+version = "2.0.9" edition = "2021" description = "Parts Search Electronics component search — CLI, backend HTTP service, and Hydrogen webview app" license = "MIT"
VERSION+1−1@@ -1 +1 @@-2.0.8+2.0.9
package.json+2−41@@ -1,6 +1,6 @@ { "slug": "adom-parts-search",- "version": "2.0.9",+ "version": "2.0.4", "type": "app", "description": "One search box across Mouser, DigiKey and JLCPCB. Parallel queries, side-by-side product photos, and a Mouser-preferred recommendation that reasons around stock and lead time. Dock Bar ready: serve, health, settings, Say it.", "dependencies": {@@ -38,44 +38,5 @@ "SKILL.md", "BUILD-SKILL.md", "CHANGELOG.md"- ],- "changelog": "Module 2.4.0: the panel gutter check now measures against the containing block",- "discovery_triggers": [- "parts search",- "find part",- "source component",- "source part",- "compare distributors",- "compare vendors",- "Mouser or DigiKey",- "BOM sourcing",- "price this part",- "where can I get",- "check stock",- "parts availability",- "fastest delivery",- "cheapest part",- "component search",- "part lookup",- "price breaks"- ],- "discovery_pitch": "Search Mouser, DigiKey and JLCPCB in parallel with product photos; Mouser-preferred best-source pick. Say 'with parts search' to your AI.",- "sample_prompts": [- {- "label": "source an STM32F103RBT6",- "prompt": "source an STM32F103RBT6"- },- {- "label": "where can I get an ESP32-S3-WROOM cheape",- "prompt": "where can I get an ESP32-S3-WROOM cheapest and fastest"- },- {- "label": "compare Mouser, DigiKey and JLCPCB for a",- "prompt": "compare Mouser, DigiKey and JLCPCB for an LM555"- },- {- "label": "price this BOM across distributors",- "prompt": "price this BOM across distributors"- } ]-}+}
page.json+9−50@@ -4,7 +4,7 @@ "slug": "adom-parts-search", "title": "Parts Search", "brief": "One search box across Mouser, DigiKey and JLCPCB: parallel queries, side-by-side product photos, and a Mouser-preferred recommendation that reasons around stock and lead time.",- "version": "2.0.9",+ "version": "2.0.4", "install": { "binary_name": "adom-parts-search", "install_dir": "",@@ -33,25 +33,13 @@ }, "hero": { "type": "image",- "path": "screenshots/hero.png"+ "path": "docs/hero.png" }, "sample_prompts": [- {- "label": "source an STM32F103RBT6",- "prompt": "source an STM32F103RBT6"- },- {- "label": "where can I get an ESP32-S3-WROOM cheape",- "prompt": "where can I get an ESP32-S3-WROOM cheapest and fastest"- },- {- "label": "compare Mouser, DigiKey and JLCPCB for a",- "prompt": "compare Mouser, DigiKey and JLCPCB for an LM555"- },- {- "label": "price this BOM across distributors",- "prompt": "price this BOM across distributors"- }+ "source an STM32F103RBT6",+ "where can I get an ESP32-S3-WROOM cheapest and fastest",+ "compare Mouser, DigiKey and JLCPCB for an LM555",+ "price this BOM across distributors" ], "discovery_triggers": [ "parts search",@@ -66,41 +54,12 @@ "where can I get", "check stock", "parts availability",- "fastest delivery",- "cheapest part",- "component search",- "part lookup",- "price breaks"+ "fastest delivery" ],- "discovery_pitch": "Search Mouser, DigiKey and JLCPCB in parallel with product photos; Mouser-preferred best-source pick. Say 'with parts search' to your AI.",+ "discovery_pitch": "Search Mouser + DigiKey + JLCPCB in parallel from one interface, with product photos and a Mouser-preferred best-source pick.", "metadata": { "platform": "linux" }, "category": "tools",- "org": "adom",- "description": "One search box across Mouser, DigiKey and JLCPCB. Parallel queries, side-by-side product photos, and a Mouser-preferred recommendation that reasons around stock and lead time. Dock Bar ready: serve, health, settings, Say it.",- "dependencies": {- "adom/adom-mouser": "*",- "adom/adom-digikey": "*",- "adom/adom-jlcpcb": "*"- },- "needs_sudo": false,- "scripts": {- "install": "./install.sh",- "uninstall": "./uninstall.sh"- },- "files": [- "bin/**",- "skills/**",- "docs/icon.svg",- "dockbar.json",- "install.sh",- "uninstall.sh",- "package.json",- "README.md",- "SKILL.md",- "BUILD-SKILL.md",- "CHANGELOG.md"- ],- "changelog": "Module 2.4.0: the panel gutter check now measures against the containing block"+ "org": "adom" }
src/vendors.rs+40−3@@ -259,13 +259,50 @@ fn adom_api_key() -> Option<String> { .filter(|s| !s.is_empty()) } -/// Identify every outbound call: the key when we have one, and always a-/// caller label + User-Agent so the backend can name us even before keys are-/// enforced.+/// The ADOM USER this process is acting for, resolved once and cached.+///+/// WHY: the API key identifies the APPLICATION. Every search from every person+/// running Parts Search looked identical in the vendors' journals, so "who is+/// spending the quota" could only ever be answered as "Parts Search" — true and+/// useless. This adds the person.+///+/// Resolved ONCE, not per search: `adom-cli carbon user get` is a network round+/// trip, and doing it per query would add its latency to every search and its+/// failure modes to every search's error path.+///+/// A failure here is NOT fatal. If identity cannot be resolved the searches+/// still run, unattributed — losing a metric is an acceptable outcome, losing+/// the feature is not.+fn adom_user() -> Option<String> {+ use std::sync::OnceLock;+ static USER: OnceLock<Option<String>> = OnceLock::new();+ USER.get_or_init(|| {+ if let Ok(u) = std::env::var("ADOM_USER") {+ if !u.trim().is_empty() { return Some(u.trim().to_string()); }+ }+ let out = std::process::Command::new("adom-cli")+ .args(["carbon", "user", "get"])+ .output()+ .ok()?;+ if !out.status.success() { return None; }+ let v: Value = serde_json::from_slice(&out.stdout).ok()?;+ // The opaque id, not the email: these land in log files that get read,+ // shipped and pasted, and an id is enough to group by.+ v.get("id").and_then(|x| x.as_str()).map(|s| s.to_string())+ })+ .clone()+}++/// Identify every outbound call: the key when we have one, always a caller+/// label and User-Agent, and the Adom user when it can be resolved. fn identify(req: ureq::Request) -> ureq::Request { let req = req .set("X-Adom-Caller", "parts-search") .set("User-Agent", concat!("adom-parts-search/", env!("CARGO_PKG_VERSION")));+ let req = match adom_user() {+ Some(u) => req.set("X-Adom-User", &u),+ None => req,+ }; match adom_api_key() { Some(k) => req.set("X-Adom-Key", &k), None => req,