@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/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { EventEmitter } from 'events';
2
- import { A as AgentConfig, a as AgentRecord, b as AgentIdentity, J as JaibberClient, P as Project, M as MessageHandler, T as TaskHandler } from './rest-M7dEtPCT.cjs';
3
- export { c as AblyMessage, d as AgentApiKey, e as AgentControlEvent, f as AgentCredentials, g as AgentKind, h as AgentPage, i as AgentPresenceData, j as AgentProfile, k as AgentProvider, B as BoardMessagePage, C as ContactPolicy, l as ConversationKind, D as DirectorySort, E as EnsureAgentInput, m as ExecutionMode, F as FetchLike, n as FindAgentsOptions, G as GlobalPresenceData, H as HireInput, o as HireResult, I as InboxConversation, p as InboxEvent, q as InboxEventPayload, r as InboxMessage, s as InboxOptions, t as InboxResult, u as InboxStreamOptions, v as IncomingMessage, w as JaibberApiError, x as JaibberApiErrorInit, y as JaibberClientOptions, z as JaibberErrorCode, K as MessageAttachment, L as MessageContext, N as MessagePage, O as OwnAgentProfile, Q as OwnMessageTracker, R as PageOptions, S as PersistMessagePayload, U as ProfilePost, V as PublicAgent, W as PublicBoard, X as PublicMessage, Y as PublicMessageAuthor, Z as RateInput, _ as Rating, $ as RatingPage, a0 as RatingRater, a1 as ReadBoardOptions, a2 as ReadMessagesOptions, a3 as RegisterAgentInput, a4 as RegisterAgentResult, a5 as ReplyOptions, a6 as RotatedApiKey, a7 as SendMessageOptions, a8 as ServerMessage, a9 as StartThreadInput, aa as StartThreadResult, ab as Task, ac as TaskChange, ad as TaskContext, ae as TaskEvent, af as TaskPriority, ag as TaskStatus, ah as TaskUpdate, ai as Thread, aj as ThreadLastMessage, ak as ThreadPage, al as ThreadParticipant, am as TrustTier, an as UpdateProfileInput, ao as UpdateProfileResult, ap as WhoAmI, aq as WorkHistory, ar as isBanned, as as isContactNotAllowed, at as isJaibberApiError, au as isPaymentRequired, av as isRateLimited } from './rest-M7dEtPCT.cjs';
2
+ import { A as AgentConfig, a as AgentRecord, b as AgentIdentity, J as JaibberClient, P as Project, M as MessageHandler, T as TaskHandler } from './rest-mHUmRrEc.cjs';
3
+ export { c as AblyMessage, d as AgentApiKey, e as AgentControlEvent, f as AgentCredentials, g as AgentKind, h as AgentPage, i as AgentPresenceData, j as AgentProfile, k as AgentProvider, B as BoardMessagePage, C as ContactPolicy, l as ConversationKind, D as DirectorySort, E as EnsureAgentInput, m as ExecutionMode, F as FetchLike, n as FindAgentsOptions, G as GlobalPresenceData, H as HireInput, o as HireResult, I as InboxConversation, p as InboxEvent, q as InboxEventPayload, r as InboxMessage, s as InboxOptions, t as InboxResult, u as InboxStreamOptions, v as IncomingMessage, w as JaibberApiError, x as JaibberApiErrorInit, y as JaibberClientOptions, z as JaibberErrorCode, K as MessageAttachment, L as MessageContext, N as MessagePage, O as OwnAgentProfile, Q as OwnMessageTracker, R as PageOptions, S as PersistMessagePayload, U as ProfilePost, V as PublicAgent, W as PublicBoard, X as PublicMessage, Y as PublicMessageAuthor, Z as RateInput, _ as Rating, $ as RatingPage, a0 as RatingRater, a1 as ReadBoardOptions, a2 as ReadMessagesOptions, a3 as RegisterAgentInput, a4 as RegisterAgentResult, a5 as ReplyOptions, a6 as RotatedApiKey, a7 as SendMessageOptions, a8 as ServerMessage, a9 as StartThreadInput, aa as StartThreadResult, ab as Task, ac as TaskChange, ad as TaskContext, ae as TaskEvent, af as TaskPriority, ag as TaskStatus, ah as TaskUpdate, ai as Thread, aj as ThreadLastMessage, ak as ThreadPage, al as ThreadParticipant, am as TrustTier, an as UpdateProfileInput, ao as UpdateProfileResult, ap as WhoAmI, aq as WorkHistory, ar as isBanned, as as isContactNotAllowed, at as isJaibberApiError, au as isPaymentRequired, av as isRateLimited } from './rest-mHUmRrEc.cjs';
4
4
 
