bkper 5.4.0 → 5.5.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 (38) hide show
  1. package/README.md +14 -0
  2. package/lib/agent/extensions/auth-commands.d.ts.map +1 -1
  3. package/lib/agent/extensions/auth-commands.js +28 -10
  4. package/lib/agent/extensions/auth-commands.js.map +1 -1
  5. package/lib/agent/extensions/bkper-ai-provider.d.ts.map +1 -1
  6. package/lib/agent/extensions/bkper-ai-provider.js +17 -7
  7. package/lib/agent/extensions/bkper-ai-provider.js.map +1 -1
  8. package/lib/agent/system-prompt.d.ts.map +1 -1
  9. package/lib/agent/system-prompt.js +5 -4
  10. package/lib/agent/system-prompt.js.map +1 -1
  11. package/lib/auth/local-auth-service.d.ts.map +1 -1
  12. package/lib/auth/local-auth-service.js +12 -2
  13. package/lib/auth/local-auth-service.js.map +1 -1
  14. package/lib/commands/apps/api.d.ts +36 -0
  15. package/lib/commands/apps/api.d.ts.map +1 -0
  16. package/lib/commands/apps/api.js +144 -0
  17. package/lib/commands/apps/api.js.map +1 -0
  18. package/lib/commands/apps/index.d.ts +2 -0
  19. package/lib/commands/apps/index.d.ts.map +1 -1
  20. package/lib/commands/apps/index.js +2 -0
  21. package/lib/commands/apps/index.js.map +1 -1
  22. package/lib/commands/apps/list.d.ts +5 -3
  23. package/lib/commands/apps/list.d.ts.map +1 -1
  24. package/lib/commands/apps/list.js +13 -5
  25. package/lib/commands/apps/list.js.map +1 -1
  26. package/lib/commands/apps/register.d.ts.map +1 -1
  27. package/lib/commands/apps/register.js +37 -5
  28. package/lib/commands/apps/register.js.map +1 -1
  29. package/lib/docs/ai/decision-models.md +88 -248
  30. package/lib/docs/api/ai-gateway.md +397 -0
  31. package/lib/docs/api/managed-agent.md +385 -0
  32. package/lib/docs/apps/ai.md +39 -6
  33. package/lib/docs/apps/context-menu.md +97 -0
  34. package/lib/docs/cli/app-management.md +14 -1
  35. package/lib/docs/cli/app-usage.md +87 -0
  36. package/lib/docs/core/core-concepts.md +9 -3
  37. package/lib/docs/index.md +4 -1
  38. package/package.json +4 -4
