bkper 5.7.3 → 5.8.1
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 +25 -0
- package/lib/agent/bundle/agent-entry.js +110 -103
- package/lib/agent/context-resources.d.ts +44 -0
- package/lib/agent/context-resources.d.ts.map +1 -0
- package/lib/agent/context-resources.js +110 -0
- package/lib/agent/context-resources.js.map +1 -0
- package/lib/agent/interactive/run-agent-mode.d.ts +2 -0
- package/lib/agent/interactive/run-agent-mode.d.ts.map +1 -1
- package/lib/agent/interactive/run-agent-mode.js +22 -3
- package/lib/agent/interactive/run-agent-mode.js.map +1 -1
- package/lib/agent/startup-maintenance.d.ts +13 -2
- package/lib/agent/startup-maintenance.d.ts.map +1 -1
- package/lib/agent/startup-maintenance.js +35 -8
- package/lib/agent/startup-maintenance.js.map +1 -1
- package/lib/cli.js +3 -0
- package/lib/cli.js.map +1 -1
- package/lib/commands/agent-command.d.ts +9 -1
- package/lib/commands/agent-command.d.ts.map +1 -1
- package/lib/commands/agent-command.js +45 -4
- package/lib/commands/agent-command.js.map +1 -1
- package/lib/commands/apps/dev.d.ts.map +1 -1
- package/lib/commands/apps/dev.js +5 -4
- package/lib/commands/apps/dev.js.map +1 -1
- package/lib/commands/apps/git/credentials.d.ts +1 -0
- package/lib/commands/apps/git/credentials.d.ts.map +1 -1
- package/lib/commands/apps/git/credentials.js +1 -1
- package/lib/commands/apps/git/credentials.js.map +1 -1
- package/lib/commands/context/book-context.d.ts +20 -0
- package/lib/commands/context/book-context.d.ts.map +1 -0
- package/lib/commands/context/book-context.js +40 -0
- package/lib/commands/context/book-context.js.map +1 -0
- package/lib/commands/context/domain-context.d.ts +21 -0
- package/lib/commands/context/domain-context.d.ts.map +1 -0
- package/lib/commands/context/domain-context.js +39 -0
- package/lib/commands/context/domain-context.js.map +1 -0
- package/lib/commands/context/git-credential.d.ts +17 -0
- package/lib/commands/context/git-credential.d.ts.map +1 -0
- package/lib/commands/context/git-credential.js +121 -0
- package/lib/commands/context/git-credential.js.map +1 -0
- package/lib/commands/context/platform-context.d.ts +42 -0
- package/lib/commands/context/platform-context.d.ts.map +1 -0
- package/lib/commands/context/platform-context.js +84 -0
- package/lib/commands/context/platform-context.js.map +1 -0
- package/lib/commands/context/register.d.ts +4 -0
- package/lib/commands/context/register.d.ts.map +1 -0
- package/lib/commands/context/register.js +79 -0
- package/lib/commands/context/register.js.map +1 -0
- package/lib/commands/context/user-context.d.ts +36 -0
- package/lib/commands/context/user-context.d.ts.map +1 -0
- package/lib/commands/context/user-context.js +125 -0
- package/lib/commands/context/user-context.js.map +1 -0
- package/lib/dev/auth-middleware.d.ts +11 -1
- package/lib/dev/auth-middleware.d.ts.map +1 -1
- package/lib/dev/auth-middleware.js +16 -1
- package/lib/dev/auth-middleware.js.map +1 -1
- package/lib/dev/local-outbound.d.ts +7 -0
- package/lib/dev/local-outbound.d.ts.map +1 -1
- package/lib/dev/local-outbound.js +26 -12
- package/lib/dev/local-outbound.js.map +1 -1
- package/lib/dev/managed-sandbox.d.ts +11 -0
- package/lib/dev/managed-sandbox.d.ts.map +1 -0
- package/lib/dev/managed-sandbox.js +13 -0
- package/lib/dev/managed-sandbox.js.map +1 -0
- package/lib/dev/tunnel.d.ts +5 -0
- package/lib/dev/tunnel.d.ts.map +1 -1
- package/lib/dev/tunnel.js +15 -0
- package/lib/dev/tunnel.js.map +1 -1
- package/lib/docs/api/ai-gateway.md +1 -0
- package/lib/docs/api/managed-agent.md +107 -3
- package/lib/docs/apps/ai.md +2 -1
- package/lib/docs/apps/development.md +27 -0
- package/lib/docs/cli/app-management.md +3 -1
- package/lib/docs/core/core-concepts.md +1 -1
- package/lib/docs/sdk/bkper-api-types.md +1 -0
- package/package.json +1 -1
|
@@ -107,6 +107,28 @@ the totals you checked.
|
|
|
107
107
|
- A fork keeps its parent's instructions unless the create request sets new ones. Continuing someone else's session never takes theirs.
|
|
108
108
|
- Sessions keep the text they were given. Updating your client changes only the sessions it creates or patches.
|
|
109
109
|
|
|
110
|
+
### Agent context
|
|
111
|
+
|
|
112
|
+
After your `instructions`, the agent reads its context: an `AGENTS.md` and skills (`.agents/skills/<name>/SKILL.md`) that people, the agent, or any other agent following the [AGENTS.md](https://agents.md/) and [Agent Skills](https://agentskills.io/specification) standards keep in a context repository per scope. A session loads the user's company's (their verified domain's, when they have one: shared by everyone in the domain, changed only by its admin), then the user's own, then its Book's (from its first input's `bookContext`, shared by everyone who can view the Book). Each is more specific than the one before and wins: a Book's skills replace the user's of the same name, and the user's the company's. It loads when the session starts and again at the start of each turn (an input that is not a steer or follow-up: a run never changes its context midway), each scope from the sandbox's working copy when the sandbox is running and the user or agent changed it there (local changes win, as on a local machine), else as published: the session's `contextScopes` show what loaded. When it changed, the agent is told so with that input. A fork starts with what its parent loaded.
|
|
113
|
+
It loads as the person in every workspace, an App's included (such as a Slack bot's): permissions are the person's. Context of other Books never loads; the agent clones one only when asked.
|
|
114
|
+
|
|
115
|
+
- Loading never delays a session by more than about two seconds: at the start, a scope that is slow or fails is skipped and shown as `unavailable`, never as an error in the conversation; at a turn, the session keeps all of what it had.
|
|
116
|
+
- Context guides; it never grants anything. The user's messages override it, and it cannot relax Bkper's base.
|
|
117
|
+
|
|
118
|
+
### Workspace
|
|
119
|
+
|
|
120
|
+
The Workspace is the agent's computer as people see it: the working copies in the sandbox of the workspace you call through (the user's own, or your app's own for that user), the same files the agent sees, which both the user and the agent change. Nothing in them reaches anyone else, or any agent's context, until the user saves: Save publishes. Readers of shared sessions never reach someone else's.
|
|
121
|
+
|
|
122
|
+
Repositories are named as one tree: `user` (the user's own context), `domain` (their company's, when they have a verified domain) and `books/{bookId}` (a Book's), the folders the sandbox and a local machine keep in `~/.bkper`, and `apps/{appId}` (the source of an App the user develops, in `/workspace/apps`). `GET /v1/workspace?bookId=` lists the root, as published: the user's domain, when they have one, the Book, named by Bkper, when the user can view it, and every App the user develops, those hosted elsewhere with their `repoUrl` instead of a repository. `GET /v1/workspace/status` reads every working copy in one call: its `fingerprint` (Git's tree id of its files, which changes whenever they do), its `base` (the published commit it builds on) and its marks (the files `added`, `modified` and `deleted` since the base, committed or not), plus the App folders in the sandbox, also those Bkper does not know yet. Opening a repository the sandbox does not have clones it there.
|
|
123
|
+
|
|
124
|
+
- **Read**: a repository's files and marks (`canEdit` says whether the user may change and save it), one file's text and blob id (`version=base` for the base's), one PNG or JPEG picture's bytes (`/image`, at most 5 MiB, typed by its bytes).
|
|
125
|
+
- **Change the working copy**: write a file over the version read (`previous`, the `sha` read: what changed since, such as by the agent, is 409 `file_changed`), move (rename) or delete a file or folder, add files from the user's computer (`/add`: 1 to 100 files at their full paths, each base64 of its exact bytes, a PNG or JPEG up to 5 MiB or text up to 256 KiB, at most 10 MiB together), undo a published commit (`/revert`), and discard changes (`/discard`: back to the base; a file never published goes). `POST /v1/workspace/copy` copies or moves a file or folder between two context repositories' working copies, such as into a Book from `GET /v1/workspace/books` (the Books whose context the user may change). A destination that exists is 409 `file_exists` (never overwritten; an add's lists every such file in `paths` at once, replaced only when it says `replace`), what cannot be written (a path, not text, too large) is 422 `file_invalid` with a `reason`; context may hold drafts agents would not load yet (the listing's `warnings` say so, and Save refuses them), and while Git works in the repository (the agent's, or a sync) 409 `workspace_busy`: nothing changed, try again.
|
|
126
|
+
- **Review and save**: `/changes` shows everything Save would publish, each file before and after, with the working copy's `fingerprint`; `POST …/save` with that `fingerprint` publishes exactly what was reviewed: the agent's commits as they are (their messages and trailers in History), plus one commit of the rest, authored and committed by the user with an automatic message, never forced and never deployed. Changed since the review is 409 `review_stale`; someone published changes to the same lines meanwhile is 409 `publish_conflict`, naming the files (`paths`) and who published them (`publishers`), with nothing published and the working copy as before; an App Bkper does not know yet is 409 `app_unregistered` until the agent registers it.
|
|
127
|
+
- **App secrets**: the secrets of an App's deployments on Bkper, production and preview, as `bkper app secrets` sets them, without the value ever reaching the agent or a conversation. `GET /v1/workspace/apps/{appId}/secrets` lists each deployment's names, or that the App is not deployed there yet; `PUT …/secrets/{name}?env=` with `{ "value" }` sets one (a name set again is replaced) and `DELETE` removes one, for the App's owner and developers (403 `workspace_forbidden`), only where it is deployed (409 `not_deployed`). Values are write-only. Only with the user's own token: through an app or channel bot these routes are 404.
|
|
128
|
+
- **History**, as published: the latest 20 commits with the files each changed and whether each was made with the agent's help (`agent`: its message ends with the trailer `Assisted-by: Bkper Agent`; the user stays its author and committer), and what one of them changed (`/commit`, each file before and after).
|
|
129
|
+
|
|
130
|
+
When the user changes the working copy, the agent is told which files with its next message. Context changed there applies to the user's sessions from their next turn while the sandbox runs; Save publishes it to everyone in its scope.
|
|
131
|
+
|
|
110
132
|
## Who the agent acts as
|
|
111
133
|
|
|
112
134
|
Every request acts as the user whose token you send. That user's Book permissions and Bkper AI allowance apply.
|
|
@@ -323,6 +345,8 @@ Before the agent reads the input, each file is copied into its workspace, at `/w
|
|
|
323
345
|
|
|
324
346
|
When the agent publishes a file, a `tool_result` entry carries a `file` part with `fileId`, `name`, `mediaType`, and `size`. List a session's published files with `GET /v1/sessions/{sessionId}/files`.
|
|
325
347
|
|
|
348
|
+
In the user's own workspace, when the agent shows an App it is building running live (`show_app`), the `tool_result` entry carries a `live_app` part with the App's `appId`, `name`, and `menuUrl`, when it has one.
|
|
349
|
+
|
|
326
350
|
### Download, retention, and quotas
|
|
327
351
|
|
|
328
352
|
- `GET /v1/files/{fileId}` returns the `File`; `GET /v1/files/{fileId}/content` its bytes, always as an attachment. The `Content-Type` is the allowlisted type for the name, never an upload's declared type; anything else is `application/octet-stream`.
|
|
@@ -432,6 +456,14 @@ Google APIs take a service account instead of a token: send its JSON key file as
|
|
|
432
456
|
|
|
433
457
|
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
458
|
|
|
459
|
+
### Domain services
|
|
460
|
+
|
|
461
|
+
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.
|
|
462
|
+
|
|
463
|
+
- `GET /v1/domain/services` lists the caller's domain's services, for any member; without a domain, the list is empty.
|
|
464
|
+
- `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.
|
|
465
|
+
- 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.
|
|
466
|
+
|
|
435
467
|
## Limits
|
|
436
468
|
|
|
437
469
|
| Limit | Value |
|
|
@@ -446,7 +478,8 @@ In the agent's workspace, Google's client libraries find credentials through `GO
|
|
|
446
478
|
| `bookContext.query` | 4,000 characters |
|
|
447
479
|
| `attributes` | 16 names, 16000 characters in total |
|
|
448
480
|
| 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 |
|
|
481
|
+
| Connected services | 20 per user and 20 per domain, 10 hosts each, tokens and keys up to 8192 characters, 20 Google scopes |
|
|
482
|
+
| App secret value | 5 KiB |
|
|
450
483
|
|
|
451
484
|
## Errors
|
|
452
485
|
|
|
@@ -457,9 +490,10 @@ Errors are `{ "error": { "code", "type", "message" } }`. Branch on `code`.
|
|
|
457
490
|
| 400 | `invalid_request`, `unknown_model`, `unknown_thinking_level` | A field is invalid or unknown |
|
|
458
491
|
| 400 | `host_not_allowed` | A connected service names a host that has its own route, such as Bkper's or Google's token endpoint |
|
|
459
492
|
| 401 | `unauthorized`, `authentication_failed` | The token is missing, invalid, or expired |
|
|
460
|
-
| 403 | `agent_beta_required` | The account cannot use the agent, such as one without an email address |
|
|
461
493
|
| 403 | `origin_forbidden` | A browser on another website sent a write |
|
|
462
494
|
| 403 | `book_access_required` | The user cannot view the Book whose shared sessions they asked for |
|
|
495
|
+
| 403 | `domain_admin_required` | Only the domain's admin changes its services |
|
|
496
|
+
| 403 | `workspace_forbidden` | The user may not change or save this Workspace repository, or change this App's secrets |
|
|
463
497
|
| 404 | `not_found`, `parent_not_found`, `file_not_found` | No such resource for this user |
|
|
464
498
|
| 405 | `method_not_allowed` | The path does not support the method |
|
|
465
499
|
| 409 | `idempotency_conflict` | The key was used with different content |
|
|
@@ -468,10 +502,15 @@ Errors are `{ "error": { "code", "type", "message" } }`. Branch on `code`.
|
|
|
468
502
|
| 409 | `file_quota_exceeded` | The user's upload quota is full |
|
|
469
503
|
| 409 | `share_unavailable` | The session cannot be shared: an app's workspace, or outside a Book without a hosted domain |
|
|
470
504
|
| 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 |
|
|
505
|
+
| 409 | `host_in_use`, `service_limit` | Another service holds the host, or the user (or domain) has 20 services |
|
|
506
|
+
| 409 | `file_changed`, `file_exists` | A Workspace file changed since it was read, or a destination exists |
|
|
507
|
+
| 409 | `workspace_busy` | Git is working in the Workspace repository; nothing changed, try again |
|
|
508
|
+
| 409 | `not_deployed` | The App is not deployed to that environment: nothing to set there yet |
|
|
509
|
+
| 409 | `review_stale`, `publish_conflict`, `app_unregistered` | Save: the files changed since the review, someone published changes to the same lines, or the App is not known to Bkper yet |
|
|
472
510
|
| 410 | `file_gone` | The file's stored copy was deleted |
|
|
473
511
|
| 411 | `length_required` | An upload has no `Content-Length` |
|
|
474
512
|
| 413 | `request_too_large`, `file_too_large` | The JSON body exceeds 64 KiB, or the upload 25 MiB |
|
|
513
|
+
| 422 | `file_invalid` | A Workspace change cannot be written or saved; `reason` says why |
|
|
475
514
|
| 503 | `service_unavailable`, `authentication_failed` | A dependency is unavailable; retry with backoff |
|
|
476
515
|
|
|
477
516
|
Model failures appear on the failed input and reply as `error.code`, such as `usage_limit_exceeded` when the monthly Bkper AI allowance is used up.
|
|
@@ -530,6 +569,71 @@ Each operation has its own page. The machine-readable contract is [openapi.json]
|
|
|
530
569
|
- [`GET /v1/services` — List connected services](https://bkper.com/docs/api/managed-agent/operations/listservices.md)
|
|
531
570
|
- [`PUT /v1/services/{serviceId}` — Connect or replace a service](https://bkper.com/docs/api/managed-agent/operations/putservice.md)
|
|
532
571
|
- [`DELETE /v1/services/{serviceId}` — Disconnect a service](https://bkper.com/docs/api/managed-agent/operations/deleteservice.md)
|
|
572
|
+
- [`GET /v1/domain/services` — List domain services](https://bkper.com/docs/api/managed-agent/operations/listdomainservices.md)
|
|
573
|
+
- [`PUT /v1/domain/services/{serviceId}` — Connect or replace a domain service](https://bkper.com/docs/api/managed-agent/operations/putdomainservice.md)
|
|
574
|
+
- [`DELETE /v1/domain/services/{serviceId}` — Disconnect a domain service](https://bkper.com/docs/api/managed-agent/operations/deletedomainservice.md)
|
|
575
|
+
|
|
576
|
+
### Workspace
|
|
577
|
+
|
|
578
|
+
- [`GET /v1/workspace` — Get the Workspace](https://bkper.com/docs/api/managed-agent/operations/getworkspace.md)
|
|
579
|
+
- [`GET /v1/workspace/status` — Get the working copies' status](https://bkper.com/docs/api/managed-agent/operations/getworkspacestatus.md)
|
|
580
|
+
- [`GET /v1/workspace/books` — List Books to copy to](https://bkper.com/docs/api/managed-agent/operations/listworkspacebooks.md)
|
|
581
|
+
- [`POST /v1/workspace/copy` — Copy or move to another repository](https://bkper.com/docs/api/managed-agent/operations/copyworkspaceentry.md)
|
|
582
|
+
- [`GET /v1/workspace/user` — Get a repository](https://bkper.com/docs/api/managed-agent/operations/getusercontext.md)
|
|
583
|
+
- [`GET /v1/workspace/user/file` — Read a file](https://bkper.com/docs/api/managed-agent/operations/getusercontextfile.md)
|
|
584
|
+
- [`PUT /v1/workspace/user/file` — Write a file](https://bkper.com/docs/api/managed-agent/operations/putusercontextfile.md)
|
|
585
|
+
- [`GET /v1/workspace/user/image` — Read a picture](https://bkper.com/docs/api/managed-agent/operations/getusercontextimage.md)
|
|
586
|
+
- [`GET /v1/workspace/user/history` — List history](https://bkper.com/docs/api/managed-agent/operations/listusercontexthistory.md)
|
|
587
|
+
- [`GET /v1/workspace/user/commit` — Get a commit's changes](https://bkper.com/docs/api/managed-agent/operations/getusercontextcommit.md)
|
|
588
|
+
- [`POST /v1/workspace/user/revert` — Undo a commit](https://bkper.com/docs/api/managed-agent/operations/revertusercontext.md)
|
|
589
|
+
- [`POST /v1/workspace/user/move` — Move or rename a file or folder](https://bkper.com/docs/api/managed-agent/operations/moveusercontextentry.md)
|
|
590
|
+
- [`POST /v1/workspace/user/delete` — Delete a file or folder](https://bkper.com/docs/api/managed-agent/operations/deleteusercontextentry.md)
|
|
591
|
+
- [`POST /v1/workspace/user/add` — Add files](https://bkper.com/docs/api/managed-agent/operations/addusercontextfiles.md)
|
|
592
|
+
- [`POST /v1/workspace/user/discard` — Discard changes](https://bkper.com/docs/api/managed-agent/operations/discardusercontext.md)
|
|
593
|
+
- [`GET /v1/workspace/user/changes` — Review the changes](https://bkper.com/docs/api/managed-agent/operations/getusercontextchanges.md)
|
|
594
|
+
- [`POST /v1/workspace/user/save` — Save](https://bkper.com/docs/api/managed-agent/operations/saveusercontext.md)
|
|
595
|
+
- [`GET /v1/workspace/domain` — Get a repository](https://bkper.com/docs/api/managed-agent/operations/getdomaincontext.md)
|
|
596
|
+
- [`GET /v1/workspace/domain/file` — Read a file](https://bkper.com/docs/api/managed-agent/operations/getdomaincontextfile.md)
|
|
597
|
+
- [`PUT /v1/workspace/domain/file` — Write a file](https://bkper.com/docs/api/managed-agent/operations/putdomaincontextfile.md)
|
|
598
|
+
- [`GET /v1/workspace/domain/image` — Read a picture](https://bkper.com/docs/api/managed-agent/operations/getdomaincontextimage.md)
|
|
599
|
+
- [`GET /v1/workspace/domain/history` — List history](https://bkper.com/docs/api/managed-agent/operations/listdomaincontexthistory.md)
|
|
600
|
+
- [`GET /v1/workspace/domain/commit` — Get a commit's changes](https://bkper.com/docs/api/managed-agent/operations/getdomaincontextcommit.md)
|
|
601
|
+
- [`POST /v1/workspace/domain/revert` — Undo a commit](https://bkper.com/docs/api/managed-agent/operations/revertdomaincontext.md)
|
|
602
|
+
- [`POST /v1/workspace/domain/move` — Move or rename a file or folder](https://bkper.com/docs/api/managed-agent/operations/movedomaincontextentry.md)
|
|
603
|
+
- [`POST /v1/workspace/domain/delete` — Delete a file or folder](https://bkper.com/docs/api/managed-agent/operations/deletedomaincontextentry.md)
|
|
604
|
+
- [`POST /v1/workspace/domain/add` — Add files](https://bkper.com/docs/api/managed-agent/operations/adddomaincontextfiles.md)
|
|
605
|
+
- [`POST /v1/workspace/domain/discard` — Discard changes](https://bkper.com/docs/api/managed-agent/operations/discarddomaincontext.md)
|
|
606
|
+
- [`GET /v1/workspace/domain/changes` — Review the changes](https://bkper.com/docs/api/managed-agent/operations/getdomaincontextchanges.md)
|
|
607
|
+
- [`POST /v1/workspace/domain/save` — Save](https://bkper.com/docs/api/managed-agent/operations/savedomaincontext.md)
|
|
608
|
+
- [`GET /v1/workspace/books/{bookId}` — Get a repository](https://bkper.com/docs/api/managed-agent/operations/getbookcontext.md)
|
|
609
|
+
- [`GET /v1/workspace/books/{bookId}/file` — Read a file](https://bkper.com/docs/api/managed-agent/operations/getbookcontextfile.md)
|
|
610
|
+
- [`PUT /v1/workspace/books/{bookId}/file` — Write a file](https://bkper.com/docs/api/managed-agent/operations/putbookcontextfile.md)
|
|
611
|
+
- [`GET /v1/workspace/books/{bookId}/image` — Read a picture](https://bkper.com/docs/api/managed-agent/operations/getbookcontextimage.md)
|
|
612
|
+
- [`GET /v1/workspace/books/{bookId}/history` — List history](https://bkper.com/docs/api/managed-agent/operations/listbookcontexthistory.md)
|
|
613
|
+
- [`GET /v1/workspace/books/{bookId}/commit` — Get a commit's changes](https://bkper.com/docs/api/managed-agent/operations/getbookcontextcommit.md)
|
|
614
|
+
- [`POST /v1/workspace/books/{bookId}/revert` — Undo a commit](https://bkper.com/docs/api/managed-agent/operations/revertbookcontext.md)
|
|
615
|
+
- [`POST /v1/workspace/books/{bookId}/move` — Move or rename a file or folder](https://bkper.com/docs/api/managed-agent/operations/movebookcontextentry.md)
|
|
616
|
+
- [`POST /v1/workspace/books/{bookId}/delete` — Delete a file or folder](https://bkper.com/docs/api/managed-agent/operations/deletebookcontextentry.md)
|
|
617
|
+
- [`POST /v1/workspace/books/{bookId}/add` — Add files](https://bkper.com/docs/api/managed-agent/operations/addbookcontextfiles.md)
|
|
618
|
+
- [`POST /v1/workspace/books/{bookId}/discard` — Discard changes](https://bkper.com/docs/api/managed-agent/operations/discardbookcontext.md)
|
|
619
|
+
- [`GET /v1/workspace/books/{bookId}/changes` — Review the changes](https://bkper.com/docs/api/managed-agent/operations/getbookcontextchanges.md)
|
|
620
|
+
- [`POST /v1/workspace/books/{bookId}/save` — Save](https://bkper.com/docs/api/managed-agent/operations/savebookcontext.md)
|
|
621
|
+
- [`GET /v1/workspace/apps/{appId}` — Get a repository](https://bkper.com/docs/api/managed-agent/operations/getappsource.md)
|
|
622
|
+
- [`GET /v1/workspace/apps/{appId}/file` — Read a file](https://bkper.com/docs/api/managed-agent/operations/getappsourcefile.md)
|
|
623
|
+
- [`PUT /v1/workspace/apps/{appId}/file` — Write a file](https://bkper.com/docs/api/managed-agent/operations/putappsourcefile.md)
|
|
624
|
+
- [`GET /v1/workspace/apps/{appId}/image` — Read a picture](https://bkper.com/docs/api/managed-agent/operations/getappsourceimage.md)
|
|
625
|
+
- [`GET /v1/workspace/apps/{appId}/history` — List history](https://bkper.com/docs/api/managed-agent/operations/listappsourcehistory.md)
|
|
626
|
+
- [`GET /v1/workspace/apps/{appId}/commit` — Get a commit's changes](https://bkper.com/docs/api/managed-agent/operations/getappsourcecommit.md)
|
|
627
|
+
- [`POST /v1/workspace/apps/{appId}/revert` — Undo a commit](https://bkper.com/docs/api/managed-agent/operations/revertappsource.md)
|
|
628
|
+
- [`POST /v1/workspace/apps/{appId}/move` — Move or rename a file or folder](https://bkper.com/docs/api/managed-agent/operations/moveappsourceentry.md)
|
|
629
|
+
- [`POST /v1/workspace/apps/{appId}/delete` — Delete a file or folder](https://bkper.com/docs/api/managed-agent/operations/deleteappsourceentry.md)
|
|
630
|
+
- [`POST /v1/workspace/apps/{appId}/add` — Add files](https://bkper.com/docs/api/managed-agent/operations/addappsourcefiles.md)
|
|
631
|
+
- [`POST /v1/workspace/apps/{appId}/discard` — Discard changes](https://bkper.com/docs/api/managed-agent/operations/discardappsource.md)
|
|
632
|
+
- [`GET /v1/workspace/apps/{appId}/changes` — Review the changes](https://bkper.com/docs/api/managed-agent/operations/getappsourcechanges.md)
|
|
633
|
+
- [`POST /v1/workspace/apps/{appId}/save` — Save](https://bkper.com/docs/api/managed-agent/operations/saveappsource.md)
|
|
634
|
+
- [`GET /v1/workspace/apps/{appId}/secrets` — List an App's secrets](https://bkper.com/docs/api/managed-agent/operations/listappsecrets.md)
|
|
635
|
+
- [`PUT /v1/workspace/apps/{appId}/secrets/{name}` — Set an App's secret](https://bkper.com/docs/api/managed-agent/operations/putappsecret.md)
|
|
636
|
+
- [`DELETE /v1/workspace/apps/{appId}/secrets/{name}` — Delete an App's secret](https://bkper.com/docs/api/managed-agent/operations/deleteappsecret.md)
|
|
533
637
|
|
|
534
638
|
### Models
|
|
535
639
|
|
package/lib/docs/apps/ai.md
CHANGED
|
@@ -98,7 +98,7 @@ Keep schemas simple. Constraints such as a string's minimum or maximum length ma
|
|
|
98
98
|
|
|
99
99
|
## Run an agent
|
|
100
100
|
|
|
101
|
-
For a chat that does real work on Books, start a session on the [Managed Agent API](https://bkper.com/docs/api/managed-agent.md) from the app's server. Bkper runs the agent in the user's private cloud workspace, with the `bkper` CLI, files, and durable sessions. Your app keeps its screens, prompts, and instructions.
|
|
101
|
+
For a chat that does real work on Books, start a session on the [Managed Agent API](https://bkper.com/docs/api/managed-agent.md) from the app's server. Bkper runs the agent in the user's private cloud workspace, with the `bkper` CLI, files, and durable sessions. Your app keeps its screens, prompts, and instructions.
|
|
102
102
|
|
|
103
103
|
```ts
|
|
104
104
|
// No Authorization header: the platform adds the user's.
|
|
@@ -123,6 +123,7 @@ const session = await response.json();
|
|
|
123
123
|
Then follow the session's stream, or poll the input until it completes, as in the [quick start](https://bkper.com/docs/api/managed-agent.md#quick-start).
|
|
124
124
|
|
|
125
125
|
- **The user's agent.** Sessions belong to the user, so work started in your app continues in Bkper Agent or any other app.
|
|
126
|
+
- **The user's procedures.** The agent follows the user's [agent context](https://bkper.com/docs/ai/agent-context.md): their company's, their own, and the session's Book's, loaded after your instructions.
|
|
126
127
|
- **Your services as tools.** The agent can call your app's API as the user. Describe the routes in your instructions, and the agent can run your checks instead of redoing them.
|
|
127
128
|
- **Real changes.** Unlike a model call, the agent can change Books with the user's permissions. Say in your instructions when it may.
|
|
128
129
|
|
|
@@ -115,6 +115,33 @@ bkper app build
|
|
|
115
115
|
4. Trigger events in Bkper and inspect handler responses in the activity stream.
|
|
116
116
|
5. Run `npm run check` before considering the change complete.
|
|
117
117
|
|
|
118
|
+
## Develop with Bkper Agent
|
|
119
|
+
|
|
120
|
+
[Bkper Agent](https://bkper.com/docs/ai/bkper-agent/build-apps.md) can build and change your app in its cloud workspace, and show it live beside the conversation. There, `bkper app dev` runs without `bkper auth login`: the workspace adds the person's credentials to the app's calls to Bkper.
|
|
121
|
+
|
|
122
|
+
To show live, an app needs:
|
|
123
|
+
|
|
124
|
+
- **Bkper CLI 5.8.0 or later** in its lockfile.
|
|
125
|
+
- **The template's current Vite config**, which accepts the live host the agent sets in `BKPER_LIVE_HOST`:
|
|
126
|
+
|
|
127
|
+
```ts
|
|
128
|
+
// client/vite.config.ts
|
|
129
|
+
export default defineConfig(() => {
|
|
130
|
+
const liveHost = process.env.BKPER_LIVE_HOST;
|
|
131
|
+
return {
|
|
132
|
+
// ...
|
|
133
|
+
server: {
|
|
134
|
+
// ...
|
|
135
|
+
...(liveHost
|
|
136
|
+
? { allowedHosts: [liveHost] }
|
|
137
|
+
: { hmr: { host: 'localhost', port: 5173, clientPort: 5173 } }),
|
|
138
|
+
},
|
|
139
|
+
};
|
|
140
|
+
});
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
The events tunnel does not run in the agent's workspace, and only the person's browser reaches the live app. Test event handlers and integrations on a preview with `bkper app deploy --preview`.
|
|
144
|
+
|
|
118
145
|
## Debugging
|
|
119
146
|
|
|
120
147
|
- **Server errors** — Check the terminal output from `bkper app dev`. Worker runtime errors appear here.
|
|
@@ -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
|
|
@@ -129,7 +129,7 @@ Bkper maintains a continuous ledger with no concept of closing periods — the s
|
|
|
129
129
|
|
|
130
130
|
## Custom Properties
|
|
131
131
|
|
|
132
|
-
**Custom Properties** are key-value pairs attachable to any entity — Books, Accounts, Groups, Transactions,
|
|
132
|
+
**Custom Properties** are key-value pairs attachable to any entity — Books, Accounts, Groups, Transactions, and Files. They add context, metadata, and meaning beyond core financial data.
|
|
133
133
|
|
|
134
134
|
By attaching properties like `invoice: inv123456` or `exc_code: BRL`, entities become rich with information that can drive automation and reporting — without changing the core model.
|
|
135
135
|
|
|
@@ -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
|