mobbdev 1.1.26 → 1.1.27
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.
|
@@ -50,18 +50,26 @@ declare const PromptItemZ: z.ZodObject<{
|
|
|
50
50
|
name: string;
|
|
51
51
|
parameters: string;
|
|
52
52
|
result: string;
|
|
53
|
-
rawArguments?: string | undefined;
|
|
54
53
|
accepted?: boolean | undefined;
|
|
54
|
+
rawArguments?: string | undefined;
|
|
55
55
|
}, {
|
|
56
56
|
name: string;
|
|
57
57
|
parameters: string;
|
|
58
58
|
result: string;
|
|
59
|
-
rawArguments?: string | undefined;
|
|
60
59
|
accepted?: boolean | undefined;
|
|
60
|
+
rawArguments?: string | undefined;
|
|
61
61
|
}>>;
|
|
62
62
|
}, "strip", z.ZodTypeAny, {
|
|
63
63
|
type: "USER_PROMPT" | "AI_RESPONSE" | "TOOL_EXECUTION" | "AI_THINKING";
|
|
64
|
+
tool?: {
|
|
65
|
+
name: string;
|
|
66
|
+
parameters: string;
|
|
67
|
+
result: string;
|
|
68
|
+
accepted?: boolean | undefined;
|
|
69
|
+
rawArguments?: string | undefined;
|
|
70
|
+
} | undefined;
|
|
64
71
|
date?: Date | undefined;
|
|
72
|
+
text?: string | undefined;
|
|
65
73
|
attachedFiles?: {
|
|
66
74
|
relativePath: string;
|
|
67
75
|
startLine?: number | undefined;
|
|
@@ -70,17 +78,17 @@ declare const PromptItemZ: z.ZodObject<{
|
|
|
70
78
|
inputCount: number;
|
|
71
79
|
outputCount: number;
|
|
72
80
|
} | undefined;
|
|
73
|
-
|
|
81
|
+
}, {
|
|
82
|
+
type: "USER_PROMPT" | "AI_RESPONSE" | "TOOL_EXECUTION" | "AI_THINKING";
|
|
74
83
|
tool?: {
|
|
75
84
|
name: string;
|
|
76
85
|
parameters: string;
|
|
77
86
|
result: string;
|
|
78
|
-
rawArguments?: string | undefined;
|
|
79
87
|
accepted?: boolean | undefined;
|
|
88
|
+
rawArguments?: string | undefined;
|
|
80
89
|
} | undefined;
|
|
81
|
-
}, {
|
|
82
|
-
type: "USER_PROMPT" | "AI_RESPONSE" | "TOOL_EXECUTION" | "AI_THINKING";
|
|
83
90
|
date?: Date | undefined;
|
|
91
|
+
text?: string | undefined;
|
|
84
92
|
attachedFiles?: {
|
|
85
93
|
relativePath: string;
|
|
86
94
|
startLine?: number | undefined;
|
|
@@ -89,14 +97,6 @@ declare const PromptItemZ: z.ZodObject<{
|
|
|
89
97
|
inputCount: number;
|
|
90
98
|
outputCount: number;
|
|
91
99
|
} | undefined;
|
|
92
|
-
text?: string | undefined;
|
|
93
|
-
tool?: {
|
|
94
|
-
name: string;
|
|
95
|
-
parameters: string;
|
|
96
|
-
result: string;
|
|
97
|
-
rawArguments?: string | undefined;
|
|
98
|
-
accepted?: boolean | undefined;
|
|
99
|
-
} | undefined;
|
|
100
100
|
}>;
|
|
101
101
|
type PromptItem = z.infer<typeof PromptItemZ>;
|
|
102
102
|
declare const PromptItemArrayZ: z.ZodArray<z.ZodObject<{
|
|
@@ -133,18 +133,26 @@ declare const PromptItemArrayZ: z.ZodArray<z.ZodObject<{
|
|
|
133
133
|
name: string;
|
|
134
134
|
parameters: string;
|
|
135
135
|
result: string;
|
|
136
|
-
rawArguments?: string | undefined;
|
|
137
136
|
accepted?: boolean | undefined;
|
|
137
|
+
rawArguments?: string | undefined;
|
|
138
138
|
}, {
|
|
139
139
|
name: string;
|
|
140
140
|
parameters: string;
|
|
141
141
|
result: string;
|
|
142
|
-
rawArguments?: string | undefined;
|
|
143
142
|
accepted?: boolean | undefined;
|
|
143
|
+
rawArguments?: string | undefined;
|
|
144
144
|
}>>;
|
|
145
145
|
}, "strip", z.ZodTypeAny, {
|
|
146
146
|
type: "USER_PROMPT" | "AI_RESPONSE" | "TOOL_EXECUTION" | "AI_THINKING";
|
|
147
|
+
tool?: {
|
|
148
|
+
name: string;
|
|
149
|
+
parameters: string;
|
|
150
|
+
result: string;
|
|
151
|
+
accepted?: boolean | undefined;
|
|
152
|
+
rawArguments?: string | undefined;
|
|
153
|
+
} | undefined;
|
|
147
154
|
date?: Date | undefined;
|
|
155
|
+
text?: string | undefined;
|
|
148
156
|
attachedFiles?: {
|
|
149
157
|
relativePath: string;
|
|
150
158
|
startLine?: number | undefined;
|
|
@@ -153,17 +161,17 @@ declare const PromptItemArrayZ: z.ZodArray<z.ZodObject<{
|
|
|
153
161
|
inputCount: number;
|
|
154
162
|
outputCount: number;
|
|
155
163
|
} | undefined;
|
|
156
|
-
|
|
164
|
+
}, {
|
|
165
|
+
type: "USER_PROMPT" | "AI_RESPONSE" | "TOOL_EXECUTION" | "AI_THINKING";
|
|
157
166
|
tool?: {
|
|
158
167
|
name: string;
|
|
159
168
|
parameters: string;
|
|
160
169
|
result: string;
|
|
161
|
-
rawArguments?: string | undefined;
|
|
162
170
|
accepted?: boolean | undefined;
|
|
171
|
+
rawArguments?: string | undefined;
|
|
163
172
|
} | undefined;
|
|
164
|
-
}, {
|
|
165
|
-
type: "USER_PROMPT" | "AI_RESPONSE" | "TOOL_EXECUTION" | "AI_THINKING";
|
|
166
173
|
date?: Date | undefined;
|
|
174
|
+
text?: string | undefined;
|
|
167
175
|
attachedFiles?: {
|
|
168
176
|
relativePath: string;
|
|
169
177
|
startLine?: number | undefined;
|
|
@@ -172,14 +180,6 @@ declare const PromptItemArrayZ: z.ZodArray<z.ZodObject<{
|
|
|
172
180
|
inputCount: number;
|
|
173
181
|
outputCount: number;
|
|
174
182
|
} | undefined;
|
|
175
|
-
text?: string | undefined;
|
|
176
|
-
tool?: {
|
|
177
|
-
name: string;
|
|
178
|
-
parameters: string;
|
|
179
|
-
result: string;
|
|
180
|
-
rawArguments?: string | undefined;
|
|
181
|
-
accepted?: boolean | undefined;
|
|
182
|
-
} | undefined;
|
|
183
183
|
}>, "many">;
|
|
184
184
|
type PromptItemArray = z.infer<typeof PromptItemArrayZ>;
|
|
185
185
|
type UploadAiBlameOptions = {
|
|
@@ -5100,6 +5100,18 @@ var GQLClient = class {
|
|
|
5100
5100
|
}
|
|
5101
5101
|
};
|
|
5102
5102
|
|
|
5103
|
+
// src/mcp/services/types.ts
|
|
5104
|
+
function buildLoginUrl(baseUrl, loginId, hostname2, context) {
|
|
5105
|
+
const url = new URL(`${baseUrl}/${loginId}`);
|
|
5106
|
+
url.searchParams.set("hostname", hostname2);
|
|
5107
|
+
url.searchParams.set("trigger", context.trigger);
|
|
5108
|
+
url.searchParams.set("source", context.source);
|
|
5109
|
+
if (context.ide) {
|
|
5110
|
+
url.searchParams.set("ide", context.ide);
|
|
5111
|
+
}
|
|
5112
|
+
return url.toString();
|
|
5113
|
+
}
|
|
5114
|
+
|
|
5103
5115
|
// src/utils/ConfigStoreService.ts
|
|
5104
5116
|
import Configstore from "configstore";
|
|
5105
5117
|
function createConfigStore(defaultValues = { apiToken: "" }) {
|
|
@@ -5150,7 +5162,8 @@ async function handleMobbLogin({
|
|
|
5150
5162
|
apiKey,
|
|
5151
5163
|
skipPrompts,
|
|
5152
5164
|
apiUrl,
|
|
5153
|
-
webAppUrl
|
|
5165
|
+
webAppUrl,
|
|
5166
|
+
loginContext
|
|
5154
5167
|
}) {
|
|
5155
5168
|
const resolvedWebAppUrl = webAppUrl || WEB_APP_URL;
|
|
5156
5169
|
const resolvedApiUrl = apiUrl || API_URL;
|
|
@@ -5195,7 +5208,8 @@ async function handleMobbLogin({
|
|
|
5195
5208
|
const loginId = await inGqlClient.createCliLogin({
|
|
5196
5209
|
publicKey: publicKey.export({ format: "pem", type: "pkcs1" }).toString()
|
|
5197
5210
|
});
|
|
5198
|
-
const
|
|
5211
|
+
const webLoginUrl = `${resolvedWebAppUrl}/cli-login`;
|
|
5212
|
+
const browserUrl = loginContext ? buildLoginUrl(webLoginUrl, loginId, os.hostname(), loginContext) : `${webLoginUrl}/${loginId}?hostname=${os.hostname()}`;
|
|
5199
5213
|
!skipPrompts && console.log(
|
|
5200
5214
|
`If the page does not open automatically, kindly access it through ${browserUrl}.`
|
|
5201
5215
|
);
|
package/dist/index.mjs
CHANGED
|
@@ -11400,6 +11400,38 @@ var GQLClient = class {
|
|
|
11400
11400
|
}
|
|
11401
11401
|
};
|
|
11402
11402
|
|
|
11403
|
+
// src/mcp/services/types.ts
|
|
11404
|
+
function detectIDE() {
|
|
11405
|
+
const env3 = process.env;
|
|
11406
|
+
if (env3["CURSOR_TRACE_ID"] || env3["CURSOR_SESSION_ID"]) return "cursor";
|
|
11407
|
+
if (env3["WINDSURF_IPC_HOOK"] || env3["WINDSURF_PID"]) return "windsurf";
|
|
11408
|
+
if (env3["CLAUDE_DESKTOP"] || env3["ANTHROPIC_CLAUDE"]) return "claude";
|
|
11409
|
+
if (env3["WEBSTORM_VM_OPTIONS"] || env3["IDEA_VM_OPTIONS"] || env3["JETBRAINS_IDE"])
|
|
11410
|
+
return "webstorm";
|
|
11411
|
+
if (env3["VSCODE_IPC_HOOK"] || env3["VSCODE_PID"]) return "vscode";
|
|
11412
|
+
const termProgram = env3["TERM_PROGRAM"]?.toLowerCase();
|
|
11413
|
+
if (termProgram === "windsurf") return "windsurf";
|
|
11414
|
+
if (termProgram === "vscode") return "vscode";
|
|
11415
|
+
return void 0;
|
|
11416
|
+
}
|
|
11417
|
+
function createMcpLoginContext(trigger) {
|
|
11418
|
+
return {
|
|
11419
|
+
trigger,
|
|
11420
|
+
source: "mcp",
|
|
11421
|
+
ide: detectIDE()
|
|
11422
|
+
};
|
|
11423
|
+
}
|
|
11424
|
+
function buildLoginUrl(baseUrl, loginId, hostname2, context) {
|
|
11425
|
+
const url = new URL(`${baseUrl}/${loginId}`);
|
|
11426
|
+
url.searchParams.set("hostname", hostname2);
|
|
11427
|
+
url.searchParams.set("trigger", context.trigger);
|
|
11428
|
+
url.searchParams.set("source", context.source);
|
|
11429
|
+
if (context.ide) {
|
|
11430
|
+
url.searchParams.set("ide", context.ide);
|
|
11431
|
+
}
|
|
11432
|
+
return url.toString();
|
|
11433
|
+
}
|
|
11434
|
+
|
|
11403
11435
|
// src/utils/ConfigStoreService.ts
|
|
11404
11436
|
import Configstore from "configstore";
|
|
11405
11437
|
function createConfigStore(defaultValues = { apiToken: "" }) {
|
|
@@ -11450,7 +11482,8 @@ async function handleMobbLogin({
|
|
|
11450
11482
|
apiKey,
|
|
11451
11483
|
skipPrompts,
|
|
11452
11484
|
apiUrl,
|
|
11453
|
-
webAppUrl
|
|
11485
|
+
webAppUrl,
|
|
11486
|
+
loginContext
|
|
11454
11487
|
}) {
|
|
11455
11488
|
const resolvedWebAppUrl = webAppUrl || WEB_APP_URL;
|
|
11456
11489
|
const resolvedApiUrl = apiUrl || API_URL;
|
|
@@ -11495,7 +11528,8 @@ async function handleMobbLogin({
|
|
|
11495
11528
|
const loginId = await inGqlClient.createCliLogin({
|
|
11496
11529
|
publicKey: publicKey.export({ format: "pem", type: "pkcs1" }).toString()
|
|
11497
11530
|
});
|
|
11498
|
-
const
|
|
11531
|
+
const webLoginUrl = `${resolvedWebAppUrl}/cli-login`;
|
|
11532
|
+
const browserUrl = loginContext ? buildLoginUrl(webLoginUrl, loginId, os.hostname(), loginContext) : `${webLoginUrl}/${loginId}?hostname=${os.hostname()}`;
|
|
11499
11533
|
!skipPrompts && console.log(
|
|
11500
11534
|
`If the page does not open automatically, kindly access it through ${browserUrl}.`
|
|
11501
11535
|
);
|
|
@@ -14263,7 +14297,8 @@ async function processAndUploadHookData() {
|
|
|
14263
14297
|
model: result.tracePayload.model,
|
|
14264
14298
|
tool: result.tracePayload.tool,
|
|
14265
14299
|
responseTime: result.tracePayload.responseTime,
|
|
14266
|
-
blameType: "CHAT" /* Chat
|
|
14300
|
+
blameType: "CHAT" /* Chat */,
|
|
14301
|
+
sessionId: result.hookData.session_id
|
|
14267
14302
|
});
|
|
14268
14303
|
uploadSuccess = true;
|
|
14269
14304
|
} catch (error) {
|
|
@@ -14776,9 +14811,10 @@ var McpAuthService = class {
|
|
|
14776
14811
|
/**
|
|
14777
14812
|
* Handles the complete authentication flow
|
|
14778
14813
|
* @param isBackgoundCall Whether this is called from tools context
|
|
14814
|
+
* @param loginContext Context information about who triggered the login
|
|
14779
14815
|
* @returns Authenticated API token
|
|
14780
14816
|
*/
|
|
14781
|
-
async authenticate(isBackgoundCall = false) {
|
|
14817
|
+
async authenticate(isBackgoundCall = false, loginContext) {
|
|
14782
14818
|
const { publicKey, privateKey } = crypto2.generateKeyPairSync("rsa", {
|
|
14783
14819
|
modulusLength: 2048
|
|
14784
14820
|
});
|
|
@@ -14791,7 +14827,7 @@ var McpAuthService = class {
|
|
|
14791
14827
|
}
|
|
14792
14828
|
logDebug(`cli login created ${loginId}`);
|
|
14793
14829
|
const webLoginUrl = `${WEB_APP_URL}/mvs-login`;
|
|
14794
|
-
const browserUrl = `${webLoginUrl}/${loginId}?hostname=${os4.hostname()}`;
|
|
14830
|
+
const browserUrl = loginContext ? buildLoginUrl(webLoginUrl, loginId, os4.hostname(), loginContext) : `${webLoginUrl}/${loginId}?hostname=${os4.hostname()}`;
|
|
14795
14831
|
await this.openBrowser(browserUrl, isBackgoundCall);
|
|
14796
14832
|
logDebug(`waiting for login to complete`);
|
|
14797
14833
|
let newApiToken = null;
|
|
@@ -15465,7 +15501,8 @@ var McpGQLClient = class {
|
|
|
15465
15501
|
}
|
|
15466
15502
|
};
|
|
15467
15503
|
async function createAuthenticatedMcpGQLClient({
|
|
15468
|
-
isBackgroundCall = false
|
|
15504
|
+
isBackgroundCall = false,
|
|
15505
|
+
loginContext
|
|
15469
15506
|
} = {}) {
|
|
15470
15507
|
logDebug("[GraphQL] Getting config", {
|
|
15471
15508
|
apiToken: configStore.get("apiToken")
|
|
@@ -15486,7 +15523,10 @@ async function createAuthenticatedMcpGQLClient({
|
|
|
15486
15523
|
return initialClient;
|
|
15487
15524
|
}
|
|
15488
15525
|
const authService = new McpAuthService(initialClient);
|
|
15489
|
-
const newApiToken = await authService.authenticate(
|
|
15526
|
+
const newApiToken = await authService.authenticate(
|
|
15527
|
+
isBackgroundCall,
|
|
15528
|
+
loginContext
|
|
15529
|
+
);
|
|
15490
15530
|
configStore.set("apiToken", newApiToken);
|
|
15491
15531
|
return new McpGQLClient({ apiKey: newApiToken, type: "apiKey" });
|
|
15492
15532
|
}
|
|
@@ -18430,7 +18470,10 @@ var BaseTool = class {
|
|
|
18430
18470
|
async execute(args) {
|
|
18431
18471
|
if (this.hasAuthentication) {
|
|
18432
18472
|
logDebug(`Authenticating tool: ${this.name}`, { args });
|
|
18433
|
-
const
|
|
18473
|
+
const loginContext = createMcpLoginContext(this.name);
|
|
18474
|
+
const mcpGqlClient = await createAuthenticatedMcpGQLClient({
|
|
18475
|
+
loginContext
|
|
18476
|
+
});
|
|
18434
18477
|
const userInfo2 = await mcpGqlClient.getUserInfo();
|
|
18435
18478
|
logDebug("User authenticated successfully", { userInfo: userInfo2 });
|
|
18436
18479
|
}
|
|
@@ -21664,7 +21707,8 @@ var _CheckForNewAvailableFixesService = class _CheckForNewAvailableFixesService
|
|
|
21664
21707
|
logInfo(`[${scanContext}] Reset service state for new path`, { path: path22 });
|
|
21665
21708
|
}
|
|
21666
21709
|
try {
|
|
21667
|
-
|
|
21710
|
+
const loginContext = createMcpLoginContext("check_new_fixes");
|
|
21711
|
+
this.gqlClient = await createAuthenticatedMcpGQLClient({ loginContext });
|
|
21668
21712
|
} catch (error) {
|
|
21669
21713
|
const errorMessage = error.message;
|
|
21670
21714
|
if (errorMessage.includes("Authentication failed") || errorMessage.includes("access-denied") || errorMessage.includes("Authentication hook unauthorized")) {
|
|
@@ -21916,7 +21960,8 @@ var _FetchAvailableFixesService = class _FetchAvailableFixesService {
|
|
|
21916
21960
|
}
|
|
21917
21961
|
async initializeGqlClient() {
|
|
21918
21962
|
if (!this.gqlClient) {
|
|
21919
|
-
|
|
21963
|
+
const loginContext = createMcpLoginContext("fetch_fixes");
|
|
21964
|
+
this.gqlClient = await createAuthenticatedMcpGQLClient({ loginContext });
|
|
21920
21965
|
}
|
|
21921
21966
|
return this.gqlClient;
|
|
21922
21967
|
}
|
|
@@ -22313,7 +22358,8 @@ var _ScanAndFixVulnerabilitiesService = class _ScanAndFixVulnerabilitiesService
|
|
|
22313
22358
|
}
|
|
22314
22359
|
}
|
|
22315
22360
|
async initializeGqlClient() {
|
|
22316
|
-
const
|
|
22361
|
+
const loginContext = createMcpLoginContext("scan_vulnerabilities");
|
|
22362
|
+
const gqlClient = await createAuthenticatedMcpGQLClient({ loginContext });
|
|
22317
22363
|
const isConnected = await gqlClient.verifyApiConnection();
|
|
22318
22364
|
if (!isConnected) {
|
|
22319
22365
|
throw new ApiConnectionError(
|