mobbdev 1.1.17 → 1.1.19

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.
@@ -51,18 +51,26 @@ declare const PromptItemZ: z.ZodObject<{
51
51
  name: string;
52
52
  parameters: string;
53
53
  result: string;
54
- rawArguments?: string | undefined;
55
54
  accepted?: boolean | undefined;
55
+ rawArguments?: string | undefined;
56
56
  }, {
57
57
  name: string;
58
58
  parameters: string;
59
59
  result: string;
60
- rawArguments?: string | undefined;
61
60
  accepted?: boolean | undefined;
61
+ rawArguments?: string | undefined;
62
62
  }>>;
63
63
  }, "strip", z.ZodTypeAny, {
64
64
  type: "USER_PROMPT" | "AI_RESPONSE" | "TOOL_EXECUTION" | "AI_THINKING";
65
+ tool?: {
66
+ name: string;
67
+ parameters: string;
68
+ result: string;
69
+ accepted?: boolean | undefined;
70
+ rawArguments?: string | undefined;
71
+ } | undefined;
65
72
  date?: Date | undefined;
73
+ text?: string | undefined;
66
74
  attachedFiles?: {
67
75
  relativePath: string;
68
76
  startLine?: number | undefined;
@@ -71,17 +79,17 @@ declare const PromptItemZ: z.ZodObject<{
71
79
  inputCount: number;
72
80
  outputCount: number;
73
81
  } | undefined;
74
- text?: string | undefined;
82
+ }, {
83
+ type: "USER_PROMPT" | "AI_RESPONSE" | "TOOL_EXECUTION" | "AI_THINKING";
75
84
  tool?: {
76
85
  name: string;
77
86
  parameters: string;
78
87
  result: string;
79
- rawArguments?: string | undefined;
80
88
  accepted?: boolean | undefined;
89
+ rawArguments?: string | undefined;
81
90
  } | undefined;
82
- }, {
83
- type: "USER_PROMPT" | "AI_RESPONSE" | "TOOL_EXECUTION" | "AI_THINKING";
84
91
  date?: Date | undefined;
92
+ text?: string | undefined;
85
93
  attachedFiles?: {
86
94
  relativePath: string;
87
95
  startLine?: number | undefined;
@@ -90,14 +98,6 @@ declare const PromptItemZ: z.ZodObject<{
90
98
  inputCount: number;
91
99
  outputCount: number;
92
100
  } | undefined;
93
- text?: string | undefined;
94
- tool?: {
95
- name: string;
96
- parameters: string;
97
- result: string;
98
- rawArguments?: string | undefined;
99
- accepted?: boolean | undefined;
100
- } | undefined;
101
101
  }>;
102
102
  type PromptItem = z.infer<typeof PromptItemZ>;
103
103
  declare const PromptItemArrayZ: z.ZodArray<z.ZodObject<{
@@ -134,18 +134,26 @@ declare const PromptItemArrayZ: z.ZodArray<z.ZodObject<{
134
134
  name: string;
135
135
  parameters: string;
136
136
  result: string;
137
- rawArguments?: string | undefined;
138
137
  accepted?: boolean | undefined;
138
+ rawArguments?: string | undefined;
139
139
  }, {
140
140
  name: string;
141
141
  parameters: string;
142
142
  result: string;
143
- rawArguments?: string | undefined;
144
143
  accepted?: boolean | undefined;
144
+ rawArguments?: string | undefined;
145
145
  }>>;
146
146
  }, "strip", z.ZodTypeAny, {
147
147
  type: "USER_PROMPT" | "AI_RESPONSE" | "TOOL_EXECUTION" | "AI_THINKING";
148
+ tool?: {
149
+ name: string;
150
+ parameters: string;
151
+ result: string;
152
+ accepted?: boolean | undefined;
153
+ rawArguments?: string | undefined;
154
+ } | undefined;
148
155
  date?: Date | undefined;
156
+ text?: string | undefined;
149
157
  attachedFiles?: {
150
158
  relativePath: string;
151
159
  startLine?: number | undefined;
@@ -154,17 +162,17 @@ declare const PromptItemArrayZ: z.ZodArray<z.ZodObject<{
154
162
  inputCount: number;
155
163
  outputCount: number;
156
164
  } | undefined;
157
- text?: string | undefined;
165
+ }, {
166
+ type: "USER_PROMPT" | "AI_RESPONSE" | "TOOL_EXECUTION" | "AI_THINKING";
158
167
  tool?: {
159
168
  name: string;
160
169
  parameters: string;
161
170
  result: string;
162
- rawArguments?: string | undefined;
163
171
  accepted?: boolean | undefined;
172
+ rawArguments?: string | undefined;
164
173
  } | undefined;
165
- }, {
166
- type: "USER_PROMPT" | "AI_RESPONSE" | "TOOL_EXECUTION" | "AI_THINKING";
167
174
  date?: Date | undefined;
175
+ text?: string | undefined;
168
176
  attachedFiles?: {
169
177
  relativePath: string;
170
178
  startLine?: number | undefined;
@@ -173,14 +181,6 @@ declare const PromptItemArrayZ: z.ZodArray<z.ZodObject<{
173
181
  inputCount: number;
174
182
  outputCount: number;
175
183
  } | undefined;
176
- text?: string | undefined;
177
- tool?: {
178
- name: string;
179
- parameters: string;
180
- result: string;
181
- rawArguments?: string | undefined;
182
- accepted?: boolean | undefined;
183
- } | undefined;
184
184
  }>, "many">;
185
185
  type PromptItemArray = z.infer<typeof PromptItemArrayZ>;
186
186
  type UploadAiBlameOptions = {
@@ -1118,6 +1118,31 @@ var GetUserMvsAutoFixDocument = `
1118
1118
  }
1119
1119
  }
1120
1120
  `;
1121
+ var StreamBlameAiAnalysisRequestsDocument = `
1122
+ subscription streamBlameAiAnalysisRequests($requestIds: [uuid!]!) {
1123
+ blame_ai_analysis_request(where: {id: {_in: $requestIds}}) {
1124
+ id
1125
+ state
1126
+ commitId
1127
+ organizationId
1128
+ createdOn
1129
+ }
1130
+ }
1131
+ `;
1132
+ var StreamCommitBlameRequestsDocument = `
1133
+ subscription streamCommitBlameRequests($requestIds: [uuid!]!) {
1134
+ commit_blame_request(where: {id: {_in: $requestIds}}) {
1135
+ id
1136
+ state
1137
+ organizationId
1138
+ repositoryUrl
1139
+ commitSha
1140
+ createdOn
1141
+ completedOn
1142
+ error
1143
+ }
1144
+ }
1145
+ `;
1121
1146
  var defaultWrapper = (action, _operationName, _operationType, _variables) => action();
1122
1147
  function getSdk(client, withWrapper = defaultWrapper) {
1123
1148
  return {
@@ -1216,6 +1241,12 @@ function getSdk(client, withWrapper = defaultWrapper) {
1216
1241
  },
1217
1242
  GetUserMvsAutoFix(variables, requestHeaders, signal) {
1218
1243
  return withWrapper((wrappedRequestHeaders) => client.request({ document: GetUserMvsAutoFixDocument, variables, requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders }, signal }), "GetUserMvsAutoFix", "query", variables);
1244
+ },
1245
+ streamBlameAiAnalysisRequests(variables, requestHeaders, signal) {
1246
+ return withWrapper((wrappedRequestHeaders) => client.request({ document: StreamBlameAiAnalysisRequestsDocument, variables, requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders }, signal }), "streamBlameAiAnalysisRequests", "subscription", variables);
1247
+ },
1248
+ streamCommitBlameRequests(variables, requestHeaders, signal) {
1249
+ return withWrapper((wrappedRequestHeaders) => client.request({ document: StreamCommitBlameRequestsDocument, variables, requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders }, signal }), "streamCommitBlameRequests", "subscription", variables);
1219
1250
  }
1220
1251
  };
1221
1252
  }
@@ -2399,75 +2430,78 @@ function createWSClient(options) {
2399
2430
  }
2400
2431
  });
