@liwu1995/afu-context 0.1.5 → 0.1.6

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/README.md CHANGED
@@ -20,24 +20,24 @@ Install and sign in to your host first. You need npm, Node.js **22.19+ (22.x) or
20
20
 
21
21
  | Host | System | Install | Launch after installation |
22
22
  | --- | --- | --- | --- |
23
- | <a id="afu-claude"></a>Claude Code | macOS / Linux | `npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.5 install claude` | `claude` |
24
- | Claude Code | Windows 10/11¹ | `npx.cmd --yes --registry=https://registry.npmjs.org "@liwu1995/afu-context@0.1.5" install claude` | `claude` |
25
- | <a id="afu-codex"></a>Codex CLI | macOS / Linux | `npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.5 install codex` | `codex` |
26
- | <a id="afu-pi"></a>Pi | macOS / Linux | `npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.5 install pi` | `pi` |
27
- | <a id="afu-dsh"></a>DSH | macOS / Linux | `npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.5 install dsh --profile YOUR_PROFILE` | `dsh --profile YOUR_PROFILE` |
23
+ | <a id="afu-claude"></a>Claude Code | macOS / Linux | `npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.6 install claude` | `claude` |
24
+ | Claude Code | Windows 10/11¹ | `npx.cmd --yes --registry=https://registry.npmjs.org "@liwu1995/afu-context@0.1.6" install claude` | `claude` |
25
+ | <a id="afu-codex"></a>Codex CLI | macOS / Linux | `npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.6 install codex` | `codex` |
26
+ | <a id="afu-pi"></a>Pi | macOS / Linux | `npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.6 install pi` | `pi` |
27
+ | <a id="afu-dsh"></a>DSH | macOS / Linux | `npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.6 install dsh --profile YOUR_PROFILE` | `dsh --profile YOUR_PROFILE` |
28
28
 
29
- Supported systems are macOS on Apple Silicon (ARM64) and Linux x64. The first `afu` command sets up a private Python environment from your Python 3.11+, which takes about half a minute. On macOS, Claude Code and Codex were tested end to end with real models (install, chat with compaction, upgrade, remove, launchd autostart). On Linux, Claude Code was tested with a real model and Codex with a local fixture; user-systemd autostart was not tested. Start a new session for Claude Code or Codex. Pi loads the extension in new sessions. Replace `YOUR_PROFILE` with the DSH profile to integrate, such as `headless` or `web`. For web, you can also launch with `dsh web`. To remove just one profile, run `npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.5 remove dsh --profile YOUR_PROFILE`.
29
+ Supported systems are macOS on Apple Silicon (ARM64) and Linux x64. The first `afu` command sets up a private Python environment from your Python 3.11+, which takes about half a minute. On macOS, Claude Code and Codex were tested end to end with real models (install, chat with compaction, upgrade, remove; when endpoint security blocks login autostart, session hooks start the gateway), including Codex sessions with tool calls, pasted images and Codex's own compactions. On Linux, Claude Code was tested with a real model and Codex with a local fixture; user-systemd autostart was not tested. Start a new session for Claude Code or Codex. Pi loads the extension in new sessions. Replace `YOUR_PROFILE` with the DSH profile to integrate, such as `headless` or `web`. For web, you can also launch with `dsh web`. To remove just one profile, run `npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.6 remove dsh --profile YOUR_PROFILE`.
30
30
 
31
31
  ¹ On Windows, use PowerShell, Python **3.11+** and a Claude Code version with PowerShell hook support. Native Claude Code is implemented and awaits Windows testing. Native Codex is unsupported, and Pi and DSH are unverified on Windows.
32
32
 
33
- The commands pin **0.1.5** from the public npm registry so installation does not depend on a mirror carrying the latest release. Use 0.1.5 or later; earlier versions lack the fixes in this release. If npm reports `with a date before`, check `before` and `min-release-age`. This version was published at **PUBLISH_TIME_UTC**. Retry after a rolling cooldown expires. For a fixed cutoff, the effective policy must allow that publication date.
33
+ The commands pin **0.1.6** from the public npm registry so installation does not depend on a mirror carrying the latest release. Use 0.1.6 or later; earlier versions lack the fixes in this release. If npm reports `with a date before`, check `before` and `min-release-age`. This version was published at **PUBLISH_TIME_UTC**. Retry after a rolling cooldown expires. For a fixed cutoff, the effective policy must allow that publication date.
34
34
 
