mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-11 15:13:23 +08:00
重构仓库目录为统一的 runtime 分层并清理历史 openclaw 残留。
本次迁移将网关/通道/工具/技能/脚本与协议资源集中到新结构,统一路径常量与脚本转发机制,减少顶层噪音并保证运行与测试行为一致。 Made-with: Cursor
This commit is contained in:
parent
ba3836f00f
commit
4a23b715a2
498 changed files with 2760 additions and 2200 deletions
33
runtime/tools/experts/generalist/system_info.py
Normal file
33
runtime/tools/experts/generalist/system_info.py
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import datetime
|
||||
import time
|
||||
from typing import Any
|
||||
|
||||
from oclaw.runtime.tools.base import ToolSpec
|
||||
|
||||
|
||||
def system_info_tool() -> ToolSpec:
|
||||
def handler(args: dict[str, Any]) -> dict[str, Any]:
|
||||
now = datetime.datetime.now()
|
||||
utc_now = datetime.datetime.now(datetime.timezone.utc)
|
||||
timezone_name = time.tzname[0] if time.daylight == 0 else time.tzname[1]
|
||||
timezone_offset = (now - utc_now.replace(tzinfo=None)).total_seconds() / 3600
|
||||
return {
|
||||
"ok": True,
|
||||
"current_time": now.strftime("%Y-%m-%d %H:%M:%S"),
|
||||
"timezone": timezone_name,
|
||||
"timezone_offset": f"UTC{'+' if timezone_offset >= 0 else ''}{timezone_offset:g}",
|
||||
"timestamp": int(time.time()),
|
||||
}
|
||||
|
||||
return ToolSpec(
|
||||
name="get_system_time",
|
||||
description="Return the current local time, timezone name, and UTC offset.",
|
||||
parameters={"type": "object", "properties": {}, "additionalProperties": False},
|
||||
handler=handler,
|
||||
read_only=True,
|
||||
)
|
||||
|
||||
|
||||
__all__ = ["system_info_tool"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue