bkper 4.30.1 → 4.31.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.
package/README.md CHANGED
@@ -5,10 +5,10 @@
5
5
 
6
6
  The official Bkper CLI is published on npm as [`bkper`](https://www.npmjs.com/package/bkper). Use it in two complementary ways:
7
7
 
8
- - **Ask the Bkper Agent** — run `bkper` for guided, interactive help in your terminal
8
+ - **Ask Bkper CLI Agent** — run `bkper` for guided, interactive help in your terminal
9
9
  - **Run CLI commands** — run `bkper <command>` for scripts, exports, automations, and app workflows
10
10
 
11
- With one tool, you can work with Bkper from your terminal, built-in agent, or external AI tools — managing financial data, building apps, and automating workflows.
11
+ With one tool, you can work with Bkper from your terminal, Bkper CLI Agent, or external AI tools — managing financial data, building apps, and automating workflows.
12
12
 
13
13
  [![npm](https://img.shields.io/npm/v/bkper?color=%235889e4)](https://www.npmjs.com/package/bkper)
14
14
 
@@ -54,7 +54,7 @@ npm install -g bkper
54
54
  bkper
55
55
  ```
56
56
 
57
- The Bkper Agent uses PowerShell natively on Windows. WSL remains supported and uses Bash.
57
+ Bkper CLI Agent uses PowerShell natively on Windows. WSL remains supported and uses Bash.
58
58
 
59
59
  ### Authenticate with Bkper
60
60
 
@@ -62,19 +62,19 @@ The Bkper Agent uses PowerShell natively on Windows. WSL remains supported and u
62
62
  bkper auth login
63
63
  ```
64
64
 
65
- `bkper auth login` connects the CLI to your Bkper account. The same local authentication can be used by direct CLI commands, the built-in agent, external coding agents, scripts, and local app development.
65
+ `bkper auth login` connects the CLI to your Bkper account. The same local authentication can be used by direct CLI commands, Bkper CLI Agent, external coding agents, scripts, and local app development.
66
66
 
67
67
  ---
68
68
 
69
69
  ## Get started
70
70
 
71
- ### Ask the Bkper Agent
71
+ ### Ask Bkper CLI Agent
72
72
 
73
73
  ```bash
74
74
  bkper
75
75
  ```
76
76
 
77
- Run `bkper` to open the built-in Bkper Agent in your terminal.
77
+ Run `bkper` to open Bkper CLI Agent in your terminal.
78
78
 
79
79
  ![Bkper CLI Agent TUI](https://raw.githubusercontent.com/bkper/bkper-cli/main/assets/bkper-agent-cli.png)
80
80
 
@@ -123,6 +123,9 @@ bkper transaction list -b <bookId> -q 'on:2026-06' --format csv
123
123
 
124
124
  # Query balances
125
125
  bkper balance list -b <bookId> -q 'on:2026-06-30'
126
+
127
+ # Show separate debit and credit columns
128
+ bkper balance list -b <bookId> -q 'on:2026-06-30' --trial
126
129
  ```
127
130
 
128
131
  Capture a receipt as a draft, then review and complete it in Bkper or with the agent:
@@ -146,7 +149,9 @@ printf '%s\n' '[{"date":"2026-08-18","amount":"25.50","creditAccount":{"name":"B
146
149
 
147
150
  ## Use Bkper from your existing agent
148
151
 
149
- Install and authenticate the CLI first:
152
+ For assistant-led setup, follow [Use Bkper with ChatGPT or Claude](https://bkper.com/docs/ai/chatgpt-and-claude).
153
+
154
+ To configure an existing agent manually, authenticate the CLI first:
150
155
 
151
156
  ```bash
152
157
  bkper auth login
@@ -179,7 +184,7 @@ For general Bkper Q&A without local tool access, use the published docs and [`ll
179
184
 
180
185
  ## Advanced agent options
181
186
 
182
- `bkper agent` starts the same built-in agent experience as `bkper`.
187
+ `bkper agent` starts the same Bkper CLI Agent experience as `bkper`.
183
188
 
184
189
  Advanced users can pass supported agent-runtime flags through:
185
190
 
@@ -194,7 +199,7 @@ When the selected model cannot read images, the agent briefly uses Bkper's defau
194
199
 
195
200
  Use `/handoff <goal>` to continue long-running work in a new focused session. If you omit the goal, the agent opens an empty goal editor. Pressing `Ctrl+H` opens that editor with your current input text as the goal. The new session is linked to the original, with the relevant context drafted in the input editor for you to adjust or submit.
196
201
 
197
- Press `Ctrl+R` in the standard or handoff input to fuzzy-search recently submitted inputs. Search history starts with inputs submitted after this feature is installed; it does not scan existing sessions. The handoff search omits Bash commands. Press `Ctrl+Alt+R` to open the session tree.
202
+ Press `Ctrl+R` in the standard or handoff input to search recently submitted inputs by case-insensitive substring, newest first. Search history starts with inputs submitted after this feature is installed; it does not scan existing sessions. The handoff search omits Bash commands. Press `Ctrl+Alt+R` to open the session tree.
198
203
 
199
204
  ---
200
205
 
@@ -1 +1 @@
1
- {"version":3,"file":"handoff.d.ts","sourceRoot":"","sources":["../../../src/agent/extensions/handoff.ts"],"names":[],"mappings":"AAIA,OAAO,EAIH,KAAK,YAAY,EAEjB,KAAK,gBAAgB,EAExB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,wBAAwB,CAAC;AA6BpD,MAAM,WAAW,wBAAwB;IACrC,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,mBAAmB;IAChC,cAAc,CAAC,OAAO,EAAE,wBAAwB,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACjG;AAED,MAAM,MAAM,wBAAwB,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAE1E,KAAK,sBAAsB,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC;AAC5D,KAAK,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC;AAqChE,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,KAAK,GAAG,SAAS,CAItF;AAED,wBAAgB,+BAA+B,CAAC,QAAQ,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAwBnF;AAgKD,wBAAgB,6BAA6B,CACzC,EAAE,EAAE,IAAI,CAAC,YAAY,EAAE,iBAAiB,GAAG,kBAAkB,CAAC,EAC9D,eAAe,CAAC,EAAE,wBAAwB,EAC1C,eAAe,CAAC,EAAE,KAAK,EACvB,YAAY,GAAE,mBAAyC,GACxD,IAAI,CAwDN"}
1
+ {"version":3,"file":"handoff.d.ts","sourceRoot":"","sources":["../../../src/agent/extensions/handoff.ts"],"names":[],"mappings":"AAGA,OAAO,EAIH,KAAK,YAAY,EAEjB,KAAK,gBAAgB,EACxB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,wBAAwB,CAAC;AA6BpD,MAAM,WAAW,wBAAwB;IACrC,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,mBAAmB;IAChC,cAAc,CAAC,OAAO,EAAE,wBAAwB,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACjG;AAED,MAAM,MAAM,wBAAwB,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAE1E,KAAK,sBAAsB,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC;AAC5D,KAAK,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC;AAqChE,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,KAAK,GAAG,SAAS,CAItF;AAED,wBAAgB,+BAA+B,CAAC,QAAQ,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAwBnF;AA2ID,wBAAgB,6BAA6B,CACzC,EAAE,EAAE,IAAI,CAAC,YAAY,EAAE,iBAAiB,GAAG,kBAAkB,CAAC,EAC9D,eAAe,CAAC,EAAE,wBAAwB,EAC1C,eAAe,CAAC,EAAE,KAAK,EACvB,YAAY,GAAE,mBAAyC,GACxD,IAAI,CAwDN"}
@@ -81,28 +81,9 @@ export function getBkperHandoffShortcutFromFile(agentDir) {
81
81
  return BKPER_HANDOFF_SHORTCUT;
82
82
  }
83
83
  }
84
- function entryToMessage(entry) {
85
- if (entry.type === 'message') {
86
- return entry.message;
87
- }
88
- if (entry.type === 'compaction') {
89
- return {
90
- role: 'compactionSummary',
91
- summary: entry.summary,
92
- tokensBefore: entry.tokensBefore,
93
- timestamp: new Date(entry.timestamp).getTime(),
94
- };
95
- }
96
- return undefined;
97
- }
98
- function contextMessages(context) {
99
- return context.sessionManager
100
- .buildContextEntries()
101
- .map(entryToMessage)
102
- .filter(message => message !== undefined);
103
- }
104
84
  function serializeCurrentConversation(context) {
105
- return serializeConversation(convertToLlm(contextMessages(context)));
85
+ const messages = context.sessionManager.buildSessionProjection().messages;
86
+ return serializeConversation(convertToLlm(messages));
106
87
  }
107
88
  function generateWithCurrentModel(context, systemPrompt, prompt, loadingMessage) {
108
89
  return __awaiter(this, void 0, void 0, function* () {
@@ -1 +1 @@
1
- {"version":3,"file":"handoff.js","sourceRoot":"","sources":["../../../src/agent/extensions/handoff.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EACH,cAAc,EACd,YAAY,EACZ,qBAAqB,GAKxB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAErE,MAAM,sBAAsB,GAAU,QAAQ,CAAC;AAC/C,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAEnC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;gDAqBkB,CAAC;AAqBjD,MAAM,qBAAsB,SAAQ,KAAK;CAAG;AAE5C,SAAS,cAAc,CAAC,KAAc;IAClC,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AACrE,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC5B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAChF,CAAC;AAED,SAAS,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AI,EAAE,CAAC;YAC7B,CAAC;YAED,MAAM,OAAO,CAAC,WAAW,EAAE,CAAC;YAC5B,MAAM,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;QACtD,CAAC,CAAA;KACJ,CAAC,CAAC;AACP,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"prompt-history-store.d.ts","sourceRoot":"","sources":["../../../src/agent/interactive/prompt-history-store.ts"],"names":[],"mappings":"AAaA,MAAM,MAAM,iBAAiB,GAAG,UAAU,GAAG,SAAS,GAAG,MAAM,CAAC;AAEhE,MAAM,WAAW,kBAAkB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,iBAAiB,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,qBAAqB;IAClC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3E;AAED,MAAM,WAAW,uBAAwB,SAAQ,qBAAqB;IAClE,UAAU,IAAI,SAAS,kBAAkB,EAAE,CAAC;CAC/C;AAED,MAAM,WAAW,0BAA0B;IACvC,WAAW,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,wBAAwB;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AA6CD,wBAAgB,0BAA0B,CACtC,OAAO,EAAE,SAAS,kBAAkB,EAAE,EACtC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,0BAA0B,GACpC,kBAAkB,EAAE,CAgBtB;AAED,qBAAa,iBAAkB,YAAW,uBAAuB;IASzD,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAR7B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAA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CACzB;AA6CD,wBAAgB,0BAA0B,CACtC,OAAO,EAAE,SAAS,kBAAkB,EAAE,EACtC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,0BAA0B,GACpC,kBAAkB,EAAE,CAgBtB;AAED,qBAAa,iBAAkB,YAAW,uBAAuB;IASzD,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAR7B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAS;IACzC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,OAAO,CAAC,OAAO,CAA4B;IAC3C,OAAO,CAAC,WAAW,CAAK;IACxB,OAAO,CAAC,SAAS,CAAK;gBAGD,QAAQ,EAAE,MAAM,EACjC,OAAO,GAAE,wBAA6B;IAW1C,UAAU,IAAI,SAAS,kBAAkB,EAAE;IAI3C,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,EAAE,SAAS,SAAa,GAAG,IAAI;IA6B3E,OAAO,CAAC,IAAI;IA0BZ,OAAO,CAAC,MAAM;CAsCjB;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE7D"}
@@ -1,6 +1,5 @@
1
1
  import { appendFileSync, chmodSync, mkdirSync, readFileSync, renameSync, statSync, unlinkSync, writeFileSync, } from 'node:fs';
2
2
  import path from 'node:path';
3
- import { fuzzyFilter } from '@earendil-works/pi-tui';
4
3
  const DEFAULT_MAX_ENTRIES = 10000;
5
4
  const DEFAULT_TRIM_RECORD_COUNT = 20000;
6
5
  const DEFAULT_MAX_FILE_BYTES = 16 * 1024 * 1024;
@@ -49,7 +48,10 @@ export function searchPromptHistoryEntries(entries, query, options) {
49
48
  seen.add(entry.text);
50
49
  uniqueEntries.push(entry);
51
50
  }
52
- return fuzzyFilter(uniqueEntries, query, entry => entry.text).slice(0, (_a = options.limit) !== null && _a !== void 0 ? _a : DEFAULT_SEARCH_LIMIT);
51
+ const normalizedQuery = query.toLowerCase();
52
+ return uniqueEntries
53
+ .filter(entry => entry.text.toLowerCase().includes(normalizedQuery))
54
+ .slice(0, (_a = options.limit) !== null && _a !== void 0 ? _a : DEFAULT_SEARCH_LIMIT);
53
55
  }
54
56
  export class FilePromptHistory {
55
57
  constructor(filePath, options = {}) {
@@ -1 +1 @@
1
- {"version":3,"file":"prompt-history-store.js","sourceRoot":"","sources":["../../../src/agent/interactive/prompt-history-store.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,cAAc,EACd,SAAS,EACT,SAAS,EACT,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,UAAU,EACV,aAAa,GAChB,MAAM,SAAS,CAAC;AACjB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAC,WAAW,EAAC,MAAM,wBAAwB,CAAC;AA6BnD,MAAM,mBAAmB,GAAG,KAAM,CAAC;AACnC,MAAM,yBAAyB,GAAG,KAAM,CAAC;AACzC,MAAM,sBAAsB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAChD,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAEhC,SAAS,mBAAmB,CAAC,KAAc;IACvC,OAAO,KAAK,KAAK,UAAU,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,MAAM,CAAC;AAC3E,CAAC;AAED,SAAS,UAAU,CAAC,IAAY;IAC5B,IAAI,CAAC;QACD,MAAM,KAAK,GAAY,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACxC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YAC9C,OAAO,SAAS,CAAC;QACrB,CAAC;QACD,MAAM,MAAM,GAAG,KAAgC,CAAC;QAChD,IACI,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ;YAC/B,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE;YACnB,CAAC,mBAAmB,CAAC,MAAM,CAAC,IAAI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a,EAAE,OAAO,EAAE,EAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAC,CAAC,CAAC;YACvE,UAAU,CAAC,aAAa,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;YACzC,IAAI,CAAC,OAAO,GAAG,cAAc,CAAC;YAC9B,IAAI,CAAC,WAAW,GAAG,cAAc,CAAC,MAAM,CAAC;YACzC,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAChD,CAAC;QAAC,WAAM,CAAC;YACL,IAAI,CAAC;gBACD,UAAU,CAAC,aAAa,CAAC,CAAC;YAC9B,CAAC;YAAC,WAAM,CAAC;gBACL,qDAAqD;YACzD,CAAC;QACL,CAAC;IACL,CAAC;CACJ;AAED,MAAM,UAAU,oBAAoB,CAAC,QAAgB;IACjD,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,2BAA2B,CAAC,CAAC;AAC5D,CAAC"}
1
+ {"version":3,"file":"prompt-history-store.js","sourceRoot":"","sources":["../../../src/agent/interactive/prompt-history-store.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,cAAc,EACd,SAAS,EACT,SAAS,EACT,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,UAAU,EACV,aAAa,GAChB,MAAM,SAAS,CAAC;AACjB,OAAO,IAAI,MAAM,WAAW,CAAC;AA4B7B,MAAM,mBAAmB,GAAG,KAAM,CAAC;AACnC,MAAM,yBAAyB,GAAG,KAAM,CAAC;AACzC,MAAM,sBAAsB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAChD,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAEhC,SAAS,mBAAmB,CAAC,KAAc;IACvC,OAAO,KAAK,KAAK,UAAU,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,MAAM,CAAC;AAC3E,CAAC;AAED,SAAS,UAAU,CAAC,IAAY;IAC5B,IAAI,CAAC;QACD,MAAM,KA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,IAAI,KAAK,CAAC;QAC3B,CAAC;QAED,MAAM,OAAO,GAAG,cAAc;aACzB,KAAK,EAAE;aACP,OAAO,EAAE;aACT,GAAG,CAAC,cAAc,CAAC;aACnB,IAAI,CAAC,EAAE,CAAC,CAAC;QACd,MAAM,aAAa,GAAG,GAAG,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC;QAE1E,IAAI,CAAC;YACD,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAC,SAAS,EAAE,IAAI,EAAC,CAAC,CAAC;YAC1D,aAAa,CAAC,aAAa,EAAE,OAAO,EAAE,EAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAC,CAAC,CAAC;YACvE,UAAU,CAAC,aAAa,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;YACzC,IAAI,CAAC,OAAO,GAAG,cAAc,CAAC;YAC9B,IAAI,CAAC,WAAW,GAAG,cAAc,CAAC,MAAM,CAAC;YACzC,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAChD,CAAC;QAAC,WAAM,CAAC;YACL,IAAI,CAAC;gBACD,UAAU,CAAC,aAAa,CAAC,CAAC;YAC9B,CAAC;YAAC,WAAM,CAAC;gBACL,qDAAqD;YACzD,CAAC;QACL,CAAC;IACL,CAAC;CACJ;AAED,MAAM,UAAU,oBAAoB,CAAC,QAAgB;IACjD,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,2BAA2B,CAAC,CAAC;AAC5D,CAAC"}
@@ -1,2 +1,3 @@
1
- export { listBalancesMatrix, ListBalancesOptions } from './list.js';
1
+ export { listBalancesMatrix } from './list.js';
2
+ export type { ListBalancesOptions } from './list.js';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/balances/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/balances/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,YAAY,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/balances/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAuB,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/balances/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC"}
@@ -7,12 +7,14 @@ export interface ListBalancesOptions {
7
7
  query: string;
8
8
  expanded?: number;
9
9
  format?: OutputFormat;
10
+ trial?: boolean;
10
11
  }
11
12
  /**
12
- * Determines the appropriate BalanceType based on query operators.
13
- * Uses after: presence as the heuristic: after: means PERIOD, otherwise CUMULATIVE.
13
+ * Determines the appropriate BalanceType based on query operators and output view.
14
+ * Trial balances use totals; otherwise after: means PERIOD and all other queries
15
+ * use CUMULATIVE.
14
16
  */
15
- export declare function resolveBalanceType(query: string): BalanceType;
17
+ export declare function resolveBalanceType(query: string, trial?: boolean): BalanceType;
16
18
  /**
17
19
  * Fetches balances from a book and returns them as a data table matrix.
18
20
  *
@@ -1 +1 @@
1
- {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/balances/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAG3D;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,YAAY,CAAC;CACzB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CAE7D;AAED;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CACpC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,mBAAmB,GAC7B,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAwBtB"}
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/balances/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAG3D;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,KAAK,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,UAAQ,GAAG,WAAW,CAK5E;AAwBD;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CACpC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,mBAAmB,GAC7B,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CA6BtB"}
@@ -11,12 +11,35 @@ import { BalanceType } from 'bkper-js';
11
11
  import { getBkperInstance } from '../../bkper-factory.js';
12
12
  import { warnIfSuspiciousDateVariableQuery } from '../../utils/query-warning.js';
13
13
  /**
14
- * Determines the appropriate BalanceType based on query operators.
15
- * Uses after: presence as the heuristic: after: means PERIOD, otherwise CUMULATIVE.
14
+ * Determines the appropriate BalanceType based on query operators and output view.
15
+ * Trial balances use totals; otherwise after: means PERIOD and all other queries
16
+ * use CUMULATIVE.
16
17
  */
17
- export function resolveBalanceType(query) {
18
+ export function resolveBalanceType(query, trial = false) {
19
+ if (trial) {
20
+ return BalanceType.TOTAL;
21
+ }
18
22
  return query.includes('after:') ? BalanceType.PERIOD : BalanceType.CUMULATIVE;
19
23
  }
24
+ /**
25
+ * Adds the missing trial balance headers from the bkper-js total table builder.
26
+ * CSV total tables already contain a header for metadata, so replace its balance
27
+ * column while preserving property columns.
28
+ */
29
+ function addTrialHeaders(matrix, csv) {
30
+ if (matrix.length === 0) {
31
+ return matrix;
32
+ }
33
+ const firstRow = matrix[0].map(cell => String(cell).toLowerCase());
34
+ if (firstRow[0] === 'name' && firstRow[1] === 'debit' && firstRow[2] === 'credit') {
35
+ return matrix;
36
+ }
37
+ if (csv) {
38
+ const [header, ...rows] = matrix;
39
+ return [['Name', 'Debit', 'Credit', ...header.slice(2)], ...rows];
40
+ }
41
+ return [['Name', 'Debit', 'Credit'], ...matrix];
42
+ }
20
43
  /**
21
44
  * Fetches balances from a book and returns them as a data table matrix.
22
45
  *
@@ -29,9 +52,12 @@ export function listBalancesMatrix(bookId, options) {
29
52
  warnIfSuspiciousDateVariableQuery(options.query);
30
53
  const bkper = getBkperInstance();
31
54
  const book = yield bkper.getBook(bookId);
32
- const balanceType = resolveBalanceType(options.query);
55
+ const balanceType = resolveBalanceType(options.query, options.trial);
33
56
  const report = yield book.getBalancesReport(options.query);
34
57
  const builder = report.createDataTable().type(balanceType);
58
+ if (options.trial) {
59
+ builder.trial(true).period(options.query.includes('after:'));
60
+ }
35
61
  if (options.format === 'csv') {
36
62
  // CSV: raw values for machine consumption, all metadata
37
63
  builder.properties(true).hiddenProperties(true);
@@ -43,7 +69,8 @@ export function listBalancesMatrix(bookId, options) {
43
69
  if (options.expanded) {
44
70
  builder.expanded(options.expanded);
45
71
  }
46
- return builder.build();
72
+ const matrix = builder.build();
73
+ return options.trial ? addTrialHeaders(matrix, options.format === 'csv') : matrix;
47
74
  });
48
75
  }
49
76
  //# sourceMappingURL=list.js.map
@@ -1 +1 @@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IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;YACnB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACvC,CAAC;QAED,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;QAC/B,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,eAAe,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IACtF,CAAC;CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../src/commands/balances/register.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMzC,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAyB9D"}
1
+ {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../src/commands/balances/register.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMzC,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA2B9D"}
@@ -19,6 +19,7 @@ export function registerBalanceCommands(program) {
19
19
  .option('-b, --book <bookId>', 'Book ID')
20
20
  .option('-q, --query <query>', 'Balances query')
21
21
  .option('--expanded <level>', 'Expand groups to specified depth (0+)', parseInt)
22
+ .option('--trial', 'Split total balances into debit and credit columns')
22
23
  .action(options => withAction('listing balances', (format) => __awaiter(this, void 0, void 0, function* () {
23
24
  throwIfErrors(validateRequiredOptions(options, [
24
25
  { name: 'book', flag: '--book' },
@@ -28,6 +29,7 @@ export function registerBalanceCommands(program) {
28
29
  query: options.query,
29
30
  expanded: options.expanded,
30
31
  format,
32
+ trial: options.trial,
31
33
  });
32
34
  renderTable(matrix, format);
33
35
  }))());
@@ -1 +1 @@
1
- {"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/commands/balances/register.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AACnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,UAAU,uBAAuB,CAAC,OAAgB;IACpD,MAAM,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC;IAEjF,cAAc;SACT,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,eAAe,CAAC;SAC5B,MAAM,CAAC,qBAAqB,EAAE,SAAS,CAAC;SACxC,MAAM,CAAC,qBAAqB,EAAE,gBAAgB,CAAC;SAC/C,MAAM,CAAC,oBAAoB,EAAE,uCAAuC,EAAE,QAAQ,CAAC;SAC/E,MAAM,CAAC,OAAO,CAAC,EAAE,CACd,UAAU,CAAC,kBAAkB,EAAE,CAAM,MAAM,EAAC,EAAE;QAC1C,aAAa,CACT,uBAAuB,CAAC,OAAO,EAAE;YAC7B,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE;YAChC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE;SACrC,CAAC,CACL,CAAC;QACF,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAAC,OAAO,CAAC,IAAI,EAAE;YAClD,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,MAAM;SACT,CAAC,CAAC;QACH,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,CAAC,CAAA,CAAC,EAAE,CACP,CAAC;AACV,CAAC"}
1
+ {"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/commands/balances/register.ts"],"names":[],"mappings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1,270 +1,123 @@
1
1
  # Add Bkper AI to an App
2
2
 
3
- Bkper AI is the preferred inference provider for Bkper Platform apps. It uses the authenticated user's included AI allowance, attributes usage to the app, and does not require the app to store provider credentials.
3
+ Bkper Platform apps can call [Bkper AI](https://bkper.com/docs/ai/ai-gateway.md) without storing a model-provider key. The platform authorizes the Worker's request using the current user and attributes usage to the app. Model output is a suggestion, not permission to change a Book: keep decisions about resource movements and any resulting writes in application code.
4
4
 
5
- Use another provider only when Bkper AI lacks a required capability, model, compliance boundary, or customer-mandated provider. External providers require their own authentication, secrets, billing, and privacy review.
5
+ This guide covers a server-side, non-streaming language response. It uses AI SDK to draft a review note from a transaction description. No Book data is written by the example.
6
6
 
7
- This guide covers the preferred current pattern: a non-streaming response with strict structured output. Streaming, tool calls, file inputs, and agent runtimes require additional design.
7
+ ## Choose the kind of response
8
8
 
9
- ## Request flow
9
+ - **A bounded yes/no, choice, or score?** Use a typed evaluation (Jev) at `POST /v1/evaluations`.
10
+ - **Generated text or a custom JSON object?** Use a language model at `POST /v1/responses`. AI SDK is an option for this path.
10
11
 
11
- Keep model calls behind the app's typed `/api/*` contract:
12
+ Pick a model of the corresponding `type` from the live [`GET /v1/models` catalog](https://ai.bkper.app/v1/models). The catalog also tells you which language models support strict structured output. AI SDK's **Open Responses provider** covers language responses, not Bkper's typed evaluation endpoint. For Jev, use HTTP or implement an AI SDK evaluation-model adapter for `experimental_evaluate`, as `bkper-agent` does. See [Typed evaluations](https://bkper.com/docs/ai/ai-gateway.md#typed-evaluations) and the [Merge Duplicates app](https://github.com/bkper/bkper-apps/tree/main/merge-duplicates) for a human-reviewed HTTP example.
12
13
 
13
- 1. The web client calls an app `/api/*` route with a Bkper bearer token. The template's `auth.authenticatedFetch()` handles this.
14
- 2. Bkper validates the token, mounts the user and app identity as outbound context, and removes the token before invoking the app Worker.
15
- 3. The Worker calls `https://ai.bkper.app/v1/*` without reading, storing, or forwarding the token.
16
- 4. Platform outbound injects Bkper authorization and overwrites `bkper-agent-id` and `bkper-ai-source` with the authenticated app identity.
14
+ ## Keep authentication in the platform
17
15
 
18
- Event handlers use the same Worker-to-Bkper-AI step. Their outbound context comes from the authenticated Bkper event. A normal page request does not establish user outbound context, so start interactive inference from an authenticated `/api/*` route rather than a page handler.
16
+ For an interactive app, the flow is:
19
17
 
20
- ## Call the app API from the client
18
+ 1. The client calls a typed app `/api/*` route through `auth.authenticatedFetch()` (or another authenticated client). The template's generated API client can use that fetch provider.
19
+ 2. Bkper verifies the user's token, removes it before invoking the Worker, and establishes user and app context for outbound requests.
20
+ 3. The Worker calls `https://ai.bkper.app/v1/*`. Platform outbound adds authorization and app attribution. **Do not read, forward, or store the user's token in the Worker.**
21
21
 
22
- Use the authenticated fetch provider already configured by the app template:
22
+ An authenticated `/events` handler has the same outbound context. A page request does not; start interactive inference from an authenticated `/api/*` route, not from the page handler or the browser.
23
23
 
24
- ```ts
25
- interface AnalyzeRequest {
26
- first: {
27
- date: string;
28
- amount: string;
29
- description: string;
30
- fromAccount: string | null;
31
- toAccount: string | null;
32
- };
33
- second: {
34
- date: string;
35
- amount: string;
36
- description: string;
37
- fromAccount: string | null;
38
- toAccount: string | null;
39
- };
40
- }
41
-
42
- export async function analyzePair(auth: AuthProvider, request: AnalyzeRequest): Promise {
43
- return auth.authenticatedFetch('/api/v1/analyze', {
44
- method: 'POST',
45
- headers: { 'content-type': 'application/json' },
46
- body: JSON.stringify(request),
47
- });
48
- }
49
- ```
24
+ ## Example: draft a review note with AI SDK
50
25
 
51
- In a full app, define this operation in the server's Zod/OpenAPI schemas and call it through the generated typed client. The important boundary is that the client authenticates the app API request; the Worker never handles that bearer token directly.
52
-
53
- ## Discover the current default model
54
-
55
- The live model catalog is authoritative. It publishes the current default, model IDs, modalities, structured-output support, reasoning levels, context and output limits, and effective usage rates.
26
+ Add `ai`, `@ai-sdk/open-responses`, and `zod` to the **Worker** package. Keep this code in a server service called from your authenticated app API route; define the route's request and response in the app's Zod/OpenAPI contract. The service takes only the description needed for this task, discovers the current language model, and validates its output before returning it to the caller.
56
27
 
57
28
  ```ts
58
- const AI_BASE_URL = 'https://ai.bkper.app/v1';
59
- type Fetcher = (input: RequestInfo | URL, init?: RequestInit) => Promise;
60
-
61
- function isRecord(value: unknown): value is Record<string, unknown> {
62
- return value !== null && typeof value === 'object' && !Array.isArray(value);
63
- }
64
-
65
- export async function getStructuredOutputModel(fetcher: Fetcher = fetch): Promise<string> {
66
- const response = await fetcher(`${AI_BASE_URL}/models`);
67
- if (!response.ok) {
68
- throw new Error(`Bkper AI model discovery failed (${response.status}).`);
69
- }
70
-
71
- const catalog: unknown = await response.json();
29
+ import { createOpenResponses } from '@ai-sdk/open-responses';
30
+ import { generateText, Output } from 'ai';
31
+ import { z } from 'zod';
32
+
33
+ const BASE_URL = 'https://ai.bkper.app/v1';
34
+ const ReviewNote = z.strictObject({ note: z.string() });
35
+
36
+ export async function draftReviewNote(
37
+ description: string,
38
+ fetcher: typeof fetch = fetch
39
+ ): Promise<{ note: string }> {
40
+ const response = await fetcher(`${BASE_URL}/models`);
41
+ if (!response.ok) throw new Error(`Model discovery failed (${response.status}).`);
42
+
43
+ const catalog = z
44
+ .object({
45
+ default_model: z.string(),
46
+ data: z.array(
47
+ z.object({
48
+ id: z.string(),
49
+ type: z.string(),
50
+ structured_output: z
51
+ .object({
52
+ json_schema: z.boolean(),
53
+ strict: z.boolean(),
54
+ })
55
+ .optional(),
56
+ })
57
+ ),
58
+ })
59
+ .parse(await response.json());
60
+ const model = catalog.data.find(item => item.id === catalog.default_model);
72
61
  if (
73
- !isRecord(catalog) ||
74
- typeof catalog.default_model !== 'string' ||
75
- !Array.isArray(catalog.data)
62
+ model?.type !== 'language' ||
63
+ !model.structured_output?.json_schema ||
64
+ !model.structured_output.strict
76
65
  ) {
77
- throw new Error('Bkper AI returned an invalid model catalog.');
66
+ throw new Error('The default model does not support strict JSON output.');
78
67
  }
79
68
 
80
- const defaultModel = catalog.default_model;
81
- const model = catalog.data.find(item => isRecord(item) && item.id === defaultModel);
82
- if (
83
- !isRecord(model) ||
84
- !isRecord(model.structured_output) ||
85
- model.structured_output.json_schema !== true ||
86
- model.structured_output.strict !== true
87
- ) {
88
- throw new Error('The default Bkper AI model does not support strict structured output.');
89
- }
90
- return defaultModel;
91
- }
92
- ```
93
-
94
- This example uses `default_model` after validating the capability required by the request. If an app requires another modality, file type, reasoning level, or limit, intentionally select and validate another model from the catalog's `data` array. Apps may cache the catalog briefly rather than fetching it for every inference request.
95
-
96
- ## Request strict structured output
97
-
98
- Keep inference in a server service and make `fetch` injectable for unit tests. This example sends only the transaction facts needed for duplicate evaluation. It omits transaction IDs, Account IDs, unrelated properties, and other Book data.
99
-
100
- ```ts
101
- const EvaluationJsonSchema = {
102
- type: 'object',
103
- properties: {
104
- duplicate: { type: 'boolean' },
105
- strength: { type: 'string', enum: ['Strong', 'Possible'] },
106
- explanation: { type: 'string', maxLength: 180 },
107
- },
108
- required: ['duplicate', 'strength', 'explanation'],
109
- additionalProperties: false,
110
- } as const;
111
-
112
- export interface DuplicateEvaluation {
113
- duplicate: boolean;
114
- strength: 'Strong' | 'Possible';
115
- explanation: string;
116
- }
117
-
118
- export class BkperAiError extends Error {
119
- constructor(
120
- readonly status: number,
121
- readonly code: string,
122
- message: string
123
- ) {
124
- super(message);
125
- this.name = 'BkperAiError';
126
- }
127
- }
128
-
129
- export async function evaluateDuplicate(
130
- candidate: AnalyzeRequest,
131
- fetcher: Fetcher = fetch
132
- ): Promise {
133
- const model = await getStructuredOutputModel(fetcher);
134
- const response = await fetcher(`${AI_BASE_URL}/responses`, {
135
- method: 'POST',
136
- headers: { 'content-type': 'application/json' },
137
- body: JSON.stringify({
138
- model,
139
- instructions:
140
- 'Decide whether both records represent the same movement. ' +
141
- 'Return Strong only when the evidence is compelling.',
142
- input: [
143
- {
144
- role: 'user',
145
- content: [
146
- {
147
- type: 'input_text',
148
- text: JSON.stringify(candidate),
149
- },
150
- ],
151
- },
152
- ],
153
- text: {
154
- format: {
155
- type: 'json_schema',
156
- name: 'duplicate_evaluation',
157
- schema: EvaluationJsonSchema,
158
- strict: true,
159
- },
160
- },
161
- stream: false,
162
- store: false,
163
- }),
69
+ const provider = createOpenResponses({
70
+ name: 'bkper-ai',
71
+ url: `${BASE_URL}/responses`,
72
+ fetch: fetcher,
164
73
  });
165
-
166
- const payload: unknown = await response.json();
167
- if (!response.ok) {
168
- const error = readAiError(payload);
169
- throw new BkperAiError(response.status, error.code, error.message);
170
- }
171
-
172
- const value: unknown = JSON.parse(getOutputText(payload));
173
- if (!isDuplicateEvaluation(value)) {
174
- throw new Error('Bkper AI output did not match the required schema.');
175
- }
176
- return value;
74
+ const { output } = await generateText({
75
+ model: provider(model.id),
76
+ system: 'Draft a short, neutral review note. Do not invent facts or change Accounts.',
77
+ prompt: description,
78
+ output: Output.object({ schema: ReviewNote }),
79
+ maxRetries: 0,
80
+ });
81
+ return ReviewNote.parse(output);
177
82
  }
178
83
  ```
179
84
 
180
- Do not add an `Authorization`, `bkper-agent-id`, or `bkper-ai-source` header to the Worker's Bkper AI request. Platform outbound derives those values from the authenticated app request or event and overwrites them before dispatch.
85
+ **This example is for a Bkper Platform Worker.** With no SDK `apiKey`, the Open Responses provider sends no `Authorization` header; platform outbound supplies authorization and app attribution. A standalone integration such as `bkper-agent` must instead obtain and send its own Bkper OAuth token. Open Responses always requests `strict: true` for structured JSON and omits `store`; Bkper AI treats an omitted `store` as `false` and never persists response state. If you need `strict: false` for a model-supported flexible schema, use `@ai-sdk/openai` with its `.responses()` model and `strictJsonSchema: false`, as `bkper-agent` does. You may cache the catalog briefly instead of fetching it for every call.
181
86
 
182
- ## Validate the response and preserve errors
87
+ The schema deliberately checks only that a `note` string exists. Constraints such as a minimum or maximum string length are **not needed for this example** and may not be supported by every model's strict JSON Schema subset. If your app needs a length limit, check it in application code after generation.
183
88
 
184
- Strict structured output constrains generation, but the app must still parse and validate the returned value before using it.
89
+ ## Before using the result
185
90
 
186
- ```ts
187
- function getOutputText(payload: unknown): string {
188
- if (!isRecord(payload) || payload.status !== 'completed' || !Array.isArray(payload.output)) {
189
- throw new Error('Bkper AI did not return a complete response.');
190
- }
91
+ - Send only task-relevant data. Validate input and Book permissions at the app API boundary. A generated note must not create, merge, or alter a transaction without deterministic application rules and any required human confirmation.
92
+ - If model discovery fails or output does not match the schema, fail safely. Avoid automatic retries on actions that may consume allowance.
93
+ - When the AI request fails, preserve the upstream HTTP status, error code, and message **when Bkper AI supplies them**, so users can understand failures such as an exhausted allowance. AI SDK exposes HTTP failures as `APICallError`; read the Bkper AI error envelope from `responseBody`, not from the SDK's generic message. For `NoObjectGeneratedError` or transport errors, return a safe app-defined error instead. Do not return prompts, raw responses, or stack traces to clients.
94
+ - Unit-test the server service with a mocked `fetch`: verify the model's type and capability, that no `Authorization` or attribution headers leave the Worker, that only necessary data is sent and `store: true` is never requested, that malformed output is rejected, and that errors remain actionable. Then run the app's normal check/build.
191
95
 
192
- const texts: string[] = [];
193
- for (const item of payload.output) {
194
- if (!isRecord(item) || item.type !== 'message' || !Array.isArray(item.content)) continue;
195
- for (const part of item.content) {
196
- if (isRecord(part) && part.type === 'output_text' && typeof part.text === 'string') {
197
- texts.push(part.text);
198
- }
199
- }
200
- }
201
- if (texts.length === 0) throw new Error('Bkper AI returned no output text.');
202
- return texts.join('');
203
- }
96
+ For example, a route can extract the safe fields before mapping them into its typed error response:
204
97
 
205
- function isDuplicateEvaluation(value: unknown): value is DuplicateEvaluation {
206
- return (
207
- isRecord(value) &&
208
- typeof value.duplicate === 'boolean' &&
209
- (value.strength === 'Strong' || value.strength === 'Possible') &&
210
- typeof value.explanation === 'string' &&
211
- value.explanation.length <= 180
212
- );
213
- }
214
-
215
- function readAiError(payload: unknown): { code: string; message: string } {
216
- if (
217
- isRecord(payload) &&
218
- isRecord(payload.error) &&
219
- typeof payload.error.code === 'string' &&
220
- typeof payload.error.message === 'string'
221
- ) {
222
- return { code: payload.error.code, message: payload.error.message };
98
+ ```ts
99
+ import { APICallError } from 'ai';
100
+
101
+ function bkperAiError(error: unknown) {
102
+ if (!APICallError.isInstance(error)) return null;
103
+ let body: unknown;
104
+ try {
105
+ body = JSON.parse(error.responseBody ?? '');
106
+ } catch {
107
+ return null;
223
108
  }
224
- return { code: 'bkper_ai_error', message: 'Bkper AI request failed.' };
109
+ const parsed = z
110
+ .object({
111
+ error: z.object({ code: z.string(), message: z.string() }),
112
+ })
113
+ .safeParse(body);
114
+ if (!parsed.success) return null;
115
+ return {
116
+ status: error.statusCode ?? 502,
117
+ code: parsed.data.error.code,
118
+ message: parsed.data.error.message,
119
+ };
225
120
  }
226
121
  ```
227
122
 
228
- Preserve the upstream HTTP status, error code, and message when mapping a `BkperAiError` into the app's typed error envelope. Bkper AI centralizes actionable messages such as allowance guidance and pricing links. Bot event responses may reuse that message directly when the surface supports it. Interactive apps can use the status and code to provide a tailored experience without duplicating the upstream policy or CTA.
229
-
230
- ## Test the boundary
231
-
232
- Use a mocked `fetch` to protect the integration contract without making live model calls:
233
-
234
- ```ts
235
- expect(capturedRequest.headers.get('authorization')).toBeNull();
236
- expect(requestBody.store).toBe(false);
237
- expect(requestBody.stream).toBe(false);
238
- expect(requestBody.text).toMatchObject({
239
- format: { type: 'json_schema', strict: true },
240
- });
241
- ```
242
-
243
- Also test that the service:
244
-
245
- - validates that the catalog's `default_model` supports strict structured output;
246
- - rejects malformed or schema-incompatible output;
247
- - preserves Bkper AI error status, code, and message;
248
- - does not send internal identifiers or unrelated Book data.
249
-
250
- ## Implementation checklist
251
-
252
- Before considering the integration complete:
253
-
254
- - [ ] The client calls a typed `/api/*` route through authenticated fetch.
255
- - [ ] Worker code never reads, stores, or forwards the Bkper bearer token.
256
- - [ ] The app discovers models from `GET /v1/models` and intentionally chooses a returned ID.
257
- - [ ] Inference runs in a server service with an injectable `fetch`.
258
- - [ ] The request uses strict structured output, `stream: false`, and `store: false`.
259
- - [ ] Only data required for the task is sent to inference.
260
- - [ ] Returned JSON is parsed and independently validated.
261
- - [ ] Error status, code, and message remain available to the caller.
262
- - [ ] Unit tests cover the request, response, validation, and error boundaries.
263
- - [ ] The app's normal `npm run check` or `bun run check` succeeds.
264
-
265
- ## Next steps
266
-
267
- - [Read the client-agnostic Bkper AI Provider guide](https://bkper.com/docs/ai/bkper-ai-provider.md) for privacy boundaries, the complete supported profile, and advanced features.
268
- - [Inspect the live model catalog](https://ai.bkper.app/v1/models).
269
- - [Browse the generated AI API reference](https://bkper.com/docs/api/ai.md) when exact request or response schema details are needed.
270
- - [Review the Merge Duplicates implementation](https://github.com/bkper/bkper-apps/tree/main/merge-duplicates) for a platform-app example with deterministic candidate filtering, strict structured output, and human-confirmed merges.
123
+ For direct HTTP calls, advanced features, or exact request and response fields, use the [Bkper AI API reference](https://bkper.com/docs/api/ai.md) and [AI Gateway guide](https://bkper.com/docs/ai/ai-gateway.md). Bkper AI implements a documented subset of Open Responses, not every OpenAI or AI SDK feature.
@@ -28,19 +28,13 @@ See [App Configuration](https://bkper.com/docs/platform/apps/configuration.md) f
28
28
 
29
29
  ## Default visibility
30
30
 
31
- By default, installation is limited to the users you've declared in `bkper.yaml`:
31
+ Unpublished apps appear in listings for their owner, developers, and users matched by `bkper.yaml`:
32
32
 
33
33
  ```yaml
34
- # Specific Bkper usernames
35
- users: alice bob
36
-
37
- # Your entire domain
38
- users: *@yourcompany.com
34
+ users: alice bob@example.com *@yourcompany.com
39
35
  ```
40
36
 
41
- Use Bkper usernames for individual access, not email addresses.
42
-
43
- Your team can install and use the app, but it doesn't appear in the public Bkper app directory for other users.
37
+ An exact email matches only that account, case-insensitively. `*@yourcompany.com` matches the hosted domain. Other users won't see an unpublished app in listings.
44
38
 
45
39
  ## Publishing to all users
46
40
 
@@ -83,8 +83,8 @@ deployment:
83
83
 
84
84
  | Field | Description |
85
85
  | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ |
86
- | `developers` | Who can update the app and deploy new versions. Accepts comma- or space-separated Bkper usernames and domain wildcards such as `*@yoursite.com`. |
87
- | `users` | Who can install and use the app. Uses the same format as `developers`; leave empty for public apps. |
86
+ | `developers` | Can update, deploy, and access managed source. Comma- or space-separated usernames, exact emails (case-insensitive), or hosted-domain patterns (`*@example.com`). |
87
+ | `users` | Who can find an unpublished app in listings. Accepts the same entries as `developers`. |
88
88
 
89
89
  ### Menu integration
90
90
 
@@ -22,7 +22,7 @@ Source and deployment remain separate. `git push` stores source only and **never
22
22
 
23
23
  CLI-managed pushes are clean-tree and fast-forward-only. The CLI never commits, merges, rebases, force-pushes, resets, or discards files. Authorized developers may use ordinary Git commands, including an intentional force-push, but a push still never deploys.
24
24
 
25
- Configured App developers, including matches such as `*@example.com`, can read and modify private managed source under the existing owner/developer policy. App users and Book collaborators do not receive source access unless they also satisfy that developer policy. Repository credentials are exact URL/path-scoped, noninteractive, and valid for five minutes; they are never persisted by Bkper.
25
+ Configured App developers, including exact email entries and domain patterns such as `*@example.com`, can read and modify private managed source under the existing owner/developer policy. An exact email matches only that account (case-insensitively); a domain pattern grants access across the hosted domain. App users and Book collaborators do not receive source access unless they also satisfy that developer policy. Repository credentials are exact URL/path-scoped, noninteractive, and valid for five minutes; they are never persisted by Bkper.
26
26
 
27
27
  ### Migrate from an external Git provider
28
28
 
@@ -360,14 +360,15 @@ deprecated: false
360
360
  # -----------------------------------------------------------------------------
361
361
  # ACCESS CONTROL
362
362
  # -----------------------------------------------------------------------------
363
- # Who can update the app configuration and deploy new versions.
364
- # Comma-separated list of Bkper usernames (not emails).
365
- # Supports domain wildcards for registered custom domains: *@yourdomain.com
366
- developers: victor, aldo, *@bkper.com
367
-
368
- # Who can install and use the app.
369
- # Same format as developers. Leave empty for public apps.
370
- users: maria, *@acme.com
363
+ # Who can update the app, access managed source, and deploy new versions.
364
+ # Comma- or space-separated Bkper usernames, exact emails, or domain patterns.
365
+ # An exact email matches only that account (case-insensitively).
366
+ # Use *@yourdomain.com only to grant access to the entire hosted domain.
367
+ developers: victor, aldo@example.com, *@bkper.com
368
+
369
+ # Who can find the unpublished app in listings (along with its owner and developers).
370
+ # Same entry formats as developers; public listing requires publication review.
371
+ users: maria, alice@example.com, *@acme.com
371
372
 
372
373
  # -----------------------------------------------------------------------------
373
374
  # MENU INTEGRATION (optional)
@@ -381,6 +381,10 @@ bkper balance list -b abc123 -q 'on:2025-12-31'
381
381
 
382
382
  # Monthly balance evolution of one account during 2025
383
383
  bkper balance list -b abc123 -q "account:'<accountName>' after:2025-01-01 before:2026-01-01 by:m" --expanded 2
384
+
385
+ # Point-in-time trial view with separate debit and credit columns
386
+ bkper balance list -b abc123 \
387
+ -q "group:'<balanceSheetRootGroup>' before:2026-01-01" --expanded 2 --trial
384
388
  ```
385
389
 
386
390
  <details>
@@ -388,6 +392,9 @@ bkper balance list -b abc123 -q "account:'<accountName>' after:2025-01-01 before
388
392
 
389
393
  - `balance list -b <bookId> -q <query>` - List balances
390
394
  - `--expanded <level>` - Expand groups to specified depth (`0`+)
395
+ - `--trial` - Show total balances in separate debit and credit columns
396
+
397
+ `--trial` uses cumulative balances unless the query contains `after:`, in which case it uses period movements. It works with any balance query. A filtered subset, including Balance Sheet accounts alone, is not necessarily zero-sum; the Book-wide ledger remains zero-sum.
391
398
 
392
399
  </details>
393
400
 
package/lib/docs/index.md CHANGED
@@ -10,7 +10,7 @@ For Bkper app implementation, refactoring, or code review, always read `apps/qua
10
10
  - `cli/data-management.md` — CLI reference for managing financial data and files: books, accounts, groups, files, transactions, per-account balance queries, query operators (on:, after:, before:, account:, group:), output formats (table/json/csv), human-review Bkper UI links, batch operations via stdin/piping, collections.
11
11
  - `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).
12
12
  - `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.
13
- - `apps/ai.md` — Bkper AI integration for Platform apps: authenticated `/api/*` request flow, outbound authorization and app attribution, live model discovery, strict structured output, response validation, error preservation, data minimization, and unit-test boundaries.
13
+ - `apps/ai.md` — Bkper AI in Platform apps: choose Jev typed evaluations or Open Responses language models, authenticate through app `/api/*` routes, discover model capabilities, validate output, and keep Book writes under deterministic application control.
14
14
  - `apps/first-app.md` — First-app walkthrough: scaffold, install, run locally, trigger an event, customize the listing, establish shared source, check, and deploy.
15
15
  - `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.
16
16
  - `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": "4.30.1",
3
+ "version": "4.31.0",
4
4
  "description": "Official Bkper CLI for accounting data, automation, apps, and AI agents",
5
5
  "bin": {
6
6
  "bkper": "./lib/cli.js"
@@ -61,8 +61,8 @@
61
61
  "upgrade:api": "bun update @bkper/bkper-api-types --latest && bun update bkper-js --latest"
62
62
  },
63
63
  "dependencies": {
64
- "@earendil-works/pi-coding-agent": "0.85.1",
65
- "@earendil-works/pi-tui": "0.85.1",
64
+ "@earendil-works/pi-coding-agent": "0.87.0",
65
+ "@earendil-works/pi-tui": "0.87.0",
66
66
  "bkper-js": "^2.42.0",
67
67
  "commander": "^13.1.0",
68
68
  "dotenv": "^8.2.0",