codex-work-receipt 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.7.0 - 2026-07-19
4
+
5
+ - 新增 Codex 原生桌宠“票仔 · AI 小票工”,提供夜班绿票风格的核心状态与左右移动动画,并支持通过 `--install-pet`、`--uninstall-pet` 和 `--install-companion` 安装管理。
6
+ - AI 打工小票 Skill 新增“票仔,开今天的票”等自然语言入口。
7
+ - 新增 `--hours <1-168>` 滚动小时统计;“最近几个小时”默认按最近 3 小时处理。
8
+ - 滚动小时小票使用兼容 cwr1 摘要,避免与 cwr2 的“会话 × 自然日”规范事实冲突。
9
+
10
+ ## 0.6.1
11
+
12
+ - 将 HTML 小票底部的重复渐变装饰替换为按小票编号生成的真实 Code 128 B 条形码,并保留适合浏览器和长图导出的静区与清晰度。
13
+ - 优化 multipart 扫码交互:单数据码继续与小程序码并排,多分片时先展示小程序码,再自动逐张轮播唯一可见的数据码,避免镜头同时识别多个二维码。
14
+
3
15
  ## 0.6.0
4
16
 
5
17
  - 新增 cwr2 协议:按“会话 × 记账自然日”生成稳定的 canonical facts,重叠的今日、近 7 日和本周小票可由接收端可靠去重。
package/README.en.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  <p align="center">
8
8
  <strong>Turn local Codex activity into a work receipt you can keep and share.</strong><br>
9
- One command · Local-first · Chinese & English · Three themes · Mobile QR import
9
+ One command · Local-first · Codex pet · Three themes · Mobile QR import
10
10
  </p>
11
11
 
12
12
  <p align="center">
@@ -22,11 +22,11 @@
22
22
 
23
23
  Codex Work Receipt summarizes turns, tool calls, Tokens, duration, and models, then turns them into playful AI work points, a job title, and a review. Receipts never include prompts, responses, source code, project paths, or file names.
24
24
 
25
- Version `0.6.0` uses the cwr2 protocol to create stable privacy-safe facts for each session and calendar day. Overlapping today, last-seven-days, and this-week receipts can be deduplicated by the receiver, and oversized payloads are automatically split into reorderable multipart QR codes.
25
+ Version `0.6.0` uses the cwr2 protocol to create stable privacy-safe facts for each session and calendar day. Overlapping today, last-seven-days, and this-week receipts can be deduplicated by the receiver, and oversized payloads are automatically split into reorderable multipart QR codes that rotate one at a time in the HTML so the camera never sees multiple data codes at once.
26
26
 
27
27
  ## Quickstart
28
28
 
29
- Requires Node.js 20+ and local Codex session records. No clone required; choose today, the last 7 days, this week, or a specific session:
29
+ Requires Node.js 20+ and local Codex session records. No clone required; choose today, the last 3 hours, the last 7 days, this week, or a specific session:
30
30
 
31
31
  ```bash
32
32
  npx codex-work-receipt@latest --lang en
@@ -38,11 +38,29 @@ Summarize all Codex activity from today:
38
38
  npx codex-work-receipt@latest --today --lang en
39
39
  ```
40
40
 
41
+ Summarize the last 3 hours:
42
+
43
+ ```bash
44
+ npx codex-work-receipt@latest --hours 3 --lang en
45
+ ```
46
+
41
47
  HTML and structured data are written to `./codex-work-receipt-output/` by default. The generated page can save a high-resolution PNG containing the full receipt and QR import stub. Non-interactive options such as `--latest` and `--today` remain available; see the [CLI guide](docs/cli.en.md).
42
48
 
43
49
  ## Ask Codex directly
44
50
 
45
- Install the AI Work Receipt skill once:
51
+ Install the AI Work Receipt skill and Ticket Buddy Codex pet together:
52
+
53
+ ```bash
54
+ npx codex-work-receipt@latest --install-companion --lang en
55
+ ```
56
+
57
+ Restart Codex, open `Settings > Pets`, select Refresh, choose “票仔 · AI 小票工” (Ticket Buddy), and use `/pet` to wake it. Then ask:
58
+
59
+ > Ticket Buddy, create today's receipt.
60
+
61
+ > Ticket Buddy, create a receipt for the last three hours.
62
+
63
+ To install only the skill:
46
64
 
