@danny_lei/dsh-current-date-weekday
v1.0.0
Published
Query today's date and day of the week as a model-callable tool
Readme
@danny_lei/dsh-current-date-weekday
一个 Host-only 的 DSH 插件(组合包 bundle),安装后为模型注册 current-date-weekday
工具,用于查询「今天是几月几号、星期几」。走 DSH 的 profile bundle 机制,重启后仍然存在。
- 查询内容:年月日、星期(中英文)、ISO 时间、IANA 时区,以及一句摘要。
- 时间来源:Host 进程的本地时区(
new Date()+Intl),返回纯 JSON。
安装
dsh plugin --profile <name> add @danny_lei/dsh-current-date-weekdaydsh plugin 是 pnpm 转发器,会把本包写入 profile 的 dependencies 并依据
dsh.bundle.patch 写进 dsh.profile.bundles。也可以直接在 profile 的
cordis.patch.yml 里手工插入:
- insert:
- id: date-weekday
name: '@danny_lei/dsh-current-date-weekday'重启 dsh,模型工具列表里就会出现 current-date-weekday。
从源码构建
pnpm install
pnpm run build # tsc 产出 lib/index.js 与 lib/index.d.ts发布
npm publish --access public # prepublishOnly 会先自动构建目录结构
src/index.ts # 插件本体:注册 current-date-weekday 工具
cordis.patch.yml # bundle patch:插入该插件这一行
tsconfig.json # 类型检查 + 转译(输出到 lib/)验证
构建成功后,让模型调用一次 current-date-weekday,期望返回类似:
{
"year": 2026,
"month": "09",
"day": "25",
"date": "2026-09-25",
"weekday": 5,
"weekdayEn": "Friday",
"weekdayZh": "星期五",
"iso": "2026-09-25T12:34:56.789Z",
"timezone": "Asia/Shanghai",
"friendly": "今天是 2026年9月25日,星期五"
}局限
- 本包是 Host-only(只有模型工具
current-date-weekday),没有浏览器小部件。 - 时间取 Host 本地时区,不区分远程用户时区。