35
35
  <details>
36
36
  <summary>Startup after reboot and Pi / DSH launch options</summary>
37
37
 
38
38
  Claude Code and Codex start the AFU gateway from their session hooks, so it comes back with the first session after a reboot. Installation also registers a login service when the system allows it. If system policy refuses it (for example an endpoint-security rule on `~/Library/LaunchAgents`, or Linux without user systemd), installation continues and prints a notice; no reinstall is needed after reboot. Codex runs only hooks you have trusted: open `codex` once after installing and trust the AFU hooks when asked.
39
39
 
40
- For Pi **0.84.4**, pass `--provider` and `--model` on the Pi command line. DSH was tested with **0.1.2-rc.1** and Cordis **4.0.2**. If a web profile reports an incompatible HMR API, run `npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.5 dsh --web-compat -- --profile web`.
40
+ For Pi **0.84.4**, pass `--provider` and `--model` on the Pi command line. DSH was tested with **0.1.2-rc.1** and Cordis **4.0.2**. If a web profile reports an incompatible HMR API, run `npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.6 dsh --web-compat -- --profile web`.
41
41
 
42
42
  </details>
43
43
 
@@ -87,8 +87,8 @@ To check compaction for the current session, type `/afu:status` in Claude Code,
87
87
  From a terminal, check the integration status, then open the dashboard and select your session. For another host, replace `codex` with `claude`, `pi` or `dsh`; `--brief` prints the same short lines as the slash commands.
88
88
 
89
89
  ```sh
90
- npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.5 status codex --brief
91
- npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.5 ui
90
+ npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.6 status codex --brief
91
+ npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.6 ui
92
92
  ```
93
93
 
94
94
  The dashboard distinguishes **request observed → summary ready → summary applied**. For Claude Code and Codex, application requires a complete successful response to a request carrying the summary. For Pi and DSH it means the host committed the summary to session history. The dashboard also shows summary duration and provider-reported cache usage.
@@ -97,7 +97,7 @@ The dashboard distinguishes **request observed → summary ready → summary app
97
97
 
98
98
  ## Models and thresholds
99
99
 
100
- All four integrations reuse the conversation’s model and authentication. The default trigger is **40%** for windows of **1,000,000 tokens or more** and **50%** for smaller windows. Pi and DSH follow the host’s selected model and window. Claude Code and Codex query provider metadata after a complete response. When the window is unknown, status reports `manual_window_required` and chat continues.
100
+ All four integrations reuse the conversation’s model and authentication. The default trigger is **40%** for windows of **1,000,000 tokens or more** and **50%** for smaller windows. Pi and DSH follow the host’s selected model and window. Claude Code reports the model window to its status line command; AFU wraps that command (your own status line keeps running unchanged) to learn the window. Codex windows come from its model catalog cache. If a window is still unknown, chat continues and status says so; `--context-window` sets it manually.
101
101
 
102
102
  <details>
103
103
  <summary>Set a window or ratio, or restore automatic settings</summary>
@@ -105,21 +105,21 @@ All four integrations reuse the conversation’s model and authentication. The d
105
105
  For a Codex model with a known 200,000-token window, the first command sets a 30% trigger. The second restores automatic settings.
106
106
 
107
107
  ```sh
108
- npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.5 install codex --context-window 200000 --ratio 0.3
109
- npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.5 install codex --context-window auto --ratio auto
108
+ npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.6 install codex --context-window 200000 --ratio 0.3
109
+ npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.6 install codex --context-window auto --ratio auto
110
110
  ```
111
111
 
112
112
  </details>
113
113
 
114
- For frequent use, run `npm install -g --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.5` and use `afu` in place of the full `npx` invocation. For example, `afu ui` opens the dashboard, and `afu ui --prices ./afu-prices.json` uses your price file to estimate costs.
114
+ For frequent use, run `npm install -g --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.6` and use `afu` in place of the full `npx` invocation. For example, `afu ui` opens the dashboard, and `afu ui --prices ./afu-prices.json` uses your price file to estimate costs.
115
115
 