47
65
  ```bash
48
66
  npx codex-work-receipt@latest --install-skill --lang en
@@ -62,6 +80,7 @@ The desktop page generates one or more privacy-safe data QR codes. The companion
62
80
 
63
81
  - [CLI usage and options](docs/cli.en.md)
64
82
  - [Codex Skill](docs/codex-skill.en.md)
83
+ - [Ticket Buddy Codex pet](docs/codex-pet.en.md)
65
84
  - [Mobile QR import](docs/mobile-import.en.md)
66
85
  - [Data schema and QR protocol](docs/data-schema.en.md)
67
86
  - [Local data and privacy](docs/privacy.en.md)
package/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  <p align="center">
8
8
  <strong>把本机 Codex 的工作记录,开成一张可以带走的 AI 打工小票。</strong><br>
9
- 一行命令 · 完全本地 · 中英双语 · 三种主题 · 扫码传到手机
9
+ 一行命令 · 完全本地 · Codex 桌宠 · 三种主题 · 扫码传到手机
10
10
  </p>
11
11
 
12
12
  <p align="center">
@@ -22,11 +22,11 @@
22
22
 
23
23
  它会统计 Codex 会话中的轮次、工具调用、Token、时长和模型,生成带有 AI 工分、今日工种和点评的小票。不会把 Prompt、回复正文、代码、项目路径或文件名写入小票。
24
24
 
25
- `0.6.0` 使用 cwr2 协议,按“会话 × 自然日”生成稳定的脱敏事实。今日、近 7 日和本周小票即使范围重叠,接收端也能识别相同工作;数据过大时会自动生成多张可重组的分片二维码。
25
+ `0.6.0` 使用 cwr2 协议,按“会话 × 自然日”生成稳定的脱敏事实。今日、近 7 日和本周小票即使范围重叠,接收端也能识别相同工作;数据过大时会自动生成多张可重组的分片二维码,并在 HTML 中逐张自动轮播,避免镜头同时识别多个数据码。
26
26
 
27
27
  ## Quickstart
28
28
 
29
- 需要 Node.js 20 或更高版本,并且本机已经使用过 Codex。无需克隆仓库,运行后选择“今天 / 近 7 日 / 本周 / 指定会话”:
29
+ 需要 Node.js 20 或更高版本,并且本机已经使用过 Codex。无需克隆仓库,运行后选择“今天 / 最近 3 小时 / 近 7 日 / 本周 / 指定会话”:
30
30
 
31
31
  ```bash
32
32
  npx codex-work-receipt@latest
@@ -38,11 +38,29 @@ npx codex-work-receipt@latest
38
38
  npx codex-work-receipt@latest --today
39
39
  ```
40
40
 
41
+ 查看最近 3 小时的工作:
42
+
43
+ ```bash
44
+ npx codex-work-receipt@latest --hours 3
45
+ ```
46
+
41
47
  网页和结构数据默认保存在 `./codex-work-receipt-output/`。生成的网页支持一键保存包含主小票和二维码导入联的高清长图。也可以继续使用 `--latest`、`--today` 等非交互参数,详见 [CLI 使用文档](docs/cli.md)。
42
48
 
43
49
  ## 直接跟 Codex 说
44
50
 
45
- 安装一次 AI 打工小票 Skill
51
+ 一次安装 AI 打工小票 Skill 和“票仔”Codex 桌宠:
52
+
53
+ ```bash
54
+ npx codex-work-receipt@latest --install-companion
55
+ ```
56
+
57
+ 重启 Codex 后,在 `Settings > Pets` 中点击 Refresh,选择“票仔 · AI 小票工”,再输入 `/pet` 唤醒。以后可以说:
58
+
59
+ > 票仔,开今天的票。
60
+
61
+ > 票仔,开最近三个小时的票。
62
+
63
+ 如果只想安装 Skill:
46
64
 
47
65
  ```bash
48
66
  npx codex-work-receipt@latest --install-skill
