@lilbox/client 0.0.3 → 0.0.5

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 |
@@ -189,6 +187,8 @@ Error codes. New codes may be added; existing ones never change meaning.
189
187
  | `payment_required` | The account must subscribe (trial ended, or the feature needs a paid plan). `checkout_url` when available |
190
188
  | `quota_exceeded` | A plan limit is used up this billing period. `meter`, `used`, `limit`, `resets_at` |
191
189
  | `rate_limited` | Too many requests from this credential or IP. `retry_after_seconds` |
190
+ | `terms_required` | The user hasn't accepted the Terms yet; a person accepts them in the dashboard |
191
+ | `reauth_required` | The action needs a sign-in in the last 15 minutes (dashboard only) |
192
192
  | `suspended` | lilbox suspended the app or account. `reason` |
193
193
  | `invalid_request` | The input failed validation. `issues`, each with a path |
194
194
  | `invalid_manifest` | `app.yaml` is invalid. `issues` |
@@ -482,18 +482,18 @@ To validate data at runtime (forms, `app.yaml`, inputs), use the zod schemas in
482
482
 
483
483
  ## Endpoint reference
484
484
 
485
- "Scope" is what a bearer token needs. The dashboard session can call everything.
485
+ "Scope" is what an API key or agent token needs. The dashboard token can call everything.
486
486
 
487
487
  **Account**
488
488
 
489
489
  | Method | Path | Operation | Scope |
490
490
  |---|---|---|---|
491
491
  | `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 |
492
+ | `GET` | `/v1/account/agents` | `list_connected_agents` | dashboard only |
493
+ | `DELETE` | `/v1/account/agents/{agent_id}` | `revoke_connected_agent` | dashboard only |
494
+ | `GET` | `/v1/account/api-keys` | `list_api_keys` | dashboard only |
495
+ | `POST` | `/v1/account/api-keys` | `create_api_key` | dashboard only |
496
+ | `DELETE` | `/v1/account/api-keys/{key_id}` | `revoke_api_key` | dashboard only |
497
497
 
498
498
  **Apps and config**
499
499
 
@@ -544,7 +544,7 @@ To validate data at runtime (forms, `app.yaml`, inputs), use the zod schemas in
544
544
  | `GET` | `/v1/billing-periods` | `list_billing_periods`: past periods, usage and invoices | `billing:read` |
545
545
  | `POST` | `/v1/subscription/upgrade` | `request_upgrade`: a checkout URL for a person | `billing:read` |
546
546
  | `GET` | `/v1/referral` | `get_referral` | `billing:read` |
547
- | `POST` | `/v1/subscription/portal` | `open_billing_portal` | dashboard session only |
547
+ | `POST` | `/v1/subscription/portal` | `open_billing_portal` | dashboard only |
548
548
 
549
549
  Each operation's description, inputs and outputs are in the types: hover the path in your editor. The same
550
550
  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
  };
@@ -812,7 +812,7 @@ export interface components {
812
812
  };
813
813
  ApiError: {
814
814
  /** @enum {string} */
815
- code: "unauthenticated" | "forbidden_scope" | "approval_required" | "payment_required" | "quota_exceeded" | "rate_limited" | "suspended" | "invalid_request" | "invalid_manifest" | "not_found" | "conflict" | "not_available" | "plan_unavailable" | "source_too_large" | "build_failed" | "image_too_large" | "migration_failed" | "healthcheck_failed" | "app_crashed_on_start" | "deploy_timeout" | "capability_requires_plan" | "capability_unconfirmed" | "domain_unverified" | "cert_pending" | "db_quota_exceeded" | "internal";
815
+ code: "unauthenticated" | "forbidden_scope" | "approval_required" | "payment_required" | "quota_exceeded" | "rate_limited" | "terms_required" | "reauth_required" | "suspended" | "invalid_request" | "invalid_manifest" | "not_found" | "conflict" | "not_available" | "plan_unavailable" | "source_too_large" | "build_failed" | "image_too_large" | "migration_failed" | "healthcheck_failed" | "app_crashed_on_start" | "deploy_timeout" | "capability_requires_plan" | "capability_unconfirmed" | "domain_unverified" | "cert_pending" | "db_quota_exceeded" | "internal";
816
816
  /** @description What went wrong, for a human. */
817
817
  message: string;
818
818
  /** @description True if the same call may succeed later unchanged. */
@@ -928,7 +928,7 @@ export interface components {
928
928
  /** @enum {string} */
929
929
  result: "succeeded" | "failed";
930
930
  /** @enum {string} */
931
- error_code?: "unauthenticated" | "forbidden_scope" | "approval_required" | "payment_required" | "quota_exceeded" | "rate_limited" | "suspended" | "invalid_request" | "invalid_manifest" | "not_found" | "conflict" | "not_available" | "plan_unavailable" | "source_too_large" | "build_failed" | "image_too_large" | "migration_failed" | "healthcheck_failed" | "app_crashed_on_start" | "deploy_timeout" | "capability_requires_plan" | "capability_unconfirmed" | "domain_unverified" | "cert_pending" | "db_quota_exceeded" | "internal";
931
+ error_code?: "unauthenticated" | "forbidden_scope" | "approval_required" | "payment_required" | "quota_exceeded" | "rate_limited" | "terms_required" | "reauth_required" | "suspended" | "invalid_request" | "invalid_manifest" | "not_found" | "conflict" | "not_available" | "plan_unavailable" | "source_too_large" | "build_failed" | "image_too_large" | "migration_failed" | "healthcheck_failed" | "app_crashed_on_start" | "deploy_timeout" | "capability_requires_plan" | "capability_unconfirmed" | "domain_unverified" | "cert_pending" | "db_quota_exceeded" | "internal";
932
932
  request_id: string;
933
933
  ip?: string;
934
934
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lilbox/client",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "Typed HTTP client for the lilbox API, generated from @lilbox/contracts' OpenAPI document.",
5
5
  "license": "MIT",
6
6
  "type": "module",