codex-blocker 0.1.1 → 0.1.3
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 +12 -9
- package/dist/bin.js +9 -2
- package/dist/chunk-ZDUKZXM4.js +1140 -0
- package/dist/server.d.ts +44 -2
- package/dist/server.js +5 -1
- package/package.json +4 -1
- package/dist/chunk-SOAB3RMQ.js +0 -574
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# codex-blocker
|
|
2
2
|
|
|
3
|
-
CLI tool and server for Codex Blocker
|
|
3
|
+
CLI tool and server for Codex Blocker -- block distracting websites unless Codex is actively running.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -41,17 +41,19 @@ npx codex-blocker --version
|
|
|
41
41
|
|
|
42
42
|
## How It Works
|
|
43
43
|
|
|
44
|
-
1. **Codex sessions**
|
|
45
|
-
to detect activity. It marks a session
|
|
46
|
-
|
|
44
|
+
1. **Codex sessions** -- The server tails Codex session logs under `~/.codex/sessions`
|
|
45
|
+
to detect activity. It marks a session "working" on your prompt and on intermediate
|
|
46
|
+
assistant/tool activity, marks `waiting_for_input` when Codex emits
|
|
47
|
+
`request_user_input`, and marks "idle" when it sees a terminal assistant reply
|
|
48
|
+
(`phase: "final_answer"`), with legacy fallback support for older Codex logs.
|
|
47
49
|
|
|
48
|
-
2. **Server**
|
|
50
|
+
2. **Server** -- Runs on localhost and:
|
|
49
51
|
- Tracks active Codex sessions
|
|
50
52
|
- Marks sessions "working" when new log lines arrive
|
|
51
53
|
- Broadcasts state via WebSocket to the Chrome extension
|
|
52
54
|
|
|
53
|
-
3. **Extension**
|
|
54
|
-
- Blocks configured sites when no sessions are working
|
|
55
|
+
3. **Extension** -- Connects to the server and:
|
|
56
|
+
- Blocks configured sites when no sessions are working, or when any session is waiting for user input
|
|
55
57
|
- Shows a modal overlay (soft block, not network block)
|
|
56
58
|
- Updates in real-time without page refresh
|
|
57
59
|
|
|
@@ -72,14 +74,15 @@ Connect to `ws://localhost:8765/ws` to receive real-time state updates:
|
|
|
72
74
|
"type": "state",
|
|
73
75
|
"blocked": true,
|
|
74
76
|
"sessions": 1,
|
|
75
|
-
"working": 0
|
|
77
|
+
"working": 0,
|
|
78
|
+
"waitingForInput": 1
|
|
76
79
|
}
|
|
77
80
|
```
|
|
78
81
|
|
|
79
82
|
## Programmatic Usage
|
|
80
83
|
|
|
81
84
|
```typescript
|
|
82
|
-
import { startServer } from
|
|
85
|
+
import { startServer } from "codex-blocker";
|
|
83
86
|
|
|
84
87
|
// Start on default port (8765)
|
|
85
88
|
startServer();
|
package/dist/bin.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
DEFAULT_PORT,
|
|
4
4
|
startServer
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-ZDUKZXM4.js";
|
|
6
6
|
|
|
7
7
|
// src/bin.ts
|
|
8
8
|
import { createRequire } from "module";
|
|
@@ -43,6 +43,10 @@ function removeCodexSetup() {
|
|
|
43
43
|
var require2 = createRequire(import.meta.url);
|
|
44
44
|
var { version } = require2("../package.json");
|
|
45
45
|
var args = process.argv.slice(2);
|
|
46
|
+
function isWindowsOrWslRuntime() {
|
|
47
|
+
if (process.platform === "win32") return true;
|
|
48
|
+
return Boolean(process.env.WSL_DISTRO_NAME || process.env.WSL_INTEROP);
|
|
49
|
+
}
|
|
46
50
|
function prompt(question) {
|
|
47
51
|
const rl = createInterface({
|
|
48
52
|
input: process.stdin,
|
|
@@ -109,6 +113,9 @@ async function main() {
|
|
|
109
113
|
console.log("");
|
|
110
114
|
}
|
|
111
115
|
}
|
|
112
|
-
startServer(port
|
|
116
|
+
startServer(port, {
|
|
117
|
+
mobile: false,
|
|
118
|
+
bindHost: isWindowsOrWslRuntime() ? "0.0.0.0" : "127.0.0.1"
|
|
119
|
+
});
|
|
113
120
|
}
|
|
114
121
|
main();
|