@huaqiu/dsh-tool-schematic-gen 0.3.10 → 0.3.11

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
@@ -3,6 +3,7 @@ import { writeFile } from "node:fs/promises";
3
3
  import { tmpdir } from "node:os";
4
4
  import { join } from "node:path";
5
5
  import { defineTool } from "@deepseek-ai/dsh-tools";
6
+ import { getLogger } from "@huaqiu/dsh-plugin-log";
6
7
  //#region src/config.ts
7
8
  /**
8
9
  * `@huaqiu/dsh-tool-schematic-gen` — config, agent identity, run-body and
@@ -709,8 +710,7 @@ async function exportModuleGraphZip(exportZipUrl, moduleGraph, config, account,
709
710
  function asJson(value) {
710
711
  return JSON.parse(JSON.stringify(value));
711
712
  }
712
- /** Console tag for log filtering. */
713
- const LOG_TAG$1 = "[dsh-schematic-gen]";
713
+ const log$1 = getLogger("dsh-schematic-gen");
714
714
  /** Agent-facing timeout hints. */
715
715
  const TOOL_TIMEOUT_MS = {
716
716
  generate_schematic_from_description: HTTP_TIMEOUT_MS,
@@ -733,7 +733,7 @@ async function resolveAccount(auth) {
733
733
  };
734
734
  return null;
735
735
  } catch (err) {
736
- console.warn(LOG_TAG$1, "could not resolve the eda.cn account", String(err?.message || err));
736
+ log$1.warn("could not resolve the eda.cn account", { error: String(err?.message || err) });
737
737
  return null;
738
738
  }
739
739
  }
@@ -798,7 +798,10 @@ async function artifactUriOf(env, id) {
798
798
  if (!env.artifacts || typeof env.artifacts.getDownloadUri !== "function") return null;
799
799
  return await env.artifacts.getDownloadUri(id);
800
800
  } catch (err) {
801
- console.warn(LOG_TAG$1, "getDownloadUri failed for", id, String(err?.message || err));
801
+ log$1.warn("getDownloadUri failed", {
802
+ id,
803
+ error: String(err?.message || err)
804
+ });
802
805
  return null;
803
806
  }
804
807
  }
@@ -1402,8 +1405,7 @@ const inject = [
1402
1405
  "huaqiuArtifacts",
1403
1406
  "webServer"
1404
1407
  ];
1405
- /** Console tag for filtering in logs. */
1406
- const LOG_TAG = "[dsh-schematic-gen]";
1408
+ const log = getLogger("dsh-schematic-gen");
1407
1409
  /**
1408
1410
  * Host plugin body — register the two generation tools.
1409
1411
  *
@@ -1429,7 +1431,7 @@ function apply(ctx, config = {}) {
1429
1431
  path: PROGRESS_ROUTE_PREFIX,
1430
1432
  handler: createProgressHandler(progress)
1431
1433
  }));
1432
- else console.warn(LOG_TAG, "webServer unavailable — live progress reporting is disabled");
1434
+ else log.warn("webServer unavailable — live progress reporting is disabled");
1433
1435
  const disposers = createSchematicGenTools({
1434
1436
  config: finalConfig,
1435
1437
  auth: auth.auth,
@@ -1438,7 +1440,7 @@ function apply(ctx, config = {}) {
1438
1440
  progress,
1439
1441
  deps: {}
1440
1442
  }).map((tool) => ctx.tools.register(tool));
1441
- console.log(LOG_TAG, "registered agent tools", {
1443
+ log.info("registered agent tools", {
1442
1444
  tools: disposers.length,
1443
1445
  copilotkitUrl: finalConfig.copilotkitUrl,
1444
1446
  exportZipUrl: finalConfig.exportZipUrl,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huaqiu/dsh-tool-schematic-gen",
3
- "version": "0.3.10",
3
+ "version": "0.3.11",
4
4
  "type": "module",
5
5
  "main": "./lib/index.mjs",
6
6
  "types": "./lib/index.d.mts",
@@ -30,8 +30,8 @@
30
30
  "@deepseek-ai/cordis": "^4.0.1",
31
31
  "@deepseek-ai/dsh-host-webserver": "^0.1.0-rc.0",
32
32
  "@deepseek-ai/dsh-tools": "^0.1.0-rc.0",
33
- "@huaqiu/dsh-auth": "^0.3.10",
34
- "@huaqiu/dsh-artifacts": "^0.3.10",
33
+ "@huaqiu/dsh-auth": "^0.3.11",
34
+ "@huaqiu/dsh-artifacts": "^0.3.11",
35
35
  "react": "^18"
36
36
  },
37
37
  "devDependencies": {
@@ -39,9 +39,9 @@
39
39
  "@huaqiu/kicad-sexpr-parser": "^0.1.1",
40
40
  "@types/react": "^18.3.31",
41
41
  "react": "^18.3.1",
42
- "@huaqiu/dsh-artifacts": "0.3.10",
43
- "@huaqiu/dsh-auth": "0.3.10",
44
- "@huaqiu/dsh-tool-uncollapse": "0.3.10"
42
+ "@huaqiu/dsh-auth": "0.3.11",
43
+ "@huaqiu/dsh-artifacts": "0.3.11",
44
+ "@huaqiu/dsh-tool-uncollapse": "0.3.11"
45
45
  },
46
46
  "files": [
47
47
  "lib",
@@ -51,6 +51,9 @@
51
51
  "publishConfig": {
52
52
  "access": "public"
53
53
  },
54
+ "dependencies": {
55
+ "@huaqiu/dsh-plugin-log": "0.3.11"
56
+ },
54
57
  "scripts": {
55
58
  "typecheck": "tsc --noEmit",
56
59
  "build": "tsdown",
package/src/index.ts CHANGED
@@ -26,6 +26,7 @@ import { resolveConfig } from './config.js'
26
26
  import { HTTP_TIMEOUT_MS } from './sse.js'
27
27
  import { ProgressStore } from './progress.js'
28
28
  import { createProgressHandler, PROGRESS_ROUTE_PREFIX } from './routes.js'
29
+ import { getLogger } from '@huaqiu/dsh-plugin-log'
29
30
 
30
31
  /** Plugin id — matches package.json. */