2401
2432
  }
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() {
2433
+ function subscribeStream(query, variables, handlers, wsClientOptions) {
2434
+ let timer = null;
2435
+ const { timeoutInMs = SUBSCRIPTION_TIMEOUT_MS } = wsClientOptions;
2436
+ const client = createWSClient(wsClientOptions);
2437
+ let unsub = null;
2438
+ let settled = false;
2439
+ const cleanup = () => {
2440
+ if (unsub) {
2412
2441
  try {
2413
- unsubscribe();
2442
+ unsub();
2414
2443
  } catch {
2415
2444
  }
2416
- if (timer) {
2417
- clearTimeout(timer);
2418
- timer = null;
2419
- }
2445
+ unsub = null;
2420
2446
  }
2421
- function finalizeResolve(data) {
2422
- if (settled) {
2447
+ if (timer) {
2448
+ clearTimeout(timer);
2449
+ timer = null;
2450
+ }
2451
+ };
2452
+ const finalizeError = (error) => {
2453
+ if (settled) {
2454
+ return;
2455
+ }
2456
+ settled = true;
2457
+ cleanup();
2458
+ handlers.error(error);
2459
+ };
2460
+ unsub = client.subscribe(
2461
+ { query, variables },
2462
+ {
2463
+ next: (payload) => {
2464
+ if (settled) {
2465
+ return;
2466
+ }
2467
+ if (!payload.data) {
2468
+ finalizeError(
2469
+ new Error(
2470
+ `Broken data object from graphQL subscribe: ${JSON.stringify(
2471
+ payload
2472
+ )} for query: ${query}`
2473
+ )
2474
+ );
2475
+ return;
2476
+ }
2477
+ handlers.next(payload.data);
2478
+ },
2479
+ error: (error) => {
2480
+ finalizeError(error);
2481
+ },
2482
+ complete: () => {
2423
2483
  return;
2424
2484
  }
2425
- settled = true;
2426
- cleanup();
2427
- resolve(data);
2428
2485
  }
2429
- function finalizeReject(error) {
2486
+ );
2487
+ if (typeof timeoutInMs === "number") {
2488
+ timer = setTimeout(() => {
2489
+ finalizeError(
2490
+ new Error(
2491
+ `Timeout expired for graphQL subscribe query: ${query} with timeout: ${timeoutInMs}`
2492
+ )
2493
+ );
2494
+ }, timeoutInMs);
2495
+ }
2496
+ return {
2497
+ unsubscribe: () => {
2430
2498
  if (settled) {
2431
2499
  return;
2432
2500
  }
2433
2501
  settled = true;
2434
2502
  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
2503
  }
2470
- });
2504
+ };
2471
2505
  }
2472
2506
 
2473
2507
  // src/features/analysis/scm/utils/index.ts
@@ -4956,32 +4990,47 @@ var GQLClient = class {
4956
4990
  }
4957
4991
  async subscribeToAnalysis(params) {
4958
4992
  const { callbackStates } = params;
4959
- return subscribe(
4960
- GetAnalysisSubscriptionDocument,
4961
- params.subscribeToAnalysisParams,
4962
- async (resolve, reject, data) => {
4963
- if (!data.analysis?.state || data.analysis?.state === "Failed" /* Failed */) {
4964
- const errorMessage = data.analysis?.failReason || `Analysis failed with id: ${data.analysis?.id}`;
4965
- reject(
4966
- new ReportDigestError(errorMessage, data.analysis?.failReason ?? "")
4967
- );
4968
- return;
4969
- }
4970
- if (callbackStates.includes(data.analysis?.state)) {
4971
- await params.callback(data.analysis.id);
4972
- resolve(data);
4973
- }
4974
- },
4975
- this._auth.type === "apiKey" ? {
4976
- apiKey: this._auth.apiKey,
4977
- type: "apiKey",
4978
- timeoutInMs: params.timeoutInMs,
4979
- proxyAgent: getProxyAgent(API_URL)
4980
- } : {
4981
- token: this._auth.token,
4982
- type: "token",
4983
- timeoutInMs: params.timeoutInMs,
4984
- proxyAgent: getProxyAgent(API_URL)
4993
+ return new Promise(
4994
+ (resolve, reject) => {
4995
+ const subscription = subscribeStream(
4996
+ GetAnalysisSubscriptionDocument,
4997
+ params.subscribeToAnalysisParams,
4998
+ {
4999
+ next: async (data) => {
5000
+ if (!data.analysis?.state || data.analysis?.state === "Failed" /* Failed */) {
5001
+ const errorMessage = data.analysis?.failReason || `Analysis failed with id: ${data.analysis?.id}`;
5002
+ subscription.unsubscribe();
5003
+ reject(
5004
+ new ReportDigestError(
5005
+ errorMessage,
5006
+ data.analysis?.failReason ?? ""
5007
+ )
5008
+ );
5009
+ return;
5010
+ }
5011
+ if (callbackStates.includes(data.analysis?.state)) {
5012
+ await params.callback(data.analysis.id);
5013
+ subscription.unsubscribe();
5014
+ resolve(data);
5015
+ }
5016
+ },
5017
+ error: (error) => {
5018
+ subscription.unsubscribe();
5019
+ reject(error);
5020
+ }
5021
+ },
5022
+ this._auth.type === "apiKey" ? {
5023
+ apiKey: this._auth.apiKey,
5024
+ type: "apiKey",
5025
+ timeoutInMs: params.timeoutInMs,
5026
+ proxyAgent: getProxyAgent(API_URL)
5027
+ } : {
5028
+ token: this._auth.token,
5029
+ type: "token",
5030
+ timeoutInMs: params.timeoutInMs,
5031
+ proxyAgent: getProxyAgent(API_URL)
5032
+ }
5033
+ );
4985
5034
  }
4986
5035
  );
4987
5036
  }
package/dist/index.mjs CHANGED
@@ -842,16 +842,7 @@ var init_GitService = __esm({
842
842
  this.git.revparse(["HEAD"]),
843
843
  this.git.revparse(["--abbrev-ref", "HEAD"])
844
844
  ]);
845
- let normalizedRepoUrl = repoUrl.value || "";
846
- if (normalizedRepoUrl.endsWith(".git")) {
847
- normalizedRepoUrl = normalizedRepoUrl.slice(0, -".git".length);
848
- }
849
- if (normalizedRepoUrl.startsWith("git@github.com:")) {
850
- normalizedRepoUrl = normalizedRepoUrl.replace(
851
- "git@github.com:",
852
- "https://github.com/"
853
- );
854
- }
845
+ const normalizedRepoUrl = repoUrl.value ? this.normalizeGitUrl(repoUrl.value) : "";
855
846
  this.log("[GitService] Git repository information retrieved", "debug", {
856
847
  repoUrl: normalizedRepoUrl,
857
848
  hash,
@@ -1147,6 +1138,9 @@ var init_GitService = __esm({
1147
1138
  }
1148
1139
  }
1149
1140
  }
1141
+ if (normalizedUrl.startsWith("https://") || normalizedUrl.startsWith("http://")) {
1142
+ normalizedUrl = normalizedUrl.replace(/^(https?:\/\/)([^@/]+@)/, "$1");
1143
+ }
1150
1144
  return normalizedUrl;
1151
1145
  }
1152
1146
  /**
@@ -2377,6 +2371,31 @@ var GetUserMvsAutoFixDocument = `
2377
2371
  }
2378
2372
  }
2379
2373
  `;
2374
+ var StreamBlameAiAnalysisRequestsDocument = `
2375
+ subscription streamBlameAiAnalysisRequests($requestIds: [uuid!]!) {
2376
+ blame_ai_analysis_request(where: {id: {_in: $requestIds}}) {
2377
+ id
2378
+ state
2379
+ commitId
2380
+ organizationId
2381
+ createdOn
2382
+ }
2383
+ }
2384
+ `;
2385
+ var StreamCommitBlameRequestsDocument = `
2386
+ subscription streamCommitBlameRequests($requestIds: [uuid!]!) {
2387
+ commit_blame_request(where: {id: {_in: $requestIds}}) {
2388
+ id
2389
+ state
2390
+ organizationId
2391
+ repositoryUrl
2392
+ commitSha
2393
+ createdOn
2394
+ completedOn
2395
+ error
2396
+ }
2397
+ }
2398
+ `;
2380
2399
  var defaultWrapper = (action, _operationName, _operationType, _variables) => action();
2381
2400
  function getSdk(client, withWrapper = defaultWrapper) {
2382
2401
  return {
@@ -2475,6 +2494,12 @@ function getSdk(client, withWrapper = defaultWrapper) {
2475
2494
  },
2476
2495
  GetUserMvsAutoFix(variables, requestHeaders, signal) {
2477
2496
  return withWrapper((wrappedRequestHeaders) => client.request({ document: GetUserMvsAutoFixDocument, variables, requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders }, signal }), "GetUserMvsAutoFix", "query", variables);
2497
+ },
2498
+ streamBlameAiAnalysisRequests(variables, requestHeaders, signal) {
2499
+ return withWrapper((wrappedRequestHeaders) => client.request({ document: StreamBlameAiAnalysisRequestsDocument, variables, requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders }, signal }), "streamBlameAiAnalysisRequests", "subscription", variables);
2500
+ },
2501
+ streamCommitBlameRequests(variables, requestHeaders, signal) {
2502
+ return withWrapper((wrappedRequestHeaders) => client.request({ document: StreamCommitBlameRequestsDocument, variables, requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders }, signal }), "streamCommitBlameRequests", "subscription", variables);
2478
2503
  }
2479
2504
  };
2480
2505
  }
@@ -8463,6 +8488,16 @@ function getGithubSdk(params = {}) {
8463
8488
  }
8464
8489
 
8465
8490
  // src/features/analysis/scm/github/GithubSCMLib.ts
8491
+ function determinePrStatus(state, isDraft) {
8492
+ switch (state) {
8493
+ case "CLOSED":
8494
+ return "CLOSED" /* Closed */;
8495
+ case "MERGED":
8496
+ return "MERGED" /* Merged */;
8497
+ case "OPEN":
8498
+ return isDraft ? "DRAFT" /* Draft */ : "ACTIVE" /* Active */;
8499
+ }
8500
+ }
8466
8501
  var GithubSCMLib = class extends SCMLib {
8467
8502
  // we don't always need a url, what's important is that we have an access token
8468
8503
  constructor(url, accessToken, scmOrg) {
@@ -8910,12 +8945,7 @@ var GithubSCMLib = class extends SCMLib {
8910
8945
  if (!pr) {
8911
8946
  throw new Error(`Pull request #${prNumber} not found`);
8912
8947
  }
8913
- let prStatus = "ACTIVE" /* Active */;
8914
- if (pr.state === "CLOSED") {
8915
- prStatus = pr.mergedAt ? "MERGED" /* Merged */ : "CLOSED" /* Closed */;
8916
- } else if (pr.isDraft) {
8917
- prStatus = "DRAFT" /* Draft */;
8918
- }
8948
+ const prStatus = determinePrStatus(pr.state, pr.isDraft);
8919
8949
  const firstCommit = pr.commits.nodes[0];
8920
8950
  const firstCommitDate = firstCommit ? new Date(
8921
8951
  firstCommit.commit.author?.date || firstCommit.commit.committedDate || pr.createdAt
@@ -10773,75 +10803,78 @@ function createWSClient(options) {
10773
10803
  }
10774
10804
  });
10775
10805
  }
10776
- function subscribe(query, variables, callback, wsClientOptions) {
10777
- return new Promise((resolve, reject) => {
10778
- let timer = null;
10779
- let settled = false;
10780
- const { timeoutInMs = SUBSCRIPTION_TIMEOUT_MS } = wsClientOptions;
10781
- const client = createWSClient(wsClientOptions);
10782
- let unsubscribe = () => {
10783
- return;
10784
- };
10785
- function cleanup() {
10806
+ function subscribeStream(query, variables, handlers, wsClientOptions) {
10807
+ let timer = null;
10808
+ const { timeoutInMs = SUBSCRIPTION_TIMEOUT_MS } = wsClientOptions;
10809
+ const client = createWSClient(wsClientOptions);
10810
+ let unsub = null;
10811
+ let settled = false;
10812
+ const cleanup = () => {
10813
+ if (unsub) {
10786
10814
  try {
10787
- unsubscribe();
10815
+ unsub();
10788
10816
  } catch {
10789
10817
  }
10790
- if (timer) {
10791
- clearTimeout(timer);
10792
- timer = null;
10793
- }
10818
+ unsub = null;
10794
10819
  }
10795
- function finalizeResolve(data) {
10796
- if (settled) {
10820
+ if (timer) {
10821
+ clearTimeout(timer);
10822
+ timer = null;
10823
+ }
10824
+ };
10825
+ const finalizeError = (error) => {
10826
+ if (settled) {
10827
+ return;
10828
+ }
10829
+ settled = true;
10830
+ cleanup();
10831
+ handlers.error(error);
10832
+ };
10833
+ unsub = client.subscribe(
10834
+ { query, variables },
10835
+ {
10836
+ next: (payload) => {
10837
+ if (settled) {
10838
+ return;
10839
+ }
10840
+ if (!payload.data) {
10841
+ finalizeError(
10842
+ new Error(
10843
+ `Broken data object from graphQL subscribe: ${JSON.stringify(
10844
+ payload
10845
+ )} for query: ${query}`
10846
+ )
10847
+ );
10848
+ return;
10849
+ }
10850
+ handlers.next(payload.data);
10851
+ },
10852
+ error: (error) => {
10853
+ finalizeError(error);
10854
+ },
10855
+ complete: () => {
10797
10856
  return;
10798
10857
  }
10799
- settled = true;
10800
- cleanup();
10801
- resolve(data);
10802
10858
  }
10803
- function finalizeReject(error) {
10859
+ );
10860
+ if (typeof timeoutInMs === "number") {
10861
+ timer = setTimeout(() => {
10862
+ finalizeError(
10863
+ new Error(
10864
+ `Timeout expired for graphQL subscribe query: ${query} with timeout: ${timeoutInMs}`
10865
+ )
10866
+ );
10867
+ }, timeoutInMs);
10868
+ }
10869
+ return {
10870
+ unsubscribe: () => {
10804
10871
  if (settled) {
10805
10872
  return;
10806
10873
  }
10807
10874
  settled = true;
10808
10875
  cleanup();
10809
- reject(error);
10810
10876
  }
10811
- unsubscribe = client.subscribe(
10812
- { query, variables },
10813
- {
10814
- next: (data) => {
10815
- if (!data.data) {
10816
- finalizeReject(
10817
- new Error(
10818
- `Broken data object from graphQL subscribe: ${JSON.stringify(
10819
- data
10820
- )} for query: ${query}`
10821
- )
10822
- );
10823
- } else {
10824
- callback(finalizeResolve, finalizeReject, data.data);
10825
- }
10826
- },
10827
- error: (error) => {
10828
- finalizeReject(error);
10829
- },
10830
- complete: () => {
10831
- return;
10832
- }
10833
- }
10834
- );
10835
- if (typeof timeoutInMs === "number") {
10836
- timer = setTimeout(() => {
10837
- finalizeReject(
10838
- new Error(
10839
- `Timeout expired for graphQL subscribe query: ${query} with timeout: ${timeoutInMs}`
10840
- )
10841
- );
10842
- }, timeoutInMs);
10843
- }
10844
- });
10877
+ };
10845
10878
  }
10846
10879
 
10847
10880
  // src/features/analysis/graphql/types.ts
@@ -11212,32 +11245,47 @@ var GQLClient = class {
11212
11245
  }
11213
11246
  async subscribeToAnalysis(params) {
11214
11247
  const { callbackStates } = params;
11215
- return subscribe(
11216
- GetAnalysisSubscriptionDocument,
11217
- params.subscribeToAnalysisParams,
11218
- async (resolve, reject, data) => {
11219
- if (!data.analysis?.state || data.analysis?.state === "Failed" /* Failed */) {
11220
- const errorMessage = data.analysis?.failReason || `Analysis failed with id: ${data.analysis?.id}`;
11221
- reject(
11222
- new ReportDigestError(errorMessage, data.analysis?.failReason ?? "")
11223
- );
11224
- return;
11225
- }
11226
- if (callbackStates.includes(data.analysis?.state)) {
11227
- await params.callback(data.analysis.id);
11228
- resolve(data);
11229
- }
11230
- },
11231
- this._auth.type === "apiKey" ? {
11232
- apiKey: this._auth.apiKey,
11233
- type: "apiKey",
11234
- timeoutInMs: params.timeoutInMs,
11235
- proxyAgent: getProxyAgent(API_URL)
11236
- } : {
11237
- token: this._auth.token,
11238
- type: "token",
11239
- timeoutInMs: params.timeoutInMs,
11240
- proxyAgent: getProxyAgent(API_URL)
11248
+ return new Promise(
11249
+ (resolve, reject) => {
11250
+ const subscription = subscribeStream(
11251
+ GetAnalysisSubscriptionDocument,
11252
+ params.subscribeToAnalysisParams,
11253
+ {
11254
+ next: async (data) => {
11255
+ if (!data.analysis?.state || data.analysis?.state === "Failed" /* Failed */) {
11256
+ const errorMessage = data.analysis?.failReason || `Analysis failed with id: ${data.analysis?.id}`;
11257
+ subscription.unsubscribe();
11258
+ reject(
11259
+ new ReportDigestError(
11260
+ errorMessage,
11261
+ data.analysis?.failReason ?? ""
11262
+ )
11263
+ );
11264
+ return;
11265
+ }
11266
+ if (callbackStates.includes(data.analysis?.state)) {
11267
+ await params.callback(data.analysis.id);
11268
+ subscription.unsubscribe();
11269
+ resolve(data);
11270
+ }
11271
+ },
11272
+ error: (error) => {
11273
+ subscription.unsubscribe();
11274
+ reject(error);
11275
+ }
11276
+ },
11277
+ this._auth.type === "apiKey" ? {
11278
+ apiKey: this._auth.apiKey,
11279
+ type: "apiKey",
11280
+ timeoutInMs: params.timeoutInMs,
11281
+ proxyAgent: getProxyAgent(API_URL)
11282
+ } : {
11283
+ token: this._auth.token,
11284
+ type: "token",
11285
+ timeoutInMs: params.timeoutInMs,
11286
+ proxyAgent: getProxyAgent(API_URL)
11287
+ }
11288
+ );
11241
11289
  }
11242
11290
  );
11243
11291
  }
@@ -14941,54 +14989,77 @@ var McpGQLClient = class {
14941
14989
  params: params.subscribeToAnalysisParams
14942
14990
  });
14943
14991
  const { callbackStates } = params;
14944
- const result = await subscribe(
14945
- GetAnalysisSubscriptionDocument,
14946
- params.subscribeToAnalysisParams,
14947
- async (resolve, reject, data) => {
14948
- logDebug(
14949
- `[${scanContext}] GraphQL: GetAnalysis subscription data received ${data.analysis?.state}`,
14950
- { data }
14951
- );
14952
- if (!data.analysis?.state || data.analysis?.state === "Failed" /* Failed */) {
14953
- const errorMessage = data.analysis?.failReason || `Analysis failed with id: ${data.analysis?.id}`;
14954
- logError(`[${scanContext}] GraphQL: Analysis failed`, {
14955
- analysisId: data.analysis?.id,
14956
- state: data.analysis?.state,
14957
- failReason: data.analysis?.failReason,
14958
- ...this.getErrorContext()
14959
- });
14960
- reject(new Error(errorMessage));
14961
- return;
14962
- }
14963
- if (callbackStates.includes(data.analysis?.state)) {
14964
- logDebug(
14965
- `[${scanContext}] GraphQL: Analysis state matches callback states: ${data.analysis.state}`,
14966
- {
14967
- analysisId: data.analysis.id,
14968
- state: data.analysis.state,
14969
- callbackStates
14992
+ return new Promise(
14993
+ (resolve, reject) => {
14994
+ const subscription = subscribeStream(
14995
+ GetAnalysisSubscriptionDocument,
14996
+ params.subscribeToAnalysisParams,
14997
+ {
14998
+ next: async (data) => {
14999
+ logDebug(
15000
+ `[${scanContext}] GraphQL: GetAnalysis subscription data received ${data.analysis?.state}`,
15001
+ { data }
15002
+ );
15003
+ if (!data.analysis?.state || data.analysis?.state === "Failed" /* Failed */) {
15004
+ const errorMessage = data.analysis?.failReason || `Analysis failed with id: ${data.analysis?.id}`;
15005
+ logError(`[${scanContext}] GraphQL: Analysis failed`, {
15006
+ analysisId: data.analysis?.id,
15007
+ state: data.analysis?.state,
15008
+ failReason: data.analysis?.failReason,
15009
+ ...this.getErrorContext()
15010
+ });
15011
+ subscription.unsubscribe();
15012
+ reject(new Error(errorMessage));
15013
+ return;
15014
+ }
15015
+ if (callbackStates.includes(data.analysis?.state)) {
15016
+ logDebug(
15017
+ `[${scanContext}] GraphQL: Analysis state matches callback states: ${data.analysis.state}`,
15018
+ {
15019
+ analysisId: data.analysis.id,
15020
+ state: data.analysis.state,
15021
+ callbackStates
15022
+ }
15023
+ );
15024
+ await params.callback(data.analysis.id);
15025
+ subscription.unsubscribe();
15026
+ logDebug(
15027
+ `[${scanContext}] GraphQL: GetAnalysis subscription completed`,
15028
+ {
15029
+ analysisId: data.analysis.id,
15030
+ state: data.analysis.state
15031
+ }
15032
+ );
15033
+ resolve(data);
15034
+ }
15035
+ },
15036
+ error: (error) => {
15037
+ logError(
15038
+ `[${scanContext}] GraphQL: GetAnalysis subscription failed`,
15039
+ {
15040
+ error,
15041
+ params: params.subscribeToAnalysisParams,
15042
+ ...this.getErrorContext()
15043
+ }
15044
+ );
15045
+ subscription.unsubscribe();
15046
+ reject(error);
14970
15047
  }
14971
- );
14972
- await params.callback(data.analysis.id);
14973
- resolve(data);
14974
- }
14975
- },
14976
- this._auth.type === "apiKey" ? {
14977
- apiKey: this._auth.apiKey,
14978
- type: "apiKey",
14979
- timeoutInMs: params.timeoutInMs,
14980
- proxyAgent: getProxyAgent2(this.apiUrl)
14981
- } : {
14982
- token: this._auth.token,
14983
- type: "token",
14984
- timeoutInMs: params.timeoutInMs,
14985
- proxyAgent: getProxyAgent2(this.apiUrl)
15048
+ },
15049
+ this._auth.type === "apiKey" ? {
15050
+ apiKey: this._auth.apiKey,
15051
+ type: "apiKey",
15052
+ timeoutInMs: params.timeoutInMs,
15053
+ proxyAgent: getProxyAgent2(this.apiUrl)
15054
+ } : {
15055
+ token: this._auth.token,
15056
+ type: "token",
15057
+ timeoutInMs: params.timeoutInMs,
15058
+ proxyAgent: getProxyAgent2(this.apiUrl)
15059
+ }
15060
+ );
14986
15061
  }
14987
15062
  );
14988
- logDebug(`[${scanContext}] GraphQL: GetAnalysis subscription completed`, {
14989
- result
14990
- });
14991
- return result;
14992
15063
  } catch (e) {
14993
15064
  logError(`[${scanContext}] GraphQL: GetAnalysis subscription failed`, {
14994
15065
  error: e,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mobbdev",
3
- "version": "1.1.17",
3
+ "version": "1.1.19",
4
4
  "description": "Automated secure code remediation tool",
5
5
  "repository": "git+https://github.com/mobb-dev/bugsy.git",
6
6
  "main": "dist/index.mjs",