Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d954b527f5 | ||
|
|
46deb9cec8 | ||
|
|
488bf027cc | ||
|
|
bd80f86357 |
No files matched your search
@@ -49,8 +49,9 @@ jobs:
|
|||||||
npm install --prefix /opt/ci-node --no-audit --no-fund node@24.11.1
|
npm install --prefix /opt/ci-node --no-audit --no-fund node@24.11.1
|
||||||
node --version
|
node --version
|
||||||
npm ci --prefix integration/dsh --no-audit --no-fund
|
npm ci --prefix integration/dsh --no-audit --no-fund
|
||||||
- name: Read-only model availability (real Harness, no remote model calls)
|
- name: Runtime and model availability (real Harness, no remote model calls)
|
||||||
run: |
|
run: |
|
||||||
|
node tools/verify_dsh_runtime.mjs
|
||||||
node tools/verify_dsh_model_availability.mjs
|
node tools/verify_dsh_model_availability.mjs
|
||||||
node --test tests/integration/test_dsh_standard_compat.mjs
|
node --test tests/integration/test_dsh_standard_compat.mjs
|
||||||
node tools/verify_dsh_incident_restart.mjs
|
node tools/verify_dsh_incident_restart.mjs
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
# Issue 33 D2 · 工程路径错误提示验收
|
||||||
|
|
||||||
|
工程读取和任务创建的路径检查直接调用 `lstat()`。目录不存在或扫描后工程移走时,文件系统异常进入统一兜底,现场报告仅能看到“发生未处理异常”。目录存在且能读取属性时,`scandir()` 仍可能因缺少列目录权限失败。
|
||||||
|
|
||||||
|
修复在路径检查和读取处分类处理这些预期错误。读取对话框和创建任务的错误提示均显示完整路径、分类代码、处理建议和可关联日志的 `DXT` 编号。预期错误写入一条应用日志。未知异常保留 traceback。
|
||||||
|
|
||||||
|
## Windows 11 实测
|
||||||
|
|
||||||
|
使用 Qt 按钮启动读取、真实文件系统与任务库。第五例在成功扫描两个候选工程后重命名其中一个文件,从实际服务入口创建选定任务并检查主窗口所用的错误格式和任务数据库。
|
||||||
|
|
||||||
|
| 输入 | 基线 `46deb9c` | 修复后代码 | 修复后错误编号 |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| 不存在的目录 | 通用兜底 | `path_missing` | `DXT-20261125-3EE8F667` |
|
||||||
|
| 普通文件作为目录 | 英文非目录文案 | `path_not_directory` | `DXT-20261125-92876D74` |
|
||||||
|
| 路径中途遇到普通文件 | 通用兜底 | `path_not_directory` | `DXT-20261125-0C615FE8` |
|
||||||
|
| ACL 拒绝列目录 | 通用兜底 | `path_denied` | `DXT-20261125-ED64EEA9` |
|
||||||
|
| 工程在扫描后被移走 | 通用兜底 | `path_missing` | `DXT-20261125-CA48D2FF` |
|
||||||
|
|
||||||
|
ACL 测试对临时目录中的当前用户拒绝 `FILE_LIST_DIRECTORY`,两个版本的文件系统操作均触发原生 `WinError 5`。创建任务失败后库中仍有 0 条任务。五个路径输入的通用兜底率从 4/5 降到 0/5。额外注入的 `RuntimeError` 对照组仍触发一次 `unhandled_exception`,并保留 traceback。
|
||||||
|
|
||||||
|
## 复跑
|
||||||
|
|
||||||
|
在仓库根目录运行。使用未占用的临时目录保存测试日志。
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
$env:PYTHONUTF8 = '1'
|
||||||
|
python -m pytest -q -s tests/v1_1/test_project_path_errors.py tests/v1_1/test_scan_responsiveness.py tests/v1_1/test_project_long_paths.py tests/v1_1/test_path_access.py tests/trial_task_center/test_logging_setup.py --basetemp build/issue33-d2
|
||||||
|
```
|
||||||
|
|
||||||
|
实测 35 项通过。以下命令按错误记录统计扫描和创建任务的通用兜底率。路径用例与故障对照分别统计时,从相应测试目录读取日志。
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
$rows = Get-ChildItem build/issue33-d2 -Recurse -Filter application.log |
|
||||||
|
Select-String 'error_id=\S+ operation=(scan_project_directory|create_project_tasks) (code=\S+ )?message='
|
||||||
|
$generic = $rows | Where-Object { $_.Line -match 'code=unhandled_exception |message=发生未处理异常$' }
|
||||||
|
'{0}/{1}' -f @($generic).Count, @($rows).Count
|
||||||
|
```
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
主工具顶部固定显示左右两个入口:左侧 **任务中心**,右侧 **DSH助手**,单击直接切换,无需展开菜单。助手也可按 `Ctrl+Shift+D` 打开;切回任务中心再进入助手时保留同一个网页、会话和未发送草稿。右侧“任务监管”读取主工具当前选中的任务。
|
主工具顶部固定显示左右两个入口:左侧 **任务中心**,右侧 **DSH助手**,单击直接切换,无需展开菜单。助手也可按 `Ctrl+Shift+D` 打开;切回任务中心再进入助手时保留同一个网页、会话和未发送草稿。右侧“任务监管”读取主工具当前选中的任务。
|
||||||
|
|
||||||
这里直接运行 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 的官方前端与运行时,固定 npm 版本 `0.2.1-rc.5`,通过 Qt WebEngine 嵌入主窗口。官方三栏框架、原生 SVG、鲸鱼悬停动画、输入编辑器、模型选择、侧栏与停靠交互均由上游代码提供。项目增加任务监管插件和“DSH助手”名称,不再使用 Qt 控件重画聊天页面。上游许可见 `licenses/DeepSeek-Harness-MIT.txt`。
|
这里直接运行 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 的官方前端与运行时,通过 Qt WebEngine 嵌入主窗口。当前 npm 版本以 `integration/dsh/package.json` 为准。官方三栏框架、原生 SVG、鲸鱼悬停动画、输入编辑器、模型选择、侧栏与停靠交互均由上游代码提供。项目增加任务监管插件和“DSH助手”名称,不再使用 Qt 控件重画聊天页面。上游许可见 `licenses/DeepSeek-Harness-MIT.txt`。
|
||||||
|
|
||||||
不显示上游账户登录、注册、充值和首次产品引导,也不注册其账户模型提供方。左下角 **工具设置** 单击打开原生设置页,包含“DSH工具”“通用设置”和“模型”;首页提示和任务监管面板围绕器件替换任务。输入框下方选择已配置的模型。
|
不显示上游账户登录、注册、充值和首次产品引导,也不注册其账户模型提供方。左下角 **工具设置** 单击打开原生设置页,包含“DSH工具”“通用设置”和“模型”;首页提示和任务监管面板围绕器件替换任务。输入框下方选择已配置的模型。
|
||||||
|
|
||||||
@@ -178,6 +178,14 @@ node tools/verify_dsh_runtime.mjs
|
|||||||
python tools/accept_dsh_desktop.py
|
python tools/accept_dsh_desktop.py
|
||||||
```
|
```
|
||||||
|
|
||||||
|
源码工作区可从 npm 更新 DSH。先退出任务中心,运行更新命令,再重新打开任务中心。
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
powershell -ExecutionPolicy Bypass -File tools/Install-DshRuntime.ps1 -Version latest
|
||||||
|
```
|
||||||
|
|
||||||
|
将 `latest` 换成 `0.2.2-rc.5` 这样的完整版本号即可安装指定版本。脚本先在临时目录启动候选运行时并验证任务插件,通过后更新依赖声明、锁文件和实际依赖。更新成功时会打印 `build/dsh-update-…` 路径,其中 `previous` 保存旧运行时,`verification/report.json` 记录验收结果。便携版随应用打包 DSH,通过重新构建的应用发行包更新。
|
||||||
|
|
||||||
CLI 验证启动真实官方内核,检查工具与 preset 名单,实际读取快照、执行禁止工具探针,并测试本机请求认证、跨任务与过期动作边界。桌面验收启动真实主工具,用 Qt 鼠标事件单击左右导航,用 Chromium Input 事件操作官方页面,核对全新数据下无账户或引导弹窗、工具设置、任务刷新、会话、侧栏、SVG 动画、模型选择、草稿保留、取消确认和正常退出。验收只使用独立测试数据,不启动 CAD 或修改用户工程;未配置模型的验收不计为真实模型回复验证。
|
CLI 验证启动真实官方内核,检查工具与 preset 名单,实际读取快照、执行禁止工具探针,并测试本机请求认证、跨任务与过期动作边界。桌面验收启动真实主工具,用 Qt 鼠标事件单击左右导航,用 Chromium Input 事件操作官方页面,核对全新数据下无账户或引导弹窗、工具设置、任务刷新、会话、侧栏、SVG 动画、模型选择、草稿保留、取消确认和正常退出。验收只使用独立测试数据,不启动 CAD 或修改用户工程;未配置模型的验收不计为真实模型回复验证。
|
||||||
|
|
||||||
已配置本机模型时,可执行真实 API 桌面验收:
|
已配置本机模型时,可执行真实 API 桌面验收:
|
||||||
|
|||||||
Generated
+4138
-3271
File diff suppressed because it is too large.
Load diff
@@ -2,7 +2,15 @@
|
|||||||
"name": "dxdesigner-dsh-runtime",
|
"name": "dxdesigner-dsh-runtime",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {"doctor": "node start.mjs --doctor", "start": "node start.mjs"},
|
"scripts": {
|
||||||
"engines": {"node": ">=24.9.0"},
|
"doctor": "node start.mjs --doctor",
|
||||||
"dependencies": {"@deepseek-ai/dsh": "0.2.1-rc.5", "fflate": "0.8.3"}
|
"start": "node start.mjs"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=24.9.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@deepseek-ai/dsh": "0.2.2-rc.5",
|
||||||
|
"fflate": "0.8.3"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -12,7 +12,7 @@ export const FILE_TOOLS=['read','read_image','write','edit','glob','grep','worki
|
|||||||
|
|
||||||
const root = path.dirname(fileURLToPath(import.meta.url));
|
const root = path.dirname(fileURLToPath(import.meta.url));
|
||||||
const require = createRequire(import.meta.url);
|
const require = createRequire(import.meta.url);
|
||||||
export const VERSION = '0.2.1-rc.5';
|
export const VERSION = require('./package.json').dependencies['@deepseek-ai/dsh'];
|
||||||
export const DISABLED = [
|
export const DISABLED = [
|
||||||
'desktop-product-telemetry','product-analytics','session-telemetry-otel',
|
'desktop-product-telemetry','product-analytics','session-telemetry-otel',
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
DeepSeek Harness native frontend and runtime
|
DeepSeek Harness native frontend and runtime
|
||||||
Pinned release: @deepseek-ai/dsh 0.2.1-rc.5
|
Package: @deepseek-ai/dsh
|
||||||
Source: https://github.com/deepseek-ai/deepseek-harness
|
Source: https://github.com/deepseek-ai/deepseek-harness
|
||||||
|
|
||||||
MIT License
|
MIT License
|
||||||
|
|||||||
@@ -12,9 +12,6 @@ from uuid import uuid4
|
|||||||
from .snapshot import TaskSnapshot
|
from .snapshot import TaskSnapshot
|
||||||
from ..trial_task_center.path_access import retry_sharing_violation
|
from ..trial_task_center.path_access import retry_sharing_violation
|
||||||
|
|
||||||
HARNESS_VERSION = '0.2.1-rc.5'
|
|
||||||
|
|
||||||
|
|
||||||
def integration_root() -> Path:
|
def integration_root() -> Path:
|
||||||
if getattr(sys, 'frozen', False):
|
if getattr(sys, 'frozen', False):
|
||||||
return Path(sys._MEIPASS) / 'dsh-runtime'
|
return Path(sys._MEIPASS) / 'dsh-runtime'
|
||||||
|
|||||||
@@ -27,3 +27,7 @@ class TaskCenterError(ValueError):
|
|||||||
def _new_error_id() -> str:
|
def _new_error_id() -> str:
|
||||||
date = datetime.now(timezone.utc).strftime("%Y%m%d")
|
date = datetime.now(timezone.utc).strftime("%Y%m%d")
|
||||||
return f"DXT-{date}-{secrets.token_hex(4).upper()}"
|
return f"DXT-{date}-{secrets.token_hex(4).upper()}"
|
||||||
|
|
||||||
|
|
||||||
|
class ProjectPathError(TaskCenterError):
|
||||||
|
"""An expected filesystem failure while reading or selecting projects."""
|
||||||
@@ -17,7 +17,7 @@ import time
|
|||||||
import traceback
|
import traceback
|
||||||
from typing import Any, Mapping
|
from typing import Any, Mapping
|
||||||
|
|
||||||
from .errors import TaskCenterError
|
from .errors import ProjectPathError, TaskCenterError
|
||||||
from .path_access import internal_path
|
from .path_access import internal_path
|
||||||
from .retention import rotate_text_log
|
from .retention import rotate_text_log
|
||||||
|
|
||||||
@@ -62,15 +62,18 @@ class LoggingContext:
|
|||||||
reported = error
|
reported = error
|
||||||
else:
|
else:
|
||||||
reported = TaskCenterError("unhandled_exception", "发生未处理异常")
|
reported = TaskCenterError("unhandled_exception", "发生未处理异常")
|
||||||
|
message = reported.message
|
||||||
|
if not isinstance(error, ProjectPathError):
|
||||||
detail = "".join(
|
detail = "".join(
|
||||||
traceback.format_exception(type(error), error, traceback_object or error.__traceback__)
|
traceback.format_exception(type(error), error, traceback_object or error.__traceback__)
|
||||||
)
|
)
|
||||||
|
message += "\n" + detail.rstrip()
|
||||||
self.logger.error(
|
self.logger.error(
|
||||||
"error_id=%s operation=%s message=%s\n%s",
|
"error_id=%s operation=%s code=%s message=%s",
|
||||||
reported.error_id,
|
reported.error_id,
|
||||||
operation,
|
operation,
|
||||||
reported.message,
|
reported.code,
|
||||||
detail.rstrip(),
|
message,
|
||||||
)
|
)
|
||||||
_flush_handlers(self.logger)
|
_flush_handlers(self.logger)
|
||||||
return reported
|
return reported
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from collections.abc import Callable
|
from collections.abc import Callable
|
||||||
|
from contextlib import contextmanager
|
||||||
from threading import Event
|
from threading import Event
|
||||||
|
|
||||||
import os
|
import os
|
||||||
@@ -10,20 +11,44 @@ from pathlib import Path
|
|||||||
import stat
|
import stat
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
|
|
||||||
from .errors import TaskCenterError
|
from .errors import ProjectPathError, TaskCenterError
|
||||||
from .path_access import canonical_path, internal_path, strip_extended_prefix
|
from .path_access import canonical_path, internal_path, strip_extended_prefix
|
||||||
from .models import TaskRecord, TaskStatus
|
from .models import TaskRecord, TaskStatus
|
||||||
from .scanner import _is_schematic_project, _reject_reparse
|
from .scanner import _is_schematic_project, _reject_reparse
|
||||||
from .store import TaskStore
|
from .store import TaskStore
|
||||||
|
|
||||||
|
|
||||||
|
@contextmanager
|
||||||
|
def _path_errors(path: Path):
|
||||||
|
try:
|
||||||
|
yield
|
||||||
|
except FileNotFoundError as error:
|
||||||
|
raise ProjectPathError(
|
||||||
|
"path_missing", f"找不到路径「{path}」。请确认目录或工程是否已移动或删除,然后重新选择并读取。"
|
||||||
|
) from error
|
||||||
|
except PermissionError as error:
|
||||||
|
raise ProjectPathError(
|
||||||
|
"path_denied", f"无法读取路径「{path}」。请检查当前用户的读取权限,然后重试。"
|
||||||
|
) from error
|
||||||
|
except NotADirectoryError as error:
|
||||||
|
raise _not_directory(path) from error
|
||||||
|
|
||||||
|
|
||||||
|
def _not_directory(path: Path) -> ProjectPathError:
|
||||||
|
return ProjectPathError(
|
||||||
|
"path_not_directory", f"路径「{path}」中有一项不是目录。请选择工程目录后重试。"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def _validated_root(root: Path, excluded_roots: tuple[Path, ...]) -> tuple[Path, tuple[Path, ...]]:
|
def _validated_root(root: Path, excluded_roots: tuple[Path, ...]) -> tuple[Path, tuple[Path, ...]]:
|
||||||
root = Path(os.path.abspath(strip_extended_prefix(root)))
|
root = Path(os.path.abspath(strip_extended_prefix(root)))
|
||||||
|
with _path_errors(root):
|
||||||
for ancestor in (*reversed(root.parents), root):
|
for ancestor in (*reversed(root.parents), root):
|
||||||
_reject_reparse(internal_path(ancestor).lstat(), ancestor)
|
details = internal_path(ancestor).lstat()
|
||||||
|
_reject_reparse(details, ancestor)
|
||||||
|
if not stat.S_ISDIR(details.st_mode):
|
||||||
|
raise _not_directory(root)
|
||||||
root = canonical_path(root, strict=True)
|
root = canonical_path(root, strict=True)
|
||||||
if not internal_path(root).is_dir():
|
|
||||||
raise TaskCenterError("discovery_root", "project root is not a directory")
|
|
||||||
excluded = tuple(canonical_path(path) for path in excluded_roots)
|
excluded = tuple(canonical_path(path) for path in excluded_roots)
|
||||||
if any(root.is_relative_to(blocked) for blocked in excluded):
|
if any(root.is_relative_to(blocked) for blocked in excluded):
|
||||||
raise TaskCenterError("discovery_root", "project root is inside an excluded directory")
|
raise TaskCenterError("discovery_root", "project root is inside an excluded directory")
|
||||||
@@ -50,8 +75,9 @@ def scan_project_directory(root: Path, *, excluded_roots: tuple[Path, ...] = (),
|
|||||||
while pending:
|
while pending:
|
||||||
check_cancelled()
|
check_cancelled()
|
||||||
directory = pending.pop()
|
directory = pending.pop()
|
||||||
_reject_reparse(internal_path(directory).lstat(), directory)
|
|
||||||
children = []
|
children = []
|
||||||
|
with _path_errors(directory):
|
||||||
|
_reject_reparse(internal_path(directory).lstat(), directory)
|
||||||
with os.scandir(internal_path(directory)) as entries:
|
with os.scandir(internal_path(directory)) as entries:
|
||||||
for entry in entries:
|
for entry in entries:
|
||||||
check_cancelled()
|
check_cancelled()
|
||||||
@@ -63,6 +89,7 @@ def scan_project_directory(root: Path, *, excluded_roots: tuple[Path, ...] = (),
|
|||||||
path = Path(strip_extended_prefix(entry.path))
|
path = Path(strip_extended_prefix(entry.path))
|
||||||
if any(path.is_relative_to(blocked) for blocked in excluded):
|
if any(path.is_relative_to(blocked) for blocked in excluded):
|
||||||
continue
|
continue
|
||||||
|
with _path_errors(path):
|
||||||
details = entry.stat(follow_symlinks=False)
|
details = entry.stat(follow_symlinks=False)
|
||||||
_reject_reparse(details, path)
|
_reject_reparse(details, path)
|
||||||
if stat.S_ISDIR(details.st_mode):
|
if stat.S_ISDIR(details.st_mode):
|
||||||
@@ -84,14 +111,18 @@ def _validate_selected(root: Path, selected_paths: tuple[Path, ...], excluded: t
|
|||||||
ancestor_projects: dict[Path, bool] = {}
|
ancestor_projects: dict[Path, bool] = {}
|
||||||
for candidate in selected_paths:
|
for candidate in selected_paths:
|
||||||
path = Path(os.path.abspath(strip_extended_prefix(candidate)))
|
path = Path(os.path.abspath(strip_extended_prefix(candidate)))
|
||||||
if not path.is_relative_to(root) or any(path.is_relative_to(blocked) for blocked in excluded):
|
if path == root or not path.is_relative_to(root) or any(path.is_relative_to(blocked) for blocked in excluded):
|
||||||
raise TaskCenterError("project_selection", "selected project is outside discovery results")
|
raise TaskCenterError("project_selection", "selected project is outside discovery results")
|
||||||
relative = path.relative_to(root)
|
relative = path.relative_to(root)
|
||||||
cursor = root
|
cursor = root
|
||||||
|
with _path_errors(path):
|
||||||
for part in relative.parts:
|
for part in relative.parts:
|
||||||
cursor /= part
|
cursor /= part
|
||||||
_reject_reparse(internal_path(cursor).lstat(), cursor)
|
details = internal_path(cursor).lstat()
|
||||||
if not internal_path(path).is_file() or path.suffix.casefold() != ".prj" or not _is_schematic_project(path):
|
_reject_reparse(details, cursor)
|
||||||
|
if cursor != path and not stat.S_ISDIR(details.st_mode):
|
||||||
|
raise _not_directory(path)
|
||||||
|
if not stat.S_ISREG(details.st_mode) or path.suffix.casefold() != ".prj" or not _is_schematic_project(path):
|
||||||
raise TaskCenterError("project_selection", "selected file is not a schematic project")
|
raise TaskCenterError("project_selection", "selected file is not a schematic project")
|
||||||
# A project in any ancestor directory stops discovery below that directory.
|
# A project in any ancestor directory stops discovery below that directory.
|
||||||
directory = path.parent
|
directory = path.parent
|
||||||
@@ -99,11 +130,12 @@ def _validate_selected(root: Path, selected_paths: tuple[Path, ...], excluded: t
|
|||||||
directory = directory.parent
|
directory = directory.parent
|
||||||
if directory not in ancestor_projects:
|
if directory not in ancestor_projects:
|
||||||
has_project = False
|
has_project = False
|
||||||
with os.scandir(internal_path(directory)) as entries:
|
with _path_errors(directory), os.scandir(internal_path(directory)) as entries:
|
||||||
for entry in entries:
|
for entry in entries:
|
||||||
sibling = Path(strip_extended_prefix(entry.path))
|
sibling = Path(strip_extended_prefix(entry.path))
|
||||||
if sibling.suffix.casefold() != ".prj" or any(sibling.is_relative_to(b) for b in excluded):
|
if sibling.suffix.casefold() != ".prj" or any(sibling.is_relative_to(b) for b in excluded):
|
||||||
continue
|
continue
|
||||||
|
with _path_errors(sibling):
|
||||||
details = entry.stat(follow_symlinks=False)
|
details = entry.stat(follow_symlinks=False)
|
||||||
_reject_reparse(details, sibling)
|
_reject_reparse(details, sibling)
|
||||||
if stat.S_ISREG(details.st_mode) and _is_schematic_project(sibling):
|
if stat.S_ISREG(details.st_mode) and _is_schematic_project(sibling):
|
||||||
@@ -112,6 +144,7 @@ def _validate_selected(root: Path, selected_paths: tuple[Path, ...], excluded: t
|
|||||||
ancestor_projects[directory] = has_project
|
ancestor_projects[directory] = has_project
|
||||||
if ancestor_projects[directory]:
|
if ancestor_projects[directory]:
|
||||||
raise TaskCenterError("project_selection", "selected project is hidden by an ancestor project")
|
raise TaskCenterError("project_selection", "selected project is hidden by an ancestor project")
|
||||||
|
with _path_errors(path):
|
||||||
selected.add(canonical_path(path, strict=True))
|
selected.add(canonical_path(path, strict=True))
|
||||||
return tuple(sorted(selected, key=lambda path: str(path).casefold()))
|
return tuple(sorted(selected, key=lambda path: str(path).casefold()))
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ from datetime import datetime
|
|||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
from ..errors import ProjectPathError
|
||||||
|
|
||||||
ERROR_TEXT = {
|
ERROR_TEXT = {
|
||||||
"dsh_startup": "DSH助手启动失败,请检查发布包中的运行时和 Node.js。",
|
"dsh_startup": "DSH助手启动失败,请检查发布包中的运行时和 Node.js。",
|
||||||
'user_forced_stop': '操作已强制中断,结果待核验。',
|
'user_forced_stop': '操作已强制中断,结果待核验。',
|
||||||
@@ -57,6 +59,8 @@ ERROR_TEXT = {
|
|||||||
|
|
||||||
|
|
||||||
def format_operation_error(error):
|
def format_operation_error(error):
|
||||||
|
if isinstance(error, ProjectPathError):
|
||||||
|
return f'{error.message}\n错误代码:{error.code} · 错误编号:{error.error_id}'
|
||||||
title = ERROR_TEXT.get(error.code, '操作未完成')
|
title = ERROR_TEXT.get(error.code, '操作未完成')
|
||||||
report = getattr(error, 'bom_report', None)
|
report = getattr(error, 'bom_report', None)
|
||||||
if report is not None:
|
if report is not None:
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ from .workers import ServiceWorker
|
|||||||
from .operation_state import OperationPhase
|
from .operation_state import OperationPhase
|
||||||
from .command_menu import CommandMenu
|
from .command_menu import CommandMenu
|
||||||
from .icons import icon
|
from .icons import icon
|
||||||
|
from .messages import format_operation_error
|
||||||
|
from ..errors import ProjectPathError
|
||||||
from ..bom_import_state import BomImportMachine, BomImportPhase, BomImportState
|
from ..bom_import_state import BomImportMachine, BomImportPhase, BomImportState
|
||||||
from ..bom_pending import retained_bom_rows
|
from ..bom_pending import retained_bom_rows
|
||||||
|
|
||||||
@@ -44,6 +46,9 @@ class DirectoryTaskDialog(QDialog):
|
|||||||
self.scan = QPushButton('读取工程', objectName='readTaskProjects')
|
self.scan = QPushButton('读取工程', objectName='readTaskProjects')
|
||||||
self.projects = QListWidget(objectName='taskProjectCandidates')
|
self.projects = QListWidget(objectName='taskProjectCandidates')
|
||||||
self.summary = QLabel('先读取工程,再勾选需要创建任务的项目。')
|
self.summary = QLabel('先读取工程,再勾选需要创建任务的项目。')
|
||||||
|
self.summary.setWordWrap(True)
|
||||||
|
self.summary.setTextFormat(Qt.TextFormat.PlainText)
|
||||||
|
self.summary.setTextInteractionFlags(Qt.TextInteractionFlag.TextSelectableByMouse)
|
||||||
self.buttons = QDialogButtonBox(QDialogButtonBox.StandardButton.Ok | QDialogButtonBox.StandardButton.Cancel)
|
self.buttons = QDialogButtonBox(QDialogButtonBox.StandardButton.Ok | QDialogButtonBox.StandardButton.Cancel)
|
||||||
self.buttons.button(QDialogButtonBox.StandardButton.Ok).setText('创建任务')
|
self.buttons.button(QDialogButtonBox.StandardButton.Ok).setText('创建任务')
|
||||||
self.buttons.button(QDialogButtonBox.StandardButton.Ok).setEnabled(False)
|
self.buttons.button(QDialogButtonBox.StandardButton.Ok).setEnabled(False)
|
||||||
@@ -137,6 +142,9 @@ class DirectoryTaskDialog(QDialog):
|
|||||||
if self._closed:
|
if self._closed:
|
||||||
return
|
return
|
||||||
self._scanned_root = None
|
self._scanned_root = None
|
||||||
|
if isinstance(error, ProjectPathError):
|
||||||
|
self.summary.setText(format_operation_error(error))
|
||||||
|
else:
|
||||||
self.summary.setText(getattr(error, 'message', str(error)))
|
self.summary.setText(getattr(error, 'message', str(error)))
|
||||||
|
|
||||||
def _finished(self):
|
def _finished(self):
|
||||||
|
|||||||
@@ -0,0 +1,134 @@
|
|||||||
|
from contextlib import closing
|
||||||
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
from PySide6.QtCore import Qt
|
||||||
|
from PySide6.QtWidgets import QDialogButtonBox
|
||||||
|
|
||||||
|
from dx_productivity.trial_task_center import project_tasks
|
||||||
|
from dx_productivity.trial_task_center.errors import TaskCenterError
|
||||||
|
from dx_productivity.trial_task_center.logging_setup import configure_logging
|
||||||
|
from dx_productivity.trial_task_center.service import TaskCenterService
|
||||||
|
from dx_productivity.trial_task_center.store import TaskStore
|
||||||
|
from dx_productivity.trial_task_center.ui.messages import format_operation_error
|
||||||
|
from dx_productivity.trial_task_center.ui.project_plan import DirectoryTaskDialog
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def service(tmp_path):
|
||||||
|
log = configure_logging(tmp_path / 'data')
|
||||||
|
with closing(TaskStore(tmp_path / 'tasks.db')) as store:
|
||||||
|
yield TaskCenterService(store, log), store, log.application_log_path
|
||||||
|
|
||||||
|
|
||||||
|
def deny_directory_listing(folder, request):
|
||||||
|
if os.name != 'nt':
|
||||||
|
pytest.skip('requires a Windows filesystem ACL')
|
||||||
|
import ntsecuritycon
|
||||||
|
import win32api
|
||||||
|
import win32con
|
||||||
|
import win32security
|
||||||
|
|
||||||
|
flag = win32security.DACL_SECURITY_INFORMATION
|
||||||
|
path = str(folder)
|
||||||
|
original = win32security.GetFileSecurity(path, flag)
|
||||||
|
token = win32security.OpenProcessToken(win32api.GetCurrentProcess(), win32con.TOKEN_QUERY)
|
||||||
|
try:
|
||||||
|
sid = win32security.GetTokenInformation(token, win32security.TokenUser)[0]
|
||||||
|
finally:
|
||||||
|
token.Close()
|
||||||
|
dacl = win32security.ACL()
|
||||||
|
dacl.AddAccessDeniedAce(win32security.ACL_REVISION, ntsecuritycon.FILE_LIST_DIRECTORY, sid)
|
||||||
|
dacl.AddAccessAllowedAce(win32security.ACL_REVISION, ntsecuritycon.FILE_ALL_ACCESS, sid)
|
||||||
|
descriptor = win32security.SECURITY_DESCRIPTOR()
|
||||||
|
descriptor.SetSecurityDescriptorDacl(True, dacl, False)
|
||||||
|
request.addfinalizer(lambda: win32security.SetFileSecurity(path, flag, original))
|
||||||
|
win32security.SetFileSecurity(path, flag, descriptor)
|
||||||
|
with pytest.raises(PermissionError) as failure, os.scandir(folder):
|
||||||
|
pytest.fail('directory ACL did not deny enumeration')
|
||||||
|
assert failure.value.winerror == 5
|
||||||
|
print('Windows ACL produced WinError 5')
|
||||||
|
|
||||||
|
|
||||||
|
def assert_operator_error(text, path, code, advice):
|
||||||
|
print(text)
|
||||||
|
assert str(path) in text
|
||||||
|
assert code in text and 'DXT-' in text
|
||||||
|
assert advice in text
|
||||||
|
assert 'Traceback' not in text
|
||||||
|
assert '发生未处理异常' not in text
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(('case', 'code', 'advice'), [
|
||||||
|
('missing', 'path_missing', '移动或删除'),
|
||||||
|
('file', 'path_not_directory', '请选择工程目录'),
|
||||||
|
('file_parent', 'path_not_directory', '请选择工程目录'),
|
||||||
|
('denied', 'path_denied', '读取权限'),
|
||||||
|
])
|
||||||
|
def test_directory_dialog_shows_actionable_path_error(qtbot, tmp_path, request, service, case, code, advice):
|
||||||
|
api, store, log = service
|
||||||
|
folder = tmp_path / case
|
||||||
|
requested = folder
|
||||||
|
if case in {'file', 'file_parent'}:
|
||||||
|
folder.touch()
|
||||||
|
if case == 'file_parent':
|
||||||
|
requested = folder / 'subfolder'
|
||||||
|
if case == 'denied':
|
||||||
|
folder.mkdir()
|
||||||
|
deny_directory_listing(folder, request)
|
||||||
|
|
||||||
|
dialog = DirectoryTaskDialog(api)
|
||||||
|
qtbot.addWidget(dialog)
|
||||||
|
dialog.directory.setText(str(requested))
|
||||||
|
dialog.show()
|
||||||
|
qtbot.mouseClick(dialog.scan, Qt.MouseButton.LeftButton)
|
||||||
|
qtbot.waitUntil(lambda: dialog._worker is None, timeout=5000)
|
||||||
|
assert dialog.directory.isEnabled()
|
||||||
|
assert not dialog.buttons.button(QDialogButtonBox.StandardButton.Ok).isEnabled()
|
||||||
|
assert_operator_error(dialog.summary.text(), requested, code, advice)
|
||||||
|
assert store.list_tasks() == ()
|
||||||
|
contents = log.read_text(encoding='utf-8')
|
||||||
|
assert f'operation=scan_project_directory code={code}' in contents
|
||||||
|
assert 'Traceback' not in contents
|
||||||
|
|
||||||
|
|
||||||
|
def test_moved_project_fails_after_scan_without_creating_partial_tasks(qtbot, tmp_path, service):
|
||||||
|
api, store, log = service
|
||||||
|
root = tmp_path / 'projects'
|
||||||
|
root.mkdir()
|
||||||
|
for name in ('one.prj', 'two.prj'):
|
||||||
|
(root / name).write_text('KEY FrontEndSnapshot "DxD"\nKEY iCDBDir "database"\n')
|
||||||
|
dialog = DirectoryTaskDialog(api)
|
||||||
|
qtbot.addWidget(dialog)
|
||||||
|
dialog.directory.setText(str(root))
|
||||||
|
dialog.show()
|
||||||
|
qtbot.mouseClick(dialog.scan, Qt.MouseButton.LeftButton)
|
||||||
|
create = dialog.buttons.button(QDialogButtonBox.StandardButton.Ok)
|
||||||
|
qtbot.waitUntil(create.isEnabled, timeout=5000)
|
||||||
|
moved = root / 'two.prj'
|
||||||
|
moved.rename(root / 'relocated.prj')
|
||||||
|
qtbot.mouseClick(create, Qt.MouseButton.LeftButton)
|
||||||
|
|
||||||
|
with pytest.raises(TaskCenterError) as failure:
|
||||||
|
api.create_project_tasks(dialog.values()[0], selected_paths=dialog.values()[1])
|
||||||
|
assert_operator_error(format_operation_error(failure.value), moved, 'path_missing', '移动或删除')
|
||||||
|
assert store.list_tasks() == ()
|
||||||
|
contents = log.read_text(encoding='utf-8')
|
||||||
|
assert 'operation=create_project_tasks code=path_missing' in contents
|
||||||
|
assert 'Traceback' not in contents
|
||||||
|
|
||||||
|
|
||||||
|
def test_unexpected_scan_fault_remains_traceable_in_application_log(tmp_path, monkeypatch, service):
|
||||||
|
api, _, log = service
|
||||||
|
|
||||||
|
def fail(*args, **kwargs):
|
||||||
|
raise RuntimeError('injected non-filesystem failure')
|
||||||
|
|
||||||
|
monkeypatch.setattr(project_tasks, '_validated_root', fail)
|
||||||
|
with pytest.raises(TaskCenterError) as failure:
|
||||||
|
api.scan_project_directory(tmp_path)
|
||||||
|
assert failure.value.code == 'unhandled_exception'
|
||||||
|
contents = log.read_text(encoding='utf-8')
|
||||||
|
assert 'operation=scan_project_directory code=unhandled_exception' in contents
|
||||||
|
assert 'Traceback' in contents and failure.value.error_id in contents
|
||||||
@@ -1,14 +1,74 @@
|
|||||||
param()
|
param(
|
||||||
|
[string]$Version
|
||||||
|
)
|
||||||
$ErrorActionPreference = 'Stop'
|
$ErrorActionPreference = 'Stop'
|
||||||
$dshRepoRoot = Split-Path -Parent $PSScriptRoot
|
$dshRepoRoot = Split-Path -Parent $PSScriptRoot
|
||||||
$dshRuntimeRoot = Join-Path $dshRepoRoot 'integration/dsh'
|
$dshRuntimeRoot = Join-Path $dshRepoRoot 'integration/dsh'
|
||||||
$dshNodeCommand = Get-Command node -ErrorAction Stop
|
$dshNodeCommand = Get-Command node -ErrorAction Stop
|
||||||
$dshNodeVersion = & $dshNodeCommand.Source -p 'process.versions.node'
|
$dshNodeVersion = & $dshNodeCommand.Source -p 'process.versions.node'
|
||||||
if ([version]$dshNodeVersion -lt [version]'24.9.0') { throw 'DSH requires Node.js 24.9.0 or later.' }
|
if ([version]$dshNodeVersion -lt [version]'24.9.0') { throw 'DSH requires Node.js 24.9.0 or later.' }
|
||||||
Push-Location -LiteralPath $dshRuntimeRoot
|
$dshNpm = (Get-Command npm.cmd -ErrorAction Stop).Source
|
||||||
|
$dshRegistry = 'https://registry.npmjs.org/'
|
||||||
|
|
||||||
|
$dshBuild = Join-Path $dshRepoRoot 'build'
|
||||||
|
New-Item -ItemType Directory -Path $dshBuild -Force | Out-Null
|
||||||
|
$dshInstallLock = [IO.File]::Open((Join-Path $dshBuild 'dsh-install.lock'), 'OpenOrCreate', 'ReadWrite', 'None')
|
||||||
try {
|
try {
|
||||||
& npm.cmd ci --ignore-scripts --no-audit --no-fund
|
if (-not $Version) {
|
||||||
|
& $dshNpm --prefix $dshRuntimeRoot ci --ignore-scripts --no-audit --no-fund
|
||||||
if ($LASTEXITCODE -ne 0) { throw 'DSH installation failed.' }
|
if ($LASTEXITCODE -ne 0) { throw 'DSH installation failed.' }
|
||||||
& $dshNodeCommand.Source start.mjs --doctor
|
& $dshNodeCommand.Source (Join-Path $dshRuntimeRoot 'start.mjs') --doctor
|
||||||
if ($LASTEXITCODE -ne 0) { throw 'DSH runtime verification failed.' }
|
if ($LASTEXITCODE -ne 0) { throw 'DSH runtime verification failed.' }
|
||||||
} finally { Pop-Location }
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($Version -cnotmatch '\A(?:latest|\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?)\z') {
|
||||||
|
throw 'Use latest or an exact version, for example 0.2.2-rc.5.'
|
||||||
|
}
|
||||||
|
|
||||||
|
# Keep the candidate and previous installation on the same volume for rename.
|
||||||
|
$dshStage = Join-Path $dshBuild ('dsh-update-' + [Guid]::NewGuid().ToString('N'))
|
||||||
|
$dshCandidate = Join-Path $dshStage 'candidate'
|
||||||
|
$dshPrevious = Join-Path $dshStage 'previous'
|
||||||
|
$dshEntries = @('package.json', 'package-lock.json', 'node_modules')
|
||||||
|
$dshBackedUp = @()
|
||||||
|
$dshPublished = @()
|
||||||
|
New-Item -ItemType Directory -Path $dshCandidate, $dshPrevious -Force | Out-Null
|
||||||
|
try {
|
||||||
|
Copy-Item -LiteralPath @(
|
||||||
|
(Join-Path $dshRuntimeRoot 'package.json')
|
||||||
|
(Join-Path $dshRuntimeRoot 'package-lock.json')
|
||||||
|
(Join-Path $dshRuntimeRoot 'start.mjs')
|
||||||
|
(Join-Path $dshRuntimeRoot 'task-plugin')
|
||||||
|
) -Destination $dshCandidate -Recurse
|
||||||
|
& $dshNpm --prefix $dshCandidate install --save-exact --ignore-scripts --no-audit --no-fund --registry=$dshRegistry "@deepseek-ai/dsh@$Version"
|
||||||
|
if ($LASTEXITCODE -ne 0) { throw 'DSH candidate installation failed.' }
|
||||||
|
& $dshNodeCommand.Source (Join-Path $PSScriptRoot 'verify_dsh_runtime.mjs') $dshCandidate (Join-Path $dshStage 'verification')
|
||||||
|
if ($LASTEXITCODE -ne 0) { throw 'DSH candidate failed the runtime check. The previous runtime is still available.' }
|
||||||
|
|
||||||
|
foreach ($dshEntry in $dshEntries) {
|
||||||
|
$dshLive = Join-Path $dshRuntimeRoot $dshEntry
|
||||||
|
if (Test-Path -LiteralPath $dshLive) {
|
||||||
|
Move-Item -LiteralPath $dshLive -Destination (Join-Path $dshPrevious $dshEntry)
|
||||||
|
$dshBackedUp += $dshEntry
|
||||||
|
}
|
||||||
|
Move-Item -LiteralPath (Join-Path $dshCandidate $dshEntry) -Destination $dshLive
|
||||||
|
$dshPublished += $dshEntry
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
try {
|
||||||
|
foreach ($dshEntry in $dshPublished) {
|
||||||
|
Move-Item -LiteralPath (Join-Path $dshRuntimeRoot $dshEntry) -Destination (Join-Path $dshCandidate $dshEntry)
|
||||||
|
}
|
||||||
|
foreach ($dshEntry in $dshBackedUp) {
|
||||||
|
Move-Item -LiteralPath (Join-Path $dshPrevious $dshEntry) -Destination (Join-Path $dshRuntimeRoot $dshEntry)
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
throw "DSH rollback failed. Previous files: $dshPrevious. $($_.Exception.Message)"
|
||||||
|
}
|
||||||
|
throw
|
||||||
|
}
|
||||||
|
Write-Output "DSH updated. Previous files and verification: $dshStage"
|
||||||
|
} finally {
|
||||||
|
$dshInstallLock.Dispose()
|
||||||
|
}
|
||||||
@@ -13,7 +13,8 @@ const {loadProfileDirectory,composeEntries}=await load('@deepseek-ai/dsh-app-boo
|
|||||||
const {runProfile,INSTALL_ANCHOR}=await load('@deepseek-ai/dsh/profile-boot');
|
const {runProfile,INSTALL_ANCHOR}=await load('@deepseek-ai/dsh/profile-boot');
|
||||||
const {createLaunchEnvironmentSnapshot}=await load('@deepseek-ai/dsh-launch-environment');
|
const {createLaunchEnvironmentSnapshot}=await load('@deepseek-ai/dsh-launch-environment');
|
||||||
const installed=require('@deepseek-ai/dsh/package.json');
|
const installed=require('@deepseek-ai/dsh/package.json');
|
||||||
if(installed.version!=='0.2.1-rc.5')throw Error('Runtime version mismatch');
|
const expected=require('../package.json').dependencies['@deepseek-ai/dsh'];
|
||||||
|
if(installed.version!==expected)throw Error('Runtime version mismatch');
|
||||||
const original=loadProfileDirectory('paired-source',path.resolve(source),INSTALL_ANCHOR);
|
const original=loadProfileDirectory('paired-source',path.resolve(source),INSTALL_ANCHOR);
|
||||||
const effective=composeEntries([...original.layers.map(layer=>layer.patches),original.patches]);
|
const effective=composeEntries([...original.layers.map(layer=>layer.patches),original.patches]);
|
||||||
// Copy effective routing/model/shell budgets, never credential values to reports.
|
// Copy effective routing/model/shell budgets, never credential values to reports.
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
/** Check actual shell file access separately from model behavior. */
|
/** Check actual shell file access separately from model behavior. */
|
||||||
|
import {executeTool} from './dsh_tool_probe.mjs';
|
||||||
import {mkdir,mkdtemp,writeFile} from 'node:fs/promises';
|
import {mkdir,mkdtemp,writeFile} from 'node:fs/promises';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import os from 'node:os';
|
import os from 'node:os';
|
||||||
@@ -17,7 +18,7 @@ try{
|
|||||||
const agent=ctx.agents.get(sessionId);
|
const agent=ctx.agents.get(sessionId);
|
||||||
const filename=path.join(process.env.DX_DSH_WORKSPACE,'input.txt');
|
const filename=path.join(process.env.DX_DSH_WORKSPACE,'input.txt');
|
||||||
await writeFile(filename,'SHELL_FILE_READ_OK');
|
await writeFile(filename,'SHELL_FILE_READ_OK');
|
||||||
const result=await ctx.tools.execute({agent,callId:crypto.randomUUID(),name:'pwsh',
|
const result=await executeTool(ctx, {agent,callId:crypto.randomUUID(),name:'pwsh',
|
||||||
arguments:{description:'Read the owned shell verification file',command:`[System.IO.File]::ReadAllText('${filename.replaceAll("'","''")}')`},signal:AbortSignal.timeout(30000)});
|
arguments:{description:'Read the owned shell verification file',command:`[System.IO.File]::ReadAllText('${filename.replaceAll("'","''")}')`},signal:AbortSignal.timeout(30000)});
|
||||||
console.log(JSON.stringify({root,result}));
|
console.log(JSON.stringify({root,result}));
|
||||||
}finally{await shutdown.shutdown(0);}
|
}finally{await shutdown.shutdown(0);}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
/** Run one tool through the installed Harness batch executor. */
|
||||||
|
export async function executeTool(ctx, {callId, name, arguments: args, ...options}) {
|
||||||
|
const {results} = await ctx.tools.execute({
|
||||||
|
...options,
|
||||||
|
calls: [{type: 'tool-call', id: callId, name, arguments: JSON.stringify(args ?? {})}],
|
||||||
|
});
|
||||||
|
return results[0].result;
|
||||||
|
}
|
||||||
@@ -1,13 +1,19 @@
|
|||||||
/** Real native Harness incident diagnosis; no engineering mutations or issue writes. */
|
/** Real native Harness incident diagnosis; no engineering mutations or issue writes. */
|
||||||
|
import {executeTool} from './dsh_tool_probe.mjs';
|
||||||
import assert from 'node:assert/strict';
|
import assert from 'node:assert/strict';
|
||||||
import {mkdir,writeFile} from 'node:fs/promises';
|
import {mkdir,mkdtemp,writeFile} from 'node:fs/promises';
|
||||||
|
import {createRequire} from 'node:module';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
|
import {pathToFileURL} from 'node:url';
|
||||||
import {bootRuntime} from '../integration/dsh/start.mjs';
|
import {bootRuntime} from '../integration/dsh/start.mjs';
|
||||||
|
|
||||||
const output=path.resolve('build/dsh-auto-runtime');
|
const output=path.resolve('build/dsh-auto-runtime');
|
||||||
await mkdir(output,{recursive:true});
|
await mkdir(output,{recursive:true});
|
||||||
process.env.DX_DSH_HOME=path.join(output,'home');
|
const offline=process.argv.includes('--fixture');
|
||||||
process.env.DX_DSH_CONTEXT_FILE=path.join(output,'context.json');
|
const fixture=offline?await mkdtemp(path.join(output,'run-')):output;
|
||||||
|
if(offline)for(const key of ['DSH_API_KEY','DSH_API_BASE','DSH_MODEL','DX_DSH_MODELS'])delete process.env[key];
|
||||||
|
process.env.DX_DSH_HOME=path.join(fixture,'home');
|
||||||
|
process.env.DX_DSH_CONTEXT_FILE=path.join(fixture,'context.json');
|
||||||
await writeFile(process.env.DX_DSH_CONTEXT_FILE,JSON.stringify({task_id:'different-current-task',revision:'other',status:'draft'}));
|
await writeFile(process.env.DX_DSH_CONTEXT_FILE,JSON.stringify({task_id:'different-current-task',revision:'other',status:'draft'}));
|
||||||
const snapshot={task_id:'auto-failure-fixture',revision:'incident',status:'failed',issue_code:'worker_error',
|
const snapshot={task_id:'auto-failure-fixture',revision:'incident',status:'failed',issue_code:'worker_error',
|
||||||
issue:'受控诊断验收:执行前 worker 失败,没有工程写入。',rules_count:1,progress:{failed_items:1,total:1,completed:0}};
|
issue:'受控诊断验收:执行前 worker 失败,没有工程写入。',rules_count:1,progress:{failed_items:1,total:1,completed:0}};
|
||||||
@@ -31,6 +37,27 @@ process.stdout.write=function(chunk,...args){
|
|||||||
};
|
};
|
||||||
let timer;
|
let timer;
|
||||||
try{
|
try{
|
||||||
|
if(offline){
|
||||||
|
const require=createRequire(new URL('../integration/dsh/start.mjs',import.meta.url));
|
||||||
|
const {LlmAdapter}=await import(pathToFileURL(require.resolve('@deepseek-ai/dsh-llm')).href);
|
||||||
|
let snapshotRequested=false;
|
||||||
|
class DiagnosticFixture extends LlmAdapter{
|
||||||
|
providerInfo(provider){return {id:provider,name:'Auto runtime fixture'};}
|
||||||
|
async listModels(provider){return [{provider,id:'fixture',name:'Fixture'}];}
|
||||||
|
async *stream(options){
|
||||||
|
const readSnapshot=options.purpose!=='session-title'&&!snapshotRequested;
|
||||||
|
if(readSnapshot)snapshotRequested=true;
|
||||||
|
const block=readSnapshot
|
||||||
|
?{type:'tool-call',id:crypto.randomUUID(),name:'dx_task_snapshot',arguments:'{}'}
|
||||||
|
:{type:'text',text:'Controlled diagnosis fixture. {"action":"none"}'};
|
||||||
|
yield {type:'block-start',index:0,blockType:block.type};
|
||||||
|
yield {type:'block-end',index:0,block};
|
||||||
|
yield {type:'finish',reason:{kind:readSnapshot?'tool-calls':'stop'}};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ctx.llm.registerAdapter(['auto-runtime-fixture'],new DiagnosticFixture());
|
||||||
|
await ctx.agentDefaultModel.saveSelection({provider:'auto-runtime-fixture',model:'fixture'});
|
||||||
|
}
|
||||||
timer=setTimeout(()=>rejectResult(Error('native_auto_test_timeout')),135000);
|
timer=setTimeout(()=>rejectResult(Error('native_auto_test_timeout')),135000);
|
||||||
ctx.emit('dx/diagnose-request',{request_id:'cli-auto-request',incident_id:'0123456789abcdef01234567',
|
ctx.emit('dx/diagnose-request',{request_id:'cli-auto-request',incident_id:'0123456789abcdef01234567',
|
||||||
phase:'diagnose',snapshot,evidence:JSON.stringify(snapshot)});
|
phase:'diagnose',snapshot,evidence:JSON.stringify(snapshot)});
|
||||||
@@ -38,7 +65,7 @@ try{
|
|||||||
const previousParent=process.env.DX_DSH_PARENT_PIPE;
|
const previousParent=process.env.DX_DSH_PARENT_PIPE;
|
||||||
process.env.DX_DSH_PARENT_PIPE='1';
|
process.env.DX_DSH_PARENT_PIPE='1';
|
||||||
try{
|
try{
|
||||||
const denial=await ctx.tools.execute({callId:'automatic-creation-denial',name:'dx_task_create',
|
const denial=await executeTool(ctx, {callId:'automatic-creation-denial',name:'dx_task_create',
|
||||||
arguments:{name:'Must never open a dialog'},agent:ctx.agents.get(sessionId),signal:AbortSignal.timeout(1500)});
|
arguments:{name:'Must never open a dialog'},agent:ctx.agents.get(sessionId),signal:AbortSignal.timeout(1500)});
|
||||||
assert.equal(denial.isError,true);
|
assert.equal(denial.isError,true);
|
||||||
assert.equal(creationBodyRan,false,'Automatic incident must be denied before desktop request emission');
|
assert.equal(creationBodyRan,false,'Automatic incident must be denied before desktop request emission');
|
||||||
@@ -48,7 +75,7 @@ try{
|
|||||||
['dx_task_execute',{operation:'start',task_ids:['auto-failure-fixture']}],
|
['dx_task_execute',{operation:'start',task_ids:['auto-failure-fixture']}],
|
||||||
['dx_task_operations',{operation:'history'}],
|
['dx_task_operations',{operation:'history'}],
|
||||||
]){
|
]){
|
||||||
const result=await ctx.tools.execute({callId:'automatic-denial-'+name,name,arguments:args,
|
const result=await executeTool(ctx, {callId:'automatic-denial-'+name,name,arguments:args,
|
||||||
agent:ctx.agents.get(sessionId),signal:AbortSignal.timeout(1500)});
|
agent:ctx.agents.get(sessionId),signal:AbortSignal.timeout(1500)});
|
||||||
assert.equal(result.isError,true);
|
assert.equal(result.isError,true);
|
||||||
assert.equal(creationBodyRan,false);
|
assert.equal(creationBodyRan,false);
|
||||||
@@ -65,7 +92,7 @@ try{
|
|||||||
assert.ok(!text.includes('different-current-task'));
|
assert.ok(!text.includes('different-current-task'));
|
||||||
const report={status:'passed',session_id:value.session_id,reply:value.reply,
|
const report={status:'passed',session_id:value.session_id,reply:value.reply,
|
||||||
incidentBoundSnapshot:true,automaticTaskCreationDenied:true,toolResults:tools};
|
incidentBoundSnapshot:true,automaticTaskCreationDenied:true,toolResults:tools};
|
||||||
await writeFile(path.join(output,'report.json'),JSON.stringify(report,null,2));
|
await writeFile(path.join(fixture,'report.json'),JSON.stringify(report,null,2));
|
||||||
original(JSON.stringify(report)+'\n');
|
original(JSON.stringify(report)+'\n');
|
||||||
}finally{
|
}finally{
|
||||||
clearTimeout(timer);
|
clearTimeout(timer);
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
/** Exercise actual Harness file tools against owned folders and ZIP archives. */
|
/** Exercise actual Harness file tools against owned folders and ZIP archives. */
|
||||||
|
import {executeTool} from './dsh_tool_probe.mjs';
|
||||||
import assert from 'node:assert/strict';
|
import assert from 'node:assert/strict';
|
||||||
import {mkdir,mkdtemp,writeFile,readFile,readdir} from 'node:fs/promises';
|
import {mkdir,mkdtemp,writeFile,readFile,readdir} from 'node:fs/promises';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
@@ -24,7 +25,7 @@ try{
|
|||||||
const names=ctx.tools.schemas(agent).map(x=>x.name);
|
const names=ctx.tools.schemas(agent).map(x=>x.name);
|
||||||
for(const name of ['read','read_image','write','edit','glob','grep','working_directory','extract_zip'])
|
for(const name of ['read','read_image','write','edit','glob','grep','working_directory','extract_zip'])
|
||||||
assert.ok(names.includes(name),'Missing file capability: '+name);
|
assert.ok(names.includes(name),'Missing file capability: '+name);
|
||||||
const call=async(name,args)=>ctx.tools.execute({name,arguments:args,callId:crypto.randomUUID(),agent,signal:AbortSignal.timeout(20000)});
|
const call=async(name,args)=>executeTool(ctx, {name,arguments:args,callId:crypto.randomUUID(),agent,signal:AbortSignal.timeout(20000)});
|
||||||
const ok=async(name,args)=>{
|
const ok=async(name,args)=>{
|
||||||
const result=await call(name,args);assert.equal(result.isError,false,name+': '+JSON.stringify(result));return result;
|
const result=await call(name,args);assert.equal(result.isError,false,name+': '+JSON.stringify(result));return result;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
/** Real Harness, two processes: automatic diagnosis must stay isolated after restart. */
|
/** Real Harness, two processes: automatic diagnosis must stay isolated after restart. */
|
||||||
|
import {executeTool} from './dsh_tool_probe.mjs';
|
||||||
import assert from 'node:assert/strict';
|
import assert from 'node:assert/strict';
|
||||||
import {mkdir,mkdtemp,writeFile,readFile,unlink,symlink} from 'node:fs/promises';
|
import {mkdir,mkdtemp,writeFile,readFile,unlink,symlink} from 'node:fs/promises';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
@@ -96,7 +97,7 @@ if(!phase){
|
|||||||
const resumed=await ctx.sessionController.resolveAgent(sessionId);
|
const resumed=await ctx.sessionController.resolveAgent(sessionId);
|
||||||
assert.ok(resumed.agent,JSON.stringify(resumed.error));
|
assert.ok(resumed.agent,JSON.stringify(resumed.error));
|
||||||
const agent=resumed.agent;
|
const agent=resumed.agent;
|
||||||
const call=(owner,name,args={})=>ctx.tools.execute({name,arguments:args,callId:crypto.randomUUID(),agent:owner,signal:AbortSignal.timeout(5000)});
|
const call=(owner,name,args={})=>executeTool(ctx, {name,arguments:args,callId:crypto.randomUUID(),agent:owner,signal:AbortSignal.timeout(5000)});
|
||||||
const snapshot=await call(agent,'dx_task_snapshot');
|
const snapshot=await call(agent,'dx_task_snapshot');
|
||||||
assert.equal(snapshot.isError,false,JSON.stringify(snapshot));
|
assert.equal(snapshot.isError,false,JSON.stringify(snapshot));
|
||||||
assert.equal(snapshot.value.task_id,'incident-original','historical diagnosis must not read the current task');
|
assert.equal(snapshot.value.task_id,'incident-original','historical diagnosis must not read the current task');
|
||||||
|
|||||||
@@ -12,8 +12,9 @@ export async function verifyModelSettings(c, output) {
|
|||||||
});
|
});
|
||||||
await new Promise(resolve=>server.listen(0,'127.0.0.1',resolve));
|
await new Promise(resolve=>server.listen(0,'127.0.0.1',resolve));
|
||||||
const endpoint=`http://127.0.0.1:${server.address().port}/v1`;
|
const endpoint=`http://127.0.0.1:${server.address().port}/v1`;
|
||||||
const visible=selector=>`[...document.querySelectorAll(${JSON.stringify(selector)})].find(e=>e.getBoundingClientRect().width>0)`;
|
const rendered=`e.getBoundingClientRect().width>0&&!e.closest('details:not([open])')`;
|
||||||
const button=text=>`[...document.querySelectorAll('button')].find(e=>e.getBoundingClientRect().width>0&&e.textContent.trim()===${JSON.stringify(text)})`;
|
const visible=selector=>`[...document.querySelectorAll(${JSON.stringify(selector)})].find(e=>${rendered})`;
|
||||||
|
const button=text=>`[...document.querySelectorAll('button')].find(e=>${rendered}&&e.textContent.trim()===${JSON.stringify(text)})`;
|
||||||
async function wait(expression){
|
async function wait(expression){
|
||||||
const end=Date.now()+20000;
|
const end=Date.now()+20000;
|
||||||
while(Date.now()<end){if(await c.evaluate(expression))return;await new Promise(r=>setTimeout(r,100));}
|
while(Date.now()<end){if(await c.evaluate(expression))return;await new Promise(r=>setTimeout(r,100));}
|
||||||
@@ -49,7 +50,7 @@ export async function verifyModelSettings(c, output) {
|
|||||||
const candidate=`[...document.querySelectorAll('[role="dialog"] label')].find(e=>e.textContent.includes('issue16-fixture-model'))?.querySelector('input[type="checkbox"]')`;
|
const candidate=`[...document.querySelectorAll('[role="dialog"] label')].find(e=>e.textContent.includes('issue16-fixture-model'))?.querySelector('input[type="checkbox"]')`;
|
||||||
if(!await c.evaluate(`(${candidate})?.checked`))await c.click(candidate);
|
if(!await c.evaluate(`(${candidate})?.checked`))await c.click(candidate);
|
||||||
assert.equal(await c.evaluate(`(${candidate})?.checked`),true);
|
assert.equal(await c.evaluate(`(${candidate})?.checked`),true);
|
||||||
await c.click(button('添加所选'));
|
await c.click(button('更新列表'));
|
||||||
await wait(`!![...document.querySelectorAll('input')].find(x=>x.value==='issue16-fixture-model')`);
|
await wait(`!![...document.querySelectorAll('input')].find(x=>x.value==='issue16-fixture-model')`);
|
||||||
await c.screenshot(path.join(output,'custom-model-discovery.png'));
|
await c.screenshot(path.join(output,'custom-model-discovery.png'));
|
||||||
await c.click(button('创建提供商'));
|
await c.click(button('创建提供商'));
|
||||||
@@ -58,7 +59,7 @@ export async function verifyModelSettings(c, output) {
|
|||||||
// Reopen the real editor to read committed fields, not the submitted draft.
|
// Reopen the real editor to read committed fields, not the submitted draft.
|
||||||
await c.click(`[...document.querySelectorAll('li')].find(e=>e.textContent.includes('issue16-fixture'))?.querySelector('button')`);
|
await c.click(`[...document.querySelectorAll('li')].find(e=>e.textContent.includes('issue16-fixture'))?.querySelector('button')`);
|
||||||
await wait(`document.body.innerText.includes('自定义设置')`);
|
await wait(`document.body.innerText.includes('自定义设置')`);
|
||||||
await c.click(`[...document.querySelectorAll('summary')].find(e=>e.textContent.includes('自定义设置'))`);
|
await c.click(`[...document.querySelectorAll('summary')].find(e=>e.textContent.includes('自定义设置')&&e.closest('details').querySelector('input[aria-label="API 地址"]')?.value===${JSON.stringify(endpoint)})`);
|
||||||
await wait(`!![...document.querySelectorAll('input')].find(x=>x.value==='issue16-fixture-model')`);
|
await wait(`!![...document.querySelectorAll('input')].find(x=>x.value==='issue16-fixture-model')`);
|
||||||
await c.screenshot(path.join(output,'custom-model-persisted.png'));
|
await c.screenshot(path.join(output,'custom-model-persisted.png'));
|
||||||
return {status:'passed',provider:'issue16-fixture',model:'issue16-fixture-model',requests,
|
return {status:'passed',provider:'issue16-fixture',model:'issue16-fixture-model',requests,
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
/** Compare the embedded assistant with the installed official Standard preset. */
|
/** Compare the embedded assistant with the installed official Standard preset. */
|
||||||
|
import {executeTool} from './dsh_tool_probe.mjs';
|
||||||
import assert from 'node:assert/strict';
|
import assert from 'node:assert/strict';
|
||||||
import {mkdir,mkdtemp,writeFile,readFile} from 'node:fs/promises';
|
import {mkdir,mkdtemp,writeFile,readFile} from 'node:fs/promises';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
@@ -29,7 +30,7 @@ try{
|
|||||||
assert.deepEqual(names(embedded),names(native),'Existing dx-task sessions must retain the full native tool catalog');
|
assert.deepEqual(names(embedded),names(native),'Existing dx-task sessions must retain the full native tool catalog');
|
||||||
for(const tool of ['read','write','edit','pwsh','get_goal','create_goal','update_goal','todo_write','subagent'])
|
for(const tool of ['read','write','edit','pwsh','get_goal','create_goal','update_goal','todo_write','subagent'])
|
||||||
assert.ok(names(embedded).includes(tool),'Missing native capability: '+tool);
|
assert.ok(names(embedded).includes(tool),'Missing native capability: '+tool);
|
||||||
const call=(name,args)=>ctx.tools.execute({name,arguments:args,callId:crypto.randomUUID(),agent:embedded,signal:AbortSignal.timeout(20000)});
|
const call=(name,args)=>executeTool(ctx, {name,arguments:args,callId:crypto.randomUUID(),agent:embedded,signal:AbortSignal.timeout(20000)});
|
||||||
const filename=path.join(process.env.DX_DSH_WORKSPACE,'native-write.txt');
|
const filename=path.join(process.env.DX_DSH_WORKSPACE,'native-write.txt');
|
||||||
const written=await call('write',{file_path:filename,content:'native file operations'});
|
const written=await call('write',{file_path:filename,content:'native file operations'});
|
||||||
assert.equal(written.isError,false,JSON.stringify(written));
|
assert.equal(written.isError,false,JSON.stringify(written));
|
||||||
|
|||||||
@@ -1,20 +1,26 @@
|
|||||||
/** Exercise the real official runtime and policy pipeline without CAD or a model. */
|
/** Exercise the real official runtime and policy pipeline without CAD or a model. */
|
||||||
|
import {executeTool} from './dsh_tool_probe.mjs';
|
||||||
import assert from 'node:assert/strict';
|
import assert from 'node:assert/strict';
|
||||||
import {mkdir,writeFile} from 'node:fs/promises';
|
import {mkdir,writeFile} from 'node:fs/promises';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import {fileURLToPath,pathToFileURL} from 'node:url';
|
import {fileURLToPath,pathToFileURL} from 'node:url';
|
||||||
import {createRequire} from 'node:module';
|
import {createRequire} from 'node:module';
|
||||||
import {bootRuntime,TASK_TOOLS} from '../integration/dsh/start.mjs';
|
|
||||||
|
|
||||||
const repo=path.resolve(path.dirname(fileURLToPath(import.meta.url)),'..');
|
const repo=path.resolve(path.dirname(fileURLToPath(import.meta.url)),'..');
|
||||||
const output=path.join(repo,'build/dsh-native-cli-verification');
|
const runtime=path.resolve(process.argv[2]??path.join(repo,'integration/dsh'));
|
||||||
|
const {bootRuntime,TASK_TOOLS,VERSION}=await import(pathToFileURL(path.join(runtime,'start.mjs')).href);
|
||||||
|
const output=path.resolve(process.argv[3]??path.join(repo,'build/dsh-native-cli-verification'));
|
||||||
await mkdir(output,{recursive:true});
|
await mkdir(output,{recursive:true});
|
||||||
|
delete process.env.DX_DSH_PARENT_PIPE;
|
||||||
|
if(process.argv[2]){
|
||||||
|
for(const key of ['DSH_API_KEY','DSH_API_BASE','DSH_MODEL','DX_DSH_MODELS','DSH_PERMISSION_MODE'])delete process.env[key];
|
||||||
|
}
|
||||||
process.env.DX_DSH_HOME=path.join(output,'home');
|
process.env.DX_DSH_HOME=path.join(output,'home');
|
||||||
process.env.DX_DSH_CONTEXT_FILE=path.join(output,'context.json');
|
process.env.DX_DSH_CONTEXT_FILE=path.join(output,'context.json');
|
||||||
await writeFile(process.env.DX_DSH_CONTEXT_FILE,JSON.stringify({task_id:'cli-verification',status:'paused',
|
await writeFile(process.env.DX_DSH_CONTEXT_FILE,JSON.stringify({task_id:'cli-verification',status:'paused',
|
||||||
revision:'cli-revision',rules_count:2,progress:{},issue:'',issue_code:'',events:[]}));
|
revision:'cli-revision',rules_count:2,progress:{},issue:'',issue_code:'',events:[]}));
|
||||||
const {ctx,shutdown}=await bootRuntime({announce:false});
|
const {ctx,shutdown}=await bootRuntime({announce:false});
|
||||||
const report={};
|
const report={version:VERSION};
|
||||||
try {
|
try {
|
||||||
const schemas=ctx.tools.schemas();
|
const schemas=ctx.tools.schemas();
|
||||||
report.tools=schemas.map(x=>x.name);
|
report.tools=schemas.map(x=>x.name);
|
||||||
@@ -26,10 +32,10 @@ try {
|
|||||||
report.configuredModels=(await ctx.llm.listModels('dx')).map(model=>model.id);
|
report.configuredModels=(await ctx.llm.listModels('dx')).map(model=>model.id);
|
||||||
assert.ok(report.configuredModels.includes(process.env.DSH_MODEL));
|
assert.ok(report.configuredModels.includes(process.env.DSH_MODEL));
|
||||||
}
|
}
|
||||||
const snapshot=await ctx.tools.execute({callId:'verify-read',name:'dx_task_snapshot',arguments:{},signal:new AbortController().signal});
|
const snapshot=await executeTool(ctx, {callId:'verify-read',name:'dx_task_snapshot',arguments:{},signal:new AbortController().signal});
|
||||||
assert.equal(snapshot.isError,false,JSON.stringify(snapshot));
|
assert.equal(snapshot.isError,false,JSON.stringify(snapshot));
|
||||||
report.snapshotRead=true;
|
report.snapshotRead=true;
|
||||||
const desktopOnly=await ctx.tools.execute({callId:'verify-desktop-only',name:'dx_task_create',arguments:{name:'CLI must not mutate'},signal:new AbortController().signal});
|
const desktopOnly=await executeTool(ctx, {callId:'verify-desktop-only',name:'dx_task_create',arguments:{name:'CLI must not mutate'},signal:new AbortController().signal});
|
||||||
assert.equal(desktopOnly.isError,true);
|
assert.equal(desktopOnly.isError,true);
|
||||||
report.creationRequiresDesktopConfirmation=true;
|
report.creationRequiresDesktopConfirmation=true;
|
||||||
for(const [name,args] of [
|
for(const [name,args] of [
|
||||||
@@ -38,16 +44,16 @@ try {
|
|||||||
['dx_task_execute',{operation:'start',task_ids:['fixture']}],
|
['dx_task_execute',{operation:'start',task_ids:['fixture']}],
|
||||||
['dx_task_operations',{operation:'history'}],
|
['dx_task_operations',{operation:'history'}],
|
||||||
]){
|
]){
|
||||||
const result=await ctx.tools.execute({callId:'desktop-only-'+name,name,arguments:args,signal:AbortSignal.timeout(2000)});
|
const result=await executeTool(ctx, {callId:'desktop-only-'+name,name,arguments:args,signal:AbortSignal.timeout(2000)});
|
||||||
assert.equal(result.isError,true,name+' requires parent desktop');
|
assert.equal(result.isError,true,name+' requires parent desktop');
|
||||||
}
|
}
|
||||||
report.lifecycleRequiresDesktop=true;
|
report.lifecycleRequiresDesktop=true;
|
||||||
const require=createRequire(path.join(repo,'integration/dsh/package.json'));
|
const require=createRequire(path.join(runtime,'package.json'));
|
||||||
const {defineTool}=await import(pathToFileURL(require.resolve('@deepseek-ai/dsh-tools')).href);
|
const {defineTool}=await import(pathToFileURL(require.resolve('@deepseek-ai/dsh-tools')).href);
|
||||||
let bodyRan=false;
|
let bodyRan=false;
|
||||||
const release=ctx.tools.register(defineTool({name:'forbidden_probe',description:'Never executes',parameters:{},
|
const release=ctx.tools.register(defineTool({name:'forbidden_probe',description:'Never executes',parameters:{},
|
||||||
output:{schema:{type:'boolean'},render:()=>[{type:'text',text:'probe'}]},execute:async()=>{bodyRan=true;return true;}}));
|
output:{schema:{type:'boolean'},render:()=>[{type:'text',text:'probe'}]},execute:async()=>{bodyRan=true;return true;}}));
|
||||||
const extension=await ctx.tools.execute({callId:'verify-extension',name:'forbidden_probe',arguments:{},signal:new AbortController().signal});
|
const extension=await executeTool(ctx, {callId:'verify-extension',name:'forbidden_probe',arguments:{},signal:new AbortController().signal});
|
||||||
release();
|
release();
|
||||||
assert.equal(extension.isError,false);
|
assert.equal(extension.isError,false);
|
||||||
assert.equal(bodyRan,true);
|
assert.equal(bodyRan,true);
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
/** PR18 #197: no silently omitted names, bounded workers, real cancellation. */
|
/** PR18 #197: no silently omitted names, bounded workers, real cancellation. */
|
||||||
|
import {executeTool} from './dsh_tool_probe.mjs';
|
||||||
import assert from 'node:assert/strict';
|
import assert from 'node:assert/strict';
|
||||||
import {mkdir,mkdtemp,writeFile,readdir,readFile} from 'node:fs/promises';
|
import {mkdir,mkdtemp,writeFile,readdir,readFile} from 'node:fs/promises';
|
||||||
import {spawnSync} from 'node:child_process';
|
import {spawnSync} from 'node:child_process';
|
||||||
@@ -25,7 +26,7 @@ process.env.DX_DSH_HOME=path.join(root,'home');process.env.DX_DSH_CONTEXT_FILE=p
|
|||||||
await writeFile(process.env.DX_DSH_CONTEXT_FILE,'{"task_id":"zip-review","revision":"zip-review","status":"observe"}');
|
await writeFile(process.env.DX_DSH_CONTEXT_FILE,'{"task_id":"zip-review","revision":"zip-review","status":"observe"}');
|
||||||
const {ctx,shutdown}=await bootRuntime({announce:false});
|
const {ctx,shutdown}=await bootRuntime({announce:false});
|
||||||
try{
|
try{
|
||||||
const call=(file,signal=AbortSignal.timeout(30000))=>ctx.tools.execute({name:'extract_zip',
|
const call=(file,signal=AbortSignal.timeout(30000))=>executeTool(ctx, {name:'extract_zip',
|
||||||
arguments:{file_path:path.join(root,file),output_directory:root},callId:crypto.randomUUID(),signal});
|
arguments:{file_path:path.join(root,file),output_directory:root},callId:crypto.randomUUID(),signal});
|
||||||
const before=await readdir(root);
|
const before=await readdir(root);
|
||||||
for(const file of ['proto.zip','proto-bad.zip']){
|
for(const file of ['proto.zip','proto-bad.zip']){
|
||||||
|
|||||||
Reference in new issue
Block a user