@simonesiega/codex-limits 0.1.6 → 1.0.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/.env.example +3 -0
- package/CHANGELOG.md +25 -0
- package/CONTRIBUTING.md +226 -0
- package/README.md +67 -37
- package/SECURITY.md +52 -16
- package/dist/cli.js +152 -136
- package/dist/copilot.mjs +5 -0
- package/dist/opencode.js +5 -0
- package/dist/pi.js +3 -3
- package/docs/README.md +67 -0
- package/docs/examples/codex-limits-output.example.json +63 -0
- package/docs/photos/agents/copilot/copilot_result.png +0 -0
- package/docs/readme/agent-integrations.md +81 -0
- package/docs/readme/agents/copilot.md +147 -0
- package/docs/readme/agents/opencode.md +126 -0
- package/docs/readme/agents/pi.md +143 -0
- package/docs/readme/compatibility.md +143 -0
- package/docs/readme/json-output.md +295 -0
- package/docs/schema/codex-limits.schema.json +183 -0
- package/package.json +7 -4
- package/dist/index.js +0 -5
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# GitHub Copilot CLI integration
|
|
2
|
+
|
|
3
|
+
[← Documentation hub](../../README.md) · [Agent integrations](../agent-integrations.md) · [Project README](../../../README.md)
|
|
4
|
+
|
|
5
|
+
The GitHub Copilot CLI integration adds a read-only `/codex-limits` extension command that loads the shared core locally and displays Codex usage windows, reset times, reset credits, and safe warnings without sending a prompt or limit data to the LLM.
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
| Detail | Value |
|
|
10
|
+
| ------------------ | ------------------------------------- |
|
|
11
|
+
| Agent | [GitHub Copilot CLI][copilot-cli] |
|
|
12
|
+
| Status | Supported |
|
|
13
|
+
| Agent command | `/codex-limits` |
|
|
14
|
+
| Install command | `codex-limits agents install copilot` |
|
|
15
|
+
| Installation scope | Global for the current user |
|
|
16
|
+
| Host API | Experimental Copilot CLI extensions |
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
Install GitHub Copilot CLI and `codex-limits`, then run the named installer:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install -g @github/copilot@latest
|
|
24
|
+
npm install -g @simonesiega/codex-limits@latest
|
|
25
|
+
codex-limits agents install copilot
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Other official Copilot CLI installation methods are documented in [Installing GitHub Copilot CLI][copilot-install]. The explicit agent name works in interactive and non-interactive terminals. The compatible `codex-limits init --copilot` form is also supported.
|
|
29
|
+
|
|
30
|
+
Restart GitHub Copilot CLI after installation so it discovers the extension. Use Copilot CLI's `/extensions` command to review or re-enable extensions when extension loading is disabled in the host.
|
|
31
|
+
|
|
32
|
+
### Extension file
|
|
33
|
+
|
|
34
|
+
The installer writes one user-scoped extension entry point:
|
|
35
|
+
|
|
36
|
+
```text
|
|
37
|
+
~/.copilot/extensions/codex-limits/extension.mjs
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
When `COPILOT_HOME` is set, the installer uses `extensions/codex-limits/extension.mjs` under that directory instead. The `codex-limits` subdirectory gives the extension its host-visible name.
|
|
41
|
+
|
|
42
|
+
The published package contains the bundled source at `dist/copilot.mjs`. The installer copies that bundle to the ESM `extension.mjs` entry point. GitHub Copilot CLI starts it as a separate Node.js process and supplies `@github/copilot-sdk/extension` through its extension module resolver; users do not install the SDK separately.
|
|
43
|
+
|
|
44
|
+
The installer:
|
|
45
|
+
|
|
46
|
+
- creates the dedicated extension directory when it is missing;
|
|
47
|
+
- validates the package identity, bounded bundle, and stable extension marker before copying;
|
|
48
|
+
- updates an older extension managed by `codex-limits` and leaves unrelated files in the directory unchanged;
|
|
49
|
+
- reports `already installed` when the installed bundle is current;
|
|
50
|
+
- writes through an owner-only sibling temporary file to avoid a partial entry point;
|
|
51
|
+
- refuses to overwrite an existing entry point that is not marked as the Codex Limits extension;
|
|
52
|
+
- refuses a competing `extension.cjs` or `extension.js` entry point in the dedicated directory;
|
|
53
|
+
- refuses symbolic-link, non-file, unreadable, or oversized entry points.
|
|
54
|
+
|
|
55
|
+
Extension and package manifest reads are bounded. Extension files larger than 5 MB are not modified. Installation output shortens paths under the user home to `~/...` and displays unexpected paths outside it as `[path]`.
|
|
56
|
+
|
|
57
|
+
## Using `/codex-limits`
|
|
58
|
+
|
|
59
|
+
Start a new interactive Copilot CLI session, then invoke:
|
|
60
|
+
|
|
61
|
+
```text
|
|
62
|
+
/codex-limits
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
> [!IMPORTANT]
|
|
66
|
+
> Run the command only inside Copilot CLI's interactive interface. Do not use `copilot -p "/codex-limits"`; prompt mode can treat that text as an LLM prompt instead of dispatching the extension command.
|
|
67
|
+
|
|
68
|
+
The extension logs a compact limits summary directly to the Copilot CLI timeline, including:
|
|
69
|
+
|
|
70
|
+
- remaining capacity and status for the weekly window;
|
|
71
|
+
- the 5-hour window when supplied by Codex;
|
|
72
|
+
- compact progress bars and reset durations;
|
|
73
|
+
- available reset credits and the next expiration;
|
|
74
|
+
- safe warnings when some data is unavailable.
|
|
75
|
+
|
|
76
|
+
The slash-command handler calls the shared local core directly. It does not call `session.send()`, create a user message, or ask the model to process the request. Loading and timeline failures are reduced to static safe messages instead of exposing raw filesystem, credential, or network details.
|
|
77
|
+
|
|
78
|
+
## Compatibility
|
|
79
|
+
|
|
80
|
+
Copilot CLI extensions are an experimental host feature and may change. The bundled ESM entry point follows the current extension contract:
|
|
81
|
+
|
|
82
|
+
- it is installed as `extension.mjs` in an immediate child of the user extensions directory;
|
|
83
|
+
- it imports the CLI-provided SDK from `@github/copilot-sdk/extension`;
|
|
84
|
+
- it calls `joinSession()` and registers `codex-limits` through the session `commands` option;
|
|
85
|
+
- it uses `session.log()` for timeline output because extension standard output is reserved for JSON-RPC.
|
|
86
|
+
|
|
87
|
+
The adapter is type-checked against `@github/copilot-sdk` 1.0.8. Automated tests mock command registration, timeline output, safe failures, and installation behavior, while packed-package validation confirms that the bundled artifact is shipped and copied to the correct user extension path. The repository does not currently claim terminal-level validation against an exact Copilot CLI release.
|
|
88
|
+
|
|
89
|
+
Keep GitHub Copilot CLI current when using the integration. See the general [Compatibility guide](../compatibility.md) and the SDK's [extension documentation][copilot-extension-docs] for the evolving host contract.
|
|
90
|
+
|
|
91
|
+
## Re-running or removing the integration
|
|
92
|
+
|
|
93
|
+
Running `codex-limits agents install copilot` again is safe. It reports `already installed` when the installed entry point matches the current package and replaces only a previously managed older bundle.
|
|
94
|
+
|
|
95
|
+
There is no `codex-limits` uninstall command. To remove the integration, delete only this dedicated directory, then restart Copilot CLI:
|
|
96
|
+
|
|
97
|
+
```text
|
|
98
|
+
~/.copilot/extensions/codex-limits
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Use the equivalent path under `COPILOT_HOME` when that variable is set. Do not remove unrelated Copilot configuration or extension directories.
|
|
102
|
+
|
|
103
|
+
## Troubleshooting
|
|
104
|
+
|
|
105
|
+
### The command does not appear
|
|
106
|
+
|
|
107
|
+
1. Run `codex-limits agents install copilot` again.
|
|
108
|
+
2. Confirm that it reports `extension.mjs` as installed or already installed.
|
|
109
|
+
3. Restart GitHub Copilot CLI completely.
|
|
110
|
+
4. Run `/extensions` and confirm that `codex-limits` is discovered and enabled.
|
|
111
|
+
5. Check that a project-local `.github/extensions/codex-limits/extension.mjs` is not shadowing the user extension with the same name.
|
|
112
|
+
6. Update Copilot CLI if the installed release does not support experimental extensions and session commands.
|
|
113
|
+
|
|
114
|
+
### The extension path is already in use
|
|
115
|
+
|
|
116
|
+
The installer found an `extension.mjs` that is not marked as a bundle managed by `codex-limits`, or it found a competing `extension.cjs` or `extension.js`, so it left the directory unchanged. Review the dedicated `codex-limits` extension directory manually. Move or remove only the conflicting entry point if you are certain it is unrelated, then run the installer again.
|
|
117
|
+
|
|
118
|
+
### The integration bundle is unavailable
|
|
119
|
+
|
|
120
|
+
Reinstall or rebuild `@simonesiega/codex-limits`, then run the installer again. Published packages include `dist/copilot.mjs`; source checkouts create it with `bun run build`.
|
|
121
|
+
|
|
122
|
+
### Limits cannot be loaded
|
|
123
|
+
|
|
124
|
+
Run `codex-limits doctor` and `codex-limits status` outside Copilot CLI. If data is also unavailable there, verify Codex authentication, local data discovery, and network access.
|
|
125
|
+
|
|
126
|
+
## Data and privacy
|
|
127
|
+
|
|
128
|
+
The integration follows the safety guarantees defined for [all agent integrations](../agent-integrations.md#data-and-privacy). It does not send a prompt or Codex limit data to the LLM, and displayed output excludes sensitive credentials, private paths, and raw local data.
|
|
129
|
+
|
|
130
|
+
Copilot CLI extensions execute as separate processes with the current user's system permissions. Install only extensions you trust. The Codex Limits extension registers one read-only slash command and does not register tools, hooks, or account-mutation behavior.
|
|
131
|
+
|
|
132
|
+
## Related documentation
|
|
133
|
+
|
|
134
|
+
- [Agent integrations](../agent-integrations.md) — Supported-agent index and behavior shared by every adapter.
|
|
135
|
+
- [Compatibility](../compatibility.md) — Runtime, operating-system, terminal, network, and agent compatibility.
|
|
136
|
+
- [JSON output](../json-output.md) — Machine-readable output, fields, warnings, and scripting behavior.
|
|
137
|
+
- [Security policy](../../../SECURITY.md) — Local-data safeguards, network behavior, and vulnerability reporting.
|
|
138
|
+
- [GitHub Copilot CLI][copilot-cli] — Official CLI repository.
|
|
139
|
+
- [Copilot CLI documentation][copilot-docs] — Official concepts and usage documentation.
|
|
140
|
+
- [Copilot SDK extension documentation][copilot-extension-docs] — Current experimental extension lifecycle and API.
|
|
141
|
+
- [Documentation hub](../../README.md) — Task-oriented index for CLI, automation, agent, development, and security guides.
|
|
142
|
+
- [Project README](../../../README.md) — Product overview, installation, commands, configuration, and troubleshooting.
|
|
143
|
+
|
|
144
|
+
[copilot-cli]: https://github.com/github/copilot-cli
|
|
145
|
+
[copilot-docs]: https://docs.github.com/en/copilot/concepts/agents/about-copilot-cli
|
|
146
|
+
[copilot-install]: https://docs.github.com/en/copilot/how-tos/copilot-cli/set-up-copilot-cli/install-copilot-cli
|
|
147
|
+
[copilot-extension-docs]: https://github.com/github/copilot-sdk/blob/main/nodejs/docs/extensions.md
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# OpenCode integration
|
|
2
|
+
|
|
3
|
+
[← Documentation hub](../../README.md) · [Agent integrations](../agent-integrations.md) · [Project README](../../../README.md)
|
|
4
|
+
|
|
5
|
+
The OpenCode integration adds a read-only `/codex-limits` command that loads the shared core locally and displays Codex usage windows, reset times, reset credits, and safe warnings without sending a prompt to an LLM.
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
| Detail | Value |
|
|
10
|
+
| ------------------ | -------------------------------------- |
|
|
11
|
+
| Agent | [OpenCode](https://opencode.ai/) |
|
|
12
|
+
| Status | Supported |
|
|
13
|
+
| Agent command | `/codex-limits` |
|
|
14
|
+
| Install command | `codex-limits agents install opencode` |
|
|
15
|
+
| Installation scope | Global for the current user |
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
Install the CLI globally, then run the named installer:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install -g @simonesiega/codex-limits@latest
|
|
23
|
+
codex-limits agents install opencode
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
The explicit agent name works in interactive and non-interactive terminals. The compatible `codex-limits init --opencode` form remains supported. Restart OpenCode after installation so it reloads its configuration.
|
|
27
|
+
|
|
28
|
+
### Configuration files
|
|
29
|
+
|
|
30
|
+
The installer updates both of these global configuration files for the current user:
|
|
31
|
+
|
|
32
|
+
```text
|
|
33
|
+
~/.config/opencode/opencode.json
|
|
34
|
+
~/.config/opencode/tui.json
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
It adds the following package to each file's `plugin` array:
|
|
38
|
+
|
|
39
|
+
```json
|
|
40
|
+
"@simonesiega/codex-limits"
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Both files are updated because compatible OpenCode versions discover TUI plugins through different global configuration files. The installer:
|
|
44
|
+
|
|
45
|
+
- creates a missing configuration as a JSON object with the appropriate OpenCode schema;
|
|
46
|
+
- preserves existing configuration fields and plugin entries;
|
|
47
|
+
- recognizes unversioned, tagged, pinned, and tuple forms of the package and does not add duplicates;
|
|
48
|
+
- writes changed files through a sibling temporary file to avoid partial JSON;
|
|
49
|
+
- refuses symbolic-link configuration files instead of following or replacing the link;
|
|
50
|
+
- refuses to modify malformed, non-object, oversized, or invalid `plugin` configurations.
|
|
51
|
+
|
|
52
|
+
Configuration files larger than 1 MB are not modified. If one file is already configured and the other is not, only the missing plugin registration is added. Installation results shorten paths under the user home to `~/...`; unexpected paths outside the home are displayed as `[path]`.
|
|
53
|
+
|
|
54
|
+
## Using `/codex-limits`
|
|
55
|
+
|
|
56
|
+
Restart OpenCode after installation, then run:
|
|
57
|
+
|
|
58
|
+
```text
|
|
59
|
+
/codex-limits
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
<p align="center">
|
|
63
|
+
<img
|
|
64
|
+
src="../../photos/agents/opencode/opencode_result.png"
|
|
65
|
+
alt="Codex Limits modal running inside OpenCode"
|
|
66
|
+
width="740"
|
|
67
|
+
/>
|
|
68
|
+
</p>
|
|
69
|
+
|
|
70
|
+
OpenCode opens a modal dialog, loads the shared core directly, and displays:
|
|
71
|
+
|
|
72
|
+
- remaining capacity and status for the weekly window;
|
|
73
|
+
- the 5-hour window when it is supplied by the usage service;
|
|
74
|
+
- reset durations;
|
|
75
|
+
- available reset credits and the next expiration;
|
|
76
|
+
- safe warnings when some data is unavailable.
|
|
77
|
+
|
|
78
|
+
Loading failures are reduced to a static safe error instead of exposing raw filesystem, credential, or network details.
|
|
79
|
+
|
|
80
|
+
## Compatibility
|
|
81
|
+
|
|
82
|
+
The adapter supports OpenCode hosts that expose either:
|
|
83
|
+
|
|
84
|
+
- the current keymap layer registration API; or
|
|
85
|
+
- the legacy command registration API.
|
|
86
|
+
|
|
87
|
+
Compatibility is determined from the API shape available at runtime rather than from a list of exact OpenCode versions. Automated adapter tests use host mocks for both supported API shapes; the repository does not currently claim end-to-end validation against named OpenCode releases.
|
|
88
|
+
|
|
89
|
+
See the general [Compatibility guide](../compatibility.md) for tested runtimes, operating systems, terminals, and network behavior.
|
|
90
|
+
|
|
91
|
+
## Re-running or removing the integration
|
|
92
|
+
|
|
93
|
+
Running `codex-limits agents install opencode` again is safe. It reports `already installed` when both configuration files already contain the package.
|
|
94
|
+
|
|
95
|
+
There is no uninstall command. To remove the integration, delete every `@simonesiega/codex-limits` entry from the `plugin` arrays in both OpenCode configuration files, then restart OpenCode. Do not remove unrelated plugins or configuration fields.
|
|
96
|
+
|
|
97
|
+
## Troubleshooting
|
|
98
|
+
|
|
99
|
+
### The command does not appear
|
|
100
|
+
|
|
101
|
+
1. Run `codex-limits agents install opencode` again.
|
|
102
|
+
2. Confirm that the reported paths are the OpenCode configuration files used by your installation.
|
|
103
|
+
3. Restart OpenCode completely.
|
|
104
|
+
4. Check that both files contain a JSON `plugin` array with `@simonesiega/codex-limits`.
|
|
105
|
+
|
|
106
|
+
### Setup reports invalid JSON
|
|
107
|
+
|
|
108
|
+
Correct the affected OpenCode configuration before running the installer again. The installer intentionally does not overwrite malformed JSON or replace a non-array `plugin` field.
|
|
109
|
+
|
|
110
|
+
### Limits cannot be loaded
|
|
111
|
+
|
|
112
|
+
Run `codex-limits status` outside OpenCode. If data is also unavailable there, verify Codex authentication, local data discovery, and network access.
|
|
113
|
+
|
|
114
|
+
## Data and privacy
|
|
115
|
+
|
|
116
|
+
The integration follows the safety guarantees defined for [all agent integrations](../agent-integrations.md#data-and-privacy). It does not send a prompt or Codex limit data to an LLM, and displayed output excludes sensitive credentials and raw local data.
|
|
117
|
+
|
|
118
|
+
## Related documentation
|
|
119
|
+
|
|
120
|
+
- [Agent integrations](../agent-integrations.md) — Supported-agent index and behavior shared by every adapter.
|
|
121
|
+
- [Compatibility](../compatibility.md) — Runtime, operating-system, terminal, network, and agent compatibility.
|
|
122
|
+
- [JSON output](../json-output.md) — Machine-readable output, fields, warnings, and scripting behavior.
|
|
123
|
+
- [Security policy](../../../SECURITY.md) — Local-data safeguards, network behavior, and vulnerability reporting.
|
|
124
|
+
- [OpenCode](https://opencode.ai/) — Official agent website.
|
|
125
|
+
- [Documentation hub](../../README.md) — Task-oriented index for CLI, automation, agent, development, and security guides.
|
|
126
|
+
- [Project README](../../../README.md) — Product overview, installation, commands, configuration, and troubleshooting.
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
# pi integration
|
|
2
|
+
|
|
3
|
+
[← Documentation hub](../../README.md) · [Agent integrations](../agent-integrations.md) · [Project README](../../../README.md)
|
|
4
|
+
|
|
5
|
+
The pi integration adds a read-only `/codex-limits` extension command that loads the shared core locally and displays Codex usage windows, reset times, reset credits, and safe warnings without sending a prompt to an LLM.
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
| Detail | Value |
|
|
10
|
+
| ------------------ | -------------------------------- |
|
|
11
|
+
| Agent | [pi](https://pi.dev/) |
|
|
12
|
+
| Status | Supported |
|
|
13
|
+
| Agent command | `/codex-limits` |
|
|
14
|
+
| Install command | `codex-limits agents install pi` |
|
|
15
|
+
| Installation scope | Global for the current user |
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
Install the CLI and pi, then run the named installer:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install -g @simonesiega/codex-limits@latest
|
|
23
|
+
npm install -g @earendil-works/pi-coding-agent@latest
|
|
24
|
+
codex-limits agents install pi
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The explicit agent name works in interactive and non-interactive terminals. The compatible `codex-limits init --pi` form is also supported. Restart pi after installation so it reloads its extensions. An already-running pi session can use `/reload` instead.
|
|
28
|
+
|
|
29
|
+
### Configuration
|
|
30
|
+
|
|
31
|
+
The installer updates pi's global settings file:
|
|
32
|
+
|
|
33
|
+
```text
|
|
34
|
+
~/.pi/agent/settings.json
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
When `PI_CODING_AGENT_DIR` is set, the installer uses `settings.json` under that directory instead. It adds the current Codex Limits package root to the `packages` array. The published package declares this pi manifest:
|
|
38
|
+
|
|
39
|
+
```json
|
|
40
|
+
{
|
|
41
|
+
"pi": {
|
|
42
|
+
"extensions": ["./dist/pi.js"]
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Registering the local package root avoids another download and keeps the extension synchronized with the globally installed `codex-limits` package. The installer also recognizes existing unversioned, tagged, or pinned `npm:@simonesiega/codex-limits` pi package registrations. If a matching object registration filters out the bundled extension, the named installer force-enables only `dist/pi.js` while preserving unrelated resource filters.
|
|
48
|
+
|
|
49
|
+
The installer:
|
|
50
|
+
|
|
51
|
+
- creates a missing settings file as a JSON object;
|
|
52
|
+
- preserves unrelated settings and package registrations;
|
|
53
|
+
- avoids duplicate local and npm package registrations;
|
|
54
|
+
- verifies that the package manifest declares the bundled `dist/pi.js` extension and that the bundle is available;
|
|
55
|
+
- writes changes through an owner-only sibling temporary file to avoid partial JSON;
|
|
56
|
+
- refuses symbolic-link, malformed, non-object, oversized, or invalid `packages` settings.
|
|
57
|
+
|
|
58
|
+
Settings files larger than 1 MB are not modified. Installation output shortens paths under the user home to `~/...` and displays unexpected paths outside it as `[path]`.
|
|
59
|
+
|
|
60
|
+
Pi's native package command is also supported because the npm package includes the pi manifest:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pi install npm:@simonesiega/codex-limits
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Use either installation method rather than registering the package twice.
|
|
67
|
+
|
|
68
|
+
## Using `/codex-limits`
|
|
69
|
+
|
|
70
|
+
Restart pi or run `/reload`, then invoke:
|
|
71
|
+
|
|
72
|
+
```text
|
|
73
|
+
/codex-limits
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
The extension loads the shared core directly and opens a themed overlay containing:
|
|
77
|
+
|
|
78
|
+
- remaining capacity and status for the weekly window;
|
|
79
|
+
- the 5-hour window when supplied by Codex;
|
|
80
|
+
- compact progress bars and reset durations;
|
|
81
|
+
- available reset credits and the next expiration;
|
|
82
|
+
- safe warnings when some data is unavailable.
|
|
83
|
+
|
|
84
|
+
Press Enter, Escape, or Ctrl+C to close the overlay. While data loads, the extension shows a temporary footer status. Loading and display failures are reduced to static safe messages instead of exposing raw filesystem, credential, or network details.
|
|
85
|
+
|
|
86
|
+
The command is interactive-TUI-only. In pi RPC, print, and JSON modes, it performs no lookup and sends no message to the model.
|
|
87
|
+
|
|
88
|
+
## Compatibility
|
|
89
|
+
|
|
90
|
+
The adapter uses pi's extension APIs for command registration, footer status, notifications, and custom overlays. It is developed against `@earendil-works/pi-coding-agent` and `@earendil-works/pi-tui` 0.81.x. Those host packages are optional peers and are not bundled into `codex-limits`.
|
|
91
|
+
|
|
92
|
+
Pi 0.81.x requires Node.js 22.19 or newer. This requirement applies to the pi host; the standalone `codex-limits` CLI continues to support Node.js 20 or newer. Automated tests use extension-host mocks and the real pi TUI component classes. Local validation also confirmed package discovery and command interception with pi 0.81.1 in print mode, without invoking the model; the interactive overlay is not terminal-tested against every pi release.
|
|
93
|
+
|
|
94
|
+
See the general [Compatibility guide](../compatibility.md) for tested runtimes, operating systems, terminals, and network behavior.
|
|
95
|
+
|
|
96
|
+
## Re-running or removing the integration
|
|
97
|
+
|
|
98
|
+
Running `codex-limits agents install pi` again is safe. It reports `already installed` when the matching local or npm package registration is already enabled.
|
|
99
|
+
|
|
100
|
+
There is no `codex-limits` uninstall command. To remove an integration installed by the named installer, delete only the Codex Limits package entry from the global pi `packages` array, then restart pi or run `/reload`. If it was installed with pi's native package manager, use:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
pi remove npm:@simonesiega/codex-limits
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Do not remove unrelated pi packages or settings.
|
|
107
|
+
|
|
108
|
+
## Troubleshooting
|
|
109
|
+
|
|
110
|
+
### The command does not appear
|
|
111
|
+
|
|
112
|
+
1. Run `codex-limits agents install pi` again.
|
|
113
|
+
2. Confirm that it reports the pi settings file as installed or already installed.
|
|
114
|
+
3. Restart pi or run `/reload`.
|
|
115
|
+
4. Check that the global `packages` array contains the Codex Limits local package path or `npm:@simonesiega/codex-limits`.
|
|
116
|
+
|
|
117
|
+
### Setup reports invalid JSON
|
|
118
|
+
|
|
119
|
+
Correct the affected pi settings before running the installer again. The installer intentionally does not overwrite malformed JSON or replace an invalid `packages` field.
|
|
120
|
+
|
|
121
|
+
### The integration bundle is unavailable
|
|
122
|
+
|
|
123
|
+
Reinstall or rebuild `@simonesiega/codex-limits`, then run the installer again. Published packages include `dist/pi.js`; source checkouts create it with `bun run build`.
|
|
124
|
+
|
|
125
|
+
### Limits cannot be loaded
|
|
126
|
+
|
|
127
|
+
Run `codex-limits doctor` and `codex-limits status` outside pi. If data is also unavailable there, verify Codex authentication, local data discovery, and network access.
|
|
128
|
+
|
|
129
|
+
## Data and privacy
|
|
130
|
+
|
|
131
|
+
The integration follows the safety guarantees defined for [all agent integrations](../agent-integrations.md#data-and-privacy). It does not send a prompt or Codex limit data to an LLM, and displayed output excludes sensitive credentials, private paths, and raw local data.
|
|
132
|
+
|
|
133
|
+
Pi extensions execute with the current user's system permissions. Install only packages you trust, as described in pi's own extension security guidance.
|
|
134
|
+
|
|
135
|
+
## Related documentation
|
|
136
|
+
|
|
137
|
+
- [Agent integrations](../agent-integrations.md) — Supported-agent index and behavior shared by every adapter.
|
|
138
|
+
- [Compatibility](../compatibility.md) — Runtime, operating-system, terminal, network, and agent compatibility.
|
|
139
|
+
- [JSON output](../json-output.md) — Machine-readable output, fields, warnings, and scripting behavior.
|
|
140
|
+
- [Security policy](../../../SECURITY.md) — Local-data safeguards, network behavior, and vulnerability reporting.
|
|
141
|
+
- [pi](https://pi.dev/) — Official agent website.
|
|
142
|
+
- [Documentation hub](../../README.md) — Task-oriented index for CLI, automation, agent, development, and security guides.
|
|
143
|
+
- [Project README](../../../README.md) — Product overview, installation, commands, configuration, and troubleshooting.
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
# Compatibility
|
|
2
|
+
|
|
3
|
+
[← Documentation hub](../README.md) · [Project README](../../README.md)
|
|
4
|
+
|
|
5
|
+
This page describes the runtime, operating-system, Codex data, network, terminal, and agent compatibility implemented by the current codebase.
|
|
6
|
+
|
|
7
|
+
## Runtime and installation
|
|
8
|
+
|
|
9
|
+
| Environment | Support |
|
|
10
|
+
| ------------------- | ------------------------------------------------------- |
|
|
11
|
+
| Published CLI | Node.js 20 or newer |
|
|
12
|
+
| Package format | ESM, bundled for Node.js |
|
|
13
|
+
| Global installation | npm (`npm install -g @simonesiega/codex-limits@latest`) |
|
|
14
|
+
| Source development | Bun 1.3.14, as declared in `package.json` |
|
|
15
|
+
| TypeScript target | ES2022 |
|
|
16
|
+
|
|
17
|
+
Bun is used for dependency management, tests, development commands, and production builds. It is not required to run the published CLI. Runtime dependencies are bundled into `dist`, so the published package does not declare separate production dependencies.
|
|
18
|
+
|
|
19
|
+
The root package module resolves to the agent-specific `dist/opencode.js` bundle for the OpenCode plugin loader. Its public module contract consists of a default plugin export and the named `tui` export; the internal core modules are not public package exports. Pi loads the separate `dist/pi.js` extension declared in the package's `pi.extensions` manifest. The GitHub Copilot CLI installer copies the separate `dist/copilot.mjs` bundle to a recognized user extension entry point.
|
|
20
|
+
|
|
21
|
+
## Tested environments
|
|
22
|
+
|
|
23
|
+
The following environments are covered by the repository's automated checks or current local validation. Other compatible environments may also work, but they are not tested for every release.
|
|
24
|
+
|
|
25
|
+
| Area | Tested environments |
|
|
26
|
+
| ---------------------- | ------------------------------------------------------------------------------------------------------------------ |
|
|
27
|
+
| Automated packaged CLI | GitHub Actions on `ubuntu-latest` with Node.js 20, 22, and 24, plus `windows-latest` with Node.js 20 |
|
|
28
|
+
| Current local checks | Windows build `10.0.26200.8875` with Node.js 22.20.0 and Bun 1.3.14 (verified 2026-07-23) |
|
|
29
|
+
| Terminal rendering | Automated Ink rendering and layout tests; no named terminal application is included in the per-release test matrix |
|
|
30
|
+
| OpenCode agent adapter | Mocked current keymap and legacy command API shapes; no exact OpenCode host release is tested end-to-end |
|
|
31
|
+
| pi agent adapter | Mocked command/UI APIs with real TUI components; package discovery validated in pi 0.81.1 print mode |
|
|
32
|
+
| Copilot CLI adapter | Mocked SDK command/timeline APIs and packed installation; typed against `@github/copilot-sdk` 1.0.8 |
|
|
33
|
+
|
|
34
|
+
The supported runtime and operating-system ranges are broader than this test matrix. In particular, macOS compatibility follows the cross-platform implementation but is not currently covered by the repository's automated workflow.
|
|
35
|
+
|
|
36
|
+
## Operating systems
|
|
37
|
+
|
|
38
|
+
The CLI supports Windows, macOS, and Linux through Node's cross-platform filesystem and path APIs.
|
|
39
|
+
|
|
40
|
+
Codex home candidates are checked in this order, skipping missing or unreadable directories and removing duplicates:
|
|
41
|
+
|
|
42
|
+
1. `CODEX_LIMITS_HOME`
|
|
43
|
+
2. `CODEX_HOME`
|
|
44
|
+
3. `~/.codex`
|
|
45
|
+
4. `~/.config/codex`
|
|
46
|
+
5. `~/Library/Application Support/Codex`
|
|
47
|
+
6. `~/Library/Application Support/Parall/Codex/.codex`
|
|
48
|
+
7. `%APPDATA%/Codex`, when `APPDATA` is available
|
|
49
|
+
8. `%LOCALAPPDATA%/Codex`, when `LOCALAPPDATA` is available
|
|
50
|
+
|
|
51
|
+
The `Parall` spelling in candidate 6 matches the constant in `src/package/core/codex/paths.ts` and is covered by the path-generation test. This verifies that the documentation matches the current implementation; it does not claim that every macOS Codex installation uses that directory.
|
|
52
|
+
|
|
53
|
+
`CODEX_LIMITS_HOME` has the highest priority. `CODEX_HOME` is Codex's native override and is used next. Override values must identify readable directories; files and unreadable paths are ignored.
|
|
54
|
+
|
|
55
|
+
The default home directory is resolved from `HOME`, then `USERPROFILE`, then the operating system's home-directory API.
|
|
56
|
+
|
|
57
|
+
## Codex data compatibility
|
|
58
|
+
|
|
59
|
+
For normal use, Codex must have been installed, run, and authenticated at least once. The CLI can use:
|
|
60
|
+
|
|
61
|
+
- live weekly usage and, when supplied, 5-hour usage from the ChatGPT Codex usage endpoint;
|
|
62
|
+
- bounded local `sessions/**/rollout-*.jsonl` data as a usage fallback;
|
|
63
|
+
- recognized bounded JSON state files as an additional local fallback;
|
|
64
|
+
- `auth.json` in the detected Codex home for live request credentials;
|
|
65
|
+
- the paired `CODEX_LIMITS_ACCESS_TOKEN` and `CODEX_LIMITS_ACCOUNT_ID` variables when automatic credential discovery is unavailable.
|
|
66
|
+
|
|
67
|
+
Both credential environment variables are required together. Supplying only one produces an incomplete-authentication warning and does not initiate an authenticated request.
|
|
68
|
+
|
|
69
|
+
Local Codex data is inspected read-only. File traversal, file counts, file sizes, JSONL line sizes, search depth, and response sizes are bounded. Nested symbolic links are skipped. Filesystem warnings do not include relative or absolute Codex paths, and fallback reset-duration strings must use compact duration units before they are normalized. Raw local files, tokens, account IDs, authorization headers, and private paths are excluded from public output.
|
|
70
|
+
|
|
71
|
+
Local state layouts can vary between Codex versions. The parser recognizes common primary/five-hour and secondary/weekly window names and can return partial data when only some fields are understood. For live responses, declared window durations such as `limit_window_seconds` take precedence over legacy primary/secondary slot names, because the usage service can now return weekly usage in `primary_window` without a 5-hour window.
|
|
72
|
+
|
|
73
|
+
## Network compatibility
|
|
74
|
+
|
|
75
|
+
Live data uses these defaults:
|
|
76
|
+
|
|
77
|
+
| Data | Endpoint | Offline behavior |
|
|
78
|
+
| -------------------- | ----------------------------------------------------------------------- | ----------------------------------- |
|
|
79
|
+
| Usage windows | `https://chatgpt.com/backend-api/codex/usage` | Falls back to recognized local data |
|
|
80
|
+
| Reset-credit coupons | `https://chatgpt.com/backend-api/wham/rate-limit-reset-credits` | Reported as unavailable |
|
|
81
|
+
| Coupon redemption | `https://chatgpt.com/backend-api/wham/rate-limit-reset-credits/consume` | Never attempted automatically |
|
|
82
|
+
|
|
83
|
+
These endpoints are implementation details rather than a public API contract and may change when Codex changes its service behavior. A response containing only a recognized weekly window is treated as valid live usage; local discovery is used only when the live response contains no recognized usage window.
|
|
84
|
+
|
|
85
|
+
Requests are authenticated from Codex credentials, reject redirects, time out after 10 seconds by default, and limit JSON responses to 1 MB. Independent usage and coupon lookups start concurrently. The transport uses the runtime's `fetch` implementation and can fall back to native Node HTTP/HTTPS transport for supported failures. Coupon timestamps must be bounded RFC 3339 values. Coupon redemption accepts only an exact coupon ID with the recognized `codex_rate_limits` type. `--soonest` refuses partial or count-inconsistent coupon data and any available coupon whose expiration cannot be verified. Its bounded JSON `POST` uses a fresh idempotency key for each confirmed redemption and reuses that key for any transport fallback.
|
|
86
|
+
|
|
87
|
+
`CODEX_LIMITS_USAGE_ENDPOINT` can override only the live usage endpoint. Overrides must use HTTPS. Plain HTTP is accepted only for loopback testing on `localhost`, `127.0.0.1`, or `::1`. URLs containing embedded usernames or passwords and all other protocols are rejected.
|
|
88
|
+
|
|
89
|
+
An internet connection is therefore recommended for current usage and required for coupon data. The CLI remains usable offline when compatible local usage snapshots exist.
|
|
90
|
+
|
|
91
|
+
## Terminal and automation compatibility
|
|
92
|
+
|
|
93
|
+
| Surface | Requirement |
|
|
94
|
+
| ------------------------------ | ---------------------------------------------------------- |
|
|
95
|
+
| Interactive dashboard | A terminal capable of running the Ink UI |
|
|
96
|
+
| `status` and `coupons` | Any environment that can capture standard output |
|
|
97
|
+
| JSON output | Any environment that can capture and parse standard output |
|
|
98
|
+
| Reset coupon redemption | Both standard input and standard output must be TTYs |
|
|
99
|
+
| Interactive agent installation | Both standard input and standard output must be TTYs |
|
|
100
|
+
| Explicit agent installation | Works non-interactively with an agent name or `--all` |
|
|
101
|
+
|
|
102
|
+
Use [`codex-limits --json`](json-output.md) or `codex-limits coupons --json` in scripts. Errors use a non-zero exit code and are written to standard error; successful machine-readable output is written to standard output. `codex-limits reset` is intentionally interactive and has no JSON or unattended confirmation mode.
|
|
103
|
+
|
|
104
|
+
## OpenCode compatibility
|
|
105
|
+
|
|
106
|
+
Install the OpenCode integration with `codex-limits agents install opencode` (or the compatible `codex-limits init --opencode` form). The integration writes to both `~/.config/opencode/opencode.json` and `~/.config/opencode/tui.json`. It supports OpenCode hosts that expose either:
|
|
107
|
+
|
|
108
|
+
- the current keymap layer registration API; or
|
|
109
|
+
- the legacy command registration API.
|
|
110
|
+
|
|
111
|
+
Compatibility is determined from the API shape available at runtime rather than from a list of exact OpenCode versions. Automated adapter tests use host mocks for both supported API shapes; the repository does not currently claim end-to-end validation against named OpenCode releases.
|
|
112
|
+
|
|
113
|
+
The command is `/codex-limits`. It loads the shared core locally and does not send an LLM prompt. See [Agent integrations](agent-integrations.md) for installation and troubleshooting.
|
|
114
|
+
|
|
115
|
+
## pi compatibility
|
|
116
|
+
|
|
117
|
+
Install the pi integration with `codex-limits agents install pi` (or the compatible `codex-limits init --pi` form). The installer registers the current package root in `~/.pi/agent/settings.json`, or in the directory selected by `PI_CODING_AGENT_DIR`. The npm package also supports pi's native `pi install npm:@simonesiega/codex-limits` flow through its extension manifest.
|
|
118
|
+
|
|
119
|
+
The extension uses pi's command registration and custom overlay APIs. It is developed against `@earendil-works/pi-coding-agent` and `@earendil-works/pi-tui` 0.81.x, which require Node.js 22.19 or newer. These packages are optional peers and are supplied by the pi host rather than bundled into the extension. This does not change the standalone CLI's Node.js 20 requirement. Local validation confirmed that pi 0.81.1 discovers the installed package and handles `/codex-limits` without invoking the model in print mode; the interactive overlay is covered with host mocks and real TUI components rather than a terminal-level end-to-end test.
|
|
120
|
+
|
|
121
|
+
The `/codex-limits` command loads the shared core locally, opens a themed read-only overlay, and never sends a prompt or limit data to the LLM. Outside pi's interactive TUI it skips loading and sends no message to the model. See the dedicated [pi integration guide](agents/pi.md) for installation, removal, and troubleshooting.
|
|
122
|
+
|
|
123
|
+
## GitHub Copilot CLI compatibility
|
|
124
|
+
|
|
125
|
+
Install the GitHub Copilot CLI integration with `codex-limits agents install copilot` (or the compatible `codex-limits init --copilot` form). The installer copies the bundled ESM extension to `~/.copilot/extensions/codex-limits/extension.mjs`, or beneath the directory selected by `COPILOT_HOME`.
|
|
126
|
+
|
|
127
|
+
The integration uses Copilot CLI's experimental extension mechanism. Copilot starts the extension in a separate Node.js process, supplies `@github/copilot-sdk/extension` through its module resolver, and communicates over JSON-RPC on standard input and output. The bundle calls `joinSession()`, registers `/codex-limits` through session commands, and uses `session.log()` for the compact timeline output. It does not call `session.send()` or add the request or result to the model conversation.
|
|
128
|
+
|
|
129
|
+
The adapter is type-checked against `@github/copilot-sdk` 1.0.8. Automated tests use host mocks for registration, timeline output, static safe failures, and installer behavior. Package validation confirms that `dist/copilot.mjs` retains only the CLI-provided SDK as an external host import and is copied to the expected user extension path. No exact Copilot CLI release is currently tested end-to-end, and the experimental API may change. The current npm installation of Copilot CLI requires Node.js 22 or newer; other official installation methods package the host separately.
|
|
130
|
+
|
|
131
|
+
See the dedicated [GitHub Copilot CLI integration guide](agents/copilot.md) for installation, removal, host details, and troubleshooting.
|
|
132
|
+
|
|
133
|
+
## Support policy
|
|
134
|
+
|
|
135
|
+
The latest npm release is supported. The current `main` branch is supported for unreleased fixes, while older releases receive best-effort support. See the [Security policy](../../SECURITY.md#supported-versions) for security support details.
|
|
136
|
+
|
|
137
|
+
## Related documentation
|
|
138
|
+
|
|
139
|
+
- [JSON output](json-output.md) — Machine-readable output, fields, warnings, and scripting behavior.
|
|
140
|
+
- [Agent integrations](agent-integrations.md) — Installation, architecture, compatibility, and troubleshooting for agent adapters.
|
|
141
|
+
- [Security policy](../../SECURITY.md) — Data-access safeguards, network behavior, and vulnerability reporting.
|
|
142
|
+
- [Documentation hub](../README.md) — Task-oriented index for CLI, automation, agent, development, and security guides.
|
|
143
|
+
- [Project README](../../README.md) — Product overview, installation, commands, configuration, and troubleshooting.
|