116
116
  ## Upgrade and remove
117
117
 
118
118
  After upgrading a Claude Code or Codex integration, start a new session to use the new gateway. To uninstall, remove the host integration first, then restart the host. Use the appropriate command below.
119
119
 
120
120
  ```sh
121
- npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.5 upgrade codex
122
- npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.5 remove codex
121
+ npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.6 upgrade codex
122
+ npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.6 remove codex
123
123
  ```
124
124
 
125
125
  Use `remove pi` or `remove dsh` for those integrations. In Windows PowerShell, use `npx.cmd` and double-quote the package name.
package/README.zh-CN.md CHANGED
@@ -20,24 +20,24 @@
20
20
 
21
21
  | 宿主 | 系统 | 一键安装 | 安装后启动 |
22
22
  | --- | --- | --- | --- |
23
- | <a id="afu-claude"></a>Claude Code | macOS / Linux | `npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.5 install claude` | `claude` |
24
- | Claude Code | Windows 10/11¹ | `npx.cmd --yes --registry=https://registry.npmjs.org "@liwu1995/afu-context@0.1.5" install claude` | `claude` |
25
- | <a id="afu-codex"></a>Codex CLI | macOS / Linux | `npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.5 install codex` | `codex` |
26
- | <a id="afu-pi"></a>Pi | macOS / Linux | `npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.5 install pi` | `pi` |
27
- | <a id="afu-dsh"></a>DSH | macOS / Linux | `npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.5 install dsh --profile YOUR_PROFILE` | `dsh --profile YOUR_PROFILE` |
23
+ | <a id="afu-claude"></a>Claude Code | macOS / Linux | `npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.6 install claude` | `claude` |
24
+ | Claude Code | Windows 10/11¹ | `npx.cmd --yes --registry=https://registry.npmjs.org "@liwu1995/afu-context@0.1.6" install claude` | `claude` |
25
+ | <a id="afu-codex"></a>Codex CLI | macOS / Linux | `npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.6 install codex` | `codex` |
26
+ | <a id="afu-pi"></a>Pi | macOS / Linux | `npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.6 install pi` | `pi` |
27
+ | <a id="afu-dsh"></a>DSH | macOS / Linux | `npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.6 install dsh --profile YOUR_PROFILE` | `dsh --profile YOUR_PROFILE` |
28
28
 
29
- 支持 Apple Silicon(ARM64)的 macOS 和 x64 Linux。首次执行 `afu` 会用本机 Python 3.11+ 创建专用运行环境,约半分钟。macOS 上 Claude Code 和 Codex 已用真实模型完成端到端验证(安装、对话压缩、升级、移除、launchd 自启);Linux 上 Claude Code 用真实模型验证,Codex 用本地模拟服务验证,用户级 systemd 自启尚未验证。Claude Code 和 Codex 安装后新开会话。Pi 扩展在新开的会话自动加载。将 DSH 的 `YOUR_PROFILE` 换成要接入的 profile,例如 `headless` 或 `web`。选择 web 后也可以用 `dsh web` 启动。仅移除某个 profile 时运行 `npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.5 remove dsh --profile YOUR_PROFILE`。
29
+ 支持 Apple Silicon(ARM64)的 macOS 和 x64 Linux。首次执行 `afu` 会用本机 Python 3.11+ 创建专用运行环境,约半分钟。macOS 上 Claude Code 和 Codex 已用真实模型完成端到端验证(安装、对话压缩、升级、移除;终端安全软件拦截开机自启时改由会话 hook 拉起),Codex 覆盖带工具调用、贴图和 Codex 自身压缩过的长会话;Linux 上 Claude Code 用真实模型验证,Codex 用本地模拟服务验证,用户级 systemd 自启尚未验证。Claude Code 和 Codex 安装后新开会话。Pi 扩展在新开的会话自动加载。将 DSH 的 `YOUR_PROFILE` 换成要接入的 profile,例如 `headless` 或 `web`。选择 web 后也可以用 `dsh web` 启动。仅移除某个 profile 时运行 `npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.6 remove dsh --profile YOUR_PROFILE`。
30
30
 
