bkper 5.7.3 → 5.8.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.
Files changed (71) hide show
  1. package/README.md +25 -0
  2. package/lib/agent/bundle/agent-entry.js +110 -103
  3. package/lib/agent/context-resources.d.ts +44 -0
  4. package/lib/agent/context-resources.d.ts.map +1 -0
  5. package/lib/agent/context-resources.js +110 -0
  6. package/lib/agent/context-resources.js.map +1 -0
  7. package/lib/agent/interactive/run-agent-mode.d.ts +2 -0
  8. package/lib/agent/interactive/run-agent-mode.d.ts.map +1 -1
  9. package/lib/agent/interactive/run-agent-mode.js +22 -3
  10. package/lib/agent/interactive/run-agent-mode.js.map +1 -1
  11. package/lib/agent/startup-maintenance.d.ts +13 -2
  12. package/lib/agent/startup-maintenance.d.ts.map +1 -1
  13. package/lib/agent/startup-maintenance.js +35 -8
  14. package/lib/agent/startup-maintenance.js.map +1 -1
  15. package/lib/cli.js +3 -0
  16. package/lib/cli.js.map +1 -1
  17. package/lib/commands/agent-command.d.ts +9 -1
  18. package/lib/commands/agent-command.d.ts.map +1 -1
  19. package/lib/commands/agent-command.js +45 -4
  20. package/lib/commands/agent-command.js.map +1 -1
  21. package/lib/commands/apps/dev.d.ts.map +1 -1
  22. package/lib/commands/apps/dev.js +5 -4
  23. package/lib/commands/apps/dev.js.map +1 -1
  24. package/lib/commands/apps/git/credentials.d.ts +1 -0
  25. package/lib/commands/apps/git/credentials.d.ts.map +1 -1
  26. package/lib/commands/apps/git/credentials.js +1 -1
  27. package/lib/commands/apps/git/credentials.js.map +1 -1
  28. package/lib/commands/context/book-context.d.ts +20 -0
  29. package/lib/commands/context/book-context.d.ts.map +1 -0
  30. package/lib/commands/context/book-context.js +40 -0
  31. package/lib/commands/context/book-context.js.map +1 -0
  32. package/lib/commands/context/domain-context.d.ts +21 -0
  33. package/lib/commands/context/domain-context.d.ts.map +1 -0
  34. package/lib/commands/context/domain-context.js +39 -0
  35. package/lib/commands/context/domain-context.js.map +1 -0
  36. package/lib/commands/context/git-credential.d.ts +17 -0
  37. package/lib/commands/context/git-credential.d.ts.map +1 -0
  38. package/lib/commands/context/git-credential.js +121 -0
  39. package/lib/commands/context/git-credential.js.map +1 -0
  40. package/lib/commands/context/platform-context.d.ts +42 -0
  41. package/lib/commands/context/platform-context.d.ts.map +1 -0
  42. package/lib/commands/context/platform-context.js +84 -0
  43. package/lib/commands/context/platform-context.js.map +1 -0
  44. package/lib/commands/context/register.d.ts +4 -0
  45. package/lib/commands/context/register.d.ts.map +1 -0
  46. package/lib/commands/context/register.js +79 -0
  47. package/lib/commands/context/register.js.map +1 -0
  48. package/lib/commands/context/user-context.d.ts +36 -0
  49. package/lib/commands/context/user-context.d.ts.map +1 -0
  50. package/lib/commands/context/user-context.js +125 -0
  51. package/lib/commands/context/user-context.js.map +1 -0
  52. package/lib/dev/auth-middleware.d.ts +11 -1
  53. package/lib/dev/auth-middleware.d.ts.map +1 -1
  54. package/lib/dev/auth-middleware.js +16 -1
  55. package/lib/dev/auth-middleware.js.map +1 -1
  56. package/lib/dev/local-outbound.d.ts +7 -0
  57. package/lib/dev/local-outbound.d.ts.map +1 -1
  58. package/lib/dev/local-outbound.js +26 -12
  59. package/lib/dev/local-outbound.js.map +1 -1
  60. package/lib/dev/managed-sandbox.d.ts +11 -0
  61. package/lib/dev/managed-sandbox.d.ts.map +1 -0
  62. package/lib/dev/managed-sandbox.js +13 -0
  63. package/lib/dev/managed-sandbox.js.map +1 -0
  64. package/lib/dev/tunnel.d.ts +5 -0
  65. package/lib/dev/tunnel.d.ts.map +1 -1
  66. package/lib/dev/tunnel.js +15 -0
  67. package/lib/dev/tunnel.js.map +1 -1
  68. package/lib/docs/api/managed-agent.md +14 -2
  69. package/lib/docs/cli/app-management.md +3 -1
  70. package/lib/docs/sdk/bkper-api-types.md +1 -0
  71. package/package.json +1 -1
