@capyclaw/scrapling 1.1.5 → 1.1.7

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.
Files changed (96) hide show
  1. package/README.md +7 -7
  2. package/cordis.patch.yml +0 -2
  3. package/lib/html-parser.mjs +1 -1
  4. package/lib/index.mjs +1 -1
  5. package/lib/runtime.mjs +102 -0
  6. package/lib/selectors.mjs +1 -1
  7. package/node_modules/@capyclaw/foundation/README.md +51 -0
  8. package/node_modules/@capyclaw/foundation/abi/bridge.mjs +86 -0
  9. package/node_modules/@capyclaw/foundation/abi/errors.mjs +63 -0
  10. package/node_modules/@capyclaw/foundation/abi/index.mjs +35 -0
  11. package/node_modules/@capyclaw/foundation/abi/kinds.mjs +271 -0
  12. package/node_modules/@capyclaw/foundation/abi/loader.mjs +345 -0
  13. package/node_modules/@capyclaw/foundation/abi/schema.mjs +98 -0
  14. package/node_modules/@capyclaw/foundation/abi/spec.mjs +255 -0
  15. package/node_modules/@capyclaw/foundation/abi/validate.mjs +24 -0
  16. package/node_modules/@capyclaw/foundation/abi/version.mjs +82 -0
  17. package/node_modules/@capyclaw/foundation/cordis.patch.yml +5 -0
  18. package/node_modules/@capyclaw/foundation/kit/index.mjs +6 -0
  19. package/node_modules/@capyclaw/foundation/lib/adapters/client-panel.mjs +98 -0
  20. package/node_modules/@capyclaw/foundation/lib/adapters/host-event.mjs +35 -0
  21. package/node_modules/@capyclaw/foundation/lib/adapters/http-router.mjs +69 -0
  22. package/node_modules/@capyclaw/foundation/lib/adapters/lifecycle-hook.mjs +55 -0
  23. package/node_modules/@capyclaw/foundation/lib/adapters/own-server.mjs +113 -0
  24. package/node_modules/@capyclaw/foundation/lib/adapters/raw.mjs +68 -0
  25. package/node_modules/@capyclaw/foundation/lib/adapters/runtime-driver.mjs +113 -0
  26. package/node_modules/@capyclaw/foundation/lib/adapters/service-provider.mjs +77 -0
  27. package/node_modules/@capyclaw/foundation/lib/adapters/skill-provider.mjs +56 -0
  28. package/node_modules/@capyclaw/foundation/lib/adapters/tool-provider.mjs +50 -0
  29. package/node_modules/@capyclaw/foundation/lib/adapters/ui-panel.mjs +64 -0
  30. package/node_modules/@capyclaw/foundation/lib/ctx-service.mjs +42 -0
  31. package/node_modules/@capyclaw/foundation/lib/host/caps.mjs +34 -0
  32. package/node_modules/@capyclaw/foundation/lib/host/contract.mjs +85 -0
  33. package/node_modules/@capyclaw/foundation/lib/host/dsh.mjs +50 -0
  34. package/node_modules/@capyclaw/foundation/lib/host/memory.mjs +160 -0
  35. package/node_modules/@capyclaw/foundation/lib/host.mjs +23 -0
  36. package/node_modules/@capyclaw/foundation/lib/kernel.mjs +185 -0
  37. package/node_modules/@capyclaw/foundation/lib/skill/scan.mjs +87 -0
  38. package/node_modules/@capyclaw/foundation/lib/subsystems/events.mjs +60 -0
  39. package/node_modules/@capyclaw/foundation/lib/subsystems/log.mjs +51 -0
  40. package/node_modules/@capyclaw/foundation/lib/subsystems/net.mjs +188 -0
  41. package/node_modules/@capyclaw/foundation/package.json +53 -0
  42. package/node_modules/@capyclaw/foundation/runtime/index.mjs +20 -0
  43. package/node_modules/@capyclaw/plugin-kit/INTEGRATION.md +100 -0
  44. package/node_modules/@capyclaw/plugin-kit/README.md +70 -0
  45. package/node_modules/@capyclaw/plugin-kit/bin/sync.mjs +103 -0
  46. package/node_modules/@capyclaw/plugin-kit/package.json +69 -0
  47. package/node_modules/@capyclaw/plugin-kit/src/cli.mjs +56 -0
  48. package/node_modules/@capyclaw/plugin-kit/src/config.mjs +142 -0
  49. package/node_modules/@capyclaw/plugin-kit/src/editor/heartbeat-worker.js +129 -0
  50. package/node_modules/@capyclaw/plugin-kit/src/editor/lease.mjs +139 -0
  51. package/node_modules/@capyclaw/plugin-kit/src/editor/shadow.mjs +219 -0
  52. package/node_modules/@capyclaw/plugin-kit/src/editor/transport.js +13 -0
  53. package/node_modules/@capyclaw/plugin-kit/src/index.mjs +13 -0
  54. package/node_modules/@capyclaw/plugin-kit/src/pack.mjs +230 -0
  55. package/node_modules/@capyclaw/plugin-kit/src/runtime/context.mjs +128 -0
  56. package/node_modules/@capyclaw/plugin-kit/src/self-contained.mjs +307 -0
  57. package/node_modules/@capyclaw/plugin-kit/src/service/api.mjs +45 -0
  58. package/node_modules/@capyclaw/plugin-kit/src/service/http.mjs +113 -0
  59. package/node_modules/@capyclaw/plugin-kit/src/service/mcp-http.mjs +150 -0
  60. package/node_modules/@capyclaw/plugin-kit/src/service/server.mjs +131 -0
  61. package/node_modules/@capyclaw/plugin-kit/src/skills/provider.mjs +82 -0
  62. package/node_modules/@capyclaw/plugin-kit/src/store/blob-store.mjs +109 -0
  63. package/node_modules/@capyclaw/plugin-kit/src/store/content-store.mjs +17 -0
  64. package/node_modules/@capyclaw/plugin-kit/src/store/journal-store.mjs +89 -0
  65. package/node_modules/@capyclaw/plugin-kit/src/tools/result.mjs +57 -0
  66. package/node_modules/@capyclaw/plugin-kit/src/tools/validate.mjs +150 -0
  67. package/node_modules/@capyclaw/plugin-kit/src/tuning.mjs +82 -0
  68. package/node_modules/@capyclaw/plugin-kit/src/util/fs-lock.mjs +132 -0
  69. package/node_modules/@capyclaw/plugin-kit/src/util/http.mjs +130 -0
  70. package/node_modules/@capyclaw/plugin-kit/src/workspace/manager.mjs +656 -0
  71. package/node_modules/@capyclaw/plugin-kit/src/zip.mjs +181 -0
  72. package/node_modules/@capyclaw/portal/README.md +70 -0
  73. package/node_modules/@capyclaw/portal/lib/index.mjs +387 -0
  74. package/node_modules/@capyclaw/portal/lib/ledger.mjs +194 -0
  75. package/node_modules/@capyclaw/portal/lib/portal-agent.ps1 +811 -0
  76. package/node_modules/@capyclaw/portal/lib/portal-darwin.mjs +183 -0
  77. package/node_modules/@capyclaw/portal/package.json +40 -0
  78. package/node_modules/@capyclaw/service-broker/README.md +104 -0
  79. package/node_modules/@capyclaw/service-broker/cordis.patch.yml +8 -0
  80. package/node_modules/@capyclaw/service-broker/dsh-suite.json +21 -0
  81. package/node_modules/@capyclaw/service-broker/lib/control.mjs +193 -0
  82. package/node_modules/@capyclaw/service-broker/lib/discovery.mjs +109 -0
  83. package/node_modules/@capyclaw/service-broker/lib/engine.mjs +1236 -0
  84. package/node_modules/@capyclaw/service-broker/lib/host.mjs +182 -0
  85. package/node_modules/@capyclaw/service-broker/lib/manifest.mjs +249 -0
  86. package/node_modules/@capyclaw/service-broker/lib/recovery.mjs +325 -0
  87. package/node_modules/@capyclaw/service-broker/lib/skills-client.mjs +28 -0
  88. package/node_modules/@capyclaw/service-broker/lib/spec.mjs +78 -0
  89. package/node_modules/@capyclaw/service-broker/package.json +65 -0
  90. package/node_modules/@capyclaw/service-broker/server.mjs +81 -0
  91. package/node_modules/@capyclaw/service-broker/service.schema.json +62 -0
  92. package/node_modules/@capyclaw/service-broker/services.json +3 -0
  93. package/package.json +20 -7
  94. package/plugin.mjs +57 -0
  95. package/server/server.mjs +2 -10
  96. package/lib/host.mjs +0 -170