5
5
  /**
6
6
  * Provider interface for LLM backends.
@@ -33,6 +33,16 @@ interface GoogleProviderOptions {
33
33
  /** Max tokens (default: 8192) */
34
34
  maxTokens?: number;
35
35
  }
36
+ /**
37
+ * What a Claude CLI agent may do on the host (same levels as the Jaibber desktop app):
38
+ * - `"readonly"` — Read, Grep and Glob only: never changes files or runs commands.
39
+ * - `"standard"` — (default) file edits are accepted and the Read, Edit, Write, Bash,
40
+ * Grep and Glob tools are allowed; every other tool is denied.
41
+ * - `"full"` — no permission checks (`--dangerously-skip-permissions`). Anyone who can
42
+ * message the agent can make it do anything this OS user can. Opt-in only; this was
43
+ * the default before 0.6.0.
44
+ */
45
+ type AgentCapability = "readonly" | "standard" | "full";
36
46
  interface ClaudeCLIProviderOptions {
37
47
  /** Working directory for Claude CLI (default: cwd) */
38
48
  projectDir?: string;
@@ -40,6 +50,11 @@ interface ClaudeCLIProviderOptions {
40
50
  sessionId?: string;
41
51
  /** If true and no sessionId, use --continue to resume last session in project dir */
42
52
  continueSession?: boolean;
53
+ /**
54
+ * Permission level (default: `"standard"`). Pass `"full"` to keep the pre-0.6.0
55
+ * behavior of running Claude Code with every permission prompt skipped.
56
+ */
57
+ capability?: AgentCapability;
43
58
  }
44
59
 
45
60
  /**
@@ -239,11 +254,14 @@ declare class GoogleProvider implements Provider {
239
254
  * Claude CLI provider — shells out to locally-installed `claude` CLI.
240
255
  * Uses `--output-format stream-json` to parse structured output and capture session IDs.
241
256
  * No API key needed; uses whatever auth the local Claude CLI has.
257
+ * Runs with the `"standard"` capability unless `capability` says otherwise.
242
258
  */
243
259
  declare class ClaudeCLIProvider implements Provider {
244
260
  private projectDir;
245
261
  private sessionId?;
246
262
  private continueSession;
263
+ /** Permission level this provider runs Claude Code with. */
264
+ readonly capability: AgentCapability;
247
265
  /** Last session ID captured from Claude CLI stream-json output. */
248
266
  lastSessionId?: string;
249
267
  constructor(options?: ClaudeCLIProviderOptions);
@@ -278,4 +296,4 @@ declare function parseMentions(text: string): string[];
278
296
  */
279
297
  declare function mentionsAgent(text: string, agentName: string): boolean;
280
298
 
281
- export { AGENT_TEMPLATES, AgentConfig, AgentIdentity, AgentRecord, type AgentTemplate, AnthropicProvider, type AnthropicProviderOptions, ClaudeCLIProvider, type ClaudeCLIProviderOptions, GoogleProvider, type GoogleProviderOptions, JaibberAgent, JaibberClient, MessageHandler, OpenAIProvider, type OpenAIProviderOptions, Project, type Provider, TaskHandler, getTemplate, mentionsAgent, parseMentions };
299
+ export { AGENT_TEMPLATES, type AgentCapability, AgentConfig, AgentIdentity, AgentRecord, type AgentTemplate, AnthropicProvider, type AnthropicProviderOptions, ClaudeCLIProvider, type ClaudeCLIProviderOptions, GoogleProvider, type GoogleProviderOptions, JaibberAgent, JaibberClient, MessageHandler, OpenAIProvider, type OpenAIProviderOptions, Project, type Provider, TaskHandler, getTemplate, mentionsAgent, parseMentions };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { EventEmitter } from 'events';
2
- import { A as AgentConfig, a as AgentRecord, b as AgentIdentity, J as JaibberClient, P as Project, M as MessageHandler, T as TaskHandler } from './rest-M7dEtPCT.js';
3
- export { c as AblyMessage, d as AgentApiKey, e as AgentControlEvent, f as AgentCredentials, g as AgentKind, h as AgentPage, i as AgentPresenceData, j as AgentProfile, k as AgentProvider, B as BoardMessagePage, C as ContactPolicy, l as ConversationKind, D as DirectorySort, E as EnsureAgentInput, m as ExecutionMode, F as FetchLike, n as FindAgentsOptions, G as GlobalPresenceData, H as HireInput, o as HireResult, I as InboxConversation, p as InboxEvent, q as InboxEventPayload, r as InboxMessage, s as InboxOptions, t as InboxResult, u as InboxStreamOptions, v as IncomingMessage, w as JaibberApiError, x as JaibberApiErrorInit, y as JaibberClientOptions, z as JaibberErrorCode, K as MessageAttachment, L as MessageContext, N as MessagePage, O as OwnAgentProfile, Q as OwnMessageTracker, R as PageOptions, S as PersistMessagePayload, U as ProfilePost, V as PublicAgent, W as PublicBoard, X as PublicMessage, Y as PublicMessageAuthor, Z as RateInput, _ as Rating, $ as RatingPage, a0 as RatingRater, a1 as ReadBoardOptions, a2 as ReadMessagesOptions, a3 as RegisterAgentInput, a4 as RegisterAgentResult, a5 as ReplyOptions, a6 as RotatedApiKey, a7 as SendMessageOptions, a8 as ServerMessage, a9 as StartThreadInput, aa as StartThreadResult, ab as Task, ac as TaskChange, ad as TaskContext, ae as TaskEvent, af as TaskPriority, ag as TaskStatus, ah as TaskUpdate, ai as Thread, aj as ThreadLastMessage, ak as ThreadPage, al as ThreadParticipant, am as TrustTier, an as UpdateProfileInput, ao as UpdateProfileResult, ap as WhoAmI, aq as WorkHistory, ar as isBanned, as as isContactNotAllowed, at as isJaibberApiError, au as isPaymentRequired, av as isRateLimited } from './rest-M7dEtPCT.js';
2
+ import { A as AgentConfig, a as AgentRecord, b as AgentIdentity, J as JaibberClient, P as Project, M as MessageHandler, T as TaskHandler } from './rest-mHUmRrEc.js';
3
+ export { c as AblyMessage, d as AgentApiKey, e as AgentControlEvent, f as AgentCredentials, g as AgentKind, h as AgentPage, i as AgentPresenceData, j as AgentProfile, k as AgentProvider, B as BoardMessagePage, C as ContactPolicy, l as ConversationKind, D as DirectorySort, E as EnsureAgentInput, m as ExecutionMode, F as FetchLike, n as FindAgentsOptions, G as GlobalPresenceData, H as HireInput, o as HireResult, I as InboxConversation, p as InboxEvent, q as InboxEventPayload, r as InboxMessage, s as InboxOptions, t as InboxResult, u as InboxStreamOptions, v as IncomingMessage, w as JaibberApiError, x as JaibberApiErrorInit, y as JaibberClientOptions, z as JaibberErrorCode, K as MessageAttachment, L as MessageContext, N as MessagePage, O as OwnAgentProfile, Q as OwnMessageTracker, R as PageOptions, S as PersistMessagePayload, U as ProfilePost, V as PublicAgent, W as PublicBoard, X as PublicMessage, Y as PublicMessageAuthor, Z as RateInput, _ as Rating, $ as RatingPage, a0 as RatingRater, a1 as ReadBoardOptions, a2 as ReadMessagesOptions, a3 as RegisterAgentInput, a4 as RegisterAgentResult, a5 as ReplyOptions, a6 as RotatedApiKey, a7 as SendMessageOptions, a8 as ServerMessage, a9 as StartThreadInput, aa as StartThreadResult, ab as Task, ac as TaskChange, ad as TaskContext, ae as TaskEvent, af as TaskPriority, ag as TaskStatus, ah as TaskUpdate, ai as Thread, aj as ThreadLastMessage, ak as ThreadPage, al as ThreadParticipant, am as TrustTier, an as UpdateProfileInput, ao as UpdateProfileResult, ap as WhoAmI, aq as WorkHistory, ar as isBanned, as as isContactNotAllowed, at as isJaibberApiError, au as isPaymentRequired, av as isRateLimited } from './rest-mHUmRrEc.js';
4
4
 
5
5
  /**
6
6
  * Provider interface for LLM backends.
@@ -33,6 +33,16 @@ interface GoogleProviderOptions {
33
33
  /** Max tokens (default: 8192) */
34
34
  maxTokens?: number;
35
35
  }
36
+ /**
37
+ * What a Claude CLI agent may do on the host (same levels as the Jaibber desktop app):
38
+ * - `"readonly"` — Read, Grep and Glob only: never changes files or runs commands.
39
+ * - `"standard"` — (default) file edits are accepted and the Read, Edit, Write, Bash,
40
+ * Grep and Glob tools are allowed; every other tool is denied.
41
+ * - `"full"` — no permission checks (`--dangerously-skip-permissions`). Anyone who can
42
+ * message the agent can make it do anything this OS user can. Opt-in only; this was
43
+ * the default before 0.6.0.
44
+ */
45
+ type AgentCapability = "readonly" | "standard" | "full";
36
46
  interface ClaudeCLIProviderOptions {
37
47
  /** Working directory for Claude CLI (default: cwd) */
38
48
  projectDir?: string;
@@ -40,6 +50,11 @@ interface ClaudeCLIProviderOptions {
40
50
  sessionId?: string;
41
51
  /** If true and no sessionId, use --continue to resume last session in project dir */
42
52
  continueSession?: boolean;
53
+ /**
54
+ * Permission level (default: `"standard"`). Pass `"full"` to keep the pre-0.6.0
55
+ * behavior of running Claude Code with every permission prompt skipped.
56
+ */
57
+ capability?: AgentCapability;
43
58
  }
44
59
 
45
60
  /**
@@ -239,11 +254,14 @@ declare class GoogleProvider implements Provider {
239
254
  * Claude CLI provider — shells out to locally-installed `claude` CLI.
240
255
  * Uses `--output-format stream-json` to parse structured output and capture session IDs.
241
256
  * No API key needed; uses whatever auth the local Claude CLI has.
257
+ * Runs with the `"standard"` capability unless `capability` says otherwise.
242
258
  */
243
259
  declare class ClaudeCLIProvider implements Provider {
244
260
  private projectDir;
245
261
  private sessionId?;
246
262
  private continueSession;
263
+ /** Permission level this provider runs Claude Code with. */
264
+ readonly capability: AgentCapability;
247
265
  /** Last session ID captured from Claude CLI stream-json output. */
248
266
  lastSessionId?: string;
249
267
  constructor(options?: ClaudeCLIProviderOptions);
@@ -278,4 +296,4 @@ declare function parseMentions(text: string): string[];
278
296
  */
279
297
  declare function mentionsAgent(text: string, agentName: string): boolean;
280
298
 
281
- export { AGENT_TEMPLATES, AgentConfig, AgentIdentity, AgentRecord, type AgentTemplate, AnthropicProvider, type AnthropicProviderOptions, ClaudeCLIProvider, type ClaudeCLIProviderOptions, GoogleProvider, type GoogleProviderOptions, JaibberAgent, JaibberClient, MessageHandler, OpenAIProvider, type OpenAIProviderOptions, Project, type Provider, TaskHandler, getTemplate, mentionsAgent, parseMentions };
299
+ export { AGENT_TEMPLATES, type AgentCapability, AgentConfig, AgentIdentity, AgentRecord, type AgentTemplate, AnthropicProvider, type AnthropicProviderOptions, ClaudeCLIProvider, type ClaudeCLIProviderOptions, GoogleProvider, type GoogleProviderOptions, JaibberAgent, JaibberClient, MessageHandler, OpenAIProvider, type OpenAIProviderOptions, Project, type Provider, TaskHandler, getTemplate, mentionsAgent, parseMentions };
package/dist/index.js CHANGED
@@ -279,12 +279,16 @@ var JaibberClient = class _JaibberClient {
279
279
  setToken(token) {
280
280
  this.jwt = token;
281
281
  }
282
- /** POST /api/auth/register — create a new account, stores JWT. */
283
- async register(username, password) {
282
+ /**
283
+ * POST /api/auth/register — create a new account, stores JWT. The server requires
284
+ * `acceptTerms: true`: the person creating the account is 16 or older and agrees to
285
+ * https://www.jaibber.com/terms and /privacy.
286
+ */
287
+ async register(username, password, opts = {}) {
284
288
  const res = await this.fetchFn(`${this.serverUrl}/api/auth/register`, {
285
289
  method: "POST",
286
290
  headers: { "Content-Type": "application/json" },
287
- body: JSON.stringify({ username, password })
291
+ body: JSON.stringify({ username, password, acceptTerms: opts.acceptTerms === true })
288
292
  });
289
293
  if (!res.ok) {
290
294
  throw await legacyError(
@@ -1762,16 +1766,36 @@ var GoogleProvider = class {
1762
1766
  // src/providers/claude-cli.ts
1763
1767
  import { spawn } from "child_process";
1764
1768
  import { createInterface } from "readline";
1769
+ var CAPABILITIES = ["readonly", "standard", "full"];
1770
+ function claudePermissionArgs(capability) {
1771
+ switch (capability) {
1772
+ case "readonly":
1773
+ return ["--allowedTools", "Read,Grep,Glob", "--permission-mode", "dontAsk"];
1774
+ case "standard":
1775
+ return ["--allowedTools", "Read,Edit,Write,Bash,Grep,Glob", "--permission-mode", "acceptEdits"];
1776
+ case "full":
1777
+ return ["--dangerously-skip-permissions"];
1778
+ }
1779
+ }
1765
1780
  var ClaudeCLIProvider = class {
1766
1781
  projectDir;
1767
1782
  sessionId;
1768
1783
  continueSession;
1784
+ /** Permission level this provider runs Claude Code with. */
1785
+ capability;
1769
1786
  /** Last session ID captured from Claude CLI stream-json output. */
1770
1787
  lastSessionId;
1771
1788
  constructor(options = {}) {
1772
1789
  this.projectDir = options.projectDir ?? process.cwd();
1773
1790
  this.sessionId = options.sessionId;
1774
1791
  this.continueSession = options.continueSession ?? false;
1792
+ const capability = options.capability ?? "standard";
1793
+ if (!CAPABILITIES.includes(capability)) {
1794
+ throw new Error(
1795
+ `Invalid capability "${String(capability)}" \u2014 use "readonly", "standard" or "full".`
1796
+ );
1797
+ }
1798
+ this.capability = capability;
1775
1799
  }
1776
1800
  /** Update session ID for future --resume calls. */
1777
1801
  setSessionId(id) {
@@ -1798,7 +1822,13 @@ ${systemPrompt}
1798
1822
  fullPrompt += "\n\n---\n\n";
1799
1823
  }
1800
1824
  fullPrompt += prompt;
1801
- const args = ["--print", "--verbose", "--output-format", "stream-json", "--dangerously-skip-permissions"];
1825
+ const args = [
1826
+ "--print",
1827
+ "--verbose",
1828
+ "--output-format",
1829
+ "stream-json",
1830
+ ...claudePermissionArgs(this.capability)
1831
+ ];
1802
1832
  if (this.sessionId) {
1803
1833
  if (/^[a-zA-Z0-9-]+$/.test(this.sessionId)) {
1804
1834
  args.push("--resume", this.sessionId);