31
31
  ¹ Windows 使用 PowerShell,需本机 Python **3.11+** 和支持 PowerShell Hook 的 Claude Code。Windows 原生 Claude Code 已实现,待实机验收。Codex 未支持,Pi 和 DSH 未验收。
32
32
 
33
- 安装命令固定使用公网 npm 上的 **0.1.5**,避免镜像尚未同步最新版本。请使用 0.1.5 或更新版本;更早的版本不含本版修复。如果报错含 `with a date before`,请核对 npm 的 `before` 或 `min-release-age`。此版本发布于 **PUBLISH_TIME_UTC**。若使用滚动冷却期,等该版本满足期限后重试;若设置了固定截止日期,需使用允许安装该版本的策略。
33
+ 安装命令固定使用公网 npm 上的 **0.1.6**,避免镜像尚未同步最新版本。请使用 0.1.6 或更新版本;更早的版本不含本版修复。如果报错含 `with a date before`,请核对 npm 的 `before` 或 `min-release-age`。此版本发布于 **PUBLISH_TIME_UTC**。若使用滚动冷却期,等该版本满足期限后重试;若设置了固定截止日期,需使用允许安装该版本的策略。
34
34
 
35
35
  <details>
36
36
  <summary>重启后的启动方式与 Pi / DSH 启动参数</summary>
37
37
 
38
38
  Claude Code 和 Codex 会在会话启动时通过 hook 拉起 AFU 网关,重启电脑后打开第一个会话即可恢复。系统允许时,安装还会注册开机自启;若被系统策略拒绝(例如终端安全软件禁止写入 `~/Library/LaunchAgents`,或 Linux 没有用户级 systemd),安装会继续并给出提示,重启后无需重新安装。Codex 只执行你信任过的 hook:安装后打开一次 `codex`,在提示中信任 AFU 的 hook。
39
39
 
40
- Pi **0.84.4** 可直接传 `--provider` 和 `--model`。DSH 已适配 **0.1.2-rc.1** 和 Cordis **4.0.2**。若 Web profile 提示 HMR API 不兼容,可使用 `npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.5 dsh --web-compat -- --profile web`。
40
+ Pi **0.84.4** 可直接传 `--provider` 和 `--model`。DSH 已适配 **0.1.2-rc.1** 和 Cordis **4.0.2**。若 Web profile 提示 HMR API 不兼容,可使用 `npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.6 dsh --web-compat -- --profile web`。
41
41
 
42
42
  </details>
43
43
 
@@ -87,8 +87,8 @@ Pi **0.84.4** 可直接传 `--provider` 和 `--model`。DSH 已适配 **0.1.2-rc
87
87
  没有 `afu` 命令时(例如 `~/.local/bin` 不在 `PATH` 中),可以用完整的 npx 命令。以 Codex 为例,其它宿主将 `codex` 换成 `claude`、`pi` 或 `dsh`:
88
88
 
89
89
  ```sh
90
- npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.5 status codex --brief
91
- npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.5 ui
90
+ npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.6 status codex --brief
91
+ npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.6 ui
92
92
  ```
93
93
 
94
94
  面板分别记录**请求已接入 → 摘要已生成 → 摘要已应用**。Claude Code 和 Codex 的应用回执表示替换历史后的请求已收到完整成功响应。Pi 和 DSH 的回执表示宿主已把摘要写入会话历史。面板也展示摘要耗时和模型返回的缓存用量。
@@ -97,7 +97,7 @@ npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.5 ui
97
97
 
98
98
  ## 模型与压缩阈值
99
99
 
