@henryqw/pi-multi-codex 0.3.17 → 0.3.19

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
@@ -2,6 +2,8 @@
2
2
 
3
3
  Use multiple ChatGPT Codex OAuth accounts in Pi.
4
4
 
5
+ ![Pi showing Codex account quotas and the active footer slot](./example.png)
6
+
5
7
  ## Why
6
8
 
7
9
  - **Created for**: Use multiple ChatGPT Codex OAuth accounts from one Pi installation.
@@ -3,6 +3,7 @@ import { readFileSync } from "node:fs";
3
3
  import { chmod, mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
4
4
  import { join } from "node:path";
5
5
  import { setTimeout as delay } from "node:timers/promises";
6
+ import { extensionConfigDir } from "@henryqw/pi-config-store";
6
7
  import { lock } from "proper-lockfile";
7
8
  import {
8
9
  createAssistantMessageEventStream,
@@ -82,7 +83,7 @@ const HEARTBEAT_MS = 5_000;
82
83
  const OPERATION_TIMEOUT_MS = 10_000;
83
84
  const CACHE_MUTEX_RETRY_MS = 20;
84
85
  const CLEANUP_TIMEOUT_MS = 250;
85
- const cachePath = () => join(getAgentDir(), "config", "pi-multi-codex", "usage.json");
86
+ const cachePath = () => join(extensionConfigDir("pi-multi-codex"), "usage.json");
86
87
  const cacheMutexPath = () => `${cachePath()}.mutex`;
87
88
 
88
89
  function isRecord(value: unknown): value is JsonRecord {
@@ -249,7 +250,7 @@ async function saveState(state: UsageState, signal?: AbortSignal): Promise<void>
249
250
  signal?.throwIfAborted();
250
251
  if (state.untrusted) return;
251
252
  const file = cachePath();
252
- const directory = join(getAgentDir(), "config", "pi-multi-codex");
253
+ const directory = extensionConfigDir("pi-multi-codex");
253
254
  await mkdir(directory, { recursive: true, mode: 0o700 });
254
255
  const data = `${JSON.stringify({
255
256
  slots: [...state.slots.values()].sort((a, b) => a.slot - b.slot),
@@ -269,7 +270,7 @@ async function saveState(state: UsageState, signal?: AbortSignal): Promise<void>
269
270
 
270
271
  async function withCacheMutex<T>(operation: (signal: AbortSignal) => Promise<T>, signal?: AbortSignal): Promise<T> {
271
272
  signal?.throwIfAborted();
272
- await mkdir(join(getAgentDir(), "config", "pi-multi-codex"), { recursive: true, mode: 0o700 });
273
+ await mkdir(extensionConfigDir("pi-multi-codex"), { recursive: true, mode: 0o700 });
273
274
  let release: (() => Promise<void>) | undefined;
274
275
  while (!release) {
275
276
  signal?.throwIfAborted();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@henryqw/pi-multi-codex",
3
- "version": "0.3.17",
3
+ "version": "0.3.19",
4
4
  "description": "Use multiple ChatGPT Codex OAuth accounts in Pi.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -29,11 +29,11 @@
29
29
  },
30
30
  "repository": {
31
31
  "type": "git",
32
- "url": "git+https://github.com/HenryQW/pi-packages.git",
33
- "directory": "packages/pi-multi-codex"
32
+ "url": "git+https://github.com/HenryQW/pi-harness.git",
33
+ "directory": "extensions/pi-multi-codex"
34
34
  },
35
35
  "bugs": {
36
- "url": "https://github.com/HenryQW/pi-packages/issues"
36
+ "url": "https://github.com/HenryQW/pi-harness/issues"
37
37
  },
38
38
  "publishConfig": {
39
39
  "access": "public"
@@ -41,9 +41,11 @@
41
41
  "pi": {
42
42
  "extensions": [
43
43
  "./extensions"
44
- ]
44
+ ],
45
+ "image": "https://raw.githubusercontent.com/HenryQW/pi-harness/main/extensions/pi-multi-codex/example.png"
45
46
  },
46
47
  "dependencies": {
48
+ "@henryqw/pi-config-store": "^0.1.0",
47
49
  "proper-lockfile": "^4.1.2"
48
50
  },
49
51
  "devDependencies": {