bkper 4.18.3 → 4.19.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 (57) hide show
  1. package/README.md +7 -3
  2. package/lib/agent/auth-commands.d.ts +28 -0
  3. package/lib/agent/auth-commands.d.ts.map +1 -0
  4. package/lib/agent/auth-commands.js +388 -0
  5. package/lib/agent/auth-commands.js.map +1 -0
  6. package/lib/agent/bkper-ai-provider.d.ts +6 -0
  7. package/lib/agent/bkper-ai-provider.d.ts.map +1 -0
  8. package/lib/agent/bkper-ai-provider.js +140 -0
  9. package/lib/agent/bkper-ai-provider.js.map +1 -0
  10. package/lib/agent/run-agent-mode.d.ts.map +1 -1
  11. package/lib/agent/run-agent-mode.js +46 -5
  12. package/lib/agent/run-agent-mode.js.map +1 -1
  13. package/lib/auth/local-auth-service.d.ts +23 -4
  14. package/lib/auth/local-auth-service.d.ts.map +1 -1
  15. package/lib/auth/local-auth-service.js +97 -27
  16. package/lib/auth/local-auth-service.js.map +1 -1
  17. package/lib/cli.js +2 -0
  18. package/lib/cli.js.map +1 -1
  19. package/lib/commands/apps/dev.d.ts +2 -0
  20. package/lib/commands/apps/dev.d.ts.map +1 -1
  21. package/lib/commands/apps/dev.js +9 -1
  22. package/lib/commands/apps/dev.js.map +1 -1
  23. package/lib/commands/apps/register.d.ts.map +1 -1
  24. package/lib/commands/apps/register.js +2 -0
  25. package/lib/commands/apps/register.js.map +1 -1
  26. package/lib/commands/events/index.d.ts +3 -0
  27. package/lib/commands/events/index.d.ts.map +1 -0
  28. package/lib/commands/events/index.js +3 -0
  29. package/lib/commands/events/index.js.map +1 -0
  30. package/lib/commands/events/list.d.ts +36 -0
  31. package/lib/commands/events/list.d.ts.map +1 -0
  32. package/lib/commands/events/list.js +160 -0
  33. package/lib/commands/events/list.js.map +1 -0
  34. package/lib/commands/events/register.d.ts +8 -0
  35. package/lib/commands/events/register.d.ts.map +1 -0
  36. package/lib/commands/events/register.js +66 -0
  37. package/lib/commands/events/register.js.map +1 -0
  38. package/lib/commands/events/replay.d.ts +11 -0
  39. package/lib/commands/events/replay.d.ts.map +1 -0
  40. package/lib/commands/events/replay.js +30 -0
  41. package/lib/commands/events/replay.js.map +1 -0
  42. package/lib/dev/local-assets.d.ts.map +1 -1
  43. package/lib/dev/local-assets.js +91 -20
  44. package/lib/dev/local-assets.js.map +1 -1
  45. package/lib/dev/logger.d.ts +3 -1
  46. package/lib/dev/logger.d.ts.map +1 -1
  47. package/lib/dev/logger.js +13 -2
  48. package/lib/dev/logger.js.map +1 -1
  49. package/lib/dev/miniflare.d.ts +1 -0
  50. package/lib/dev/miniflare.d.ts.map +1 -1
  51. package/lib/dev/miniflare.js +67 -6
  52. package/lib/dev/miniflare.js.map +1 -1
  53. package/lib/docs/cli/app-management.md +14 -2
  54. package/lib/docs/cli/data-management.md +44 -1
  55. package/lib/docs/sdk/bkper-api-types.md +2 -0
  56. package/lib/docs/sdk/bkper-js.md +37 -1
  57. package/package.json +4 -4
@@ -1 +1 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/dev/logger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE3E,MAAM,WAAW,MAAM;IACnB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAiBD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAuBtD;AAED;;;;GAIG;AACH,wBAA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AAM,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CAC3C,GAAG,IAAI,CAgBP"}
package/lib/dev/logger.js CHANGED
@@ -62,14 +62,25 @@ export function formatSize(bytes) {
62
62
  }
63
63
  /**
64
64
  * Logs startup banner for the dev server
65
- * @param options - URLs for tunnel endpoint
65
+ * @param options - URLs for client, Worker/API, and tunnel endpoints
66
66
  */
