@huaqiu/dsh-eda-host 0.4.5 → 0.4.6

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.
package/lib/index.mjs CHANGED
@@ -327,7 +327,7 @@ function createEdaHostTools(env) {
327
327
  return [
328
328
  defineTool({
329
329
  name: "get_eda_host_info",
330
- description: "Describe the EDA host currently connected through hq-edge (DSH → dsh-eda-host → hq-edge → EDA host). Returns { ok, info: { identity: { hostType, hostName, version }, installation: { applicationPath, executables[]: { name, path } } } }. Use it when you need factual information about the current EDA environment, such as \"what EDA host am I connected to\", \"what version is it\", \"where is it installed\", or \"where is kicad-cli\". The returned information is authoritative host-provided ground truth. " + ERROR_SEMANTICS,
330
+ description: "Describe the EDA host currently connected through hq-edge (DSH → dsh-eda-host → hq-edge → EDA host). Returns { ok, info: { identity: { hostType, hostName, version }, installation: { applicationPath, executables[]: { name, path } } } }. Use it when you need factual information about the current EDA environment, such as \"what EDA host am I connected to\", \"what version is it\", \"where is it installed\", or \"where is kicad-cli\". When the host is KiCad, the executable list also carries \"kicad-python\" — the interpreter bundled with KiCad that owns the official kicad-python package (kipy); the dsh-kicad skills already run with it automatically. The returned information is authoritative host-provided ground truth. " + ERROR_SEMANTICS,
331
331
  parameters: {},
332
332
  output: {
333
333
  schema: { type: "json" },
@@ -418,6 +418,30 @@ const name = "@huaqiu/dsh-eda-host";
418
418
  */
419
419
  const inject = ["hqEdge", "tools"];
420
420
  const log = getLogger("dsh-eda-host");
421
+ /**
422
+ * Env vars relevant to the hq-edge / DSH / KiCad integration, captured at
423
+ * plugin apply() time so startup issues are diagnosable from the log.
424
+ *
425
+ * Values are logged verbatim EXCEPT `KICAD_API_TOKEN`, which is a live
426
+ * credential KiCad injects for the IPC socket — only its presence is logged
427
+ * (never the token itself).
428
+ */
429
+ const DSH_ENV_LOG_KEYS = [
430
+ "DSH_KICAD_PYTHON",
431
+ "DSH_KICAD_SKILLS_DIR",
432
+ "DSH_HOME",
433
+ "HQ_EDGE_BASE_URL",
434
+ "KICAD_API_SOCKET",
435
+ "KICAD_API_TOKEN"
436
+ ];
437
+ function envSnapshot() {
438
+ const snapshot = {};
439
+ for (const key of DSH_ENV_LOG_KEYS) {
440
+ const value = process.env[key];
441
+ snapshot[key] = key === "KICAD_API_TOKEN" ? value ? "<set>" : null : value ?? null;
442
+ }
443
+ return snapshot;
444
+ }
421
445
  log.info("dsh-eda-host: module loaded (waiting for the hqEdge + tools services)");
422
446
  /**
423
447
  * Host plugin body — provide `edaHost` and register the three netlist tools.
@@ -449,7 +473,8 @@ function apply(ctx, config = {}) {
449
473
  hqEdgeBaseUrlFromConfig: resolved.hqEdgeBaseUrl ?? null,
450
474
  netlistPathPrefix: resolved.netlistPathPrefix,
451
475
  hostPathPrefix: resolved.hostPathPrefix,
452
- requestTimeoutMs: resolved.requestTimeoutMs
476
+ requestTimeoutMs: resolved.requestTimeoutMs,
477
+ env: envSnapshot()
453
478
  });
454
479
  const client = createEdaHostClient(resolved, { baseUrlResolver: getHqEdgeBaseUrl });
455
480
  ctx.effect(() => ctx.provide("edaHost", client));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huaqiu/dsh-eda-host",
3
- "version": "0.4.5",
3
+ "version": "0.4.6",
4
4
  "type": "module",
5
5
  "main": "./lib/index.mjs",
6
6
  "types": "./lib/index.d.mts",
@@ -22,7 +22,7 @@
22
22
  "@deepseek-ai/dsh-tools": "^0.1.0-rc.0"
23
23
  },
24
24
  "dependencies": {
25
- "@huaqiu/dsh-plugin-log": "0.4.5"
25
+ "@huaqiu/dsh-plugin-log": "0.4.6"
26
26
  },
27
27
  "files": [
28
28
  "lib",
package/src/index.ts CHANGED
@@ -112,6 +112,32 @@ declare module '@deepseek-ai/cordis' {
112
112
  const COMPONENT = 'dsh-eda-host'
113
113
  const log = getLogger(COMPONENT)
114
114
 
115
+ /**
116
+ * Env vars relevant to the hq-edge / DSH / KiCad integration, captured at
117
+ * plugin apply() time so startup issues are diagnosable from the log.
118
+ *
119
+ * Values are logged verbatim EXCEPT `KICAD_API_TOKEN`, which is a live
120
+ * credential KiCad injects for the IPC socket — only its presence is logged
121
+ * (never the token itself).
122
+ */
123
+ const DSH_ENV_LOG_KEYS = [
124
+ 'DSH_KICAD_PYTHON',
125
+ 'DSH_KICAD_SKILLS_DIR',
126
+ 'DSH_HOME',
127
+ 'HQ_EDGE_BASE_URL',
128
+ 'KICAD_API_SOCKET',
129
+ 'KICAD_API_TOKEN',
130
+ ] as const
131
+
132
+ function envSnapshot(): Record<string, string | null> {
133
+ const snapshot: Record<string, string | null> = {}
134
+ for (const key of DSH_ENV_LOG_KEYS) {
135
+ const value = process.env[key]
136
+ snapshot[key] = key === 'KICAD_API_TOKEN' ? (value ? '<set>' : null) : (value ?? null)
137
+ }
138
+ return snapshot
139
+ }
140
+
115
141
  // Emitted on import, before any Cordis dependency is resolved. Pairs with the
116
142
  // "node half ready" marker in apply(): if this line is logged but that one is
117
143
  // not, the edge-bridge never provided `hqEdge` and this plugin is still
@@ -182,6 +208,7 @@ export function apply(ctx: Context, config: Partial<EdaHostConfig> = {}): () =>
182
208
  netlistPathPrefix: resolved.netlistPathPrefix,
183
209
  hostPathPrefix: resolved.hostPathPrefix,
184
210
  requestTimeoutMs: resolved.requestTimeoutMs,
211
+ env: envSnapshot(),
185
212
  })
186
213
 
187
214
  const client = createEdaHostClient(resolved, { baseUrlResolver: getHqEdgeBaseUrl })
package/src/tools.ts CHANGED
@@ -179,6 +179,9 @@ export function createNetListTools(env: NetlistToolEnv) {
179
179
  `Use it when you need factual information about the current EDA environment, such as ` +
180
180
  `"what EDA host am I connected to", "what version is it", "where is it installed", ` +
181
181
  `or "where is kicad-cli". ` +
182
+ `When the host is KiCad, the executable list also carries "kicad-python" — the ` +
183
+ `interpreter bundled with KiCad that owns the official kicad-python package ` +
184
+ `(kipy); the dsh-kicad skills already run with it automatically. ` +
182
185
  `The returned information is authoritative host-provided ground truth. ` +
183
186
  ERROR_SEMANTICS,
184
187
  parameters: {},