@alpic-ai/insights 0.0.0-dev.g2a0d3d0 → 0.0.0-dev.g2a0f2cf
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/index.d.mts +7 -7
- package/dist/index.mjs +1 -1
- package/dist/react/index.d.mts +5 -5
- package/package.json +11 -10
package/dist/index.d.mts
CHANGED
|
@@ -18,7 +18,7 @@ type McpMiddlewareFn = (request: {
|
|
|
18
18
|
params: Record<string, unknown>;
|
|
19
19
|
}, extra: unknown, next: () => Promise<unknown>) => Promise<unknown> | unknown;
|
|
20
20
|
/** Captures the user's natural-language intent behind each tool call: the LLM fills in `user_intent` from the original user message, which the server has no other way to access. */
|
|
21
|
-
declare function intentMiddleware(options?: IntentMiddlewareOptions): McpMiddlewareFn;
|
|
21
|
+
export declare function intentMiddleware(options?: IntentMiddlewareOptions): McpMiddlewareFn;
|
|
22
22
|
//#endregion
|
|
23
23
|
//#region src/analytics-middleware.d.ts
|
|
24
24
|
interface CaptureOptions {
|
|
@@ -53,7 +53,7 @@ interface AnalyticsMiddlewareOptions {
|
|
|
53
53
|
handler?: (batch: AnalyticsBatch) => Promise<void> | void;
|
|
54
54
|
}
|
|
55
55
|
/** Buffers `extra.analytics.capture(...)` / `identify(...)` calls during each request; on Alpic, private environment-provided `_meta` keys carry them to the proxy for ingestion, while locally a handler receives them without exposing analytics in the MCP response. */
|
|
56
|
-
declare function analyticsMiddleware(options?: AnalyticsMiddlewareOptions): McpMiddlewareFn;
|
|
56
|
+
export declare function analyticsMiddleware(options?: AnalyticsMiddlewareOptions): McpMiddlewareFn;
|
|
57
57
|
//#endregion
|
|
58
58
|
//#region src/feedback-middleware.d.ts
|
|
59
59
|
interface FeedbackData {
|
|
@@ -65,18 +65,18 @@ interface FeedbackMiddlewareOptions {
|
|
|
65
65
|
handler?: (feedback: FeedbackData) => Promise<void> | void;
|
|
66
66
|
}
|
|
67
67
|
/** Injects a `send_feedback` tool at `tools/list` time and short-circuits calls to it at `tools/call` time (the tool has no server-side handler), invoking `options.handler` or attaching the feedback to the response `_meta`. */
|
|
68
|
-
declare function feedbackMiddleware(options?: FeedbackMiddlewareOptions): McpMiddlewareFn;
|
|
68
|
+
export declare function feedbackMiddleware(options?: FeedbackMiddlewareOptions): McpMiddlewareFn;
|
|
69
69
|
//#endregion
|
|
70
70
|
//#region src/capture-feedback.d.ts
|
|
71
71
|
/** Injects a `send_feedback` tool by patching the server's `tools/list` and `tools/call` handlers, surfacing captured feedback via `options.handler` (or via the response `_meta` when `ALPIC_FEEDBACK_META_KEY` is set). */
|
|
72
|
-
declare const captureFeedback: (server: McpServer | Server, options?: FeedbackMiddlewareOptions) => void;
|
|
72
|
+
export declare const captureFeedback: (server: McpServer | Server, options?: FeedbackMiddlewareOptions) => void;
|
|
73
73
|
//#endregion
|
|
74
74
|
//#region src/capture-intents.d.ts
|
|
75
75
|
/** Captures the user's natural-language intent behind each tool call by patching the server's `tools/list` and `tools/call` handlers, surfacing it via `options.handler` (or via the response `_meta` when `ALPIC_INTENT_META_KEY` is set). */
|
|
76
|
-
declare const captureIntents: (server: McpServer | Server, options?: IntentMiddlewareOptions) => void;
|
|
76
|
+
export declare const captureIntents: (server: McpServer | Server, options?: IntentMiddlewareOptions) => void;
|
|
77
77
|
//#endregion
|
|
78
78
|
//#region src/track.d.ts
|
|
79
79
|
/** Enables custom analytics events by patching the server's `tools/call` handlers so tool handlers can call `extra.analytics.capture(...)` / `identify(...)`; pass `options.handler` to receive analytics when running outside Alpic. */
|
|
80
|
-
declare const track: (server: McpServer | Server, options?: AnalyticsMiddlewareOptions) => void;
|
|
80
|
+
export declare const track: (server: McpServer | Server, options?: AnalyticsMiddlewareOptions) => void;
|
|
81
81
|
//#endregion
|
|
82
|
-
export {
|
|
82
|
+
export type { Analytics, AnalyticsBatch, AnalyticsEvent, AnalyticsExtra, AnalyticsMiddlewareOptions, CaptureOptions, FeedbackData, FeedbackMiddlewareOptions, IntentMiddlewareOptions, McpMiddlewareFn, PromptData };
|
package/dist/index.mjs
CHANGED
package/dist/react/index.d.mts
CHANGED
|
@@ -40,13 +40,13 @@ interface AlpicAnalyticsProps {
|
|
|
40
40
|
autoCapture?: AutoCaptureOptions;
|
|
41
41
|
}
|
|
42
42
|
/** Provides Alpic Analytics to descendant components, configuring itself from the widget host; events captured before configuration is available are buffered automatically. */
|
|
43
|
-
declare function AlpicAnalytics({ children, beforeSend, autoCapture }: AlpicAnalyticsProps): import("react").JSX.Element;
|
|
43
|
+
export declare function AlpicAnalytics({ children, beforeSend, autoCapture }: AlpicAnalyticsProps): import("react").JSX.Element;
|
|
44
44
|
/** Returns the analytics client from the nearest `AlpicAnalytics` provider. */
|
|
45
|
-
declare function useAnalytics(): Analytics;
|
|
45
|
+
export declare function useAnalytics(): Analytics;
|
|
46
46
|
//#endregion
|
|
47
47
|
//#region src/react/auto-capture.d.ts
|
|
48
48
|
/** The `$` prefix marks events emitted by the SDK itself so the analytics UI can distinguish them from custom `capture()` calls; keep in sync with the server-side reserved namespace. */
|
|
49
|
-
declare const AUTO_EVENT: {
|
|
49
|
+
export declare const AUTO_EVENT: {
|
|
50
50
|
readonly loaded: "$loaded";
|
|
51
51
|
readonly visible: "$visible";
|
|
52
52
|
readonly hidden: "$hidden";
|
|
@@ -54,6 +54,6 @@ declare const AUTO_EVENT: {
|
|
|
54
54
|
readonly error: "$error";
|
|
55
55
|
};
|
|
56
56
|
/** Public DOM contract for declarative interaction capture: the attribute value is the event name. */
|
|
57
|
-
declare const INTERACTION_ATTRIBUTE = "data-alpic-event";
|
|
57
|
+
export declare const INTERACTION_ATTRIBUTE = "data-alpic-event";
|
|
58
58
|
//#endregion
|
|
59
|
-
export {
|
|
59
|
+
export type { AlpicAnalyticsProps, Analytics, AutoCaptureOptions, BeforeSend, CaptureOptions };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alpic-ai/insights",
|
|
3
|
-
"version": "0.0.0-dev.
|
|
3
|
+
"version": "0.0.0-dev.g2a0f2cf",
|
|
4
4
|
"description": "User insights middlewares for Alpic-hosted MCP servers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.mjs",
|
|
@@ -21,9 +21,8 @@
|
|
|
21
21
|
"author": "Alpic",
|
|
22
22
|
"license": "ISC",
|
|
23
23
|
"peerDependencies": {
|
|
24
|
-
"@modelcontextprotocol/sdk": ">=1.29.0 <2",
|
|
25
24
|
"react": ">=18.0.0",
|
|
26
|
-
"skybridge": "^0.36.3 || ^1.0.0"
|
|
25
|
+
"skybridge": "^0.36.3 || ^1.0.0 || ^2.0.0-beta.0"
|
|
27
26
|
},
|
|
28
27
|
"peerDependenciesMeta": {
|
|
29
28
|
"react": {
|
|
@@ -33,10 +32,12 @@
|
|
|
33
32
|
"optional": true
|
|
34
33
|
}
|
|
35
34
|
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@modelcontextprotocol/sdk": "^1.30.0"
|
|
37
|
+
},
|
|
36
38
|
"devDependencies": {
|
|
37
|
-
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
38
39
|
"@testing-library/dom": "^10.4.1",
|
|
39
|
-
"@testing-library/react": "^16.3.
|
|
40
|
+
"@testing-library/react": "^16.3.3",
|
|
40
41
|
"@total-typescript/tsconfig": "^1.0.4",
|
|
41
42
|
"@types/node": "^25.9.5",
|
|
42
43
|
"@types/react": "19.2.18",
|
|
@@ -44,11 +45,11 @@
|
|
|
44
45
|
"react": "^19.2.8",
|
|
45
46
|
"react-dom": "^19.2.8",
|
|
46
47
|
"shx": "^0.4.0",
|
|
47
|
-
"skybridge": "^
|
|
48
|
-
"tsdown": "^0.
|
|
48
|
+
"skybridge": "^2.0.0",
|
|
49
|
+
"tsdown": "^0.23.0",
|
|
49
50
|
"typescript": "^6.0.3",
|
|
50
|
-
"vitest": "^
|
|
51
|
-
"zod": "^4.4
|
|
51
|
+
"vitest": "^5.0.0",
|
|
52
|
+
"zod": "^4.5.4"
|
|
52
53
|
},
|
|
53
54
|
"scripts": {
|
|
54
55
|
"build": "shx rm -rf dist && tsdown",
|
|
@@ -61,6 +62,6 @@
|
|
|
61
62
|
"test:unit": "vitest run",
|
|
62
63
|
"test:format": "biome check --error-on-warnings .",
|
|
63
64
|
"test:type": "tsgo --noEmit",
|
|
64
|
-
"publish:npm": "
|
|
65
|
+
"publish:npm": "../../scripts/publish-if-new.sh"
|
|
65
66
|
}
|
|
66
67
|
}
|