@huaqiu/dsh-tool-schematic-gen 0.3.10 → 0.3.12
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/client.js +10 -10
- package/lib/client.js.map +1 -1
- package/lib/index.mjs +11 -9
- package/package.json +9 -6
- package/src/index.ts +6 -11
- package/src/tools.ts +6 -4
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 { createLogger } from "@hqedge/logging";
|
|
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
|
-
|
|
713
|
-
const LOG_TAG$1 = "[dsh-schematic-gen]";
|
|
713
|
+
const log$1 = createLogger({ component: "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
|
-
|
|
736
|
+
log$1.warn({ error: String(err?.message || err) }, "could not resolve the eda.cn account");
|
|
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
|
-
|
|
801
|
+
log$1.warn({
|
|
802
|
+
id,
|
|
803
|
+
error: String(err?.message || err)
|
|
804
|
+
}, "getDownloadUri failed");
|
|
802
805
|
return null;
|
|
803
806
|
}
|
|
804
807
|
}
|
|
@@ -1402,8 +1405,7 @@ const inject = [
|
|
|
1402
1405
|
"huaqiuArtifacts",
|
|
1403
1406
|
"webServer"
|
|
1404
1407
|
];
|
|
1405
|
-
|
|
1406
|
-
const LOG_TAG = "[dsh-schematic-gen]";
|
|
1408
|
+
const log = createLogger({ component: "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
|
|
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,12 +1440,12 @@ function apply(ctx, config = {}) {
|
|
|
1438
1440
|
progress,
|
|
1439
1441
|
deps: {}
|
|
1440
1442
|
}).map((tool) => ctx.tools.register(tool));
|
|
1441
|
-
|
|
1443
|
+
log.info({
|
|
1442
1444
|
tools: disposers.length,
|
|
1443
1445
|
copilotkitUrl: finalConfig.copilotkitUrl,
|
|
1444
1446
|
exportZipUrl: finalConfig.exportZipUrl,
|
|
1445
1447
|
auth: "huaqiuAuth"
|
|
1446
|
-
});
|
|
1448
|
+
}, "registered agent tools");
|
|
1447
1449
|
return function dispose() {
|
|
1448
1450
|
for (const disposeTool of disposers) try {
|
|
1449
1451
|
disposeTool();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@huaqiu/dsh-tool-schematic-gen",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.12",
|
|
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.
|
|
34
|
-
"@huaqiu/dsh-artifacts": "^0.3.
|
|
33
|
+
"@huaqiu/dsh-auth": "^0.3.12",
|
|
34
|
+
"@huaqiu/dsh-artifacts": "^0.3.12",
|
|
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.
|
|
43
|
-
"@huaqiu/dsh-
|
|
44
|
-
"@huaqiu/dsh-
|
|
42
|
+
"@huaqiu/dsh-artifacts": "0.3.12",
|
|
43
|
+
"@huaqiu/dsh-tool-uncollapse": "0.3.12",
|
|
44
|
+
"@huaqiu/dsh-auth": "0.3.12"
|
|
45
45
|
},
|
|
46
46
|
"files": [
|
|
47
47
|
"lib",
|
|
@@ -51,6 +51,9 @@
|
|
|
51
51
|
"publishConfig": {
|
|
52
52
|
"access": "public"
|
|
53
53
|
},
|
|
54
|
+
"dependencies": {
|
|
55
|
+
"@hqedge/logging": "^0.2.7"
|
|
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 { createLogger } from '@hqedge/logging'
|
|
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
|
-
/**
|
|
43
|
-
const
|
|
43
|
+
/** Shared component name for the unified DSH-plugin log. */
|
|
44
|
+
const COMPONENT = 'dsh-schematic-gen'
|
|
45
|
+
const log = createLogger({ component: 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
|
-
|
|
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,13 +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
|
-
|
|
110
|
-
console.log(LOG_TAG, 'registered agent tools', {
|
|
111
|
-
tools: disposers.length,
|
|
112
|
-
copilotkitUrl: finalConfig.copilotkitUrl,
|
|
113
|
-
exportZipUrl: finalConfig.exportZipUrl,
|
|
114
|
-
auth: 'huaqiuAuth',
|
|
115
|
-
})
|
|
110
|
+
log.info({ tools: disposers.length, copilotkitUrl: finalConfig.copilotkitUrl, exportZipUrl: finalConfig.exportZipUrl, auth: 'huaqiuAuth' }, 'registered agent tools')
|
|
116
111
|
|
|
117
112
|
return function dispose() {
|
|
118
113
|
for (const disposeTool of disposers) {
|
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 { createLogger } from '@hqedge/logging'
|
|
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
|
-
/**
|
|
48
|
-
const
|
|
48
|
+
/** Shared component name for the unified DSH-plugin log. */
|
|
49
|
+
const COMPONENT = 'dsh-schematic-gen'
|
|
50
|
+
const log = createLogger({ component: 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
|
-
|
|
101
|
+
log.warn({ error: String((err as Error)?.message || err) }, 'could not resolve the eda.cn account')
|
|
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
|
-
|
|
183
|
+
log.warn({ id, error: String((err as Error)?.message || err) }, 'getDownloadUri failed')
|
|
182
184
|
return null
|
|
183
185
|
}
|
|
184
186
|
}
|