@probelabs/visor 0.1.29 → 0.1.33
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/defaults/.visor.yaml +4 -5
- package/dist/check-execution-engine.d.ts.map +1 -1
- package/dist/defaults/.visor.yaml +4 -5
- package/dist/index.js +137 -45
- package/dist/pr-analyzer.d.ts +2 -0
- package/dist/pr-analyzer.d.ts.map +1 -1
- package/dist/providers/ai-check-provider.d.ts.map +1 -1
- package/package.json +1 -1
package/defaults/.visor.yaml
CHANGED
|
@@ -278,12 +278,11 @@ checks:
|
|
|
278
278
|
{%- endif %}
|
|
279
279
|
|
|
280
280
|
## Repository Analysis Context
|
|
281
|
-
{%- if pr.title %}
|
|
282
|
-
**
|
|
281
|
+
{%- if event.isPullRequest and pr.title %}
|
|
282
|
+
**PR Context**: {{ pr.title }}
|
|
283
283
|
{%- endif %}
|
|
284
|
-
{%- if
|
|
285
|
-
**
|
|
286
|
-
**Technologies**: {% for ext in utils.filesByExtension %}{{ ext[0] }}{% unless forloop.last %}, {% endunless %}{% endfor %}
|
|
284
|
+
{%- if event.repository %}
|
|
285
|
+
**Repository**: {{ event.repository.fullName }}
|
|
287
286
|
{%- endif %}
|
|
288
287
|
|
|
289
288
|
## Instructions
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"","sourceRoot":"","sources":["file:///home/runner/work/visor/visor/src/check-execution-engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EAEb,mBAAmB,EAEpB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAKvC,OAAO,EAAE,sBAAsB,EAAe,MAAM,gBAAgB,CAAC;AAiCrE,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE;QACJ,KAAK,EAAE;YACL,GAAG,EAAE,MAAM,OAAO,CAAC;gBAAE,I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}
|
|
282
|
-
**
|
|
281
|
+
{%- if event.isPullRequest and pr.title %}
|
|
282
|
+
**PR Context**: {{ pr.title }}
|
|
283
283
|
{%- endif %}
|
|
284
|
-
{%- if
|
|
285
|
-
**
|
|
286
|
-
**Technologies**: {% for ext in utils.filesByExtension %}{{ ext[0] }}{% unless forloop.last %}, {% endunless %}{% endfor %}
|
|
284
|
+
{%- if event.repository %}
|
|
285
|
+
**Repository**: {{ event.repository.fullName }}
|
|
287
286
|
{%- endif %}
|
|
288
287
|
|
|
289
288
|
## Instructions
|
package/dist/index.js
CHANGED
|
@@ -81778,6 +81778,7 @@ class CheckExecutionEngine {
|
|
|
81778
81778
|
const providerConfig = {
|
|
81779
81779
|
type: checks[0],
|
|
81780
81780
|
prompt: 'all',
|
|
81781
|
+
eventContext: prInfo.eventContext, // Pass event context for templates
|
|
81781
81782
|
ai: timeout ? { timeout } : undefined,
|
|
81782
81783
|
};
|
|
81783
81784
|
const result = await provider.execute(prInfo, providerConfig);
|
|
@@ -81812,6 +81813,7 @@ class CheckExecutionEngine {
|
|
|
81812
81813
|
type: 'ai',
|
|
81813
81814
|
prompt: focus,
|
|
81814
81815
|
focus: focus,
|
|
81816
|
+
eventContext: prInfo.eventContext, // Pass event context for templates
|
|
81815
81817
|
ai: timeout ? { timeout } : undefined,
|
|
81816
81818
|
// Inherit global AI provider and model settings if config is available
|
|
81817
81819
|
ai_provider: config?.ai_provider,
|
|
@@ -81899,6 +81901,7 @@ class CheckExecutionEngine {
|
|
|
81899
81901
|
focus: checkConfig.focus || this.mapCheckNameToFocus(checkName),
|
|
81900
81902
|
schema: checkConfig.schema,
|
|
81901
81903
|
group: checkConfig.group,
|
|
81904
|
+
eventContext: prInfo.eventContext, // Pass event context for templates
|
|
81902
81905
|
ai: {
|
|
81903
81906
|
timeout: timeout || 600000,
|
|
81904
81907
|
debug: debug,
|
|
@@ -82220,6 +82223,7 @@ class CheckExecutionEngine {
|
|
|
82220
82223
|
schema: checkConfig.schema,
|
|
82221
82224
|
group: checkConfig.group,
|
|
82222
82225
|
checkName: checkName, // Add checkName for sessionID
|
|
82226
|
+
eventContext: prInfo.eventContext, // Pass event context for templates
|
|
82223
82227
|
ai: {
|
|
82224
82228
|
timeout: timeout || 600000,
|
|
82225
82229
|
debug: debug,
|
|
@@ -82428,6 +82432,7 @@ class CheckExecutionEngine {
|
|
|
82428
82432
|
focus: checkConfig.focus || this.mapCheckNameToFocus(checkName),
|
|
82429
82433
|
schema: checkConfig.schema,
|
|
82430
82434
|
group: checkConfig.group,
|
|
82435
|
+
eventContext: prInfo.eventContext, // Pass event context for templates
|
|
82431
82436
|
ai: {
|
|
82432
82437
|
timeout: timeout || 600000,
|
|
82433
82438
|
debug: debug, // Pass debug flag to AI provider
|
|
@@ -82495,6 +82500,7 @@ class CheckExecutionEngine {
|
|
|
82495
82500
|
focus: checkConfig.focus || this.mapCheckNameToFocus(checkName),
|
|
82496
82501
|
schema: checkConfig.schema,
|
|
82497
82502
|
group: checkConfig.group,
|
|
82503
|
+
eventContext: prInfo.eventContext, // Pass event context for templates
|
|
82498
82504
|
ai: {
|
|
82499
82505
|
timeout: timeout || 600000,
|
|
82500
82506
|
...(checkConfig.ai || {}),
|
|
@@ -86257,7 +86263,7 @@ async function handleEvent(octokit, inputs, eventName, context, config) {
|
|
|
86257
86263
|
// Handle different GitHub events
|
|
86258
86264
|
switch (eventName) {
|
|
86259
86265
|
case 'issue_comment':
|
|
86260
|
-
await handleIssueComment(octokit, owner, repo, context, inputs);
|
|
86266
|
+
await handleIssueComment(octokit, owner, repo, context, inputs, config, checksToRun);
|
|
86261
86267
|
break;
|
|
86262
86268
|
case 'pull_request':
|
|
86263
86269
|
// Run the checks that are configured for this event
|
|
@@ -86340,6 +86346,8 @@ async function handleIssueEvent(octokit, owner, repo, context, inputs, config, c
|
|
|
86340
86346
|
totalAdditions: 0,
|
|
86341
86347
|
totalDeletions: 0,
|
|
86342
86348
|
eventType: mapGitHubEventToTrigger('issues', action),
|
|
86349
|
+
isIssue: true, // Flag to indicate this is an issue, not a PR
|
|
86350
|
+
eventContext: context.event, // Pass the full event context for templates
|
|
86343
86351
|
};
|
|
86344
86352
|
// Run the checks using CheckExecutionEngine
|
|
86345
86353
|
const { CheckExecutionEngine } = await Promise.resolve().then(() => __importStar(__nccwpck_require__(80299)));
|
|
@@ -86350,11 +86358,11 @@ async function handleIssueEvent(octokit, owner, repo, context, inputs, config, c
|
|
|
86350
86358
|
inputs.debug === 'true');
|
|
86351
86359
|
// Format and post results as a comment on the issue
|
|
86352
86360
|
if (Object.keys(result).length > 0) {
|
|
86353
|
-
let commentBody =
|
|
86361
|
+
let commentBody = '';
|
|
86362
|
+
// Directly use check content without adding extra headers
|
|
86354
86363
|
for (const checks of Object.values(result)) {
|
|
86355
86364
|
for (const check of checks) {
|
|
86356
86365
|
if (check.content && check.content.trim()) {
|
|
86357
|
-
commentBody += `### ${check.checkName}\n`;
|
|
86358
86366
|
commentBody += `${check.content}\n\n`;
|
|
86359
86367
|
}
|
|
86360
86368
|
}
|
|
@@ -86383,7 +86391,7 @@ async function handleIssueEvent(octokit, owner, repo, context, inputs, config, c
|
|
|
86383
86391
|
throw error;
|
|
86384
86392
|
}
|
|
86385
86393
|
}
|
|
86386
|
-
async function handleIssueComment(octokit, owner, repo, context, inputs) {
|
|
86394
|
+
async function handleIssueComment(octokit, owner, repo, context, inputs, actionConfig, _actionChecksToRun) {
|
|
86387
86395
|
const comment = context.event?.comment;
|
|
86388
86396
|
const issue = context.event?.issue;
|
|
86389
86397
|
if (!comment || !issue) {
|
|
@@ -86391,41 +86399,56 @@ async function handleIssueComment(octokit, owner, repo, context, inputs) {
|
|
|
86391
86399
|
return;
|
|
86392
86400
|
}
|
|
86393
86401
|
// Prevent recursion: skip if comment is from visor itself
|
|
86394
|
-
|
|
86402
|
+
// Check both comment author and content markers
|
|
86403
|
+
const isVisorBot = comment.user?.login === 'visor[bot]' ||
|
|
86404
|
+
comment.user?.login === 'github-actions[bot]' ||
|
|
86405
|
+
comment.user?.type === 'Bot';
|
|
86406
|
+
const hasVisorMarkers = comment.body &&
|
|
86395
86407
|
(comment.body.includes('<!-- visor-comment-id:') ||
|
|
86396
|
-
comment.body.includes('*Powered by [Visor]')
|
|
86397
|
-
|
|
86408
|
+
comment.body.includes('*Powered by [Visor](https://probelabs.com/visor)') ||
|
|
86409
|
+
comment.body.includes('*Powered by [Visor](https://github.com/probelabs/visor)'));
|
|
86410
|
+
if (isVisorBot || hasVisorMarkers) {
|
|
86411
|
+
console.log(`Skipping visor comment to prevent recursion. Author: ${comment.user?.login}, Type: ${comment.user?.type}, Has markers: ${hasVisorMarkers}`);
|
|
86398
86412
|
return;
|
|
86399
86413
|
}
|
|
86400
86414
|
// Process comments on both issues and PRs
|
|
86401
86415
|
// (issue.pull_request exists for PR comments, doesn't exist for issue comments)
|
|
86416
|
+
const isPullRequest = !!issue.pull_request;
|
|
86402
86417
|
// Load configuration to get available commands
|
|
86403
86418
|
const configManager = new config_1.ConfigManager();
|
|
86404
86419
|
let config;
|
|
86405
86420
|
const commandRegistry = {};
|
|
86406
|
-
|
|
86407
|
-
|
|
86408
|
-
|
|
86409
|
-
|
|
86410
|
-
|
|
86411
|
-
|
|
86412
|
-
|
|
86413
|
-
|
|
86414
|
-
|
|
86415
|
-
|
|
86416
|
-
|
|
86417
|
-
|
|
86418
|
-
|
|
86419
|
-
|
|
86421
|
+
// Use provided config if available (from action), otherwise load it
|
|
86422
|
+
if (actionConfig) {
|
|
86423
|
+
config = actionConfig;
|
|
86424
|
+
}
|
|
86425
|
+
else {
|
|
86426
|
+
try {
|
|
86427
|
+
config = await configManager.findAndLoadConfig();
|
|
86428
|
+
}
|
|
86429
|
+
catch {
|
|
86430
|
+
console.log('Could not load config, using defaults');
|
|
86431
|
+
config = undefined;
|
|
86432
|
+
}
|
|
86433
|
+
}
|
|
86434
|
+
// Build command registry from config
|
|
86435
|
+
if (config?.checks) {
|
|
86436
|
+
// Add 'review' command that runs all checks
|
|
86437
|
+
commandRegistry['review'] = Object.keys(config.checks);
|
|
86438
|
+
// Also add individual check names as commands
|
|
86439
|
+
for (const [checkId, checkConfig] of Object.entries(config.checks)) {
|
|
86440
|
+
// Legacy: check if it has old 'command' property
|
|
86441
|
+
if (checkConfig.command) {
|
|
86442
|
+
if (!commandRegistry[checkConfig.command]) {
|
|
86443
|
+
commandRegistry[checkConfig.command] = [];
|
|
86420
86444
|
}
|
|
86421
|
-
|
|
86422
|
-
commandRegistry[checkId] = [checkId];
|
|
86445
|
+
commandRegistry[checkConfig.command].push(checkId);
|
|
86423
86446
|
}
|
|
86447
|
+
// New: add check name as command
|
|
86448
|
+
commandRegistry[checkId] = [checkId];
|
|
86424
86449
|
}
|
|
86425
86450
|
}
|
|
86426
|
-
|
|
86427
|
-
console.log('Could not load config, using defaults');
|
|
86428
|
-
config = undefined;
|
|
86451
|
+
else {
|
|
86429
86452
|
// Default commands when no config is available
|
|
86430
86453
|
commandRegistry['review'] = ['security', 'performance', 'style', 'architecture'];
|
|
86431
86454
|
}
|
|
@@ -86442,22 +86465,40 @@ async function handleIssueComment(octokit, owner, repo, context, inputs) {
|
|
|
86442
86465
|
const reviewer = new reviewer_1.PRReviewer(octokit);
|
|
86443
86466
|
switch (command.type) {
|
|
86444
86467
|
case 'status':
|
|
86445
|
-
|
|
86446
|
-
|
|
86447
|
-
|
|
86448
|
-
|
|
86449
|
-
|
|
86450
|
-
|
|
86451
|
-
|
|
86452
|
-
|
|
86453
|
-
|
|
86454
|
-
|
|
86455
|
-
|
|
86456
|
-
|
|
86457
|
-
|
|
86458
|
-
|
|
86459
|
-
|
|
86460
|
-
|
|
86468
|
+
if (isPullRequest) {
|
|
86469
|
+
const statusPrInfo = await analyzer.fetchPRDiff(owner, repo, prNumber, undefined, 'issue_comment');
|
|
86470
|
+
const statusComment = `## 📊 PR Status\n\n` +
|
|
86471
|
+
`**Title:** ${statusPrInfo.title}\n` +
|
|
86472
|
+
`**Author:** ${statusPrInfo.author}\n` +
|
|
86473
|
+
`**Files Changed:** ${statusPrInfo.files.length}\n` +
|
|
86474
|
+
`**Additions:** +${statusPrInfo.totalAdditions}\n` +
|
|
86475
|
+
`**Deletions:** -${statusPrInfo.totalDeletions}\n` +
|
|
86476
|
+
`**Base:** ${statusPrInfo.base} → **Head:** ${statusPrInfo.head}\n\n` +
|
|
86477
|
+
`\n---\n\n` +
|
|
86478
|
+
`*Powered by [Visor](https://probelabs.com/visor) from [Probelabs](https://probelabs.com)*`;
|
|
86479
|
+
await octokit.rest.issues.createComment({
|
|
86480
|
+
owner,
|
|
86481
|
+
repo,
|
|
86482
|
+
issue_number: prNumber,
|
|
86483
|
+
body: statusComment,
|
|
86484
|
+
});
|
|
86485
|
+
}
|
|
86486
|
+
else {
|
|
86487
|
+
const statusComment = `## 📊 Issue Status\n\n` +
|
|
86488
|
+
`**Title:** ${issue.title || 'N/A'}\n` +
|
|
86489
|
+
`**Author:** ${issue.user?.login || 'unknown'}\n` +
|
|
86490
|
+
`**State:** ${issue.state || 'open'}\n` +
|
|
86491
|
+
`**Comments:** ${issue.comments || 0}\n` +
|
|
86492
|
+
`**Created:** ${issue.created_at || 'unknown'}\n` +
|
|
86493
|
+
`\n---\n\n` +
|
|
86494
|
+
`*Powered by [Visor](https://probelabs.com/visor) from [Probelabs](https://probelabs.com)*`;
|
|
86495
|
+
await octokit.rest.issues.createComment({
|
|
86496
|
+
owner,
|
|
86497
|
+
repo,
|
|
86498
|
+
issue_number: prNumber,
|
|
86499
|
+
body: statusComment,
|
|
86500
|
+
});
|
|
86501
|
+
}
|
|
86461
86502
|
break;
|
|
86462
86503
|
case 'help':
|
|
86463
86504
|
await octokit.rest.issues.createComment({
|
|
@@ -86474,7 +86515,32 @@ async function handleIssueComment(octokit, owner, repo, context, inputs) {
|
|
|
86474
86515
|
// Resolve all dependencies recursively
|
|
86475
86516
|
const checkIds = resolveDependencies(initialCheckIds, config);
|
|
86476
86517
|
console.log(`Running checks for command /${command.type} (initial: ${initialCheckIds.join(', ')}, resolved: ${checkIds.join(', ')})`);
|
|
86477
|
-
|
|
86518
|
+
// Different handling for PRs vs Issues
|
|
86519
|
+
let prInfo;
|
|
86520
|
+
if (isPullRequest) {
|
|
86521
|
+
// It's a PR comment - fetch the PR diff
|
|
86522
|
+
prInfo = await analyzer.fetchPRDiff(owner, repo, prNumber, undefined, 'issue_comment');
|
|
86523
|
+
// Add event context for templates
|
|
86524
|
+
prInfo.eventContext = context.event;
|
|
86525
|
+
}
|
|
86526
|
+
else {
|
|
86527
|
+
// It's an issue comment - create a minimal PRInfo structure for issue assistant
|
|
86528
|
+
prInfo = {
|
|
86529
|
+
number: issue.number,
|
|
86530
|
+
title: issue.title || '',
|
|
86531
|
+
body: issue.body || '',
|
|
86532
|
+
author: issue.user?.login || 'unknown',
|
|
86533
|
+
base: 'main',
|
|
86534
|
+
head: 'issue',
|
|
86535
|
+
files: [],
|
|
86536
|
+
totalAdditions: 0,
|
|
86537
|
+
totalDeletions: 0,
|
|
86538
|
+
fullDiff: '',
|
|
86539
|
+
eventType: 'issue_comment',
|
|
86540
|
+
isIssue: true, // Flag to indicate this is an issue, not a PR
|
|
86541
|
+
eventContext: context.event, // Pass the full event context for templates
|
|
86542
|
+
};
|
|
86543
|
+
}
|
|
86478
86544
|
// Extract common arguments
|
|
86479
86545
|
const focus = command.args?.find(arg => arg.startsWith('--focus='))?.split('=')[1];
|
|
86480
86546
|
const format = command.args?.find(arg => arg.startsWith('--format='))?.split('=')[1];
|
|
@@ -86486,11 +86552,34 @@ async function handleIssueComment(octokit, owner, repo, context, inputs) {
|
|
|
86486
86552
|
}
|
|
86487
86553
|
}
|
|
86488
86554
|
}
|
|
86555
|
+
// Only run checks that are appropriate for the context
|
|
86556
|
+
const filteredCheckIds = checkIds.filter(checkId => {
|
|
86557
|
+
if (!config?.checks?.[checkId])
|
|
86558
|
+
return false;
|
|
86559
|
+
const checkConfig = config.checks[checkId];
|
|
86560
|
+
const checkEvents = checkConfig.on || ['pr_opened', 'pr_updated'];
|
|
86561
|
+
// For issue comments, only run checks that are configured for issue_comment events
|
|
86562
|
+
if (!isPullRequest) {
|
|
86563
|
+
return checkEvents.includes('issue_comment');
|
|
86564
|
+
}
|
|
86565
|
+
// For PR comments, run checks configured for PR events or issue_comment
|
|
86566
|
+
return checkEvents.includes('pr_updated') || checkEvents.includes('issue_comment');
|
|
86567
|
+
});
|
|
86568
|
+
if (filteredCheckIds.length === 0) {
|
|
86569
|
+
console.log(`No checks configured to run for ${isPullRequest ? 'PR' : 'issue'} comments`);
|
|
86570
|
+
await octokit.rest.issues.createComment({
|
|
86571
|
+
owner,
|
|
86572
|
+
repo,
|
|
86573
|
+
issue_number: prNumber,
|
|
86574
|
+
body: `⚠️ No checks are configured to run for ${isPullRequest ? 'PR' : 'issue'} comments with command /${command.type}\n\n*Powered by [Visor](https://probelabs.com/visor)*`,
|
|
86575
|
+
});
|
|
86576
|
+
return;
|
|
86577
|
+
}
|
|
86489
86578
|
const groupedResults = await reviewer.reviewPR(owner, repo, prNumber, prInfo, {
|
|
86490
86579
|
focus,
|
|
86491
86580
|
format,
|
|
86492
86581
|
config: config,
|
|
86493
|
-
checks:
|
|
86582
|
+
checks: filteredCheckIds,
|
|
86494
86583
|
parallelExecution: false,
|
|
86495
86584
|
});
|
|
86496
86585
|
// Check if commenting is enabled before posting
|
|
@@ -86502,7 +86591,7 @@ async function handleIssueComment(octokit, owner, repo, context, inputs) {
|
|
|
86502
86591
|
});
|
|
86503
86592
|
}
|
|
86504
86593
|
else {
|
|
86505
|
-
console.log('📝 Skipping
|
|
86594
|
+
console.log('📝 Skipping comment (comment-on-pr is disabled)');
|
|
86506
86595
|
}
|
|
86507
86596
|
// Calculate total check results from grouped results
|
|
86508
86597
|
const totalChecks = Object.values(groupedResults).flat().length;
|
|
@@ -86530,6 +86619,8 @@ async function handlePullRequestWithConfig(octokit, owner, repo, inputs, config,
|
|
|
86530
86619
|
let prInfo;
|
|
86531
86620
|
try {
|
|
86532
86621
|
prInfo = await analyzer.fetchPRDiff(owner, repo, prNumber, undefined, eventType);
|
|
86622
|
+
// Add event context for templates
|
|
86623
|
+
prInfo.eventContext = context.event;
|
|
86533
86624
|
}
|
|
86534
86625
|
catch (error) {
|
|
86535
86626
|
// Handle test scenarios with mock repos
|
|
@@ -88061,6 +88152,7 @@ class AICheckProvider extends check_provider_interface_1.CheckProvider {
|
|
|
88061
88152
|
? {
|
|
88062
88153
|
name: eventContext.event_name || 'unknown',
|
|
88063
88154
|
action: eventContext.action,
|
|
88155
|
+
isPullRequest: !prInfo.isIssue, // Set based on whether this is a PR or an issue
|
|
88064
88156
|
// Repository Info
|
|
88065
88157
|
repository: eventContext.repository
|
|
88066
88158
|
? {
|
package/dist/pr-analyzer.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"","sourceRoot":"","sources":["file:///home/runner/work/visor/visor/src/pr-analyzer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,MAAM,WAAW,MAAM;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,OAAO,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC;CACtD;AAED,MAAM,WAAW,MAAM;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,OAAO,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC;CACtD;AAED,MAAM,WAAW,MAAM;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb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EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,gBAAgB,EAAE,YAAY,CAAC;IAClD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACxC;AAQD,qBAAa,UAAU;IAEnB,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,UAAU;gBADV,OAAO,EAAE,OAAO,EAChB,UAAU,GAAE,MAAU;IAGhC;;OAEG;IACG,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAwBtF;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAOlB,WAAW,CACf,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,SAAS,CAAC,EAAE,MAAM,EAClB,SAAS,CAAC,EAAE,OAAO,gBAAgB,EAAE,YAAY,GAChD,OAAO,CAAC,MAAM,CAAC;IAqGZ,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;;;;;;;YAkBrD,SAAS;IAwCvB,OAAO,CAAC,gBAAgB;CAkBzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-check-provider.d.ts","sourceRoot":"","sources":["file:///home/runner/work/visor/visor/src/providers/ai-check-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAO5C;;GAEG;AACH,qBAAa,eAAgB,SAAQ,aAAa;IAChD,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,YAAY,CAAS;;IAQ7B,OAAO,IAAI,MAAM;IAIjB,cAAc,IAAI,MAAM;IAIlB,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAoCvD;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAiB7B;;OAEG;YACW,aAAa;IAmB3B;;OAEG;YACW,UAAU;IAsExB;;OAEG;YACW,kBAAkB;IA0ChC;;OAEG;YACW,oBAAoB;
|
|
1
|
+
{"version":3,"file":"ai-check-provider.d.ts","sourceRoot":"","sources":["file:///home/runner/work/visor/visor/src/providers/ai-check-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAO5C;;GAEG;AACH,qBAAa,eAAgB,SAAQ,aAAa;IAChD,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,YAAY,CAAS;;IAQ7B,OAAO,IAAI,MAAM;IAIjB,cAAc,IAAI,MAAM;IAIlB,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAoCvD;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAiB7B;;OAEG;YACW,aAAa;IAmB3B;;OAEG;YACW,UAAU;IAsExB;;OAEG;YACW,kBAAkB;IA0ChC;;OAEG;YACW,oBAAoB;IA+J5B,OAAO,CACX,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,mBAAmB,EAC3B,kBAAkB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,EAC/C,WAAW,CAAC,EAAE;QAAE,eAAe,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,OAAO,CAAA;KAAE,GACjE,OAAO,CAAC,aAAa,CAAC;YAiBX,iBAAiB;IAmH/B,sBAAsB,IAAI,MAAM,EAAE;IAiB5B,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IASrC,eAAe,IAAI,MAAM,EAAE;CAO5B"}
|