pi-keyboard 0.1.7 → 0.1.9

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Frad LEE
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -32,7 +32,10 @@ Supports discrete control for keyboard lighting channels:
32
32
  ## Shared Directory Session Registry
33
33
 
34
34
  Per-session glow records use pi-kit’s canonical directory identity, hashed into
35
- the registry directory name. Existing paths are resolved through `realpath`,
35
+ the registry directory name. The registry location also comes from pi-kit, so
36
+ `PI_DIRECTORY_SESSIONS_DIR`, `PI_CODING_AGENT_DIR`, and `PI_AGENT_DIR` point every
37
+ writer in this process at one directory instead of splitting the registry. Existing
38
+ paths are resolved through `realpath`,
36
39
  while missing paths use their absolute path; this keeps slash-versus-hyphen
37
40
  project names separate. Reads, cleanup, and clean shutdown verify the stored
38
41
  `cwd` belongs to the requested directory. Older registry directory names are
@@ -120,3 +123,7 @@ Settings are saved in `~/.pi/agent/keyboard.json`:
120
123
  "saveToEeprom": false
121
124
  }
122
125
  ```
126
+
127
+ ## License
128
+
129
+ MIT
package/README.zh-CN.md CHANGED
@@ -30,6 +30,8 @@
30
30
  ## 共享目录会话注册表
31
31
 
32
32
  每个会话的灯光记录使用 pi-kit 的规范目录身份,并将其哈希为注册表目录名。
33
+ 注册表位置同样来自 pi-kit:`PI_DIRECTORY_SESSIONS_DIR`、`PI_CODING_AGENT_DIR` 与
34
+ `PI_AGENT_DIR` 会让本进程内的所有写入方指向同一个目录,而不会把注册表分成两处。
33
35
  已存在的路径通过 `realpath` 解析,不存在的路径使用绝对路径,因此仅以斜杠和连字符
34
36
  区分的项目不会碰撞。读取、清理和正常退出删除记录前都会核验记录中的 `cwd` 属于请求的
35
37
  目录;旧目录名不会迁移。
@@ -168,3 +168,9 @@ Feature: Pi Keyboard Lighting Indicator
168
168
  Scenario: Keyboard state notifications use Pi's native notification surface
169
169
  Given the keyboard extension reports an interactive command outcome
170
170
  Then it uses ctx.ui.notify without a custom notification renderer
171
+
172
+ Scenario: The glow registry follows the shared agent directory
173
+ Given PI_CODING_AGENT_DIR or PI_AGENT_DIR points outside the default home registry
174
+ When a session writes its glow record
175
+ Then it writes to that directory
176
+ And it resolves the same directory as every other registry writer
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-keyboard",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "Dynamic VIA/QMK keyboard RGB lighting indicator reflecting Pi states (idle, thinking, unread, need-approval, error)",
5
5
  "author": "Frad LEE <fradser@gmail.com>",
6
6
  "license": "MIT",
@@ -38,6 +38,6 @@
38
38
  "@earendil-works/pi-tui": "*"
39
39
  },
40
40
  "dependencies": {
41
- "@fradser/pi-kit": "0.5.0"
41
+ "@fradser/pi-kit": "0.6.0"
42
42
  }
43
- }
43
+ }
@@ -1,7 +1,6 @@
1
1
  import fs from "node:fs";
2
- import os from "node:os";
3
2
  import path from "node:path";
4
- import { getDirectorySessionKey, isSameDirectory } from "@fradser/pi-kit";
3
+ import { directorySessionsDir, getDirectorySessionKey, isSameDirectory } from "@fradser/pi-kit";
5
4
  import type { KeyboardState } from "./types";
6
5
 
7
6
  export interface SessionGlowRecord {
@@ -14,11 +13,10 @@ export interface SessionGlowRecord {
14
13
  }
15
14
 
16
15
  export function getRegistryDir(): string {
17
- // Test seam: allow pointing at an isolated registry so tests never touch the
18
- // real ~/.pi/agent/directory-sessions directory.
19
- const override = process.env.PI_DIRECTORY_SESSIONS_DIR;
20
- if (override) return override;
21
- return path.join(os.homedir(), ".pi", "agent", "directory-sessions");
16
+ // pi-kit owns the shared location: its PI_DIRECTORY_SESSIONS_DIR override is the
17
+ // test seam, and the agent-directory overrides must agree with every other
18
+ // registry writer, or a sandboxed session splits the registry in two.
19
+ return directorySessionsDir();
22
20
  }
23
21
 
24
22
  /** Shared directory-session key used by every registry writer and reader. */