package/package.json CHANGED
@@ -1,18 +1,19 @@
1
1
  {
2
2
  "name": "@capyclaw/scrapling",
3
- "version": "1.1.5",
3
+ "version": "1.1.7",
4
4
  "description": "Scrapling 网页抓取集成:HTTP 抓取 + 纯 Node CSS 选择器提取 + 可视化爬虫工作台(浏览器打开即用)",
5
5
  "type": "module",
6
- "main": "./lib/host.mjs",
6
+ "main": "./plugin.mjs",
7
7
  "exports": {
8
- ".": "./lib/host.mjs",
8
+ ".": "./plugin.mjs",
9
9
  "./api": "./lib/index.mjs",
10
10
  "./client": "./client/client.js",
11
11
  "./package.json": "./package.json"
12
12
  },
13
13
  "dependencies": {
14
14
  "@capyclaw/plugin-kit": "^0.2.2",
15
- "@capyclaw/service-broker": "^0.2.2"
15
+ "@capyclaw/service-broker": "^0.2.2",
16
+ "@capyclaw/foundation": "^0.1.1"
16
17
  },
17
18
  "dsh": {
18
19
  "bundle": {
@@ -23,13 +24,19 @@
23
24
  "immediately": true
24
25
  },
25
26
  "category": "tool",
26
- "platform": "both"
27
+ "platform": "both",
28
+ "requires": {
29
+ "capabilities": {
30
+ "os.proc": "^1.0.0"
31
+ }
32
+ }
27
33
  },
28
34
  "meta": {
29
35
  "title": "Scrapling 网页抓取",
30
36
  "description": "网页数据爬取工具:HTTP 抓取、CSS 选择器提取(::text/::attr,纯 Node 实现)、可视化爬虫工作台(http://127.0.0.1:39640/,步骤回放 + 选择器试玩 + JSON/CSV 导出,内置离线演示页)。浏览器渲染与 XPath 依赖外部 Python scrapling,未实现并如实标注。"
31
37
  },
32
38
  "files": [
39
+ "plugin.mjs",
33
40
  "lib/",
34
41
  "client/",
35
42
  "server/",
@@ -56,7 +63,7 @@
56
63
  "repository": {
57
64
  "type": "git",
58
65
  "url": "git+https://github.com/Maple496/capyclaw.git",
59
- "directory": "extensions/official/capyclaw-scrapling"
66
+ "directory": "B/official/capyclaw-scrapling"
60
67
  },
61
68
  "bugs": {
62
69
  "url": "https://github.com/Maple496/capyclaw/issues"
@@ -64,5 +71,11 @@
64
71
  "homepage": "https://github.com/capyclaw/dsh-plugins",
65
72
  "publishConfig": {
66
73
  "access": "public"
67
- }
74
+ },
75
+ "bundledDependencies": [
76
+ "@capyclaw/foundation",
77
+ "@capyclaw/plugin-kit",
78
+ "@capyclaw/portal",
79
+ "@capyclaw/service-broker"
80
+ ]
68
81
  }
package/plugin.mjs ADDED
@@ -0,0 +1,57 @@
1
+ /**
2
+ * @capyclaw/scrapling:foundation ABI 入口。
3
+ *
4
+ * - service-provider 提供 scrapling 服务(fetch/parse/crawler);
5
+ * - client-panel 注入 __DSH_SCRAPLING__ 开机全局;
6
+ * - runtime-driver 通过 broker 拉起工作台子进程(workbench=false 时跳过)。
7
+ */
8
+ import { createPlugin, clientPanel, runtimeDriver, serviceProvider } from '@capyclaw/foundation/abi'
9
+ import {
10
+ createScraplingRuntime, scraplingEnabled, scraplingWorkbenchEnabled, resolveScraplingConfig,
11
+ } from './lib/runtime.mjs'
12
+
13
+ const runtimes = new WeakMap()
14
+ let fallbackRuntime
15
+
16
+ function ensure(api) {
17
+ const key = api?.config && typeof api.config === 'object' ? api.config : null
18
+ if (key) {
19
+ let cached = runtimes.get(key)
20
+ if (!cached) {
21
+ cached = createScraplingRuntime(api)
22
+ runtimes.set(key, cached)
23
+ }
24
+ return cached
25
+ }
26
+ fallbackRuntime ??= createScraplingRuntime(api)
27
+ return fallbackRuntime
28
+ }
29
+
30
+ export const { name, inject, apply } = createPlugin({
31
+ name: 'scrapling',
32
+ requires: ['os.proc@^1'],
33
+ implements: [
34
+ serviceProvider({
35
+ service: 'scrapling',
36
+ when: ({ config }) => scraplingEnabled(config),
37
+ provide: (api) => ensure(api).service,
38
+ }),
39
+ clientPanel({
40
+ bootGlobals: (api) => ensure(api).globals,
41
+ }),
42
+ runtimeDriver({
43
+ id: 'scrapling-workbench',
44
+ entry: './server/server.mjs',
45
+ port: ({ config }) => resolveScraplingConfig(config).servicePort,
46
+ health: { path: '/healthz' },
47
+ when: ({ config }) => scraplingWorkbenchEnabled(config),
48
+ env: ({ config }) => {
49
+ const cfg = config || {}
50
+ return {
51
+ DSH_SCRAPLING_TIMEOUT_MS: String(cfg.timeoutMs ?? 20000),
52
+ ...(cfg.userAgent ? { DSH_SCRAPLING_USER_AGENT: String(cfg.userAgent) } : {}),
53
+ }
54
+ },
55
+ }),
56
+ ],
57
+ }, import.meta.url)
package/server/server.mjs CHANGED
@@ -13,6 +13,7 @@ import path from 'node:path'
13
13
  import { fileURLToPath } from 'node:url'
14
14
  import { createRequire } from 'node:module'
15
15
  import { isMain, parseArgs } from '@capyclaw/plugin-kit'
16
+ import { mimeFor } from '@capyclaw/plugin-kit/util/http'
16
17
  import { installServiceSignalHandlers, startStandaloneService } from '@capyclaw/plugin-kit/service/server'
17
18
 
18
19
  import { createCrawler } from '../lib/crawler.mjs'
@@ -24,15 +25,6 @@ const { version: PKG_VERSION } = requireFromHere('../package.json')
24
25
  export const DEFAULT_PORT = 39640
25
26
  export const CONTRACT_VERSION = '1'
26
27
 
27
- const MIME = {
28
- '.html': 'text/html; charset=utf-8',
29
- '.js': 'text/javascript; charset=utf-8',
30
- '.css': 'text/css; charset=utf-8',
31
- '.json': 'application/json; charset=utf-8',
32
- '.svg': 'image/svg+xml',
33
- '.png': 'image/png',
34
- }
35
-
36
28
  /** 静态文件白名单(路径 → 磁盘相对路径),杜绝路径穿越。 */
37
29
  function staticFiles(uiDir, demoDir) {
38
30
  return new Map([
@@ -209,7 +201,7 @@ export async function startWorkbenchServer(options = {}) {
209
201
  }
210
202
  const content = await readFile(file)
211
203
  res.writeHead(200, {
212
- 'content-type': MIME[path.extname(file)] || 'application/octet-stream',
204
+ 'content-type': mimeFor(file),
213
205
  'cache-control': 'no-store',
214
206
  'x-content-type-options': 'nosniff',
215
207
  })
package/lib/host.mjs DELETED
@@ -1,170 +0,0 @@
1
- /**
2
- * dsh-scrapling 宿主半(Cordis 入口)。
3
- *
4
- * 能力边界(诚实声明):
5
- * - fetch() 已实现:Node 内置 fetch 发起 HTTP 请求,返回状态/头/正文。
6
- * - parse() 已实现:纯 Node 的容错 HTML 解析 + CSS 选择器引擎
7
- * (lib/html-parser.mjs / lib/selectors.mjs),支持
8
- * ::text / ::attr / 组合器 / 常见伪类;xpath 未实现。
9
- * - fetchWithBrowser() 未实现:浏览器渲染 / Cloudflare 绕过需要外部 Python
10
- * scrapling,直接抛 NOT_IMPLEMENTED,不会伪造结果。
11
- *
12
- * 工作台服务(server/server.mjs):
13
- * - 由 service-broker 作为独立进程管理;Cordis 进程不监听业务端口;
14
- * - 依赖注入可选:workbench: false 可只注册进程内 fetch/parse API;
15
- * - 通过 webserver/index-inject 注入 URL(固定端口,注入时机先于 broker.start);
16
- * 浏览器半据此挂右侧边栏面板。
17
- *
18
- * 配置(resolveConfig:ctx config → 环境变量 → 默认值):
19
- * enabled 是否注册服务/界面 DSH_SCRAPLING_ENABLED 默认 true
20
- * port 工作台端口 DSH_SCRAPLING_PORT 默认 39640
21
- * host 监听地址 DSH_SCRAPLING_HOST 默认 127.0.0.1
22
- * timeoutMs 单次请求超时(ms) DSH_SCRAPLING_TIMEOUT_MS 默认 20000
23
- * userAgent 默认 UA DSH_SCRAPLING_USER_AGENT
24
- * workbench 是否拉起界面 DSH_SCRAPLING_WORKBENCH 默认 true
25
- */
26
- import path from 'node:path'
27
- import { fileURLToPath } from 'node:url'
28
- import { resolveConfig } from '@capyclaw/plugin-kit/config'
29
-
30
- import { createCrawler } from './crawler.mjs'
31
- import { createSelectorDocument } from './selectors.mjs'
32
-
33
- export const name = '@capyclaw/scrapling'
34
- export const DEFAULT_PORT = 39640
35
- export const inject = ['serviceBroker']
36
-
37
- const SERVICE_ID = 'scrapling-workbench'
38
-
39
- /* 版本号单一真源:读包内 package.json(createRequire 全 Node 版本稳态)。 */
40
- import { createRequire } from 'node:module'
41
- const requireFromHere = createRequire(import.meta.url)
42
- const { version: PKG_VERSION } = requireFromHere('../package.json')
43
-
44
- function notImplemented(feature) {
45
- const error = new Error(
46
- `[dsh-scrapling] ${feature} 未实现:浏览器渲染与 XPath 依赖外部 Python scrapling 运行时。` +
47
- '请使用 fetch()/parse()(HTTP 抓取 + CSS 选择器),或另行部署 scrapling 服务后通过 HTTP 调用。',
48
- )
49
- error.code = 'NOT_IMPLEMENTED'
50
- return error
51
- }
52
-
53
- export async function apply(ctx, config = {}) {
54
- const { value: cfg, issues } = resolveConfig(config, {
55
- envPrefix: 'DSH_SCRAPLING',
56
- defaults: {
57
- enabled: true,
58
- port: DEFAULT_PORT,
59
- host: '127.0.0.1',
60
- timeoutMs: 20000,
61
- workbench: true,
62
- },
63
- fields: {
64
- enabled: { env: 'ENABLED', type: 'boolean' },
65
- port: { env: 'PORT', type: 'string' },
66
- host: { env: 'HOST' },
67
- timeoutMs: { env: 'TIMEOUT_MS', type: 'number' },
68
- userAgent: { env: 'USER_AGENT' },
69
- workbench: { env: 'WORKBENCH', type: 'boolean' },
70
- },
71
- })
72
- for (const issue of issues) ctx.logger?.warn?.(`[dsh-scrapling] 配置: ${issue}`)
73
- const port = cfg.port === 'auto' ? 'auto' : Number(cfg.port)
74
- if (port !== 'auto' && (!Number.isInteger(port) || port < 1 || port > 65535)) {
75
- ctx.logger?.warn?.(`[dsh-scrapling] 非法 port=${cfg.port},回退为默认 ${DEFAULT_PORT}`)
76
- }
77
- const servicePort = port === 'auto' || !Number.isInteger(port) || port < 1 || port > 65535 ? DEFAULT_PORT : port
78
-
79
- if (!cfg.enabled) {
80
- ctx.logger?.info?.('[dsh-scrapling] 已按配置禁用,不注册 scrapling 服务')
81
- return
82
- }
83
-
84
- const packageDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')
85
- const crawler = createCrawler({ timeoutMs: cfg.timeoutMs, userAgent: cfg.userAgent })
86
-
87
- ctx.provide('scrapling', {
88
- /** 普通 HTTP 抓取(真实实现)。 */
89
- async fetch(url, options = {}) {
90
- const record = await crawler.crawl({ url, timeoutMs: options.timeoutMs, userAgent: options.userAgent || options.headers?.['user-agent'] })
91
- if (record.error) {
92
- const error = new Error(record.error.message)
93
- error.code = record.error.code
94
- error.hint = record.error.hint
95
- throw error
96
- }
97
- return { url: record.url, status: record.status, ok: record.ok, headers: {}, html: record.html }
98
- },
99
-
100
- /** 浏览器渲染:未实现(诚实声明,不伪造结果)。 */
101
- async fetchWithBrowser() {
102
- throw notImplemented('fetchWithBrowser')
103
- },
104
-
105
- /** HTML → 文档包装:css('.a .b::text') / css('a::attr(href)')。 */
106
- parse(html, options = {}) {
107
- return createSelectorDocument(html, options)
108
- },
109
-
110
- /** 工作台爬取流水线(带步骤计时,工作台界面数据源)。 */
111
- crawler,
112
- })
113
-
114
- /* 工作台由 broker 独立拉起;Cordis 进程只注册 API 与 sidebar URL。
115
- * 时序契约:webserver/index-inject 是 webserver 启动时机的一次性事件,
116
- * 注册必须发生在 broker.start 之前,且 URL 必须此刻可知——所以默认固定端口
117
- *(port=auto 时 URL 要等 broker 分配,注入会错过时机,只做尽力补注册并告警)。 */
118
- let serviceBroker = null
119
- let stopServiceOnDispose = false
120
- if (cfg.workbench) {
121
- const expectedUrl = `http://${cfg.host === '0.0.0.0' ? '127.0.0.1' : cfg.host}:${servicePort}`
122
- ctx.on?.('webserver/index-inject', (table) => {
123
- table.push({ kind: 'global', name: '__DSH_SCRAPLING__', value: { url: `${expectedUrl}/`, version: PKG_VERSION } })
124
- })
125
- const broker = ctx.serviceBroker
126
- serviceBroker = broker || null
127
- if (!broker || typeof broker.start !== 'function') {
128
- ctx.logger?.warn?.('[dsh-scrapling] 缺少 ctx.serviceBroker,工作台未启动;fetch/parse API 仍可用')
129
- } else {
130
- const serviceFile = path.join(packageDir, 'server', 'server.mjs')
131
- const spec = {
132
- id: SERVICE_ID,
133
- cmd: [process.execPath, serviceFile, '--port', '${PORT}', '--host', cfg.host],
134
- env: {
135
- DSH_SCRAPLING_TIMEOUT_MS: String(cfg.timeoutMs),
136
- ...(cfg.userAgent ? { DSH_SCRAPLING_USER_AGENT: String(cfg.userAgent) } : {}),
137
- },
138
- ports: { main: servicePort },
139
- url: 'http://127.0.0.1:${PORT}',
140
- healthPath: '/healthz',
141
- keepAlive: true,
142
- }
143
- try {
144
- const started = await broker.start(spec)
145
- if (!started?.url) throw new Error('serviceBroker.start 未返回服务 url')
146
- const serviceUrl = started.url.replace(/\/$/, '')
147
- stopServiceOnDispose = true
148
- ctx.logger?.info?.(`[dsh-scrapling] broker 工作台已就绪: ${serviceUrl}/`)
149
- if (serviceUrl !== expectedUrl) {
150
- ctx.logger?.warn?.(`[dsh-scrapling] 实际服务地址 ${serviceUrl} 与注入地址 ${expectedUrl} 不一致(port=auto?),面板可能指向旧地址;建议使用固定端口`)
151
- }
152
- } catch (error) {
153
- ctx.logger?.warn?.(`[dsh-scrapling] broker 工作台启动失败(fetch/parse API 仍可用): ${error.message}`)
154
- }
155
- }
156
- } else {
157
- ctx.logger?.info?.('[dsh-scrapling] workbench=false,仅注册 scrapling API,不投递服务')
158
- }
159
-
160
- ctx.logger?.info?.(
161
- `[dsh-scrapling] 已注册 scrapling 服务(fetch + parse;浏览器/XPath 未实现,timeout=${cfg.timeoutMs}ms)`,
162
- )
163
-
164
- return async () => {
165
- if (stopServiceOnDispose && serviceBroker && typeof serviceBroker.stop === 'function') {
166
- const result = await serviceBroker.stop(SERVICE_ID)
167
- if (result?.stopped) ctx.logger?.info?.('[dsh-scrapling] broker 已停止工作台服务')
168
- }
169
- }
170
- }