mobbdev 1.1.13 → 1.1.16
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/args/commands/upload_ai_blame.mjs +224 -132
- package/dist/index.mjs +384 -155
- package/package.json +2 -3
|
@@ -100,7 +100,7 @@ import z26 from "zod";
|
|
|
100
100
|
import crypto from "crypto";
|
|
101
101
|
import os from "os";
|
|
102
102
|
import chalk2 from "chalk";
|
|
103
|
-
import
|
|
103
|
+
import Debug6 from "debug";
|
|
104
104
|
import open from "open";
|
|
105
105
|
|
|
106
106
|
// src/constants.ts
|
|
@@ -333,6 +333,7 @@ var IssueType_Enum = /* @__PURE__ */ ((IssueType_Enum2) => {
|
|
|
333
333
|
var Pr_Status_Enum = /* @__PURE__ */ ((Pr_Status_Enum2) => {
|
|
334
334
|
Pr_Status_Enum2["Active"] = "ACTIVE";
|
|
335
335
|
Pr_Status_Enum2["Closed"] = "CLOSED";
|
|
336
|
+
Pr_Status_Enum2["Draft"] = "DRAFT";
|
|
336
337
|
Pr_Status_Enum2["Merged"] = "MERGED";
|
|
337
338
|
return Pr_Status_Enum2;
|
|
338
339
|
})(Pr_Status_Enum || {});
|
|
@@ -815,6 +816,57 @@ var UploadS3BucketInfoDocument = `
|
|
|
815
816
|
}
|
|
816
817
|
}
|
|
817
818
|
`;
|
|
819
|
+
var AnalyzeCommitForExtensionAiBlameDocument = `
|
|
820
|
+
mutation AnalyzeCommitForExtensionAIBlame($repositoryURL: String!, $commitSha: String!, $organizationId: String!) {
|
|
821
|
+
analyzeCommitForAIBlame(
|
|
822
|
+
repositoryURL: $repositoryURL
|
|
823
|
+
commitSha: $commitSha
|
|
824
|
+
organizationId: $organizationId
|
|
825
|
+
) {
|
|
826
|
+
__typename
|
|
827
|
+
... on ProcessAIBlameFinalResult {
|
|
828
|
+
status
|
|
829
|
+
inferencesProcessed
|
|
830
|
+
attributionsCreated
|
|
831
|
+
attributions {
|
|
832
|
+
id
|
|
833
|
+
aiBlameCommitId
|
|
834
|
+
aiBlameInferenceId
|
|
835
|
+
filePath
|
|
836
|
+
lineNumber
|
|
837
|
+
model
|
|
838
|
+
toolName
|
|
839
|
+
commitSha
|
|
840
|
+
inferenceType
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
... on ProcessAIBlameErrorResult {
|
|
844
|
+
status
|
|
845
|
+
error
|
|
846
|
+
}
|
|
847
|
+
... on ProcessAIBlameRequestedResult {
|
|
848
|
+
status
|
|
849
|
+
requestIds
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
`;
|
|
854
|
+
var GetAiBlameInferenceDocument = `
|
|
855
|
+
query GetAIBlameInference($aiBlameInferenceIds: [uuid!]) {
|
|
856
|
+
ai_blame_inference(where: {id: {_in: $aiBlameInferenceIds}}) {
|
|
857
|
+
id
|
|
858
|
+
type
|
|
859
|
+
aiResponseAt
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
`;
|
|
863
|
+
var GetAiBlameAttributionPromptDocument = `
|
|
864
|
+
query GetAIBlameAttributionPrompt($aiBlameAttributionId: String!) {
|
|
865
|
+
getAIBlameInferenceData(aiBlameAttributionId: $aiBlameAttributionId) {
|
|
866
|
+
promptUrl
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
`;
|
|
818
870
|
var UploadAiBlameInferencesInitDocument = `
|
|
819
871
|
mutation UploadAIBlameInferencesInit($sessions: [AIBlameInferenceInitInput!]!) {
|
|
820
872
|
uploadAIBlameInferencesInit(sessions: $sessions) {
|
|
@@ -1108,6 +1160,15 @@ function getSdk(client, withWrapper = defaultWrapper) {
|
|
|
1108
1160
|
uploadS3BucketInfo(variables, requestHeaders, signal) {
|
|
1109
1161
|
return withWrapper((wrappedRequestHeaders) => client.request({ document: UploadS3BucketInfoDocument, variables, requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders }, signal }), "uploadS3BucketInfo", "mutation", variables);
|
|
1110
1162
|
},
|
|
1163
|
+
AnalyzeCommitForExtensionAIBlame(variables, requestHeaders, signal) {
|
|
1164
|
+
return withWrapper((wrappedRequestHeaders) => client.request({ document: AnalyzeCommitForExtensionAiBlameDocument, variables, requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders }, signal }), "AnalyzeCommitForExtensionAIBlame", "mutation", variables);
|
|
1165
|
+
},
|
|
1166
|
+
GetAIBlameInference(variables, requestHeaders, signal) {
|
|
1167
|
+
return withWrapper((wrappedRequestHeaders) => client.request({ document: GetAiBlameInferenceDocument, variables, requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders }, signal }), "GetAIBlameInference", "query", variables);
|
|
1168
|
+
},
|
|
1169
|
+
GetAIBlameAttributionPrompt(variables, requestHeaders, signal) {
|
|
1170
|
+
return withWrapper((wrappedRequestHeaders) => client.request({ document: GetAiBlameAttributionPromptDocument, variables, requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders }, signal }), "GetAIBlameAttributionPrompt", "query", variables);
|
|
1171
|
+
},
|
|
1111
1172
|
UploadAIBlameInferencesInit(variables, requestHeaders, signal) {
|
|
1112
1173
|
return withWrapper((wrappedRequestHeaders) => client.request({ document: UploadAiBlameInferencesInitDocument, variables, requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders }, signal }), "UploadAIBlameInferencesInit", "mutation", variables);
|
|
1113
1174
|
},
|
|
@@ -2170,10 +2231,9 @@ var VUL_REPORT_DIGEST_TIMEOUT_MS = 1e3 * 60 * 30;
|
|
|
2170
2231
|
|
|
2171
2232
|
// src/features/analysis/graphql/gql.ts
|
|
2172
2233
|
import fetchOrig from "cross-fetch";
|
|
2173
|
-
import
|
|
2234
|
+
import Debug5 from "debug";
|
|
2174
2235
|
import { GraphQLClient } from "graphql-request";
|
|
2175
|
-
import {
|
|
2176
|
-
import { HttpsProxyAgent as HttpsProxyAgent2 } from "https-proxy-agent";
|
|
2236
|
+
import { HttpsProxyAgent } from "https-proxy-agent";
|
|
2177
2237
|
import { v4 as uuidv4 } from "uuid";
|
|
2178
2238
|
|
|
2179
2239
|
// src/mcp/core/Errors.ts
|
|
@@ -2285,6 +2345,131 @@ var sleep = (ms = 2e3) => new Promise((r) => setTimeout(r, ms));
|
|
|
2285
2345
|
var CliError = class extends Error {
|
|
2286
2346
|
};
|
|
2287
2347
|
|
|
2348
|
+
// src/utils/subscribe/subscribe.ts
|
|
2349
|
+
import { createClient } from "graphql-ws";
|
|
2350
|
+
import WebsocketNode from "isomorphic-ws";
|
|
2351
|
+
|
|
2352
|
+
// src/utils/subscribe/graphql.ts
|
|
2353
|
+
function getGraphQlHeaders(options) {
|
|
2354
|
+
const headers = {
|
|
2355
|
+
"Content-Type": "application/json"
|
|
2356
|
+
};
|
|
2357
|
+
if ("type" in options) {
|
|
2358
|
+
if (options.type === "apiKey") {
|
|
2359
|
+
headers["x-mobb-key"] = options.apiKey;
|
|
2360
|
+
} else if (options.type === "token") {
|
|
2361
|
+
headers["Authorization"] = `Bearer ${options.token}`;
|
|
2362
|
+
}
|
|
2363
|
+
return headers;
|
|
2364
|
+
}
|
|
2365
|
+
if ("isAdmin" in options && options.isAdmin) {
|
|
2366
|
+
headers["x-hasura-access-key"] = options.adminPassword;
|
|
2367
|
+
} else if ("isApiKey" in options && options.isApiKey) {
|
|
2368
|
+
headers["x-mobb-key"] = options.apiKey;
|
|
2369
|
+
} else if ("accessToken" in options) {
|
|
2370
|
+
headers["Authorization"] = `Bearer ${options.accessToken}`;
|
|
2371
|
+
}
|
|
2372
|
+
return headers;
|
|
2373
|
+
}
|
|
2374
|
+
|
|
2375
|
+
// src/utils/subscribe/subscribe.ts
|
|
2376
|
+
var DEFAULT_API_URL2 = "https://api.mobb.ai/v1/graphql";
|
|
2377
|
+
var SUBSCRIPTION_TIMEOUT_MS = 30 * 60 * 1e3;
|
|
2378
|
+
function createWSClient(options) {
|
|
2379
|
+
const url = options.url || (process.env["API_URL"] || DEFAULT_API_URL2).replace("http", "ws");
|
|
2380
|
+
const websocketImpl = options.websocket || (typeof WebSocket !== "undefined" ? WebSocket : WebsocketNode);
|
|
2381
|
+
const CustomWebSocket = options.proxyAgent ? (
|
|
2382
|
+
// biome-ignore lint/suspicious/noExplicitAny: Dynamic WebSocket extension requires any cast for cross-platform compatibility
|
|
2383
|
+
class extends websocketImpl {
|
|
2384
|
+
constructor(address, protocols) {
|
|
2385
|
+
super(address, protocols, { agent: options.proxyAgent });
|
|
2386
|
+
}
|
|
2387
|
+
}
|
|
2388
|
+
) : websocketImpl;
|
|
2389
|
+
return createClient({
|
|
2390
|
+
//this is needed to prevent AWS from killing the connection
|
|
2391
|
+
//currently our load balancer has a 29s idle timeout
|
|
2392
|
+
keepAlive: 1e4,
|
|
2393
|
+
url,
|
|
2394
|
+
webSocketImpl: CustomWebSocket,
|
|
2395
|
+
connectionParams: () => {
|
|
2396
|
+
return {
|
|
2397
|
+
headers: getGraphQlHeaders(options)
|
|
2398
|
+
};
|
|
2399
|
+
}
|
|
2400
|
+
});
|
|
2401
|
+
}
|
|
2402
|
+
function subscribe(query, variables, callback, wsClientOptions) {
|
|
2403
|
+
return new Promise((resolve, reject) => {
|
|
2404
|
+
let timer = null;
|
|
2405
|
+
let settled = false;
|
|
2406
|
+
const { timeoutInMs = SUBSCRIPTION_TIMEOUT_MS } = wsClientOptions;
|
|
2407
|
+
const client = createWSClient(wsClientOptions);
|
|
2408
|
+
let unsubscribe = () => {
|
|
2409
|
+
return;
|
|
2410
|
+
};
|
|
2411
|
+
function cleanup() {
|
|
2412
|
+
try {
|
|
2413
|
+
unsubscribe();
|
|
2414
|
+
} catch {
|
|
2415
|
+
}
|
|
2416
|
+
if (timer) {
|
|
2417
|
+
clearTimeout(timer);
|
|
2418
|
+
timer = null;
|
|
2419
|
+
}
|
|
2420
|
+
}
|
|
2421
|
+
function finalizeResolve(data) {
|
|
2422
|
+
if (settled) {
|
|
2423
|
+
return;
|
|
2424
|
+
}
|
|
2425
|
+
settled = true;
|
|
2426
|
+
cleanup();
|
|
2427
|
+
resolve(data);
|
|
2428
|
+
}
|
|
2429
|
+
function finalizeReject(error) {
|
|
2430
|
+
if (settled) {
|
|
2431
|
+
return;
|
|
2432
|
+
}
|
|
2433
|
+
settled = true;
|
|
2434
|
+
cleanup();
|
|
2435
|
+
reject(error);
|
|
2436
|
+
}
|
|
2437
|
+
unsubscribe = client.subscribe(
|
|
2438
|
+
{ query, variables },
|
|
2439
|
+
{
|
|
2440
|
+
next: (data) => {
|
|
2441
|
+
if (!data.data) {
|
|
2442
|
+
finalizeReject(
|
|
2443
|
+
new Error(
|
|
2444
|
+
`Broken data object from graphQL subscribe: ${JSON.stringify(
|
|
2445
|
+
data
|
|
2446
|
+
)} for query: ${query}`
|
|
2447
|
+
)
|
|
2448
|
+
);
|
|
2449
|
+
} else {
|
|
2450
|
+
callback(finalizeResolve, finalizeReject, data.data);
|
|
2451
|
+
}
|
|
2452
|
+
},
|
|
2453
|
+
error: (error) => {
|
|
2454
|
+
finalizeReject(error);
|
|
2455
|
+
},
|
|
2456
|
+
complete: () => {
|
|
2457
|
+
return;
|
|
2458
|
+
}
|
|
2459
|
+
}
|
|
2460
|
+
);
|
|
2461
|
+
if (typeof timeoutInMs === "number") {
|
|
2462
|
+
timer = setTimeout(() => {
|
|
2463
|
+
finalizeReject(
|
|
2464
|
+
new Error(
|
|
2465
|
+
`Timeout expired for graphQL subscribe query: ${query} with timeout: ${timeoutInMs}`
|
|
2466
|
+
)
|
|
2467
|
+
);
|
|
2468
|
+
}, timeoutInMs);
|
|
2469
|
+
}
|
|
2470
|
+
});
|
|
2471
|
+
}
|
|
2472
|
+
|
|
2288
2473
|
// src/features/analysis/scm/utils/index.ts
|
|
2289
2474
|
import { z as z15 } from "zod";
|
|
2290
2475
|
|
|
@@ -4403,107 +4588,6 @@ var debug5 = Debug4("scm:gitlab");
|
|
|
4403
4588
|
// src/features/analysis/scm/scmFactory.ts
|
|
4404
4589
|
import { z as z24 } from "zod";
|
|
4405
4590
|
|
|
4406
|
-
// src/features/analysis/graphql/subscribe.ts
|
|
4407
|
-
import Debug5 from "debug";
|
|
4408
|
-
import { createClient } from "graphql-ws";
|
|
4409
|
-
import { HttpsProxyAgent } from "https-proxy-agent";
|
|
4410
|
-
import WebSocket from "ws";
|
|
4411
|
-
var DEFAULT_API_URL2 = "https://api.mobb.ai/v1/graphql";
|
|
4412
|
-
var debug6 = Debug5("mobbdev:subscribe");
|
|
4413
|
-
var SUBSCRIPTION_TIMEOUT_MS = 30 * 60 * 1e3;
|
|
4414
|
-
function createWSClient(options) {
|
|
4415
|
-
const proxy = options.url.startsWith("wss://") && process.env["HTTPS_PROXY"] ? new HttpsProxyAgent(process.env["HTTPS_PROXY"]) : options.url.startsWith("ws://") && process.env["HTTP_PROXY"] ? new HttpsProxyAgent(process.env["HTTP_PROXY"]) : null;
|
|
4416
|
-
debug6(
|
|
4417
|
-
`Using proxy: ${proxy ? "yes" : "no"} with url: ${options.url} and with proxy: ${process.env["HTTP_PROXY"]} for the websocket connection`
|
|
4418
|
-
);
|
|
4419
|
-
const CustomWebSocket = class extends WebSocket {
|
|
4420
|
-
constructor(address, protocols) {
|
|
4421
|
-
super(
|
|
4422
|
-
address,
|
|
4423
|
-
protocols,
|
|
4424
|
-
proxy ? { agent: proxy } : void 0
|
|
4425
|
-
);
|
|
4426
|
-
}
|
|
4427
|
-
};
|
|
4428
|
-
return createClient({
|
|
4429
|
-
//this is needed to prevent AWS from killing the connection
|
|
4430
|
-
//currently our load balancer has a 29s idle timeout
|
|
4431
|
-
keepAlive: 1e4,
|
|
4432
|
-
url: options.url,
|
|
4433
|
-
webSocketImpl: proxy ? CustomWebSocket : options.websocket || WebSocket,
|
|
4434
|
-
connectionParams: () => {
|
|
4435
|
-
return {
|
|
4436
|
-
headers: options.type === "apiKey" ? {
|
|
4437
|
-
[API_KEY_HEADER_NAME]: options.apiKey
|
|
4438
|
-
} : { authorization: `Bearer ${options.token}` }
|
|
4439
|
-
};
|
|
4440
|
-
}
|
|
4441
|
-
});
|
|
4442
|
-
}
|
|
4443
|
-
function subscribe(query, variables, callback, wsClientOptions) {
|
|
4444
|
-
return new Promise((resolve, reject) => {
|
|
4445
|
-
let timer = null;
|
|
4446
|
-
const { timeoutInMs = SUBSCRIPTION_TIMEOUT_MS } = wsClientOptions;
|
|
4447
|
-
const API_URL2 = process.env["API_URL"] || DEFAULT_API_URL2;
|
|
4448
|
-
const client = createWSClient({
|
|
4449
|
-
...wsClientOptions,
|
|
4450
|
-
websocket: WebSocket,
|
|
4451
|
-
url: API_URL2.replace("http", "ws")
|
|
4452
|
-
});
|
|
4453
|
-
const unsubscribe = client.subscribe(
|
|
4454
|
-
{ query, variables },
|
|
4455
|
-
{
|
|
4456
|
-
next: (data) => {
|
|
4457
|
-
function callbackResolve(data2) {
|
|
4458
|
-
unsubscribe();
|
|
4459
|
-
if (timer) {
|
|
4460
|
-
clearTimeout(timer);
|
|
4461
|
-
}
|
|
4462
|
-
resolve(data2);
|
|
4463
|
-
}
|
|
4464
|
-
function callbackReject(data2) {
|
|
4465
|
-
unsubscribe();
|
|
4466
|
-
if (timer) {
|
|
4467
|
-
clearTimeout(timer);
|
|
4468
|
-
}
|
|
4469
|
-
reject(data2);
|
|
4470
|
-
}
|
|
4471
|
-
if (!data.data) {
|
|
4472
|
-
reject(
|
|
4473
|
-
new Error(
|
|
4474
|
-
`Broken data object from graphQL subscribe: ${JSON.stringify(
|
|
4475
|
-
data
|
|
4476
|
-
)} for query: ${query}`
|
|
4477
|
-
)
|
|
4478
|
-
);
|
|
4479
|
-
} else {
|
|
4480
|
-
callback(callbackResolve, callbackReject, data.data);
|
|
4481
|
-
}
|
|
4482
|
-
},
|
|
4483
|
-
error: (error) => {
|
|
4484
|
-
if (timer) {
|
|
4485
|
-
clearTimeout(timer);
|
|
4486
|
-
}
|
|
4487
|
-
reject(error);
|
|
4488
|
-
},
|
|
4489
|
-
complete: () => {
|
|
4490
|
-
return;
|
|
4491
|
-
}
|
|
4492
|
-
}
|
|
4493
|
-
);
|
|
4494
|
-
if (typeof timeoutInMs === "number") {
|
|
4495
|
-
timer = setTimeout(() => {
|
|
4496
|
-
unsubscribe();
|
|
4497
|
-
reject(
|
|
4498
|
-
new Error(
|
|
4499
|
-
`Timeout expired for graphQL subscribe query: ${query} with timeout: ${timeoutInMs}`
|
|
4500
|
-
)
|
|
4501
|
-
);
|
|
4502
|
-
}, timeoutInMs);
|
|
4503
|
-
}
|
|
4504
|
-
});
|
|
4505
|
-
}
|
|
4506
|
-
|
|
4507
4591
|
// src/features/analysis/graphql/types.ts
|
|
4508
4592
|
import { z as z25 } from "zod";
|
|
4509
4593
|
var VulnerabilityReportIssueCodeNodeZ = z25.object({
|
|
@@ -4566,7 +4650,7 @@ var GetVulByNodesMetadataZ = z25.object({
|
|
|
4566
4650
|
});
|
|
4567
4651
|
|
|
4568
4652
|
// src/features/analysis/graphql/gql.ts
|
|
4569
|
-
var
|
|
4653
|
+
var debug6 = Debug5("mobbdev:gql");
|
|
4570
4654
|
var API_KEY_HEADER_NAME = "x-mobb-key";
|
|
4571
4655
|
var REPORT_STATE_CHECK_DELAY = 5 * 1e3;
|
|
4572
4656
|
function getProxyAgent(url) {
|
|
@@ -4574,14 +4658,14 @@ function getProxyAgent(url) {
|
|
|
4574
4658
|
const parsedUrl = new URL(url);
|
|
4575
4659
|
const isHttp = parsedUrl.protocol === "http:";
|
|
4576
4660
|
const isHttps = parsedUrl.protocol === "https:";
|
|
4577
|
-
const proxy = isHttps ? HTTPS_PROXY : isHttp ? HTTP_PROXY : null;
|
|
4661
|
+
const proxy = isHttps ? HTTPS_PROXY || HTTP_PROXY : isHttp ? HTTP_PROXY : null;
|
|
4578
4662
|
if (proxy) {
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
return
|
|
4663
|
+
debug6("Using proxy %s", proxy);
|
|
4664
|
+
debug6("Proxy agent %o", proxy);
|
|
4665
|
+
return new HttpsProxyAgent(proxy);
|
|
4582
4666
|
}
|
|
4583
4667
|
} catch (err) {
|
|
4584
|
-
|
|
4668
|
+
debug6(`Skipping proxy for ${url}. Reason: ${err.message}`);
|
|
4585
4669
|
}
|
|
4586
4670
|
return void 0;
|
|
4587
4671
|
}
|
|
@@ -4596,7 +4680,7 @@ var fetchWithProxy = (url, options = {}) => {
|
|
|
4596
4680
|
});
|
|
4597
4681
|
}
|
|
4598
4682
|
} catch (err) {
|
|
4599
|
-
|
|
4683
|
+
debug6(`Skipping proxy for ${url}. Reason: ${err.message}`);
|
|
4600
4684
|
}
|
|
4601
4685
|
return fetchOrig(url, options);
|
|
4602
4686
|
};
|
|
@@ -4605,7 +4689,7 @@ var GQLClient = class {
|
|
|
4605
4689
|
__publicField(this, "_client");
|
|
4606
4690
|
__publicField(this, "_clientSdk");
|
|
4607
4691
|
__publicField(this, "_auth");
|
|
4608
|
-
|
|
4692
|
+
debug6(`init with ${args}`);
|
|
4609
4693
|
this._auth = args;
|
|
4610
4694
|
this._client = new GraphQLClient(API_URL, {
|
|
4611
4695
|
headers: args.type === "apiKey" ? { [API_KEY_HEADER_NAME]: args.apiKey || "" } : {
|
|
@@ -4614,7 +4698,7 @@ var GQLClient = class {
|
|
|
4614
4698
|
fetch: fetchWithProxy,
|
|
4615
4699
|
requestMiddleware: (request) => {
|
|
4616
4700
|
const requestId = uuidv4();
|
|
4617
|
-
|
|
4701
|
+
debug6(
|
|
4618
4702
|
`sending API request with id: ${requestId} and with request: ${request.body}`
|
|
4619
4703
|
);
|
|
4620
4704
|
return {
|
|
@@ -4651,7 +4735,7 @@ var GQLClient = class {
|
|
|
4651
4735
|
await this.getUserInfo();
|
|
4652
4736
|
} catch (e) {
|
|
4653
4737
|
if (e?.toString().startsWith("FetchError")) {
|
|
4654
|
-
|
|
4738
|
+
debug6("verify connection failed %o", e);
|
|
4655
4739
|
return false;
|
|
4656
4740
|
}
|
|
4657
4741
|
}
|
|
@@ -4663,7 +4747,7 @@ var GQLClient = class {
|
|
|
4663
4747
|
try {
|
|
4664
4748
|
info = await this.getUserInfo();
|
|
4665
4749
|
} catch (e) {
|
|
4666
|
-
|
|
4750
|
+
debug6("verify token failed %o", e);
|
|
4667
4751
|
return false;
|
|
4668
4752
|
}
|
|
4669
4753
|
return info?.email || true;
|
|
@@ -4724,7 +4808,7 @@ var GQLClient = class {
|
|
|
4724
4808
|
try {
|
|
4725
4809
|
await this._clientSdk.CreateCommunityUser();
|
|
4726
4810
|
} catch (e) {
|
|
4727
|
-
|
|
4811
|
+
debug6("create community user failed %o", e);
|
|
4728
4812
|
}
|
|
4729
4813
|
}
|
|
4730
4814
|
async updateScmToken(args) {
|
|
@@ -4891,11 +4975,13 @@ var GQLClient = class {
|
|
|
4891
4975
|
this._auth.type === "apiKey" ? {
|
|
4892
4976
|
apiKey: this._auth.apiKey,
|
|
4893
4977
|
type: "apiKey",
|
|
4894
|
-
timeoutInMs: params.timeoutInMs
|
|
4978
|
+
timeoutInMs: params.timeoutInMs,
|
|
4979
|
+
proxyAgent: getProxyAgent(API_URL)
|
|
4895
4980
|
} : {
|
|
4896
4981
|
token: this._auth.token,
|
|
4897
4982
|
type: "token",
|
|
4898
|
-
timeoutInMs: params.timeoutInMs
|
|
4983
|
+
timeoutInMs: params.timeoutInMs,
|
|
4984
|
+
proxyAgent: getProxyAgent(API_URL)
|
|
4899
4985
|
}
|
|
4900
4986
|
);
|
|
4901
4987
|
}
|
|
@@ -4948,6 +5034,12 @@ var GQLClient = class {
|
|
|
4948
5034
|
async finalizeAIBlameInferencesUploadRaw(variables) {
|
|
4949
5035
|
return await this._clientSdk.FinalizeAIBlameInferencesUpload(variables);
|
|
4950
5036
|
}
|
|
5037
|
+
async analyzeCommitForExtensionAIBlame(variables) {
|
|
5038
|
+
return await this._clientSdk.AnalyzeCommitForExtensionAIBlame(variables);
|
|
5039
|
+
}
|
|
5040
|
+
async getAIBlameAttributionPrompt(variables) {
|
|
5041
|
+
return await this._clientSdk.GetAIBlameAttributionPrompt(variables);
|
|
5042
|
+
}
|
|
4951
5043
|
};
|
|
4952
5044
|
|
|
4953
5045
|
// src/utils/ConfigStoreService.ts
|
|
@@ -4970,7 +5062,7 @@ function getConfigStore() {
|
|
|
4970
5062
|
var configStore = getConfigStore();
|
|
4971
5063
|
|
|
4972
5064
|
// src/commands/handleMobbLogin.ts
|
|
4973
|
-
var
|
|
5065
|
+
var debug7 = Debug6("mobbdev:commands");
|
|
4974
5066
|
var LOGIN_MAX_WAIT = 10 * 60 * 1e3;
|
|
4975
5067
|
var LOGIN_CHECK_DELAY = 5 * 1e3;
|
|
4976
5068
|
var webLoginUrl = `${WEB_APP_URL}/cli-login`;
|
|
@@ -5049,9 +5141,9 @@ async function handleMobbLogin({
|
|
|
5049
5141
|
});
|
|
5050
5142
|
loginSpinner.spin();
|
|
5051
5143
|
if (encryptedApiToken) {
|
|
5052
|
-
|
|
5144
|
+
debug7("encrypted API token received %s", encryptedApiToken);
|
|
5053
5145
|
newApiToken = crypto.privateDecrypt(privateKey, Buffer.from(encryptedApiToken, "base64")).toString("utf-8");
|
|
5054
|
-
|
|
5146
|
+
debug7("API token decrypted");
|
|
5055
5147
|
break;
|
|
5056
5148
|
}
|
|
5057
5149
|
await sleep(LOGIN_CHECK_DELAY);
|
|
@@ -5065,7 +5157,7 @@ async function handleMobbLogin({
|
|
|
5065
5157
|
const newGqlClient = new GQLClient({ apiKey: newApiToken, type: "apiKey" });
|
|
5066
5158
|
const loginSuccess = await newGqlClient.validateUserToken();
|
|
5067
5159
|
if (loginSuccess) {
|
|
5068
|
-
|
|
5160
|
+
debug7(`set api token ${newApiToken}`);
|
|
5069
5161
|
configStore.set("apiToken", newApiToken);
|
|
5070
5162
|
loginSpinner.success({
|
|
5071
5163
|
text: `\u{1F513} Login to Mobb successful! ${typeof loginSpinner === "string" ? `Logged in as ${loginSuccess}` : ""}`
|
|
@@ -5080,9 +5172,9 @@ async function handleMobbLogin({
|
|
|
5080
5172
|
}
|
|
5081
5173
|
|
|
5082
5174
|
// src/features/analysis/upload-file.ts
|
|
5083
|
-
import
|
|
5175
|
+
import Debug7 from "debug";
|
|
5084
5176
|
import fetch3, { File, fileFrom, FormData } from "node-fetch";
|
|
5085
|
-
var
|
|
5177
|
+
var debug8 = Debug7("mobbdev:upload-file");
|
|
5086
5178
|
async function uploadFile({
|
|
5087
5179
|
file,
|
|
5088
5180
|
url,
|
|
@@ -5095,9 +5187,9 @@ async function uploadFile({
|
|
|
5095
5187
|
logInfo(`FileUpload: upload file start ${url}`);
|
|
5096
5188
|
logInfo(`FileUpload: upload fields`, uploadFields);
|
|
5097
5189
|
logInfo(`FileUpload: upload key ${uploadKey}`);
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
|
|
5190
|
+
debug8("upload file start %s", url);
|
|
5191
|
+
debug8("upload fields %o", uploadFields);
|
|
5192
|
+
debug8("upload key %s", uploadKey);
|
|
5101
5193
|
const form = new FormData();
|
|
5102
5194
|
Object.entries(uploadFields).forEach(([key, value]) => {
|
|
5103
5195
|
form.append(key, value);
|
|
@@ -5106,11 +5198,11 @@ async function uploadFile({
|
|
|
5106
5198
|
form.append("key", uploadKey);
|
|
5107
5199
|
}
|
|
5108
5200
|
if (typeof file === "string") {
|
|
5109
|
-
|
|
5201
|
+
debug8("upload file from path %s", file);
|
|
5110
5202
|
logInfo(`FileUpload: upload file from path ${file}`);
|
|
5111
5203
|
form.append("file", await fileFrom(file));
|
|
5112
5204
|
} else {
|
|
5113
|
-
|
|
5205
|
+
debug8("upload file from buffer");
|
|
5114
5206
|
logInfo(`FileUpload: upload file from buffer`);
|
|
5115
5207
|
form.append("file", new File([new Uint8Array(file)], "file"));
|
|
5116
5208
|
}
|
|
@@ -5121,11 +5213,11 @@ async function uploadFile({
|
|
|
5121
5213
|
agent
|
|
5122
5214
|
});
|
|
5123
5215
|
if (!response.ok) {
|
|
5124
|
-
|
|
5216
|
+
debug8("error from S3 %s %s", response.body, response.status);
|
|
5125
5217
|
logInfo(`FileUpload: error from S3 ${response.body} ${response.status}`);
|
|
5126
5218
|
throw new Error(`Failed to upload the file: ${response.status}`);
|
|
5127
5219
|
}
|
|
5128
|
-
|
|
5220
|
+
debug8("upload file done");
|
|
5129
5221
|
logInfo(`FileUpload: upload file done`);
|
|
5130
5222
|
}
|
|
5131
5223
|
|