You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+42-42Lines changed: 42 additions & 42 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,7 @@
28
28
29
29
## What is OneCLI?
30
30
31
-
**OneCLI** (`oc`) is a thin, agent-first CLI that connects AI agents to external services via plugins. The SDK provides a programmatic interface for Node.js applications to interact with OneCLI's proxy, allowing containerized agents to access external APIs without exposing credentials.
31
+
**OneCLI** (`oc`) is a thin, agent-first CLI that connects AI agents to external services via plugins. The SDK provides a programmatic interface for Node.js applications to interact with OneCLI, allowing containerized agents to access external APIs without exposing credentials.
32
32
33
33
## Installation
34
34
@@ -54,18 +54,18 @@ yarn add @onecli/sdk
54
54
55
55
### Standalone function
56
56
57
-
The simplest way to use the SDK. A single function that configures Docker containers to use the OneCLI proxy:
57
+
The simplest way to use the SDK. A single function that configures Docker containers to use OneCLI:
|`combineCaBundle`|`boolean`|`true`| Build combined CA bundle for system-wide proxy trust |
157
+
|`combineCaBundle`|`boolean`|`true`| Build combined CA bundle for system-wide trust|
158
158
|`addHostMapping`|`boolean`|`true`| Add `host.docker.internal` mapping on Linux |
159
159
160
160
**What it does:**
161
-
1. Fetches `/container-config` from the proxy
161
+
1. Fetches `/container-config` from OneCLI
162
162
2. Pushes `-e KEY=VALUE` for each environment variable
163
163
3. Pushes `-v host:container[:ro]` for each mount
164
-
4. Builds a combined CA bundle (system CAs + proxy CA) so all tools trust the proxy
164
+
4. Builds a combined CA bundle (system CAs + OneCLI CA) so all tools trust OneCLI
165
165
5. Adds `--add-host host.docker.internal:host-gateway` on Linux
166
166
167
167
---
168
168
169
-
### `applyProxyConfig(args, proxyUrl?)`
169
+
### `applyOneCLIConfig(args, onecliUrl?)`
170
170
171
-
Standalone convenience function. Equivalent to creating a `ProxyClient` and calling `applyContainerConfig`.
171
+
Standalone convenience function. Equivalent to creating a `Client` and calling `applyContainerConfig`.
172
172
173
173
```typescript
174
-
import { applyProxyConfig } from"@onecli/sdk";
174
+
import { applyOneCLIConfig } from"@onecli/sdk";
175
175
176
-
const active =awaitapplyProxyConfig(args, "http://localhost:18080");
176
+
const active =awaitapplyOneCLIConfig(args, "http://localhost:18080");
177
177
// Pass undefined/null to skip (returns false immediately)
178
178
```
179
179
@@ -189,7 +189,7 @@ General SDK error.
189
189
import { OneCLIError } from"@onecli/sdk";
190
190
191
191
try {
192
-
oc.proxy(); // throws if no proxy URL configured
192
+
oc.client(); // throws if no OneCLI URL configured
193
193
} catch (error) {
194
194
if (errorinstanceofOneCLIError) {
195
195
console.error(error.message);
@@ -205,7 +205,7 @@ HTTP request error with context.
205
205
import { OneCLIRequestError } from"@onecli/sdk";
206
206
207
207
try {
208
-
awaitoc.proxy().getContainerConfig();
208
+
awaitoc.client().getContainerConfig();
209
209
} catch (error) {
210
210
if (errorinstanceofOneCLIRequestError) {
211
211
console.error(error.url); // Request URL
@@ -232,16 +232,16 @@ import type {
232
232
233
233
## How It Works
234
234
235
-
The OneCLI proxy runs on the host machine and acts as a MITM proxy for containerized agents. When a container makes HTTPS requests to intercepted domains (e.g. `api.anthropic.com`), the proxy:
235
+
OneCLI runs on the host machine and acts as a MITM proxy for containerized agents. When a container makes HTTPS requests to intercepted domains (e.g. `api.anthropic.com`), OneCLI:
236
236
237
237
1. Terminates TLS using a local CA certificate
238
238
2. Inspects the request and injects real credentials (replacing placeholder tokens)
239
239
3. Forwards the request to the upstream service
240
240
4. Returns the response to the container
241
241
242
-
This means **containers never see real API keys**. They only have placeholder tokens that the proxy swaps out transparently.
242
+
This means **containers never see real API keys**. They only have placeholder tokens that OneCLI swaps out transparently.
243
243
244
-
The SDK configures containers with the right environment variables (`HTTPS_PROXY`, `NODE_EXTRA_CA_CERTS`) and volume mounts (proxy CA certificate) so this works automatically.
244
+
The SDK configures containers with the right environment variables (`HTTPS_PROXY`, `NODE_EXTRA_CA_CERTS`) and volume mounts (OneCLI CA certificate) so this works automatically.
0 commit comments