@@ -0,0 +1,87 @@
1
+ # App Usage
2
+
3
+ Use the Apps installed in a Book, or available to install, to do work on it, instead of rebuilding what an App already does.
4
+
5
+ Apps are part of how a Book works. They react to its Events, read their settings from Custom Properties, act on the Book as their own users, and may offer an interface in the Book or an API. An App's own route keeps results consistent with what it does on its own, and it is the Book's established, auditable way to do that work.
6
+
7
+ All commands run as the signed-in user; Apps and Bkper enforce the user's Book permissions.
8
+
9
+ ---
10
+
11
+ ## Explore the Book's Apps
12
+
13
+ ```bash
14
+ # Apps installed in a book
15
+ bkper app list -b abc123
16
+
17
+ # One App in full, including its readme
18
+ bkper app get exchange-bot
19
+ ```
20
+
21
+ For each App, read:
22
+
23
+ - `description` and, for a closer look, the readme from `app get` — what it does and how people use it.
24
+ - `propertiesSchema` — the property keys it reads on the Book, Accounts, Groups, and Transactions.
25
+ - `events` — the Book changes it reacts to.
26
+ - `menuText` — its interface, opened from the Book's menu.
27
+
28
+ Match the `propertiesSchema` keys against the properties of the Book and its Accounts, Groups, and Transactions (`bkper book get`, `bkper account list`, `bkper group list`) to see which Apps are set up in this Book and how. Bot responses on events (`bkper event list -b <bookId>`) show what Apps have done.
29
+
30
+ ## Find an App to install
31
+
32
+ When no installed App fits the task, look in the catalog:
33
+
34
+ ```bash
35
+ # Apps you can install, most used first
36
+ bkper app list
37
+
38
+ # Read one App's readme before proposing it
39
+ bkper app get <appId>
40
+
41
+ # Install it (a change to the Book)
42
+ bkper app install <appId> -b <bookId>
43
+ ```
44
+
45
+ Read the readme for the setup an App needs after installation, usually properties on the Book, Accounts, or Groups.
46
+
47
+ ## Call an App's API
48
+
49
+ ```bash
50
+ # The App's OpenAPI spec: operations, parameters, and schemas
51
+ bkper app api spec inventory-bot
52
+
53
+ # Read
54
+ bkper app api request exchange-bot "/api/v1/books/abc123/exchange-rates?date=2026-08-05"
55
+
56
+ # Send JSON data (POST unless -X says otherwise)
57
+ bkper app api request inventory-bot /api/v1/books/abc123/accounts/def456/calculate -d '{"date":"2026-08-31"}'
58
+
59
+ # Larger bodies via stdin
60
+ cat body.json | bkper app api request merge-duplicates /api/v1/analyze
61
+ ```
62
+
63
+ - Read the spec before calling. Use paths exactly as written there, filling path parameters with IDs obtained from Bkper.
64
+ - Decide from each operation's summary, description, and schemas what it reads and what it changes in the Book. The HTTP method is a hint: GET usually only reads. When it is unclear whether an operation changes the Book, treat it as a change.
65
+ - Not every App has an API. `app api spec` then reports `<appId> does not publish an OpenAPI spec`. Such Apps work through Book events, and through their interface when they have one (`menuText`).
66
+ - A failed request exits with code 1 and `Error requesting app API: <status> <message>`, using the App's own error message.
67
+
68
+ ---
69
+
70
+ <details>
71
+ <summary>Command reference</summary>
72
+
73
+ - `app list` - List apps you have access to; readmes are omitted
74
+ - `-b, --book <bookId>` - List the apps installed in this book instead
75
+ - `app get <appId>` - Get an app, including its readme
76
+ - `app install <appId> -b <bookId>` - Install an app on a book
77
+ - `app uninstall <appId> -b <bookId>` - Uninstall an app from a book
78
+ - `app api spec <appId>` - Print the app's OpenAPI spec (`/openapi.json`)
79
+ - `-p, --preview` - Use the preview environment
80
+ - `app api request <appId> <path>` - Send a request to the app's API (`/api/...` paths only), as the signed-in user, and print the response body
81
+ - `-X, --method <method>` - HTTP method (default: `GET`, or `POST` when data is sent)
82
+ - `-d, --data <json>` - JSON request body; without it, a body piped via stdin is sent
83
+ - `-p, --preview` - Use the preview environment
84
+
85
+ Requests go to `https://{appId}.bkper.app`, or `https://{appId}-preview.bkper.app` with `--preview`. Redirects are not followed. JSON responses print compact when piped and pretty in a terminal; other responses print as they are.
86
+
87
+ </details>
@@ -143,10 +143,16 @@ Unlike Account structures, Hashtags can be added or removed as needs evolve, mak
143
143
 
144
144
  **Collections** group related Books for organization and consolidated views. Each Book remains self-contained and balanced — Collections simply provide navigation and structure across multiple Books. You might track resources in multiple currencies, or organize branch offices in one collection.
145
145
 
146
- Collections can also serve as references for automations (Bots or Apps) that work on all Books in the collection.
146
+ Collections can also serve as references for Apps that work on all Books in the collection.
147
147
 
148
148
  ## Events
149
149
 
150
- Every action in a Book — such as posting a transaction, editing an account, or attaching a file — generates an **Event**. Events record _who_ (a user) or _what_ (a bot, an automation) performed the action and _when_, forming a complete audit trail essential for collaboration and trust.
150
+ Every action in a Book — such as posting a transaction, editing an account, or attaching a file — generates an **Event**. Events record _who_ (a user) or _what_ (an App or an automation) performed the action and _when_, forming a complete audit trail essential for collaboration and trust.
151
151
 
152
- Events are also the foundation of Bkper's automation model. Bots and Agents listen for specific event types and react automatically — for example, calculating taxes when a transaction is posted or converting currencies when one is checked.
152
+ Events are also the foundation of Bkper's automation model. Apps listen for specific event types and react automatically — for example, calculating taxes when a transaction is posted or converting currencies when one is checked.
153
+
154
+ ## Apps
155
+
156
+ **Apps** extend what Books can do. An App is installed in a Book and works through the same building blocks described above: it can react to the Book's Events, take its settings from Custom Properties, and act on the Book like any user — every change it makes is recorded as an Event of its own.
157
+
158
+ Some Apps also offer an interface inside the Book, or an API for work started on demand. A Book's installed Apps are part of how that Book works, and more can be installed from the App directory.
package/lib/docs/index.md CHANGED
@@ -5,10 +5,13 @@ Reference docs for Bkper tasks. Load only the specific doc(s) relevant to the ta
5
5
  For Bkper app implementation, refactoring, or code review, always read `apps/quality.md` alongside the task-specific references. After implementation, review the changed code against the guidelines before considering the work complete.
