@lilbox/client 0.0.3 → 0.0.4

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 CHANGED
@@ -53,9 +53,9 @@ The API accepts three kinds of credentials:
53
53
  |---|---|---|---|
54
54
  | API key | `lbx_…` | Created by a person in the dashboard, with chosen scopes and an optional expiry | CI, scripts, servers |
55
55
  | OAuth access token | opaque | The OAuth flow an MCP client or the lilbox CLI runs when it connects to an account | Agents and the CLI |
56
- | Session cookie | `lilbox_session` | Signing in at lilbox.ai | The lilbox dashboard only |
56
+ | Dashboard token | a JWT | Signing in at lilbox.ai; lasts 15 minutes and is refreshed by the dashboard | The lilbox dashboard only |
57
57
 
58
- API keys and OAuth tokens are sent as a bearer token:
58
+ All three are sent as a bearer token:
59
59
 
60
60
  ```ts
61
61
  const lilbox = createLilboxClient({ token: "lbx_..." });
@@ -67,11 +67,8 @@ If the token can change (an OAuth token you refresh), pass a function. It's call
67
67
  const lilbox = createLilboxClient({ token: async () => tokenStore.currentAccessToken() });
68
68
  ```
69
69
 
70
- In a browser on lilbox.ai, leave out `token` and send the session cookie instead:
71
-
72
- ```ts
73
- const lilbox = createLilboxClient({ credentials: "include" });
74
- ```
70
+ The lilbox dashboard passes a function that returns the signed-in user's current access token, refreshing it
71
+ when it's about to expire. lilbox uses no cookies.
75
72
 