100
- 四个平台都复用主对话的模型和认证。模型窗口为 **1,000,000 tokens 或更大** 时,默认在 **40%** 触发,更小的窗口按 **50%** 触发。Pi 和 DSH 跟随宿主选择的模型和窗口。Claude Code 和 Codex 在完整响应后查询提供方的窗口信息,查不到时显示 `manual_window_required`,聊天可以继续。
100
+ 四个平台都复用主对话的模型和认证。模型窗口为 **1,000,000 tokens 或更大** 时,默认在 **40%** 触发,更小的窗口按 **50%** 触发。Pi 和 DSH 跟随宿主选择的模型和窗口。Claude Code 会把模型窗口传给它的状态栏命令,AFU 包装这条命令来获取窗口(你原来的状态栏照常运行、显示不变);Codex 的窗口来自它的模型目录缓存。仍未知时聊天照常进行,状态里会提示,也可以用 `--context-window` 手动指定。
101
101
 
102
102
  <details>
103
103
  <summary>手动指定窗口、调整比例或恢复自动设置</summary>
@@ -105,21 +105,21 @@ npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.5 ui
105
105
  下面以已知窗口为 200,000 tokens 的 Codex 模型为例。第一条将触发比例设为 30%,第二条恢复自动设置。
106
106
 
107
107
  ```sh
108
- npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.5 install codex --context-window 200000 --ratio 0.3
109
- npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.5 install codex --context-window auto --ratio auto
108
+ npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.6 install codex --context-window 200000 --ratio 0.3
109
+ npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.6 install codex --context-window auto --ratio auto
110
110
  ```
111
111
 
112
112
  </details>
113
113
 
114
- 如果经常使用 AFU,可运行 `npm install -g --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.5`,以后用 `afu` 代替完整的 `npx` 命令。例如,`afu ui` 打开面板,`afu ui --prices ./afu-prices.json` 使用自己的单价文件估算费用。
114
+ 如果经常使用 AFU,可运行 `npm install -g --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.6`,以后用 `afu` 代替完整的 `npx` 命令。例如,`afu ui` 打开面板,`afu ui --prices ./afu-prices.json` 使用自己的单价文件估算费用。
115
115
 
116
116
  ## 升级与移除
117
117
 
118
118
  升级 Claude Code 或 Codex 接入后,新开会话即可使用新版网关。需要移除时,先撤销对应宿主的接入,再重启宿主。以下两条命令分别用于升级和移除。
119
119
 
120
120
  ```sh
121
- npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.5 upgrade codex
122
- npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.5 remove codex
121
+ npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.6 upgrade codex
122
+ npx --yes --registry=https://registry.npmjs.org @liwu1995/afu-context@0.1.6 remove codex
123
123
  ```
124
124
 
125
125
  Pi 和 DSH 可分别用 `remove pi` 或 `remove dsh` 撤销。Windows PowerShell 请使用 `npx.cmd` 并将包名放在双引号中。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liwu1995/afu-context",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "description": "Local asynchronous context compression and diagnostics",
package/release.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
- "version": "0.1.5",
3
- "build": "9211426113913a6035cb91ef91d2bdb420342298b4994abf214dbfd0fd1ed521",
4
- "wheel": "afu_context_local-0.1.5-py3-none-any.whl",
2
+ "version": "0.1.6",
3
+ "build": "5a12cd02f9fbe6ffbf4989e8ef5932a0456a9deadee5d03af0490f02fabf799a",
4
+ "wheel": "afu_context_local-0.1.6-py3-none-any.whl",
5
5
  "prebuilt": false
6
6
  }
@@ -62,7 +62,8 @@ export class HostCompactPool {
62
62
  throw new Error("Host binding requires the local worker factory");
63
63
  if (factory < 0)
64
64
  args.push("--factory", "afu_context.local_worker:create_plugin");
65
- const client = new CompactWorkerClient({ ...this.options, timeoutMs: this.options.timeoutMs ?? 150_000, args, env: {
65
+ // Above the 600 s background summary limit, so the worker reports its own timeout.
66
+ const client = new CompactWorkerClient({ ...this.options, timeoutMs: this.options.timeoutMs ?? 630_000, args, env: {
66
67
  ...this.options.env,
67
68
  ...(binding.contextWindow === undefined ? {} : { AFU_CONTEXT_WINDOW: String(binding.contextWindow) }),
68
69
  AFU_HOST_SUMMARY_URL: `${this.base}/${this.capability}/${binding.key}`,