6
6
 
7
7
  - `cli/data-management.md` — CLI reference for managing financial data and files: books, accounts, groups, files, transactions, events and bot responses (bot errors, replay, delete), per-account balance queries, query operators (on:, after:, before:, account:, group:), JSON output shapes and jq reshaping, human-review Bkper UI links, batch operations via stdin/piping, collections.
8
+ - `cli/app-usage.md` — Using Bkper apps to do work on a Book instead of rebuilding what they do: list a Book's installed apps and the app catalog, read descriptions, readmes, and property schemas, match them to the Book's properties, read an app's OpenAPI spec and call its API as the user, install apps.
8
9
  - `cli/app-management.md` — CLI reference for building and deploying Bkper apps: init/git clone/credential helpers, dev/build/deploy workflow, app install/uninstall, secrets management, app logs, bkper.yaml configuration reference (identity, branding, events, menu integration, deployment).
9
10
  - `apps/overview.md` — Platform evaluation and capability overview: use when comparing managed Bkper hosting with self-managed infrastructure or clarifying platform responsibilities; use the task-specific app references for implementation.
10
11
  - `apps/ai.md` — Bkper AI in apps, scripts, and tools: ask the Jev decision model with TypeSafe's SDK or language models with AI SDK Open Responses, authenticate through app `/api/*` routes or a Bkper token outside the platform, handle errors, and keep Book writes under deterministic application control.
11
- - `ai/decision-models.md` — Automating recurring judgments in code, such as categorizing bank lines, matching duplicates, or flagging entries, with Bkper AI decision models: writing questions and state, reading calibrated answers, and acting only above thresholds while routing uncertain cases to a person.
12
+ - `ai/decision-models.md` — Designing software around decision models: when to use one, the three kinds of question, a step-by-step workflow from facts to thresholds and human review, and a worked bank-line example. The request, answers, errors, and caching are in `api/ai-gateway.md`.
13
+ - `api/ai-gateway.md` — Bkper AI Gateway API guide: call Bkper AI language and decision models from your own client, script, or server — authentication, model IDs, requests, decision request rules and answer guarantees, streaming, errors, caching, and links to each operation's page.
14
+ - `api/managed-agent.md` — Bkper Managed Agent API guide: build apps, chat bots, and scripts on the agent behind Bkper Agent — sessions, instructions, inputs and idempotency, Book context, streams, files, a Slack bot example, limits, errors, and links to each operation's page.
12
15
  - `apps/first-app.md` — First-app walkthrough: scaffold, install, run locally, trigger an event, customize the listing, establish shared source, check, and deploy.
13
16
  - `apps/architecture.md` — App and template architecture: npm workspace structure, Lit/Vite client, Hono Worker, typed `/api/*` contracts, authentication, `/events`, static assets, and supported app shapes.
14
17
  - `apps/quality.md` — Cross-cutting quality guidance for Bkper apps: UI consistency, immediate first rendering, typed API contracts, cohesive low-coupling modules, separation of business behavior from connectors and storage, security, and final implementation review. Load for app implementation, refactoring, or review tasks.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bkper",
3
- "version": "5.4.0",
3
+ "version": "5.5.0",
4
4
  "description": "Official Bkper CLI for accounting data, automation, apps, and AI agents",
5
5
  "bin": {
6
6
  "bkper": "lib/cli.js"
@@ -63,7 +63,7 @@
63
63
  "upgrade:api": "bun update @bkper/bkper-api-types --latest && bun update bkper-js --latest"
64
64
  },
65
65
  "dependencies": {
66
- "@earendil-works/pi-coding-agent": "1.0.0",
66
+ "@earendil-works/pi-coding-agent": "1.1.0",
67
67
  "bkper-js": "^2.42.0",
68
68
  "commander": "^13.1.0",
69
69
  "dotenv": "^8.2.0",
@@ -87,8 +87,8 @@
87
87
  },
88
88
  "devDependencies": {
89
89
  "@bkper/bkper-api-types": "^5.44.0",
90
- "@earendil-works/pi-ai": "1.0.0",
91
- "@earendil-works/pi-tui": "1.0.0",
90
+ "@earendil-works/pi-ai": "1.1.0",
91
+ "@earendil-works/pi-tui": "1.1.0",
92
92
  "@types/chai": "^4.3.0",
93
93
  "@types/mocha": "^10.0.0",
94
94
  "@types/node": "^22.5.1",