diff --git a/.DS_Store b/.DS_Store index 4516de1..de1f640 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/modules/file_manager.py b/modules/file_manager.py index c4fd612..1b14e8d 100644 --- a/modules/file_manager.py +++ b/modules/file_manager.py @@ -158,8 +158,8 @@ class FileManager: if full_path.parent == self.project_path: return { "success": False, - "error": "禁止在项目根目录直接创建文件,请先创建或选择子目录(例如 ./data 或 ./docs)。", - "suggestion": "请先创建文件夹,再在该文件夹中创建新文件。" + "error": "禁止在项目根目录直接创建文件,请先创建或选择合适的子目录。", + "suggestion": "然后必须**重新**再次创建文件。" } if self._use_container(): result = self._container_call("create_file", { diff --git a/static/src/app.ts b/static/src/app.ts index 1929628..f5633fb 100644 --- a/static/src/app.ts +++ b/static/src/app.ts @@ -195,9 +195,10 @@ const appOptions = { this.$nextTick(() => { this.autoResizeInput(); }); - this.resourceStartContainerStatsPolling(); - this.resourceStartProjectStoragePolling(); - this.resourceStartUsageQuotaPolling(); + this.resourceBindContainerVisibilityWatcher(); + this.resourceStartContainerStatsPolling(); + this.resourceStartProjectStoragePolling(); + this.resourceStartUsageQuotaPolling(); }, computed: { @@ -563,6 +564,7 @@ const appOptions = { resourceStartUsageQuotaPolling: 'startUsageQuotaPolling', resourceStopUsageQuotaPolling: 'stopUsageQuotaPolling', resourcePollContainerStats: 'pollContainerStats', + resourceBindContainerVisibilityWatcher: 'bindContainerVisibilityWatcher', resourcePollProjectStorage: 'pollProjectStorage', resourceFetchUsageQuota: 'fetchUsageQuota', resourceResetTokenStatistics: 'resetTokenStatistics', diff --git a/static/src/components/chat/VirtualMonitorSurface.vue b/static/src/components/chat/VirtualMonitorSurface.vue index 319f05a..b4ef8da 100644 --- a/static/src/components/chat/VirtualMonitorSurface.vue +++ b/static/src/components/chat/VirtualMonitorSurface.vue @@ -188,6 +188,7 @@
+
diff --git a/static/src/stores/resource.ts b/static/src/stores/resource.ts index fec38ca..4339cf4 100644 --- a/static/src/stores/resource.ts +++ b/static/src/stores/resource.ts @@ -75,6 +75,7 @@ export const useResourceStore = defineStore('resource', { down_bps: null, up_bps: null } as ContainerNetRate, + containerVisibilityBound: false, lastContainerSample: null as ContainerSample | null, containerStatsInFlight: false, containerStatsFailCount: 0, @@ -271,6 +272,22 @@ export const useResourceStore = defineStore('resource', { this.pollContainerStats(); }, this.containerStatsIntervalMs); }, + bindContainerVisibilityWatcher() { + if (this.containerVisibilityBound || typeof document === 'undefined') { + return; + } + const handler = () => { + if (document.hidden) { + this.stopContainerStatsPolling(); + } else { + this.containerStatsFailCount = 0; + this.containerStatsIntervalMs = 500; + this.startContainerStatsPolling(); + } + }; + document.addEventListener('visibilitychange', handler); + this.containerVisibilityBound = true; + }, async pollProjectStorage() { if (this.projectStorageInFlight) { return; diff --git a/sub_agent/core/main_terminal.py b/sub_agent/core/main_terminal.py index 1a02f2e..738174c 100644 --- a/sub_agent/core/main_terminal.py +++ b/sub_agent/core/main_terminal.py @@ -1149,7 +1149,7 @@ class MainTerminal: "type": "function", "function": { "name": "terminal_input", - "description": "向活动终端发送命令或输入。禁止启动会占用终端界面的程序(python/node/nano/vim 等);如遇卡死请结合 terminal_snapshot 并使用 terminal_reset 恢复。", + "description": "向活动终端发送命令或输入。禁止启动会占用终端界面的程序(python/node/nano/vim 等);如遇卡死请结合 terminal_snapshot 并使用 terminal_reset 恢复。默认等待输出120秒,最长300秒,超时会尝试中断并返回已捕获输出。", "parameters": { "type": "object", "properties": { @@ -1167,7 +1167,7 @@ class MainTerminal: }, "timeout": { "type": "number", - "description": "等待输出的最长秒数,默认使用配置项 TERMINAL_OUTPUT_WAIT" + "description": "等待输出的最长秒数,默认120,最大300" } }, "required": ["command"] @@ -1292,11 +1292,15 @@ class MainTerminal: "type": "function", "function": { "name": "run_python", - "description": "执行一次性 Python 脚本,可用于处理二进制或非 UTF-8 文件(如 Excel、Word、PDF、图片),或进行数据分析与验证。请在脚本内显式读取文件并输出结果,避免长时间阻塞。", + "description": "执行一次性 Python 脚本,可用于处理二进制或非 UTF-8 文件(如 Excel、Word、PDF、图片),或进行数据分析与验证。默认超时20秒,最长60秒;超时会尝试中断并返回已捕获输出。", "parameters": { "type": "object", "properties": { - "code": {"type": "string", "description": "Python代码"} + "code": {"type": "string", "description": "Python代码"}, + "timeout": { + "type": "number", + "description": "超时时长(秒),默认20,最大60" + } }, "required": ["code"] } @@ -1306,11 +1310,15 @@ class MainTerminal: "type": "function", "function": { "name": "run_command", - "description": "执行一次性终端命令,适合查看文件信息(file/ls/stat/iconv 等)、转换编码或调用 CLI 工具。禁止启动交互式程序;对已聚焦文件仅允许使用 grep -n 等定位命令。输出超过10000字符将被拒绝,可先限制返回体量。", + "description": "执行一次性终端命令,适合查看文件信息(file/ls/stat/iconv 等)、转换编码或调用 CLI 工具。禁止启动交互式程序;对已聚焦文件仅允许使用 grep -n 等定位命令。默认超时10秒,最长30秒,超时会尝试中断并返回已捕获输出;输出超过10000字符将被截断或拒绝。", "parameters": { "type": "object", "properties": { - "command": {"type": "string", "description": "终端命令"} + "command": {"type": "string", "description": "终端命令"}, + "timeout": { + "type": "number", + "description": "超时时长(秒),默认10,最大30" + } }, "required": ["command"] } @@ -1963,7 +1971,7 @@ class MainTerminal: elif tool_name == "run_python": result = await self.terminal_ops.run_python_code(arguments["code"]) - + elif tool_name == "run_command": result = await self.terminal_ops.run_command(arguments["command"]) diff --git a/test/.DS_Store b/test/.DS_Store index 5008ddf..bd4d1cf 100644 Binary files a/test/.DS_Store and b/test/.DS_Store differ