67
67
  export function logDevServerBanner(options) {
68
68
  console.log('');
69
69
  console.log(`${icons.rocket} Bkper App Development Server`);
70
70
  console.log('');
71
+ if (options.clientUrl) {
72
+ console.log(` Open app: ${options.clientUrl}`);
73
+ }
74
+ if (options.workerUrl) {
75
+ console.log(` Worker/API: ${options.workerUrl}`);
76
+ }
71
77
  if (options.tunnelUrl) {
72
- console.log(` Events: ${options.tunnelUrl} (tunneled)`);
78
+ console.log(` Events: ${options.tunnelUrl} (tunneled)`);
79
+ }
80
+ if (options.clientUrl) {
81
+ console.log('');
82
+ console.log(' Open the app URL in your browser.');
83
+ console.log(' The Worker/API URL is for /api, /health, /openapi.json, and events.');
73
84
  }
74
85
  console.log('');
75
86
  console.log(' Press Ctrl+C to stop');
@@ -1 +1 @@
1
- {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/dev/logger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH;;GAEG;AACH,MAAM,KAAK,GAAG;IACV,OAAO,EAAE,QAAQ;IACjB,IAAI,EAAE,eAAe;IACrB,KAAK,EAAE,QAAQ;IACf,MAAM,EAAE,cAAc;IACtB,KAAK,EAAE,cAAc;IACrB,MAAM,EAAE,cAAc;IACtB,MAAM,EAAE,cAAc;IACtB,OAAO,EAAE,cAAc;IACvB,MAAM,EAAE,cAAc;CACzB,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,MAAiB;IAC1C,MAAM,aAAa,GAAG,CAAC,OAAe,EAAE,IAAa,EAAU,EAAE;QAC7D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BAAyB,CAAC,CAAC;IACvC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AACpB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,OAE/B;IACG,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;IACtD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAEhB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACjB,OAAO,CAAC,GAAG,CACP,kCAAkC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,UAAU,CAC3E,OAAO,CAAC,MAAM,CAAC,IAAI,CACtB,GAAG,CACP,CAAC;IACN,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;IAC/C,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AACpB,CAAC"}
@@ -10,6 +10,7 @@ export interface WorkerServerOptions {
10
10
  persistPath?: string;
11
11
  assetsService?: LocalAssetsService;
12
12
  outboundService?: LocalOutboundService;
13
+ clientOrigin?: string;
13
14
  }
14
15
  /**
15
16
  * Resolves the Miniflare entry point from the app project root.
@@ -1 +1 @@
1
- {"version":3,"file":"miniflare.d.ts","sourceRoot":"","sources":["../../src/dev/miniflare.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAO,MAAM,WAAW,CAAC;AAIhD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAEhE,MAAM,WAAW,mBAAmB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,EA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AM,CAAC,CAAC;IAC9B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,kBAAkB,CAAC;IACnC,eAAe,CAAC,EAAE,oBAAoB,CAAC;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAiKD;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAEtE;AAqBD;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CACpC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,mBAAmB,GAC7B,OAAO,CAAC,SAAS,CAAC,CA2DpB;AAED;;;;;;GAMG;AACH,wBAAsB,YAAY,CAAC,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGnF;AAED;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAkBjF;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,EAAE,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAEnE"}
@@ -7,6 +7,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
+ var __rest = (this && this.__rest) || function (s, e) {
11
+ var t = {};
12
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
13
+ t[p] = s[p];
14
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
15
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
16
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
17
+ t[p[i]] = s[p[i]];
18
+ }
19
+ return t;
20
+ };
10
21
  import { createRequire } from 'module';
11
22
  import { pathToFileURL } from 'url';
12
23
  import { buildWorker } from './esbuild.js';
@@ -18,9 +29,12 @@ const instanceConfigs = new WeakMap();
18
29
  const require = createRequire(import.meta.url);
19
30
  const APP_WORKER_MODULE_PATH = 'app-worker.js';
20
31
  const LOCAL_DISPATCH_WRAPPER_PATH = 'index.js';
21
- const localDispatchWrapper = `
32
+ function createLocalDispatchWrapper(clientOrigin) {
33
+ const serializedClientOrigin = JSON.stringify(clientOrigin !== null && clientOrigin !== void 0 ? clientOrigin : '');
34
+ return `
22
35
  import appWorker from './${APP_WORKER_MODULE_PATH}';
23
36
 
37
+ const CLIENT_ORIGIN = ${serializedClientOrigin};
24
38
  const PLATFORM_SESSION_COOKIE_NAMES = new Set([
25
39
  'bkper_session',
26
40
  'bkper_session_dev',
@@ -33,6 +47,44 @@ const RESERVED_PLATFORM_REQUEST_HEADERS = [
33
47
  'bkper-agent-id',
34
48
  ];
35
49
 
50
+ const WORKER_BROWSER_ENDPOINTS = new Set([
51
+ '/health',
52
+ '/openapi.json',
53
+ ]);
54
+
55
+ function shouldRedirectToClient(request) {
56
+ if (!CLIENT_ORIGIN || (request.method !== 'GET' && request.method !== 'HEAD')) {
57
+ return false;
58
+ }
59
+
60
+ const url = new URL(request.url);
61
+ if (isWorkerEndpoint(url.pathname)) {
62
+ return false;
63
+ }
64
+
65
+ const accept = request.headers.get('Accept') || '';
66
+ const fetchMode = request.headers.get('Sec-Fetch-Mode') || '';
67
+ return fetchMode === 'navigate' || accept.includes('text/html') || accept === '';
68
+ }
69
+
70
+ function isWorkerEndpoint(pathname) {
71
+ return (
72
+ WORKER_BROWSER_ENDPOINTS.has(pathname) ||
73
+ pathname === '/events' ||
74
+ pathname.startsWith('/events/') ||
75
+ pathname === '/api' ||
76
+ pathname.startsWith('/api/')
77
+ );
78
+ }
79
+
80
+ function buildClientRedirectUrl(request) {
81
+ const targetUrl = new URL(request.url);
82
+ const clientUrl = new URL(CLIENT_ORIGIN);
83
+ targetUrl.protocol = clientUrl.protocol;
84
+ targetUrl.host = clientUrl.host;
85
+ return targetUrl.toString();
86
+ }
87
+
36
88
  function stripPlatformRequestCredentials(request) {
37
89
  const headers = new Headers(request.headers);
38
90
  stripPlatformCookieHeader(headers);
@@ -76,16 +128,21 @@ function isPlatformCookiePair(cookiePair) {
76
128
 
77
129
  export default {
78
130
  fetch(request, env, ctx) {
131
+ if (shouldRedirectToClient(request)) {
132
+ return Response.redirect(buildClientRedirectUrl(request), 302);
133
+ }
134
+
79
135
  return appWorker.fetch(stripPlatformRequestCredentials(request), env, ctx);
80
136
  },
81
137
  };
82
138
  `;
83
- function buildWorkerModules(script) {
139
+ }
140
+ function buildWorkerModules(script, clientOrigin) {
84
141
  return [
85
142
  {
86
143
  type: 'ESModule',
87
144
  path: LOCAL_DISPATCH_WRAPPER_PATH,
88
- contents: localDispatchWrapper,
145
+ contents: createLocalDispatchWrapper(clientOrigin),
89
146
  },
90
147
  {
91
148
  type: 'ESModule',
@@ -154,12 +211,15 @@ export function createWorkerServer(entryPoint, options) {
154
211
  serviceBindings: options.assetsService ? { ASSETS: options.assetsService } : undefined,
155
212
  // Local outbound service emulates Workers for Platforms egress policies.
156
213
  outboundService: options.outboundService,
214
+ // Client browser origin used to redirect accidental Worker-root navigations.
215
+ clientOrigin: options.clientOrigin,
157
216
  };
158
- const mf = new MiniflareClass(Object.assign(Object.assign({}, baseConfig), {
217
+ const { clientOrigin } = baseConfig, miniflareBaseConfig = __rest(baseConfig, ["clientOrigin"]);
218
+ const mf = new MiniflareClass(Object.assign(Object.assign({}, miniflareBaseConfig), {
159
219
  // Use modules array format instead of script string
160
220
  // This allows Miniflare to properly handle dynamic imports of external modules
161
221
  // like cloudflare:workers that are used by libraries (e.g., Hono)
162
- modules: buildWorkerModules(script) }));
222
+ modules: buildWorkerModules(script, clientOrigin) }));
163
223
  // Store the base config for hot reload
164
224
  instanceConfigs.set(mf, baseConfig);
165
225
  // Wait for Miniflare to be ready
@@ -198,8 +258,9 @@ export function updateWorkerCode(mf, code) {
198
258
  });
199
259
  return;
200
260
  }
261
+ const { clientOrigin } = baseConfig, miniflareBaseConfig = __rest(baseConfig, ["clientOrigin"]);
201
262
  // Apply the full config with new modules
202
- yield mf.setOptions(Object.assign(Object.assign({}, baseConfig), { modules: buildWorkerModules(code) }));
263
+ yield mf.setOptions(Object.assign(Object.assign({}, miniflareBaseConfig), { modules: buildWorkerModules(code, clientOrigin) }));
203
264
  });
204
265
  }
205
266
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"miniflare.js","sourceRoot":"","sources":["../../src/dev/miniflare.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAgC3C;;;GAGG;AACH,MAAM,eAAe,GAAG,IAAI,OAAO,EAAyB,CAAC;AAC7D,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAQ/C,MAAM,sBAAsB,GAAG,eAAe,CAAC;AAC/C,MAAM,2BAA2B,GAAG,UAAU,CAAC;AAE/C,MAAM,oBAAoB,GAAG;2BACF,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4DhD,CAAC;AAEF,SAAS,kBAAkB,CAAC,MAAc;IACtC,OAAO;QACH;YACI,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,2BAA2B;YACjC,QAAQ,EAAE,oBAAoB;SACjC;QACD;YACI,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,sBAAsB;YAC5B,QAAQ,EAAE,MAAM;SACnB;KACJ,CAAC;AACN,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,0BAA0B,CAAC,WAAmB;IAC1D,OAAO,OAAO,C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jC,MAAM,EAAE,CAAC,KAAK,CAAC;QACf,OAAO,EAAE,CAAC;IACd,CAAC;CAAA;AAED;;;;;;GAMG;AACH,MAAM,UAAgB,YAAY,CAAC,EAAa,EAAE,UAAkB;;QAChE,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,UAAU,CAAC,CAAC;QAC7C,MAAM,gBAAgB,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;IACvC,CAAC;CAAA;AAED;;;;;;GAMG;AACH,MAAM,UAAgB,gBAAgB,CAAC,EAAa,EAAE,IAAY;;QAC9D,kCAAkC;QAClC,MAAM,UAAU,GAAG,eAAe,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC3C,IAAI,CAAC,UAAU,EAAE,CAAC;YACd,+EAA+E;YAC/E,MAAM,EAAE,CAAC,UAAU,CAAC;gBAChB,OAAO,EAAE,kBAAkB,CAAC,IAAI,CAAC;aACpC,CAAC,CAAC;YACH,OAAO;QACX,CAAC;QAED,MAAM,EAAE,YAAY,KAA6B,UAAU,EAAlC,mBAAmB,UAAK,UAAU,EAArD,gBAAwC,CAAa,CAAC;QAE5D,yCAAyC;QACzC,MAAM,EAAE,CAAC,UAAU,iCACZ,mBAAmB,KACtB,OAAO,EAAE,kBAAkB,CAAC,IAAI,EAAE,YAAY,CAAC,IACjD,CAAC;IACP,CAAC;CAAA;AAED;;;;GAIG;AACH,MAAM,UAAgB,gBAAgB,CAAC,EAAa;;QAChD,MAAM,EAAE,CAAC,OAAO,EAAE,CAAC;IACvB,CAAC;CAAA"}
@@ -111,6 +111,12 @@ cd my-app
111
111
  # In your project, use "npm run dev" to run both Vite and the worker concurrently
112
112
  bkper app dev
113
113
 
114
+ # If your Vite dev server uses a non-default port, point ASSETS at it
115
+ bkper app dev --cp 5177
116
+
117
+ # In the browser, open the "Open app" URL printed by the command
118
+ # (normally http://localhost:5173), not the Worker/API URL.
119
+
114
120
  # Build the server Worker bundle
115
121
  # In your project, use "npm run build" to build both client (Vite) and worker
116
122
  bkper app build
@@ -129,7 +135,7 @@ bkper app deploy --preview
129
135
  bkper app status
130
136
  ```
131
137
 
132
- > **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`. If needed, install Miniflare in the app root with `bun add -d miniflare` or `npm install -D miniflare`.
138
+ > **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`.
133
139
 
134
140
  ---
135
141
 
@@ -410,7 +416,12 @@ deployment:
410
416
  - `agent` - Start the interactive Bkper Agent
411
417
  - `agent <pi-args...>` - Run Pi CLI with Bkper defaults (system prompt/resources)
412
418
 
413
- Inside the interactive agent, `/login` connects an AI model provider; it is separate from `bkper auth login`, which connects the CLI to your Bkper account.
419
+ Inside the interactive agent:
420
+
421
+ - `/login` connects to Bkper and enables the included Bkper AI models. It uses the same local credentials as `bkper auth login`.
422
+ - `/logout` revokes and clears Bkper authentication.
423
+ - `/connect [provider]` connects an external model provider through a subscription or API key.
424
+ - `/disconnect [provider]` removes credentials stored by `/connect`. Environment variables and model configuration remain unchanged.
414
425
 
415
426
  ### App Lifecycle
416
427
 
@@ -436,6 +447,7 @@ Inside the interactive agent, `/login` connects an AI model provider; it is sepa
436
447
  - `--force` - Skip confirmation prompts (use with `--delete-data` for automation)
437
448
  - `app dev` - Start the worker runtime for local development
438
449
  - `--sp, --server-port <port>` - Server simulation port (default: `8787`)
450
+ - `--cp, --client-port <port>` - Client dev server port for local static assets (default: `5173`)
439
451
 
440
452
  > **Note:** `sync` and `deploy` are independent operations. Use `sync` to update your app's URLs in Bkper (required for webhooks and menu integration). Use `deploy` to push code to Cloudflare. For a typical deployment workflow, run both: `bkper app sync && bkper app deploy`
441
453
 
@@ -1,6 +1,6 @@
1
1
  # Data Management
2
2
 
3
- Interact with books, files, accounts, transactions, and balances using the `bkper` CLI.
3
+ Interact with books, files, accounts, transactions, events, and balances using the `bkper` CLI.
4
4
 
5
5
  All commands that operate within a book use `-b, --book <bookId>` to specify the book context.
6
6
 
@@ -296,6 +296,49 @@ bkper transaction merge tx_123 tx_456 -b abc123
296
296
  </details>
297
297
 
298
298
 
299
+ ---
300
+
301
+ ## Events
302
+
303
+ Inspect book events and bot responses — useful for debugging automations and recovering from intermittent bot errors.
304
+
305
+ ```bash
306
+ # List recent events (one page, default limit 50)
307
+ bkper event list -b abc123
308
+
309
+ # List only events with error bot responses, as JSON (includes full botResponses)
310
+ bkper event list -b abc123 --error --json
311
+
312
+ # Filter by resource (transaction, account, or group id)
313
+ bkper event list -b abc123 --resource tx_456 --json
314
+
315
+ # Filter by event type and date range
316
+ bkper event list -b abc123 --type TRANSACTION_POSTED --after 2026-01-01T00:00:00Z
317
+
318
+ # Fetch the next page
319
+ bkper event list -b abc123 --limit 50 --cursor cursor_123
320
+
321
+ # Replay one bot response after inspecting an error
322
+ bkper event replay evt_789 -b abc123 --agent-id tax-bot --json
323
+ ```
324
+
325
+ <details>
326
+ <summary>Command reference</summary>
327
+
328
+ - `event list -b <bookId>` - List one page of events in a book (includes bot responses in JSON)
329
+ - `--after <date>` - Start date inclusive (RFC3339)
330
+ - `--before <date>` - End date exclusive (RFC3339)
331
+ - `--resource <resourceId>` - Filter by resource ID (Transaction, Account, or Group). When set, `--error` and `--type` are ignored by the API
332
+ - `--error` - Only events with at least one error bot response. When set, `--type` is ignored by the API
333
+ - `--type <type>` - Filter by event type (e.g. `TRANSACTION_POSTED`, `ACCOUNT_CREATED`)
334
+ - `--limit <number>` - Fetch one page with up to this many events (default `50`, max `200`)
335
+ - `--cursor <cursor>` - Cursor for fetching the next page
336
+ - `event replay <eventId> -b <bookId> --agent-id <agentId>` - Replay one bot response for an event (returns the updated event with bot responses)
337
+
338
+ JSON output includes the full event payload, including nested `botResponses` (`agentId`, `type`, `message`, `createdAt`), for LLM-assisted debugging.
339
+
340
+ </details>
341
+
299
342
  ---
300
343
 
301
344
  ## Balances
@@ -244,6 +244,7 @@ More information at the [Bkper Developer Documentation](https://bkper.com/docs/#
244
244
  **Properties:**
245
245
 
246
246
  - `agentId?`: `string` — The id of agent that created the resource
247
+ - `avatarUrl?`: `string` — The Collaborator public avatar url
247
248
  - `createdAt?`: `string` — The creation timestamp, in milliseconds
248
249
  - `email?`: `string` — The email of the Collaborator
249
250
  - `id?`: `string` — The unique id that identifies the Collaborator in the Book
@@ -534,6 +535,7 @@ More information at the [Bkper Developer Documentation](https://bkper.com/docs/#
534
535
  - `billingAdminEmail?`: `string` — The billing admin email for this user's billing account
535
536
  - `billingEnabled?`: `boolean` — True if billing is enabled for the user
536
537
  - `daysLeftInTrial?`: `number` — How many days left in trial
538
+ - `domain?`: `bkper.Domain`
537
539
  - `email?`: `string` — The user email
538
540
  - `free?`: `boolean` — True if user is in the free plan
539
541
  - `fullName?`: `string` — The user full name
@@ -631,7 +631,7 @@ It contains all `Accounts` where `Transactions` are recorded/posted;
631
631
  - `getTransaction(id: string)` → `Promise<Transaction | undefined>` — Retrieve a transaction by id.
632
632
  - `getVisibility()` / `setVisibility(visibility: Visibility)` → `Visibility` — Gets the visibility of the book.
633
633
  - `json()` → `bkper.Book` — Gets an immutable copy of the JSON payload for this resource.
634
- - `listEvents(afterDate: string | null, beforeDate: string | null, onError: boolean | null, resourceId: string | null, limit: number, cursor?: string)` → `Promise<EventList>` — Lists events in the Book based on the provided parameters.
634
+ - `listEvents(options: ListEventsOptions)` → `Promise<EventList>` — Lists events in the Book based on the provided options.
635
635
  - `listFiles(limit?: number, cursor?: string)` → `Promise<FileList>` — Lists files in the Book, for pagination.
636
636
  - `listTransactions(query?: string, limit?: number, cursor?: string)` → `Promise<TransactionList>` — Lists transactions in the Book based on the provided query, limit, and cursor, for pagination.
637
637
  - `mergeTransactions(transaction1: string | bkper.Transaction | Transaction, transaction2: string | bkper.Transaction | Transaction)` → `Promise<Transaction>` — Merge two `Transactions` into a single new canonical transaction.
@@ -786,6 +786,7 @@ A Collaborator represents a user that has been granted access to a Book with spe
786
786
  **Methods:**
787
787
 
788
788
  - `create(message?: string)` → `Promise<Collaborator>` — Performs create new Collaborator.
789
+ - `getAvatarUrl()` → `string | undefined` — Gets the public avatar url of the Collaborator.
789
790
  - `getEmail()` / `setEmail(email: string)` → `string | undefined (set: string)` — Gets the Collaborator email address.
790
791
  - `getId()` → `string | undefined` — Gets the Collaborator internal id.
791
792
  - `getPermission()` / `setPermission(permission: Permission)` → `Permission | undefined (set: Permission)` — Gets the permission level of the Collaborator.
@@ -902,6 +903,7 @@ A File can be attached to a `Transaction` or used to import data.
902
903
  - `getBook()` → `Book` — Gets the Book this File belongs to.
903
904
  - `getContent()` / `setContent(content: string)` → `Promise<string | undefined> (set: string)` — Gets the file content Base64 encoded.
904
905
  - `getContentType()` / `setContentType(contentType: string)` → `string | undefined (set: string)` — Gets the File content type.
906
+ - `getCreatedAt()` → `Date | undefined` — Gets the date the File was created.
905
907
  - `getId()` → `string | undefined` — Gets the File id.
906
908
  - `getName()` / `setName(name: string)` → `string | undefined (set: string)` — Gets the File name.
907
909
  - `getSize()` → `number | undefined` — Gets the file size in bytes.
@@ -1311,6 +1313,40 @@ Bkper Platform outbound for server-side app routes.
1311
1313
  This function is called when a request fails and needs to be retried.
1312
1314
  It provides the HTTP status code, error message, and the number of retry attempts made so far.
1313
1315
 
1316
+ ### ListEventsOptions
1317
+
1318
+ Options for listing events in a Book.
1319
+
1320
+ **Properties:**
1321
+
1322
+ - `afterDate?`: `string` — The start date (inclusive) for the events search range, in [RFC3339](https://en.wikipedia.org/wiki/ISO_8601#RFC_3339) format.
1323
+ - `beforeDate?`: `string` — The end date (exclusive) for the events search range, in [RFC3339](https://en.wikipedia.org/wiki/ISO_8601#RFC_3339) format.
1324
+ - `cursor?`: `string` — The cursor for pagination.
1325
+ - `limit`: `number` — The maximum number of events to return.
1326
+ - `onError?`: `boolean` — Whether to filter events by error responses.
1327
+ - `resourceId?`: `string` — The ID of the event's resource (Transaction, Account, or Group).
1328
+ - `type?`: `EventType` — The event type to filter by.
1329
+
1330
+ **limit**
1331
+
1332
+ Defaults to `50`, maximum is `200`.
1333
+
1334
+ **onError**
1335
+
1336
+ `true` returns events with at least one error response.
1337
+ `false` returns events with no error responses.
1338
+ `null` or `undefined` includes events regardless of error responses.
1339
+
1340
+ Ignored when `resourceId` is set. When set, `type` is ignored.
1341
+
1342
+ **resourceId**
1343
+
1344
+ When set, `onError` and `type` are ignored.
1345
+
1346
+ **type**
1347
+
1348
+ Ignored when `resourceId` or `onError` is set.
1349
+
1314
1350
  ## Enums
1315
1351
 
1316
1352
  ### AccountType
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bkper",
3
- "version": "4.18.3",
3
+ "version": "4.19.0",
4
4
  "description": "Command line client for Bkper",
5
5
  "bin": {
6
6
  "bkper": "./lib/cli.js"
@@ -43,7 +43,7 @@
43
43
  "test:integration": "TS_NODE_TRANSPILE_ONLY=true BKPER_API_URL=${BKPER_API_URL:-http://localhost:8081/_ah/api/bkper} TS_NODE_PROJECT=tsconfig.test.json mocha --config .mocharc.integration.json",
44
44
  "test:deploy": "TS_NODE_TRANSPILE_ONLY=true BKPER_PLATFORM_URL=http://localhost:8790 BKPER_API_URL=https://api-dev.bkper.app TS_NODE_PROJECT=tsconfig.test.json mocha --config .mocharc.deploy.json",
45
45
  "test:all": "bun run test:unit && bun run test:integration",
46
- "version": "bun ./scripts/sync-plugin-version.ts",
46
+ "version": "bun ./scripts/sync-plugin-version.ts && git add .claude-plugin/plugin.json .claude-plugin/marketplace.json .codex-plugin/plugin.json",
47
47
  "release:patch": "npm version patch -m \"chore(release): v%s\"",
48
48
  "release:minor": "npm version minor -m \"chore(release): v%s\"",
49
49
  "release:major": "npm version major -m \"chore(release): v%s\"",
@@ -52,8 +52,8 @@
52
52
  "upgrade:api": "bun update @bkper/bkper-api-types --latest && bun update bkper-js --latest"
53
53
  },
54
54
  "dependencies": {
55
- "@earendil-works/pi-coding-agent": "0.80.3",
56
- "bkper-js": "^2.37.0",
55
+ "@earendil-works/pi-coding-agent": "0.80.6",
56
+ "bkper-js": "^2.40.1",
57
57
  "commander": "^13.1.0",
58
58
  "dotenv": "^8.2.0",
59
59
  "esbuild": "^0.27.2",