@lotics/app-sdk 0.47.1 → 0.48.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.
@@ -8,10 +8,11 @@
8
8
  * with autocapture OFF (the product captures explicit events, not DOM
9
9
  * autocapture), and that project setting overrides any client `autocapture`
10
10
  * flag — so apps can't rely on autocapture. The SDK instead emits explicit
11
- * events for genuine user actions: `app_opened`, plus `app_workflow_run` /
12
- * `app_file_uploaded` from the hooks. Data-read mechanics (a `useQuery`
13
- * refetch) are a system signal, not a user action, and are deliberately not
14
- * events.
11
+ * events for genuine user actions only: `app_opened`, `app_file_uploaded`, and
12
+ * `app_comment_*`. System signals data-read mechanics (a `useQuery` refetch)
13
+ * and workflow/agent run outcomes are not events: the backend already logs
14
+ * and persists every run (`workflow_executions`, `app_agent_runs`), so a client
15
+ * event would be redundant system telemetry, not a gesture.
15
16
  *
16
17
  * Every event is tagged with app identity and rolls up under the existing
17
18
  * `organization` group; embedded apps `identify` the member the host passes
@@ -93,6 +94,10 @@ export async function bootstrapAnalytics() {
93
94
  autocapture: false,
94
95
  capture_pageview: false,
95
96
  capture_pageleave: false,
97
+ // Dead-click autocapture (enabled by the defaults preset) is a UX-research
98
+ // signal nobody consumes; explicit user actions + exception capture cover
99
+ // the app's monitoring needs.
100
+ capture_dead_clicks: false,
96
101
  // Error tracking (the project opts in). mount() only renders a local
97
102
  // banner, so this is the app's one exception channel.
98
103
  capture_exceptions: true,
package/dist/src/hooks.js CHANGED
@@ -23,17 +23,7 @@ import { initialAgentRunState, reduceAgentChunk, parseSseChunks, } from "./agent
23
23
  import { getMockRows } from "./mock.js";
24
24
  import { captureAppEvent } from "./analytics.js";
25
25
  export function useWorkflow(alias) {
26
- return useCallback(async (inputs) => {
27
- try {
28
- const result = await rpc("workflow", { alias, inputs: inputs ?? {} });
29
- captureAppEvent("app_workflow_run", { alias, ok: result.status !== "error" });
30
- return result;
31
- }
32
- catch (err) {
33
- captureAppEvent("app_workflow_run", { alias, ok: false });
34
- throw err;
35
- }
36
- }, [alias]);
26
+ return useCallback((inputs) => rpc("workflow", { alias, inputs: inputs ?? {} }), [alias]);
37
27
  }
38
28
  // Shared SWR config: surface a failed query immediately, keep the last good
39
29
  // rows (no retry loop that masks the error), and honor the focus/reconnect
@@ -413,7 +403,6 @@ export function useAgentRun(alias) {
413
403
  acc = { ...acc, status: "completed" };
414
404
  safeSetState(acc);
415
405
  }
416
- captureAppEvent("app_agent_run", { alias, ok: acc.status !== "error" });
417
406
  return acc.output;
418
407
  })
419
408
  .catch(async (err) => {
@@ -431,7 +420,6 @@ export function useAgentRun(alias) {
431
420
  ? { ...acc, status: "completed", output: settled.output ?? acc.output }
432
421
  : { ...acc, status: "error", error: settled.error_message ?? "The run was stopped." };
433
422
  safeSetState(acc);
434
- captureAppEvent("app_agent_run", { alias, ok: settled.status === "completed" });
435
423
  return acc.output;
436
424
  }
437
425
  if (aborted)
@@ -439,7 +427,6 @@ export function useAgentRun(alias) {
439
427
  }
440
428
  acc = { ...acc, status: "error", error: err.message };
441
429
  safeSetState(acc);
442
- captureAppEvent("app_agent_run", { alias, ok: false });
443
430
  throw err;
444
431
  });
445
432
  }, [alias, safeSetState]);
package/docs/runtime.md CHANGED
@@ -333,17 +333,18 @@ await checkIn({ latitude: r.coords.latitude, longitude: r.coords.longitude });
333
333
  bundle, invisible to the product's own analytics. **No per-app wiring**: don't
334
334
  install `posthog-js` or call any analytics API from app code.
335
335
 
336
- - **Explicit events only.** Autocapture, pageviews, and session replay are off
337
- (autocapture is disabled at the project level — a client flag could not
338
- re-enable it). Data reads (`useQuery` fetches) are deliberately not events.
336
+ - **Explicit events only — user gestures.** Autocapture, pageviews, and session
337
+ replay are off (autocapture is disabled at the project level — a client flag
338
+ could not re-enable it). System signals are deliberately not events: data
339
+ reads (`useQuery` fetches) and workflow/agent run outcomes. The backend
340
+ already logs and persists every run (`workflow_executions`, `app_agent_runs`),
341
+ so a client run event would be redundant system telemetry, not a gesture.
339
342
  - Events the SDK emits automatically:
340
343
 
341
344
  | Event | Fired when | Properties |
342
345
  |---|---|---|
343
346
  | `app_opened` | analytics finished initializing after `mount()` | — |
344
- | `app_workflow_run` | each `useWorkflow` call settles | `alias`, `ok` |
345
347
  | `app_file_uploaded` | a `useFileUpload` upload succeeds | `mime_type` |
346
- | `app_agent_run` | a `useAgentRun` run finishes | `alias`, `ok` |
347
348
  | `app_comment_created` | a comment is created via `useComments` | `has_files` |
348
349
  | `app_comment_updated` / `app_comment_deleted` | comment edit/delete succeeds | — |
349
350
 
@@ -359,9 +360,8 @@ install `posthog-js` or call any analytics API from app code.
359
360
  and never breaks the app. Events fired before init completes are buffered
360
361
  (bounded) and drained on init.
361
362
  - **Limitation:** there is no public API for custom app events — the capture
362
- function is internal to the SDK. If a bespoke funnel matters, model it as a
363
- workflow (which produces `app_workflow_run`) or request the surface as a
364
- platform change.
363
+ function is internal to the SDK. If a bespoke funnel matters, request the
364
+ surface as a platform change.
365
365
  - **Limitation:** PostHog's default bot/user-agent filter applies — headless
366
366
  browsers (e.g. Playwright) are never tracked, so analytics cannot be verified
367
367
  through headless automation.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lotics/app-sdk",
3
- "version": "0.47.1",
3
+ "version": "0.48.0",
4
4
  "description": "Runtime SDK for Lotics custom-code apps — typed hooks, postMessage bridge, mount entry point",
5
5
  "type": "module",
6
6
  "exports": {