omdsh-dev/dsh-tool-time
DSH 时间工具插件:严格 ISO 8601 解析、IANA 时区转换、UTC 日历运算、固定时长差,零依赖
Project Overview项目介绍
This is a native time utility plugin built exclusively for DeepSeek Harness (DSH). It provides strict ISO 8601 time parsing, IANA timezone conversion, UTC-based calendar arithmetic, and fixed duration difference calculation. As a zero-dependency, zero-extra-process pure function implementation, it eliminates common issues that plague alternative approaches: LLM calculation errors for timezone offsets, leap years, and daylight saving time boundaries, plus cross-platform inconsistencies with the system date command. You can install it directly via the DSH CLI for version 0.1.5-rc.1 and above with a single command.
The plugin supports four core actions: get current time, convert between timezones, add or subtract a fixed duration from a given time, and calculate the difference between two timestamps. All inputs undergo strict validation, which rejects unrecognized formats like natural language dates, invalid calendar dates such as February 30, and illegal timezone names, preventing silent processing errors. Output is standardized as structured JSON that includes the canonical ISO timestamp, Unix milliseconds timestamp, localized formatted string, and relevant timezone metadata.
The plugin is distributed as a DSH profile bundle, and can also be installed from a locally generated tarball file for offline use. It has been fully validated against DSH 0.1.5-rc.1, with 63 test cases covering core functionality, edge cases, and malicious inputs. It is released under the open source MIT license, with documented limitations including a supported input year range of 1000–9999, no support for natural language date parsing, and UTC-only calendar arithmetic for the current version.
这是一个面向 DeepSeek Harness(DSH)开发的原生时间工具插件,提供严格的ISO 8601时间解析、IANA时区转换、UTC日历运算和固定时长差计算功能。它是零依赖、零额外进程的纯函数实现,解决了LLM心算时区偏移、闰年夏时制边界容易出错,以及系统date命令跨平台语法不一致的问题。
插件支持四种核心操作:获取当前时间、时区转换、时间加减、计算固定时长差,对所有输入都做了严格安全校验,仅接受规范的ISO格式输入,拒绝非法日期和非标准格式,避免静默错误产生。所有运算基于UTC执行,月份日期会自动钳制到合法范围,输出包含结构化的ISO格式、Unix时间戳和本地化格式化展示。
插件兼容DSH 0.1.5-rc.1及以上版本,支持通过DSH的profile bundle命令直接从GitHub在线安装,也支持本地生成的tarball包离线安装。遵循MIT开源许可,共有63个测试用例覆盖各类功能和边界场景,输入年份限制在1000到9999之间,当前版本不支持自然语言日期解析。
请帮我安装这个 DSH 插件。安装前先完成【兼容性检查 + 安全性检查】,检查通过再动手。
插件:dsh-tool-time(omdsh-dev/dsh-tool-time)
仓库:https://github.com/omdsh-dev/dsh-tool-time
本站详情页:https://www.yhbd.top/plugins/omdsh-dev-dsh-tool-time/
本站登记:类型 plugin · 归类 原生 DSH 插件 · 许可证 MIT · ⭐ 4 · 最近提交 2026-09-10 · 主语言 TypeScript
按下面顺序执行,每步先把结论告诉我,再进入下一步:
【1 兼容性检查】
① 我这边:DSH 版本、Node 版本、操作系统、当前 profile(web / desktop)。
② 读它的 README、package.json、插件 manifest,列出它要求的 DSH 版本 / Node 版本 / 操作系统 / 外部依赖 / 需要另外先装的运行时。
③ 逐条比对,结论只写「满足 / 不满足 / 未知」三种;不满足的给出可行替代方案。
④ 检查是否和我已装的插件冲突:命令名重复、skill / tool 重名、端口占用、重复注册的 MCP server。
【2 安全性检查】
① 仓库可信度:和上面「本站登记」是否一致;star / fork 数、创建时间、最近提交,是否归档或长期停更。
② 安装脚本:逐行看 package.json 的 preinstall / install / postinstall,以及 install.sh、setup.ps1 之类脚本。出现 curl|bash、下载后直接执行、混淆代码、访问与插件功能无关的域名,立刻停下来告诉我,不要继续装。
③ 依赖:列出新增依赖,标出无人维护、或与知名包拼写近似的可疑包(typosquatting)。
④ 权限与副作用:它会读写哪些目录、访问哪些域名、需要哪些 DSH 权限(filesystem / network / shell / clipboard 等),以及怎么卸载和回滚。
⑤ 如果它要求 sudo / 管理员权限,或权限明显超出功能所需,先停下来问我。
【3 安装】
上面两步没有「不满足」和「高危项」时才执行;用官方推荐方式安装,不要自行提权。
【4 汇报】
用表格输出:检查项 / 结论 / 依据 / 是否需要我决策。拿不准的一律写「未知」并说明要我怎么确认——不要猜,也不要替我决定。
Send this message to DSH in your current session: it verifies compatibility and security first (answering met / not met / unknown item by item) and only installs once everything checks out — it will stop and ask you if it finds a high-risk item. The box scrolls; the copy is the full prompt. CLI install commands may not be accurate across systems, so DSH is the safer route.把上面这条消息直接发给当前会话里的 DSH:它会先核对兼容性与安全性(逐条给「满足 / 不满足 / 未知」),确认没问题再安装,有高危项会停下来问你。框内可滚动,复制到的是完整提示词;安装命令不一定准确,发给 DSH 更稳。
- Only 4 stars - very few users, little community feedback星标只有 4,几乎没人在用,遇到问题缺少社区反馈
DSH walks through these 9 checksDSH 会逐条核对这 9 项
Compatibility兼容性
- DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
- External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
- Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册
Security安全性
- Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
- Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
- curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
- Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
- Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
- Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式
Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。
Or use CLI install (for developers)或使用命令行安装(适合开发者)
CLI Install命令行安装
dsh plugin --profile web add github:omdsh-dev/dsh-tool-time
把 omdsh-dev/dsh-tool-time 加入你的 DSH 配置(web profile)即可启用。
READMEREADME
dsh-tool-time
DSH 时间工具插件 —— 严格 ISO 解析、IANA 时区转换、UTC 日历运算、固定时长差。零依赖、零进程、纯函数。
动机
Agent 处理时间信息是最高频需求之一——"现在几点"、"3 天后是几号"、"把 UTC 转成北京时间"。当前做法 bash date 的问题:每次起进程、跨平台语法不一致(macOS 与 GNU date -d 完全不同)、时区转换靠 TZ=... 手动拼。模型心算时区偏移和闰年/DST 边界是错误高发区。
安全模型
无 eval、无 new Function。输入只经过严格校验:
- 严格 ISO 8601 子集:仅接受
YYYY-MM-DD(UTC 零点)、YYYY-MM-DDTHH:mm:ssZ、YYYY-MM-DDTHH:mm:ss±HH:MM(±14:00 内,可选.SSS毫秒);不带时区的日期时间、RFC 2822、自然语言日期一律拒绝;2026-02-30等日历溢出由查表校验拒绝(不依赖 Date 的静默归一化) - 时区名:IANA 名交给
Intl.DateTimeFormat校验,非法即抛time: unknown timezone - 数值:
amount必须是安全整数;unit枚举白名单;所有字符串 ≤200 字符 - Intl 环境固定:
'en-CA'+hourCycle: 'h23'(避免午夜24:00与本地化数字)
架构
DSH Agent
│ ctx.tools.register()
▼
src/index.ts(Cordis 插件入口 + action 分发 + 独立校验)
│
▼
src/time.ts
├── parseStrictISO() — 严格 ISO 解析(正则 + 查表校验)
├── formatInTimezone() — Intl formatToParts 组装(时钟可注入)
├── addMonthsClamped() — 先置 1 日 → 目标年月 → 天数钳制
└── diffBetween() — 固定时长(sign + absolute 分解)
工具声明
ctx.tools.register(defineTool({
name: 'time',
parameters: {
action: { type: 'string', required: true, enum: ['now', 'convert', 'add', 'diff'] },
value: { type: 'string', description: 'Strict ISO 8601 timestamp' },
timezone: { type: 'string', description: 'IANA timezone (default UTC; display only)' },
from: { type: 'string', description: 'diff start' },
to: { type: 'string', description: 'diff end' },
amount: { type: 'integer', description: 'Signed safe integer' },
unit: { type: 'string', enum: ['seconds','minutes','hours','days','weeks','months','years'] },
},
output: { schema: { type: 'json' }, render: (_a, v) => [{ type: 'text', text: JSON.stringify(v, null, 2) }] },
execute: (args) => Promise.resolve(executeAction(args.action, args) as JsonValue),
timeoutMs: 1000,
}))
支持的操作
| action | 参数 | 返回 |
|---|---|---|
now |
timezone?(默认 UTC) |
当前时间结构化表示 |
convert |
value + timezone(必填) |
转换后的结构化时间 |
add |
value + amount + unit(timezone? 仅展示) |
加减后的结构化时间 |
diff |
from + to |
固定时长差(无月份/年份) |
Showing the opening section of the README — the full document lives in the repository以上为 README 开头摘要,完整文档在仓库内 · View the full README on GitHub →在 GitHub 查看完整 README →
Bin-hy/dsh
anweat/dsh-restart
Starfie1d1272/dsh-builtin-toggles
peiyucn/dsh-sparrow