npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

cortico-world-clock-alont1

v0.1.1

Published

现在几点 World:把钟点和时段交给她——一天里的时间线索本来只有消息自带的时间戳,久没人说话就断了

Readme

cortico-world-clock-alont1

现在几点 World:把钟点和时段交给她 —— 她问就现算,跨过时段边界时按配置主动说一句。

为什么需要它

没有它的时候,她上下文里的时间只有两处来源,而两处都会断:

  • 消息自带的时间戳([群 10:56] 这种,各 World 自己写的)。一下午没人说话, 她看到的最后一个时间就是几小时前的,只好拿它当"现在"。
  • 系统前缀。前缀是请求的一部分、会被缓存,只在会话交接时重建 —— 实测两次重建之间 能隔两个多小时。往里放时间,它就一直僵在那儿。

所以这个 World 走的是另外两条路:

| 通道 | 什么时候 | 准不准 | |---|---|---| | clock_now 工具 | 她问的时候 | 现算,准的 | | 时段变化的通知 | 跨过时段边界时(哪些时段看 announce) | 那一刻的,准的 | | 环境提示词里那一行 | 前缀重建时 | 会过期,模板里写明了让她别当准的用 |

装

控制台「扩展」页搜 cortico-world,或者:

cd extensions
corepack pnpm add --ignore-workspace cortico-world-clock-alont1

--ignore-workspace 不能省。装完重启进程,World 定义在启动时读取。

开

部署的 config.json:

{
  "worlds": {
    "clock": {
      "enabled": true,
      "announce": "quiet-hours"
    }
  }
}

开着她就能回答"现在几点""今天还剩多久"。announce 决定她会不会自己开口: 默认 quiet-hours,只在清晨和深夜各说一句;改成 all 则每个时段变化都说,一天七八次。

时段是这么分的

| 时段 | 起点 | 通常意味着 | |---|---|---| | 深夜 | 23:00 | 该睡了 | | 凌晨 | 01:00 | 人通常已经睡了;还没睡就是熬过头了 | | 清晨 | 05:00 | 天刚亮,多数人还在睡 | | 上午 | 08:00 | 白天的正事时间,人可能不在 | | 中午 | 11:00 | 饭点 | | 下午 | 13:00 | 白天的正事时间,人可能不在 | | 傍晚 | 17:00 | 收工前后 | | 晚上 | 19:00 | 一天里最闲的一段,人通常在 |

时段只是钟点的说法,不替你决定做什么。 环境提示词里明确写了这一点 —— 该说话还是该沉默,由人格自己的性子决定。

它给什么

| 工具 | 干什么 | |---|---| | clock_now | 现在几点、几号、星期几、哪个时段、今天还剩多久 |

加上一段进系统前缀的环境提示词(时段表 + 当前时段),以及时段变化时的一条事件。

配置

| 旋钮 | 默认 | 说明 | |---|---|---| | announce | quiet-hours | 主动报时的时机。off 不主动说;quiet-hours 只在清晨和深夜;all 每个时段都说 | | announceGapMinutes | 30 | 两次主动之间至少隔多久。重启或校时可能让同一个时段被连报两次 |

默认为什么是 quiet-hours:主动开口要克制,这是"不设置就不吵"的一档。 但它只覆盖一天的头尾两个点;要让她对整天都有节律感(下午知道是下午、傍晚知道收工了), 改成 all。两种都只是"说不说",不影响 clock_now 和前缀里那份时段表。

排错

她还是会说错时间 检查部署的 timezone 对不对(默认 Asia/Shanghai)。这个 World 全部按时区算, 不看服务器本机时区。

她从来不主动报时 先看 announce 是不是 off。控制台「现在几点」那页有一盏「主动报时」灯, 写着当前是哪一档。

报时的时刻不对 clock_now 是现算的,一定对;环境提示词里那一行是前缀重建那一刻的,会过期。 如果她引用了过期的那行,说明她没去调 clock_now —— 模板里已经提醒过了。

开发

corepack pnpm install
corepack pnpm typecheck
node --import tsx tests/clock-test.mjs

clock-test.mjs 只测纯逻辑(时段判定、排版),不需要框架。world-announce-test.mjs 驱动真实的 ClockWorld 验"时段变化推事件"那条路,得在框架根目录下跑,靠框架的解析钩子 把 cortico/core/* 映射到 src/:

node --import tsx --import ./src/extensions/runtime.ts \
  <这份包>/tests/world-announce-test.mjs

它读真实系统时钟、不改系统时间,断言跟着"现在落在哪个时段"走,任何时刻跑都成立。

"type": "module" 是硬要求。契约版本 cortico.api 是 5(world 这一类)。

许可

MIT