@lucida-analytics/browser 0.0.0-stage → 0.1.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/LICENSE +202 -0
- package/README.md +228 -2
- package/dist/autocapture.d.ts +78 -0
- package/dist/autocapture.js +1 -0
- package/dist/banner-CGEWCIGP.js +1 -0
- package/dist/chunk-3PWTJFHH.js +1 -0
- package/dist/chunk-AWIQCFGN.js +1 -0
- package/dist/chunk-GVYMMTQM.js +1 -0
- package/dist/chunk-MCWQHOEV.js +1 -0
- package/dist/chunk-MI35SSIT.js +1 -0
- package/dist/client-ts5YMCoB.d.ts +8 -0
- package/dist/consent.d.ts +84 -0
- package/dist/consent.js +1 -0
- package/dist/core.d.ts +9 -0
- package/dist/core.js +3 -0
- package/dist/correlate.d.ts +15 -0
- package/dist/correlate.js +1 -0
- package/dist/early-access.d.ts +12 -0
- package/dist/early-access.js +1 -0
- package/dist/experiments.d.ts +199 -0
- package/dist/experiments.js +1 -0
- package/dist/flags.d.ts +13 -0
- package/dist/flags.js +3 -0
- package/dist/forms.d.ts +13 -0
- package/dist/forms.js +1 -0
- package/dist/guides.d.ts +1158 -0
- package/dist/guides.js +1 -0
- package/dist/heatmaps.d.ts +17 -0
- package/dist/heatmaps.js +1 -0
- package/dist/host-headers.d.ts +16 -0
- package/dist/host-headers.js +1 -0
- package/dist/index.d.ts +89 -0
- package/dist/index.js +3 -0
- package/dist/inspector.d.ts +13 -0
- package/dist/inspector.js +1 -0
- package/dist/lucida.js +3 -0
- package/dist/modules-FANMZRDJ.js +1 -0
- package/dist/persistent-XLGNSZQR.js +1 -0
- package/dist/recommendations.d.ts +2 -0
- package/dist/recommendations.js +1 -0
- package/dist/recorder-LFUTDRP4.js +78 -0
- package/dist/replay.d.ts +18 -0
- package/dist/replay.js +1 -0
- package/dist/static/v0/autocapture.js +1 -0
- package/dist/static/v0/banner-CGEWCIGP.js +1 -0
- package/dist/static/v0/chunk-3PWTJFHH.js +1 -0
- package/dist/static/v0/chunk-AWIQCFGN.js +1 -0
- package/dist/static/v0/chunk-GVYMMTQM.js +1 -0
- package/dist/static/v0/chunk-MCWQHOEV.js +1 -0
- package/dist/static/v0/chunk-MI35SSIT.js +1 -0
- package/dist/static/v0/consent.js +1 -0
- package/dist/static/v0/core.js +3 -0
- package/dist/static/v0/correlate.js +1 -0
- package/dist/static/v0/early-access.js +1 -0
- package/dist/static/v0/experiments.js +1 -0
- package/dist/static/v0/flags.js +3 -0
- package/dist/static/v0/forms.js +1 -0
- package/dist/static/v0/guides.js +1 -0
- package/dist/static/v0/heatmaps.js +1 -0
- package/dist/static/v0/host-headers.js +1 -0
- package/dist/static/v0/index.js +3 -0
- package/dist/static/v0/inspector.js +1 -0
- package/dist/static/v0/lucida.js +3 -0
- package/dist/static/v0/modules-FANMZRDJ.js +1 -0
- package/dist/static/v0/persistent-XLGNSZQR.js +1 -0
- package/dist/static/v0/recommendations.js +1 -0
- package/dist/static/v0/recorder-LFUTDRP4.js +78 -0
- package/dist/static/v0/replay.js +1 -0
- package/dist/static/v0/toolbar.js +4 -0
- package/dist/static/v0/validation-ENITEP6V.js +1 -0
- package/dist/static/v0/webmcp.js +1 -0
- package/dist/static/v0.1.0/autocapture.js +1 -0
- package/dist/static/v0.1.0/banner-CGEWCIGP.js +1 -0
- package/dist/static/v0.1.0/chunk-3PWTJFHH.js +1 -0
- package/dist/static/v0.1.0/chunk-AWIQCFGN.js +1 -0
- package/dist/static/v0.1.0/chunk-GVYMMTQM.js +1 -0
- package/dist/static/v0.1.0/chunk-MCWQHOEV.js +1 -0
- package/dist/static/v0.1.0/chunk-MI35SSIT.js +1 -0
- package/dist/static/v0.1.0/consent.js +1 -0
- package/dist/static/v0.1.0/core.js +3 -0
- package/dist/static/v0.1.0/correlate.js +1 -0
- package/dist/static/v0.1.0/early-access.js +1 -0
- package/dist/static/v0.1.0/experiments.js +1 -0
- package/dist/static/v0.1.0/flags.js +3 -0
- package/dist/static/v0.1.0/forms.js +1 -0
- package/dist/static/v0.1.0/guides.js +1 -0
- package/dist/static/v0.1.0/heatmaps.js +1 -0
- package/dist/static/v0.1.0/host-headers.js +1 -0
- package/dist/static/v0.1.0/index.js +3 -0
- package/dist/static/v0.1.0/inspector.js +1 -0
- package/dist/static/v0.1.0/integrity.json +30 -0
- package/dist/static/v0.1.0/lucida.js +3 -0
- package/dist/static/v0.1.0/modules-FANMZRDJ.js +1 -0
- package/dist/static/v0.1.0/persistent-XLGNSZQR.js +1 -0
- package/dist/static/v0.1.0/recommendations.js +1 -0
- package/dist/static/v0.1.0/recorder-LFUTDRP4.js +78 -0
- package/dist/static/v0.1.0/replay.js +1 -0
- package/dist/static/v0.1.0/toolbar.js +4 -0
- package/dist/static/v0.1.0/validation-ENITEP6V.js +1 -0
- package/dist/static/v0.1.0/webmcp.js +1 -0
- package/dist/toolbar.d.ts +193 -0
- package/dist/toolbar.js +4 -0
- package/dist/types-BWd9sbCh.d.ts +1071 -0
- package/dist/types-Cv4pBbPu.d.ts +898 -0
- package/dist/validation-ENITEP6V.js +1 -0
- package/dist/webmcp.d.ts +21 -0
- package/dist/webmcp.js +1 -0
- package/package.json +104 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as x,f as E,g as L,j as w}from"./chunk-MCWQHOEV.js";var k=/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/,A=/^\+?[\d\s().-]{7,20}$/,G=".v{position:fixed;z-index:2147483000;background:#fff;color:#b42318;border:1px solid #f04438;border-radius:6px;padding:6px 10px;font:13px system-ui;max-width:280px;box-shadow:0 2px 8px rgba(0,0,0,.15)}";function H(t,l){let n=t.trim();for(let e of l){if(e.type==="required"){if(!n)return e;continue}if(!n)continue;let u=typeof e.value=="number"?e.value:Number(e.value);if(e.type==="email"&&!k.test(n)||e.type==="url"&&!N(n)||e.type==="phone"&&!(A.test(n)&&n.replace(/\D/g,"").length>=7)||e.type==="regex"&&!T(n,e.value)||e.type==="min_length"&&Number.isFinite(u)&&n.length<u||e.type==="max_length"&&Number.isFinite(u)&&n.length>u||e.type==="number"&&!Number.isFinite(Number(n)))return e}return null}function N(t){try{return/^https?:$/.test(new URL(t).protocol)}catch{return!1}}function T(t,l){if(typeof l!="string"||l.length>500)return!0;try{return new RegExp(l).test(t)}catch{return!0}}var M=t=>t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement?t.value:null;function $(t,l,n,e={}){let u=document.createElement("div");u.setAttribute("data-lc-ignore","");let p=u.attachShadow({mode:"open"});p.append(x(G,e.nonce)),document.body.append(u);let v=new WeakSet,m=new Map,f=[],b=!1,g=(r,i,d)=>{let s=M(i);if(s===null)return!0;let a=H(s,d);if(m.get(r)?.remove(),m.delete(r),i.removeAttribute("aria-invalid"),!a)return!0;let o=document.createElement("div");o.className="v",o.setAttribute("role","alert"),o.textContent=a.message;let c=E(t.appearance);return delete c.background,delete c.text,L(o,c),p.append(o),w(o,i,"bottom"),m.set(r,o),i.setAttribute("aria-invalid","true"),l.validationFailed?.(r,a.type),!1},y=()=>{for(let r of t.steps){let i=r.validation;if(!i?.selector||!i.rules?.length)continue;let d;try{d=[...document.querySelectorAll(i.selector)]}catch{continue}for(let s of d){if(v.has(s))continue;v.add(s);let a=()=>{g(r.id,s,i.rules)};s.addEventListener("blur",a),f.push(()=>s.removeEventListener("blur",a));let o=s.closest("form");if(!o)continue;let c=h=>{g(r.id,s,i.rules)||(h.preventDefault(),h.stopPropagation())};o.addEventListener("submit",c,!0),f.push(()=>o.removeEventListener("submit",c,!0))}}},R=setInterval(y,500);return y(),l.shown(),()=>{if(!b){b=!0,clearInterval(R);for(let r of f)r();u.remove(),n()}}}export{H as failedRule,$ as renderValidation};
|
package/dist/webmcp.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { M as Module } from './types-BWd9sbCh.js';
|
|
2
|
+
import '@lucida-analytics/sdk-core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* WebMCP agent-action capture (P-M43). Sites expose tools to in-browser AI agents through
|
|
6
|
+
* `navigator.modelContext` (`provideContext({tools})` / `registerTool(tool)`, W3C WebMCP draft). This module wraps
|
|
7
|
+
* every tool's `execute` so each agent call emits `$agent_action {tool, status, duration_ms}` and marks the session
|
|
8
|
+
* as agent-driven: every later event of the session carries `$agent_session: true` (lc-enrich turns that into the
|
|
9
|
+
* server-owned `$agent_driven`). Tool inputs and results are never read. Load it before the site registers tools
|
|
10
|
+
* (tools registered earlier are not wrapped).
|
|
11
|
+
*/
|
|
12
|
+
interface WebMcpTool {
|
|
13
|
+
name: string;
|
|
14
|
+
execute?: (...args: unknown[]) => unknown;
|
|
15
|
+
[k: string]: unknown;
|
|
16
|
+
}
|
|
17
|
+
/** A copy of `tool` whose execute reports to `onCall`; anything else on the tool is kept as-is. */
|
|
18
|
+
declare function wrapTool(tool: WebMcpTool, onCall: (name: string, ok: boolean, ms: number) => void): WebMcpTool;
|
|
19
|
+
declare const webmcp: Module;
|
|
20
|
+
|
|
21
|
+
export { type WebMcpTool, webmcp, wrapTool };
|
package/dist/webmcp.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var l="lc_agent_session",p=Symbol.for("lucida.webmcp.wrapped"),f=e=>e,d=200;function m(e,t){let r=e.execute;if(typeof r!="function"||f(r)[p])return e;let a=String(e.name??"").slice(0,d),u=function(...c){let i=performance.now(),n=s=>t(a,s,Math.round(performance.now()-i)),o;try{o=r.apply(this,c)}catch(s){throw n(!1),s}return o&&typeof o.then=="function"?o.then(()=>n(!0),()=>n(!1)):n(!0),o};return f(u)[p]=!0,{...e,execute:u}}var g=e=>{let t=navigator.modelContext;if(!t)return;let{core:r}=e,a=()=>{try{return r.storage.get(l)??null}catch{return null}};e.eventExtras.push(n=>a()===n?{$agent_session:!0}:{});let u=(n,o,s)=>{try{r.storage.set(l,r.sessionId)}catch{}e.client.capture("$agent_action",{tool:n,status:o?"ok":"error",duration_ms:s,$agent_session:!0,$agent_protocol:"webmcp"})},{provideContext:c,registerTool:i}=t;return typeof c=="function"&&(t.provideContext=function(n){let o=n?.tools,s=Array.isArray(o)?o.map(w=>m(w,u)):o;return c.call(this,{...n,tools:s})}),typeof i=="function"&&(t.registerTool=function(n){return i.call(this,n&&typeof n=="object"?m(n,u):n)}),()=>{c&&(t.provideContext=c),i&&(t.registerTool=i)}};export{g as webmcp,m as wrapTool};
|
package/package.json
CHANGED
|
@@ -1,6 +1,107 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lucida-analytics/browser",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/lucidaanalytics/lucida-js.git",
|
|
8
|
+
"directory": "packages/browser"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/lucidaanalytics/lucida-js/tree/main/packages/browser",
|
|
11
|
+
"bugs": "https://github.com/lucidaanalytics/lucida-js/issues",
|
|
12
|
+
"type": "module",
|
|
13
|
+
"sideEffects": false,
|
|
14
|
+
"main": "./dist/index.js",
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"default": "./dist/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./core": {
|
|
22
|
+
"types": "./dist/core.d.ts",
|
|
23
|
+
"default": "./dist/core.js"
|
|
24
|
+
},
|
|
25
|
+
"./autocapture": {
|
|
26
|
+
"types": "./dist/autocapture.d.ts",
|
|
27
|
+
"default": "./dist/autocapture.js"
|
|
28
|
+
},
|
|
29
|
+
"./flags": {
|
|
30
|
+
"types": "./dist/flags.d.ts",
|
|
31
|
+
"default": "./dist/flags.js"
|
|
32
|
+
},
|
|
33
|
+
"./heatmaps": {
|
|
34
|
+
"types": "./dist/heatmaps.d.ts",
|
|
35
|
+
"default": "./dist/heatmaps.js"
|
|
36
|
+
},
|
|
37
|
+
"./forms": {
|
|
38
|
+
"types": "./dist/forms.d.ts",
|
|
39
|
+
"default": "./dist/forms.js"
|
|
40
|
+
},
|
|
41
|
+
"./toolbar": {
|
|
42
|
+
"types": "./dist/toolbar.d.ts",
|
|
43
|
+
"default": "./dist/toolbar.js"
|
|
44
|
+
},
|
|
45
|
+
"./inspector": {
|
|
46
|
+
"types": "./dist/inspector.d.ts",
|
|
47
|
+
"default": "./dist/inspector.js"
|
|
48
|
+
},
|
|
49
|
+
"./consent": {
|
|
50
|
+
"types": "./dist/consent.d.ts",
|
|
51
|
+
"default": "./dist/consent.js"
|
|
52
|
+
},
|
|
53
|
+
"./correlate": {
|
|
54
|
+
"types": "./dist/correlate.d.ts",
|
|
55
|
+
"default": "./dist/correlate.js"
|
|
56
|
+
},
|
|
57
|
+
"./host-headers": {
|
|
58
|
+
"types": "./dist/host-headers.d.ts",
|
|
59
|
+
"default": "./dist/host-headers.js"
|
|
60
|
+
},
|
|
61
|
+
"./replay": {
|
|
62
|
+
"types": "./dist/replay.d.ts",
|
|
63
|
+
"default": "./dist/replay.js"
|
|
64
|
+
},
|
|
65
|
+
"./guides": {
|
|
66
|
+
"types": "./dist/guides.d.ts",
|
|
67
|
+
"default": "./dist/guides.js"
|
|
68
|
+
},
|
|
69
|
+
"./experiments": {
|
|
70
|
+
"types": "./dist/experiments.d.ts",
|
|
71
|
+
"default": "./dist/experiments.js"
|
|
72
|
+
},
|
|
73
|
+
"./early-access": {
|
|
74
|
+
"types": "./dist/early-access.d.ts",
|
|
75
|
+
"default": "./dist/early-access.js"
|
|
76
|
+
},
|
|
77
|
+
"./webmcp": {
|
|
78
|
+
"types": "./dist/webmcp.d.ts",
|
|
79
|
+
"default": "./dist/webmcp.js"
|
|
80
|
+
},
|
|
81
|
+
"./recommendations": {
|
|
82
|
+
"types": "./dist/recommendations.d.ts",
|
|
83
|
+
"default": "./dist/recommendations.js"
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"files": [
|
|
87
|
+
"dist"
|
|
88
|
+
],
|
|
89
|
+
"dependencies": {
|
|
90
|
+
"@rrweb/record": "2.2.0",
|
|
91
|
+
"fflate": "0.8.3",
|
|
92
|
+
"@lucida-analytics/sdk-core": "0.1.0"
|
|
93
|
+
},
|
|
94
|
+
"devDependencies": {
|
|
95
|
+
"@types/node": "^22.0.0",
|
|
96
|
+
"jsdom": "^26.1.0",
|
|
97
|
+
"playwright": "1.64.1",
|
|
98
|
+
"tsup": "^8.5.0"
|
|
99
|
+
},
|
|
100
|
+
"scripts": {
|
|
101
|
+
"build": "rm -rf dist && tsup && node scripts/static-layout.mjs",
|
|
102
|
+
"typecheck": "tsgo --noEmit",
|
|
103
|
+
"test": "vitest run",
|
|
104
|
+
"size": "pnpm build && node scripts/size.mjs",
|
|
105
|
+
"e2e": "pnpm build && vitest run --config vitest.e2e.config.ts"
|
|
106
|
+
}
|
|
6
107
|
}
|