@@ -432,6 +432,14 @@ Google APIs take a service account instead of a token: send its JSON key file as
432
432
 
433
433
  In the agent's workspace, Google's client libraries find credentials through `GOOGLE_APPLICATION_CREDENTIALS`, a placeholder key that grants nothing, and must use their REST transport (such as `{ fallback: true }`): gRPC does not leave the workspace.
434
434
 
435
+ ### Domain services
436
+
437
+ A domain's admin can connect a service for everyone in the domain, with the same requests under `/v1/domain/services`. The agent of every member then uses it, unless the member connected their own service for the same host, which comes first. A domain's token works for everyone in the domain and any app they authorize: choose its permissions as narrowly as you can.
438
+
439
+ - `GET /v1/domain/services` lists the caller's domain's services, for any member; without a domain, the list is empty.
440
+ - `PUT` and `DELETE /v1/domain/services/{serviceId}` are only for the domain's admin (403 `domain_admin_required`). The services belong to the domain, not the admin who connected them.
441
+ - Each host belongs to one service within the domain; a member's own services are apart. Through an app or channel bot these routes are 404.
442
+
435
443
  ## Limits
436
444
 
437
445
  | Limit | Value |
@@ -446,7 +454,7 @@ In the agent's workspace, Google's client libraries find credentials through `GO
446
454
  | `bookContext.query` | 4,000 characters |
447
455
  | `attributes` | 16 names, 16000 characters in total |
448
456
  | List page | 50 sessions, entries, or files |
449
- | Connected services | 20 per user, 10 hosts each, tokens and keys up to 8192 characters, 20 Google scopes |
457
+ | Connected services | 20 per user and 20 per domain, 10 hosts each, tokens and keys up to 8192 characters, 20 Google scopes |
450
458
 
451
459
  ## Errors
452
460
 
@@ -460,6 +468,7 @@ Errors are `{ "error": { "code", "type", "message" } }`. Branch on `code`.
460
468
  | 403 | `agent_beta_required` | The account cannot use the agent, such as one without an email address |
461
469
  | 403 | `origin_forbidden` | A browser on another website sent a write |
462
470
  | 403 | `book_access_required` | The user cannot view the Book whose shared sessions they asked for |
471
+ | 403 | `domain_admin_required` | Only the domain's admin changes its services |
463
472
  | 404 | `not_found`, `parent_not_found`, `file_not_found` | No such resource for this user |
464
473
  | 405 | `method_not_allowed` | The path does not support the method |
465
474
  | 409 | `idempotency_conflict` | The key was used with different content |
@@ -468,7 +477,7 @@ Errors are `{ "error": { "code", "type", "message" } }`. Branch on `code`.
468
477
  | 409 | `file_quota_exceeded` | The user's upload quota is full |
469
478
  | 409 | `share_unavailable` | The session cannot be shared: an app's workspace, or outside a Book without a hosted domain |
470
479
  | 409 | `book_access_required` | The user cannot view the Book the session was started in |
471
- | 409 | `host_in_use`, `service_limit` | Another service holds the host, or the user has 20 services |
480
+ | 409 | `host_in_use`, `service_limit` | Another service holds the host, or the user (or domain) has 20 services |
472
481
  | 410 | `file_gone` | The file's stored copy was deleted |
473
482
  | 411 | `length_required` | An upload has no `Content-Length` |
474
483
  | 413 | `request_too_large`, `file_too_large` | The JSON body exceeds 64 KiB, or the upload 25 MiB |
@@ -530,6 +539,9 @@ Each operation has its own page. The machine-readable contract is [openapi.json]
530
539
  - [`GET /v1/services` — List connected services](https://bkper.com/docs/api/managed-agent/operations/listservices.md)
531
540
  - [`PUT /v1/services/{serviceId}` — Connect or replace a service](https://bkper.com/docs/api/managed-agent/operations/putservice.md)
532
541
  - [`DELETE /v1/services/{serviceId}` — Disconnect a service](https://bkper.com/docs/api/managed-agent/operations/deleteservice.md)
542
+ - [`GET /v1/domain/services` — List domain services](https://bkper.com/docs/api/managed-agent/operations/listdomainservices.md)
543
+ - [`PUT /v1/domain/services/{serviceId}` — Connect or replace a domain service](https://bkper.com/docs/api/managed-agent/operations/putdomainservice.md)
544
+ - [`DELETE /v1/domain/services/{serviceId}` — Disconnect a domain service](https://bkper.com/docs/api/managed-agent/operations/deletedomainservice.md)
533
545
 
534
546
  ### Models
535
547
 
@@ -88,7 +88,7 @@ Verify:
88
88
 
89
89
  - Server worker responds: `curl http://localhost:8787/health` (or the port you configured)
