@huaqiu/dsh-tool-part-search 0.3.11 → 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/index.mjs +5 -4
- package/package.json +3 -3
- package/src/index.ts +7 -6
package/lib/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createLogger } from "@hqedge/logging";
|
|
2
2
|
import { createPartSearchService } from "@huaqiu/part-search";
|
|
3
3
|
import { defineTool } from "@deepseek-ai/dsh-tools";
|
|
4
4
|
//#region src/service.ts
|
|
@@ -257,7 +257,8 @@ const name = "@huaqiu/dsh-tool-part-search";
|
|
|
257
257
|
/** Cordis services this half depends on: the DSH node tool registry. */
|
|
258
258
|
const inject = ["tools"];
|
|
259
259
|
/**
|
|
260
|
-
* Lazy: a module-level `const log =
|
|
260
|
+
* Lazy: a module-level `const log = createLogger(...)` would create the file
|
|
261
|
+
* stream at import time (before DSH home is mockable in tests).
|
|
261
262
|
* import time, which on bootstrap touches `dshHomePath('logs')` (transitively
|
|
262
263
|
* via the unified-sink directory resolution). Tests that
|
|
263
264
|
* `vi.mock('@deepseek-ai/dsh-home-paths', …)` get their TMP constant in scope
|
|
@@ -265,7 +266,7 @@ const inject = ["tools"];
|
|
|
265
266
|
*/
|
|
266
267
|
let _log = null;
|
|
267
268
|
function log() {
|
|
268
|
-
if (_log === null) _log =
|
|
269
|
+
if (_log === null) _log = createLogger({ component: "dsh-part-search" });
|
|
269
270
|
return _log;
|
|
270
271
|
}
|
|
271
272
|
/**
|
|
@@ -281,7 +282,7 @@ function log() {
|
|
|
281
282
|
function apply(ctx) {
|
|
282
283
|
if (!ctx.tools || typeof ctx.tools.register !== "function") throw new Error("@huaqiu/dsh-tool-part-search requires the DSH `tools` service (ctx.tools.register).");
|
|
283
284
|
const disposers = createPartSearchTools(createPartSearch()).map((tool) => ctx.tools.register(tool));
|
|
284
|
-
log().info(
|
|
285
|
+
log().info({ tools: disposers.length }, "registered agent tools");
|
|
285
286
|
return function dispose() {
|
|
286
287
|
for (const disposeTool of disposers) try {
|
|
287
288
|
disposeTool();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@huaqiu/dsh-tool-part-search",
|
|
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",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"@deepseek-ai/dsh-tools": "^0.1.0-rc.0"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@
|
|
26
|
-
"@huaqiu/
|
|
25
|
+
"@hqedge/logging": "^0.2.7",
|
|
26
|
+
"@huaqiu/part-search": "^0.2.0"
|
|
27
27
|
},
|
|
28
28
|
"files": [
|
|
29
29
|
"lib",
|
package/src/index.ts
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
26
|
import type { Context } from '@deepseek-ai/cordis'
|
|
27
|
-
import {
|
|
27
|
+
import { createLogger, type Logger } from '@hqedge/logging'
|
|
28
28
|
import { createPartSearch } from './service.js'
|
|
29
29
|
import { createPartSearchTools } from './tools.js'
|
|
30
30
|
|
|
@@ -35,15 +35,16 @@ export const name = '@huaqiu/dsh-tool-part-search'
|
|
|
35
35
|
export const inject = ['tools'] as const
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
|
-
* Lazy: a module-level `const log =
|
|
38
|
+
* Lazy: a module-level `const log = createLogger(...)` would create the file
|
|
39
|
+
* stream at import time (before DSH home is mockable in tests).
|
|
39
40
|
* import time, which on bootstrap touches `dshHomePath('logs')` (transitively
|
|
40
41
|
* via the unified-sink directory resolution). Tests that
|
|
41
42
|
* `vi.mock('@deepseek-ai/dsh-home-paths', …)` get their TMP constant in scope
|
|
42
43
|
* only after the mock factory, so defer the call until `apply()` runs.
|
|
43
44
|
*/
|
|
44
|
-
let _log:
|
|
45
|
-
function log():
|
|
46
|
-
if (_log === null) _log =
|
|
45
|
+
let _log: Logger | null = null
|
|
46
|
+
function log(): Logger {
|
|
47
|
+
if (_log === null) _log = createLogger({ component: 'dsh-part-search' })
|
|
47
48
|
return _log
|
|
48
49
|
}
|
|
49
50
|
|
|
@@ -65,7 +66,7 @@ export function apply(ctx: Context): () => void {
|
|
|
65
66
|
const service = createPartSearch()
|
|
66
67
|
const disposers = createPartSearchTools(service).map((tool) => ctx.tools.register(tool))
|
|
67
68
|
|
|
68
|
-
log().info(
|
|
69
|
+
log().info({ tools: disposers.length }, 'registered agent tools')
|
|
69
70
|
|
|
70
71
|
return function dispose() {
|
|
71
72
|
for (const disposeTool of disposers) {
|