mobbdev 1.1.27 → 1.1.28
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.
|
@@ -16,6 +16,10 @@ type SanitizationCounts = {
|
|
|
16
16
|
};
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
+
type Logger = {
|
|
20
|
+
info: (msg: string, data?: unknown) => void;
|
|
21
|
+
error: (msg: string, data?: unknown) => void;
|
|
22
|
+
};
|
|
19
23
|
declare const PromptItemZ: z.ZodObject<{
|
|
20
24
|
type: z.ZodEnum<["USER_PROMPT", "AI_RESPONSE", "TOOL_EXECUTION", "AI_THINKING"]>;
|
|
21
25
|
attachedFiles: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -50,26 +54,18 @@ declare const PromptItemZ: z.ZodObject<{
|
|
|
50
54
|
name: string;
|
|
51
55
|
parameters: string;
|
|
52
56
|
result: string;
|
|
53
|
-
accepted?: boolean | undefined;
|
|
54
57
|
rawArguments?: string | undefined;
|
|
58
|
+
accepted?: boolean | undefined;
|
|
55
59
|
}, {
|
|
56
60
|
name: string;
|
|
57
61
|
parameters: string;
|
|
58
62
|
result: string;
|
|
59
|
-
accepted?: boolean | undefined;
|
|
60
63
|
rawArguments?: string | undefined;
|
|
64
|
+
accepted?: boolean | undefined;
|
|
61
65
|
}>>;
|
|
62
66
|
}, "strip", z.ZodTypeAny, {
|
|
63
67
|
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;
|
|
71
68
|
date?: Date | undefined;
|
|
72
|
-
text?: string | undefined;
|
|
73
69
|
attachedFiles?: {
|
|
74
70
|
relativePath: string;
|
|
75
71
|
startLine?: number | undefined;
|
|
@@ -78,17 +74,17 @@ declare const PromptItemZ: z.ZodObject<{
|
|
|
78
74
|
inputCount: number;
|
|
79
75
|
outputCount: number;
|
|
80
76
|
} | undefined;
|
|
81
|
-
|
|
82
|
-
type: "USER_PROMPT" | "AI_RESPONSE" | "TOOL_EXECUTION" | "AI_THINKING";
|
|
77
|
+
text?: string | undefined;
|
|
83
78
|
tool?: {
|
|
84
79
|
name: string;
|
|
85
80
|
parameters: string;
|
|
86
81
|
result: string;
|
|
87
|
-
accepted?: boolean | undefined;
|
|
88
82
|
rawArguments?: string | undefined;
|
|
83
|
+
accepted?: boolean | undefined;
|
|
89
84
|
} | undefined;
|
|
85
|
+
}, {
|
|
86
|
+
type: "USER_PROMPT" | "AI_RESPONSE" | "TOOL_EXECUTION" | "AI_THINKING";
|
|
90
87
|
date?: Date | undefined;
|
|
91
|
-
text?: string | undefined;
|
|
92
88
|
attachedFiles?: {
|
|
93
89
|
relativePath: string;
|
|
94
90
|
startLine?: number | undefined;
|
|
@@ -97,6 +93,14 @@ declare const PromptItemZ: z.ZodObject<{
|
|
|
97
93
|
inputCount: number;
|
|
98
94
|
outputCount: number;
|
|
99
95
|
} | undefined;
|
|
96
|
+
text?: string | undefined;
|
|
97
|
+
tool?: {
|
|
98
|
+
name: string;
|
|
99
|
+
parameters: string;
|
|
100
|
+
result: string;
|
|
101
|
+
rawArguments?: string | undefined;
|
|
102
|
+
accepted?: boolean | undefined;
|
|
103
|
+
} | undefined;
|
|
100
104
|
}>;
|
|
101
105
|
type PromptItem = z.infer<typeof PromptItemZ>;
|
|
102
106
|
declare const PromptItemArrayZ: z.ZodArray<z.ZodObject<{
|
|
@@ -133,26 +137,18 @@ declare const PromptItemArrayZ: z.ZodArray<z.ZodObject<{
|
|
|
133
137
|
name: string;
|
|
134
138
|
parameters: string;
|
|
135
139
|
result: string;
|
|
136
|
-
accepted?: boolean | undefined;
|
|
137
140
|
rawArguments?: string | undefined;
|
|
141
|
+
accepted?: boolean | undefined;
|
|
138
142
|
}, {
|
|
139
143
|
name: string;
|
|
140
144
|
parameters: string;
|
|
141
145
|
result: string;
|
|
142
|
-
accepted?: boolean | undefined;
|
|
143
146
|
rawArguments?: string | undefined;
|
|
147
|
+
accepted?: boolean | undefined;
|
|
144
148
|
}>>;
|
|
145
149
|
}, "strip", z.ZodTypeAny, {
|
|
146
150
|
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;
|
|
154
151
|
date?: Date | undefined;
|
|
155
|
-
text?: string | undefined;
|
|
156
152
|
attachedFiles?: {
|
|
157
153
|
relativePath: string;
|
|
158
154
|
startLine?: number | undefined;
|
|
@@ -161,17 +157,17 @@ declare const PromptItemArrayZ: z.ZodArray<z.ZodObject<{
|
|
|
161
157
|
inputCount: number;
|
|
162
158
|
outputCount: number;
|
|
163
159
|
} | undefined;
|
|
164
|
-
|
|
165
|
-
type: "USER_PROMPT" | "AI_RESPONSE" | "TOOL_EXECUTION" | "AI_THINKING";
|
|
160
|
+
text?: string | undefined;
|
|
166
161
|
tool?: {
|
|
167
162
|
name: string;
|
|
168
163
|
parameters: string;
|
|
169
164
|
result: string;
|
|
170
|
-
accepted?: boolean | undefined;
|
|
171
165
|
rawArguments?: string | undefined;
|
|
166
|
+
accepted?: boolean | undefined;
|
|
172
167
|
} | undefined;
|
|
168
|
+
}, {
|
|
169
|
+
type: "USER_PROMPT" | "AI_RESPONSE" | "TOOL_EXECUTION" | "AI_THINKING";
|
|
173
170
|
date?: Date | undefined;
|
|
174
|
-
text?: string | undefined;
|
|
175
171
|
attachedFiles?: {
|
|
176
172
|
relativePath: string;
|
|
177
173
|
startLine?: number | undefined;
|
|
@@ -180,6 +176,14 @@ declare const PromptItemArrayZ: z.ZodArray<z.ZodObject<{
|
|
|
180
176
|
inputCount: number;
|
|
181
177
|
outputCount: number;
|
|
182
178
|
} | undefined;
|
|
179
|
+
text?: string | undefined;
|
|
180
|
+
tool?: {
|
|
181
|
+
name: string;
|
|
182
|
+
parameters: string;
|
|
183
|
+
result: string;
|
|
184
|
+
rawArguments?: string | undefined;
|
|
185
|
+
accepted?: boolean | undefined;
|
|
186
|
+
} | undefined;
|
|
183
187
|
}>, "many">;
|
|
184
188
|
type PromptItemArray = z.infer<typeof PromptItemArrayZ>;
|
|
185
189
|
type UploadAiBlameOptions = {
|
|
@@ -210,7 +214,17 @@ declare function uploadAiBlameHandlerFromExtension(args: {
|
|
|
210
214
|
responseTime: string;
|
|
211
215
|
blameType?: AiBlameInferenceType;
|
|
212
216
|
sessionId?: string;
|
|
217
|
+
apiUrl?: string;
|
|
218
|
+
webAppUrl?: string;
|
|
213
219
|
}): Promise<UploadAiBlameResult>;
|
|
214
|
-
|
|
220
|
+
type UploadAiBlameHandlerOptions = {
|
|
221
|
+
args: UploadAiBlameOptions;
|
|
222
|
+
exitOnError?: boolean;
|
|
223
|
+
apiUrl?: string;
|
|
224
|
+
webAppUrl?: string;
|
|
225
|
+
logger?: Logger;
|
|
226
|
+
};
|
|
227
|
+
declare function uploadAiBlameHandler(options: UploadAiBlameHandlerOptions): Promise<void>;
|
|
228
|
+
declare function uploadAiBlameCommandHandler(args: UploadAiBlameOptions): Promise<void>;
|
|
215
229
|
|
|
216
|
-
export { type PromptItem, type PromptItemArray, type UploadAiBlameOptions, type UploadAiBlameResult, uploadAiBlameBuilder, uploadAiBlameHandler, uploadAiBlameHandlerFromExtension };
|
|
230
|
+
export { type PromptItem, type PromptItemArray, type UploadAiBlameOptions, type UploadAiBlameResult, uploadAiBlameBuilder, uploadAiBlameCommandHandler, uploadAiBlameHandler, uploadAiBlameHandlerFromExtension };
|
|
@@ -4734,6 +4734,11 @@ var GQLClient = class {
|
|
|
4734
4734
|
debug6(`init with ${args}`);
|
|
4735
4735
|
this._auth = args;
|
|
4736
4736
|
this._apiUrl = args.apiUrl || API_URL;
|
|
4737
|
+
debug6(
|
|
4738
|
+
"GQLClient constructor: resolved apiUrl=%s (from param: %s)",
|
|
4739
|
+
this._apiUrl,
|
|
4740
|
+
args.apiUrl || "fallback to API_URL constant"
|
|
4741
|
+
);
|
|
4737
4742
|
this._client = new GraphQLClient(this._apiUrl, {
|
|
4738
4743
|
headers: args.type === "apiKey" ? { [API_KEY_HEADER_NAME]: args.apiKey || "" } : {
|
|
4739
4744
|
Authorization: `Bearer ${args.token}`
|
|
@@ -5144,6 +5149,11 @@ async function getAuthenticatedGQLClient({
|
|
|
5144
5149
|
apiUrl,
|
|
5145
5150
|
webAppUrl
|
|
5146
5151
|
}) {
|
|
5152
|
+
debug7(
|
|
5153
|
+
"getAuthenticatedGQLClient called with: apiUrl=%s, webAppUrl=%s",
|
|
5154
|
+
apiUrl || "undefined",
|
|
5155
|
+
webAppUrl || "undefined"
|
|
5156
|
+
);
|
|
5147
5157
|
let gqlClient = new GQLClient({
|
|
5148
5158
|
apiKey: inputApiKey || configStore.get("apiToken") || "",
|
|
5149
5159
|
type: "apiKey",
|
|
@@ -5167,6 +5177,13 @@ async function handleMobbLogin({
|
|
|
5167
5177
|
}) {
|
|
5168
5178
|
const resolvedWebAppUrl = webAppUrl || WEB_APP_URL;
|
|
5169
5179
|
const resolvedApiUrl = apiUrl || API_URL;
|
|
5180
|
+
debug7(
|
|
5181
|
+
"handleMobbLogin: resolved URLs - apiUrl=%s (from param: %s), webAppUrl=%s (from param: %s)",
|
|
5182
|
+
resolvedApiUrl,
|
|
5183
|
+
apiUrl || "fallback",
|
|
5184
|
+
resolvedWebAppUrl,
|
|
5185
|
+
webAppUrl || "fallback"
|
|
5186
|
+
);
|
|
5170
5187
|
const { createSpinner } = Spinner({ ci: skipPrompts });
|
|
5171
5188
|
const isConnected = await inGqlClient.verifyApiConnection();
|
|
5172
5189
|
if (!isConnected) {
|
|
@@ -5447,6 +5464,22 @@ async function sanitizeDataWithCounts(obj) {
|
|
|
5447
5464
|
}
|
|
5448
5465
|
|
|
5449
5466
|
// src/args/commands/upload_ai_blame.ts
|
|
5467
|
+
var defaultLogger = {
|
|
5468
|
+
info: (msg, data) => {
|
|
5469
|
+
if (data !== void 0) {
|
|
5470
|
+
console.log(msg, data);
|
|
5471
|
+
} else {
|
|
5472
|
+
console.log(msg);
|
|
5473
|
+
}
|
|
5474
|
+
},
|
|
5475
|
+
error: (msg, data) => {
|
|
5476
|
+
if (data !== void 0) {
|
|
5477
|
+
console.error(msg, data);
|
|
5478
|
+
} else {
|
|
5479
|
+
console.error(msg);
|
|
5480
|
+
}
|
|
5481
|
+
}
|
|
5482
|
+
};
|
|
5450
5483
|
var PromptItemZ = z26.object({
|
|
5451
5484
|
type: z26.enum(["USER_PROMPT", "AI_RESPONSE", "TOOL_EXECUTION", "AI_THINKING"]),
|
|
5452
5485
|
attachedFiles: z26.array(
|
|
@@ -5562,7 +5595,12 @@ async function uploadAiBlameHandlerFromExtension(args) {
|
|
|
5562
5595
|
if (args.sessionId) {
|
|
5563
5596
|
uploadArgs.sessionId.push(args.sessionId);
|
|
5564
5597
|
}
|
|
5565
|
-
await uploadAiBlameHandler(
|
|
5598
|
+
await uploadAiBlameHandler({
|
|
5599
|
+
args: uploadArgs,
|
|
5600
|
+
exitOnError: false,
|
|
5601
|
+
apiUrl: args.apiUrl,
|
|
5602
|
+
webAppUrl: args.webAppUrl
|
|
5603
|
+
});
|
|
5566
5604
|
});
|
|
5567
5605
|
});
|
|
5568
5606
|
return {
|
|
@@ -5572,7 +5610,14 @@ async function uploadAiBlameHandlerFromExtension(args) {
|
|
|
5572
5610
|
inferenceUUID
|
|
5573
5611
|
};
|
|
5574
5612
|
}
|
|
5575
|
-
async function uploadAiBlameHandler(
|
|
5613
|
+
async function uploadAiBlameHandler(options) {
|
|
5614
|
+
const {
|
|
5615
|
+
args,
|
|
5616
|
+
exitOnError = true,
|
|
5617
|
+
apiUrl,
|
|
5618
|
+
webAppUrl,
|
|
5619
|
+
logger = defaultLogger
|
|
5620
|
+
} = options;
|
|
5576
5621
|
const prompts = args.prompt || [];
|
|
5577
5622
|
const inferences = args.inference || [];
|
|
5578
5623
|
const models = args.model || [];
|
|
@@ -5582,7 +5627,7 @@ async function uploadAiBlameHandler(args, exitOnError = true) {
|
|
|
5582
5627
|
const sessionIds = args.sessionId || args["session-id"] || [];
|
|
5583
5628
|
if (prompts.length !== inferences.length) {
|
|
5584
5629
|
const errorMsg = "prompt and inference must have the same number of entries";
|
|
5585
|
-
|
|
5630
|
+
logger.error(chalk3.red(errorMsg));
|
|
5586
5631
|
if (exitOnError) {
|
|
5587
5632
|
process.exit(1);
|
|
5588
5633
|
}
|
|
@@ -5601,7 +5646,7 @@ async function uploadAiBlameHandler(args, exitOnError = true) {
|
|
|
5601
5646
|
]);
|
|
5602
5647
|
} catch {
|
|
5603
5648
|
const errorMsg = `File not found for session ${i + 1}`;
|
|
5604
|
-
|
|
5649
|
+
logger.error(chalk3.red(errorMsg));
|
|
5605
5650
|
if (exitOnError) {
|
|
5606
5651
|
process.exit(1);
|
|
5607
5652
|
}
|
|
@@ -5620,7 +5665,9 @@ async function uploadAiBlameHandler(args, exitOnError = true) {
|
|
|
5620
5665
|
});
|
|
5621
5666
|
}
|
|
5622
5667
|
const authenticatedClient = await getAuthenticatedGQLClient({
|
|
5623
|
-
isSkipPrompts: true
|
|
5668
|
+
isSkipPrompts: true,
|
|
5669
|
+
apiUrl,
|
|
5670
|
+
webAppUrl
|
|
5624
5671
|
});
|
|
5625
5672
|
const initSessions = sessions.map(
|
|
5626
5673
|
({ sessionId: _sessionId, ...rest }) => rest
|
|
@@ -5631,7 +5678,7 @@ async function uploadAiBlameHandler(args, exitOnError = true) {
|
|
|
5631
5678
|
const uploadSessions = initRes.uploadAIBlameInferencesInit?.uploadSessions ?? [];
|
|
5632
5679
|
if (uploadSessions.length !== sessions.length) {
|
|
5633
5680
|
const errorMsg = "Init failed to return expected number of sessions";
|
|
5634
|
-
|
|
5681
|
+
logger.error(chalk3.red(errorMsg));
|
|
5635
5682
|
if (exitOnError) {
|
|
5636
5683
|
process.exit(1);
|
|
5637
5684
|
}
|
|
@@ -5673,22 +5720,41 @@ async function uploadAiBlameHandler(args, exitOnError = true) {
|
|
|
5673
5720
|
sessionId: s.sessionId
|
|
5674
5721
|
};
|
|
5675
5722
|
});
|
|
5676
|
-
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
|
|
5680
|
-
|
|
5681
|
-
|
|
5682
|
-
|
|
5683
|
-
|
|
5684
|
-
|
|
5723
|
+
try {
|
|
5724
|
+
logger.info(
|
|
5725
|
+
`[UPLOAD] Calling finalizeAIBlameInferencesUploadRaw with ${finalizeSessions.length} sessions`
|
|
5726
|
+
);
|
|
5727
|
+
const finRes = await authenticatedClient.finalizeAIBlameInferencesUploadRaw(
|
|
5728
|
+
{
|
|
5729
|
+
sessions: finalizeSessions
|
|
5730
|
+
}
|
|
5731
|
+
);
|
|
5732
|
+
logger.info("[UPLOAD] Finalize response:", JSON.stringify(finRes, null, 2));
|
|
5733
|
+
const status = finRes?.finalizeAIBlameInferencesUpload?.status;
|
|
5734
|
+
if (status !== "OK") {
|
|
5735
|
+
const errorMsg = finRes?.finalizeAIBlameInferencesUpload?.error || "unknown error";
|
|
5736
|
+
logger.error(
|
|
5737
|
+
chalk3.red(
|
|
5738
|
+
`[UPLOAD] Finalize failed with status: ${status}, error: ${errorMsg}`
|
|
5739
|
+
)
|
|
5740
|
+
);
|
|
5741
|
+
if (exitOnError) {
|
|
5742
|
+
process.exit(1);
|
|
5743
|
+
}
|
|
5744
|
+
throw new Error(errorMsg);
|
|
5685
5745
|
}
|
|
5686
|
-
|
|
5746
|
+
logger.info(chalk3.green("[UPLOAD] AI Blame uploads finalized successfully"));
|
|
5747
|
+
} catch (error) {
|
|
5748
|
+
logger.error("[UPLOAD] Finalize threw error:", error);
|
|
5749
|
+
throw error;
|
|
5687
5750
|
}
|
|
5688
|
-
|
|
5751
|
+
}
|
|
5752
|
+
async function uploadAiBlameCommandHandler(args) {
|
|
5753
|
+
await uploadAiBlameHandler({ args });
|
|
5689
5754
|
}
|
|
5690
5755
|
export {
|
|
5691
5756
|
uploadAiBlameBuilder,
|
|
5757
|
+
uploadAiBlameCommandHandler,
|
|
5692
5758
|
uploadAiBlameHandler,
|
|
5693
5759
|
uploadAiBlameHandlerFromExtension
|
|
5694
5760
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -11034,6 +11034,11 @@ var GQLClient = class {
|
|
|
11034
11034
|
debug6(`init with ${args}`);
|
|
11035
11035
|
this._auth = args;
|
|
11036
11036
|
this._apiUrl = args.apiUrl || API_URL;
|
|
11037
|
+
debug6(
|
|
11038
|
+
"GQLClient constructor: resolved apiUrl=%s (from param: %s)",
|
|
11039
|
+
this._apiUrl,
|
|
11040
|
+
args.apiUrl || "fallback to API_URL constant"
|
|
11041
|
+
);
|
|
11037
11042
|
this._client = new GraphQLClient(this._apiUrl, {
|
|
11038
11043
|
headers: args.type === "apiKey" ? { [API_KEY_HEADER_NAME]: args.apiKey || "" } : {
|
|
11039
11044
|
Authorization: `Bearer ${args.token}`
|
|
@@ -11464,6 +11469,11 @@ async function getAuthenticatedGQLClient({
|
|
|
11464
11469
|
apiUrl,
|
|
11465
11470
|
webAppUrl
|
|
11466
11471
|
}) {
|
|
11472
|
+
debug7(
|
|
11473
|
+
"getAuthenticatedGQLClient called with: apiUrl=%s, webAppUrl=%s",
|
|
11474
|
+
apiUrl || "undefined",
|
|
11475
|
+
webAppUrl || "undefined"
|
|
11476
|
+
);
|
|
11467
11477
|
let gqlClient = new GQLClient({
|
|
11468
11478
|
apiKey: inputApiKey || configStore.get("apiToken") || "",
|
|
11469
11479
|
type: "apiKey",
|
|
@@ -11487,6 +11497,13 @@ async function handleMobbLogin({
|
|
|
11487
11497
|
}) {
|
|
11488
11498
|
const resolvedWebAppUrl = webAppUrl || WEB_APP_URL;
|
|
11489
11499
|
const resolvedApiUrl = apiUrl || API_URL;
|
|
11500
|
+
debug7(
|
|
11501
|
+
"handleMobbLogin: resolved URLs - apiUrl=%s (from param: %s), webAppUrl=%s (from param: %s)",
|
|
11502
|
+
resolvedApiUrl,
|
|
11503
|
+
apiUrl || "fallback",
|
|
11504
|
+
resolvedWebAppUrl,
|
|
11505
|
+
webAppUrl || "fallback"
|
|
11506
|
+
);
|
|
11490
11507
|
const { createSpinner: createSpinner5 } = Spinner({ ci: skipPrompts });
|
|
11491
11508
|
const isConnected = await inGqlClient.verifyApiConnection();
|
|
11492
11509
|
if (!isConnected) {
|
|
@@ -13801,6 +13818,22 @@ async function sanitizeDataWithCounts(obj) {
|
|
|
13801
13818
|
}
|
|
13802
13819
|
|
|
13803
13820
|
// src/args/commands/upload_ai_blame.ts
|
|
13821
|
+
var defaultLogger2 = {
|
|
13822
|
+
info: (msg, data) => {
|
|
13823
|
+
if (data !== void 0) {
|
|
13824
|
+
console.log(msg, data);
|
|
13825
|
+
} else {
|
|
13826
|
+
console.log(msg);
|
|
13827
|
+
}
|
|
13828
|
+
},
|
|
13829
|
+
error: (msg, data) => {
|
|
13830
|
+
if (data !== void 0) {
|
|
13831
|
+
console.error(msg, data);
|
|
13832
|
+
} else {
|
|
13833
|
+
console.error(msg);
|
|
13834
|
+
}
|
|
13835
|
+
}
|
|
13836
|
+
};
|
|
13804
13837
|
var PromptItemZ = z31.object({
|
|
13805
13838
|
type: z31.enum(["USER_PROMPT", "AI_RESPONSE", "TOOL_EXECUTION", "AI_THINKING"]),
|
|
13806
13839
|
attachedFiles: z31.array(
|
|
@@ -13916,7 +13949,12 @@ async function uploadAiBlameHandlerFromExtension(args) {
|
|
|
13916
13949
|
if (args.sessionId) {
|
|
13917
13950
|
uploadArgs.sessionId.push(args.sessionId);
|
|
13918
13951
|
}
|
|
13919
|
-
await uploadAiBlameHandler(
|
|
13952
|
+
await uploadAiBlameHandler({
|
|
13953
|
+
args: uploadArgs,
|
|
13954
|
+
exitOnError: false,
|
|
13955
|
+
apiUrl: args.apiUrl,
|
|
13956
|
+
webAppUrl: args.webAppUrl
|
|
13957
|
+
});
|
|
13920
13958
|
});
|
|
13921
13959
|
});
|
|
13922
13960
|
return {
|
|
@@ -13926,7 +13964,14 @@ async function uploadAiBlameHandlerFromExtension(args) {
|
|
|
13926
13964
|
inferenceUUID
|
|
13927
13965
|
};
|
|
13928
13966
|
}
|
|
13929
|
-
async function uploadAiBlameHandler(
|
|
13967
|
+
async function uploadAiBlameHandler(options) {
|
|
13968
|
+
const {
|
|
13969
|
+
args,
|
|
13970
|
+
exitOnError = true,
|
|
13971
|
+
apiUrl,
|
|
13972
|
+
webAppUrl,
|
|
13973
|
+
logger: logger2 = defaultLogger2
|
|
13974
|
+
} = options;
|
|
13930
13975
|
const prompts = args.prompt || [];
|
|
13931
13976
|
const inferences = args.inference || [];
|
|
13932
13977
|
const models = args.model || [];
|
|
@@ -13936,7 +13981,7 @@ async function uploadAiBlameHandler(args, exitOnError = true) {
|
|
|
13936
13981
|
const sessionIds = args.sessionId || args["session-id"] || [];
|
|
13937
13982
|
if (prompts.length !== inferences.length) {
|
|
13938
13983
|
const errorMsg = "prompt and inference must have the same number of entries";
|
|
13939
|
-
|
|
13984
|
+
logger2.error(chalk9.red(errorMsg));
|
|
13940
13985
|
if (exitOnError) {
|
|
13941
13986
|
process.exit(1);
|
|
13942
13987
|
}
|
|
@@ -13955,7 +14000,7 @@ async function uploadAiBlameHandler(args, exitOnError = true) {
|
|
|
13955
14000
|
]);
|
|
13956
14001
|
} catch {
|
|
13957
14002
|
const errorMsg = `File not found for session ${i + 1}`;
|
|
13958
|
-
|
|
14003
|
+
logger2.error(chalk9.red(errorMsg));
|
|
13959
14004
|
if (exitOnError) {
|
|
13960
14005
|
process.exit(1);
|
|
13961
14006
|
}
|
|
@@ -13974,7 +14019,9 @@ async function uploadAiBlameHandler(args, exitOnError = true) {
|
|
|
13974
14019
|
});
|
|
13975
14020
|
}
|
|
13976
14021
|
const authenticatedClient = await getAuthenticatedGQLClient({
|
|
13977
|
-
isSkipPrompts: true
|
|
14022
|
+
isSkipPrompts: true,
|
|
14023
|
+
apiUrl,
|
|
14024
|
+
webAppUrl
|
|
13978
14025
|
});
|
|
13979
14026
|
const initSessions = sessions.map(
|
|
13980
14027
|
({ sessionId: _sessionId, ...rest }) => rest
|
|
@@ -13985,7 +14032,7 @@ async function uploadAiBlameHandler(args, exitOnError = true) {
|
|
|
13985
14032
|
const uploadSessions = initRes.uploadAIBlameInferencesInit?.uploadSessions ?? [];
|
|
13986
14033
|
if (uploadSessions.length !== sessions.length) {
|
|
13987
14034
|
const errorMsg = "Init failed to return expected number of sessions";
|
|
13988
|
-
|
|
14035
|
+
logger2.error(chalk9.red(errorMsg));
|
|
13989
14036
|
if (exitOnError) {
|
|
13990
14037
|
process.exit(1);
|
|
13991
14038
|
}
|
|
@@ -14027,19 +14074,37 @@ async function uploadAiBlameHandler(args, exitOnError = true) {
|
|
|
14027
14074
|
sessionId: s.sessionId
|
|
14028
14075
|
};
|
|
14029
14076
|
});
|
|
14030
|
-
|
|
14031
|
-
|
|
14032
|
-
|
|
14033
|
-
|
|
14034
|
-
|
|
14035
|
-
|
|
14036
|
-
|
|
14037
|
-
|
|
14038
|
-
|
|
14077
|
+
try {
|
|
14078
|
+
logger2.info(
|
|
14079
|
+
`[UPLOAD] Calling finalizeAIBlameInferencesUploadRaw with ${finalizeSessions.length} sessions`
|
|
14080
|
+
);
|
|
14081
|
+
const finRes = await authenticatedClient.finalizeAIBlameInferencesUploadRaw(
|
|
14082
|
+
{
|
|
14083
|
+
sessions: finalizeSessions
|
|
14084
|
+
}
|
|
14085
|
+
);
|
|
14086
|
+
logger2.info("[UPLOAD] Finalize response:", JSON.stringify(finRes, null, 2));
|
|
14087
|
+
const status = finRes?.finalizeAIBlameInferencesUpload?.status;
|
|
14088
|
+
if (status !== "OK") {
|
|
14089
|
+
const errorMsg = finRes?.finalizeAIBlameInferencesUpload?.error || "unknown error";
|
|
14090
|
+
logger2.error(
|
|
14091
|
+
chalk9.red(
|
|
14092
|
+
`[UPLOAD] Finalize failed with status: ${status}, error: ${errorMsg}`
|
|
14093
|
+
)
|
|
14094
|
+
);
|
|
14095
|
+
if (exitOnError) {
|
|
14096
|
+
process.exit(1);
|
|
14097
|
+
}
|
|
14098
|
+
throw new Error(errorMsg);
|
|
14039
14099
|
}
|
|
14040
|
-
|
|
14100
|
+
logger2.info(chalk9.green("[UPLOAD] AI Blame uploads finalized successfully"));
|
|
14101
|
+
} catch (error) {
|
|
14102
|
+
logger2.error("[UPLOAD] Finalize threw error:", error);
|
|
14103
|
+
throw error;
|
|
14041
14104
|
}
|
|
14042
|
-
|
|
14105
|
+
}
|
|
14106
|
+
async function uploadAiBlameCommandHandler(args) {
|
|
14107
|
+
await uploadAiBlameHandler({ args });
|
|
14043
14108
|
}
|
|
14044
14109
|
|
|
14045
14110
|
// src/features/claude_code/transcript_parser.ts
|
|
@@ -22792,7 +22857,7 @@ var parseArgs = async (args) => {
|
|
|
22792
22857
|
"Upload AI Blame inference artifacts (prompt + inference) and finalize them."
|
|
22793
22858
|
),
|
|
22794
22859
|
uploadAiBlameBuilder,
|
|
22795
|
-
|
|
22860
|
+
uploadAiBlameCommandHandler
|
|
22796
22861
|
).command(
|
|
22797
22862
|
mobbCliCommand.claudeCodeInstallHook,
|
|
22798
22863
|
chalk12.bold("Install Claude Code hooks for data collection."),
|