76
73
  **Scopes.** Each credential carries scopes, and most operations need one (see the
77
74
  [endpoint reference](#endpoint-reference)). A call without the right scope fails with `forbidden_scope`, and
@@ -84,8 +81,9 @@ const lilbox = createLilboxClient({ credentials: "include" });
84
81
  | `deploy` | Check, create, cancel and roll back deployments |
85
82
  | `billing:read` | Subscription, usage, billing periods, referral; request an upgrade (a person completes it) |
86
83
 
87
- Operations marked "dashboard session only" (managing API keys and connected agents, the billing portal) refuse
88
- bearer tokens: a credential can never create credentials or widen its own access.
84
+ Operations marked "dashboard only" (managing API keys and connected agents, the billing portal) accept only the
85
+ dashboard token, never an API key or an agent's token: a credential can never create credentials or widen its
86
+ own access.
89
87
 
90
88
  `GET /v1/whoami` returns the signed-in user and the current credential's kind, scopes and expiry. Call it first
91
89
  to check a token.
@@ -100,7 +98,7 @@ createLilboxClient(options?: LilboxClientOptions): LilboxClient
100
98
  |---|---|---|---|
101
99
  | `baseUrl` | `string` | `"https://api.lilbox.ai"` | Change it for a local API, e.g. `http://localhost:3000` |
102
100
  | `token` | `string \| () => string \| undefined \| Promise<string \| undefined>` | none | Sent as `Authorization: Bearer <token>`. A function is called per request; returning `undefined` sends no header |
103
- | `credentials` | `RequestCredentials` | fetch's default | `"include"` to send the session cookie |
101
+ | `credentials` | `RequestCredentials` | fetch's default | fetch's credentials mode. lilbox uses no cookies, so rarely needed |
104
102
  | `userAgent` | `string` | none | Sent as `X-Lilbox-Client`, e.g. `"my-ci/1.4.0"`. Helps support find your requests |
105
103
  | `headers` | `Record<string, string>` | none | Extra headers on every request |
106
104
  | `fetch` | `typeof fetch` | `globalThis.fetch` | A custom fetch, for tests, proxies or older runtimes |
@@ -482,18 +480,18 @@ To validate data at runtime (forms, `app.yaml`, inputs), use the zod schemas in
482
480
 
483
481
  ## Endpoint reference
484
482
 
485
- "Scope" is what a bearer token needs. The dashboard session can call everything.
483
+ "Scope" is what an API key or agent token needs. The dashboard token can call everything.
486
484
 
487
485
  **Account**
488
486
 
489
487
  | Method | Path | Operation | Scope |
490
488
  |---|---|---|---|
491
489
  | `GET` | `/v1/whoami` | `whoami`: the user and this credential's scopes | any |
492
- | `GET` | `/v1/account/agents` | `list_connected_agents` | dashboard session only |
493
- | `DELETE` | `/v1/account/agents/{agent_id}` | `revoke_connected_agent` | dashboard session only |
494
- | `GET` | `/v1/account/api-keys` | `list_api_keys` | dashboard session only |
495
- | `POST` | `/v1/account/api-keys` | `create_api_key` | dashboard session only |
496
- | `DELETE` | `/v1/account/api-keys/{key_id}` | `revoke_api_key` | dashboard session only |
490
+ | `GET` | `/v1/account/agents` | `list_connected_agents` | dashboard only |
491
+ | `DELETE` | `/v1/account/agents/{agent_id}` | `revoke_connected_agent` | dashboard only |
492
+ | `GET` | `/v1/account/api-keys` | `list_api_keys` | dashboard only |
493
+ | `POST` | `/v1/account/api-keys` | `create_api_key` | dashboard only |
494
+ | `DELETE` | `/v1/account/api-keys/{key_id}` | `revoke_api_key` | dashboard only |
497
495
 
498
496
  **Apps and config**
499
497
 
@@ -544,7 +542,7 @@ To validate data at runtime (forms, `app.yaml`, inputs), use the zod schemas in
544
542
  | `GET` | `/v1/billing-periods` | `list_billing_periods`: past periods, usage and invoices | `billing:read` |
545
543
  | `POST` | `/v1/subscription/upgrade` | `request_upgrade`: a checkout URL for a person | `billing:read` |
546
544
  | `GET` | `/v1/referral` | `get_referral` | `billing:read` |
547
- | `POST` | `/v1/subscription/portal` | `open_billing_portal` | dashboard session only |
545
+ | `POST` | `/v1/subscription/portal` | `open_billing_portal` | dashboard only |
548
546
 
549
547
  Each operation's description, inputs and outputs are in the types: hover the path in your editor. The same
550
548
  operations are the lilbox MCP server's tools, under the names above (except the dashboard-only ones).
package/dist/index.d.ts CHANGED
@@ -10,11 +10,11 @@ export interface LilboxClientOptions {
10
10
  /** Default https://api.lilbox.ai. */
11
11
  baseUrl?: string;
12
12
  /**
13
- * An API key (lbx_…) or an OAuth access token, sent as a bearer token. A function is called before every
14
- * request, so a refreshed token is picked up. Leave it out in the dashboard: the session cookie is used.
13
+ * An API key (lbx_…), an OAuth access token, or the dashboard's access JWT, sent as a bearer token. A function
14
+ * is called before every request, so a refreshed token is picked up.
15
15
  */
16
16
  token?: string | (() => string | undefined | Promise<string | undefined>);
17
- /** "include" in the dashboard, so the lilbox_session cookie is sent. */
17
+ /** fetch's credentials mode. lilbox uses no cookies, so this is rarely needed. */
18
18
  credentials?: RequestCredentials;
19
19
  /** e.g. "lilbox-cli/1.2.0". Sent as X-Lilbox-Client (browsers don't allow setting User-Agent). */
20
20
  userAgent?: string;
package/dist/openapi.d.ts CHANGED
@@ -587,7 +587,7 @@ export interface components {
587
587
  user: components["schemas"]["User"];
588
588
  credential: {
589
589
  /** @enum {string} */
590
- kind: "session" | "agent" | "api_key";
590
+ kind: "dashboard" | "agent" | "api_key";
591
591
  scopes: ("apps:read" | "apps:write" | "deploy" | "billing:read")[];
592
592
  expires_at: string | null;
593
593
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lilbox/client",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "Typed HTTP client for the lilbox API, generated from @lilbox/contracts' OpenAPI document.",
5
5
  "license": "MIT",
6
6
  "type": "module",