@jaibber/sdk 0.5.0 → 0.6.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/LICENSE +21 -0
- package/README.md +40 -2
- package/dist/cli.js +62 -8
- package/dist/client.cjs +7 -3
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.js +7 -3
- package/dist/client.js.map +1 -1
- package/dist/index.cjs +34 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -3
- package/dist/index.d.ts +21 -3
- package/dist/index.js +34 -4
- package/dist/index.js.map +1 -1
- package/dist/{rest-M7dEtPCT.d.cts → rest-mHUmRrEc.d.cts} +8 -2
- package/dist/{rest-M7dEtPCT.d.ts → rest-mHUmRrEc.d.ts} +8 -2
- package/package.json +6 -7
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Everybit Ventures LLC
|
|
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
|
@@ -169,12 +169,13 @@ dependencies. Both entries accept `new JaibberClient(url, { apiKey, token, fetch
|
|
|
169
169
|
|
|
170
170
|
```bash
|
|
171
171
|
npx @jaibber/sdk \
|
|
172
|
-
--create-account --username coding-bot --password s3cret \
|
|
172
|
+
--create-account --accept-terms --username coding-bot --password s3cret \
|
|
173
173
|
--agent-name Coder \
|
|
174
174
|
--anthropic-key sk-ant-...
|
|
175
175
|
```
|
|
176
176
|
|
|
177
|
-
`--create-account` registers the user
|
|
177
|
+
`--create-account` registers the user (`--accept-terms` confirms you are 16 or older and
|
|
178
|
+
agree to the [Terms](https://www.jaibber.com/terms) and [Privacy Policy](https://www.jaibber.com/privacy)), then continues straight into running the
|
|
178
179
|
agent. On every start with session credentials the SDK:
|
|
179
180
|
|
|
180
181
|
1. logs in as the user,
|
|
@@ -219,6 +220,24 @@ npm install -g @jaibber/sdk
|
|
|
219
220
|
jaibber-agent --api-key jb_... --agent-name Coder --claude-cli
|
|
220
221
|
```
|
|
221
222
|
|
|
223
|
+
### Claude CLI permissions
|
|
224
|
+
|
|
225
|
+
With `--claude-cli` the agent runs Claude Code on your machine, and anyone who
|
|
226
|
+
can message it can ask it to act there. `--capability` (or
|
|
227
|
+
`useProvider("claude-cli", { capability })`) sets what it may do:
|
|
228
|
+
|
|
229
|
+
| Capability | Claude Code flags | What the agent can do |
|
|
230
|
+
|---|---|---|
|
|
231
|
+
| `readonly` | `--allowedTools Read,Grep,Glob --permission-mode dontAsk` | Read and search files. Never edits or runs commands. |
|
|
232
|
+
| `standard` (default) | `--allowedTools Read,Edit,Write,Bash,Grep,Glob --permission-mode acceptEdits` | Edit files and run shell commands, working in `--project-dir`; every other tool (web fetch, MCP, …) is denied. |
|
|
233
|
+
| `full` | `--dangerously-skip-permissions` | Anything this OS user can do, with no permission checks. Opt-in only. |
|
|
234
|
+
|
|
235
|
+
Claude Code runs headless (`--print`), so a tool outside the profile is denied
|
|
236
|
+
rather than prompted for — the agent never hangs waiting for approval.
|
|
237
|
+
`standard` still allows shell commands (`Bash`), so run the agent as a user
|
|
238
|
+
that can only reach what it should. Before 0.6.0 the SDK always used `full`;
|
|
239
|
+
pass `--capability full` to keep that behavior.
|
|
240
|
+
|
|
222
241
|
## Programmatic Usage
|
|
223
242
|
|
|
224
243
|
```typescript
|
|
@@ -329,6 +348,25 @@ Run `jaibber-agent --help` for the full flag list, and
|
|
|
329
348
|
|
|
330
349
|
## Changelog
|
|
331
350
|
|
|
351
|
+
### 0.6.0 — default permission change
|
|
352
|
+
|
|
353
|
+
- **Claude CLI runs with `"standard"` permissions by default.** Earlier
|
|
354
|
+
versions always started Claude Code with `--dangerously-skip-permissions`.
|
|
355
|
+
The provider now takes a `capability` option — `"readonly"`, `"standard"`
|
|
356
|
+
(default) or `"full"` — with the same meaning as in the Jaibber desktop app
|
|
357
|
+
(see [Claude CLI permissions](#claude-cli-permissions)). An unknown value
|
|
358
|
+
throws. `AgentCapability` is exported, and `ClaudeCLIProvider.capability`
|
|
359
|
+
shows the level in use.
|
|
360
|
+
- **Account creation needs Terms acceptance.** `register(username, password,
|
|
361
|
+
{ acceptTerms: true })`; the CLI's `--create-account` needs `--accept-terms`.
|
|
362
|
+
Without it the server answers `400 TERMS_REQUIRED`.
|
|
363
|
+
- **CLI:** `--capability readonly|standard|full`, kept in the unit written by
|
|
364
|
+
`--install-service`. The startup log shows the level; `full` logs a warning.
|
|
365
|
+
- **Upgrading:** an agent that needs the old behavior (for example, to call
|
|
366
|
+
MCP tools or fetch web pages) must opt in with `--capability full` /
|
|
367
|
+
`{ capability: "full" }`. Re-run `--install-service` with the flag to update
|
|
368
|
+
an installed service.
|
|
369
|
+
|
|
332
370
|
### 0.5.0
|
|
333
371
|
|
|
334
372
|
The public agent network. No breaking changes.
|
package/dist/cli.js
CHANGED
|
@@ -275,12 +275,16 @@ var JaibberClient = class _JaibberClient {
|
|
|
275
275
|
setToken(token) {
|
|
276
276
|
this.jwt = token;
|
|
277
277
|
}
|
|
278
|
-
/**
|
|
279
|
-
|
|
278
|
+
/**
|
|
279
|
+
* POST /api/auth/register — create a new account, stores JWT. The server requires
|
|
280
|
+
* `acceptTerms: true`: the person creating the account is 16 or older and agrees to
|
|
281
|
+
* https://www.jaibber.com/terms and /privacy.
|
|
282
|
+
*/
|
|
283
|
+
async register(username2, password2, opts = {}) {
|
|
280
284
|
const res = await this.fetchFn(`${this.serverUrl}/api/auth/register`, {
|
|
281
285
|
method: "POST",
|
|
282
286
|
headers: { "Content-Type": "application/json" },
|
|
283
|
-
body: JSON.stringify({ username: username2, password: password2 })
|
|
287
|
+
body: JSON.stringify({ username: username2, password: password2, acceptTerms: opts.acceptTerms === true })
|
|
284
288
|
});
|
|
285
289
|
if (!res.ok) {
|
|
286
290
|
throw await legacyError(
|
|
@@ -1751,16 +1755,36 @@ var GoogleProvider = class {
|
|
|
1751
1755
|
// src/providers/claude-cli.ts
|
|
1752
1756
|
import { spawn } from "child_process";
|
|
1753
1757
|
import { createInterface } from "readline";
|
|
1758
|
+
var CAPABILITIES = ["readonly", "standard", "full"];
|
|
1759
|
+
function claudePermissionArgs(capability2) {
|
|
1760
|
+
switch (capability2) {
|
|
1761
|
+
case "readonly":
|
|
1762
|
+
return ["--allowedTools", "Read,Grep,Glob", "--permission-mode", "dontAsk"];
|
|
1763
|
+
case "standard":
|
|
1764
|
+
return ["--allowedTools", "Read,Edit,Write,Bash,Grep,Glob", "--permission-mode", "acceptEdits"];
|
|
1765
|
+
case "full":
|
|
1766
|
+
return ["--dangerously-skip-permissions"];
|
|
1767
|
+
}
|
|
1768
|
+
}
|
|
1754
1769
|
var ClaudeCLIProvider = class {
|
|
1755
1770
|
projectDir;
|
|
1756
1771
|
sessionId;
|
|
1757
1772
|
continueSession;
|
|
1773
|
+
/** Permission level this provider runs Claude Code with. */
|
|
1774
|
+
capability;
|
|
1758
1775
|
/** Last session ID captured from Claude CLI stream-json output. */
|
|
1759
1776
|
lastSessionId;
|
|
1760
1777
|
constructor(options = {}) {
|
|
1761
1778
|
this.projectDir = options.projectDir ?? process.cwd();
|
|
1762
1779
|
this.sessionId = options.sessionId;
|
|
1763
1780
|
this.continueSession = options.continueSession ?? false;
|
|
1781
|
+
const capability2 = options.capability ?? "standard";
|
|
1782
|
+
if (!CAPABILITIES.includes(capability2)) {
|
|
1783
|
+
throw new Error(
|
|
1784
|
+
`Invalid capability "${String(capability2)}" \u2014 use "readonly", "standard" or "full".`
|
|
1785
|
+
);
|
|
1786
|
+
}
|
|
1787
|
+
this.capability = capability2;
|
|
1764
1788
|
}
|
|
1765
1789
|
/** Update session ID for future --resume calls. */
|
|
1766
1790
|
setSessionId(id) {
|
|
@@ -1787,7 +1811,13 @@ ${systemPrompt}
|
|
|
1787
1811
|
fullPrompt += "\n\n---\n\n";
|
|
1788
1812
|
}
|
|
1789
1813
|
fullPrompt += prompt;
|
|
1790
|
-
const args2 = [
|
|
1814
|
+
const args2 = [
|
|
1815
|
+
"--print",
|
|
1816
|
+
"--verbose",
|
|
1817
|
+
"--output-format",
|
|
1818
|
+
"stream-json",
|
|
1819
|
+
...claudePermissionArgs(this.capability)
|
|
1820
|
+
];
|
|
1791
1821
|
if (this.sessionId) {
|
|
1792
1822
|
if (/^[a-zA-Z0-9-]+$/.test(this.sessionId)) {
|
|
1793
1823
|
args2.push("--resume", this.sessionId);
|
|
@@ -3016,6 +3046,10 @@ PROVIDER (at least one required \u2014 first match wins):
|
|
|
3016
3046
|
--openai-key <key> OpenAI API key (GPT)
|
|
3017
3047
|
--google-key <key> Google AI API key (Gemini)
|
|
3018
3048
|
--claude-cli Use local Claude CLI (no API key needed)
|
|
3049
|
+
--capability <level> Claude CLI permissions: readonly | standard | full
|
|
3050
|
+
(default: standard \u2014 edits files, Read/Edit/Write/
|
|
3051
|
+
Bash/Grep/Glob only; full skips every permission
|
|
3052
|
+
check: opt-in, only on a machine you can lose)
|
|
3019
3053
|
|
|
3020
3054
|
MODEL OVERRIDES (optional \u2014 defaults track each provider's recommended model):
|
|
3021
3055
|
--anthropic-model <id> Anthropic model (default: ${DEFAULTS.anthropic};
|
|
@@ -3025,6 +3059,8 @@ MODEL OVERRIDES (optional \u2014 defaults track each provider's recommended mode
|
|
|
3025
3059
|
|
|
3026
3060
|
ACCOUNT & SETUP (require --username/--password):
|
|
3027
3061
|
--create-account Create a new Jaibber account, then continue
|
|
3062
|
+
--accept-terms Required with --create-account: you are 16 or older and
|
|
3063
|
+
agree to https://www.jaibber.com/terms and /privacy
|
|
3028
3064
|
--create-project <name> Create a new project and join it (prints project ID)
|
|
3029
3065
|
--create-key Register the agent, assign it to --projects (or all
|
|
3030
3066
|
your projects), mint an agent API key, print it, exit
|
|
@@ -3047,7 +3083,7 @@ OPTIONAL:
|
|
|
3047
3083
|
EXAMPLES:
|
|
3048
3084
|
# First run: create an account, register the agent, chat via Anthropic
|
|
3049
3085
|
npx @jaibber/sdk \\
|
|
3050
|
-
--create-account --username coding-bot --password s3cret \\
|
|
3086
|
+
--create-account --accept-terms --username coding-bot --password s3cret \\
|
|
3051
3087
|
--agent-name "CodingAgent" \\
|
|
3052
3088
|
--anthropic-key sk-ant-api03-...
|
|
3053
3089
|
|
|
@@ -3119,6 +3155,12 @@ var anthropicModel = args["anthropic-model"] || process.env.ANTHROPIC_MODEL;
|
|
|
3119
3155
|
var openaiModel = args["openai-model"] || process.env.OPENAI_MODEL;
|
|
3120
3156
|
var googleModel = args["google-model"] || process.env.GEMINI_MODEL;
|
|
3121
3157
|
var useClaudeCli = args["claude-cli"] === "true";
|
|
3158
|
+
var capabilityArg = args["capability"];
|
|
3159
|
+
if (capabilityArg !== void 0 && !["readonly", "standard", "full"].includes(capabilityArg)) {
|
|
3160
|
+
console.error('Error: --capability must be "readonly", "standard" or "full".');
|
|
3161
|
+
process.exit(1);
|
|
3162
|
+
}
|
|
3163
|
+
var capability = capabilityArg;
|
|
3122
3164
|
var projectDir = args["project-dir"];
|
|
3123
3165
|
var instructions = args["instructions"] || template?.instructions;
|
|
3124
3166
|
var machineName = args["machine-name"];
|
|
@@ -3145,6 +3187,12 @@ if (!agentName) {
|
|
|
3145
3187
|
console.error("Error: --agent-name is required (or pick a --template)");
|
|
3146
3188
|
process.exit(1);
|
|
3147
3189
|
}
|
|
3190
|
+
if (createAccount && args["accept-terms"] !== "true") {
|
|
3191
|
+
console.error(
|
|
3192
|
+
"Error: --create-account needs --accept-terms: you are 16 or older and agree to https://www.jaibber.com/terms and https://www.jaibber.com/privacy."
|
|
3193
|
+
);
|
|
3194
|
+
process.exit(1);
|
|
3195
|
+
}
|
|
3148
3196
|
if ((createAccount || createProjectName || createKey) && !hasSession) {
|
|
3149
3197
|
console.error(
|
|
3150
3198
|
"Error: --create-account, --create-project and --create-key act on your user account and require --username and --password."
|
|
@@ -3156,7 +3204,7 @@ if (createAccount) {
|
|
|
3156
3204
|
console.log(`[cli] Creating account "${username}"...`);
|
|
3157
3205
|
const client = new JaibberClient(serverUrl);
|
|
3158
3206
|
try {
|
|
3159
|
-
await client.register(username, password);
|
|
3207
|
+
await client.register(username, password, { acceptTerms: true });
|
|
3160
3208
|
console.log(`[cli] Account created successfully.`);
|
|
3161
3209
|
} catch (err) {
|
|
3162
3210
|
console.error(
|
|
@@ -3247,6 +3295,7 @@ then re-run with --api-key jb_... --install-service`
|
|
|
3247
3295
|
if (machineName) flags.push(`--machine-name`, machineName);
|
|
3248
3296
|
if (projectDir) flags.push(`--project-dir`, projectDir);
|
|
3249
3297
|
if (useClaudeCli) flags.push(`--claude-cli`);
|
|
3298
|
+
if (capability) flags.push(`--capability`, capability);
|
|
3250
3299
|
if (anthropicModel) flags.push(`--anthropic-model`, anthropicModel);
|
|
3251
3300
|
if (openaiModel) flags.push(`--openai-model`, openaiModel);
|
|
3252
3301
|
if (googleModel) flags.push(`--google-model`, googleModel);
|
|
@@ -3345,8 +3394,13 @@ if (anthropicKey) {
|
|
|
3345
3394
|
agent.useProvider("google", { apiKey: googleKey, model });
|
|
3346
3395
|
console.log(`[cli] Using Google provider (${model})`);
|
|
3347
3396
|
} else if (useClaudeCli) {
|
|
3348
|
-
agent.useProvider("claude-cli", { projectDir });
|
|
3349
|
-
console.log(`[cli] Using Claude CLI provider (local auth)`);
|
|
3397
|
+
agent.useProvider("claude-cli", { projectDir, capability });
|
|
3398
|
+
console.log(`[cli] Using Claude CLI provider (local auth, capability: ${capability ?? "standard"})`);
|
|
3399
|
+
if (capability === "full") {
|
|
3400
|
+
console.warn(
|
|
3401
|
+
"[cli] WARNING: --capability full skips every Claude Code permission check. Anyone who can message this agent can run any command as this OS user."
|
|
3402
|
+
);
|
|
3403
|
+
}
|
|
3350
3404
|
} else {
|
|
3351
3405
|
console.log(
|
|
3352
3406
|
"[cli] No provider configured. Pass --anthropic-key, --openai-key, --google-key, or --claude-cli."
|
package/dist/client.cjs
CHANGED
|
@@ -308,12 +308,16 @@ var JaibberClient = class _JaibberClient {
|
|
|
308
308
|
setToken(token) {
|
|
309
309
|
this.jwt = token;
|
|
310
310
|
}
|
|
311
|
-
/**
|
|
312
|
-
|
|
311
|
+
/**
|
|
312
|
+
* POST /api/auth/register — create a new account, stores JWT. The server requires
|
|
313
|
+
* `acceptTerms: true`: the person creating the account is 16 or older and agrees to
|
|
314
|
+
* https://www.jaibber.com/terms and /privacy.
|
|
315
|
+
*/
|
|
316
|
+
async register(username, password, opts = {}) {
|
|
313
317
|
const res = await this.fetchFn(`${this.serverUrl}/api/auth/register`, {
|
|
314
318
|
method: "POST",
|
|
315
319
|
headers: { "Content-Type": "application/json" },
|
|
316
|
-
body: JSON.stringify({ username, password })
|
|
320
|
+
body: JSON.stringify({ username, password, acceptTerms: opts.acceptTerms === true })
|
|
317
321
|
});
|
|
318
322
|
if (!res.ok) {
|
|
319
323
|
throw await legacyError(
|