dsh-plugin-opc 0.1.8 → 0.1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-opc",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "OPC Enterprise Plugin for DeepSeek Harness (DSH)",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -28,6 +28,7 @@
28
28
  "@types/yauzl": "^3.4.0",
29
29
  "esbuild": "^0.28.2",
30
30
  "fflate": "^0.8.3",
31
+ "pinyin-pro": "^3.29.5",
31
32
  "playwright": "^1.64.1",
32
33
  "tsx": "^4.23.15",
33
34
  "typescript": "^6.0.3"
@@ -66,10 +67,10 @@
66
67
  },
67
68
  "peerDependencies": {
68
69
  "@deepseek-ai/dsh-credentials": ">=0.2.2-alpha.3 <0.3.0",
69
- "@deepseek-ai/schemastery": "3.18.6-alpha.2 || 3.19.0",
70
70
  "@deepseek-ai/dsh-home-paths": ">=0.2.2-alpha.3 <0.3.0",
71
+ "@deepseek-ai/dsh-tools": ">=0.2.2-alpha.3 <0.3.0",
71
72
  "@deepseek-ai/dsh-typert-protocol": ">=0.2.2-alpha.3 <0.3.0",
72
- "@deepseek-ai/dsh-tools": ">=0.2.2-alpha.3 <0.3.0"
73
+ "@deepseek-ai/schemastery": "3.18.6-alpha.2 || 3.19.0"
73
74
  },
74
75
  "peerDependenciesMeta": {
75
76
  "@deepseek-ai/dsh-credentials": {
package/runtime/worker.py CHANGED
@@ -324,19 +324,30 @@ def main(body):
324
324
  return {"files": [{"path": f["path"], "bytes": f["bytes"]} for f in files[start:start+500]], "total": len(files)}
325
325
  if action == "read":
326
326
  source_dir = root / "review/source"
327
- p = d.relative(source_dir, body["path"])
328
- content = d.text_of(p)
327
+ path = body["path"]
328
+ proposed = bool(body.get("proposed"))
329
+ if proposed:
330
+ drafts = load_json_if_exists(root / "draft_files.json", {})
331
+ change = next((c for c in reversed(list(drafts.values())) if isinstance(c, dict) and c.get("path") == path), None)
332
+ if change is None or not isinstance(change.get("content"), str):
333
+ raise ValueError("该文件尚无暂存修改,请读取原始源码")
334
+ content = change["content"]
335
+ else:
336
+ p = d.relative(source_dir, path)
337
+ content = d.text_of(p)
329
338
  if content is None:
330
339
  return {"text": "Binary file"}
331
340
  start = max(0, int(body.get("start", 1)) - 1)
332
- lines = redact(content, body["path"]).splitlines()
341
+ lines = redact(content, path).splitlines()
333
342
  excerpt = "\n".join(f"{i + start + 1}: {s[:400]}" for i, s in enumerate(lines[start:start+200]))
334
343
  returned = len(lines[start:start+200])
335
344
  range_info = f"返回第 {start + 1}–{start + returned} 行" if returned else "所请求范围无内容"
336
- excerpt = f"{body['path']} 共 {len(lines)} 行,{range_info}。\n{excerpt}"
337
- fields = original_fields(source_dir, body["path"])
338
- if fields:
339
- excerpt += "\nOriginal configuration references (metadata only; values stay local):\n" + json.dumps(fields, ensure_ascii=False)
345
+ location = "拟交付文件" if proposed else "原始源码"
346
+ excerpt = f"{location} {path} 共 {len(lines)} 行,{range_info}。\n{excerpt}"
347
+ if not proposed:
348
+ fields = original_fields(source_dir, path)
349
+ if fields:
350
+ excerpt += "\nOriginal configuration references (metadata only; values stay local):\n" + json.dumps(fields, ensure_ascii=False)
340
351
  return {"text": excerpt, "total_lines": len(lines)}
341
352
  if action == "read_failed":
342
353
  revision = body.get("revision", "")