@sentientui/core 0.25.0 → 0.27.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/dist/chunk-TRBPPGFT.mjs +2 -0
- package/dist/chunk-TRBPPGFT.mjs.map +1 -0
- package/dist/{index-BjVvN7cU.d.ts → index-B5b5LlRJ.d.cts} +42 -215
- package/dist/{index-Cd0gMdJv.d.cts → index-NqZbPgmm.d.ts} +42 -215
- package/dist/index-engagement.js +1 -1
- package/dist/index-engagement.js.map +1 -1
- package/dist/index-engagement.mjs +1 -1
- package/dist/index-graph.d.cts +4 -3
- package/dist/index-graph.d.ts +4 -3
- package/dist/index-graph.js +1 -1
- package/dist/index-graph.js.map +1 -1
- package/dist/index-graph.mjs +1 -1
- package/dist/index-graph.mjs.map +1 -1
- package/dist/index-local.d.cts +2 -2
- package/dist/index-local.d.ts +2 -2
- package/dist/index-server.d.cts +9 -2
- package/dist/index-server.d.ts +9 -2
- package/dist/index-server.js +1 -1
- package/dist/index-server.js.map +1 -1
- package/dist/index-server.mjs +1 -1
- package/dist/index-server.mjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/session-meta-dN92q19_.d.cts +378 -0
- package/dist/session-meta-dN92q19_.d.ts +378 -0
- package/llms.txt +4 -0
- package/package.json +1 -1
- package/dist/chunk-RL5B6M4G.mjs +0 -2
- package/dist/chunk-RL5B6M4G.mjs.map +0 -1
- package/dist/session-meta-C-bMqVeq.d.cts +0 -130
- package/dist/session-meta-C-bMqVeq.d.ts +0 -130
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import { SlotResult, SlotDecl } from '@sentientui/policy';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Slot declaration helpers shared by the browser client (decide) and the
|
|
5
|
-
* server preload path. Pure wrappers over @sentientui/policy.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/** SDK-facing slot declaration. `dims` accepts readonly arrays (`as const`). */
|
|
9
|
-
type SlotDeclInput = {
|
|
10
|
-
id: string;
|
|
11
|
-
arms?: string[];
|
|
12
|
-
dims?: Record<string, readonly string[]>;
|
|
13
|
-
baseline?: string | Record<string, string>;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Whitelists the wire fields of a slot declaration. Anything an SDK layer
|
|
18
|
-
* attached (goal configs, refs, …) is stripped so it never reaches the zod
|
|
19
|
-
* schema on the API. Also normalizes readonly arrays to mutable ones.
|
|
20
|
-
*/
|
|
21
|
-
declare function toWireSlot(d: SlotDeclInput): SlotDecl;
|
|
22
|
-
/** The declared (or default first-declared) baseline result for a slot. */
|
|
23
|
-
declare function baselineResultFor(d: SlotDeclInput): SlotResult;
|
|
24
|
-
/** Baseline results for a whole declaration list, keyed by slot id. */
|
|
25
|
-
declare function baselineSlots(decls: SlotDeclInput[]): Record<string, SlotResult>;
|
|
26
|
-
/**
|
|
27
|
-
* Canonical arm string of a slot result: dims results encode as sorted
|
|
28
|
-
* `dim=value` pairs joined with '|'; arms results are the arm id verbatim.
|
|
29
|
-
*/
|
|
30
|
-
declare function armOfResult(result: SlotResult): string;
|
|
31
|
-
|
|
32
|
-
/** Session metadata helpers (browser + Node). No DOM APIs. */
|
|
33
|
-
/**
|
|
34
|
-
* Known AI-agent / crawler user-agent tokens. Matched case-insensitively as
|
|
35
|
-
* substrings. This is maintained data — bot lists move monthly. Used both to
|
|
36
|
-
* flag automation on sessions (agentic browsers that leak a token) and by the
|
|
37
|
-
* server middleware / agent-feed route to identify crawler HTTP reads.
|
|
38
|
-
*/
|
|
39
|
-
declare const agentUaList: readonly string[];
|
|
40
|
-
/** True when the user-agent contains a known AI-agent / crawler token. */
|
|
41
|
-
declare function uaTokenMatch(userAgent: string): boolean;
|
|
42
|
-
/** The first known agent token found in the user-agent, or null. */
|
|
43
|
-
declare function matchedAgentToken(userAgent: string): string | null;
|
|
44
|
-
/**
|
|
45
|
-
* Purpose category for an agent fetch, inferred from its published user-agent:
|
|
46
|
-
* - `user` — a person asked an assistant to read the page, live (…-User UAs)
|
|
47
|
-
* - `search` — indexing for an AI answer engine (…-SearchBot / SearchBot)
|
|
48
|
-
* - `training` — model-training crawl (GPTBot, ClaudeBot, CCBot, …)
|
|
49
|
-
* - `other` — not clearly AI, or an unknown/new token
|
|
50
|
-
*/
|
|
51
|
-
type AgentIntent = 'user' | 'search' | 'training' | 'other';
|
|
52
|
-
/** Intent per agent token. Maintained beside `agentUaList` — when you add or
|
|
53
|
-
* rename a token above, set its intent here (a unit test enforces coverage). */
|
|
54
|
-
declare const AGENT_INTENTS: Record<string, AgentIntent>;
|
|
55
|
-
/** Intent for a matched bot token (case-insensitive); `other` for null/unknown. */
|
|
56
|
-
declare function agentIntent(botName: string | null): AgentIntent;
|
|
57
|
-
/** `agentUaList` grouped by intent — the "which crawlers do you classify?" reference. */
|
|
58
|
-
declare function classifiedAgents(): Record<AgentIntent, string[]>;
|
|
59
|
-
declare function detectDeviceClass(userAgent: string): string;
|
|
60
|
-
declare function detectTrafficSource(referrer: string, appOrigin?: string): string;
|
|
61
|
-
declare function referrerDomainFromReferer(referrer: string): string | null;
|
|
62
|
-
/**
|
|
63
|
-
* Ad-platform click-ID query params worth keeping. An ALLOWLIST, unlike the
|
|
64
|
-
* `utm_` prefix match: unknown query keys here are unbounded-cardinality junk
|
|
65
|
-
* (session tokens, cache busters) that would bloat the sessions table, so only
|
|
66
|
-
* the IDs the major ad platforms actually append survive.
|
|
67
|
-
*
|
|
68
|
-
* gclid / gbraid / wbraid — Google Ads auto-tagging (search, YouTube, Display;
|
|
69
|
-
* gbraid/wbraid are the iOS-14 privacy variants)
|
|
70
|
-
* fbclid — Meta (Facebook + Instagram). Appended to EVERY outbound Meta
|
|
71
|
-
* click, paid and organic alike — it identifies the platform, never spend.
|
|
72
|
-
* ttclid — TikTok Ads
|
|
73
|
-
* msclkid — Microsoft Ads (Bing)
|
|
74
|
-
* twclid — X/Twitter Ads
|
|
75
|
-
* li_fat_id — LinkedIn Ads
|
|
76
|
-
*/
|
|
77
|
-
declare const CLICK_ID_KEYS: readonly string[];
|
|
78
|
-
/**
|
|
79
|
-
* Splits a URL query into the attribution params the session upsert carries:
|
|
80
|
-
* every `utm_`-prefixed key, plus allowlisted ad click IDs (CLICK_ID_KEYS).
|
|
81
|
-
* Accepts a raw search string ("?a=b" or "a=b"), a URLSearchParams, or a
|
|
82
|
-
* Next.js `searchParams` object (whose values may be string arrays — the
|
|
83
|
-
* first occurrence wins, matching URLSearchParams iteration order).
|
|
84
|
-
* Node-safe: no DOM APIs.
|
|
85
|
-
*/
|
|
86
|
-
declare function extractTrackedParams(search: string | URLSearchParams | Record<string, string | string[] | undefined>): {
|
|
87
|
-
utmParams: Record<string, string>;
|
|
88
|
-
clickIds: Record<string, string>;
|
|
89
|
-
};
|
|
90
|
-
declare function detectTimeOfDay(d: Date): string;
|
|
91
|
-
type SessionUpsertPayload = {
|
|
92
|
-
sessionId: string;
|
|
93
|
-
ephemeral: boolean;
|
|
94
|
-
utmParams: Record<string, string>;
|
|
95
|
-
/** Allowlisted ad-platform click IDs from the landing URL (CLICK_ID_KEYS). */
|
|
96
|
-
clickIds: Record<string, string>;
|
|
97
|
-
deviceClass: string;
|
|
98
|
-
trafficSource: string;
|
|
99
|
-
referrerDomain: string | null;
|
|
100
|
-
timeOfDay: string;
|
|
101
|
-
dayOfWeek: string;
|
|
102
|
-
/**
|
|
103
|
-
* True when this session is likely driven by automation — either
|
|
104
|
-
* `navigator.webdriver` was set, or the user-agent carried a known agent
|
|
105
|
-
* token. Probabilistic: a flag for metrics + bandit exclusion, never a gate.
|
|
106
|
-
*/
|
|
107
|
-
automation: boolean;
|
|
108
|
-
};
|
|
109
|
-
/** Bandit segment key: `<device_class>:<traffic_source>`. */
|
|
110
|
-
declare function deriveSessionSegment(opts?: {
|
|
111
|
-
userAgent?: string;
|
|
112
|
-
referer?: string;
|
|
113
|
-
appOrigin?: string;
|
|
114
|
-
}): string;
|
|
115
|
-
/**
|
|
116
|
-
* Builds a session upsert body aligned with the browser SDK so SSR assign uses
|
|
117
|
-
* the same segment key (`device:source`) as the client after hydration.
|
|
118
|
-
*/
|
|
119
|
-
declare function buildSessionUpsertPayload(sessionId: string, opts?: {
|
|
120
|
-
userAgent?: string;
|
|
121
|
-
referer?: string;
|
|
122
|
-
appOrigin?: string;
|
|
123
|
-
utmParams?: Record<string, string>;
|
|
124
|
-
clickIds?: Record<string, string>;
|
|
125
|
-
now?: Date;
|
|
126
|
-
/** `navigator.webdriver` value from the browser, when available. */
|
|
127
|
-
webdriver?: boolean;
|
|
128
|
-
}): SessionUpsertPayload;
|
|
129
|
-
|
|
130
|
-
export { AGENT_INTENTS as A, CLICK_ID_KEYS as C, type SessionUpsertPayload as S, type AgentIntent as a, type SlotDeclInput as b, agentIntent as c, agentUaList as d, armOfResult as e, baselineResultFor as f, baselineSlots as g, buildSessionUpsertPayload as h, classifiedAgents as i, deriveSessionSegment as j, detectDeviceClass as k, detectTimeOfDay as l, detectTrafficSource as m, extractTrackedParams as n, matchedAgentToken as o, referrerDomainFromReferer as r, toWireSlot as t, uaTokenMatch as u };
|