@alpic-ai/insights 0.0.0-dev.81296d9 → 0.0.0-dev.81b0876

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 CHANGED
@@ -9,13 +9,13 @@ interface PromptData {
9
9
  interface UserPromptMiddlewareOptions {
10
10
  handler?: (prompt: PromptData) => Promise<void> | void;
11
11
  /**
12
- * Mapping of tool names to input field names whose values should be captured as the prompt.
12
+ * Mapping of tool names to the name of the input parameter whose value should be captured as the prompt.
13
13
  * This overrides the default behavior of injecting a synthetic `user_prompt` field into the tool's schema.
14
14
  * Use this when the tool already has a parameter (e.g. `query`, `question`) that conveys user intent.
15
15
  * For tools in this mapping, the synthetic `user_prompt` field is not injected into the schema and
16
16
  * the field's value is read straight from the tool call arguments without being stripped.
17
17
  */
18
- promptArgByTool?: Record<string, string>;
18
+ paramNameOverride?: Record<string, string>;
19
19
  }
20
20
  /**
21
21
  * Structurally compatible with `skybridge/server`'s `McpMiddlewareFn` so
package/dist/index.mjs CHANGED
@@ -9,14 +9,14 @@ const USER_PROMPT_FIELD = "user_prompt";
9
9
  */
10
10
  function userPromptMiddleware(options) {
11
11
  const metaKeyName = process.env.ALPIC_PROMPT_META_KEY;
12
- const promptArgByTool = options?.promptArgByTool ?? {};
12
+ const paramNameOverride = options?.paramNameOverride ?? {};
13
13
  return async (request, _extra, next) => {
14
14
  if (request.method === "tools/list") {
15
15
  const rawResult = await next();
16
16
  const parsed = ListToolsResultSchema.safeParse(rawResult);
17
17
  if (!parsed.success) return rawResult;
18
18
  for (const tool of parsed.data.tools) {
19
- if (promptArgByTool[tool.name] != null) continue;
19
+ if (paramNameOverride[tool.name] != null) continue;
20
20
  tool.inputSchema.properties = {
21
21
  ...tool.inputSchema.properties,
22
22
  [USER_PROMPT_FIELD]: {
@@ -30,7 +30,7 @@ function userPromptMiddleware(options) {
30
30
  if (request.method === "tools/call") {
31
31
  const parsedRequest = CallToolRequestSchema.safeParse(request);
32
32
  if (!parsedRequest.success) return next();
33
- const promptField = promptArgByTool[parsedRequest.data.params.name] ?? USER_PROMPT_FIELD;
33
+ const promptField = paramNameOverride[parsedRequest.data.params.name] ?? USER_PROMPT_FIELD;
34
34
  const args = parsedRequest.data.params.arguments ?? {};
35
35
  const userPrompt = typeof args[promptField] === "string" ? args[promptField] : void 0;
36
36
  const hasUserPrompt = userPrompt != null && userPrompt.length > 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alpic-ai/insights",
3
- "version": "0.0.0-dev.81296d9",
3
+ "version": "0.0.0-dev.81b0876",
4
4
  "description": "User insights middlewares for Alpic-hosted MCP servers",
5
5
  "type": "module",
6
6
  "main": "./dist/index.mjs",
@@ -18,7 +18,7 @@
18
18
  "license": "ISC",
19
19
  "peerDependencies": {
20
20
  "@modelcontextprotocol/sdk": ">=1.29.0 <2",
21
- "skybridge": ">=0.35.21"
21
+ "skybridge": ">=0.36.2"
22
22
  },
23
23
  "peerDependenciesMeta": {
24
24
  "skybridge": {
@@ -28,13 +28,13 @@
28
28
  "devDependencies": {
29
29
  "@modelcontextprotocol/sdk": "^1.29.0",
30
30
  "@total-typescript/tsconfig": "^1.0.4",
31
- "@types/node": "^25.6.0",
31
+ "@types/node": "^25.6.2",
32
32
  "shx": "^0.4.0",
33
- "skybridge": "^0.35.21",
34
- "tsdown": "^0.21.10",
33
+ "skybridge": "^0.36.2",
34
+ "tsdown": "^0.22.0",
35
35
  "typescript": "^6.0.3",
36
36
  "vitest": "^4.1.5",
37
- "zod": "^4.4.1"
37
+ "zod": "^4.4.3"
38
38
  },
39
39
  "scripts": {
40
40
  "build": "shx rm -rf dist && tsdown",