@huaqiu/dsh-eda-host 0.3.21 → 0.3.22

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/cordis.patch.yml CHANGED
@@ -1,8 +1,11 @@
1
1
  # DSH bundle patch: inserts the Huaqiu EDA host netlist tool plugin.
2
- # The entry inject must match the node-half module contract (`src/index.ts`
3
- # export const inject). The tool's apply() reads the `tools` service; the
4
- # hq-edge supervisor delivers the base URL as overlay config.
2
+ # The entry `inject` MUST match the node-half module contract (`src/index.ts`
3
+ # `export const inject`): `hqEdge` + `tools`. `hqEdge` is REQUIRED — the
4
+ # edge-bridge (HOST) provides it and its `baseUrl` is the loopback HQ Edge
5
+ # endpoint the netlist tools fetch from (`createNodeHqEdge(upstreamRoot,…)` →
6
+ # `get baseUrl()`). Omitting `hqEdge` from inject makes `apply()`'s
7
+ # `ctx.hqEdge` access throw `cannot get property "hqEdge" without inject`.
5
8
  - insert:
6
9
  - id: huaqiu-dsh-eda-host
7
10
  name: '@huaqiu/dsh-eda-host'
8
- inject: ['tools']
11
+ inject: ['hqEdge', 'tools']
package/lib/index.d.mts CHANGED
@@ -89,8 +89,23 @@ interface EdaHostClient {
89
89
  //#region src/index.d.ts
90
90
  /** Plugin id — matches package.json. */
91
91
  declare const name = "@huaqiu/dsh-eda-host";
92
- /** Cordis services this half depends on. */
93
- declare const inject: readonly ["tools"];
92
+ /**
93
+ * Cordis services this half depends on.
94
+ *
95
+ * `hqEdge` is REQUIRED: the edge-bridge (the HOST) provides the node-side
96
+ * `hqEdge` service whose `baseUrl` is the loopback HQ Edge endpoint
97
+ * (`createNodeHqEdge(upstreamRoot, …)` → `get baseUrl()`). Without it the
98
+ * plugin cannot reach hq-edge at all — by design it cannot work standalone
99
+ * (the user-confirmed contract is "eda-host cannot work without hqEdge").
100
+ * Declaring it here is what lets `apply()` read `ctx.hqEdge` without Cordis
101
+ * throwing `cannot get property "hqEdge" without inject` (its context proxy
102
+ * walks the fiber tree and throws at the root fiber when the service was
103
+ * never injected into this plugin's fiber).
104
+ *
105
+ * `tools` is the DSH node runtime tool registry used to register the netlist
106
+ * tools.
107
+ */
108
+ declare const inject: readonly ["hqEdge", "tools"];
94
109
  declare module '@deepseek-ai/cordis' {
95
110
  interface Context {
96
111
  edaHost: EdaHostClient;
@@ -100,7 +115,16 @@ declare module '@deepseek-ai/cordis' {
100
115
  * lazily so this plugin does not hard-depend on the bridge and still works
101
116
  * in standalone DSH installs (where the service is absent).
102
117
  */
103
- hqEdge?: {
118
+ /**
119
+ * Provided by the hq-edge `edge-bridge` plugin (the HOST). `baseUrl` is the
120
+ * loopback HQ Edge endpoint, e.g. "http://localhost:18080". This is a
121
+ * REQUIRED inject (see `export const inject` above): `apply()` reads
122
+ * `ctx.hqEdge` to resolve the endpoint, so the service must be present or
123
+ * Cordis throws `cannot get property "hqEdge" without inject`. When present
124
+ * but its `baseUrl` is empty, the netlist tools degrade to a clear
125
+ * FAILED_PRECONDITION rather than throwing at load time.
126
+ */
127
+ hqEdge: {
104
128
  baseUrl?: string;
105
129
  };
106
130
  }
package/lib/index.mjs CHANGED
@@ -164,8 +164,23 @@ function createNetListTools(env) {
164
164
  //#region src/index.ts
165
165
  /** Plugin id — matches package.json. */
166
166
  const name = "@huaqiu/dsh-eda-host";
167
- /** Cordis services this half depends on. */
168
- const inject = ["tools"];
167
+ /**
168
+ * Cordis services this half depends on.
169
+ *
170
+ * `hqEdge` is REQUIRED: the edge-bridge (the HOST) provides the node-side
171
+ * `hqEdge` service whose `baseUrl` is the loopback HQ Edge endpoint
172
+ * (`createNodeHqEdge(upstreamRoot, …)` → `get baseUrl()`). Without it the
173
+ * plugin cannot reach hq-edge at all — by design it cannot work standalone
174
+ * (the user-confirmed contract is "eda-host cannot work without hqEdge").
175
+ * Declaring it here is what lets `apply()` read `ctx.hqEdge` without Cordis
176
+ * throwing `cannot get property "hqEdge" without inject` (its context proxy
177
+ * walks the fiber tree and throws at the root fiber when the service was
178
+ * never injected into this plugin's fiber).
179
+ *
180
+ * `tools` is the DSH node runtime tool registry used to register the netlist
181
+ * tools.
182
+ */
183
+ const inject = ["hqEdge", "tools"];
169
184
  const log = getLogger("dsh-eda-host");
170
185
  /**
171
186
  * Host plugin body — provide `edaHost` and register the three netlist tools.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huaqiu/dsh-eda-host",
3
- "version": "0.3.21",
3
+ "version": "0.3.22",
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.3.21"
25
+ "@huaqiu/dsh-plugin-log": "0.3.22"
26
26
  },
27
27
  "files": [
28
28
  "lib",
package/src/index.ts CHANGED
@@ -13,9 +13,12 @@
13
13
  * This plugin owns DSH integration only: it translates tool calls into hq-edge
14
14
  * requests and returns the semantic `SchematicNetlist`. It contains no
15
15
  * KiCad-specific logic, no schematic parsing, and no host IPC. The plugin is
16
- * self-contained — no `@hqedge/*` dependency; the base URL is delivered by the
17
- * hq-edge supervisor as overlay config (`hqEdgeBaseUrl`), with
18
- * `HQ_EDGE_BASE_URL` as env fallback (same convention as `@huaqiu/dsh-auth`).
16
+ * self-contained — no `@hqedge/*` dependency. The base URL is resolved at
17
+ * request time in this order: (1) the `ctx.hqEdge.baseUrl` service provided by
18
+ * the edge-bridge HOST (the loopback HQ Edge endpoint), then (2) the
19
+ * supervisor's overlay config (`hqEdgeBaseUrl`), then (3) `HQ_EDGE_BASE_URL`
20
+ * env fallback (same convention as `@huaqiu/dsh-auth`). `hqEdge` is a REQUIRED
21
+ * inject — the plugin cannot reach hq-edge without the bridge.
19
22
  *
20
23
  * @module @huaqiu/dsh-eda-host
21
24
  */
@@ -28,8 +31,23 @@ import { createNetListTools } from './tools.js'
28
31
  /** Plugin id — matches package.json. */
29
32
  export const name = '@huaqiu/dsh-eda-host'
30
33
 
31
- /** Cordis services this half depends on. */
32
- export const inject = ['tools'] as const
34
+ /**
35
+ * Cordis services this half depends on.
36
+ *
37
+ * `hqEdge` is REQUIRED: the edge-bridge (the HOST) provides the node-side
38
+ * `hqEdge` service whose `baseUrl` is the loopback HQ Edge endpoint
39
+ * (`createNodeHqEdge(upstreamRoot, …)` → `get baseUrl()`). Without it the
40
+ * plugin cannot reach hq-edge at all — by design it cannot work standalone
41
+ * (the user-confirmed contract is "eda-host cannot work without hqEdge").
42
+ * Declaring it here is what lets `apply()` read `ctx.hqEdge` without Cordis
43
+ * throwing `cannot get property "hqEdge" without inject` (its context proxy
44
+ * walks the fiber tree and throws at the root fiber when the service was
45
+ * never injected into this plugin's fiber).
46
+ *
47
+ * `tools` is the DSH node runtime tool registry used to register the netlist
48
+ * tools.
49
+ */
50
+ export const inject = ['hqEdge', 'tools'] as const
33
51
 
34
52
  export type { EdaHostConfig } from './config.js'
35
53
  export type { EdaHostClient } from './client.js'
@@ -53,7 +71,16 @@ declare module '@deepseek-ai/cordis' {
53
71
  * lazily so this plugin does not hard-depend on the bridge and still works
54
72
  * in standalone DSH installs (where the service is absent).
55
73
  */
56
- hqEdge?: { baseUrl?: string }
74
+ /**
75
+ * Provided by the hq-edge `edge-bridge` plugin (the HOST). `baseUrl` is the
76
+ * loopback HQ Edge endpoint, e.g. "http://localhost:18080". This is a
77
+ * REQUIRED inject (see `export const inject` above): `apply()` reads
78
+ * `ctx.hqEdge` to resolve the endpoint, so the service must be present or
79
+ * Cordis throws `cannot get property "hqEdge" without inject`. When present
80
+ * but its `baseUrl` is empty, the netlist tools degrade to a clear
81
+ * FAILED_PRECONDITION rather than throwing at load time.
82
+ */
83
+ hqEdge: { baseUrl?: string }
57
84
  }
58
85
  }
59
86