@@ -62,6 +80,7 @@ Codex 会选择统计范围和主题、执行命令并打开小票。详见 [Cod
62
80
 
63
81
  - [CLI 使用与全部参数](docs/cli.md)
64
82
  - [Codex Skill](docs/codex-skill.md)
83
+ - [Codex 桌宠“票仔”](docs/codex-pet.md)
65
84
  - [手机扫码导入](docs/mobile-import.md)
66
85
  - [数据结构与二维码协议](docs/data-schema.md)
67
86
  - [本地数据与隐私说明](docs/privacy.md)
@@ -0,0 +1,6 @@
1
+ {
2
+ "id": "ai-work-receipt",
3
+ "displayName": "票仔 · AI 小票工",
4
+ "description": "一只陪 Codex 搬砖、完工后提醒你开票的小票工。",
5
+ "spritesheetPath": "spritesheet.webp"
6
+ }
package/docs/cli.en.md CHANGED
@@ -17,7 +17,7 @@ Run:
17
17
  npx codex-work-receipt@latest --lang en
18
18
  ```
19
19
 
20
- Choose all activity today, the last 7 calendar days, this week, or a specific recent session. Session choices include their time range, turns, tool calls, and model for identification.
20
+ Choose all activity today, the last 3 hours, the last 7 calendar days, this week, or a specific recent session. Session choices include their time range, turns, tool calls, and model for identification.
21
21
 
22
22
  ## Non-interactive ranges
23
23
 
@@ -33,6 +33,14 @@ Summarize all Codex activity from today in your local timezone:
33
33
  npx codex-work-receipt@latest --today --lang en
34
34
  ```
35
35
 
36
+ Summarize the last 3 hours:
37
+
38
+ ```bash
39
+ npx codex-work-receipt@latest --hours 3 --lang en
40
+ ```
41
+
42
+ `--hours` accepts an integer from 1 to 168 and filters exact timestamps, including windows that cross midnight. Rolling-hour receipts use the compatible cwr1 summary protocol and do not create cwr2 session-day canonical facts.
43
+
36
44
  Last 7 calendar days, including today:
37
45
 
38
46
  ```bash
@@ -79,7 +87,7 @@ Default output:
79
87
 
80
88
  Default filenames include the calendar range. Latest-session and selected-session receipts include a short identifier so receipts from different dates or sessions do not overwrite one another.
81
89
 
82
- Open the generated HTML and click “Save full PNG” to download a high-resolution image. It includes the main receipt, mini-program code, and data QR import stub in the currently selected theme. Theme controls, the page background, and the footer note are excluded. When cwr2 data exceeds the safe capacity of one QR code, the import stub automatically shows numbered multipart codes that must all be scanned in the mini program.
90
+ Open the generated HTML and click “Save full PNG” to download a high-resolution image. It includes the main receipt, mini-program code, and data QR import stub in the currently selected theme. Theme controls, the page background, and the footer note are excluded. With one data QR, the mini-program code and data code remain side by side. When cwr2 exceeds the safe capacity of one QR code, the page shows the mini-program code first and then rotates multipart data codes one at a time without desktop clicks. The full PNG still includes every numbered part so the offline payload remains complete.
83
91
 
84
92
  Set a timezone and output path:
85
93
 
@@ -99,7 +107,8 @@ npx codex-work-receipt@latest --latest --lang en --no-open
99
107
 
100
108
  | Option | Description |
101
109
  | --- | --- |
102
- | `--range <name>` | `latest`, `today`, `last-7-days`, or `this-week` |
110
+ | `--range <name>` | `latest`, `last-hours`, `today`, `last-7-days`, or `this-week` |
111
+ | `--hours <number>` | Summarize the last 1-168 hours |
103
112
  | `--latest` | Summarize the latest active Codex session; default mode |
104
113
  | `--today` | Summarize activity from today in the selected timezone |
105
114
  | `--session <id>` | Summarize one specific Codex session |
@@ -109,6 +118,9 @@ npx codex-work-receipt@latest --latest --lang en --no-open
109
118
  | `--output <file>` | Set the HTML output path |
110
119
  | `--data-dir <directory>` | Set the local structured-history directory |
111
120
  | `--install-skill` | Install the Codex AI Work Receipt skill |
121
+ | `--install-pet` | Install only the Ticket Buddy Codex pet |
122
+ | `--uninstall-pet` | Remove Ticket Buddy without deleting the skill or receipts |
123
+ | `--install-companion` | Install both the skill and Ticket Buddy Codex pet |
112
124
  | `--no-open` | Do not open the generated page |
113
125
 
114
126
  Run the built-in help at any time:
@@ -133,5 +145,5 @@ See the [data schema and QR protocol](data-schema.en.md).
133
145
 
134
146
  - Codex is the only supported data source; Cursor and WorkBuddy are planned
135
147
  - Changed-file and line counts are intentionally omitted until they can be measured consistently
136
- - Calendar ranges filter individual events by local date and calculate a Token delta for each session
148
+ - Calendar ranges filter events by local date, rolling-hour ranges use exact timestamps, and both calculate per-session Token deltas
137
149
  - Desktop PNG export is rendered locally in the browser and does not upload receipt data
package/docs/cli.md CHANGED
@@ -17,7 +17,7 @@
17
17
  npx codex-work-receipt@latest
18
18
  ```
19
19
 
20
- 命令行会让你选择:今天全部活动、最近 7 个自然日、本周,或最近的某个具体会话。选择具体会话时会展示起止时间、轮次、工具调用和模型,帮助辨认。
20
+ 命令行会让你选择:今天全部活动、最近 3 小时、最近 7 个自然日、本周,或最近的某个具体会话。选择具体会话时会展示起止时间、轮次、工具调用和模型,帮助辨认。
21
21
 
22
22
  ## 非交互统计范围
23
23
 
@@ -33,6 +33,14 @@ npx codex-work-receipt@latest --latest
33
33
  npx codex-work-receipt@latest --today
34
34
  ```
35
35
 
36
+ 最近 3 小时:
37
+
38
+ ```bash
39
+ npx codex-work-receipt@latest --hours 3
40
+ ```
41
+
42
+ `--hours` 支持 1~168 的整数,并按精确时间戳筛选,可以跨越午夜。滚动小时小票使用兼容的 cwr1 摘要协议,不会写入 cwr2 的“会话 × 自然日”规范事实。
43
+
36
44
  最近 7 个自然日(含今天):
37
45
 
38
46
  ```bash
@@ -79,7 +87,7 @@ npx codex-work-receipt@latest --latest --theme diner
79
87
 
80
88
  默认文件名会携带统计日期范围;最近会话和指定会话则携带短编号,避免不同日期或会话的小票互相覆盖。
81
89
 
82
- 打开生成的 HTML 后,点击“保存完整长图”即可下载高清 PNG。图片包含主小票、小程序码和数据二维码导入联,并自动使用当前选择的主题;主题按钮、网页背景和底部说明不会进入图片。cwr2 数据超过单个二维码的安全容量时,导入联会自动展示多张带序号的分片二维码,需在小程序中全部扫完。
90
+ 打开生成的 HTML 后,点击“保存完整长图”即可下载高清 PNG。图片包含主小票、小程序码和数据二维码导入联,并自动使用当前选择的主题;主题按钮、网页背景和底部说明不会进入图片。只有一个数据二维码时,小程序码与数据码继续并排展示。cwr2 数据超过单码安全容量时,网页先单独展示小程序码,随后自动逐张轮播分片数据码;用户无需在电脑上切换上一张或下一张,但仍需在小程序中收齐全部分片。完整长图为保留离线数据,会继续包含全部带序号的分片二维码。
83
91
 
84
92
  指定时区和输出路径:
85
93
 
@@ -99,7 +107,8 @@ npx codex-work-receipt@latest --latest --no-open
99
107
 
100
108
  | 参数 | 说明 |
101
109
  | --- | --- |
102
- | `--range <name>` | `latest`、`today`、`last-7-days` 或 `this-week` |
110
+ | `--range <name>` | `latest`、`last-hours`、`today`、`last-7-days` 或 `this-week` |
111
+ | `--hours <number>` | 统计最近 1~168 小时;等价于 `last-hours` 范围 |
103
112
  | `--latest` | 统计最近活跃的 Codex 会话,默认模式 |
104
113
  | `--today` | 汇总指定时区今天发生的 Codex 活动 |
105
114
  | `--session <id>` | 统计指定的 Codex 会话 |
@@ -109,6 +118,9 @@ npx codex-work-receipt@latest --latest --no-open
109
118
  | `--output <file>` | 指定 HTML 输出路径 |
110
119
  | `--data-dir <directory>` | 指定本地结构历史目录 |
111
120
  | `--install-skill` | 安装 AI 打工小票 Codex Skill |
121
+ | `--install-pet` | 只安装“票仔”Codex 桌宠 |
122
+ | `--uninstall-pet` | 卸载“票仔”,不删除 Skill 或历史小票 |
123
+ | `--install-companion` | 同时安装 Skill 和“票仔”Codex 桌宠 |
112
124
  | `--no-open` | 生成后不自动打开浏览器 |
113
125
 
114
126
  也可以随时运行:
@@ -133,5 +145,5 @@ npx codex-work-receipt@latest --help
133
145
 
134
146
  - 当前只支持 Codex;Cursor、WorkBuddy 等数据源仍在规划中
135
147
  - 暂不统计修改文件数和代码行数,避免不同工具调用方式产生误导
136
- - 时间范围按每条事件的本地日期筛选,并分别计算每个会话的 Token 区间增量
148
+ - 自然日范围按本地日期筛选,滚动小时范围按精确时间戳筛选,并分别计算每个会话的 Token 区间增量
137
149
  - 桌面网页导出 PNG 使用浏览器本地渲染,不上传小票数据
@@ -0,0 +1,60 @@
1
+ # Ticket Buddy Codex Pet
2
+
3
+ <p><a href="./codex-pet.md">中文</a> · <strong>English</strong> · <a href="../README.en.md">Back to README</a></p>
4
+
5
+ “Ticket Buddy · AI Work Receipt” is a custom companion for Codex's native Pets feature. It is a night-green thermal receipt printer with tiny ox horns and animated idle, working, waiting, ready, failed, and review states.
6
+
7
+ Ticket Buddy only presents Codex activity and provides companionship. It does not collect extra data, generate receipts automatically, or alter the current task. Receipt generation continues through the AI Work Receipt skill.
8
+
9
+ ## Install the skill and pet together
10
+
11
+ ```bash
12
+ npx codex-work-receipt@latest --install-companion --lang en
13
+ ```
14
+
15
+ After installation:
16
+
17
+ 1. Restart Codex.
18
+ 2. Open `Settings > Pets`.
19
+ 3. Select Refresh.
20
+ 4. Choose “票仔 · AI 小票工” (Ticket Buddy).
21
+ 5. Use `/pet` to wake it.
22
+
23
+ Then ask:
24
+
25
+ > Ticket Buddy, create today's receipt.
26
+
27
+ > Ticket Buddy, create a receipt for the latest session.
28
+
29
+ > Ticket Buddy, create a receipt for the last three hours.
30
+
31
+ “The last few hours” defaults to three hours.
32
+
33
+ ## Install or remove only the pet
34
+
35
+ ```bash
36
+ npx codex-work-receipt@latest --install-pet --lang en
37
+ ```
38
+
39
+ ```bash
40
+ npx codex-work-receipt@latest --uninstall-pet --lang en
41
+ ```
42
+
43
+ Removal only deletes `~/.codex/pets/ai-work-receipt/`. It leaves the skill, saved receipts, and other pets untouched.
44
+
45
+ ## States
46
+
47
+ - Idle: quiet breathing and blinking.
48
+ - Running: focused button work shows that Codex is executing a task.
49
+ - Needs input: an open paw and head tilt show that Codex needs approval, a choice, or an answer.
50
+ - Ready: the pet scans the attached receipt to show that the task is complete and waiting for review.
51
+ - Failed or blocked: the pet looks deflated.
52
+ - Movement: separate leftward and rightward walking loops follow its movement direction.
53
+
54
+ Codex automatically controls state transitions and movement direction; a command cannot select an individual action row. A custom pet currently supplies only its name, description, and animation atlas. Selecting the pet returns to Codex or opens activity; it cannot run the receipt CLI directly.
55
+
56
+ ## Availability
57
+
58
+ - Codex desktop app: floating companion and activity states.
59
+ - Codex CLI: terminal pets in compatible iTerm2, Kitty Graphics, or Sixel terminals.
60
+ - Codex IDE extension: no pet picker or floating pet overlay currently.
@@ -0,0 +1,64 @@
1
+ # Codex 桌宠“票仔”
2
+
3
+ <p><strong>中文</strong> · <a href="./codex-pet.en.md">English</a> · <a href="../README.md">返回 README</a></p>
4
+
5
+ “票仔 · AI 小票工”是 AI 打工小票为 Codex 原生 Pets 功能制作的自定义桌宠。它是一台长着小牛角的夜班绿热敏打印机,会跟随 Codex 的空闲、工作、等待、完成和失败状态切换动画。
6
+
7
+ 票仔只负责状态展示和陪伴,不会自动读取额外数据、生成小票或改变 Codex 的任务。开票仍然通过 AI 打工小票 Skill 完成。
8
+
9
+ ## 一次安装 Skill 和票仔
10
+
11
+ ```bash
12
+ npx codex-work-receipt@latest --install-companion
13
+ ```
14
+
15
+ 安装完成后:
16
+
17
+ 1. 重启 Codex。
18
+ 2. 打开 `Settings > Pets`。
19
+ 3. 点击 Refresh。
20
+ 4. 选择“票仔 · AI 小票工”。
21
+ 5. 输入 `/pet` 唤醒票仔。
22
+
23
+ 以后可以直接说:
24
+
25
+ > 票仔,开今天的票。
26
+
27
+ > 票仔,开最近一个会话的票。
28
+
29
+ > 票仔,开最近三个小时的票。
30
+
31
+ “最近几个小时”默认表示最近 3 小时。
32
+
33
+ ## 只安装或卸载桌宠
34
+
35
+ 只安装票仔:
36
+
37
+ ```bash
38
+ npx codex-work-receipt@latest --install-pet
39
+ ```
40
+
41
+ 卸载票仔:
42
+
43
+ ```bash
44
+ npx codex-work-receipt@latest --uninstall-pet
45
+ ```
46
+
47
+ 卸载只会删除 `~/.codex/pets/ai-work-receipt/`,不会删除 Skill、历史小票或其他宠物。
48
+
49
+ ## 状态
50
+
51
+ - 空闲:安静呼吸和眨眼。
52
+ - 正在打工:专注操作打印按钮,表示 Codex 正在执行任务。
53
+ - 等你确认:抬手并歪头等待,表示 Codex 需要批准、选择或回答。
54
+ - 任务完成:查看票纸并左右扫视,表示任务已经完成、等待你回来查看。
55
+ - 失败或阻塞:小票工露出沮丧表情。
56
+ - 左右移动:根据移动方向播放对应步行动画。
57
+
58
+ Codex 会自动决定状态和移动方向,不能通过命令指定播放某一行动画。当前自定义 Pet 只能提供名称、描述和动画图集;点击票仔会返回 Codex 或打开活动列表,不能改成直接运行 CLI。
59
+
60
+ ## 使用范围
61
+
62
+ - Codex 桌面端:支持悬浮桌宠和活动状态。
63
+ - Codex CLI:在支持 iTerm2、Kitty Graphics 或 Sixel 的终端里提供终端宠物。
64
+ - Codex IDE 扩展:当前不提供宠物选择器或悬浮桌宠。
@@ -26,16 +26,24 @@ After installation, ask Codex:
26
26
 
27
27
  > Generate today's AI work receipt with the diner theme.
28
28
 
29
+ > Ticket Buddy, create a receipt for the last three hours.
30
+
31
+ > Ticket Buddy, create a receipt for the last few hours.
32
+
29
33
  > Generate an AI work receipt for the last seven days.
30
34
 
31
35
  > Show how much Codex worked this week.
32
36
 
33
37
  > Create a Chinese receipt for my latest session.
34
38
 
35
- Codex will choose a specific session, today, the last seven days, or this week, plus the language and theme, then run the CLI and open the generated page.
39
+ Codex will choose a specific session, the last 1-168 hours, today, the last seven days, or this week, plus the language and theme, then run the CLI and open the generated page. “The last few hours” defaults to three hours.
40
+
41
+ If another Codex task is still running and you want the receipt immediately, start a separate local Codex chat. A message sent to the active chat may steer the current run or wait in its queue, depending on Follow-up behavior.
36
42
 
37
43
  You can also invoke the skill explicitly with `$ai-work-receipt`.
38
44
 
45
+ See [Ticket Buddy Codex pet](codex-pet.en.md) for the companion setup.
46
+
39
47
  ## Update
40
48
 
41
49
  Run the installation command again to safely replace an older version:
@@ -26,16 +26,24 @@ Skill 会安装到:
26
26
 
27
27
  > 生成我今天的 AI 打工小票,使用复古粉票。
28
28
 
29
+ > 票仔,开最近三个小时的票。
30
+
31
+ > 票仔,开最近几个小时的票。
32
+
29
33
  > 生成我最近七天的 AI 打工小票。
30
34
 
31
35
  > 看看本周 Codex 一共打了多少工。
32
36
 
33
37
  > 用英文生成刚刚这次工作的 AI 打工小票。
34
38
 
35
- Codex 会根据表达选择单次会话、今天、近七日或本周,以及语言和主题,然后执行命令并打开生成的网页。
39
+ Codex 会根据表达选择单次会话、最近 1~168 小时、今天、近七日或本周,以及语言和主题,然后执行命令并打开生成的网页。“最近几个小时”默认统计最近 3 小时。
40
+
41
+ 如果当前 Codex 任务仍在运行,而你希望立刻查看小票,建议新开一个本地 Codex 会话再说“开今天的票”;在当前运行会话中发送的消息可能根据 Follow-up behavior 被用于 Steer 或 Queue。
36
42
 
37
43
  也可以通过 `$ai-work-receipt` 显式调用这个 Skill。
38
44
 
45
+ 桌宠安装和使用见 [Codex 桌宠“票仔”](codex-pet.md)。
46
+
39
47
  ## 更新
40
48
 
41
49
  重新运行安装命令即可安全覆盖旧版本:
@@ -24,11 +24,15 @@ The QR payload uses compact fields:
24
24
 
25
25
  ```text
26
26
  cwr1.<checksum>.<Base64URL of deflateRaw(JSON)>
27
+ cwr2.<checksum>.<Base64URL of deflateRaw(JSON)>
28
+ cwr2p.<transferId>.<partIndex>.<partCount>.<totalChecksum>.<partChecksum>.<chunk>
27
29
  ```
28
30
 
31
+ `cwr1` and `cwr2` are complete single-code payloads. `cwr2p` splits the cwr2 string into up to 12 reorderable parts. The mini program collects a transfer by transferId, validates the total checksum, reconstructs cwr2, and only then decompresses it. Multipart HTML rotates one data code at a time; the protocol does not require scan order.
32
+
29
33
  The mini program validates the prefix and checksum before decompressing and parsing the payload. Future schema versions use the compact `v` field for compatibility.
30
34
 
31
- Compact field `o` explicitly carries `latest`, `session`, `today`, `last-7-days`, or `this-week`. `d[3]` and `d[4]` carry the calendar boundaries. These additive fields keep the `cwr1` prefix and schema version `1`, so the updated mini program can still import older QR codes.
35
+ Compact field `o` explicitly carries `latest`, `session`, `last-hours`, `today`, `last-7-days`, or `this-week`. `d[3]` and `d[4]` carry date boundaries. Today, last-seven-days, and this-week receipts continue to use cwr2 canonical facts. `last-hours` is a rolling window, so it uses the compatible cwr1 summary payload to avoid colliding with session-day fact identities. The updated mini program can still import older QR codes.
32
36
 
33
37
  `presentation.compensation` contains playful AI work points, not real API cost. For compatibility with the current Chinese mini program, QR display copy remains Chinese while compact fields `l` and `r` carry the desktop locale and language-neutral role ID. English HTML and local JSON remain fully localized.
34
38
 
@@ -24,11 +24,15 @@
24
24
 
25
25
  ```text
26
26
  cwr1.<checksum>.<deflateRaw(JSON) 的 Base64URL>
27
+ cwr2.<checksum>.<deflateRaw(JSON) 的 Base64URL>
28
+ cwr2p.<transferId>.<partIndex>.<partCount>.<totalChecksum>.<partChecksum>.<chunk>
27
29
  ```
28
30
 
31
+ `cwr1` 和 `cwr2` 是完整单码。`cwr2p` 是 cwr2 单码字符串的可乱序分片,最多 12 片;小程序先按 transferId 收集全部分片,再校验总 checksum、拼回 cwr2 并解压。HTML 在多分片时每次只轮播一个数据码,协议本身不依赖扫描顺序。
32
+
29
33
  小程序应检查前缀和校验值,再解压并解析数据。未来结构升级通过 `v` 字段兼容。
30
34
 
31
- 精简字段 `o` 显式携带 `latest`、`session`、`today`、`last-7-days` 或 `this-week`;`d[3]` 和 `d[4]` 携带自然日边界。新增字段保持 `cwr1` 和结构版本 `1`,旧二维码仍可由新版小程序导入。
35
+ 精简字段 `o` 显式携带 `latest`、`session`、`last-hours`、`today`、`last-7-days` 或 `this-week`;`d[3]` 和 `d[4]` 携带日期边界。今日、近 7 日和本周继续使用 cwr2 canonical facts。`last-hours` 是滚动时间窗,为避免与“会话 × 自然日”事实发生身份冲突,使用兼容的 cwr1 摘要载荷。旧二维码仍可由新版小程序导入。
32
36
 
33
37
  `presentation.compensation` 是娱乐化 AI 工分,不代表真实 API 费用。为兼容当前中文小程序,二维码展示文案继续使用中文,并通过精简字段 `l` 和 `r` 携带桌面语言及工种语义 ID;英文 HTML 和本地 JSON 不受影响。
34
38
 
@@ -6,9 +6,9 @@ The desktop page shows both the fixed mini-program code and a data QR code for t
6
6
 
7
7
  1. Scan the fixed mini-program code in WeChat and open the companion mini program.
8
8
  2. Tap the desktop-import action.
9
- 3. Scan the adjacent data QR code.
9
+ 3. Scan the adjacent data QR code. Multipart receipts rotate one part at a time on the computer, while the mini program automatically reopens scanning until all parts are collected.
10
10
  4. Validate the `cwr1`, `cwr2`, or multipart `cwr2p` prefix, checksum, and schema version.
11
- 5. Decompress and parse the privacy-safe metrics.
11
+ 5. Single codes decompress immediately. Multipart codes can arrive out of order, and missed parts are collected on the next rotation before the privacy-safe metrics are parsed.
12
12
  6. Recognize a session, today, last-seven-days, or this-week range. New receipts use canonical facts for deduplication and are stored in the anonymous account database by default.
13
13
  7. Render the selected template with Canvas and save it to the phone.
14
14
 
@@ -6,9 +6,9 @@
6
6
 
7
7
  1. 微信扫描固定小程序码并打开配套小程序。
8
8
  2. 点击“从电脑导入”。
9
- 3. 扫描网页旁边的数据二维码。
9
+ 3. 扫描网页旁边的数据二维码;多分片小票会在电脑上自动逐张轮播,小程序在未集齐时自动继续打开扫码。
10
10
  4. 小程序校验 `cwr1`、`cwr2` 或 `cwr2p` 分片前缀、checksum 和结构版本。
11
- 5. 解压并解析脱敏统计数据。
11
+ 5. 单码立即解压;多分片允许乱序、漏扫后等待下一轮补齐,全部到齐再解析脱敏统计数据。
12
12
  6. 识别单会话、今日、近七日或本周范围;新版小票按规范事实去重,完整记录默认保存到匿名账号数据库。
13
13
  7. 使用 Canvas 重新绘制所选模板并保存到手机相册。
14
14
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codex-work-receipt",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "type": "module",
5
5
  "description": "Generate a privacy-first Codex work receipt from local session metadata.",
6
6
  "author": "a-bai-2026",
@@ -27,7 +27,7 @@
27
27
  "scripts": {
28
28
  "receipt": "node src/cli.mjs",
29
29
  "test": "node --test",
30
- "check": "node --check src/cli.mjs && node --check src/core/skill-installer.mjs",
30
+ "check": "node --check src/cli.mjs && node --check src/core/skill-installer.mjs && node --check src/core/pet-installer.mjs && node --check src/core/range.mjs",
31
31
  "prepublishOnly": "npm test && npm run check"
32
32
  },
33
33
  "files": [
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: ai-work-receipt
3
- description: Generate and open a privacy-first local AI work receipt from Codex session metadata. Use when the user asks Codex to create, regenerate, open, or locate an “AI 打工小票” or “AI work receipt” for the latest session, today, the last seven days, or this week, in Chinese or English. Do not use for real invoices, salary calculations, API billing, or non-Codex activity.
3
+ description: Generate and open a privacy-first local AI work receipt from Codex session metadata. Use when the user asks Codex or 票仔 to create, regenerate, open, or locate an “AI 打工小票”, “工票”, or “AI work receipt” for the latest session, the last few hours, today, the last seven days, or this week, in Chinese or English. Do not use for real invoices, salary calculations, API billing, or non-Codex activity.
4
4
  ---
5
5
 
6
6
  # AI 打工小票
@@ -10,6 +10,9 @@ Use the published `codex-work-receipt` CLI as the only statistics and rendering
10
10
  ## Interpret the request
11
11
 
12
12
  - Use `--latest` for “刚刚”“这次”“最近一次”“上一段工作” or an unspecified request for one receipt.
13
+ - Use `--hours <N>` for “最近 N 小时”“过去 N 小时” or “近 N 小时”. Accept integers from 1 to 168.
14
+ - Use `--hours 3` for an unspecified “最近几个小时”“过去几个小时” request.
15
+ - Use `--hours 12` for “最近半天”.
13
16
  - Use `--today` for “今天”“今日”“今天全部工作” or a daily summary.
14
17
  - Use `--range last-7-days` for “最近七天”“近 7 日” or a rolling seven-calendar-day summary.
15
18
  - Use `--range this-week` for “本周”“这周” or a Monday-to-now summary.
@@ -21,6 +24,7 @@ Use the published `codex-work-receipt` CLI as the only statistics and rendering
21
24
  - Use `--lang en` when the user requests English or asks for the receipt in English. Use `--lang zh-CN` otherwise.
22
25
  - If the user asks to choose interactively, run the CLI without a range flag so it can show the local selector.
23
26
  - If the user asks for an unsupported custom date range, explain the available ranges and do not invent flags.
27
+ - Treat requests addressed to “票仔” the same as direct AI work receipt requests, for example “票仔,开今天的票”.
24
28
 
25
29
  ## Execute
26
30
 
@@ -1,4 +1,4 @@
1
1
  interface:
2
2
  display_name: "AI 打工小票"
3
- short_description: "使用自然语言生成中英文 AI 打工小票并扫码导入手机"
4
- default_prompt: "使用 $ai-work-receipt 给我刚刚这次 Codex 工作生成一张 AI 打工小票。"
3
+ short_description: "让票仔按会话、小时或自然日生成 AI 打工小票"
4
+ default_prompt: "使用 $ai-work-receipt 让票仔给我刚刚这次 Codex 工作生成一张 AI 打工小票。"