90
90
  - Client dev server is reachable if running separately
91
- - If the app declares `events`, the events tunnel URL is printed in terminal and registered in Bkper as `webhookUrlDev`
91
+ - If the app declares `events`, the events tunnel URL is printed in terminal and registered in Bkper as `webhookUrlDev` (not in Bkper's managed agent sandbox: there, test events on a deployed preview)
92
92
  - If the worker fails to start, fix before writing code
93
93
 
94
94
  ### 3. Build
@@ -199,6 +199,8 @@ bkper app status <appId>
199
199
 
200
200
  > **Note:** `bkper app dev` runs one local Worker runtime — Miniflare, file watching, and an optional Cloudflare tunnel to `/events` when the app subscribes to events. Miniflare is loaded from the app project's `devDependencies` so each app can keep its local Workers simulator aligned with its own code. The Vite client dev server is configured in the project's `vite.config.ts` and run separately. The project template composes both via `npm run dev` using `concurrently`. Open the printed `Open app` URL in your browser; the `Worker/API` URL is for `/api`, `/health`, `/openapi.json`, and events. If your Vite server uses a port other than `5173`, pass that port with `--cp, --client-port` so the local `ASSETS` binding can reach it. If needed, install Miniflare in the app root with `bun add -d miniflare` or `npm install -D miniflare`.
201
201
 
202
+ > **Managed agent sandbox:** in Bkper's managed agent sandbox, `bkper app dev` needs no `bkper auth login`. The Worker's calls to the Bkper API and Bkper AI go out without the CLI's credentials (the sandbox adds its owner's), Bkper API calls go to the sandbox's own Bkper environment, and the client's `/auth/refresh` gets a placeholder token the sandbox replaces. The events tunnel is skipped there, since it cannot connect; test events on a deployed preview (`bkper app deploy --preview`).
203
+
202
204
  ---
203
205
 
204
206
  ## Clone managed source
@@ -538,6 +538,7 @@ More information at the [Bkper Developer Documentation](https://bkper.com/docs/#
538
538
  - `billingEnabled?`: `boolean` — True if billing is enabled for the user
539
539
  - `daysLeftInTrial?`: `number` — How many days left in trial
540
540
  - `domain?`: `bkper.Domain`
541
+ - `domainAdmin?`: `boolean` — True if the user is the admin of their domain
541
542
  - `email?`: `string` — The user email
542
543
  - `free?`: `boolean` — True if user is in the free plan
543
544
  - `fullName?`: `string` — The user full name
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bkper",
3
- "version": "5.7.3",
3
+ "version": "5.8.0",
4
4
  "description": "Official Bkper CLI for accounting data, automation, apps, and AI agents",
5
5
  "bin": {
6
6
  "bkper": "lib/cli.js"