@resolveio/server-lib 22.1.23 → 22.1.24
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/methods/ai-terminal.js +287 -124
- package/methods/ai-terminal.js.map +1 -1
- package/package.json +1 -1
package/methods/ai-terminal.js
CHANGED
|
@@ -1718,7 +1718,7 @@ function executeAiAssistantCodexRun(payload, context) {
|
|
|
1718
1718
|
insertResult = _d.sent();
|
|
1719
1719
|
assistantMessageId = (insertResult === null || insertResult === void 0 ? void 0 : insertResult._id) || (insertResult === null || insertResult === void 0 ? void 0 : insertResult.insertedId);
|
|
1720
1720
|
enqueueAssistantCodexRun(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1721
|
-
var runStart, steps, recordStep, progressTracker, streamProgress, assistantContent, toolResult, assistantDebug, directiveSource, requestClassification, dataQuestion, lastDirective, heuristicDirectivePrecomputed, usedDeterministicHeuristicFastPath, requestedTimeGrain, requestedBreakdownDimensions, enforceDatedDirective, enforceGroupedDirective, datedDirectiveRetryUsed, datedDirectiveResolved, toolResponseDebug, toolError, termHints, collectionHints, fieldHints, methodHints, publicationHints, collectionTokenization, collectionRanking, collectionSelection, collectionOverride, collectionNames, plannerEnabled, plannerUsed, plannerSkipReason, plannerOutput, plannerRaw, timingBreakdown, codexUsage, accumulateCodexUsage, contextRoute, contextMode, hintSeed, termExpansion, hintText, baseTokens, expandedTokens, baseWeights, expandedWeights, dbName, db, surfaceHints, _a, allowedRoutes, rankedAllowedRoutes, routeHints, rankedCollectionHints, rankedCollections, hintCollections, assistantContext, hasDeterministicHeuristicFastPath, prompt_1, workspaceRoot, codexConfig, runOptions, plannerRunOptions, shouldRunPlanner, plannerPrompt, plannerStart, _b, preferListDirective, directiveStyleHint, directivePromptMode, responseText, directiveText, directive, heuristicDirectiveFastPath, directivePrompt, directiveStart, forcedDirective, _c, initialStart, extractedDirective, error_2, directivePrompt, forcedStart, forcedDirective, _d, strictDirectivePrompt, strictStart, strictDirectiveText, strictDirective, strictDirectiveIsDated, shouldUseStrictDirective, _e, guardDirectivePrompt, guardStart, guardDirectiveText, guardDirective, _f, groupedDirectivePrompt, groupedStart, groupedDirectiveText, groupedDirective, _g, heuristicDirective, requestedCollection, allowCollectionOverride, cleanedResponseText, effectiveDirective, toolRequest, toolStart, toolResponse, _h, toolPayload, skipFollowupCodex, followupPrompt, followupStart, followupText, _j, error_3, error_4, finishedAt, finalNow, finishedAt, codexMs, draftingMs, finalMetadata, finalUsage, usageClientId, usageError_1, finalAssistantDoc, setPayload;
|
|
1721
|
+
var runStart, steps, recordStep, progressTracker, streamProgress, assistantContent, toolResult, assistantDebug, directiveSource, requestClassification, dataQuestion, lastDirective, heuristicDirectivePrecomputed, usedDeterministicHeuristicFastPath, requestedTimeGrain, requestedBreakdownDimensions, enforceDatedDirective, enforceGroupedDirective, datedDirectiveRetryUsed, datedDirectiveResolved, toolResponseDebug, toolError, termHints, collectionHints, fieldHints, methodHints, publicationHints, collectionTokenization, collectionRanking, collectionSelection, collectionOverride, collectionNames, plannerEnabled, plannerUsed, plannerSkipReason, plannerOutput, plannerRaw, timingBreakdown, codexUsage, accumulateCodexUsage, contextRoute, contextMode, hintSeed, termExpansion, hintText, baseTokens, expandedTokens, baseWeights, expandedWeights, dbName, db, surfaceHints, _a, allowedRoutes, rankedAllowedRoutes, routeHints, rankedCollectionHints, rankedCollections, hintCollections, assistantContext, hasDeterministicHeuristicFastPath, prompt_1, workspaceRoot, codexConfig, runOptions, plannerRunOptions, shouldRunPlanner, plannerPrompt, plannerStart, _b, preferListDirective, directiveStyleHint, directivePromptMode, responseText, directiveText, directive, heuristicDirectiveFastPath, directivePrompt, directiveStart, forcedDirective, _c, initialStart, extractedDirective, error_2, directivePrompt, forcedStart, forcedDirective, _d, strictDirectivePrompt, strictStart, strictDirectiveText, strictDirective, strictDirectiveIsDated, shouldUseStrictDirective, _e, guardDirectivePrompt, guardStart, guardDirectiveText, guardDirective, _f, groupedDirectivePrompt, groupedStart, groupedDirectiveText, groupedDirective, _g, heuristicDirective, requestedCollection, allowCollectionOverride, cleanedResponseText, denyInvoiceDataByIntent, effectiveDirective, toolRequest, toolStart, toolResponse, _h, toolPayload, skipFollowupCodex, followupPrompt, followupStart, followupText, _j, error_3, error_4, finishedAt, finalNow, finishedAt, codexMs, draftingMs, finalMetadata, finalUsage, usageClientId, usageError_1, finalAssistantDoc, setPayload;
|
|
1722
1722
|
var _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12;
|
|
1723
1723
|
return __generator(this, function (_13) {
|
|
1724
1724
|
switch (_13.label) {
|
|
@@ -1816,7 +1816,7 @@ function executeAiAssistantCodexRun(payload, context) {
|
|
|
1816
1816
|
});
|
|
1817
1817
|
_13.label = 1;
|
|
1818
1818
|
case 1:
|
|
1819
|
-
_13.trys.push([1,
|
|
1819
|
+
_13.trys.push([1, 53, 54, 55]);
|
|
1820
1820
|
hintSeed = [message, contextRoute].filter(Boolean).join(' ');
|
|
1821
1821
|
termExpansion = expandAssistantTermSynonyms(hintSeed);
|
|
1822
1822
|
hintText = termExpansion.expanded || hintSeed;
|
|
@@ -2329,7 +2329,20 @@ function executeAiAssistantCodexRun(payload, context) {
|
|
|
2329
2329
|
if (cleanedResponseText) {
|
|
2330
2330
|
assistantContent = sanitizeAssistantResponse(cleanedResponseText);
|
|
2331
2331
|
}
|
|
2332
|
-
|
|
2332
|
+
denyInvoiceDataByIntent = dataQuestion
|
|
2333
|
+
&& !isSuperAdmin
|
|
2334
|
+
&& !hasInvoiceAccess
|
|
2335
|
+
&& assistantMessageRequestsInvoiceData(message);
|
|
2336
|
+
if (!denyInvoiceDataByIntent) return [3 /*break*/, 38];
|
|
2337
|
+
progressTracker.push('Grabbing Data');
|
|
2338
|
+
recordStep('Grabbing Data: denied', {
|
|
2339
|
+
reason: 'invoice_permission_required'
|
|
2340
|
+
});
|
|
2341
|
+
assistantContent = 'I couldn\'t run the data query because this account does not have permission for that dataset.';
|
|
2342
|
+
toolError = new Error('AI assistant report builder bridge: Access denied.');
|
|
2343
|
+
return [3 /*break*/, 52];
|
|
2344
|
+
case 38:
|
|
2345
|
+
if (!((directive === null || directive === void 0 ? void 0 : directive.payload) && AI_ASSISTANT_TOOL_MAX_STEPS > 0)) return [3 /*break*/, 51];
|
|
2333
2346
|
effectiveDirective = collectionOverride
|
|
2334
2347
|
? __assign(__assign({}, directive), { payload: __assign(__assign({}, (directive.payload || {})), { collection: collectionOverride.to }) }) : directive;
|
|
2335
2348
|
toolRequest = buildAssistantToolRequest(effectiveDirective, input);
|
|
@@ -2339,20 +2352,20 @@ function executeAiAssistantCodexRun(payload, context) {
|
|
|
2339
2352
|
collection: normalizeOptionalString(toolRequest === null || toolRequest === void 0 ? void 0 : toolRequest.collection) || undefined,
|
|
2340
2353
|
permissionView: normalizeOptionalString(toolRequest === null || toolRequest === void 0 ? void 0 : toolRequest.permissionView) || undefined
|
|
2341
2354
|
});
|
|
2342
|
-
_13.label =
|
|
2343
|
-
case
|
|
2344
|
-
_13.trys.push([
|
|
2355
|
+
_13.label = 39;
|
|
2356
|
+
case 39:
|
|
2357
|
+
_13.trys.push([39, 49, , 50]);
|
|
2345
2358
|
toolStart = Date.now();
|
|
2346
|
-
if (!(effectiveDirective.type === 'aggregate')) return [3 /*break*/,
|
|
2359
|
+
if (!(effectiveDirective.type === 'aggregate')) return [3 /*break*/, 41];
|
|
2347
2360
|
return [4 /*yield*/, executeAiAssistantReportBuilderAggregate(toolRequest, context)];
|
|
2348
|
-
case
|
|
2349
|
-
_h = _13.sent();
|
|
2350
|
-
return [3 /*break*/, 42];
|
|
2351
|
-
case 40: return [4 /*yield*/, executeAiAssistantReportBuilderRead(toolRequest, context)];
|
|
2352
|
-
case 41:
|
|
2361
|
+
case 40:
|
|
2353
2362
|
_h = _13.sent();
|
|
2354
|
-
|
|
2363
|
+
return [3 /*break*/, 43];
|
|
2364
|
+
case 41: return [4 /*yield*/, executeAiAssistantReportBuilderRead(toolRequest, context)];
|
|
2355
2365
|
case 42:
|
|
2366
|
+
_h = _13.sent();
|
|
2367
|
+
_13.label = 43;
|
|
2368
|
+
case 43:
|
|
2356
2369
|
toolResponse = _h;
|
|
2357
2370
|
timingBreakdown.toolMs = Date.now() - toolStart;
|
|
2358
2371
|
toolResponseDebug = (toolResponse === null || toolResponse === void 0 ? void 0 : toolResponse.debug) && typeof toolResponse.debug === 'object'
|
|
@@ -2368,54 +2381,54 @@ function executeAiAssistantCodexRun(payload, context) {
|
|
|
2368
2381
|
progressTracker.push('Drafting response');
|
|
2369
2382
|
skipFollowupCodex = usedDeterministicHeuristicFastPath
|
|
2370
2383
|
|| isAssistantDeterministicHeuristicDirective(effectiveDirective);
|
|
2371
|
-
if (!skipFollowupCodex) return [3 /*break*/,
|
|
2384
|
+
if (!skipFollowupCodex) return [3 /*break*/, 44];
|
|
2372
2385
|
recordStep('Drafting response: deterministic summary', {
|
|
2373
2386
|
reason: normalizeOptionalString(effectiveDirective.rawLine) || 'deterministic_heuristic'
|
|
2374
2387
|
});
|
|
2375
2388
|
assistantContent = buildAssistantToolFallbackResponse(toolPayload.result);
|
|
2376
2389
|
assistantContent = applyAssistantDisplayTableToResponse(assistantContent, toolPayload.result.output.display);
|
|
2377
|
-
return [3 /*break*/,
|
|
2378
|
-
case
|
|
2390
|
+
return [3 /*break*/, 48];
|
|
2391
|
+
case 44:
|
|
2379
2392
|
recordStep('Drafting response');
|
|
2380
2393
|
followupPrompt = buildAssistantCodexToolFollowupPrompt(message, attachmentData.promptText, historyLines.join('\n'), assistantContext, toolPayload.prompt);
|
|
2381
|
-
_13.label =
|
|
2382
|
-
case
|
|
2383
|
-
_13.trys.push([
|
|
2394
|
+
_13.label = 45;
|
|
2395
|
+
case 45:
|
|
2396
|
+
_13.trys.push([45, 47, , 48]);
|
|
2384
2397
|
followupStart = Date.now();
|
|
2385
2398
|
return [4 /*yield*/, runCodexInWorkerThread(followupPrompt, runOptions, codexConfig, streamProgress)];
|
|
2386
|
-
case
|
|
2399
|
+
case 46:
|
|
2387
2400
|
followupText = _13.sent();
|
|
2388
2401
|
accumulateCodexUsage(followupPrompt, followupText);
|
|
2389
2402
|
timingBreakdown.followupMs = Date.now() - followupStart;
|
|
2390
2403
|
assistantContent = sanitizeAssistantResponse(followupText);
|
|
2391
2404
|
assistantContent = applyAssistantDisplayTableToResponse(assistantContent, toolPayload.result.output.display);
|
|
2392
|
-
return [3 /*break*/,
|
|
2393
|
-
case
|
|
2405
|
+
return [3 /*break*/, 48];
|
|
2406
|
+
case 47:
|
|
2394
2407
|
_j = _13.sent();
|
|
2395
2408
|
assistantContent = buildAssistantToolFallbackResponse(toolPayload.result);
|
|
2396
2409
|
assistantContent = applyAssistantDisplayTableToResponse(assistantContent, toolPayload.result.output.display);
|
|
2397
|
-
return [3 /*break*/,
|
|
2398
|
-
case
|
|
2399
|
-
case
|
|
2410
|
+
return [3 /*break*/, 48];
|
|
2411
|
+
case 48: return [3 /*break*/, 50];
|
|
2412
|
+
case 49:
|
|
2400
2413
|
error_3 = _13.sent();
|
|
2401
2414
|
assistantContent = buildAssistantToolErrorMessage(error_3);
|
|
2402
2415
|
toolError = error_3;
|
|
2403
|
-
return [3 /*break*/,
|
|
2404
|
-
case
|
|
2405
|
-
case
|
|
2416
|
+
return [3 /*break*/, 50];
|
|
2417
|
+
case 50: return [3 /*break*/, 52];
|
|
2418
|
+
case 51:
|
|
2406
2419
|
progressTracker.push('Drafting response');
|
|
2407
2420
|
recordStep('Drafting response');
|
|
2408
|
-
_13.label =
|
|
2409
|
-
case
|
|
2410
|
-
case
|
|
2421
|
+
_13.label = 52;
|
|
2422
|
+
case 52: return [3 /*break*/, 55];
|
|
2423
|
+
case 53:
|
|
2411
2424
|
error_4 = _13.sent();
|
|
2412
2425
|
assistantContent = buildAssistantCodexErrorMessage(error_4);
|
|
2413
2426
|
recordStep('Error', { message: normalizeOptionalString(error_4 === null || error_4 === void 0 ? void 0 : error_4.message) || 'Unknown error' });
|
|
2414
|
-
return [3 /*break*/,
|
|
2415
|
-
case
|
|
2427
|
+
return [3 /*break*/, 55];
|
|
2428
|
+
case 54:
|
|
2416
2429
|
progressTracker.stop();
|
|
2417
2430
|
return [7 /*endfinally*/];
|
|
2418
|
-
case
|
|
2431
|
+
case 55:
|
|
2419
2432
|
if (!assistantContent) {
|
|
2420
2433
|
assistantContent = buildAssistantCodexErrorMessage(null);
|
|
2421
2434
|
}
|
|
@@ -2515,14 +2528,14 @@ function executeAiAssistantCodexRun(payload, context) {
|
|
|
2515
2528
|
output_tokens: codexUsage.output_tokens,
|
|
2516
2529
|
total_tokens: codexUsage.total_tokens
|
|
2517
2530
|
} : null;
|
|
2518
|
-
if (!finalUsage) return [3 /*break*/,
|
|
2531
|
+
if (!finalUsage) return [3 /*break*/, 60];
|
|
2519
2532
|
return [4 /*yield*/, resolveClientId(conversation, input.id_client, context === null || context === void 0 ? void 0 : context.id_user)];
|
|
2520
|
-
case 55:
|
|
2521
|
-
usageClientId = _13.sent();
|
|
2522
|
-
if (!usageClientId) return [3 /*break*/, 59];
|
|
2523
|
-
_13.label = 56;
|
|
2524
2533
|
case 56:
|
|
2525
|
-
_13.
|
|
2534
|
+
usageClientId = _13.sent();
|
|
2535
|
+
if (!usageClientId) return [3 /*break*/, 60];
|
|
2536
|
+
_13.label = 57;
|
|
2537
|
+
case 57:
|
|
2538
|
+
_13.trys.push([57, 59, , 60]);
|
|
2526
2539
|
return [4 /*yield*/, (0, openai_usage_ledger_manager_1.recordOpenAIUsage)({
|
|
2527
2540
|
id_client: usageClientId,
|
|
2528
2541
|
model: finalUsage.model,
|
|
@@ -2533,16 +2546,16 @@ function executeAiAssistantCodexRun(payload, context) {
|
|
|
2533
2546
|
id_request: requestId || undefined,
|
|
2534
2547
|
id_conversation: conversation._id
|
|
2535
2548
|
})];
|
|
2536
|
-
case 57:
|
|
2537
|
-
_13.sent();
|
|
2538
|
-
return [3 /*break*/, 59];
|
|
2539
2549
|
case 58:
|
|
2550
|
+
_13.sent();
|
|
2551
|
+
return [3 /*break*/, 60];
|
|
2552
|
+
case 59:
|
|
2540
2553
|
usageError_1 = _13.sent();
|
|
2541
2554
|
console.error(new Date(), 'Failed to record codex usage', usageError_1);
|
|
2542
|
-
return [3 /*break*/,
|
|
2543
|
-
case
|
|
2555
|
+
return [3 /*break*/, 60];
|
|
2556
|
+
case 60:
|
|
2544
2557
|
finalAssistantDoc = __assign(__assign(__assign(__assign({}, assistantDoc), { _id: assistantMessageId, content: assistantContent, metadata: finalMetadata }), (finalUsage ? { usage: finalUsage } : {})), { updatedAt: finalNow });
|
|
2545
|
-
if (!assistantMessageId) return [3 /*break*/,
|
|
2558
|
+
if (!assistantMessageId) return [3 /*break*/, 62];
|
|
2546
2559
|
setPayload = {
|
|
2547
2560
|
content: assistantContent,
|
|
2548
2561
|
metadata: finalMetadata,
|
|
@@ -2552,18 +2565,18 @@ function executeAiAssistantCodexRun(payload, context) {
|
|
|
2552
2565
|
setPayload.usage = finalUsage;
|
|
2553
2566
|
}
|
|
2554
2567
|
return [4 /*yield*/, updateAssistantMessageWithFallback(assistantMessageId, setPayload)];
|
|
2555
|
-
case
|
|
2568
|
+
case 61:
|
|
2556
2569
|
_13.sent();
|
|
2557
|
-
_13.label =
|
|
2558
|
-
case
|
|
2559
|
-
case
|
|
2570
|
+
_13.label = 62;
|
|
2571
|
+
case 62: return [4 /*yield*/, touchConversation(conversation._id, finalNow, assistantMessageId ? String(assistantMessageId) : undefined)];
|
|
2572
|
+
case 63:
|
|
2560
2573
|
_13.sent();
|
|
2561
|
-
if (!(input.delete_files_after_run !== false)) return [3 /*break*/,
|
|
2574
|
+
if (!(input.delete_files_after_run !== false)) return [3 /*break*/, 65];
|
|
2562
2575
|
return [4 /*yield*/, cleanupAttachments(attachmentData.attachments)];
|
|
2563
|
-
case
|
|
2576
|
+
case 64:
|
|
2564
2577
|
_13.sent();
|
|
2565
|
-
_13.label =
|
|
2566
|
-
case
|
|
2578
|
+
_13.label = 65;
|
|
2579
|
+
case 65: return [2 /*return*/, finalAssistantDoc];
|
|
2567
2580
|
}
|
|
2568
2581
|
});
|
|
2569
2582
|
}); });
|
|
@@ -9694,7 +9707,8 @@ function ensureAssistantReadAccess(context, permissionView, collection) {
|
|
|
9694
9707
|
if (!normalizedPermission) {
|
|
9695
9708
|
throw new Error('AI assistant report builder bridge: Permission scope required.');
|
|
9696
9709
|
}
|
|
9697
|
-
requiresInvoiceAccess = normalizedCollection ? requiresInvoicePermission(normalizedCollection) : false
|
|
9710
|
+
requiresInvoiceAccess = (normalizedCollection ? requiresInvoicePermission(normalizedCollection) : false)
|
|
9711
|
+
|| /invoice/i.test(normalizedPermission);
|
|
9698
9712
|
hasInvoiceAccess = requiresInvoiceAccess && userHasInvoiceAccess(user);
|
|
9699
9713
|
hasViewAccess = userHasViewPermission(user, normalizedPermission);
|
|
9700
9714
|
if (!hasViewAccess && !hasInvoiceAccess) {
|
|
@@ -16281,27 +16295,166 @@ function fetchAssistantProbeDocs(params) {
|
|
|
16281
16295
|
})
|
|
16282
16296
|
.toArray();
|
|
16283
16297
|
}
|
|
16284
|
-
|
|
16285
|
-
|
|
16286
|
-
|
|
16298
|
+
var AI_ASSISTANT_PERMISSION_ACTION_TOKENS = new Set([
|
|
16299
|
+
'list',
|
|
16300
|
+
'detail',
|
|
16301
|
+
'new',
|
|
16302
|
+
'edit',
|
|
16303
|
+
'delete',
|
|
16304
|
+
'create',
|
|
16305
|
+
'dashboard',
|
|
16306
|
+
'report',
|
|
16307
|
+
'reports',
|
|
16308
|
+
'calendar',
|
|
16309
|
+
'board',
|
|
16310
|
+
'timeline',
|
|
16311
|
+
'settings',
|
|
16312
|
+
'setting',
|
|
16313
|
+
'view'
|
|
16314
|
+
]);
|
|
16315
|
+
function tokenizeAssistantPermissionScope(value) {
|
|
16316
|
+
var normalizedRoute = normalizeRouteMatchKey(value);
|
|
16317
|
+
if (!normalizedRoute) {
|
|
16318
|
+
return [];
|
|
16319
|
+
}
|
|
16320
|
+
var rawTokens = normalizedRoute
|
|
16321
|
+
.split(/[^a-z0-9]+/g)
|
|
16322
|
+
.map(function (token) { return token.trim(); })
|
|
16323
|
+
.filter(Boolean);
|
|
16324
|
+
var tokens = [];
|
|
16325
|
+
rawTokens.forEach(function (token) {
|
|
16326
|
+
normalizeCollectionToken(token).forEach(function (normalized) {
|
|
16327
|
+
if (!normalized) {
|
|
16328
|
+
return;
|
|
16329
|
+
}
|
|
16330
|
+
tokens.push(normalized);
|
|
16331
|
+
});
|
|
16332
|
+
});
|
|
16333
|
+
return Array.from(new Set(tokens));
|
|
16334
|
+
}
|
|
16335
|
+
function splitAssistantPermissionTokenSets(value) {
|
|
16336
|
+
var tokens = tokenizeAssistantPermissionScope(value);
|
|
16337
|
+
var actionTokens = new Set();
|
|
16338
|
+
var domainTokens = new Set();
|
|
16339
|
+
tokens.forEach(function (token) {
|
|
16340
|
+
if (AI_ASSISTANT_PERMISSION_ACTION_TOKENS.has(token)) {
|
|
16341
|
+
actionTokens.add(token);
|
|
16342
|
+
return;
|
|
16343
|
+
}
|
|
16344
|
+
domainTokens.add(token);
|
|
16345
|
+
});
|
|
16346
|
+
return {
|
|
16347
|
+
tokens: new Set(tokens),
|
|
16348
|
+
domainTokens: domainTokens,
|
|
16349
|
+
actionTokens: actionTokens
|
|
16350
|
+
};
|
|
16351
|
+
}
|
|
16352
|
+
function isAssistantTokenSetSubset(subset, superset) {
|
|
16353
|
+
var e_43, _a;
|
|
16354
|
+
if (!subset.size) {
|
|
16287
16355
|
return false;
|
|
16288
16356
|
}
|
|
16289
|
-
|
|
16357
|
+
try {
|
|
16358
|
+
for (var subset_1 = __values(subset), subset_1_1 = subset_1.next(); !subset_1_1.done; subset_1_1 = subset_1.next()) {
|
|
16359
|
+
var token = subset_1_1.value;
|
|
16360
|
+
if (!superset.has(token)) {
|
|
16361
|
+
return false;
|
|
16362
|
+
}
|
|
16363
|
+
}
|
|
16364
|
+
}
|
|
16365
|
+
catch (e_43_1) { e_43 = { error: e_43_1 }; }
|
|
16366
|
+
finally {
|
|
16367
|
+
try {
|
|
16368
|
+
if (subset_1_1 && !subset_1_1.done && (_a = subset_1.return)) _a.call(subset_1);
|
|
16369
|
+
}
|
|
16370
|
+
finally { if (e_43) throw e_43.error; }
|
|
16371
|
+
}
|
|
16372
|
+
return true;
|
|
16373
|
+
}
|
|
16374
|
+
function buildAssistantPermissionRegex(value) {
|
|
16375
|
+
var tokens = tokenizeAssistantPermissionScope(value);
|
|
16376
|
+
if (!tokens.length) {
|
|
16377
|
+
return null;
|
|
16378
|
+
}
|
|
16379
|
+
var _a = __read(tokens), first = _a[0], rest = _a.slice(1);
|
|
16380
|
+
var pattern = "(?:^|[^a-z0-9])".concat(escapeRegexValue(first), "s?");
|
|
16381
|
+
rest.forEach(function (token) {
|
|
16382
|
+
pattern += "(?:[^a-z0-9]+".concat(escapeRegexValue(token), "s?)");
|
|
16383
|
+
});
|
|
16384
|
+
pattern += '(?:$|[^a-z0-9])';
|
|
16385
|
+
return new RegExp(pattern, 'i');
|
|
16386
|
+
}
|
|
16387
|
+
function isAssistantViewPermissionMatch(grantedPermission, requestedView) {
|
|
16388
|
+
var grantedRoute = normalizeRouteMatchKey(grantedPermission);
|
|
16389
|
+
var requestedRoute = normalizeRouteMatchKey(requestedView);
|
|
16390
|
+
if (!grantedRoute || !requestedRoute) {
|
|
16391
|
+
return false;
|
|
16392
|
+
}
|
|
16393
|
+
if (grantedRoute === requestedRoute
|
|
16394
|
+
|| grantedRoute.startsWith("".concat(requestedRoute, "/"))
|
|
16395
|
+
|| requestedRoute.startsWith("".concat(grantedRoute, "/"))) {
|
|
16290
16396
|
return true;
|
|
16291
16397
|
}
|
|
16292
|
-
var
|
|
16293
|
-
var
|
|
16294
|
-
if (
|
|
16398
|
+
var grantedTokens = splitAssistantPermissionTokenSets(grantedRoute);
|
|
16399
|
+
var requestedTokens = splitAssistantPermissionTokenSets(requestedRoute);
|
|
16400
|
+
if (!grantedTokens.tokens.size || !requestedTokens.tokens.size) {
|
|
16401
|
+
return false;
|
|
16402
|
+
}
|
|
16403
|
+
if (grantedTokens.actionTokens.size && requestedTokens.actionTokens.size) {
|
|
16404
|
+
var hasSharedAction = Array.from(requestedTokens.actionTokens)
|
|
16405
|
+
.some(function (token) { return grantedTokens.actionTokens.has(token); });
|
|
16406
|
+
if (!hasSharedAction) {
|
|
16407
|
+
return false;
|
|
16408
|
+
}
|
|
16409
|
+
}
|
|
16410
|
+
if (!grantedTokens.domainTokens.size || !requestedTokens.domainTokens.size) {
|
|
16411
|
+
return false;
|
|
16412
|
+
}
|
|
16413
|
+
if (isAssistantTokenSetSubset(requestedTokens.domainTokens, grantedTokens.domainTokens)) {
|
|
16414
|
+
return true;
|
|
16415
|
+
}
|
|
16416
|
+
if (requestedTokens.domainTokens.size > 1
|
|
16417
|
+
&& grantedTokens.domainTokens.size > 1
|
|
16418
|
+
&& isAssistantTokenSetSubset(grantedTokens.domainTokens, requestedTokens.domainTokens)) {
|
|
16419
|
+
return true;
|
|
16420
|
+
}
|
|
16421
|
+
var sharedTokenCount = 0;
|
|
16422
|
+
requestedTokens.tokens.forEach(function (token) {
|
|
16423
|
+
if (grantedTokens.tokens.has(token)) {
|
|
16424
|
+
sharedTokenCount += 1;
|
|
16425
|
+
}
|
|
16426
|
+
});
|
|
16427
|
+
var requestedCoverage = requestedTokens.tokens.size
|
|
16428
|
+
? sharedTokenCount / requestedTokens.tokens.size
|
|
16429
|
+
: 0;
|
|
16430
|
+
if (sharedTokenCount >= 2 && requestedCoverage >= 0.8) {
|
|
16295
16431
|
return true;
|
|
16296
16432
|
}
|
|
16297
|
-
|
|
16433
|
+
var requestedRegex = buildAssistantPermissionRegex(requestedRoute);
|
|
16434
|
+
if (requestedRegex && requestedRegex.test(grantedRoute)) {
|
|
16298
16435
|
return true;
|
|
16299
16436
|
}
|
|
16300
|
-
|
|
16437
|
+
var grantedRegex = buildAssistantPermissionRegex(grantedRoute);
|
|
16438
|
+
if (grantedRegex && grantedRegex.test(requestedRoute)) {
|
|
16301
16439
|
return true;
|
|
16302
16440
|
}
|
|
16303
16441
|
return false;
|
|
16304
16442
|
}
|
|
16443
|
+
function userHasViewPermission(user, view) {
|
|
16444
|
+
var _a, _b;
|
|
16445
|
+
if (!user || !view) {
|
|
16446
|
+
return false;
|
|
16447
|
+
}
|
|
16448
|
+
if ((_a = user.roles) === null || _a === void 0 ? void 0 : _a.super_admin) {
|
|
16449
|
+
return true;
|
|
16450
|
+
}
|
|
16451
|
+
var permissions = collectUserViewPermissions(user);
|
|
16452
|
+
if (permissions.some(function (permission) { return isAssistantViewPermissionMatch(permission, view); })) {
|
|
16453
|
+
return true;
|
|
16454
|
+
}
|
|
16455
|
+
var groups = Array.isArray((_b = user.roles) === null || _b === void 0 ? void 0 : _b.groups) ? user.roles.groups : [];
|
|
16456
|
+
return groups.some(function (group) { return isAssistantViewPermissionMatch(normalizeOptionalString(group === null || group === void 0 ? void 0 : group.name), view); });
|
|
16457
|
+
}
|
|
16305
16458
|
function collectUserViewPermissions(user) {
|
|
16306
16459
|
var _a, _b;
|
|
16307
16460
|
if (!user) {
|
|
@@ -16327,7 +16480,7 @@ function collectUserViewPermissions(user) {
|
|
|
16327
16480
|
return collected;
|
|
16328
16481
|
}
|
|
16329
16482
|
function userHasViewTokenPermission(user, tokenRegex) {
|
|
16330
|
-
var _a;
|
|
16483
|
+
var _a, _b;
|
|
16331
16484
|
if (!user || !tokenRegex) {
|
|
16332
16485
|
return false;
|
|
16333
16486
|
}
|
|
@@ -16335,7 +16488,11 @@ function userHasViewTokenPermission(user, tokenRegex) {
|
|
|
16335
16488
|
return true;
|
|
16336
16489
|
}
|
|
16337
16490
|
var permissions = collectUserViewPermissions(user);
|
|
16338
|
-
|
|
16491
|
+
if (permissions.some(function (view) { return tokenRegex.test(view); })) {
|
|
16492
|
+
return true;
|
|
16493
|
+
}
|
|
16494
|
+
var groups = Array.isArray((_b = user.roles) === null || _b === void 0 ? void 0 : _b.groups) ? user.roles.groups : [];
|
|
16495
|
+
return groups.some(function (group) { return tokenRegex.test(normalizeOptionalString(group === null || group === void 0 ? void 0 : group.name)); });
|
|
16339
16496
|
}
|
|
16340
16497
|
function userHasInvoiceAccess(user) {
|
|
16341
16498
|
return userHasViewTokenPermission(user, /invoice/i);
|
|
@@ -16355,6 +16512,13 @@ function requiresInvoicePermission(collection) {
|
|
|
16355
16512
|
}
|
|
16356
16513
|
return normalized.includes('invoice');
|
|
16357
16514
|
}
|
|
16515
|
+
function assistantMessageRequestsInvoiceData(message) {
|
|
16516
|
+
var normalized = normalizeOptionalString(message).toLowerCase();
|
|
16517
|
+
if (!normalized) {
|
|
16518
|
+
return false;
|
|
16519
|
+
}
|
|
16520
|
+
return /\binvoices?\b/.test(normalized);
|
|
16521
|
+
}
|
|
16358
16522
|
function redactSensitiveFields(value) {
|
|
16359
16523
|
if (Array.isArray(value)) {
|
|
16360
16524
|
return value.map(function (entry) { return redactSensitiveFields(entry); });
|
|
@@ -16566,8 +16730,8 @@ function applyCodexStreamStatusHandler(runOptions, streamStatusHandler) {
|
|
|
16566
16730
|
}
|
|
16567
16731
|
function waitForCodexWorkerMessage(worker, streamStatusHandler) {
|
|
16568
16732
|
return __awaiter(this, void 0, void 0, function () {
|
|
16569
|
-
var _a, _b, _c, _d, message, payload, status_1,
|
|
16570
|
-
var _e,
|
|
16733
|
+
var _a, _b, _c, _d, message, payload, status_1, e_44_1;
|
|
16734
|
+
var _e, e_44, _f, _g;
|
|
16571
16735
|
return __generator(this, function (_h) {
|
|
16572
16736
|
switch (_h.label) {
|
|
16573
16737
|
case 0:
|
|
@@ -16594,8 +16758,8 @@ function waitForCodexWorkerMessage(worker, streamStatusHandler) {
|
|
|
16594
16758
|
return [3 /*break*/, 1];
|
|
16595
16759
|
case 4: return [3 /*break*/, 11];
|
|
16596
16760
|
case 5:
|
|
16597
|
-
|
|
16598
|
-
|
|
16761
|
+
e_44_1 = _h.sent();
|
|
16762
|
+
e_44 = { error: e_44_1 };
|
|
16599
16763
|
return [3 /*break*/, 11];
|
|
16600
16764
|
case 6:
|
|
16601
16765
|
_h.trys.push([6, , 9, 10]);
|
|
@@ -16606,7 +16770,7 @@ function waitForCodexWorkerMessage(worker, streamStatusHandler) {
|
|
|
16606
16770
|
_h.label = 8;
|
|
16607
16771
|
case 8: return [3 /*break*/, 10];
|
|
16608
16772
|
case 9:
|
|
16609
|
-
if (
|
|
16773
|
+
if (e_44) throw e_44.error;
|
|
16610
16774
|
return [7 /*endfinally*/];
|
|
16611
16775
|
case 10: return [7 /*endfinally*/];
|
|
16612
16776
|
case 11: throw new CodexWorkerBootstrapError('Codex worker exited before completing.');
|
|
@@ -16950,8 +17114,8 @@ function buildAssistantWorkspaceRootCandidates(params) {
|
|
|
16950
17114
|
}
|
|
16951
17115
|
function resolveAssistantWorkspaceRoot() {
|
|
16952
17116
|
return __awaiter(this, void 0, void 0, function () {
|
|
16953
|
-
var candidates, firstExisting, firstNestedGitRoot, candidates_8, candidates_8_1, candidate, _a, gitRoot, nestedGitRoots,
|
|
16954
|
-
var
|
|
17117
|
+
var candidates, firstExisting, firstNestedGitRoot, candidates_8, candidates_8_1, candidate, _a, gitRoot, nestedGitRoots, e_45_1;
|
|
17118
|
+
var e_45, _b;
|
|
16955
17119
|
return __generator(this, function (_c) {
|
|
16956
17120
|
switch (_c.label) {
|
|
16957
17121
|
case 0:
|
|
@@ -16998,14 +17162,14 @@ function resolveAssistantWorkspaceRoot() {
|
|
|
16998
17162
|
return [3 /*break*/, 2];
|
|
16999
17163
|
case 8: return [3 /*break*/, 11];
|
|
17000
17164
|
case 9:
|
|
17001
|
-
|
|
17002
|
-
|
|
17165
|
+
e_45_1 = _c.sent();
|
|
17166
|
+
e_45 = { error: e_45_1 };
|
|
17003
17167
|
return [3 /*break*/, 11];
|
|
17004
17168
|
case 10:
|
|
17005
17169
|
try {
|
|
17006
17170
|
if (candidates_8_1 && !candidates_8_1.done && (_b = candidates_8.return)) _b.call(candidates_8);
|
|
17007
17171
|
}
|
|
17008
|
-
finally { if (
|
|
17172
|
+
finally { if (e_45) throw e_45.error; }
|
|
17009
17173
|
return [7 /*endfinally*/];
|
|
17010
17174
|
case 11:
|
|
17011
17175
|
if (firstNestedGitRoot) {
|
|
@@ -17408,7 +17572,7 @@ var AI_ASSISTANT_BREAKDOWN_DIMENSION_STOPWORDS = new Set([
|
|
|
17408
17572
|
'by'
|
|
17409
17573
|
]);
|
|
17410
17574
|
function normalizeAssistantBreakdownDimension(value) {
|
|
17411
|
-
var
|
|
17575
|
+
var e_46, _a;
|
|
17412
17576
|
var normalized = normalizeOptionalString(value)
|
|
17413
17577
|
.toLowerCase()
|
|
17414
17578
|
.replace(/[^a-z0-9_\s-]+/g, ' ')
|
|
@@ -17440,12 +17604,12 @@ function normalizeAssistantBreakdownDimension(value) {
|
|
|
17440
17604
|
}
|
|
17441
17605
|
}
|
|
17442
17606
|
}
|
|
17443
|
-
catch (
|
|
17607
|
+
catch (e_46_1) { e_46 = { error: e_46_1 }; }
|
|
17444
17608
|
finally {
|
|
17445
17609
|
try {
|
|
17446
17610
|
if (tokens_1_1 && !tokens_1_1.done && (_a = tokens_1.return)) _a.call(tokens_1);
|
|
17447
17611
|
}
|
|
17448
|
-
finally { if (
|
|
17612
|
+
finally { if (e_46) throw e_46.error; }
|
|
17449
17613
|
}
|
|
17450
17614
|
if (!kept.length) {
|
|
17451
17615
|
return '';
|
|
@@ -17643,7 +17807,7 @@ function resolveAssistantPlannerEnabled() {
|
|
|
17643
17807
|
return raw === undefined ? true : raw === true;
|
|
17644
17808
|
}
|
|
17645
17809
|
function resolveAssistantPlannerKnownRoutes(user, isSuperAdmin) {
|
|
17646
|
-
var
|
|
17810
|
+
var e_47, _a;
|
|
17647
17811
|
var _b;
|
|
17648
17812
|
if (isSuperAdmin === void 0) { isSuperAdmin = false; }
|
|
17649
17813
|
var routes = ((_b = resolveio_server_app_1.ResolveIOServer.getClientRoutes) === null || _b === void 0 ? void 0 : _b.call(resolveio_server_app_1.ResolveIOServer)) || [];
|
|
@@ -17657,12 +17821,12 @@ function resolveAssistantPlannerKnownRoutes(user, isSuperAdmin) {
|
|
|
17657
17821
|
}
|
|
17658
17822
|
}
|
|
17659
17823
|
}
|
|
17660
|
-
catch (
|
|
17824
|
+
catch (e_47_1) { e_47 = { error: e_47_1 }; }
|
|
17661
17825
|
finally {
|
|
17662
17826
|
try {
|
|
17663
17827
|
if (routes_1_1 && !routes_1_1.done && (_a = routes_1.return)) _a.call(routes_1);
|
|
17664
17828
|
}
|
|
17665
|
-
finally { if (
|
|
17829
|
+
finally { if (e_47) throw e_47.error; }
|
|
17666
17830
|
}
|
|
17667
17831
|
var normalizedRoutes = Array.from(unique);
|
|
17668
17832
|
var allowedRoutes = collectAssistantAllowedRoutesForUser(user, normalizedRoutes, isSuperAdmin);
|
|
@@ -17901,7 +18065,7 @@ function normalizeRouteMatchKey(value) {
|
|
|
17901
18065
|
return normalizeRouteKey(value).toLowerCase();
|
|
17902
18066
|
}
|
|
17903
18067
|
function buildClientRouteIndex() {
|
|
17904
|
-
var
|
|
18068
|
+
var e_48, _a;
|
|
17905
18069
|
var _b;
|
|
17906
18070
|
var routes = ((_b = resolveio_server_app_1.ResolveIOServer.getClientRoutes) === null || _b === void 0 ? void 0 : _b.call(resolveio_server_app_1.ResolveIOServer)) || [];
|
|
17907
18071
|
var set = new Set();
|
|
@@ -17920,12 +18084,12 @@ function buildClientRouteIndex() {
|
|
|
17920
18084
|
}
|
|
17921
18085
|
}
|
|
17922
18086
|
}
|
|
17923
|
-
catch (
|
|
18087
|
+
catch (e_48_1) { e_48 = { error: e_48_1 }; }
|
|
17924
18088
|
finally {
|
|
17925
18089
|
try {
|
|
17926
18090
|
if (routes_2_1 && !routes_2_1.done && (_a = routes_2.return)) _a.call(routes_2);
|
|
17927
18091
|
}
|
|
17928
|
-
finally { if (
|
|
18092
|
+
finally { if (e_48) throw e_48.error; }
|
|
17929
18093
|
}
|
|
17930
18094
|
return { set: set, map: map, size: routes.length };
|
|
17931
18095
|
}
|
|
@@ -18091,16 +18255,15 @@ function collectAssistantAllowedRoutesForUser(user, allRoutes, isSuperAdmin) {
|
|
|
18091
18255
|
seen.add(normalized);
|
|
18092
18256
|
allowed.push(normalized);
|
|
18093
18257
|
};
|
|
18094
|
-
var allRouteEntries = normalizedRoutes.map(function (route) { return ({ route: route
|
|
18258
|
+
var allRouteEntries = normalizedRoutes.map(function (route) { return ({ route: route }); });
|
|
18095
18259
|
views.forEach(function (view) {
|
|
18096
|
-
var
|
|
18097
|
-
var canonical = normalizedRoutes.find(function (route) { return route.toLowerCase() === viewKey; });
|
|
18260
|
+
var canonical = normalizedRoutes.find(function (route) { return normalizeRouteMatchKey(route) === normalizeRouteMatchKey(view); });
|
|
18098
18261
|
if (canonical) {
|
|
18099
18262
|
push(canonical);
|
|
18100
18263
|
}
|
|
18101
18264
|
var matched = false;
|
|
18102
18265
|
allRouteEntries.forEach(function (entry) {
|
|
18103
|
-
if (
|
|
18266
|
+
if (isAssistantViewPermissionMatch(view, entry.route)) {
|
|
18104
18267
|
push(entry.route);
|
|
18105
18268
|
matched = true;
|
|
18106
18269
|
}
|
|
@@ -18705,8 +18868,8 @@ function shouldSkipAssistantGitDiscoveryDirectory(name) {
|
|
|
18705
18868
|
}
|
|
18706
18869
|
function resolveAssistantWorkspaceGitRoots(workspaceRoot) {
|
|
18707
18870
|
return __awaiter(this, void 0, void 0, function () {
|
|
18708
|
-
var roots, seen, push, _a, configuredRoots, configuredRoots_1, configuredRoots_1_1, configuredRoot, _b,
|
|
18709
|
-
var
|
|
18871
|
+
var roots, seen, push, _a, configuredRoots, configuredRoots_1, configuredRoots_1_1, configuredRoot, _b, e_49_1, queue, queued, enqueue, next, entries, _c, entries_1, entries_1_1, entry, childName, candidate, gitPath, _d, e_50_1;
|
|
18872
|
+
var e_49, _e, e_50, _f;
|
|
18710
18873
|
var _g;
|
|
18711
18874
|
return __generator(this, function (_h) {
|
|
18712
18875
|
switch (_h.label) {
|
|
@@ -18751,14 +18914,14 @@ function resolveAssistantWorkspaceGitRoots(workspaceRoot) {
|
|
|
18751
18914
|
return [3 /*break*/, 3];
|
|
18752
18915
|
case 6: return [3 /*break*/, 9];
|
|
18753
18916
|
case 7:
|
|
18754
|
-
|
|
18755
|
-
|
|
18917
|
+
e_49_1 = _h.sent();
|
|
18918
|
+
e_49 = { error: e_49_1 };
|
|
18756
18919
|
return [3 /*break*/, 9];
|
|
18757
18920
|
case 8:
|
|
18758
18921
|
try {
|
|
18759
18922
|
if (configuredRoots_1_1 && !configuredRoots_1_1.done && (_e = configuredRoots_1.return)) _e.call(configuredRoots_1);
|
|
18760
18923
|
}
|
|
18761
|
-
finally { if (
|
|
18924
|
+
finally { if (e_49) throw e_49.error; }
|
|
18762
18925
|
return [7 /*endfinally*/];
|
|
18763
18926
|
case 9:
|
|
18764
18927
|
queue = [];
|
|
@@ -18798,7 +18961,7 @@ function resolveAssistantWorkspaceGitRoots(workspaceRoot) {
|
|
|
18798
18961
|
return [3 /*break*/, 14];
|
|
18799
18962
|
case 14:
|
|
18800
18963
|
_h.trys.push([14, 21, 22, 23]);
|
|
18801
|
-
entries_1 = (
|
|
18964
|
+
entries_1 = (e_50 = void 0, __values(entries)), entries_1_1 = entries_1.next();
|
|
18802
18965
|
_h.label = 15;
|
|
18803
18966
|
case 15:
|
|
18804
18967
|
if (!!entries_1_1.done) return [3 /*break*/, 20];
|
|
@@ -18837,14 +19000,14 @@ function resolveAssistantWorkspaceGitRoots(workspaceRoot) {
|
|
|
18837
19000
|
return [3 /*break*/, 15];
|
|
18838
19001
|
case 20: return [3 /*break*/, 23];
|
|
18839
19002
|
case 21:
|
|
18840
|
-
|
|
18841
|
-
|
|
19003
|
+
e_50_1 = _h.sent();
|
|
19004
|
+
e_50 = { error: e_50_1 };
|
|
18842
19005
|
return [3 /*break*/, 23];
|
|
18843
19006
|
case 22:
|
|
18844
19007
|
try {
|
|
18845
19008
|
if (entries_1_1 && !entries_1_1.done && (_f = entries_1.return)) _f.call(entries_1);
|
|
18846
19009
|
}
|
|
18847
|
-
finally { if (
|
|
19010
|
+
finally { if (e_50) throw e_50.error; }
|
|
18848
19011
|
return [7 /*endfinally*/];
|
|
18849
19012
|
case 23: return [3 /*break*/, 10];
|
|
18850
19013
|
case 24: return [2 /*return*/, roots];
|
|
@@ -19147,8 +19310,8 @@ function syncAssistantGitMirror(repoUrl) {
|
|
|
19147
19310
|
}
|
|
19148
19311
|
function resolveAssistantChangeHistoryGitRoots(workspaceRoot) {
|
|
19149
19312
|
return __awaiter(this, void 0, void 0, function () {
|
|
19150
|
-
var roots, repoUrls, mirroredRoots, repoUrls_1, repoUrls_1_1, repoUrl, mirrorRoot,
|
|
19151
|
-
var
|
|
19313
|
+
var roots, repoUrls, mirroredRoots, repoUrls_1, repoUrls_1_1, repoUrl, mirrorRoot, e_51_1;
|
|
19314
|
+
var e_51, _a;
|
|
19152
19315
|
return __generator(this, function (_b) {
|
|
19153
19316
|
switch (_b.label) {
|
|
19154
19317
|
case 0: return [4 /*yield*/, resolveAssistantWorkspaceGitRoots(workspaceRoot)];
|
|
@@ -19182,14 +19345,14 @@ function resolveAssistantChangeHistoryGitRoots(workspaceRoot) {
|
|
|
19182
19345
|
return [3 /*break*/, 3];
|
|
19183
19346
|
case 6: return [3 /*break*/, 9];
|
|
19184
19347
|
case 7:
|
|
19185
|
-
|
|
19186
|
-
|
|
19348
|
+
e_51_1 = _b.sent();
|
|
19349
|
+
e_51 = { error: e_51_1 };
|
|
19187
19350
|
return [3 /*break*/, 9];
|
|
19188
19351
|
case 8:
|
|
19189
19352
|
try {
|
|
19190
19353
|
if (repoUrls_1_1 && !repoUrls_1_1.done && (_a = repoUrls_1.return)) _a.call(repoUrls_1);
|
|
19191
19354
|
}
|
|
19192
|
-
finally { if (
|
|
19355
|
+
finally { if (e_51) throw e_51.error; }
|
|
19193
19356
|
return [7 /*endfinally*/];
|
|
19194
19357
|
case 9: return [2 /*return*/, mirroredRoots];
|
|
19195
19358
|
}
|
|
@@ -19198,8 +19361,8 @@ function resolveAssistantChangeHistoryGitRoots(workspaceRoot) {
|
|
|
19198
19361
|
}
|
|
19199
19362
|
function resolveAssistantChangeHistoryFastPathResponse(params) {
|
|
19200
19363
|
return __awaiter(this, void 0, void 0, function () {
|
|
19201
|
-
var workspaceRoot, _a, gitRoots, featureKeywords, sawExecutionError, bestFallback, gitRoots_1, gitRoots_1_1, gitRoot, _b, branch, _c, _d, limit, historyDepth, rawHistory, commits, summary, hasKeywordMatches, _e,
|
|
19202
|
-
var
|
|
19364
|
+
var workspaceRoot, _a, gitRoots, featureKeywords, sawExecutionError, bestFallback, gitRoots_1, gitRoots_1_1, gitRoot, _b, branch, _c, _d, limit, historyDepth, rawHistory, commits, summary, hasKeywordMatches, _e, e_52_1;
|
|
19365
|
+
var e_52, _f;
|
|
19203
19366
|
return __generator(this, function (_g) {
|
|
19204
19367
|
switch (_g.label) {
|
|
19205
19368
|
case 0:
|
|
@@ -19321,14 +19484,14 @@ function resolveAssistantChangeHistoryFastPathResponse(params) {
|
|
|
19321
19484
|
return [3 /*break*/, 7];
|
|
19322
19485
|
case 20: return [3 /*break*/, 23];
|
|
19323
19486
|
case 21:
|
|
19324
|
-
|
|
19325
|
-
|
|
19487
|
+
e_52_1 = _g.sent();
|
|
19488
|
+
e_52 = { error: e_52_1 };
|
|
19326
19489
|
return [3 /*break*/, 23];
|
|
19327
19490
|
case 22:
|
|
19328
19491
|
try {
|
|
19329
19492
|
if (gitRoots_1_1 && !gitRoots_1_1.done && (_f = gitRoots_1.return)) _f.call(gitRoots_1);
|
|
19330
19493
|
}
|
|
19331
|
-
finally { if (
|
|
19494
|
+
finally { if (e_52) throw e_52.error; }
|
|
19332
19495
|
return [7 /*endfinally*/];
|
|
19333
19496
|
case 23:
|
|
19334
19497
|
if (bestFallback) {
|
|
@@ -19509,7 +19672,7 @@ function sanitizeAssistantResponse(value) {
|
|
|
19509
19672
|
return normalizeAssistantRoutes(normalizedCurrency);
|
|
19510
19673
|
}
|
|
19511
19674
|
function evaluateAssistantGuardrails(message) {
|
|
19512
|
-
var
|
|
19675
|
+
var e_53, _a;
|
|
19513
19676
|
var normalized = String(message || '').toLowerCase();
|
|
19514
19677
|
var identityGuardrail = evaluateAssistantIdentityDisclosureGuardrail(normalized);
|
|
19515
19678
|
if (identityGuardrail === null || identityGuardrail === void 0 ? void 0 : identityGuardrail.blocked) {
|
|
@@ -19559,12 +19722,12 @@ function evaluateAssistantGuardrails(message) {
|
|
|
19559
19722
|
}
|
|
19560
19723
|
}
|
|
19561
19724
|
}
|
|
19562
|
-
catch (
|
|
19725
|
+
catch (e_53_1) { e_53 = { error: e_53_1 }; }
|
|
19563
19726
|
finally {
|
|
19564
19727
|
try {
|
|
19565
19728
|
if (patterns_2_1 && !patterns_2_1.done && (_a = patterns_2.return)) _a.call(patterns_2);
|
|
19566
19729
|
}
|
|
19567
|
-
finally { if (
|
|
19730
|
+
finally { if (e_53) throw e_53.error; }
|
|
19568
19731
|
}
|
|
19569
19732
|
return null;
|
|
19570
19733
|
}
|
|
@@ -19679,7 +19842,7 @@ function tokenizeArithmeticExpression(expression) {
|
|
|
19679
19842
|
return tokens;
|
|
19680
19843
|
}
|
|
19681
19844
|
function evaluateArithmeticExpression(expression) {
|
|
19682
|
-
var
|
|
19845
|
+
var e_54, _a, e_55, _b;
|
|
19683
19846
|
var tokens = tokenizeArithmeticExpression(expression);
|
|
19684
19847
|
if (!tokens || !tokens.length) {
|
|
19685
19848
|
return null;
|
|
@@ -19736,12 +19899,12 @@ function evaluateArithmeticExpression(expression) {
|
|
|
19736
19899
|
prevToken = token;
|
|
19737
19900
|
}
|
|
19738
19901
|
}
|
|
19739
|
-
catch (
|
|
19902
|
+
catch (e_54_1) { e_54 = { error: e_54_1 }; }
|
|
19740
19903
|
finally {
|
|
19741
19904
|
try {
|
|
19742
19905
|
if (tokens_2_1 && !tokens_2_1.done && (_a = tokens_2.return)) _a.call(tokens_2);
|
|
19743
19906
|
}
|
|
19744
|
-
finally { if (
|
|
19907
|
+
finally { if (e_54) throw e_54.error; }
|
|
19745
19908
|
}
|
|
19746
19909
|
while (ops.length) {
|
|
19747
19910
|
var op = ops.pop();
|
|
@@ -19781,12 +19944,12 @@ function evaluateArithmeticExpression(expression) {
|
|
|
19781
19944
|
stack.push(Number(token));
|
|
19782
19945
|
}
|
|
19783
19946
|
}
|
|
19784
|
-
catch (
|
|
19947
|
+
catch (e_55_1) { e_55 = { error: e_55_1 }; }
|
|
19785
19948
|
finally {
|
|
19786
19949
|
try {
|
|
19787
19950
|
if (output_1_1 && !output_1_1.done && (_b = output_1.return)) _b.call(output_1);
|
|
19788
19951
|
}
|
|
19789
|
-
finally { if (
|
|
19952
|
+
finally { if (e_55) throw e_55.error; }
|
|
19790
19953
|
}
|
|
19791
19954
|
if (stack.length !== 1 || Number.isNaN(stack[0])) {
|
|
19792
19955
|
return null;
|
|
@@ -19970,8 +20133,8 @@ function handleCodexUpload(id_conversation, file_name, content_base64, size, con
|
|
|
19970
20133
|
}
|
|
19971
20134
|
function readAttachmentContents(attachments) {
|
|
19972
20135
|
return __awaiter(this, void 0, void 0, function () {
|
|
19973
|
-
var limits, totalBytes, totalChars, chunks, cleaned, attachments_1, attachments_1_1, attachment, localPath, safe, stat, ext, name_1, type, readable, content, _a,
|
|
19974
|
-
var
|
|
20136
|
+
var limits, totalBytes, totalChars, chunks, cleaned, attachments_1, attachments_1_1, attachment, localPath, safe, stat, ext, name_1, type, readable, content, _a, e_56_1;
|
|
20137
|
+
var e_56, _b;
|
|
19975
20138
|
return __generator(this, function (_c) {
|
|
19976
20139
|
switch (_c.label) {
|
|
19977
20140
|
case 0:
|
|
@@ -20050,14 +20213,14 @@ function readAttachmentContents(attachments) {
|
|
|
20050
20213
|
return [3 /*break*/, 2];
|
|
20051
20214
|
case 10: return [3 /*break*/, 13];
|
|
20052
20215
|
case 11:
|
|
20053
|
-
|
|
20054
|
-
|
|
20216
|
+
e_56_1 = _c.sent();
|
|
20217
|
+
e_56 = { error: e_56_1 };
|
|
20055
20218
|
return [3 /*break*/, 13];
|
|
20056
20219
|
case 12:
|
|
20057
20220
|
try {
|
|
20058
20221
|
if (attachments_1_1 && !attachments_1_1.done && (_b = attachments_1.return)) _b.call(attachments_1);
|
|
20059
20222
|
}
|
|
20060
|
-
finally { if (
|
|
20223
|
+
finally { if (e_56) throw e_56.error; }
|
|
20061
20224
|
return [7 /*endfinally*/];
|
|
20062
20225
|
case 13: return [2 /*return*/, {
|
|
20063
20226
|
promptText: chunks.length ? "\n\nAttachments:\n".concat(chunks.join('\n\n')) : '',
|
|
@@ -20381,7 +20544,7 @@ function estimateUsage(messages, responseText, model) {
|
|
|
20381
20544
|
};
|
|
20382
20545
|
}
|
|
20383
20546
|
function evaluateGuardrails(message) {
|
|
20384
|
-
var
|
|
20547
|
+
var e_57, _a;
|
|
20385
20548
|
var normalized = String(message || '').toLowerCase();
|
|
20386
20549
|
var identityGuardrail = evaluateAssistantIdentityDisclosureGuardrail(normalized);
|
|
20387
20550
|
if (identityGuardrail === null || identityGuardrail === void 0 ? void 0 : identityGuardrail.blocked) {
|
|
@@ -20407,12 +20570,12 @@ function evaluateGuardrails(message) {
|
|
|
20407
20570
|
}
|
|
20408
20571
|
}
|
|
20409
20572
|
}
|
|
20410
|
-
catch (
|
|
20573
|
+
catch (e_57_1) { e_57 = { error: e_57_1 }; }
|
|
20411
20574
|
finally {
|
|
20412
20575
|
try {
|
|
20413
20576
|
if (patterns_3_1 && !patterns_3_1.done && (_a = patterns_3.return)) _a.call(patterns_3);
|
|
20414
20577
|
}
|
|
20415
|
-
finally { if (
|
|
20578
|
+
finally { if (e_57) throw e_57.error; }
|
|
20416
20579
|
}
|
|
20417
20580
|
return null;
|
|
20418
20581
|
}
|