@aipanel/dsh-plugin 1.3.7 → 1.3.9

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 (2) hide show
  1. package/dist/index.js +44 -21
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -7,6 +7,8 @@ import { randomUUID } from "node:crypto";
7
7
  var LOG_PREFIX = "[vite-plugin-aipanel]";
8
8
  var CONTEXT_API_PATH = "/__aipanel_context__";
9
9
  var HOST_EVENTS_API_PATH = "/__aipanel_host_events__";
10
+ var DEPENDENCY_DIR_NAME = "node_modules";
11
+ var DEPENDENCY_SOURCE_NOTE = `\u4F9D\u8D56\u5305\u5185\u6587\u4EF6\uFF08${DEPENDENCY_DIR_NAME}\uFF09\uFF1A\u901A\u5E38\u4E0D\u5E94\u76F4\u63A5\u4FEE\u6539\uFF0C\u9875\u9762\u884C\u4E3A\u8BF7\u6539\u9879\u76EE\u5185\u6E90\u7801`;
10
12
  var EXT_BROADCAST = {
11
13
  PAGE_CONTEXT: "PAGE_CONTEXT",
12
14
  THEME_CHANGE: "THEME_CHANGE",
@@ -20,6 +22,8 @@ var EXT_MSG = {
20
22
  REQUEST_PAGE_CONTEXT: "REQUEST_PAGE_CONTEXT",
21
23
  SELECTION_START: "SELECTION_START",
22
24
  SELECTION_STOP: "SELECTION_STOP",
25
+ /** Side Panel → 目标 Tab:请目标页定位某个已选节点(跳回其页面并呼吸高亮) */
26
+ LOCATE_NODE: "LOCATE_NODE",
23
27
  CS_QUERY_WINDOW: "__CS_QUERY_WINDOW__",
24
28
  /** Side Panel → Background:立即轮询一次并回传当前服务信息 */
25
29
  FORCE_POLL: "FORCE_POLL"
@@ -39,6 +43,35 @@ var VUE_DEVTOOLS_TIMELINE_INCLUDES = [
39
43
  var DEFAULT_TIMELINE_INCLUDE = VUE_DEVTOOLS_TIMELINE_INCLUDE.SLOW;
40
44
  var MUTATING_TOOLS = /* @__PURE__ */ new Set(["write", "edit", "apply_patch"]);
41
45
 
46
+ // ../../core/es/common/utils.mjs
47
+ function normalizePathSeparators(filePath) {
48
+ return filePath.replace(/\\/g, "/");
49
+ }
50
+ function fileNameOf(filePath) {
51
+ const normalized = normalizePathSeparators(filePath);
52
+ return normalized.slice(normalized.lastIndexOf("/") + 1);
53
+ }
54
+ function isDependencyPath(filePath) {
55
+ return normalizePathSeparators(filePath).split("/").includes(DEPENDENCY_DIR_NAME);
56
+ }
57
+ function formatSourceLocation(filePath, line, column) {
58
+ if (!line) return filePath;
59
+ return column ? `${filePath}:${line}:${column}` : `${filePath}:${line}`;
60
+ }
61
+ var NODE_MENTION_RE = /@节点\[(n[0-9a-z]+)\]/g;
62
+ function parseNodeMentions(text) {
63
+ const out = [];
64
+ const seen = /* @__PURE__ */ new Set();
65
+ for (const m of text.matchAll(NODE_MENTION_RE)) {
66
+ const id = m[1];
67
+ if (!seen.has(id)) {
68
+ seen.add(id);
69
+ out.push(id);
70
+ }
71
+ }
72
+ return out;
73
+ }
74
+
42
75
  // ../../core/es/common/diagnostics.mjs
43
76
  var COMMAND_CHECK_TIMEOUT_MS = 6e4;
44
77
  var SOURCE_EXTENSIONS = [
@@ -54,7 +87,7 @@ var SOURCE_EXTENSIONS = [
54
87
  ];
55
88
  function matchesExtensions(filePath, extensions) {
56
89
  if (!extensions?.length) return true;
57
- const base = filePath.replace(/\\/g, "/").split("/").pop() ?? "";
90
+ const base = fileNameOf(filePath);
58
91
  const dot = base.lastIndexOf(".");
59
92
  if (dot <= 0) return false;
60
93
  return extensions.includes(base.slice(dot).toLowerCase());
@@ -398,7 +431,7 @@ function getCallerInfo(depth = 3) {
398
431
  const match = targetLine.match(/at\s+(?:(.+?)\s+\()?(.+?):(\d+):(\d+)\)?/);
399
432
  if (!match) return "";
400
433
  const [, funcName, filePath, line] = match;
401
- const fileName = filePath.split("/").pop() || filePath;
434
+ const fileName = fileNameOf(filePath) || filePath;
402
435
  const func = funcName || "<anonymous>";
403
436
  return `${fileName}:${line} ${func}`;
404
437
  }
@@ -1261,8 +1294,11 @@ async function runCommandCheck(check, target, phase, severity, optional = false)
1261
1294
  if (failure) return { text: failure, diagnostics: [] };
1262
1295
  const raw = rawCommandOutput(outcome);
1263
1296
  try {
1264
- if (check.adapter) return await runAdapterModule(check, outcome, cwd, fileSet);
1265
- return adaptBuiltinFormat(check.format ?? "text", check, raw, cwd, severity);
1297
+ const produced2 = check.adapter ? await runAdapterModule(check, outcome, cwd, fileSet) : adaptBuiltinFormat(check.format ?? "text", check, raw, cwd, severity);
1298
+ if (phase === "edit" && outcome.exitCode === 0 && produced2.diagnostics.length === 0) {
1299
+ return { ...produced2, text: void 0, notes: void 0 };
1300
+ }
1301
+ return produced2;
1266
1302
  } catch (error) {
1267
1303
  const reason = error instanceof Error ? error.message : String(error);
1268
1304
  const excerpt = raw.replace(/\s+/g, " ").trim().slice(0, 200);
@@ -1422,21 +1458,6 @@ ${body}` : body);
1422
1458
  return blocks.join("\n\n");
1423
1459
  }
1424
1460
 
1425
- // ../../core/es/common/utils.mjs
1426
- var NODE_MENTION_RE = /@节点\[(n[0-9a-z]+)\]/g;
1427
- function parseNodeMentions(text) {
1428
- const out = [];
1429
- const seen = /* @__PURE__ */ new Set();
1430
- for (const m of text.matchAll(NODE_MENTION_RE)) {
1431
- const id = m[1];
1432
- if (!seen.has(id)) {
1433
- seen.add(id);
1434
- out.push(id);
1435
- }
1436
- }
1437
- return out;
1438
- }
1439
-
1440
1461
  // dsh-plugin/src/events-relay.ts
1441
1462
  var log3 = createNodeLogger("DshEventRelay");
1442
1463
  var FLUSH_DELAY_MS = 120;
@@ -1659,8 +1680,10 @@ var inject = ["tools"];
1659
1680
  var log4 = createNodeLogger("DshPlugin");
1660
1681
  function buildNodeContext(e) {
1661
1682
  const lines = [`\u8282\u70B9 ID\uFF1A${e.id ?? ""}`];
1662
- const loc = e.line ? e.column ? `:${e.line}:${e.column}` : `:${e.line}` : "";
1663
- if (e.filePath) lines.push(`\u6E90\u7801\u6587\u4EF6\u8DEF\u5F84\uFF1A${e.filePath}${loc}`);
1683
+ if (e.filePath) {
1684
+ lines.push(`\u6E90\u7801\u6587\u4EF6\u8DEF\u5F84\uFF1A${formatSourceLocation(e.filePath, e.line, e.column)}`);
1685
+ if (isDependencyPath(e.filePath)) lines.push(`\u6E90\u7801\u5F52\u5C5E\uFF1A${DEPENDENCY_SOURCE_NOTE}`);
1686
+ }
1664
1687
  if (e.description) lines.push(`DOM \u5143\u7D20\u9009\u62E9\u5668\uFF1A${e.description}`);
1665
1688
  if (e.innerText) {
1666
1689
  const text = e.innerText.slice(0, 20).replace(/\r?\n/g, "\\n");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aipanel/dsh-plugin",
3
- "version": "1.3.7",
3
+ "version": "1.3.9",
4
4
  "type": "module",
5
5
  "description": "AIPanel for DeepSeek Harness (dsh):注入审查工具 run_diagnostics、编辑后自动诊断。",
6
6
  "main": "./dist/index.js",
@@ -16,7 +16,7 @@
16
16
  "vue-tsc": "^3.3.9"
17
17
  },
18
18
  "devDependencies": {
19
- "@aipanel/core": "1.3.7",
19
+ "@aipanel/core": "1.3.9",
20
20
  "@deepseek-ai/cordis": "~4.0.4",
21
21
  "@deepseek-ai/dsh-agent": "^0.1.7-alpha.2",
22
22
  "@deepseek-ai/dsh-llm": "^0.1.7-alpha.2",