31
32
  export const name = '@huaqiu/dsh-tool-schematic-gen'
@@ -39,8 +40,9 @@ export const name = '@huaqiu/dsh-tool-schematic-gen'
39
40
  */
40
41
  export const inject = ['tools', 'huaqiuAuth', 'huaqiuArtifacts', 'webServer'] as const
41
42
 
42
- /** Console tag for filtering in logs. */
43
- const LOG_TAG = '[dsh-schematic-gen]'
43
+ /** Shared component name for the unified DSH-plugin log. */
44
+ const COMPONENT = 'dsh-schematic-gen'
45
+ const log = getLogger(COMPONENT)
44
46
 
45
47
  export interface SchematicGenPluginConfig {
46
48
  /** Endpoint overrides, env-backed. */
@@ -90,8 +92,7 @@ export function apply(ctx: Context, config: SchematicGenPluginConfig = {}): () =
90
92
  handler: createProgressHandler(progress),
91
93
  }))
92
94
  } else {
93
- // eslint-disable-next-line no-console
94
- console.warn(LOG_TAG, 'webServer unavailable — live progress reporting is disabled')
95
+ log.warn('webServer unavailable — live progress reporting is disabled')
95
96
  }
96
97
 
97
98
  const deps: SchematicGenDeps = {}
@@ -106,8 +107,7 @@ export function apply(ctx: Context, config: SchematicGenPluginConfig = {}): () =
106
107
 
107
108
  const disposers = createSchematicGenTools(env).map((tool) => ctx.tools.register(tool))
108
109
 
109
- // eslint-disable-next-line no-console
110
- console.log(LOG_TAG, 'registered agent tools', {
110
+ log.info('registered agent tools', {
111
111
  tools: disposers.length,
112
112
  copilotkitUrl: finalConfig.copilotkitUrl,
113
113
  exportZipUrl: finalConfig.exportZipUrl,
package/src/tools.ts CHANGED
@@ -23,6 +23,7 @@ import { join } from 'node:path'
23
23
  import { defineTool } from '@deepseek-ai/dsh-tools'
24
24
  import type { HuaqiuAuthService } from '@huaqiu/dsh-auth'
25
25
  import type { CreateArtifactResult, HuaqiuArtifacts } from '@huaqiu/dsh-artifacts'
26
+ import { getLogger } from '@huaqiu/dsh-plugin-log'
26
27
  import {
27
28
  agentIds,
28
29
  buildHeaders,
@@ -44,8 +45,9 @@ function asJson<T>(value: T): Json {
44
45
  return JSON.parse(JSON.stringify(value)) as Json
45
46
  }
46
47
 
47
- /** Console tag for log filtering. */
48
- const LOG_TAG = '[dsh-schematic-gen]'
48
+ /** Shared component name for the unified DSH-plugin log. */
49
+ const COMPONENT = 'dsh-schematic-gen'
50
+ const log = getLogger(COMPONENT)
49
51
 
50
52
  /** Agent-facing timeout hints. */
51
53
  export const TOOL_TIMEOUT_MS = {
@@ -96,7 +98,7 @@ async function resolveAccount(auth: HuaqiuAuthService['auth']): Promise<EdaAccou
96
98
  }
97
99
  return null
98
100
  } catch (err) {
99
- console.warn(LOG_TAG, 'could not resolve the eda.cn account', String((err as Error)?.message || err))
101
+ log.warn('could not resolve the eda.cn account', { error: String((err as Error)?.message || err) })
100
102
  return null
101
103
  }
102
104
  }
@@ -178,7 +180,7 @@ async function artifactUriOf(env: SchematicGenEnv, id: string): Promise<string |
178
180
  if (!env.artifacts || typeof env.artifacts.getDownloadUri !== 'function') return null
179
181
  return await env.artifacts.getDownloadUri(id)
180
182
  } catch (err) {
181
- console.warn(LOG_TAG, 'getDownloadUri failed for', id, String((err as Error)?.message || err))
183
+ log.warn('getDownloadUri failed', { id, error: String((err as Error)?.message || err) })
182
184
  return null
183
185
  }
184
186
  }