@probelabs/visor 0.1.93 → 0.1.95
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/README.md +4 -4
- package/defaults/.visor.yaml +86 -6
- package/dist/ai-review-service.d.ts +1 -1
- package/dist/ai-review-service.d.ts.map +1 -1
- package/dist/check-execution-engine.d.ts +5 -0
- package/dist/check-execution-engine.d.ts.map +1 -1
- package/dist/cli.d.ts +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/commands.d.ts.map +1 -1
- package/dist/config.d.ts +9 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/defaults/.visor.yaml +86 -6
- package/dist/failure-condition-evaluator.d.ts.map +1 -1
- package/dist/footer.d.ts +25 -0
- package/dist/footer.d.ts.map +1 -0
- package/dist/github-check-service.d.ts.map +1 -1
- package/dist/github-comments.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1074 -472
- package/dist/output/code-review/schema.json +0 -23
- package/dist/providers/command-check-provider.d.ts.map +1 -1
- package/dist/providers/log-check-provider.d.ts.map +1 -1
- package/dist/providers/memory-check-provider.d.ts.map +1 -1
- package/dist/reviewer.d.ts +11 -0
- package/dist/reviewer.d.ts.map +1 -1
- package/dist/sdk/{check-execution-engine-RORGGGGP.mjs → check-execution-engine-NMPXJ7FQ.mjs} +2 -2
- package/dist/sdk/{chunk-Z47UECAT.mjs → chunk-Q4S5A5TO.mjs} +314 -111
- package/dist/sdk/chunk-Q4S5A5TO.mjs.map +1 -0
- package/dist/sdk/sdk.d.mts +11 -2
- package/dist/sdk/sdk.d.ts +11 -2
- package/dist/sdk/sdk.js +398 -152
- package/dist/sdk/sdk.js.map +1 -1
- package/dist/sdk/sdk.mjs +57 -24
- package/dist/sdk/sdk.mjs.map +1 -1
- package/dist/sdk.d.ts +11 -2
- package/dist/sdk.d.ts.map +1 -1
- package/dist/traces/{run-2025-10-15T11-54-04-087Z.ndjson → run-2025-10-18T18-27-25-085Z.ndjson} +8 -1
- package/dist/traces/{run-2025-10-15T11-54-14-046Z.ndjson → run-2025-10-18T18-27-35-400Z.ndjson} +8 -1
- package/dist/traces/{run-2025-10-15T11-54-14-575Z.ndjson → run-2025-10-18T18-27-35-937Z.ndjson} +8 -1
- package/dist/traces/{run-2025-10-15T11-54-15-082Z.ndjson → run-2025-10-18T18-27-36-428Z.ndjson} +8 -1
- package/dist/types/cli.d.ts +3 -2
- package/dist/types/cli.d.ts.map +1 -1
- package/dist/types/config.d.ts +0 -2
- package/dist/types/config.d.ts.map +1 -1
- package/dist/utils/diff-processor.d.ts +6 -0
- package/dist/utils/diff-processor.d.ts.map +1 -0
- package/package.json +2 -2
- package/dist/sdk/chunk-Z47UECAT.mjs.map +0 -1
- /package/dist/sdk/{check-execution-engine-RORGGGGP.mjs.map → check-execution-engine-NMPXJ7FQ.mjs.map} +0 -0
- /package/dist/traces/{run-2025-10-15T11-54-15-561Z.ndjson → run-2025-10-18T18-27-36-917Z.ndjson} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
process.env.VISOR_VERSION = '0.1.
|
|
3
|
-
process.env.PROBE_VERSION = '0.6.0-
|
|
2
|
+
process.env.VISOR_VERSION = '0.1.95';
|
|
3
|
+
process.env.PROBE_VERSION = '0.6.0-rc145';
|
|
4
4
|
/******/ (() => { // webpackBootstrap
|
|
5
5
|
/******/ var __webpack_modules__ = ({
|
|
6
6
|
|
|
@@ -218031,6 +218031,7 @@ const probe_1 = __nccwpck_require__(83841);
|
|
|
218031
218031
|
const session_registry_1 = __nccwpck_require__(46059);
|
|
218032
218032
|
const logger_1 = __nccwpck_require__(86999);
|
|
218033
218033
|
const tracer_init_1 = __nccwpck_require__(11903);
|
|
218034
|
+
const diff_processor_1 = __nccwpck_require__(29883);
|
|
218034
218035
|
/**
|
|
218035
218036
|
* Helper function to log debug messages using the centralized logger
|
|
218036
218037
|
*/
|
|
@@ -218083,7 +218084,7 @@ class AIReviewService {
|
|
|
218083
218084
|
/**
|
|
218084
218085
|
* Execute AI review using probe agent
|
|
218085
218086
|
*/
|
|
218086
|
-
async executeReview(prInfo, customPrompt, schema,
|
|
218087
|
+
async executeReview(prInfo, customPrompt, schema, checkName, sessionId) {
|
|
218087
218088
|
const startTime = Date.now();
|
|
218088
218089
|
const timestamp = new Date().toISOString();
|
|
218089
218090
|
// Build prompt from custom instructions
|
|
@@ -218140,7 +218141,7 @@ class AIReviewService {
|
|
|
218140
218141
|
}
|
|
218141
218142
|
}
|
|
218142
218143
|
try {
|
|
218143
|
-
const { response, effectiveSchema } = await this.callProbeAgent(prompt, schema, debugInfo,
|
|
218144
|
+
const { response, effectiveSchema } = await this.callProbeAgent(prompt, schema, debugInfo, checkName, sessionId);
|
|
218144
218145
|
const processingTime = Date.now() - startTime;
|
|
218145
218146
|
if (debugInfo) {
|
|
218146
218147
|
debugInfo.rawResponse = response;
|
|
@@ -218300,10 +218301,10 @@ class AIReviewService {
|
|
|
218300
218301
|
async buildCustomPrompt(prInfo, customInstructions, schema, options) {
|
|
218301
218302
|
// When reusing sessions, skip PR context to avoid sending duplicate diff data
|
|
218302
218303
|
const skipPRContext = options?.skipPRContext === true;
|
|
218303
|
-
const prContext = skipPRContext ? '' : this.formatPRContext(prInfo);
|
|
218304
|
-
const isIssue = prInfo.isIssue === true;
|
|
218305
218304
|
// Check if we're using the code-review schema
|
|
218306
218305
|
const isCodeReviewSchema = schema === 'code-review';
|
|
218306
|
+
const prContext = skipPRContext ? '' : await this.formatPRContext(prInfo, isCodeReviewSchema);
|
|
218307
|
+
const isIssue = prInfo.isIssue === true;
|
|
218307
218308
|
if (isIssue) {
|
|
218308
218309
|
// Issue context - no code analysis needed
|
|
218309
218310
|
if (skipPRContext) {
|
|
@@ -218401,7 +218402,7 @@ ${prContext}
|
|
|
218401
218402
|
/**
|
|
218402
218403
|
* Format PR or Issue context for the AI using XML structure
|
|
218403
218404
|
*/
|
|
218404
|
-
formatPRContext(prInfo) {
|
|
218405
|
+
async formatPRContext(prInfo, isCodeReviewSchema) {
|
|
218405
218406
|
// Check if this is an issue (not a PR)
|
|
218406
218407
|
const prContextInfo = prInfo;
|
|
218407
218408
|
const isIssue = prContextInfo.isIssue === true;
|
|
@@ -218496,9 +218497,14 @@ ${this.escapeXml(prInfo.body)}
|
|
|
218496
218497
|
const issueComments = prInfo.comments;
|
|
218497
218498
|
if (issueComments && issueComments.length > 0) {
|
|
218498
218499
|
// Filter out the triggering comment from history if present
|
|
218499
|
-
|
|
218500
|
+
let historicalComments = triggeringComment
|
|
218500
218501
|
? issueComments.filter(c => c.id !== triggeringComment.id)
|
|
218501
218502
|
: issueComments;
|
|
218503
|
+
// For code-review schema checks, filter out previous Visor code-review comments to avoid self-bias
|
|
218504
|
+
// Comment IDs look like: <!-- visor-comment-id:pr-review-244-review -->
|
|
218505
|
+
if (isCodeReviewSchema) {
|
|
218506
|
+
historicalComments = historicalComments.filter(c => !c.body || !c.body.includes('visor-comment-id:pr-review-'));
|
|
218507
|
+
}
|
|
218502
218508
|
if (historicalComments.length > 0) {
|
|
218503
218509
|
context += `
|
|
218504
218510
|
<!-- Previous comments in chronological order (excluding triggering comment) -->
|
|
@@ -218545,26 +218551,34 @@ ${this.escapeXml(prInfo.body)}
|
|
|
218545
218551
|
if (includeCodeContext) {
|
|
218546
218552
|
// Add full diff if available (for complete PR review)
|
|
218547
218553
|
if (prInfo.fullDiff) {
|
|
218554
|
+
// Process the diff with outline-diff format for better structure
|
|
218555
|
+
const processedFullDiff = await (0, diff_processor_1.processDiffWithOutline)(prInfo.fullDiff);
|
|
218548
218556
|
context += `
|
|
218549
|
-
<!-- Complete unified diff showing all changes in the pull request -->
|
|
218557
|
+
<!-- Complete unified diff showing all changes in the pull request (processed with outline-diff) -->
|
|
218550
218558
|
<full_diff>
|
|
218551
|
-
${this.escapeXml(
|
|
218559
|
+
${this.escapeXml(processedFullDiff)}
|
|
218552
218560
|
</full_diff>`;
|
|
218553
218561
|
}
|
|
218554
218562
|
// Add incremental commit diff if available (for new commit analysis)
|
|
218555
218563
|
if (prInfo.isIncremental) {
|
|
218556
218564
|
if (prInfo.commitDiff && prInfo.commitDiff.length > 0) {
|
|
218565
|
+
// Process the commit diff with outline-diff format for better structure
|
|
218566
|
+
const processedCommitDiff = await (0, diff_processor_1.processDiffWithOutline)(prInfo.commitDiff);
|
|
218557
218567
|
context += `
|
|
218558
|
-
<!-- Diff of only the latest commit for incremental analysis -->
|
|
218568
|
+
<!-- Diff of only the latest commit for incremental analysis (processed with outline-diff) -->
|
|
218559
218569
|
<commit_diff>
|
|
218560
|
-
${this.escapeXml(
|
|
218570
|
+
${this.escapeXml(processedCommitDiff)}
|
|
218561
218571
|
</commit_diff>`;
|
|
218562
218572
|
}
|
|
218563
218573
|
else {
|
|
218574
|
+
// Process the fallback full diff with outline-diff format
|
|
218575
|
+
const processedFallbackDiff = prInfo.fullDiff
|
|
218576
|
+
? await (0, diff_processor_1.processDiffWithOutline)(prInfo.fullDiff)
|
|
218577
|
+
: '';
|
|
218564
218578
|
context += `
|
|
218565
|
-
<!-- Commit diff could not be retrieved - falling back to full diff analysis -->
|
|
218579
|
+
<!-- Commit diff could not be retrieved - falling back to full diff analysis (processed with outline-diff) -->
|
|
218566
218580
|
<commit_diff>
|
|
218567
|
-
${
|
|
218581
|
+
${this.escapeXml(processedFallbackDiff)}
|
|
218568
218582
|
</commit_diff>`;
|
|
218569
218583
|
}
|
|
218570
218584
|
}
|
|
@@ -218606,9 +218620,14 @@ ${prInfo.fullDiff ? this.escapeXml(prInfo.fullDiff) : ''}
|
|
|
218606
218620
|
const prComments = prInfo.comments;
|
|
218607
218621
|
if (prComments && prComments.length > 0) {
|
|
218608
218622
|
// Filter out the triggering comment from history if present
|
|
218609
|
-
|
|
218623
|
+
let historicalComments = triggeringComment
|
|
218610
218624
|
? prComments.filter(c => c.id !== triggeringComment.id)
|
|
218611
218625
|
: prComments;
|
|
218626
|
+
// For code-review schema checks, filter out previous Visor code-review comments to avoid self-bias
|
|
218627
|
+
// Comment IDs look like: <!-- visor-comment-id:pr-review-244-review -->
|
|
218628
|
+
if (isCodeReviewSchema) {
|
|
218629
|
+
historicalComments = historicalComments.filter(c => !c.body || !c.body.includes('visor-comment-id:pr-review-'));
|
|
218630
|
+
}
|
|
218612
218631
|
if (historicalComments.length > 0) {
|
|
218613
218632
|
context += `
|
|
218614
218633
|
<!-- Previous PR comments in chronological order (excluding triggering comment) -->
|
|
@@ -219842,6 +219861,8 @@ class CheckExecutionEngine {
|
|
|
219842
219861
|
webhookContext;
|
|
219843
219862
|
routingSandbox;
|
|
219844
219863
|
executionStats = new Map();
|
|
219864
|
+
// Track history of all outputs for each check (useful for loops and goto)
|
|
219865
|
+
outputHistory = new Map();
|
|
219845
219866
|
// Event override to simulate alternate event (used during routing goto)
|
|
219846
219867
|
routingEventOverride;
|
|
219847
219868
|
// Cached GitHub context for context elevation when running in Actions
|
|
@@ -220102,6 +220123,8 @@ class CheckExecutionEngine {
|
|
|
220102
220123
|
transform_js: targetCfg.transform_js,
|
|
220103
220124
|
env: targetCfg.env,
|
|
220104
220125
|
forEach: targetCfg.forEach,
|
|
220126
|
+
// Pass output history for loop/goto scenarios
|
|
220127
|
+
__outputHistory: this.outputHistory,
|
|
220105
220128
|
// Include provider-specific keys (e.g., op/values for github)
|
|
220106
220129
|
...targetCfg,
|
|
220107
220130
|
ai: {
|
|
@@ -220178,6 +220201,11 @@ class CheckExecutionEngine {
|
|
|
220178
220201
|
timestamp: Date.now(),
|
|
220179
220202
|
}));
|
|
220180
220203
|
const enriched = { ...r, issues: enrichedIssues };
|
|
220204
|
+
// Track output history for loop/goto scenarios
|
|
220205
|
+
const enrichedWithOutput = enriched;
|
|
220206
|
+
if (enrichedWithOutput.output !== undefined) {
|
|
220207
|
+
this.trackOutputHistory(target, enrichedWithOutput.output);
|
|
220208
|
+
}
|
|
220181
220209
|
resultsMap?.set(target, enriched);
|
|
220182
220210
|
if (debug)
|
|
220183
220211
|
log(`🔧 Debug: inline executed '${target}', issues: ${enrichedIssues.length}`);
|
|
@@ -220941,6 +220969,8 @@ class CheckExecutionEngine {
|
|
|
220941
220969
|
ai_model: checkConfig.ai_model || config.ai_model,
|
|
220942
220970
|
// Pass claude_code config if present
|
|
220943
220971
|
claude_code: checkConfig.claude_code,
|
|
220972
|
+
// Pass output history for loop/goto scenarios
|
|
220973
|
+
__outputHistory: this.outputHistory,
|
|
220944
220974
|
// Pass any provider-specific config
|
|
220945
220975
|
...checkConfig,
|
|
220946
220976
|
};
|
|
@@ -220974,10 +221004,15 @@ class CheckExecutionEngine {
|
|
|
220974
221004
|
}
|
|
220975
221005
|
// Render the check content using the appropriate template
|
|
220976
221006
|
const content = await this.renderCheckContent(checkName, result, checkConfig, prInfo);
|
|
221007
|
+
// Determine the group: if group_by is 'check', use the check name; otherwise use configured group or 'default'
|
|
221008
|
+
let group = checkConfig.group || 'default';
|
|
221009
|
+
if (config?.output?.pr_comment?.group_by === 'check' && !checkConfig.group) {
|
|
221010
|
+
group = checkName;
|
|
221011
|
+
}
|
|
220977
221012
|
return {
|
|
220978
221013
|
checkName,
|
|
220979
221014
|
content,
|
|
220980
|
-
group
|
|
221015
|
+
group,
|
|
220981
221016
|
output: result.output,
|
|
220982
221017
|
debug: result.debug,
|
|
220983
221018
|
issues: result.issues, // Include structured issues
|
|
@@ -221129,16 +221164,20 @@ class CheckExecutionEngine {
|
|
|
221129
221164
|
},
|
|
221130
221165
|
];
|
|
221131
221166
|
}
|
|
221167
|
+
// Determine the group: if group_by is 'check', use the check name; otherwise use configured group or 'default'
|
|
221168
|
+
let group = checkConfig.group || 'default';
|
|
221169
|
+
if (config?.output?.pr_comment?.group_by === 'check' && !checkConfig.group) {
|
|
221170
|
+
group = checkName;
|
|
221171
|
+
}
|
|
221132
221172
|
const checkResult = {
|
|
221133
221173
|
checkName,
|
|
221134
221174
|
content,
|
|
221135
|
-
group
|
|
221175
|
+
group,
|
|
221136
221176
|
output: checkSummary.output,
|
|
221137
221177
|
debug: reviewSummary.debug,
|
|
221138
221178
|
issues: issuesForCheck, // Include structured issues + rendering error if any
|
|
221139
221179
|
};
|
|
221140
221180
|
// Add to appropriate group
|
|
221141
|
-
const group = checkResult.group;
|
|
221142
221181
|
if (!groupedResults[group]) {
|
|
221143
221182
|
groupedResults[group] = [];
|
|
221144
221183
|
}
|
|
@@ -222150,6 +222189,11 @@ class CheckExecutionEngine {
|
|
|
222150
222189
|
const iterationDuration = (Date.now() - iterationStart) / 1000;
|
|
222151
222190
|
this.recordIterationComplete(checkName, iterationStart, !hadFatalError, // Success if no fatal errors
|
|
222152
222191
|
itemResult.issues || [], itemResult.output);
|
|
222192
|
+
// Track output history for forEach iterations
|
|
222193
|
+
const itemOutput = itemResult.output;
|
|
222194
|
+
if (itemOutput !== undefined) {
|
|
222195
|
+
this.trackOutputHistory(checkName, itemOutput);
|
|
222196
|
+
}
|
|
222153
222197
|
// General branch-first scheduling for this item: execute all descendants (from current node only) when ready
|
|
222154
222198
|
const descendantSet = (() => {
|
|
222155
222199
|
const visited = new Set();
|
|
@@ -222796,6 +222840,11 @@ class CheckExecutionEngine {
|
|
|
222796
222840
|
]);
|
|
222797
222841
|
}
|
|
222798
222842
|
catch { }
|
|
222843
|
+
// Track output history for loop/goto scenarios
|
|
222844
|
+
const reviewResultWithOutput = reviewResult;
|
|
222845
|
+
if (reviewResultWithOutput.output !== undefined) {
|
|
222846
|
+
this.trackOutputHistory(checkName, reviewResultWithOutput.output);
|
|
222847
|
+
}
|
|
222799
222848
|
results.set(checkName, reviewResult);
|
|
222800
222849
|
}
|
|
222801
222850
|
else {
|
|
@@ -224044,6 +224093,17 @@ class CheckExecutionEngine {
|
|
|
224044
224093
|
stats.outputsProduced = (stats.outputsProduced || 0) + 1;
|
|
224045
224094
|
}
|
|
224046
224095
|
}
|
|
224096
|
+
/**
|
|
224097
|
+
* Track output in history for loop/goto scenarios
|
|
224098
|
+
*/
|
|
224099
|
+
trackOutputHistory(checkName, output) {
|
|
224100
|
+
if (output === undefined)
|
|
224101
|
+
return;
|
|
224102
|
+
if (!this.outputHistory.has(checkName)) {
|
|
224103
|
+
this.outputHistory.set(checkName, []);
|
|
224104
|
+
}
|
|
224105
|
+
this.outputHistory.get(checkName).push(output);
|
|
224106
|
+
}
|
|
224047
224107
|
/**
|
|
224048
224108
|
* Record that a check was skipped
|
|
224049
224109
|
*/
|
|
@@ -224912,6 +224972,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
224912
224972
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
224913
224973
|
exports.CLI = void 0;
|
|
224914
224974
|
const commander_1 = __nccwpck_require__(18909);
|
|
224975
|
+
const config_1 = __nccwpck_require__(22973);
|
|
224915
224976
|
const fs = __importStar(__nccwpck_require__(79896));
|
|
224916
224977
|
const path = __importStar(__nccwpck_require__(16928));
|
|
224917
224978
|
/**
|
|
@@ -224921,6 +224982,12 @@ class CLI {
|
|
|
224921
224982
|
program;
|
|
224922
224983
|
validChecks = ['performance', 'architecture', 'security', 'style', 'all'];
|
|
224923
224984
|
validOutputs = ['table', 'json', 'markdown', 'sarif'];
|
|
224985
|
+
// Valid events: all core EventTrigger types plus 'all' for CLI-only usage
|
|
224986
|
+
// Reuses VALID_EVENT_TRIGGERS from config.ts as the single source of truth
|
|
224987
|
+
validEvents = [
|
|
224988
|
+
...config_1.VALID_EVENT_TRIGGERS,
|
|
224989
|
+
'all', // CLI-specific: run checks regardless of event triggers
|
|
224990
|
+
];
|
|
224924
224991
|
constructor() {
|
|
224925
224992
|
this.program = new commander_1.Command();
|
|
224926
224993
|
this.setupProgram();
|
|
@@ -225051,6 +225118,8 @@ class CLI {
|
|
|
225051
225118
|
help: options.help,
|
|
225052
225119
|
version: options.version,
|
|
225053
225120
|
codeContext,
|
|
225121
|
+
analyzeBranchDiff: options.analyzeBranchDiff,
|
|
225122
|
+
event: options.event,
|
|
225054
225123
|
};
|
|
225055
225124
|
}
|
|
225056
225125
|
catch (error) {
|
|
@@ -225101,6 +225170,10 @@ class CLI {
|
|
|
225101
225170
|
throw new Error(`Invalid max parallelism value: ${options.maxParallelism}. Max parallelism must be a positive integer (minimum 1).`);
|
|
225102
225171
|
}
|
|
225103
225172
|
}
|
|
225173
|
+
// Validate event type
|
|
225174
|
+
if (options.event && !this.validEvents.includes(options.event)) {
|
|
225175
|
+
throw new Error(`Invalid event type: ${options.event}. Available options: ${this.validEvents.join(', ')}`);
|
|
225176
|
+
}
|
|
225104
225177
|
}
|
|
225105
225178
|
/**
|
|
225106
225179
|
* Get help text
|
|
@@ -225127,6 +225200,7 @@ class CLI {
|
|
|
225127
225200
|
.option('--enable-code-context', 'Force include code diffs in analysis (CLI mode)')
|
|
225128
225201
|
.option('--disable-code-context', 'Force exclude code diffs from analysis (CLI mode)')
|
|
225129
225202
|
.option('--analyze-branch-diff', 'Analyze diff vs base branch when on feature branch (auto-enabled for code-review schemas)')
|
|
225203
|
+
.option('--event <type>', 'Simulate GitHub event (pr_opened, pr_updated, issue_opened, issue_comment, manual, all). Default: auto-detect from schema or "all"')
|
|
225130
225204
|
.option('--mode <mode>', 'Run mode (cli|github-actions). Default: cli')
|
|
225131
225205
|
.addHelpText('after', this.getExamplesText());
|
|
225132
225206
|
// Get the basic help and append examples manually if addHelpText doesn't work
|
|
@@ -225209,13 +225283,14 @@ exports.CLI = CLI;
|
|
|
225209
225283
|
/***/ }),
|
|
225210
225284
|
|
|
225211
225285
|
/***/ 99153:
|
|
225212
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
225286
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
225213
225287
|
|
|
225214
225288
|
"use strict";
|
|
225215
225289
|
|
|
225216
225290
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
225217
225291
|
exports.parseComment = parseComment;
|
|
225218
225292
|
exports.getHelpText = getHelpText;
|
|
225293
|
+
const footer_1 = __nccwpck_require__(6924);
|
|
225219
225294
|
function parseComment(body, supportedCommands) {
|
|
225220
225295
|
const trimmed = body.trim();
|
|
225221
225296
|
if (!trimmed.startsWith('/')) {
|
|
@@ -225261,8 +225336,7 @@ function getHelpText(customCommands) {
|
|
|
225261
225336
|
${commandList}
|
|
225262
225337
|
Commands are case-insensitive and can be used in PR comments.
|
|
225263
225338
|
|
|
225264
|
-
|
|
225265
|
-
*Powered by [Visor](https://probelabs.com/visor) from [Probelabs](https://probelabs.com)*`;
|
|
225339
|
+
${(0, footer_1.generateFooter)()}`;
|
|
225266
225340
|
}
|
|
225267
225341
|
|
|
225268
225342
|
|
|
@@ -225310,7 +225384,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
225310
225384
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
225311
225385
|
};
|
|
225312
225386
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
225313
|
-
exports.ConfigManager = void 0;
|
|
225387
|
+
exports.ConfigManager = exports.VALID_EVENT_TRIGGERS = void 0;
|
|
225314
225388
|
const yaml = __importStar(__nccwpck_require__(74281));
|
|
225315
225389
|
const fs = __importStar(__nccwpck_require__(79896));
|
|
225316
225390
|
const path = __importStar(__nccwpck_require__(16928));
|
|
@@ -225320,6 +225394,20 @@ const config_loader_1 = __nccwpck_require__(73836);
|
|
|
225320
225394
|
const config_merger_1 = __nccwpck_require__(20730);
|
|
225321
225395
|
const ajv_1 = __importDefault(__nccwpck_require__(42463));
|
|
225322
225396
|
const ajv_formats_1 = __importDefault(__nccwpck_require__(82815));
|
|
225397
|
+
/**
|
|
225398
|
+
* Valid event triggers for checks
|
|
225399
|
+
* Exported as a constant to serve as the single source of truth for event validation
|
|
225400
|
+
*/
|
|
225401
|
+
exports.VALID_EVENT_TRIGGERS = [
|
|
225402
|
+
'pr_opened',
|
|
225403
|
+
'pr_updated',
|
|
225404
|
+
'pr_closed',
|
|
225405
|
+
'issue_opened',
|
|
225406
|
+
'issue_comment',
|
|
225407
|
+
'manual',
|
|
225408
|
+
'schedule',
|
|
225409
|
+
'webhook_received',
|
|
225410
|
+
];
|
|
225323
225411
|
/**
|
|
225324
225412
|
* Configuration manager for Visor
|
|
225325
225413
|
*/
|
|
@@ -225331,20 +225419,13 @@ class ConfigManager {
|
|
|
225331
225419
|
'http',
|
|
225332
225420
|
'http_input',
|
|
225333
225421
|
'http_client',
|
|
225422
|
+
'memory',
|
|
225334
225423
|
'noop',
|
|
225335
225424
|
'log',
|
|
225425
|
+
'memory',
|
|
225336
225426
|
'github',
|
|
225337
225427
|
];
|
|
225338
|
-
validEventTriggers = [
|
|
225339
|
-
'pr_opened',
|
|
225340
|
-
'pr_updated',
|
|
225341
|
-
'pr_closed',
|
|
225342
|
-
'issue_opened',
|
|
225343
|
-
'issue_comment',
|
|
225344
|
-
'manual',
|
|
225345
|
-
'schedule',
|
|
225346
|
-
'webhook_received',
|
|
225347
|
-
];
|
|
225428
|
+
validEventTriggers = [...exports.VALID_EVENT_TRIGGERS];
|
|
225348
225429
|
validOutputFormats = ['table', 'json', 'markdown', 'sarif'];
|
|
225349
225430
|
validGroupByOptions = ['check', 'file', 'severity', 'group'];
|
|
225350
225431
|
/**
|
|
@@ -225352,18 +225433,22 @@ class ConfigManager {
|
|
|
225352
225433
|
*/
|
|
225353
225434
|
async loadConfig(configPath, options = {}) {
|
|
225354
225435
|
const { validate = true, mergeDefaults = true, allowedRemotePatterns } = options;
|
|
225436
|
+
// Resolve relative paths to absolute paths based on current working directory
|
|
225437
|
+
const resolvedPath = path.isAbsolute(configPath)
|
|
225438
|
+
? configPath
|
|
225439
|
+
: path.resolve(process.cwd(), configPath);
|
|
225355
225440
|
try {
|
|
225356
|
-
if (!fs.existsSync(
|
|
225357
|
-
throw new Error(`Configuration file not found: ${
|
|
225441
|
+
if (!fs.existsSync(resolvedPath)) {
|
|
225442
|
+
throw new Error(`Configuration file not found: ${resolvedPath}`);
|
|
225358
225443
|
}
|
|
225359
|
-
const configContent = fs.readFileSync(
|
|
225444
|
+
const configContent = fs.readFileSync(resolvedPath, 'utf8');
|
|
225360
225445
|
let parsedConfig;
|
|
225361
225446
|
try {
|
|
225362
225447
|
parsedConfig = yaml.load(configContent);
|
|
225363
225448
|
}
|
|
225364
225449
|
catch (yamlError) {
|
|
225365
225450
|
const errorMessage = yamlError instanceof Error ? yamlError.message : String(yamlError);
|
|
225366
|
-
throw new Error(`Invalid YAML syntax in ${
|
|
225451
|
+
throw new Error(`Invalid YAML syntax in ${resolvedPath}: ${errorMessage}`);
|
|
225367
225452
|
}
|
|
225368
225453
|
if (!parsedConfig || typeof parsedConfig !== 'object') {
|
|
225369
225454
|
throw new Error('Configuration file must contain a valid YAML object');
|
|
@@ -225371,7 +225456,7 @@ class ConfigManager {
|
|
|
225371
225456
|
// Handle extends directive if present
|
|
225372
225457
|
if (parsedConfig.extends) {
|
|
225373
225458
|
const loaderOptions = {
|
|
225374
|
-
baseDir: path.dirname(
|
|
225459
|
+
baseDir: path.dirname(resolvedPath),
|
|
225375
225460
|
allowRemote: this.isRemoteExtendsAllowed(),
|
|
225376
225461
|
maxDepth: 10,
|
|
225377
225462
|
allowedRemotePatterns,
|
|
@@ -225417,12 +225502,12 @@ class ConfigManager {
|
|
|
225417
225502
|
}
|
|
225418
225503
|
// Add more context for generic errors
|
|
225419
225504
|
if (error.message.includes('ENOENT')) {
|
|
225420
|
-
throw new Error(`Configuration file not found: ${
|
|
225505
|
+
throw new Error(`Configuration file not found: ${resolvedPath}`);
|
|
225421
225506
|
}
|
|
225422
225507
|
if (error.message.includes('EPERM')) {
|
|
225423
|
-
throw new Error(`Permission denied reading configuration file: ${
|
|
225508
|
+
throw new Error(`Permission denied reading configuration file: ${resolvedPath}`);
|
|
225424
225509
|
}
|
|
225425
|
-
throw new Error(`Failed to read configuration file ${
|
|
225510
|
+
throw new Error(`Failed to read configuration file ${resolvedPath}: ${error.message}`);
|
|
225426
225511
|
}
|
|
225427
225512
|
throw error;
|
|
225428
225513
|
}
|
|
@@ -225605,8 +225690,10 @@ class ConfigManager {
|
|
|
225605
225690
|
}
|
|
225606
225691
|
/**
|
|
225607
225692
|
* Validate configuration against schema
|
|
225693
|
+
* @param config The config to validate
|
|
225694
|
+
* @param strict If true, treat warnings as errors (default: false)
|
|
225608
225695
|
*/
|
|
225609
|
-
validateConfig(config) {
|
|
225696
|
+
validateConfig(config, strict = false) {
|
|
225610
225697
|
const errors = [];
|
|
225611
225698
|
const warnings = [];
|
|
225612
225699
|
// First, run schema-based validation (runtime-generated).
|
|
@@ -225723,11 +225810,15 @@ class ConfigManager {
|
|
|
225723
225810
|
if (config.tag_filter) {
|
|
225724
225811
|
this.validateTagFilter(config.tag_filter, errors);
|
|
225725
225812
|
}
|
|
225813
|
+
// In strict mode, treat warnings as errors
|
|
225814
|
+
if (strict && warnings.length > 0) {
|
|
225815
|
+
errors.push(...warnings);
|
|
225816
|
+
}
|
|
225726
225817
|
if (errors.length > 0) {
|
|
225727
225818
|
throw new Error(errors[0].message);
|
|
225728
225819
|
}
|
|
225729
|
-
// Emit warnings (do not block execution)
|
|
225730
|
-
if (warnings.length > 0) {
|
|
225820
|
+
// Emit warnings (do not block execution) - only in non-strict mode
|
|
225821
|
+
if (!strict && warnings.length > 0) {
|
|
225731
225822
|
for (const w of warnings) {
|
|
225732
225823
|
logger_1.logger.warn(`⚠️ Config warning [${w.field}]: ${w.message}`);
|
|
225733
225824
|
}
|
|
@@ -226853,11 +226944,6 @@ class FailureConditionEvaluator {
|
|
|
226853
226944
|
return false;
|
|
226854
226945
|
return issues.some(issue => issue.file?.includes(pattern));
|
|
226855
226946
|
};
|
|
226856
|
-
const hasSuggestion = (suggestions, text) => {
|
|
226857
|
-
if (!Array.isArray(suggestions))
|
|
226858
|
-
return false;
|
|
226859
|
-
return suggestions.some(s => s.toLowerCase().includes(text.toLowerCase()));
|
|
226860
|
-
};
|
|
226861
226947
|
// Backward compatibility aliases
|
|
226862
226948
|
const hasIssueWith = hasIssue;
|
|
226863
226949
|
const hasFileWith = hasFileMatching;
|
|
@@ -226872,7 +226958,6 @@ class FailureConditionEvaluator {
|
|
|
226872
226958
|
// Extract context variables
|
|
226873
226959
|
const output = context.output || {};
|
|
226874
226960
|
const issues = output.issues || [];
|
|
226875
|
-
const suggestions = [];
|
|
226876
226961
|
// Backward compatibility: provide metadata for transition period
|
|
226877
226962
|
// TODO: Remove after all configurations are updated
|
|
226878
226963
|
const metadata = context.metadata || {
|
|
@@ -226923,7 +227008,6 @@ class FailureConditionEvaluator {
|
|
|
226923
227008
|
memory: memoryAccessor,
|
|
226924
227009
|
// Legacy compatibility variables
|
|
226925
227010
|
issues,
|
|
226926
|
-
suggestions,
|
|
226927
227011
|
metadata,
|
|
226928
227012
|
criticalIssues,
|
|
226929
227013
|
errorIssues,
|
|
@@ -226952,7 +227036,6 @@ class FailureConditionEvaluator {
|
|
|
226952
227036
|
hasIssue,
|
|
226953
227037
|
countIssues,
|
|
226954
227038
|
hasFileMatching,
|
|
226955
|
-
hasSuggestion,
|
|
226956
227039
|
hasIssueWith,
|
|
226957
227040
|
hasFileWith,
|
|
226958
227041
|
// Permission helpers
|
|
@@ -227236,6 +227319,53 @@ class FailureConditionEvaluator {
|
|
|
227236
227319
|
exports.FailureConditionEvaluator = FailureConditionEvaluator;
|
|
227237
227320
|
|
|
227238
227321
|
|
|
227322
|
+
/***/ }),
|
|
227323
|
+
|
|
227324
|
+
/***/ 6924:
|
|
227325
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
227326
|
+
|
|
227327
|
+
"use strict";
|
|
227328
|
+
|
|
227329
|
+
/**
|
|
227330
|
+
* Centralized footer generation for Visor comments and outputs
|
|
227331
|
+
*/
|
|
227332
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
227333
|
+
exports.generateFooter = generateFooter;
|
|
227334
|
+
exports.hasVisorFooter = hasVisorFooter;
|
|
227335
|
+
/**
|
|
227336
|
+
* Generate a standard Visor footer with branding and optional tip
|
|
227337
|
+
*/
|
|
227338
|
+
function generateFooter(options = {}) {
|
|
227339
|
+
const { includeMetadata, includeSeparator = true } = options;
|
|
227340
|
+
const parts = [];
|
|
227341
|
+
// Add separator
|
|
227342
|
+
if (includeSeparator) {
|
|
227343
|
+
parts.push('---');
|
|
227344
|
+
parts.push('');
|
|
227345
|
+
}
|
|
227346
|
+
// Add branding
|
|
227347
|
+
parts.push('*Powered by [Visor](https://probelabs.com/visor) from [Probelabs](https://probelabs.com)*');
|
|
227348
|
+
// Add metadata if provided
|
|
227349
|
+
if (includeMetadata) {
|
|
227350
|
+
const { lastUpdated, triggeredBy, commitSha } = includeMetadata;
|
|
227351
|
+
const commitInfo = commitSha ? ` | Commit: ${commitSha.substring(0, 7)}` : '';
|
|
227352
|
+
parts.push('');
|
|
227353
|
+
parts.push(`*Last updated: ${lastUpdated} | Triggered by: ${triggeredBy}${commitInfo}*`);
|
|
227354
|
+
}
|
|
227355
|
+
// Add tip
|
|
227356
|
+
parts.push('');
|
|
227357
|
+
parts.push('💡 **TIP:** You can chat with Visor using `/visor ask <your question>`');
|
|
227358
|
+
return parts.join('\n');
|
|
227359
|
+
}
|
|
227360
|
+
/**
|
|
227361
|
+
* Check if a string contains a Visor footer
|
|
227362
|
+
*/
|
|
227363
|
+
function hasVisorFooter(text) {
|
|
227364
|
+
return (text.includes('*Powered by [Visor](https://probelabs.com/visor)') ||
|
|
227365
|
+
text.includes('*Powered by [Visor](https://github.com/probelabs/visor)'));
|
|
227366
|
+
}
|
|
227367
|
+
|
|
227368
|
+
|
|
227239
227369
|
/***/ }),
|
|
227240
227370
|
|
|
227241
227371
|
/***/ 65543:
|
|
@@ -228776,7 +228906,7 @@ exports.GitRepositoryAnalyzer = GitRepositoryAnalyzer;
|
|
|
228776
228906
|
/***/ }),
|
|
228777
228907
|
|
|
228778
228908
|
/***/ 43748:
|
|
228779
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
228909
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
228780
228910
|
|
|
228781
228911
|
"use strict";
|
|
228782
228912
|
|
|
@@ -228785,6 +228915,7 @@ exports.GitRepositoryAnalyzer = GitRepositoryAnalyzer;
|
|
|
228785
228915
|
*/
|
|
228786
228916
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
228787
228917
|
exports.GitHubCheckService = void 0;
|
|
228918
|
+
const footer_1 = __nccwpck_require__(6924);
|
|
228788
228919
|
/**
|
|
228789
228920
|
* Service for managing GitHub Check Runs based on Visor failure conditions
|
|
228790
228921
|
*/
|
|
@@ -229026,9 +229157,7 @@ class GitHubCheckService {
|
|
|
229026
229157
|
}
|
|
229027
229158
|
// Footer
|
|
229028
229159
|
sections.push('');
|
|
229029
|
-
sections.push(
|
|
229030
|
-
sections.push('');
|
|
229031
|
-
sections.push('*Powered by [Visor](https://probelabs.com/visor) from [Probelabs](https://probelabs.com)*');
|
|
229160
|
+
sections.push((0, footer_1.generateFooter)());
|
|
229032
229161
|
return sections.join('\n');
|
|
229033
229162
|
}
|
|
229034
229163
|
/**
|
|
@@ -229239,6 +229368,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
229239
229368
|
exports.CommentManager = void 0;
|
|
229240
229369
|
const uuid_1 = __nccwpck_require__(31914);
|
|
229241
229370
|
const logger_1 = __nccwpck_require__(86999);
|
|
229371
|
+
const footer_1 = __nccwpck_require__(6924);
|
|
229242
229372
|
/**
|
|
229243
229373
|
* Manages GitHub PR comments with dynamic updating capabilities
|
|
229244
229374
|
*/
|
|
@@ -229332,15 +229462,17 @@ class CommentManager {
|
|
|
229332
229462
|
*/
|
|
229333
229463
|
formatCommentWithMetadata(content, metadata) {
|
|
229334
229464
|
const { commentId, lastUpdated, triggeredBy, commitSha } = metadata;
|
|
229335
|
-
const
|
|
229465
|
+
const footer = (0, footer_1.generateFooter)({
|
|
229466
|
+
includeMetadata: {
|
|
229467
|
+
lastUpdated,
|
|
229468
|
+
triggeredBy,
|
|
229469
|
+
commitSha,
|
|
229470
|
+
},
|
|
229471
|
+
});
|
|
229336
229472
|
return `<!-- visor-comment-id:${commentId} -->
|
|
229337
229473
|
${content}
|
|
229338
229474
|
|
|
229339
|
-
|
|
229340
|
-
|
|
229341
|
-
*Powered by [Visor](https://probelabs.com/visor) from [Probelabs](https://probelabs.com)*
|
|
229342
|
-
|
|
229343
|
-
*Last updated: ${lastUpdated} | Triggered by: ${triggeredBy}${commitInfo}*
|
|
229475
|
+
${footer}
|
|
229344
229476
|
<!-- /visor-comment-id:${commentId} -->`;
|
|
229345
229477
|
}
|
|
229346
229478
|
/**
|
|
@@ -229709,6 +229841,7 @@ const reviewer_1 = __nccwpck_require__(532);
|
|
|
229709
229841
|
const config_1 = __nccwpck_require__(22973);
|
|
229710
229842
|
const github_check_service_1 = __nccwpck_require__(43748);
|
|
229711
229843
|
const github_reactions_1 = __nccwpck_require__(67997);
|
|
229844
|
+
const footer_1 = __nccwpck_require__(6924);
|
|
229712
229845
|
/**
|
|
229713
229846
|
* Create an authenticated Octokit instance using either GitHub App or token authentication
|
|
229714
229847
|
*/
|
|
@@ -230286,8 +230419,8 @@ async function handleIssueEvent(octokit, owner, repo, context, inputs, config, c
|
|
|
230286
230419
|
// Only post if there's actual content (not just empty checks)
|
|
230287
230420
|
if (commentBody.trim()) {
|
|
230288
230421
|
// Only add footer if not already present (to avoid duplicates)
|
|
230289
|
-
if (!
|
|
230290
|
-
commentBody += `\n
|
|
230422
|
+
if (!(0, footer_1.hasVisorFooter)(commentBody)) {
|
|
230423
|
+
commentBody += `\n${(0, footer_1.generateFooter)()}`;
|
|
230291
230424
|
}
|
|
230292
230425
|
// Post comment to the issue
|
|
230293
230426
|
await octokit.rest.issues.createComment({
|
|
@@ -230329,9 +230462,7 @@ async function handleIssueComment(octokit, owner, repo, context, inputs, actionC
|
|
|
230329
230462
|
comment.user?.login === 'github-actions[bot]' ||
|
|
230330
230463
|
comment.user?.type === 'Bot';
|
|
230331
230464
|
const hasVisorMarkers = comment.body &&
|
|
230332
|
-
(comment.body.includes('<!-- visor-comment-id:') ||
|
|
230333
|
-
comment.body.includes('*Powered by [Visor](https://probelabs.com/visor)') ||
|
|
230334
|
-
comment.body.includes('*Powered by [Visor](https://github.com/probelabs/visor)'));
|
|
230465
|
+
(comment.body.includes('<!-- visor-comment-id:') || (0, footer_1.hasVisorFooter)(comment.body));
|
|
230335
230466
|
if (isVisorBot || hasVisorMarkers) {
|
|
230336
230467
|
console.log(`✓ Skipping bot's own comment to prevent recursion. Author: ${comment.user?.login}, Type: ${comment.user?.type}, Has markers: ${hasVisorMarkers}`);
|
|
230337
230468
|
return;
|
|
@@ -230407,8 +230538,7 @@ async function handleIssueComment(octokit, owner, repo, context, inputs, actionC
|
|
|
230407
230538
|
`**Additions:** +${statusPrInfo.totalAdditions}\n` +
|
|
230408
230539
|
`**Deletions:** -${statusPrInfo.totalDeletions}\n` +
|
|
230409
230540
|
`**Base:** ${statusPrInfo.base} → **Head:** ${statusPrInfo.head}\n\n` +
|
|
230410
|
-
`\n
|
|
230411
|
-
`*Powered by [Visor](https://probelabs.com/visor) from [Probelabs](https://probelabs.com)*`;
|
|
230541
|
+
`\n${(0, footer_1.generateFooter)()}`;
|
|
230412
230542
|
await octokit.rest.issues.createComment({
|
|
230413
230543
|
owner,
|
|
230414
230544
|
repo,
|
|
@@ -230423,8 +230553,7 @@ async function handleIssueComment(octokit, owner, repo, context, inputs, actionC
|
|
|
230423
230553
|
`**State:** ${issue.state || 'open'}\n` +
|
|
230424
230554
|
`**Comments:** ${issue.comments || 0}\n` +
|
|
230425
230555
|
`**Created:** ${issue.created_at || 'unknown'}\n` +
|
|
230426
|
-
`\n
|
|
230427
|
-
`*Powered by [Visor](https://probelabs.com/visor) from [Probelabs](https://probelabs.com)*`;
|
|
230556
|
+
`\n${(0, footer_1.generateFooter)()}`;
|
|
230428
230557
|
await octokit.rest.issues.createComment({
|
|
230429
230558
|
owner,
|
|
230430
230559
|
repo,
|
|
@@ -230521,7 +230650,7 @@ async function handleIssueComment(octokit, owner, repo, context, inputs, actionC
|
|
|
230521
230650
|
owner,
|
|
230522
230651
|
repo,
|
|
230523
230652
|
issue_number: prNumber,
|
|
230524
|
-
body: `⚠️ No checks are configured to run for ${isPullRequest ? 'PR' : 'issue'} comments with command /${command.type}\n\n
|
|
230653
|
+
body: `⚠️ No checks are configured to run for ${isPullRequest ? 'PR' : 'issue'} comments with command /${command.type}\n\n${(0, footer_1.generateFooter)()}`,
|
|
230525
230654
|
});
|
|
230526
230655
|
return;
|
|
230527
230656
|
}
|
|
@@ -230571,6 +230700,7 @@ async function handleIssueComment(octokit, owner, repo, context, inputs, actionC
|
|
|
230571
230700
|
await reviewer.postReviewComment(owner, repo, prNumber, groupedResults, {
|
|
230572
230701
|
focus,
|
|
230573
230702
|
format,
|
|
230703
|
+
config: config,
|
|
230574
230704
|
commentId: `pr-review-${prNumber}`,
|
|
230575
230705
|
triggeredBy: comment?.user?.login
|
|
230576
230706
|
? `comment by @${comment.user.login}`
|
|
@@ -230690,6 +230820,7 @@ async function handlePullRequestWithConfig(octokit, owner, repo, inputs, config,
|
|
|
230690
230820
|
const shouldComment = inputs['comment-on-pr'] !== 'false';
|
|
230691
230821
|
if (shouldComment) {
|
|
230692
230822
|
await reviewer.postReviewComment(owner, repo, prNumber, groupedResults, {
|
|
230823
|
+
config,
|
|
230693
230824
|
commentId,
|
|
230694
230825
|
triggeredBy: action,
|
|
230695
230826
|
commitSha: pullRequest.head?.sha,
|
|
@@ -234414,7 +234545,7 @@ class CommandCheckProvider extends check_provider_interface_1.CheckProvider {
|
|
|
234414
234545
|
},
|
|
234415
234546
|
files: prInfo.files,
|
|
234416
234547
|
fileCount: prInfo.files.length,
|
|
234417
|
-
outputs: this.buildOutputContext(dependencyResults),
|
|
234548
|
+
outputs: this.buildOutputContext(dependencyResults, config.__outputHistory),
|
|
234418
234549
|
env: this.getSafeEnvironmentVariables(),
|
|
234419
234550
|
};
|
|
234420
234551
|
logger_1.logger.debug(`🔧 Debug: Template outputs keys: ${Object.keys(templateContext.outputs || {}).join(', ')}`);
|
|
@@ -235262,11 +235393,12 @@ ${bodyWithReturn}
|
|
|
235262
235393
|
};
|
|
235263
235394
|
}
|
|
235264
235395
|
}
|
|
235265
|
-
buildOutputContext(dependencyResults) {
|
|
235396
|
+
buildOutputContext(dependencyResults, outputHistory) {
|
|
235266
235397
|
if (!dependencyResults) {
|
|
235267
235398
|
return {};
|
|
235268
235399
|
}
|
|
235269
235400
|
const outputs = {};
|
|
235401
|
+
const history = {};
|
|
235270
235402
|
for (const [checkName, result] of dependencyResults) {
|
|
235271
235403
|
// If the result has a direct output field, use it directly
|
|
235272
235404
|
// Otherwise, expose the entire result as-is
|
|
@@ -235274,6 +235406,14 @@ ${bodyWithReturn}
|
|
|
235274
235406
|
const value = summary.output !== undefined ? summary.output : summary;
|
|
235275
235407
|
outputs[checkName] = this.makeJsonSmart(value);
|
|
235276
235408
|
}
|
|
235409
|
+
// Add history for each check if available
|
|
235410
|
+
if (outputHistory) {
|
|
235411
|
+
for (const [checkName, historyArray] of outputHistory) {
|
|
235412
|
+
history[checkName] = historyArray.map(val => this.makeJsonSmart(val));
|
|
235413
|
+
}
|
|
235414
|
+
}
|
|
235415
|
+
// Attach history to the outputs object
|
|
235416
|
+
outputs.history = history;
|
|
235277
235417
|
return outputs;
|
|
235278
235418
|
}
|
|
235279
235419
|
/**
|
|
@@ -236736,7 +236876,7 @@ class LogCheckProvider extends check_provider_interface_1.CheckProvider {
|
|
|
236736
236876
|
const includeDependencies = config.include_dependencies !== false;
|
|
236737
236877
|
const includeMetadata = config.include_metadata !== false;
|
|
236738
236878
|
// Prepare template context
|
|
236739
|
-
const templateContext = this.buildTemplateContext(prInfo, dependencyResults, includePrContext, includeDependencies, includeMetadata);
|
|
236879
|
+
const templateContext = this.buildTemplateContext(prInfo, dependencyResults, includePrContext, includeDependencies, includeMetadata, config.__outputHistory);
|
|
236740
236880
|
// Render the log message template
|
|
236741
236881
|
const renderedMessage = await this.liquid.parseAndRender(message, templateContext);
|
|
236742
236882
|
// Build the log output
|
|
@@ -236757,7 +236897,7 @@ class LogCheckProvider extends check_provider_interface_1.CheckProvider {
|
|
|
236757
236897
|
logOutput,
|
|
236758
236898
|
};
|
|
236759
236899
|
}
|
|
236760
|
-
buildTemplateContext(prInfo, dependencyResults, _includePrContext = true, _includeDependencies = true, includeMetadata = true) {
|
|
236900
|
+
buildTemplateContext(prInfo, dependencyResults, _includePrContext = true, _includeDependencies = true, includeMetadata = true, outputHistory) {
|
|
236761
236901
|
const context = {};
|
|
236762
236902
|
// Always provide pr context for template rendering
|
|
236763
236903
|
context.pr = {
|
|
@@ -236784,6 +236924,7 @@ class LogCheckProvider extends check_provider_interface_1.CheckProvider {
|
|
|
236784
236924
|
if (dependencyResults) {
|
|
236785
236925
|
const dependencies = {};
|
|
236786
236926
|
const outputs = {};
|
|
236927
|
+
const history = {};
|
|
236787
236928
|
context.dependencyCount = dependencyResults.size;
|
|
236788
236929
|
for (const [checkName, result] of dependencyResults.entries()) {
|
|
236789
236930
|
dependencies[checkName] = {
|
|
@@ -236795,6 +236936,14 @@ class LogCheckProvider extends check_provider_interface_1.CheckProvider {
|
|
|
236795
236936
|
const summary = result;
|
|
236796
236937
|
outputs[checkName] = summary.output !== undefined ? summary.output : summary;
|
|
236797
236938
|
}
|
|
236939
|
+
// Add history for each check if available
|
|
236940
|
+
if (outputHistory) {
|
|
236941
|
+
for (const [checkName, historyArray] of outputHistory) {
|
|
236942
|
+
history[checkName] = historyArray;
|
|
236943
|
+
}
|
|
236944
|
+
}
|
|
236945
|
+
// Attach history to the outputs object
|
|
236946
|
+
outputs.history = history;
|
|
236798
236947
|
context.dependencies = dependencies;
|
|
236799
236948
|
context.outputs = outputs;
|
|
236800
236949
|
}
|
|
@@ -237039,7 +237188,7 @@ class MemoryCheckProvider extends check_provider_interface_1.CheckProvider {
|
|
|
237039
237188
|
// Get memory store instance
|
|
237040
237189
|
const memoryStore = memory_store_1.MemoryStore.getInstance();
|
|
237041
237190
|
// Build template context for value computation
|
|
237042
|
-
const templateContext = this.buildTemplateContext(prInfo, dependencyResults, memoryStore);
|
|
237191
|
+
const templateContext = this.buildTemplateContext(prInfo, dependencyResults, memoryStore, config.__outputHistory);
|
|
237043
237192
|
let result;
|
|
237044
237193
|
try {
|
|
237045
237194
|
switch (operation) {
|
|
@@ -237344,7 +237493,7 @@ class MemoryCheckProvider extends check_provider_interface_1.CheckProvider {
|
|
|
237344
237493
|
/**
|
|
237345
237494
|
* Build template context for Liquid and JS evaluation
|
|
237346
237495
|
*/
|
|
237347
|
-
buildTemplateContext(prInfo, dependencyResults, memoryStore) {
|
|
237496
|
+
buildTemplateContext(prInfo, dependencyResults, memoryStore, outputHistory) {
|
|
237348
237497
|
const context = {};
|
|
237349
237498
|
// Add PR context
|
|
237350
237499
|
context.pr = {
|
|
@@ -237364,15 +237513,24 @@ class MemoryCheckProvider extends check_provider_interface_1.CheckProvider {
|
|
|
237364
237513
|
changes: f.changes,
|
|
237365
237514
|
})),
|
|
237366
237515
|
};
|
|
237367
|
-
// Add dependency outputs
|
|
237516
|
+
// Add dependency outputs - always create outputs object even if no dependencies
|
|
237517
|
+
const outputs = {};
|
|
237518
|
+
const history = {};
|
|
237368
237519
|
if (dependencyResults) {
|
|
237369
|
-
const outputs = {};
|
|
237370
237520
|
for (const [checkName, result] of dependencyResults.entries()) {
|
|
237371
237521
|
const summary = result;
|
|
237372
237522
|
outputs[checkName] = summary.output !== undefined ? summary.output : summary;
|
|
237373
237523
|
}
|
|
237374
|
-
context.outputs = outputs;
|
|
237375
237524
|
}
|
|
237525
|
+
// Add history for each check if available
|
|
237526
|
+
if (outputHistory) {
|
|
237527
|
+
for (const [checkName, historyArray] of outputHistory) {
|
|
237528
|
+
history[checkName] = historyArray;
|
|
237529
|
+
}
|
|
237530
|
+
}
|
|
237531
|
+
// Attach history to the outputs object
|
|
237532
|
+
outputs.history = history;
|
|
237533
|
+
context.outputs = outputs;
|
|
237376
237534
|
// Add memory accessor
|
|
237377
237535
|
if (memoryStore) {
|
|
237378
237536
|
context.memory = {
|
|
@@ -237599,17 +237757,91 @@ class PRReviewer {
|
|
|
237599
237757
|
throw new Error('No configuration provided. Please create a .visor.yaml file with check definitions. ' +
|
|
237600
237758
|
'Built-in prompts have been removed - all checks must be explicitly configured.');
|
|
237601
237759
|
}
|
|
237760
|
+
/**
|
|
237761
|
+
* Helper to check if a schema is comment-generating
|
|
237762
|
+
* Comment-generating schemas include:
|
|
237763
|
+
* - Built-in schemas: code-review, overview, plain, text
|
|
237764
|
+
* - Custom schemas with a "text" field in properties
|
|
237765
|
+
*/
|
|
237766
|
+
async isCommentGeneratingSchema(schema) {
|
|
237767
|
+
try {
|
|
237768
|
+
// Check for built-in comment-generating schemas
|
|
237769
|
+
if (typeof schema === 'string') {
|
|
237770
|
+
// Well-known comment-generating schemas
|
|
237771
|
+
if (['code-review', 'overview', 'plain', 'text'].includes(schema)) {
|
|
237772
|
+
return true;
|
|
237773
|
+
}
|
|
237774
|
+
// Try to load and check custom string schema
|
|
237775
|
+
const fs = (__nccwpck_require__(79896).promises);
|
|
237776
|
+
const path = __nccwpck_require__(16928);
|
|
237777
|
+
// Sanitize schema name
|
|
237778
|
+
const sanitizedSchemaName = schema.replace(/[^a-zA-Z0-9-]/g, '');
|
|
237779
|
+
if (!sanitizedSchemaName || sanitizedSchemaName !== schema) {
|
|
237780
|
+
return false;
|
|
237781
|
+
}
|
|
237782
|
+
// Construct path to built-in schema file
|
|
237783
|
+
const schemaPath = __nccwpck_require__.ab + "output/" + sanitizedSchemaName + '/schema.json';
|
|
237784
|
+
try {
|
|
237785
|
+
const schemaContent = await fs.readFile(schemaPath, 'utf-8');
|
|
237786
|
+
const schemaObj = JSON.parse(schemaContent);
|
|
237787
|
+
// Check if schema has a "text" field in properties
|
|
237788
|
+
const properties = schemaObj.properties;
|
|
237789
|
+
return !!(properties && 'text' in properties);
|
|
237790
|
+
}
|
|
237791
|
+
catch {
|
|
237792
|
+
// Schema file not found or invalid, return false
|
|
237793
|
+
return false;
|
|
237794
|
+
}
|
|
237795
|
+
}
|
|
237796
|
+
else {
|
|
237797
|
+
// Inline schema object - check if it has a "text" field in properties
|
|
237798
|
+
const properties = schema.properties;
|
|
237799
|
+
return !!(properties && 'text' in properties);
|
|
237800
|
+
}
|
|
237801
|
+
}
|
|
237802
|
+
catch {
|
|
237803
|
+
return false;
|
|
237804
|
+
}
|
|
237805
|
+
}
|
|
237806
|
+
/**
|
|
237807
|
+
* Filter check results to only include those that should post GitHub comments
|
|
237808
|
+
*/
|
|
237809
|
+
async filterCommentGeneratingChecks(checkResults, config) {
|
|
237810
|
+
const filtered = [];
|
|
237811
|
+
for (const r of checkResults) {
|
|
237812
|
+
const cfg = config.checks?.[r.checkName];
|
|
237813
|
+
const type = cfg?.type || 'ai'; // Default to 'ai' if not specified
|
|
237814
|
+
const schema = cfg?.schema;
|
|
237815
|
+
// Determine if this check should generate a comment
|
|
237816
|
+
// Include checks with:
|
|
237817
|
+
// 1. type: 'ai' or 'claude-code' with no schema or comment-generating schemas
|
|
237818
|
+
// 2. Other types ONLY if they have explicit comment-generating schemas
|
|
237819
|
+
let shouldPostComment = false;
|
|
237820
|
+
// AI-powered checks generate comments by default
|
|
237821
|
+
const isAICheck = type === 'ai' || type === 'claude-code';
|
|
237822
|
+
if (!schema || schema === '') {
|
|
237823
|
+
// No schema specified - only AI checks generate comments by default
|
|
237824
|
+
// Other types (github, command, http, etc.) without schema are for orchestration
|
|
237825
|
+
shouldPostComment = isAICheck;
|
|
237826
|
+
}
|
|
237827
|
+
else {
|
|
237828
|
+
// Check if the schema is comment-generating (built-in or custom with text field)
|
|
237829
|
+
shouldPostComment = await this.isCommentGeneratingSchema(schema);
|
|
237830
|
+
}
|
|
237831
|
+
if (shouldPostComment) {
|
|
237832
|
+
filtered.push(r);
|
|
237833
|
+
}
|
|
237834
|
+
}
|
|
237835
|
+
return filtered;
|
|
237836
|
+
}
|
|
237602
237837
|
async postReviewComment(owner, repo, prNumber, groupedResults, options = {}) {
|
|
237603
237838
|
// Post separate comments for each group
|
|
237604
237839
|
for (const [groupName, checkResults] of Object.entries(groupedResults)) {
|
|
237605
|
-
//
|
|
237840
|
+
// Only checks with comment-generating schemas should post PR comments
|
|
237841
|
+
// AI checks (ai, claude-code) generate comments by default
|
|
237842
|
+
// Other types need explicit comment-generating schemas
|
|
237606
237843
|
const filteredResults = options.config
|
|
237607
|
-
?
|
|
237608
|
-
const cfg = options.config.checks?.[r.checkName];
|
|
237609
|
-
const t = cfg?.type || '';
|
|
237610
|
-
const isGitHubOps = t === 'github' || r.group === 'github' || t === 'noop' || t === 'command';
|
|
237611
|
-
return !isGitHubOps;
|
|
237612
|
-
})
|
|
237844
|
+
? await this.filterCommentGeneratingChecks(checkResults, options.config)
|
|
237613
237845
|
: checkResults;
|
|
237614
237846
|
// If nothing to report after filtering, skip this group
|
|
237615
237847
|
if (!filteredResults || filteredResults.length === 0) {
|
|
@@ -239996,6 +240228,121 @@ class ConfigMerger {
|
|
|
239996
240228
|
exports.ConfigMerger = ConfigMerger;
|
|
239997
240229
|
|
|
239998
240230
|
|
|
240231
|
+
/***/ }),
|
|
240232
|
+
|
|
240233
|
+
/***/ 29883:
|
|
240234
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
240235
|
+
|
|
240236
|
+
"use strict";
|
|
240237
|
+
|
|
240238
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
240239
|
+
if (k2 === undefined) k2 = k;
|
|
240240
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
240241
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
240242
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
240243
|
+
}
|
|
240244
|
+
Object.defineProperty(o, k2, desc);
|
|
240245
|
+
}) : (function(o, m, k, k2) {
|
|
240246
|
+
if (k2 === undefined) k2 = k;
|
|
240247
|
+
o[k2] = m[k];
|
|
240248
|
+
}));
|
|
240249
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
240250
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
240251
|
+
}) : function(o, v) {
|
|
240252
|
+
o["default"] = v;
|
|
240253
|
+
});
|
|
240254
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
240255
|
+
var ownKeys = function(o) {
|
|
240256
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
240257
|
+
var ar = [];
|
|
240258
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
240259
|
+
return ar;
|
|
240260
|
+
};
|
|
240261
|
+
return ownKeys(o);
|
|
240262
|
+
};
|
|
240263
|
+
return function (mod) {
|
|
240264
|
+
if (mod && mod.__esModule) return mod;
|
|
240265
|
+
var result = {};
|
|
240266
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
240267
|
+
__setModuleDefault(result, mod);
|
|
240268
|
+
return result;
|
|
240269
|
+
};
|
|
240270
|
+
})();
|
|
240271
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
240272
|
+
exports.processDiffWithOutline = processDiffWithOutline;
|
|
240273
|
+
const probe_1 = __nccwpck_require__(83841);
|
|
240274
|
+
const path = __importStar(__nccwpck_require__(16928));
|
|
240275
|
+
/**
|
|
240276
|
+
* Process diff content using the outline-diff format from @probelabs/probe
|
|
240277
|
+
* This extracts a structured outline from the diff without requiring a temporary file
|
|
240278
|
+
*/
|
|
240279
|
+
async function processDiffWithOutline(diffContent) {
|
|
240280
|
+
if (!diffContent || diffContent.trim().length === 0) {
|
|
240281
|
+
return diffContent;
|
|
240282
|
+
}
|
|
240283
|
+
try {
|
|
240284
|
+
// Set PROBE_PATH to use the bundled binary with outline-diff support
|
|
240285
|
+
// The SDK by default may download an older binary that doesn't support outline-diff
|
|
240286
|
+
const originalProbePath = process.env.PROBE_PATH;
|
|
240287
|
+
// Try multiple possible locations for the probe binary
|
|
240288
|
+
// When bundled with ncc, __dirname may not be reliable
|
|
240289
|
+
const fs = __nccwpck_require__(79896);
|
|
240290
|
+
const possiblePaths = [
|
|
240291
|
+
// Relative to current working directory (most common in production)
|
|
240292
|
+
path.join(process.cwd(), 'node_modules/@probelabs/probe/bin/probe-binary'),
|
|
240293
|
+
// Relative to __dirname (for unbundled development)
|
|
240294
|
+
path.join(__dirname, '../..', 'node_modules/@probelabs/probe/bin/probe-binary'),
|
|
240295
|
+
// Relative to dist directory (for bundled CLI)
|
|
240296
|
+
path.join(__dirname, 'node_modules/@probelabs/probe/bin/probe-binary'),
|
|
240297
|
+
];
|
|
240298
|
+
let probeBinaryPath;
|
|
240299
|
+
for (const candidatePath of possiblePaths) {
|
|
240300
|
+
if (fs.existsSync(candidatePath)) {
|
|
240301
|
+
probeBinaryPath = candidatePath;
|
|
240302
|
+
break;
|
|
240303
|
+
}
|
|
240304
|
+
}
|
|
240305
|
+
// Only process if binary exists, otherwise fall back to original diff
|
|
240306
|
+
if (!probeBinaryPath) {
|
|
240307
|
+
if (process.env.DEBUG === '1' || process.env.VERBOSE === '1') {
|
|
240308
|
+
console.error('Probe binary not found. Tried:', possiblePaths);
|
|
240309
|
+
}
|
|
240310
|
+
return diffContent;
|
|
240311
|
+
}
|
|
240312
|
+
process.env.PROBE_PATH = probeBinaryPath;
|
|
240313
|
+
// Use extract with content parameter (can be string or Buffer)
|
|
240314
|
+
// The TypeScript types haven't been updated yet, but the runtime supports it
|
|
240315
|
+
// Add timeout to avoid hanging
|
|
240316
|
+
const extractPromise = probe_1.extract({
|
|
240317
|
+
content: diffContent,
|
|
240318
|
+
format: 'outline-diff',
|
|
240319
|
+
allowTests: true, // Allow test files and test code blocks in extraction results
|
|
240320
|
+
});
|
|
240321
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
240322
|
+
setTimeout(() => reject(new Error('Extract timeout after 30s')), 30000);
|
|
240323
|
+
});
|
|
240324
|
+
const result = await Promise.race([extractPromise, timeoutPromise]);
|
|
240325
|
+
// Restore original PROBE_PATH
|
|
240326
|
+
if (originalProbePath !== undefined) {
|
|
240327
|
+
process.env.PROBE_PATH = originalProbePath;
|
|
240328
|
+
}
|
|
240329
|
+
else {
|
|
240330
|
+
delete process.env.PROBE_PATH;
|
|
240331
|
+
}
|
|
240332
|
+
// Return the processed outline diff
|
|
240333
|
+
return typeof result === 'string' ? result : JSON.stringify(result);
|
|
240334
|
+
}
|
|
240335
|
+
catch (error) {
|
|
240336
|
+
// If outline-diff processing fails, fall back to the original diff
|
|
240337
|
+
// Use console.error instead of console.warn to avoid polluting JSON output
|
|
240338
|
+
if (process.env.DEBUG === '1' || process.env.VERBOSE === '1') {
|
|
240339
|
+
console.error('Failed to process diff with outline-diff format:', error);
|
|
240340
|
+
}
|
|
240341
|
+
return diffContent;
|
|
240342
|
+
}
|
|
240343
|
+
}
|
|
240344
|
+
|
|
240345
|
+
|
|
239999
240346
|
/***/ }),
|
|
240000
240347
|
|
|
240001
240348
|
/***/ 58749:
|
|
@@ -254119,6 +254466,145 @@ var init_directory_resolver = __esm({
|
|
|
254119
254466
|
});
|
|
254120
254467
|
|
|
254121
254468
|
// src/downloader.js
|
|
254469
|
+
async function acquireFileLock(lockPath, version) {
|
|
254470
|
+
const lockData = {
|
|
254471
|
+
version,
|
|
254472
|
+
pid: process.pid,
|
|
254473
|
+
timestamp: Date.now()
|
|
254474
|
+
};
|
|
254475
|
+
try {
|
|
254476
|
+
await import_fs_extra2.default.writeFile(lockPath, JSON.stringify(lockData), { flag: "wx" });
|
|
254477
|
+
if (process.env.DEBUG === "1" || process.env.VERBOSE === "1") {
|
|
254478
|
+
console.log(`Acquired file lock: ${lockPath}`);
|
|
254479
|
+
}
|
|
254480
|
+
return true;
|
|
254481
|
+
} catch (error2) {
|
|
254482
|
+
if (error2.code === "EEXIST") {
|
|
254483
|
+
try {
|
|
254484
|
+
const existingLock = JSON.parse(await import_fs_extra2.default.readFile(lockPath, "utf-8"));
|
|
254485
|
+
const lockAge = Date.now() - existingLock.timestamp;
|
|
254486
|
+
if (lockAge > LOCK_TIMEOUT_MS) {
|
|
254487
|
+
if (process.env.DEBUG === "1" || process.env.VERBOSE === "1") {
|
|
254488
|
+
console.log(`Removing stale lock file (age: ${Math.round(lockAge / 1e3)}s, pid: ${existingLock.pid})`);
|
|
254489
|
+
}
|
|
254490
|
+
await import_fs_extra2.default.remove(lockPath);
|
|
254491
|
+
return false;
|
|
254492
|
+
}
|
|
254493
|
+
if (process.env.DEBUG === "1" || process.env.VERBOSE === "1") {
|
|
254494
|
+
console.log(`Download in progress by process ${existingLock.pid}, waiting...`);
|
|
254495
|
+
}
|
|
254496
|
+
return false;
|
|
254497
|
+
} catch (readError) {
|
|
254498
|
+
if (process.env.DEBUG === "1" || process.env.VERBOSE === "1") {
|
|
254499
|
+
console.log(`Lock file corrupted, removing: ${readError.message}`);
|
|
254500
|
+
}
|
|
254501
|
+
try {
|
|
254502
|
+
await import_fs_extra2.default.remove(lockPath);
|
|
254503
|
+
} catch {
|
|
254504
|
+
}
|
|
254505
|
+
return false;
|
|
254506
|
+
}
|
|
254507
|
+
}
|
|
254508
|
+
if (error2.code === "EACCES" || error2.code === "EPERM" || error2.code === "EROFS") {
|
|
254509
|
+
if (process.env.DEBUG === "1" || process.env.VERBOSE === "1") {
|
|
254510
|
+
console.log(`Cannot create lock file (${error2.code}): ${lockPath}`);
|
|
254511
|
+
console.log(`File-based locking unavailable, will proceed without cross-process coordination`);
|
|
254512
|
+
}
|
|
254513
|
+
return null;
|
|
254514
|
+
}
|
|
254515
|
+
if (process.env.DEBUG === "1" || process.env.VERBOSE === "1") {
|
|
254516
|
+
console.log(`Unexpected error creating lock file: ${error2.message}`);
|
|
254517
|
+
console.log(`Proceeding without file-based lock`);
|
|
254518
|
+
}
|
|
254519
|
+
return null;
|
|
254520
|
+
}
|
|
254521
|
+
}
|
|
254522
|
+
async function releaseFileLock(lockPath) {
|
|
254523
|
+
try {
|
|
254524
|
+
await import_fs_extra2.default.remove(lockPath);
|
|
254525
|
+
if (process.env.DEBUG === "1" || process.env.VERBOSE === "1") {
|
|
254526
|
+
console.log(`Released file lock: ${lockPath}`);
|
|
254527
|
+
}
|
|
254528
|
+
} catch (error2) {
|
|
254529
|
+
if (process.env.DEBUG === "1" || process.env.VERBOSE === "1") {
|
|
254530
|
+
console.log(`Warning: Could not release lock file: ${error2.message}`);
|
|
254531
|
+
}
|
|
254532
|
+
}
|
|
254533
|
+
}
|
|
254534
|
+
async function waitForFileLock(lockPath, binaryPath) {
|
|
254535
|
+
const startTime = Date.now();
|
|
254536
|
+
while (Date.now() - startTime < MAX_LOCK_WAIT_MS) {
|
|
254537
|
+
if (await import_fs_extra2.default.pathExists(binaryPath)) {
|
|
254538
|
+
if (process.env.DEBUG === "1" || process.env.VERBOSE === "1") {
|
|
254539
|
+
console.log(`Binary now available at ${binaryPath}, download completed by another process`);
|
|
254540
|
+
}
|
|
254541
|
+
return true;
|
|
254542
|
+
}
|
|
254543
|
+
const lockExists = await import_fs_extra2.default.pathExists(lockPath);
|
|
254544
|
+
if (!lockExists) {
|
|
254545
|
+
if (process.env.DEBUG === "1" || process.env.VERBOSE === "1") {
|
|
254546
|
+
console.log(`Lock file removed but binary not found - download may have failed`);
|
|
254547
|
+
}
|
|
254548
|
+
return false;
|
|
254549
|
+
}
|
|
254550
|
+
try {
|
|
254551
|
+
const lockData = JSON.parse(await import_fs_extra2.default.readFile(lockPath, "utf-8"));
|
|
254552
|
+
const lockAge = Date.now() - lockData.timestamp;
|
|
254553
|
+
if (lockAge > LOCK_TIMEOUT_MS) {
|
|
254554
|
+
if (process.env.DEBUG === "1" || process.env.VERBOSE === "1") {
|
|
254555
|
+
console.log(`Lock expired (age: ${Math.round(lockAge / 1e3)}s), will retry download`);
|
|
254556
|
+
}
|
|
254557
|
+
return false;
|
|
254558
|
+
}
|
|
254559
|
+
} catch {
|
|
254560
|
+
}
|
|
254561
|
+
await new Promise((resolve4) => setTimeout(resolve4, LOCK_POLL_INTERVAL_MS));
|
|
254562
|
+
}
|
|
254563
|
+
if (process.env.DEBUG === "1" || process.env.VERBOSE === "1") {
|
|
254564
|
+
console.log(`Timeout waiting for file lock`);
|
|
254565
|
+
}
|
|
254566
|
+
return false;
|
|
254567
|
+
}
|
|
254568
|
+
async function withDownloadLock(version, downloadFn) {
|
|
254569
|
+
const lockKey = version || "latest";
|
|
254570
|
+
if (downloadLocks.has(lockKey)) {
|
|
254571
|
+
const lock = downloadLocks.get(lockKey);
|
|
254572
|
+
const lockAge = Date.now() - lock.timestamp;
|
|
254573
|
+
if (lockAge > LOCK_TIMEOUT_MS) {
|
|
254574
|
+
if (process.env.DEBUG === "1" || process.env.VERBOSE === "1") {
|
|
254575
|
+
console.log(`In-memory lock for version ${lockKey} expired (age: ${Math.round(lockAge / 1e3)}s), removing stale lock`);
|
|
254576
|
+
}
|
|
254577
|
+
downloadLocks.delete(lockKey);
|
|
254578
|
+
} else {
|
|
254579
|
+
if (process.env.DEBUG === "1" || process.env.VERBOSE === "1") {
|
|
254580
|
+
console.log(`Download already in progress in this process for version ${lockKey}, waiting...`);
|
|
254581
|
+
}
|
|
254582
|
+
try {
|
|
254583
|
+
return await lock.promise;
|
|
254584
|
+
} catch (error2) {
|
|
254585
|
+
if (process.env.DEBUG === "1" || process.env.VERBOSE === "1") {
|
|
254586
|
+
console.log(`In-memory locked download failed, will retry: ${error2.message}`);
|
|
254587
|
+
}
|
|
254588
|
+
}
|
|
254589
|
+
}
|
|
254590
|
+
}
|
|
254591
|
+
const downloadPromise = Promise.race([
|
|
254592
|
+
downloadFn(),
|
|
254593
|
+
new Promise(
|
|
254594
|
+
(_2, reject2) => setTimeout(() => reject2(new Error(`Download timeout after ${LOCK_TIMEOUT_MS / 1e3}s`)), LOCK_TIMEOUT_MS)
|
|
254595
|
+
)
|
|
254596
|
+
]);
|
|
254597
|
+
downloadLocks.set(lockKey, {
|
|
254598
|
+
promise: downloadPromise,
|
|
254599
|
+
timestamp: Date.now()
|
|
254600
|
+
});
|
|
254601
|
+
try {
|
|
254602
|
+
const result = await downloadPromise;
|
|
254603
|
+
return result;
|
|
254604
|
+
} finally {
|
|
254605
|
+
downloadLocks.delete(lockKey);
|
|
254606
|
+
}
|
|
254607
|
+
}
|
|
254122
254608
|
function detectOsArch() {
|
|
254123
254609
|
const osType = import_os2.default.platform();
|
|
254124
254610
|
const archType = import_os2.default.arch();
|
|
@@ -254562,16 +255048,64 @@ async function getPackageVersion() {
|
|
|
254562
255048
|
return "0.0.0";
|
|
254563
255049
|
}
|
|
254564
255050
|
}
|
|
255051
|
+
async function doDownload(version) {
|
|
255052
|
+
const localDir = await getPackageBinDir();
|
|
255053
|
+
if (process.env.DEBUG === "1" || process.env.VERBOSE === "1") {
|
|
255054
|
+
console.log(`Downloading probe binary (version: ${version || "latest"})...`);
|
|
255055
|
+
console.log(`Using binary directory: ${localDir}`);
|
|
255056
|
+
}
|
|
255057
|
+
const isWindows = import_os2.default.platform() === "win32";
|
|
255058
|
+
const binaryName = isWindows ? `${BINARY_NAME}.exe` : `${BINARY_NAME}-binary`;
|
|
255059
|
+
const binaryPath = import_path2.default.join(localDir, binaryName);
|
|
255060
|
+
const { os: osInfo, arch: archInfo } = detectOsArch();
|
|
255061
|
+
let versionToUse = version;
|
|
255062
|
+
let bestAsset;
|
|
255063
|
+
let tagVersion;
|
|
255064
|
+
if (!versionToUse || versionToUse === "0.0.0") {
|
|
255065
|
+
if (process.env.DEBUG === "1" || process.env.VERBOSE === "1") {
|
|
255066
|
+
console.log("No specific version requested, will use the latest release");
|
|
255067
|
+
}
|
|
255068
|
+
const { tag: tag2, assets } = await getLatestRelease(void 0);
|
|
255069
|
+
tagVersion = tag2.startsWith("v") ? tag2.substring(1) : tag2;
|
|
255070
|
+
bestAsset = findBestAsset(assets, osInfo, archInfo);
|
|
255071
|
+
if (process.env.DEBUG === "1" || process.env.VERBOSE === "1") {
|
|
255072
|
+
console.log(`Found release version: ${tagVersion}`);
|
|
255073
|
+
}
|
|
255074
|
+
} else {
|
|
255075
|
+
if (process.env.DEBUG === "1" || process.env.VERBOSE === "1") {
|
|
255076
|
+
console.log(`Direct download for version: ${versionToUse}`);
|
|
255077
|
+
}
|
|
255078
|
+
tagVersion = versionToUse;
|
|
255079
|
+
bestAsset = constructAssetInfo(versionToUse, osInfo, archInfo);
|
|
255080
|
+
}
|
|
255081
|
+
const { assetPath, checksumPath } = await downloadAsset(bestAsset, localDir);
|
|
255082
|
+
const checksumValid = await verifyChecksum(assetPath, checksumPath);
|
|
255083
|
+
if (!checksumValid) {
|
|
255084
|
+
throw new Error("Checksum verification failed");
|
|
255085
|
+
}
|
|
255086
|
+
const extractedBinaryPath = await extractBinary(assetPath, localDir);
|
|
255087
|
+
await saveVersionInfo(tagVersion, localDir);
|
|
255088
|
+
try {
|
|
255089
|
+
await import_fs_extra2.default.remove(assetPath);
|
|
255090
|
+
if (checksumPath) {
|
|
255091
|
+
await import_fs_extra2.default.remove(checksumPath);
|
|
255092
|
+
}
|
|
255093
|
+
} catch (err) {
|
|
255094
|
+
if (process.env.DEBUG === "1" || process.env.VERBOSE === "1") {
|
|
255095
|
+
console.log(`Warning: Could not clean up temporary files: ${err}`);
|
|
255096
|
+
}
|
|
255097
|
+
}
|
|
255098
|
+
if (process.env.DEBUG === "1" || process.env.VERBOSE === "1") {
|
|
255099
|
+
console.log(`Binary successfully installed at ${extractedBinaryPath} (version: ${tagVersion})`);
|
|
255100
|
+
}
|
|
255101
|
+
return extractedBinaryPath;
|
|
255102
|
+
}
|
|
254565
255103
|
async function downloadProbeBinary(version) {
|
|
254566
255104
|
try {
|
|
254567
255105
|
const localDir = await getPackageBinDir();
|
|
254568
255106
|
if (!version || version === "0.0.0") {
|
|
254569
255107
|
version = await getPackageVersion();
|
|
254570
255108
|
}
|
|
254571
|
-
if (process.env.DEBUG === "1" || process.env.VERBOSE === "1") {
|
|
254572
|
-
console.log(`Downloading probe binary (version: ${version || "latest"})...`);
|
|
254573
|
-
console.log(`Using binary directory: ${localDir}`);
|
|
254574
|
-
}
|
|
254575
255109
|
const isWindows = import_os2.default.platform() === "win32";
|
|
254576
255110
|
const binaryName = isWindows ? `${BINARY_NAME}.exe` : `${BINARY_NAME}-binary`;
|
|
254577
255111
|
const binaryPath = import_path2.default.join(localDir, binaryName);
|
|
@@ -254587,54 +255121,44 @@ async function downloadProbeBinary(version) {
|
|
|
254587
255121
|
console.log(`Existing binary version (${versionInfo?.version || "unknown"}) doesn't match requested version (${version}). Downloading new version...`);
|
|
254588
255122
|
}
|
|
254589
255123
|
}
|
|
254590
|
-
const
|
|
254591
|
-
|
|
254592
|
-
let
|
|
254593
|
-
|
|
254594
|
-
|
|
254595
|
-
|
|
254596
|
-
|
|
254597
|
-
|
|
254598
|
-
|
|
254599
|
-
|
|
254600
|
-
|
|
254601
|
-
if (process.env.DEBUG === "1" || process.env.VERBOSE === "1") {
|
|
254602
|
-
console.log(`Found release version: ${tagVersion}`);
|
|
255124
|
+
const lockPath = import_path2.default.join(localDir, `.probe-download-${version}.lock`);
|
|
255125
|
+
const maxRetries = 3;
|
|
255126
|
+
for (let retry = 0; retry < maxRetries; retry++) {
|
|
255127
|
+
const lockAcquired = await acquireFileLock(lockPath, version);
|
|
255128
|
+
if (lockAcquired === true) {
|
|
255129
|
+
try {
|
|
255130
|
+
const result = await withDownloadLock(version, () => doDownload(version));
|
|
255131
|
+
return result;
|
|
255132
|
+
} finally {
|
|
255133
|
+
await releaseFileLock(lockPath);
|
|
255134
|
+
}
|
|
254603
255135
|
}
|
|
254604
|
-
|
|
254605
|
-
|
|
254606
|
-
|
|
255136
|
+
if (lockAcquired === null) {
|
|
255137
|
+
if (process.env.DEBUG === "1" || process.env.VERBOSE === "1") {
|
|
255138
|
+
console.log(`File-based locking unavailable, downloading without cross-process coordination`);
|
|
255139
|
+
}
|
|
255140
|
+
return await withDownloadLock(version, () => doDownload(version));
|
|
254607
255141
|
}
|
|
254608
|
-
|
|
254609
|
-
|
|
254610
|
-
|
|
254611
|
-
const { assetPath, checksumPath } = await downloadAsset(bestAsset, localDir);
|
|
254612
|
-
const checksumValid = await verifyChecksum(assetPath, checksumPath);
|
|
254613
|
-
if (!checksumValid) {
|
|
254614
|
-
throw new Error("Checksum verification failed");
|
|
254615
|
-
}
|
|
254616
|
-
const extractedBinaryPath = await extractBinary(assetPath, localDir);
|
|
254617
|
-
await saveVersionInfo(tagVersion, localDir);
|
|
254618
|
-
try {
|
|
254619
|
-
await import_fs_extra2.default.remove(assetPath);
|
|
254620
|
-
if (checksumPath) {
|
|
254621
|
-
await import_fs_extra2.default.remove(checksumPath);
|
|
255142
|
+
const downloadCompleted = await waitForFileLock(lockPath, binaryPath);
|
|
255143
|
+
if (downloadCompleted) {
|
|
255144
|
+
return binaryPath;
|
|
254622
255145
|
}
|
|
254623
|
-
|
|
254624
|
-
|
|
254625
|
-
|
|
255146
|
+
if (retry < maxRetries - 1) {
|
|
255147
|
+
if (process.env.DEBUG === "1" || process.env.VERBOSE === "1") {
|
|
255148
|
+
console.log(`Retrying download (attempt ${retry + 2}/${maxRetries})...`);
|
|
255149
|
+
}
|
|
254626
255150
|
}
|
|
254627
255151
|
}
|
|
254628
255152
|
if (process.env.DEBUG === "1" || process.env.VERBOSE === "1") {
|
|
254629
|
-
console.log(`
|
|
255153
|
+
console.log(`All lock attempts exhausted, attempting direct download`);
|
|
254630
255154
|
}
|
|
254631
|
-
return
|
|
255155
|
+
return await withDownloadLock(version, () => doDownload(version));
|
|
254632
255156
|
} catch (error2) {
|
|
254633
255157
|
console.error("Error downloading probe binary:", error2);
|
|
254634
255158
|
throw error2;
|
|
254635
255159
|
}
|
|
254636
255160
|
}
|
|
254637
|
-
var import_axios, import_fs_extra2, import_path2, import_crypto, import_util, import_child_process, import_tar, import_os2, import_url2, exec, REPO_OWNER, REPO_NAME, BINARY_NAME, __filename2, __dirname2;
|
|
255161
|
+
var import_axios, import_fs_extra2, import_path2, import_crypto, import_util, import_child_process, import_tar, import_os2, import_url2, exec, REPO_OWNER, REPO_NAME, BINARY_NAME, __filename2, __dirname2, downloadLocks, LOCK_TIMEOUT_MS, LOCK_POLL_INTERVAL_MS, MAX_LOCK_WAIT_MS;
|
|
254638
255162
|
var init_downloader = __esm({
|
|
254639
255163
|
"src/downloader.js"() {
|
|
254640
255164
|
"use strict";
|
|
@@ -254655,19 +255179,25 @@ var init_downloader = __esm({
|
|
|
254655
255179
|
BINARY_NAME = "probe";
|
|
254656
255180
|
__filename2 = (0, import_url2.fileURLToPath)("file:///");
|
|
254657
255181
|
__dirname2 = import_path2.default.dirname(__filename2);
|
|
255182
|
+
downloadLocks = /* @__PURE__ */ new Map();
|
|
255183
|
+
LOCK_TIMEOUT_MS = 5 * 60 * 1e3;
|
|
255184
|
+
LOCK_POLL_INTERVAL_MS = 1e3;
|
|
255185
|
+
MAX_LOCK_WAIT_MS = 5 * 60 * 1e3;
|
|
254658
255186
|
}
|
|
254659
255187
|
});
|
|
254660
255188
|
|
|
254661
255189
|
// src/utils.js
|
|
254662
255190
|
async function getBinaryPath(options = {}) {
|
|
254663
255191
|
const { forceDownload = false, version } = options;
|
|
254664
|
-
if (probeBinaryPath && !forceDownload && import_fs_extra3.default.existsSync(probeBinaryPath)) {
|
|
254665
|
-
return probeBinaryPath;
|
|
254666
|
-
}
|
|
254667
255192
|
if (process.env.PROBE_PATH && import_fs_extra3.default.existsSync(process.env.PROBE_PATH) && !forceDownload) {
|
|
254668
255193
|
probeBinaryPath = process.env.PROBE_PATH;
|
|
254669
255194
|
return probeBinaryPath;
|
|
254670
255195
|
}
|
|
255196
|
+
if (version && !forceDownload) {
|
|
255197
|
+
console.log(`Specific version ${version} requested. Downloading...`);
|
|
255198
|
+
probeBinaryPath = await downloadProbeBinary(version);
|
|
255199
|
+
return probeBinaryPath;
|
|
255200
|
+
}
|
|
254671
255201
|
const binDir = await getPackageBinDir();
|
|
254672
255202
|
const isWindows = process.platform === "win32";
|
|
254673
255203
|
const binaryName = isWindows ? "probe.exe" : "probe-binary";
|
|
@@ -254779,17 +255309,20 @@ Search: query="${queries[0]}" path="${options.path}"`;
|
|
|
254779
255309
|
if (options.session) logMessage += ` session=${options.session}`;
|
|
254780
255310
|
console.error(logMessage);
|
|
254781
255311
|
}
|
|
254782
|
-
const
|
|
255312
|
+
const args = ["search", ...cliArgs];
|
|
254783
255313
|
if (queries.length > 0) {
|
|
254784
|
-
|
|
255314
|
+
args.push(queries[0]);
|
|
255315
|
+
}
|
|
255316
|
+
args.push(options.path);
|
|
255317
|
+
if (process.env.DEBUG === "1") {
|
|
255318
|
+
console.error(`Executing: ${binaryPath} ${args.join(" ")}`);
|
|
254785
255319
|
}
|
|
254786
|
-
positionalArgs.push(escapeString(options.path));
|
|
254787
|
-
const command = `${binaryPath} search ${cliArgs.join(" ")} ${positionalArgs.join(" ")}`;
|
|
254788
255320
|
try {
|
|
254789
|
-
const { stdout, stderr } = await
|
|
254790
|
-
|
|
254791
|
-
timeout: options.timeout * 1e3
|
|
255321
|
+
const { stdout, stderr } = await execFileAsync(binaryPath, args, {
|
|
255322
|
+
timeout: options.timeout * 1e3,
|
|
254792
255323
|
// Convert seconds to milliseconds
|
|
255324
|
+
maxBuffer: 50 * 1024 * 1024
|
|
255325
|
+
// 50MB buffer for large outputs
|
|
254793
255326
|
});
|
|
254794
255327
|
if (stderr && process.env.DEBUG) {
|
|
254795
255328
|
console.error(`stderr: ${stderr}`);
|
|
@@ -254838,23 +255371,25 @@ Search results: ${resultCount} matches, ${tokenCount} tokens`;
|
|
|
254838
255371
|
} catch (error2) {
|
|
254839
255372
|
if (error2.code === "ETIMEDOUT" || error2.killed) {
|
|
254840
255373
|
const timeoutMessage = `Search operation timed out after ${options.timeout} seconds.
|
|
254841
|
-
|
|
255374
|
+
Binary: ${binaryPath}
|
|
255375
|
+
Args: ${args.join(" ")}`;
|
|
254842
255376
|
console.error(timeoutMessage);
|
|
254843
255377
|
throw new Error(timeoutMessage);
|
|
254844
255378
|
}
|
|
254845
255379
|
const errorMessage = `Error executing search command: ${error2.message}
|
|
254846
|
-
|
|
255380
|
+
Binary: ${binaryPath}
|
|
255381
|
+
Args: ${args.join(" ")}`;
|
|
254847
255382
|
throw new Error(errorMessage);
|
|
254848
255383
|
}
|
|
254849
255384
|
}
|
|
254850
|
-
var import_child_process2, import_util2,
|
|
255385
|
+
var import_child_process2, import_util2, execFileAsync, SEARCH_FLAG_MAP;
|
|
254851
255386
|
var init_search = __esm({
|
|
254852
255387
|
"src/search.js"() {
|
|
254853
255388
|
"use strict";
|
|
254854
255389
|
import_child_process2 = __nccwpck_require__(35317);
|
|
254855
255390
|
import_util2 = __nccwpck_require__(39023);
|
|
254856
255391
|
init_utils();
|
|
254857
|
-
|
|
255392
|
+
execFileAsync = (0, import_util2.promisify)(import_child_process2.execFile);
|
|
254858
255393
|
SEARCH_FLAG_MAP = {
|
|
254859
255394
|
filesOnly: "--files-only",
|
|
254860
255395
|
ignore: "--ignore",
|
|
@@ -254862,6 +255397,7 @@ var init_search = __esm({
|
|
|
254862
255397
|
reranker: "--reranker",
|
|
254863
255398
|
frequencySearch: "--frequency",
|
|
254864
255399
|
exact: "--exact",
|
|
255400
|
+
strictElasticSyntax: "--strict-elastic-syntax",
|
|
254865
255401
|
maxResults: "--max-results",
|
|
254866
255402
|
maxBytes: "--max-bytes",
|
|
254867
255403
|
maxTokens: "--max-tokens",
|
|
@@ -254899,7 +255435,7 @@ async function query(options) {
|
|
|
254899
255435
|
}
|
|
254900
255436
|
const command = `${binaryPath} query ${cliArgs.join(" ")}`;
|
|
254901
255437
|
try {
|
|
254902
|
-
const { stdout, stderr } = await
|
|
255438
|
+
const { stdout, stderr } = await execAsync(command);
|
|
254903
255439
|
if (stderr) {
|
|
254904
255440
|
console.error(`stderr: ${stderr}`);
|
|
254905
255441
|
}
|
|
@@ -254928,14 +255464,14 @@ Command: ${command}`;
|
|
|
254928
255464
|
throw new Error(errorMessage);
|
|
254929
255465
|
}
|
|
254930
255466
|
}
|
|
254931
|
-
var import_child_process3, import_util3,
|
|
255467
|
+
var import_child_process3, import_util3, execAsync, QUERY_FLAG_MAP;
|
|
254932
255468
|
var init_query = __esm({
|
|
254933
255469
|
"src/query.js"() {
|
|
254934
255470
|
"use strict";
|
|
254935
255471
|
import_child_process3 = __nccwpck_require__(35317);
|
|
254936
255472
|
import_util3 = __nccwpck_require__(39023);
|
|
254937
255473
|
init_utils();
|
|
254938
|
-
|
|
255474
|
+
execAsync = (0, import_util3.promisify)(import_child_process3.exec);
|
|
254939
255475
|
QUERY_FLAG_MAP = {
|
|
254940
255476
|
language: "--language",
|
|
254941
255477
|
ignore: "--ignore",
|
|
@@ -254951,15 +255487,20 @@ async function extract(options) {
|
|
|
254951
255487
|
if (!options) {
|
|
254952
255488
|
throw new Error("Options object is required");
|
|
254953
255489
|
}
|
|
254954
|
-
|
|
254955
|
-
|
|
255490
|
+
const hasFiles = options.files && Array.isArray(options.files) && options.files.length > 0;
|
|
255491
|
+
const hasInputFile = !!options.inputFile;
|
|
255492
|
+
const hasContent = options.content !== void 0 && options.content !== null;
|
|
255493
|
+
if (!hasFiles && !hasInputFile && !hasContent) {
|
|
255494
|
+
throw new Error("Either files array, inputFile, or content must be provided");
|
|
254956
255495
|
}
|
|
254957
255496
|
const binaryPath = await getBinaryPath(options.binaryOptions || {});
|
|
254958
|
-
const
|
|
255497
|
+
const filteredOptions = { ...options };
|
|
255498
|
+
delete filteredOptions.content;
|
|
255499
|
+
const cliArgs = buildCliArgs(filteredOptions, EXTRACT_FLAG_MAP);
|
|
254959
255500
|
if (options.json && !options.format) {
|
|
254960
255501
|
cliArgs.push("--format", "json");
|
|
254961
255502
|
}
|
|
254962
|
-
if (
|
|
255503
|
+
if (hasFiles) {
|
|
254963
255504
|
for (const file of options.files) {
|
|
254964
255505
|
cliArgs.push(escapeString(file));
|
|
254965
255506
|
}
|
|
@@ -254971,75 +255512,124 @@ Extract:`;
|
|
|
254971
255512
|
logMessage += ` files="${options.files.join(", ")}"`;
|
|
254972
255513
|
}
|
|
254973
255514
|
if (options.inputFile) logMessage += ` inputFile="${options.inputFile}"`;
|
|
255515
|
+
if (options.content) logMessage += ` content=(${typeof options.content === "string" ? options.content.length : options.content.byteLength} bytes)`;
|
|
254974
255516
|
if (options.allowTests) logMessage += " allowTests=true";
|
|
254975
255517
|
if (options.contextLines) logMessage += ` contextLines=${options.contextLines}`;
|
|
254976
255518
|
if (options.format) logMessage += ` format=${options.format}`;
|
|
254977
255519
|
if (options.json) logMessage += " json=true";
|
|
254978
255520
|
console.error(logMessage);
|
|
254979
255521
|
}
|
|
255522
|
+
if (hasContent) {
|
|
255523
|
+
return extractWithStdin(binaryPath, cliArgs, options.content, options);
|
|
255524
|
+
}
|
|
254980
255525
|
const command = `${binaryPath} extract ${cliArgs.join(" ")}`;
|
|
254981
255526
|
try {
|
|
254982
|
-
const { stdout, stderr } = await
|
|
255527
|
+
const { stdout, stderr } = await execAsync2(command);
|
|
254983
255528
|
if (stderr) {
|
|
254984
255529
|
console.error(`stderr: ${stderr}`);
|
|
254985
255530
|
}
|
|
254986
|
-
|
|
254987
|
-
|
|
254988
|
-
|
|
254989
|
-
|
|
254990
|
-
|
|
254991
|
-
|
|
254992
|
-
|
|
254993
|
-
|
|
254994
|
-
|
|
254995
|
-
|
|
254996
|
-
|
|
254997
|
-
|
|
254998
|
-
|
|
254999
|
-
|
|
255000
|
-
|
|
255531
|
+
return processExtractOutput(stdout, options);
|
|
255532
|
+
} catch (error2) {
|
|
255533
|
+
const errorMessage = `Error executing extract command: ${error2.message}
|
|
255534
|
+
Command: ${command}`;
|
|
255535
|
+
throw new Error(errorMessage);
|
|
255536
|
+
}
|
|
255537
|
+
}
|
|
255538
|
+
function extractWithStdin(binaryPath, cliArgs, content, options) {
|
|
255539
|
+
return new Promise((resolve4, reject2) => {
|
|
255540
|
+
const childProcess = (0, import_child_process4.spawn)(binaryPath, ["extract", ...cliArgs], {
|
|
255541
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
255542
|
+
});
|
|
255543
|
+
let stdout = "";
|
|
255544
|
+
let stderr = "";
|
|
255545
|
+
childProcess.stdout.on("data", (data2) => {
|
|
255546
|
+
stdout += data2.toString();
|
|
255547
|
+
});
|
|
255548
|
+
childProcess.stderr.on("data", (data2) => {
|
|
255549
|
+
stderr += data2.toString();
|
|
255550
|
+
});
|
|
255551
|
+
childProcess.on("close", (code) => {
|
|
255552
|
+
if (stderr && process.env.DEBUG === "1") {
|
|
255553
|
+
console.error(`stderr: ${stderr}`);
|
|
255554
|
+
}
|
|
255555
|
+
if (code !== 0) {
|
|
255556
|
+
reject2(new Error(`Extract command failed with exit code ${code}: ${stderr}`));
|
|
255557
|
+
return;
|
|
255001
255558
|
}
|
|
255559
|
+
try {
|
|
255560
|
+
const result = processExtractOutput(stdout, options);
|
|
255561
|
+
resolve4(result);
|
|
255562
|
+
} catch (error2) {
|
|
255563
|
+
reject2(error2);
|
|
255564
|
+
}
|
|
255565
|
+
});
|
|
255566
|
+
childProcess.on("error", (error2) => {
|
|
255567
|
+
reject2(new Error(`Failed to spawn extract process: ${error2.message}`));
|
|
255568
|
+
});
|
|
255569
|
+
if (typeof content === "string") {
|
|
255570
|
+
childProcess.stdin.write(content);
|
|
255571
|
+
} else {
|
|
255572
|
+
childProcess.stdin.write(content);
|
|
255002
255573
|
}
|
|
255003
|
-
|
|
255004
|
-
|
|
255005
|
-
|
|
255574
|
+
childProcess.stdin.end();
|
|
255575
|
+
});
|
|
255576
|
+
}
|
|
255577
|
+
function processExtractOutput(stdout, options) {
|
|
255578
|
+
let tokenUsage = {
|
|
255579
|
+
requestTokens: 0,
|
|
255580
|
+
responseTokens: 0,
|
|
255581
|
+
totalTokens: 0
|
|
255582
|
+
};
|
|
255583
|
+
if (options.files && Array.isArray(options.files)) {
|
|
255584
|
+
tokenUsage.requestTokens = options.files.join(" ").length / 4;
|
|
255585
|
+
} else if (options.inputFile) {
|
|
255586
|
+
tokenUsage.requestTokens = options.inputFile.length / 4;
|
|
255587
|
+
} else if (options.content) {
|
|
255588
|
+
const contentLength = typeof options.content === "string" ? options.content.length : options.content.byteLength;
|
|
255589
|
+
tokenUsage.requestTokens = contentLength / 4;
|
|
255590
|
+
}
|
|
255591
|
+
if (stdout.includes("Total tokens returned:")) {
|
|
255592
|
+
const tokenMatch = stdout.match(/Total tokens returned: (\d+)/);
|
|
255593
|
+
if (tokenMatch && tokenMatch[1]) {
|
|
255594
|
+
tokenUsage.responseTokens = parseInt(tokenMatch[1], 10);
|
|
255595
|
+
tokenUsage.totalTokens = tokenUsage.requestTokens + tokenUsage.responseTokens;
|
|
255596
|
+
}
|
|
255597
|
+
}
|
|
255598
|
+
let output = stdout;
|
|
255599
|
+
if (!output.includes("Token Usage:")) {
|
|
255600
|
+
output += `
|
|
255006
255601
|
Token Usage:
|
|
255007
255602
|
Request tokens: ${tokenUsage.requestTokens}
|
|
255008
255603
|
Response tokens: ${tokenUsage.responseTokens}
|
|
255009
255604
|
Total tokens: ${tokenUsage.totalTokens}
|
|
255010
255605
|
`;
|
|
255011
|
-
|
|
255012
|
-
|
|
255013
|
-
|
|
255014
|
-
|
|
255015
|
-
|
|
255016
|
-
|
|
255017
|
-
|
|
255018
|
-
|
|
255019
|
-
|
|
255020
|
-
|
|
255021
|
-
}
|
|
255022
|
-
return jsonOutput;
|
|
255023
|
-
} catch (error2) {
|
|
255024
|
-
console.error("Error parsing JSON output:", error2);
|
|
255025
|
-
return output;
|
|
255606
|
+
}
|
|
255607
|
+
if (options.json || options.format === "json") {
|
|
255608
|
+
try {
|
|
255609
|
+
const jsonOutput = JSON.parse(stdout);
|
|
255610
|
+
if (!jsonOutput.token_usage) {
|
|
255611
|
+
jsonOutput.token_usage = {
|
|
255612
|
+
request_tokens: tokenUsage.requestTokens,
|
|
255613
|
+
response_tokens: tokenUsage.responseTokens,
|
|
255614
|
+
total_tokens: tokenUsage.totalTokens
|
|
255615
|
+
};
|
|
255026
255616
|
}
|
|
255617
|
+
return jsonOutput;
|
|
255618
|
+
} catch (error2) {
|
|
255619
|
+
console.error("Error parsing JSON output:", error2);
|
|
255620
|
+
return output;
|
|
255027
255621
|
}
|
|
255028
|
-
return output;
|
|
255029
|
-
} catch (error2) {
|
|
255030
|
-
const errorMessage = `Error executing extract command: ${error2.message}
|
|
255031
|
-
Command: ${command}`;
|
|
255032
|
-
throw new Error(errorMessage);
|
|
255033
255622
|
}
|
|
255623
|
+
return output;
|
|
255034
255624
|
}
|
|
255035
|
-
var import_child_process4, import_util4,
|
|
255625
|
+
var import_child_process4, import_util4, execAsync2, EXTRACT_FLAG_MAP;
|
|
255036
255626
|
var init_extract = __esm({
|
|
255037
255627
|
"src/extract.js"() {
|
|
255038
255628
|
"use strict";
|
|
255039
255629
|
import_child_process4 = __nccwpck_require__(35317);
|
|
255040
255630
|
import_util4 = __nccwpck_require__(39023);
|
|
255041
255631
|
init_utils();
|
|
255042
|
-
|
|
255632
|
+
execAsync2 = (0, import_util4.promisify)(import_child_process4.exec);
|
|
255043
255633
|
EXTRACT_FLAG_MAP = {
|
|
255044
255634
|
allowTests: "--allow-tests",
|
|
255045
255635
|
contextLines: "--context",
|
|
@@ -255074,7 +255664,7 @@ async function grep(options) {
|
|
|
255074
255664
|
const paths = Array.isArray(options.paths) ? options.paths : [options.paths];
|
|
255075
255665
|
cliArgs.push(...paths);
|
|
255076
255666
|
try {
|
|
255077
|
-
const { stdout, stderr } = await
|
|
255667
|
+
const { stdout, stderr } = await execFileAsync2(binaryPath, cliArgs, {
|
|
255078
255668
|
maxBuffer: 10 * 1024 * 1024,
|
|
255079
255669
|
// 10MB buffer
|
|
255080
255670
|
env: {
|
|
@@ -255092,14 +255682,14 @@ async function grep(options) {
|
|
|
255092
255682
|
throw new Error(`Grep failed: ${errorMessage}`);
|
|
255093
255683
|
}
|
|
255094
255684
|
}
|
|
255095
|
-
var import_child_process5, import_util5,
|
|
255685
|
+
var import_child_process5, import_util5, execFileAsync2, GREP_FLAG_MAP;
|
|
255096
255686
|
var init_grep = __esm({
|
|
255097
255687
|
"src/grep.js"() {
|
|
255098
255688
|
"use strict";
|
|
255099
255689
|
import_child_process5 = __nccwpck_require__(35317);
|
|
255100
255690
|
import_util5 = __nccwpck_require__(39023);
|
|
255101
255691
|
init_utils();
|
|
255102
|
-
|
|
255692
|
+
execFileAsync2 = (0, import_util5.promisify)(import_child_process5.execFile);
|
|
255103
255693
|
GREP_FLAG_MAP = {
|
|
255104
255694
|
ignoreCase: "-i",
|
|
255105
255695
|
lineNumbers: "-n",
|
|
@@ -259330,6 +259920,12 @@ function createMessagePreview(message, charsPerSide = 200) {
|
|
|
259330
259920
|
const end = message.substring(message.length - charsPerSide);
|
|
259331
259921
|
return `${start}...${end}`;
|
|
259332
259922
|
}
|
|
259923
|
+
function parseTargets(targets) {
|
|
259924
|
+
if (!targets || typeof targets !== "string") {
|
|
259925
|
+
return [];
|
|
259926
|
+
}
|
|
259927
|
+
return targets.split(/\s+/).filter((f3) => f3.length > 0);
|
|
259928
|
+
}
|
|
259333
259929
|
var searchSchema, querySchema, extractSchema, delegateSchema, bashSchema, attemptCompletionSchema, searchToolDefinition, queryToolDefinition, extractToolDefinition, delegateToolDefinition, attemptCompletionToolDefinition, bashToolDefinition, searchDescription, queryDescription, extractDescription, delegateDescription, bashDescription, DEFAULT_VALID_TOOLS;
|
|
259334
259930
|
var init_common = __esm({
|
|
259335
259931
|
"src/tools/common.js"() {
|
|
@@ -259357,7 +259953,7 @@ var init_common = __esm({
|
|
|
259357
259953
|
end_line: external_exports.number().optional().describe("End line number for extracting a range of lines"),
|
|
259358
259954
|
allow_tests: external_exports.boolean().optional().default(false).describe("Allow test files and test code blocks"),
|
|
259359
259955
|
context_lines: external_exports.number().optional().default(10).describe("Number of context lines to include"),
|
|
259360
|
-
format: external_exports.string().optional().default("plain").describe("Output format (plain, markdown, json, color)")
|
|
259956
|
+
format: external_exports.string().optional().default("plain").describe("Output format (plain, markdown, json, xml, color, outline-xml, outline-diff)")
|
|
259361
259957
|
});
|
|
259362
259958
|
delegateSchema = external_exports.object({
|
|
259363
259959
|
task: external_exports.string().describe("The task to delegate to a subagent. Be specific about what needs to be accomplished.")
|
|
@@ -259984,7 +260580,7 @@ var init_vercel = __esm({
|
|
|
259984
260580
|
format: effectiveFormat
|
|
259985
260581
|
};
|
|
259986
260582
|
} else if (targets) {
|
|
259987
|
-
const files =
|
|
260583
|
+
const files = parseTargets(targets);
|
|
259988
260584
|
let effectiveFormat = format2;
|
|
259989
260585
|
if (outline && format2 === "outline-xml") {
|
|
259990
260586
|
effectiveFormat = "xml";
|
|
@@ -261342,7 +261938,7 @@ function createExtractTool() {
|
|
|
261342
261938
|
schema: extractSchema,
|
|
261343
261939
|
func: async ({ targets, line, end_line, allow_tests, context_lines, format: format2 }) => {
|
|
261344
261940
|
try {
|
|
261345
|
-
const files =
|
|
261941
|
+
const files = parseTargets(targets);
|
|
261346
261942
|
const results = await extract({
|
|
261347
261943
|
files,
|
|
261348
261944
|
allowTests: allow_tests,
|
|
@@ -261568,7 +262164,7 @@ async function listFilesByLevel(options) {
|
|
|
261568
262164
|
return await listFilesByLevelManually(directory, maxFiles, respectGitignore);
|
|
261569
262165
|
}
|
|
261570
262166
|
async function listFilesUsingGit(directory, maxFiles) {
|
|
261571
|
-
const { stdout } = await
|
|
262167
|
+
const { stdout } = await execAsync3("git ls-files", { cwd: directory });
|
|
261572
262168
|
const files = stdout.split("\n").filter(Boolean);
|
|
261573
262169
|
const sortedFiles = files.sort((a3, b3) => {
|
|
261574
262170
|
const depthA = a3.split(import_path6.default.sep).length;
|
|
@@ -261634,7 +262230,7 @@ function shouldIgnore(filePath, ignorePatterns) {
|
|
|
261634
262230
|
}
|
|
261635
262231
|
return false;
|
|
261636
262232
|
}
|
|
261637
|
-
var import_fs2, import_path6, import_util9, import_child_process8,
|
|
262233
|
+
var import_fs2, import_path6, import_util9, import_child_process8, execAsync3;
|
|
261638
262234
|
var init_file_lister = __esm({
|
|
261639
262235
|
"src/utils/file-lister.js"() {
|
|
261640
262236
|
"use strict";
|
|
@@ -261642,7 +262238,7 @@ var init_file_lister = __esm({
|
|
|
261642
262238
|
import_path6 = __toESM(__nccwpck_require__(16928), 1);
|
|
261643
262239
|
import_util9 = __nccwpck_require__(39023);
|
|
261644
262240
|
import_child_process8 = __nccwpck_require__(35317);
|
|
261645
|
-
|
|
262241
|
+
execAsync3 = (0, import_util9.promisify)(import_child_process8.exec);
|
|
261646
262242
|
}
|
|
261647
262243
|
});
|
|
261648
262244
|
|
|
@@ -264701,22 +265297,13 @@ var require_dist_cjs18 = __commonJS({
|
|
|
264701
265297
|
var sdkStreamMixin2 = require_sdk_stream_mixin();
|
|
264702
265298
|
var splitStream = require_splitStream();
|
|
264703
265299
|
var streamTypeCheck = require_stream_type_check();
|
|
264704
|
-
function transformToString(payload2, encoding = "utf-8") {
|
|
264705
|
-
if (encoding === "base64") {
|
|
264706
|
-
return utilBase64.toBase64(payload2);
|
|
264707
|
-
}
|
|
264708
|
-
return utilUtf8.toUtf8(payload2);
|
|
264709
|
-
}
|
|
264710
|
-
function transformFromString(str, encoding) {
|
|
264711
|
-
if (encoding === "base64") {
|
|
264712
|
-
return Uint8ArrayBlobAdapter2.mutate(utilBase64.fromBase64(str));
|
|
264713
|
-
}
|
|
264714
|
-
return Uint8ArrayBlobAdapter2.mutate(utilUtf8.fromUtf8(str));
|
|
264715
|
-
}
|
|
264716
265300
|
var Uint8ArrayBlobAdapter2 = class _Uint8ArrayBlobAdapter extends Uint8Array {
|
|
264717
265301
|
static fromString(source, encoding = "utf-8") {
|
|
264718
265302
|
if (typeof source === "string") {
|
|
264719
|
-
|
|
265303
|
+
if (encoding === "base64") {
|
|
265304
|
+
return _Uint8ArrayBlobAdapter.mutate(utilBase64.fromBase64(source));
|
|
265305
|
+
}
|
|
265306
|
+
return _Uint8ArrayBlobAdapter.mutate(utilUtf8.fromUtf8(source));
|
|
264720
265307
|
}
|
|
264721
265308
|
throw new Error(`Unsupported conversion from ${typeof source} to Uint8ArrayBlobAdapter.`);
|
|
264722
265309
|
}
|
|
@@ -264725,7 +265312,10 @@ var require_dist_cjs18 = __commonJS({
|
|
|
264725
265312
|
return source;
|
|
264726
265313
|
}
|
|
264727
265314
|
transformToString(encoding = "utf-8") {
|
|
264728
|
-
|
|
265315
|
+
if (encoding === "base64") {
|
|
265316
|
+
return utilBase64.toBase64(this);
|
|
265317
|
+
}
|
|
265318
|
+
return utilUtf8.toUtf8(this);
|
|
264729
265319
|
}
|
|
264730
265320
|
};
|
|
264731
265321
|
exports2.Uint8ArrayBlobAdapter = Uint8ArrayBlobAdapter2;
|
|
@@ -264838,6 +265428,138 @@ var init_deref = __esm({
|
|
|
264838
265428
|
}
|
|
264839
265429
|
});
|
|
264840
265430
|
|
|
265431
|
+
// node_modules/@smithy/core/dist-es/submodules/schema/schemas/operation.js
|
|
265432
|
+
var operation;
|
|
265433
|
+
var init_operation = __esm({
|
|
265434
|
+
"node_modules/@smithy/core/dist-es/submodules/schema/schemas/operation.js"() {
|
|
265435
|
+
operation = (namespace, name14, traits, input, output) => ({
|
|
265436
|
+
name: name14,
|
|
265437
|
+
namespace,
|
|
265438
|
+
traits,
|
|
265439
|
+
input,
|
|
265440
|
+
output
|
|
265441
|
+
});
|
|
265442
|
+
}
|
|
265443
|
+
});
|
|
265444
|
+
|
|
265445
|
+
// node_modules/@smithy/core/dist-es/submodules/schema/middleware/schemaDeserializationMiddleware.js
|
|
265446
|
+
var import_protocol_http2, import_util_middleware3, schemaDeserializationMiddleware, findHeader;
|
|
265447
|
+
var init_schemaDeserializationMiddleware = __esm({
|
|
265448
|
+
"node_modules/@smithy/core/dist-es/submodules/schema/middleware/schemaDeserializationMiddleware.js"() {
|
|
265449
|
+
import_protocol_http2 = __toESM(require_dist_cjs2());
|
|
265450
|
+
import_util_middleware3 = __toESM(require_dist_cjs7());
|
|
265451
|
+
init_operation();
|
|
265452
|
+
schemaDeserializationMiddleware = (config) => (next, context3) => async (args) => {
|
|
265453
|
+
const { response } = await next(args);
|
|
265454
|
+
const { operationSchema } = (0, import_util_middleware3.getSmithyContext)(context3);
|
|
265455
|
+
const [, ns, n3, t3, i3, o3] = operationSchema ?? [];
|
|
265456
|
+
try {
|
|
265457
|
+
const parsed = await config.protocol.deserializeResponse(operation(ns, n3, t3, i3, o3), {
|
|
265458
|
+
...config,
|
|
265459
|
+
...context3
|
|
265460
|
+
}, response);
|
|
265461
|
+
return {
|
|
265462
|
+
response,
|
|
265463
|
+
output: parsed
|
|
265464
|
+
};
|
|
265465
|
+
} catch (error2) {
|
|
265466
|
+
Object.defineProperty(error2, "$response", {
|
|
265467
|
+
value: response
|
|
265468
|
+
});
|
|
265469
|
+
if (!("$metadata" in error2)) {
|
|
265470
|
+
const hint = `Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.`;
|
|
265471
|
+
try {
|
|
265472
|
+
error2.message += "\n " + hint;
|
|
265473
|
+
} catch (e3) {
|
|
265474
|
+
if (!context3.logger || context3.logger?.constructor?.name === "NoOpLogger") {
|
|
265475
|
+
console.warn(hint);
|
|
265476
|
+
} else {
|
|
265477
|
+
context3.logger?.warn?.(hint);
|
|
265478
|
+
}
|
|
265479
|
+
}
|
|
265480
|
+
if (typeof error2.$responseBodyText !== "undefined") {
|
|
265481
|
+
if (error2.$response) {
|
|
265482
|
+
error2.$response.body = error2.$responseBodyText;
|
|
265483
|
+
}
|
|
265484
|
+
}
|
|
265485
|
+
try {
|
|
265486
|
+
if (import_protocol_http2.HttpResponse.isInstance(response)) {
|
|
265487
|
+
const { headers = {} } = response;
|
|
265488
|
+
const headerEntries = Object.entries(headers);
|
|
265489
|
+
error2.$metadata = {
|
|
265490
|
+
httpStatusCode: response.statusCode,
|
|
265491
|
+
requestId: findHeader(/^x-[\w-]+-request-?id$/, headerEntries),
|
|
265492
|
+
extendedRequestId: findHeader(/^x-[\w-]+-id-2$/, headerEntries),
|
|
265493
|
+
cfId: findHeader(/^x-[\w-]+-cf-id$/, headerEntries)
|
|
265494
|
+
};
|
|
265495
|
+
}
|
|
265496
|
+
} catch (e3) {
|
|
265497
|
+
}
|
|
265498
|
+
}
|
|
265499
|
+
throw error2;
|
|
265500
|
+
}
|
|
265501
|
+
};
|
|
265502
|
+
findHeader = (pattern, headers) => {
|
|
265503
|
+
return (headers.find(([k3]) => {
|
|
265504
|
+
return k3.match(pattern);
|
|
265505
|
+
}) || [void 0, void 0])[1];
|
|
265506
|
+
};
|
|
265507
|
+
}
|
|
265508
|
+
});
|
|
265509
|
+
|
|
265510
|
+
// node_modules/@smithy/core/dist-es/submodules/schema/middleware/schemaSerializationMiddleware.js
|
|
265511
|
+
var import_util_middleware4, schemaSerializationMiddleware;
|
|
265512
|
+
var init_schemaSerializationMiddleware = __esm({
|
|
265513
|
+
"node_modules/@smithy/core/dist-es/submodules/schema/middleware/schemaSerializationMiddleware.js"() {
|
|
265514
|
+
import_util_middleware4 = __toESM(require_dist_cjs7());
|
|
265515
|
+
init_operation();
|
|
265516
|
+
schemaSerializationMiddleware = (config) => (next, context3) => async (args) => {
|
|
265517
|
+
const { operationSchema } = (0, import_util_middleware4.getSmithyContext)(context3);
|
|
265518
|
+
const [, ns, n3, t3, i3, o3] = operationSchema ?? [];
|
|
265519
|
+
const endpoint = context3.endpointV2?.url && config.urlParser ? async () => config.urlParser(context3.endpointV2.url) : config.endpoint;
|
|
265520
|
+
const request = await config.protocol.serializeRequest(operation(ns, n3, t3, i3, o3), args.input, {
|
|
265521
|
+
...config,
|
|
265522
|
+
...context3,
|
|
265523
|
+
endpoint
|
|
265524
|
+
});
|
|
265525
|
+
return next({
|
|
265526
|
+
...args,
|
|
265527
|
+
request
|
|
265528
|
+
});
|
|
265529
|
+
};
|
|
265530
|
+
}
|
|
265531
|
+
});
|
|
265532
|
+
|
|
265533
|
+
// node_modules/@smithy/core/dist-es/submodules/schema/middleware/getSchemaSerdePlugin.js
|
|
265534
|
+
function getSchemaSerdePlugin(config) {
|
|
265535
|
+
return {
|
|
265536
|
+
applyToStack: (commandStack) => {
|
|
265537
|
+
commandStack.add(schemaSerializationMiddleware(config), serializerMiddlewareOption2);
|
|
265538
|
+
commandStack.add(schemaDeserializationMiddleware(config), deserializerMiddlewareOption);
|
|
265539
|
+
config.protocol.setSerdeContext(config);
|
|
265540
|
+
}
|
|
265541
|
+
};
|
|
265542
|
+
}
|
|
265543
|
+
var deserializerMiddlewareOption, serializerMiddlewareOption2;
|
|
265544
|
+
var init_getSchemaSerdePlugin = __esm({
|
|
265545
|
+
"node_modules/@smithy/core/dist-es/submodules/schema/middleware/getSchemaSerdePlugin.js"() {
|
|
265546
|
+
init_schemaDeserializationMiddleware();
|
|
265547
|
+
init_schemaSerializationMiddleware();
|
|
265548
|
+
deserializerMiddlewareOption = {
|
|
265549
|
+
name: "deserializerMiddleware",
|
|
265550
|
+
step: "deserialize",
|
|
265551
|
+
tags: ["DESERIALIZER"],
|
|
265552
|
+
override: true
|
|
265553
|
+
};
|
|
265554
|
+
serializerMiddlewareOption2 = {
|
|
265555
|
+
name: "serializerMiddleware",
|
|
265556
|
+
step: "serialize",
|
|
265557
|
+
tags: ["SERIALIZER"],
|
|
265558
|
+
override: true
|
|
265559
|
+
};
|
|
265560
|
+
}
|
|
265561
|
+
});
|
|
265562
|
+
|
|
264841
265563
|
// node_modules/@smithy/core/dist-es/submodules/schema/schemas/Schema.js
|
|
264842
265564
|
var Schema;
|
|
264843
265565
|
var init_Schema = __esm({
|
|
@@ -264865,51 +265587,6 @@ var init_Schema = __esm({
|
|
|
264865
265587
|
}
|
|
264866
265588
|
});
|
|
264867
265589
|
|
|
264868
|
-
// node_modules/@smithy/core/dist-es/submodules/schema/schemas/StructureSchema.js
|
|
264869
|
-
var StructureSchema, struct;
|
|
264870
|
-
var init_StructureSchema = __esm({
|
|
264871
|
-
"node_modules/@smithy/core/dist-es/submodules/schema/schemas/StructureSchema.js"() {
|
|
264872
|
-
init_Schema();
|
|
264873
|
-
StructureSchema = class _StructureSchema extends Schema {
|
|
264874
|
-
static symbol = Symbol.for("@smithy/str");
|
|
264875
|
-
name;
|
|
264876
|
-
traits;
|
|
264877
|
-
memberNames;
|
|
264878
|
-
memberList;
|
|
264879
|
-
symbol = _StructureSchema.symbol;
|
|
264880
|
-
};
|
|
264881
|
-
struct = (namespace, name14, traits, memberNames, memberList) => Schema.assign(new StructureSchema(), {
|
|
264882
|
-
name: name14,
|
|
264883
|
-
namespace,
|
|
264884
|
-
traits,
|
|
264885
|
-
memberNames,
|
|
264886
|
-
memberList
|
|
264887
|
-
});
|
|
264888
|
-
}
|
|
264889
|
-
});
|
|
264890
|
-
|
|
264891
|
-
// node_modules/@smithy/core/dist-es/submodules/schema/schemas/ErrorSchema.js
|
|
264892
|
-
var ErrorSchema, error;
|
|
264893
|
-
var init_ErrorSchema = __esm({
|
|
264894
|
-
"node_modules/@smithy/core/dist-es/submodules/schema/schemas/ErrorSchema.js"() {
|
|
264895
|
-
init_Schema();
|
|
264896
|
-
init_StructureSchema();
|
|
264897
|
-
ErrorSchema = class _ErrorSchema extends StructureSchema {
|
|
264898
|
-
static symbol = Symbol.for("@smithy/err");
|
|
264899
|
-
ctor;
|
|
264900
|
-
symbol = _ErrorSchema.symbol;
|
|
264901
|
-
};
|
|
264902
|
-
error = (namespace, name14, traits, memberNames, memberList, ctor) => Schema.assign(new ErrorSchema(), {
|
|
264903
|
-
name: name14,
|
|
264904
|
-
namespace,
|
|
264905
|
-
traits,
|
|
264906
|
-
memberNames,
|
|
264907
|
-
memberList,
|
|
264908
|
-
ctor: null
|
|
264909
|
-
});
|
|
264910
|
-
}
|
|
264911
|
-
});
|
|
264912
|
-
|
|
264913
265590
|
// node_modules/@smithy/core/dist-es/submodules/schema/schemas/ListSchema.js
|
|
264914
265591
|
var ListSchema, list;
|
|
264915
265592
|
var init_ListSchema = __esm({
|
|
@@ -264977,29 +265654,47 @@ var init_OperationSchema = __esm({
|
|
|
264977
265654
|
}
|
|
264978
265655
|
});
|
|
264979
265656
|
|
|
264980
|
-
// node_modules/@smithy/core/dist-es/submodules/schema/schemas/
|
|
264981
|
-
var
|
|
264982
|
-
var
|
|
264983
|
-
"node_modules/@smithy/core/dist-es/submodules/schema/schemas/
|
|
265657
|
+
// node_modules/@smithy/core/dist-es/submodules/schema/schemas/StructureSchema.js
|
|
265658
|
+
var StructureSchema, struct;
|
|
265659
|
+
var init_StructureSchema = __esm({
|
|
265660
|
+
"node_modules/@smithy/core/dist-es/submodules/schema/schemas/StructureSchema.js"() {
|
|
264984
265661
|
init_Schema();
|
|
264985
|
-
|
|
264986
|
-
static symbol = Symbol.for("@smithy/
|
|
265662
|
+
StructureSchema = class _StructureSchema extends Schema {
|
|
265663
|
+
static symbol = Symbol.for("@smithy/str");
|
|
264987
265664
|
name;
|
|
264988
|
-
schemaRef;
|
|
264989
265665
|
traits;
|
|
264990
|
-
|
|
265666
|
+
memberNames;
|
|
265667
|
+
memberList;
|
|
265668
|
+
symbol = _StructureSchema.symbol;
|
|
264991
265669
|
};
|
|
264992
|
-
|
|
265670
|
+
struct = (namespace, name14, traits, memberNames, memberList) => Schema.assign(new StructureSchema(), {
|
|
264993
265671
|
name: name14,
|
|
264994
265672
|
namespace,
|
|
264995
265673
|
traits,
|
|
264996
|
-
|
|
265674
|
+
memberNames,
|
|
265675
|
+
memberList
|
|
264997
265676
|
});
|
|
264998
|
-
|
|
265677
|
+
}
|
|
265678
|
+
});
|
|
265679
|
+
|
|
265680
|
+
// node_modules/@smithy/core/dist-es/submodules/schema/schemas/ErrorSchema.js
|
|
265681
|
+
var ErrorSchema, error;
|
|
265682
|
+
var init_ErrorSchema = __esm({
|
|
265683
|
+
"node_modules/@smithy/core/dist-es/submodules/schema/schemas/ErrorSchema.js"() {
|
|
265684
|
+
init_Schema();
|
|
265685
|
+
init_StructureSchema();
|
|
265686
|
+
ErrorSchema = class _ErrorSchema extends StructureSchema {
|
|
265687
|
+
static symbol = Symbol.for("@smithy/err");
|
|
265688
|
+
ctor;
|
|
265689
|
+
symbol = _ErrorSchema.symbol;
|
|
265690
|
+
};
|
|
265691
|
+
error = (namespace, name14, traits, memberNames, memberList, ctor) => Schema.assign(new ErrorSchema(), {
|
|
264999
265692
|
name: name14,
|
|
265000
265693
|
namespace,
|
|
265001
265694
|
traits,
|
|
265002
|
-
|
|
265695
|
+
memberNames,
|
|
265696
|
+
memberList,
|
|
265697
|
+
ctor: null
|
|
265003
265698
|
});
|
|
265004
265699
|
}
|
|
265005
265700
|
});
|
|
@@ -265043,28 +265738,10 @@ function member(memberSchema, memberName) {
|
|
|
265043
265738
|
const internalCtorAccess = NormalizedSchema;
|
|
265044
265739
|
return new internalCtorAccess(memberSchema, memberName);
|
|
265045
265740
|
}
|
|
265046
|
-
function hydrate(ss) {
|
|
265047
|
-
const [id, ...rest] = ss;
|
|
265048
|
-
return {
|
|
265049
|
-
[0]: simAdapter,
|
|
265050
|
-
[1]: list,
|
|
265051
|
-
[2]: map,
|
|
265052
|
-
[3]: struct,
|
|
265053
|
-
[-3]: error,
|
|
265054
|
-
[9]: op
|
|
265055
|
-
}[id].call(null, ...rest);
|
|
265056
|
-
}
|
|
265057
265741
|
var NormalizedSchema, isMemberSchema, isStaticSchema;
|
|
265058
265742
|
var init_NormalizedSchema = __esm({
|
|
265059
265743
|
"node_modules/@smithy/core/dist-es/submodules/schema/schemas/NormalizedSchema.js"() {
|
|
265060
265744
|
init_deref();
|
|
265061
|
-
init_ErrorSchema();
|
|
265062
|
-
init_ListSchema();
|
|
265063
|
-
init_MapSchema();
|
|
265064
|
-
init_OperationSchema();
|
|
265065
|
-
init_Schema();
|
|
265066
|
-
init_SimpleSchema();
|
|
265067
|
-
init_StructureSchema();
|
|
265068
265745
|
init_translateTraits();
|
|
265069
265746
|
NormalizedSchema = class _NormalizedSchema {
|
|
265070
265747
|
ref;
|
|
@@ -265090,8 +265767,6 @@ var init_NormalizedSchema = __esm({
|
|
|
265090
265767
|
schema = deref(_ref);
|
|
265091
265768
|
this._isMemberSchema = true;
|
|
265092
265769
|
}
|
|
265093
|
-
if (isStaticSchema(schema))
|
|
265094
|
-
schema = hydrate(schema);
|
|
265095
265770
|
if (traitStack.length > 0) {
|
|
265096
265771
|
this.memberTraits = {};
|
|
265097
265772
|
for (let i3 = traitStack.length - 1; i3 >= 0; --i3) {
|
|
@@ -265110,18 +265785,24 @@ var init_NormalizedSchema = __esm({
|
|
|
265110
265785
|
return;
|
|
265111
265786
|
}
|
|
265112
265787
|
this.schema = deref(schema);
|
|
265113
|
-
if (this.schema
|
|
265114
|
-
this.
|
|
265788
|
+
if (isStaticSchema(this.schema)) {
|
|
265789
|
+
this.name = `${this.schema[1]}#${this.schema[2]}`;
|
|
265790
|
+
this.traits = this.schema[3];
|
|
265115
265791
|
} else {
|
|
265792
|
+
this.name = this.memberName ?? String(schema);
|
|
265116
265793
|
this.traits = 0;
|
|
265117
265794
|
}
|
|
265118
|
-
this.name = (this.schema instanceof Schema ? this.schema.getName?.() : void 0) ?? this.memberName ?? String(schema);
|
|
265119
265795
|
if (this._isMemberSchema && !memberName) {
|
|
265120
265796
|
throw new Error(`@smithy/core/schema - NormalizedSchema member init ${this.getName(true)} missing member name.`);
|
|
265121
265797
|
}
|
|
265122
265798
|
}
|
|
265123
265799
|
static [Symbol.hasInstance](lhs) {
|
|
265124
|
-
|
|
265800
|
+
const isPrototype2 = this.prototype.isPrototypeOf(lhs);
|
|
265801
|
+
if (!isPrototype2 && typeof lhs === "object" && lhs !== null) {
|
|
265802
|
+
const ns = lhs;
|
|
265803
|
+
return ns.symbol === this.symbol;
|
|
265804
|
+
}
|
|
265805
|
+
return isPrototype2;
|
|
265125
265806
|
}
|
|
265126
265807
|
static of(ref) {
|
|
265127
265808
|
const sc = deref(ref);
|
|
@@ -265139,7 +265820,11 @@ var init_NormalizedSchema = __esm({
|
|
|
265139
265820
|
return new _NormalizedSchema(sc);
|
|
265140
265821
|
}
|
|
265141
265822
|
getSchema() {
|
|
265142
|
-
|
|
265823
|
+
const sc = this.schema;
|
|
265824
|
+
if (sc[0] === 0) {
|
|
265825
|
+
return sc[4];
|
|
265826
|
+
}
|
|
265827
|
+
return sc;
|
|
265143
265828
|
}
|
|
265144
265829
|
getName(withNamespace = false) {
|
|
265145
265830
|
const { name: name14 } = this;
|
|
@@ -265154,15 +265839,15 @@ var init_NormalizedSchema = __esm({
|
|
|
265154
265839
|
}
|
|
265155
265840
|
isListSchema() {
|
|
265156
265841
|
const sc = this.getSchema();
|
|
265157
|
-
return typeof sc === "number" ? sc >= 64 && sc < 128 : sc
|
|
265842
|
+
return typeof sc === "number" ? sc >= 64 && sc < 128 : sc[0] === 1;
|
|
265158
265843
|
}
|
|
265159
265844
|
isMapSchema() {
|
|
265160
265845
|
const sc = this.getSchema();
|
|
265161
|
-
return typeof sc === "number" ? sc >= 128 && sc <= 255 : sc
|
|
265846
|
+
return typeof sc === "number" ? sc >= 128 && sc <= 255 : sc[0] === 2;
|
|
265162
265847
|
}
|
|
265163
265848
|
isStructSchema() {
|
|
265164
265849
|
const sc = this.getSchema();
|
|
265165
|
-
return sc
|
|
265850
|
+
return sc[0] === 3 || sc[0] === -3;
|
|
265166
265851
|
}
|
|
265167
265852
|
isBlobSchema() {
|
|
265168
265853
|
const sc = this.getSchema();
|
|
@@ -265220,13 +265905,13 @@ var init_NormalizedSchema = __esm({
|
|
|
265220
265905
|
throw new Error(`@smithy/core/schema - cannot get key for non-map: ${this.getName(true)}`);
|
|
265221
265906
|
}
|
|
265222
265907
|
const schema = this.getSchema();
|
|
265223
|
-
const memberSchema = isDoc ? 15 : schema
|
|
265908
|
+
const memberSchema = isDoc ? 15 : schema[4] ?? 0;
|
|
265224
265909
|
return member([memberSchema, 0], "key");
|
|
265225
265910
|
}
|
|
265226
265911
|
getValueSchema() {
|
|
265227
265912
|
const sc = this.getSchema();
|
|
265228
265913
|
const [isDoc, isMap2, isList] = [this.isDocumentSchema(), this.isMapSchema(), this.isListSchema()];
|
|
265229
|
-
const memberSchema = typeof sc === "number" ? 63 & sc : sc && typeof sc === "object" && (isMap2 || isList) ? sc
|
|
265914
|
+
const memberSchema = typeof sc === "number" ? 63 & sc : sc && typeof sc === "object" && (isMap2 || isList) ? sc[3 + sc[0]] : isDoc ? 15 : void 0;
|
|
265230
265915
|
if (memberSchema != null) {
|
|
265231
265916
|
return member([memberSchema, 0], isMap2 ? "value" : "member");
|
|
265232
265917
|
}
|
|
@@ -265234,9 +265919,9 @@ var init_NormalizedSchema = __esm({
|
|
|
265234
265919
|
}
|
|
265235
265920
|
getMemberSchema(memberName) {
|
|
265236
265921
|
const struct2 = this.getSchema();
|
|
265237
|
-
if (this.isStructSchema() && struct2.
|
|
265238
|
-
const i3 = struct2.
|
|
265239
|
-
const memberSchema = struct2
|
|
265922
|
+
if (this.isStructSchema() && struct2[4].includes(memberName)) {
|
|
265923
|
+
const i3 = struct2[4].indexOf(memberName);
|
|
265924
|
+
const memberSchema = struct2[5][i3];
|
|
265240
265925
|
return member(isMemberSchema(memberSchema) ? memberSchema : [memberSchema, 0], memberName);
|
|
265241
265926
|
}
|
|
265242
265927
|
if (this.isDocumentSchema()) {
|
|
@@ -265272,8 +265957,8 @@ var init_NormalizedSchema = __esm({
|
|
|
265272
265957
|
throw new Error("@smithy/core/schema - cannot iterate non-struct schema.");
|
|
265273
265958
|
}
|
|
265274
265959
|
const struct2 = this.getSchema();
|
|
265275
|
-
for (let i3 = 0; i3 < struct2.
|
|
265276
|
-
yield [struct2
|
|
265960
|
+
for (let i3 = 0; i3 < struct2[4].length; ++i3) {
|
|
265961
|
+
yield [struct2[4][i3], member([struct2[5][i3], 0], struct2[4][i3])];
|
|
265277
265962
|
}
|
|
265278
265963
|
}
|
|
265279
265964
|
};
|
|
@@ -265282,125 +265967,30 @@ var init_NormalizedSchema = __esm({
|
|
|
265282
265967
|
}
|
|
265283
265968
|
});
|
|
265284
265969
|
|
|
265285
|
-
// node_modules/@smithy/core/dist-es/submodules/schema/
|
|
265286
|
-
var
|
|
265287
|
-
var
|
|
265288
|
-
"node_modules/@smithy/core/dist-es/submodules/schema/
|
|
265289
|
-
|
|
265290
|
-
|
|
265291
|
-
|
|
265292
|
-
|
|
265293
|
-
|
|
265294
|
-
|
|
265295
|
-
|
|
265296
|
-
operationSchema = hydrate(operationSchema);
|
|
265297
|
-
}
|
|
265298
|
-
try {
|
|
265299
|
-
const parsed = await config.protocol.deserializeResponse(operationSchema, {
|
|
265300
|
-
...config,
|
|
265301
|
-
...context3
|
|
265302
|
-
}, response);
|
|
265303
|
-
return {
|
|
265304
|
-
response,
|
|
265305
|
-
output: parsed
|
|
265306
|
-
};
|
|
265307
|
-
} catch (error2) {
|
|
265308
|
-
Object.defineProperty(error2, "$response", {
|
|
265309
|
-
value: response
|
|
265310
|
-
});
|
|
265311
|
-
if (!("$metadata" in error2)) {
|
|
265312
|
-
const hint = `Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.`;
|
|
265313
|
-
try {
|
|
265314
|
-
error2.message += "\n " + hint;
|
|
265315
|
-
} catch (e3) {
|
|
265316
|
-
if (!context3.logger || context3.logger?.constructor?.name === "NoOpLogger") {
|
|
265317
|
-
console.warn(hint);
|
|
265318
|
-
} else {
|
|
265319
|
-
context3.logger?.warn?.(hint);
|
|
265320
|
-
}
|
|
265321
|
-
}
|
|
265322
|
-
if (typeof error2.$responseBodyText !== "undefined") {
|
|
265323
|
-
if (error2.$response) {
|
|
265324
|
-
error2.$response.body = error2.$responseBodyText;
|
|
265325
|
-
}
|
|
265326
|
-
}
|
|
265327
|
-
try {
|
|
265328
|
-
if (import_protocol_http2.HttpResponse.isInstance(response)) {
|
|
265329
|
-
const { headers = {} } = response;
|
|
265330
|
-
const headerEntries = Object.entries(headers);
|
|
265331
|
-
error2.$metadata = {
|
|
265332
|
-
httpStatusCode: response.statusCode,
|
|
265333
|
-
requestId: findHeader(/^x-[\w-]+-request-?id$/, headerEntries),
|
|
265334
|
-
extendedRequestId: findHeader(/^x-[\w-]+-id-2$/, headerEntries),
|
|
265335
|
-
cfId: findHeader(/^x-[\w-]+-cf-id$/, headerEntries)
|
|
265336
|
-
};
|
|
265337
|
-
}
|
|
265338
|
-
} catch (e3) {
|
|
265339
|
-
}
|
|
265340
|
-
}
|
|
265341
|
-
throw error2;
|
|
265342
|
-
}
|
|
265343
|
-
};
|
|
265344
|
-
findHeader = (pattern, headers) => {
|
|
265345
|
-
return (headers.find(([k3]) => {
|
|
265346
|
-
return k3.match(pattern);
|
|
265347
|
-
}) || [void 0, void 0])[1];
|
|
265348
|
-
};
|
|
265349
|
-
}
|
|
265350
|
-
});
|
|
265351
|
-
|
|
265352
|
-
// node_modules/@smithy/core/dist-es/submodules/schema/middleware/schemaSerializationMiddleware.js
|
|
265353
|
-
var import_util_middleware4, schemaSerializationMiddleware;
|
|
265354
|
-
var init_schemaSerializationMiddleware = __esm({
|
|
265355
|
-
"node_modules/@smithy/core/dist-es/submodules/schema/middleware/schemaSerializationMiddleware.js"() {
|
|
265356
|
-
import_util_middleware4 = __toESM(require_dist_cjs7());
|
|
265357
|
-
init_NormalizedSchema();
|
|
265358
|
-
schemaSerializationMiddleware = (config) => (next, context3) => async (args) => {
|
|
265359
|
-
let { operationSchema } = (0, import_util_middleware4.getSmithyContext)(context3);
|
|
265360
|
-
if (isStaticSchema(operationSchema)) {
|
|
265361
|
-
operationSchema = hydrate(operationSchema);
|
|
265362
|
-
}
|
|
265363
|
-
const endpoint = context3.endpointV2?.url && config.urlParser ? async () => config.urlParser(context3.endpointV2.url) : config.endpoint;
|
|
265364
|
-
const request = await config.protocol.serializeRequest(operationSchema, args.input, {
|
|
265365
|
-
...config,
|
|
265366
|
-
...context3,
|
|
265367
|
-
endpoint
|
|
265368
|
-
});
|
|
265369
|
-
return next({
|
|
265370
|
-
...args,
|
|
265371
|
-
request
|
|
265372
|
-
});
|
|
265373
|
-
};
|
|
265374
|
-
}
|
|
265375
|
-
});
|
|
265376
|
-
|
|
265377
|
-
// node_modules/@smithy/core/dist-es/submodules/schema/middleware/getSchemaSerdePlugin.js
|
|
265378
|
-
function getSchemaSerdePlugin(config) {
|
|
265379
|
-
return {
|
|
265380
|
-
applyToStack: (commandStack) => {
|
|
265381
|
-
commandStack.add(schemaSerializationMiddleware(config), serializerMiddlewareOption2);
|
|
265382
|
-
commandStack.add(schemaDeserializationMiddleware(config), deserializerMiddlewareOption);
|
|
265383
|
-
config.protocol.setSerdeContext(config);
|
|
265384
|
-
}
|
|
265385
|
-
};
|
|
265386
|
-
}
|
|
265387
|
-
var deserializerMiddlewareOption, serializerMiddlewareOption2;
|
|
265388
|
-
var init_getSchemaSerdePlugin = __esm({
|
|
265389
|
-
"node_modules/@smithy/core/dist-es/submodules/schema/middleware/getSchemaSerdePlugin.js"() {
|
|
265390
|
-
init_schemaDeserializationMiddleware();
|
|
265391
|
-
init_schemaSerializationMiddleware();
|
|
265392
|
-
deserializerMiddlewareOption = {
|
|
265393
|
-
name: "deserializerMiddleware",
|
|
265394
|
-
step: "deserialize",
|
|
265395
|
-
tags: ["DESERIALIZER"],
|
|
265396
|
-
override: true
|
|
265397
|
-
};
|
|
265398
|
-
serializerMiddlewareOption2 = {
|
|
265399
|
-
name: "serializerMiddleware",
|
|
265400
|
-
step: "serialize",
|
|
265401
|
-
tags: ["SERIALIZER"],
|
|
265402
|
-
override: true
|
|
265970
|
+
// node_modules/@smithy/core/dist-es/submodules/schema/schemas/SimpleSchema.js
|
|
265971
|
+
var SimpleSchema, sim, simAdapter;
|
|
265972
|
+
var init_SimpleSchema = __esm({
|
|
265973
|
+
"node_modules/@smithy/core/dist-es/submodules/schema/schemas/SimpleSchema.js"() {
|
|
265974
|
+
init_Schema();
|
|
265975
|
+
SimpleSchema = class _SimpleSchema extends Schema {
|
|
265976
|
+
static symbol = Symbol.for("@smithy/sim");
|
|
265977
|
+
name;
|
|
265978
|
+
schemaRef;
|
|
265979
|
+
traits;
|
|
265980
|
+
symbol = _SimpleSchema.symbol;
|
|
265403
265981
|
};
|
|
265982
|
+
sim = (namespace, name14, schemaRef, traits) => Schema.assign(new SimpleSchema(), {
|
|
265983
|
+
name: name14,
|
|
265984
|
+
namespace,
|
|
265985
|
+
traits,
|
|
265986
|
+
schemaRef
|
|
265987
|
+
});
|
|
265988
|
+
simAdapter = (namespace, name14, traits, schemaRef) => Schema.assign(new SimpleSchema(), {
|
|
265989
|
+
name: name14,
|
|
265990
|
+
namespace,
|
|
265991
|
+
traits,
|
|
265992
|
+
schemaRef
|
|
265993
|
+
});
|
|
265404
265994
|
}
|
|
265405
265995
|
});
|
|
265406
265996
|
|
|
@@ -265468,7 +266058,7 @@ var init_TypeRegistry = __esm({
|
|
|
265468
266058
|
getErrorCtor(es) {
|
|
265469
266059
|
const $error = es;
|
|
265470
266060
|
const registry = _TypeRegistry.for($error[1]);
|
|
265471
|
-
return registry.exceptions.get(
|
|
266061
|
+
return registry.exceptions.get($error);
|
|
265472
266062
|
}
|
|
265473
266063
|
getBaseException() {
|
|
265474
266064
|
for (const exceptionKey of this.exceptions.keys()) {
|
|
@@ -265516,11 +266106,11 @@ __export(schema_exports, {
|
|
|
265516
266106
|
deserializerMiddlewareOption: () => deserializerMiddlewareOption,
|
|
265517
266107
|
error: () => error,
|
|
265518
266108
|
getSchemaSerdePlugin: () => getSchemaSerdePlugin,
|
|
265519
|
-
hydrate: () => hydrate,
|
|
265520
266109
|
isStaticSchema: () => isStaticSchema,
|
|
265521
266110
|
list: () => list,
|
|
265522
266111
|
map: () => map,
|
|
265523
266112
|
op: () => op,
|
|
266113
|
+
operation: () => operation,
|
|
265524
266114
|
serializerMiddlewareOption: () => serializerMiddlewareOption2,
|
|
265525
266115
|
sim: () => sim,
|
|
265526
266116
|
simAdapter: () => simAdapter,
|
|
@@ -265534,6 +266124,7 @@ var init_schema = __esm({
|
|
|
265534
266124
|
init_ListSchema();
|
|
265535
266125
|
init_MapSchema();
|
|
265536
266126
|
init_OperationSchema();
|
|
266127
|
+
init_operation();
|
|
265537
266128
|
init_ErrorSchema();
|
|
265538
266129
|
init_NormalizedSchema();
|
|
265539
266130
|
init_Schema();
|
|
@@ -266900,7 +267491,6 @@ var init_EventStreamSerde = __esm({
|
|
|
266900
267491
|
const marshaller = this.marshaller;
|
|
266901
267492
|
const eventStreamMember = requestSchema.getEventStreamMember();
|
|
266902
267493
|
const unionSchema = requestSchema.getMemberSchema(eventStreamMember);
|
|
266903
|
-
const memberSchemas = unionSchema.getMemberSchemas();
|
|
266904
267494
|
const serializer = this.serializer;
|
|
266905
267495
|
const defaultContentType = this.defaultContentType;
|
|
266906
267496
|
const initialRequestMarker = Symbol("initialRequestMarker");
|
|
@@ -267011,7 +267601,7 @@ var init_EventStreamSerde = __esm({
|
|
|
267011
267601
|
let explicitPayloadContentType;
|
|
267012
267602
|
const isKnownSchema = (() => {
|
|
267013
267603
|
const struct2 = unionSchema.getSchema();
|
|
267014
|
-
return struct2.
|
|
267604
|
+
return struct2[4].includes(unionMember);
|
|
267015
267605
|
})();
|
|
267016
267606
|
const additionalHeaders = {};
|
|
267017
267607
|
if (!isKnownSchema) {
|
|
@@ -267145,10 +267735,10 @@ var init_HttpProtocol = __esm({
|
|
|
267145
267735
|
}
|
|
267146
267736
|
}
|
|
267147
267737
|
setHostPrefix(request, operationSchema, input) {
|
|
267148
|
-
const operationNs = NormalizedSchema.of(operationSchema);
|
|
267149
267738
|
const inputNs = NormalizedSchema.of(operationSchema.input);
|
|
267150
|
-
|
|
267151
|
-
|
|
267739
|
+
const opTraits = translateTraits(operationSchema.traits ?? {});
|
|
267740
|
+
if (opTraits.endpoint) {
|
|
267741
|
+
let hostPrefix = opTraits.endpoint?.[0];
|
|
267152
267742
|
if (typeof hostPrefix === "string") {
|
|
267153
267743
|
const hostLabelInputs = [...inputNs.structIterator()].filter(([, member2]) => member2.getMergedTraits().hostLabel);
|
|
267154
267744
|
for (const [name14] of hostLabelInputs) {
|
|
@@ -268427,20 +269017,24 @@ var require_dist_cjs20 = __commonJS({
|
|
|
268427
269017
|
if (typeof obj === "string") {
|
|
268428
269018
|
return evaluateTemplate(obj, options);
|
|
268429
269019
|
} else if (obj["fn"]) {
|
|
268430
|
-
return callFunction(obj, options);
|
|
269020
|
+
return group$2.callFunction(obj, options);
|
|
268431
269021
|
} else if (obj["ref"]) {
|
|
268432
269022
|
return getReferenceValue(obj, options);
|
|
268433
269023
|
}
|
|
268434
269024
|
throw new EndpointError(`'${keyName}': ${String(obj)} is not a string, function or reference.`);
|
|
268435
269025
|
};
|
|
268436
269026
|
var callFunction = ({ fn, argv }, options) => {
|
|
268437
|
-
const evaluatedArgs = argv.map((arg) => ["boolean", "number"].includes(typeof arg) ? arg : evaluateExpression(arg, "arg", options));
|
|
269027
|
+
const evaluatedArgs = argv.map((arg) => ["boolean", "number"].includes(typeof arg) ? arg : group$2.evaluateExpression(arg, "arg", options));
|
|
268438
269028
|
const fnSegments = fn.split(".");
|
|
268439
269029
|
if (fnSegments[0] in customEndpointFunctions3 && fnSegments[1] != null) {
|
|
268440
269030
|
return customEndpointFunctions3[fnSegments[0]][fnSegments[1]](...evaluatedArgs);
|
|
268441
269031
|
}
|
|
268442
269032
|
return endpointFunctions[fn](...evaluatedArgs);
|
|
268443
269033
|
};
|
|
269034
|
+
var group$2 = {
|
|
269035
|
+
evaluateExpression,
|
|
269036
|
+
callFunction
|
|
269037
|
+
};
|
|
268444
269038
|
var evaluateCondition = ({ assign: assign2, ...fnArgs }, options) => {
|
|
268445
269039
|
if (assign2 && assign2 in options.referenceRecord) {
|
|
268446
269040
|
throw new EndpointError(`'${assign2}' is already defined in Reference Record.`);
|
|
@@ -268482,6 +269076,10 @@ var require_dist_cjs20 = __commonJS({
|
|
|
268482
269076
|
return processedExpr;
|
|
268483
269077
|
})
|
|
268484
269078
|
}), {});
|
|
269079
|
+
var getEndpointProperties = (properties, options) => Object.entries(properties).reduce((acc, [propertyKey, propertyVal]) => ({
|
|
269080
|
+
...acc,
|
|
269081
|
+
[propertyKey]: group$1.getEndpointProperty(propertyVal, options)
|
|
269082
|
+
}), {});
|
|
268485
269083
|
var getEndpointProperty = (property2, options) => {
|
|
268486
269084
|
if (Array.isArray(property2)) {
|
|
268487
269085
|
return property2.map((propertyEntry) => getEndpointProperty(propertyEntry, options));
|
|
@@ -268493,17 +269091,17 @@ var require_dist_cjs20 = __commonJS({
|
|
|
268493
269091
|
if (property2 === null) {
|
|
268494
269092
|
throw new EndpointError(`Unexpected endpoint property: ${property2}`);
|
|
268495
269093
|
}
|
|
268496
|
-
return getEndpointProperties(property2, options);
|
|
269094
|
+
return group$1.getEndpointProperties(property2, options);
|
|
268497
269095
|
case "boolean":
|
|
268498
269096
|
return property2;
|
|
268499
269097
|
default:
|
|
268500
269098
|
throw new EndpointError(`Unexpected endpoint property type: ${typeof property2}`);
|
|
268501
269099
|
}
|
|
268502
269100
|
};
|
|
268503
|
-
var
|
|
268504
|
-
|
|
268505
|
-
|
|
268506
|
-
}
|
|
269101
|
+
var group$1 = {
|
|
269102
|
+
getEndpointProperty,
|
|
269103
|
+
getEndpointProperties
|
|
269104
|
+
};
|
|
268507
269105
|
var getEndpointUrl = (endpointUrl, options) => {
|
|
268508
269106
|
const expression = evaluateExpression(endpointUrl, "Endpoint URL", options);
|
|
268509
269107
|
if (typeof expression === "string") {
|
|
@@ -268549,17 +269147,6 @@ var require_dist_cjs20 = __commonJS({
|
|
|
268549
269147
|
referenceRecord: { ...options.referenceRecord, ...referenceRecord }
|
|
268550
269148
|
}));
|
|
268551
269149
|
};
|
|
268552
|
-
var evaluateTreeRule = (treeRule, options) => {
|
|
268553
|
-
const { conditions, rules } = treeRule;
|
|
268554
|
-
const { result, referenceRecord } = evaluateConditions(conditions, options);
|
|
268555
|
-
if (!result) {
|
|
268556
|
-
return;
|
|
268557
|
-
}
|
|
268558
|
-
return evaluateRules(rules, {
|
|
268559
|
-
...options,
|
|
268560
|
-
referenceRecord: { ...options.referenceRecord, ...referenceRecord }
|
|
268561
|
-
});
|
|
268562
|
-
};
|
|
268563
269150
|
var evaluateRules = (rules, options) => {
|
|
268564
269151
|
for (const rule of rules) {
|
|
268565
269152
|
if (rule.type === "endpoint") {
|
|
@@ -268570,7 +269157,7 @@ var require_dist_cjs20 = __commonJS({
|
|
|
268570
269157
|
} else if (rule.type === "error") {
|
|
268571
269158
|
evaluateErrorRule(rule, options);
|
|
268572
269159
|
} else if (rule.type === "tree") {
|
|
268573
|
-
const endpointOrUndefined = evaluateTreeRule(rule, options);
|
|
269160
|
+
const endpointOrUndefined = group.evaluateTreeRule(rule, options);
|
|
268574
269161
|
if (endpointOrUndefined) {
|
|
268575
269162
|
return endpointOrUndefined;
|
|
268576
269163
|
}
|
|
@@ -268580,6 +269167,21 @@ var require_dist_cjs20 = __commonJS({
|
|
|
268580
269167
|
}
|
|
268581
269168
|
throw new EndpointError(`Rules evaluation failed`);
|
|
268582
269169
|
};
|
|
269170
|
+
var evaluateTreeRule = (treeRule, options) => {
|
|
269171
|
+
const { conditions, rules } = treeRule;
|
|
269172
|
+
const { result, referenceRecord } = evaluateConditions(conditions, options);
|
|
269173
|
+
if (!result) {
|
|
269174
|
+
return;
|
|
269175
|
+
}
|
|
269176
|
+
return group.evaluateRules(rules, {
|
|
269177
|
+
...options,
|
|
269178
|
+
referenceRecord: { ...options.referenceRecord, ...referenceRecord }
|
|
269179
|
+
});
|
|
269180
|
+
};
|
|
269181
|
+
var group = {
|
|
269182
|
+
evaluateRules,
|
|
269183
|
+
evaluateTreeRule
|
|
269184
|
+
};
|
|
268583
269185
|
var resolveEndpoint3 = (ruleSetObject, options) => {
|
|
268584
269186
|
const { endpointParams, logger: logger2 } = options;
|
|
268585
269187
|
const { parameters, rules } = ruleSetObject;
|
|
@@ -271102,8 +271704,8 @@ var init_SmithyRpcV2CborProtocol = __esm({
|
|
|
271102
271704
|
} catch (e3) {
|
|
271103
271705
|
}
|
|
271104
271706
|
}
|
|
271105
|
-
const { service, operation } = (0, import_util_middleware5.getSmithyContext)(context3);
|
|
271106
|
-
const path7 = `/service/${service}/operation/${
|
|
271707
|
+
const { service, operation: operation2 } = (0, import_util_middleware5.getSmithyContext)(context3);
|
|
271708
|
+
const path7 = `/service/${service}/operation/${operation2}`;
|
|
271107
271709
|
if (request.path.endsWith("/")) {
|
|
271108
271710
|
request.path += path7.slice(1);
|
|
271109
271711
|
} else {
|
|
@@ -271808,10 +272410,10 @@ var require_dist_cjs27 = __commonJS({
|
|
|
271808
272410
|
this._middlewareFn = middlewareSupplier;
|
|
271809
272411
|
return this;
|
|
271810
272412
|
}
|
|
271811
|
-
s(service,
|
|
272413
|
+
s(service, operation2, smithyContext = {}) {
|
|
271812
272414
|
this._smithyContext = {
|
|
271813
272415
|
service,
|
|
271814
|
-
operation,
|
|
272416
|
+
operation: operation2,
|
|
271815
272417
|
...smithyContext
|
|
271816
272418
|
};
|
|
271817
272419
|
return this;
|
|
@@ -271838,9 +272440,9 @@ var require_dist_cjs27 = __commonJS({
|
|
|
271838
272440
|
this._deserializer = deserializer;
|
|
271839
272441
|
return this;
|
|
271840
272442
|
}
|
|
271841
|
-
sc(
|
|
271842
|
-
this._operationSchema =
|
|
271843
|
-
this._smithyContext.operationSchema =
|
|
272443
|
+
sc(operation2) {
|
|
272444
|
+
this._operationSchema = operation2;
|
|
272445
|
+
this._smithyContext.operationSchema = operation2;
|
|
271844
272446
|
return this;
|
|
271845
272447
|
}
|
|
271846
272448
|
build() {
|
|
@@ -272692,7 +273294,7 @@ var init_AwsJsonRpcProtocol = __esm({
|
|
|
272692
273294
|
}
|
|
272693
273295
|
Object.assign(request.headers, {
|
|
272694
273296
|
"content-type": `application/x-amz-json-${this.getJsonRpcVersion()}`,
|
|
272695
|
-
"x-amz-target": `${this.serviceTarget}.${
|
|
273297
|
+
"x-amz-target": `${this.serviceTarget}.${operationSchema.name}`
|
|
272696
273298
|
});
|
|
272697
273299
|
if (this.awsQueryCompatible) {
|
|
272698
273300
|
request.headers["x-amzn-query-mode"] = "true";
|
|
@@ -276815,6 +277417,7 @@ var require_dist_cjs42 = __commonJS({
|
|
|
276815
277417
|
var ENV_PROFILE = "AWS_PROFILE";
|
|
276816
277418
|
var DEFAULT_PROFILE = "default";
|
|
276817
277419
|
var getProfileName = (init) => init.profile || process.env[ENV_PROFILE] || DEFAULT_PROFILE;
|
|
277420
|
+
var CONFIG_PREFIX_SEPARATOR = ".";
|
|
276818
277421
|
var getConfigData = (data2) => Object.entries(data2).filter(([key]) => {
|
|
276819
277422
|
const indexOfSeparator = key.indexOf(CONFIG_PREFIX_SEPARATOR);
|
|
276820
277423
|
if (indexOfSeparator === -1) {
|
|
@@ -276881,7 +277484,6 @@ var require_dist_cjs42 = __commonJS({
|
|
|
276881
277484
|
return map4;
|
|
276882
277485
|
};
|
|
276883
277486
|
var swallowError$1 = () => ({});
|
|
276884
|
-
var CONFIG_PREFIX_SEPARATOR = ".";
|
|
276885
277487
|
var loadSharedConfigFiles = async (init = {}) => {
|
|
276886
277488
|
const { filepath = getCredentialsFilepath(), configFilepath = getConfigFilepath() } = init;
|
|
276887
277489
|
const homeDir = getHomeDir.getHomeDir();
|
|
@@ -278086,7 +278688,7 @@ var require_package = __commonJS({
|
|
|
278086
278688
|
module2.exports = {
|
|
278087
278689
|
name: "@aws-sdk/client-bedrock-runtime",
|
|
278088
278690
|
description: "AWS SDK for JavaScript Bedrock Runtime Client for Node.js, Browser and React Native",
|
|
278089
|
-
version: "3.
|
|
278691
|
+
version: "3.911.0",
|
|
278090
278692
|
scripts: {
|
|
278091
278693
|
build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
|
|
278092
278694
|
"build:cjs": "node ../../scripts/compilation/inline client-bedrock-runtime",
|
|
@@ -278105,21 +278707,21 @@ var require_package = __commonJS({
|
|
|
278105
278707
|
dependencies: {
|
|
278106
278708
|
"@aws-crypto/sha256-browser": "5.2.0",
|
|
278107
278709
|
"@aws-crypto/sha256-js": "5.2.0",
|
|
278108
|
-
"@aws-sdk/core": "3.
|
|
278109
|
-
"@aws-sdk/credential-provider-node": "3.
|
|
278710
|
+
"@aws-sdk/core": "3.911.0",
|
|
278711
|
+
"@aws-sdk/credential-provider-node": "3.911.0",
|
|
278110
278712
|
"@aws-sdk/eventstream-handler-node": "3.910.0",
|
|
278111
278713
|
"@aws-sdk/middleware-eventstream": "3.910.0",
|
|
278112
278714
|
"@aws-sdk/middleware-host-header": "3.910.0",
|
|
278113
278715
|
"@aws-sdk/middleware-logger": "3.910.0",
|
|
278114
278716
|
"@aws-sdk/middleware-recursion-detection": "3.910.0",
|
|
278115
|
-
"@aws-sdk/middleware-user-agent": "3.
|
|
278717
|
+
"@aws-sdk/middleware-user-agent": "3.911.0",
|
|
278116
278718
|
"@aws-sdk/middleware-websocket": "3.910.0",
|
|
278117
278719
|
"@aws-sdk/region-config-resolver": "3.910.0",
|
|
278118
|
-
"@aws-sdk/token-providers": "3.
|
|
278720
|
+
"@aws-sdk/token-providers": "3.911.0",
|
|
278119
278721
|
"@aws-sdk/types": "3.910.0",
|
|
278120
278722
|
"@aws-sdk/util-endpoints": "3.910.0",
|
|
278121
278723
|
"@aws-sdk/util-user-agent-browser": "3.910.0",
|
|
278122
|
-
"@aws-sdk/util-user-agent-node": "3.
|
|
278724
|
+
"@aws-sdk/util-user-agent-node": "3.911.0",
|
|
278123
278725
|
"@smithy/config-resolver": "^4.3.2",
|
|
278124
278726
|
"@smithy/core": "^3.16.1",
|
|
278125
278727
|
"@smithy/eventstream-serde-browser": "^4.2.2",
|
|
@@ -278867,7 +279469,7 @@ var init_package = __esm({
|
|
|
278867
279469
|
"node_modules/@aws-sdk/nested-clients/package.json"() {
|
|
278868
279470
|
package_default = {
|
|
278869
279471
|
name: "@aws-sdk/nested-clients",
|
|
278870
|
-
version: "3.
|
|
279472
|
+
version: "3.911.0",
|
|
278871
279473
|
description: "Nested clients for AWS SDK packages.",
|
|
278872
279474
|
main: "./dist-cjs/index.js",
|
|
278873
279475
|
module: "./dist-es/index.js",
|
|
@@ -278896,16 +279498,16 @@ var init_package = __esm({
|
|
|
278896
279498
|
dependencies: {
|
|
278897
279499
|
"@aws-crypto/sha256-browser": "5.2.0",
|
|
278898
279500
|
"@aws-crypto/sha256-js": "5.2.0",
|
|
278899
|
-
"@aws-sdk/core": "3.
|
|
279501
|
+
"@aws-sdk/core": "3.911.0",
|
|
278900
279502
|
"@aws-sdk/middleware-host-header": "3.910.0",
|
|
278901
279503
|
"@aws-sdk/middleware-logger": "3.910.0",
|
|
278902
279504
|
"@aws-sdk/middleware-recursion-detection": "3.910.0",
|
|
278903
|
-
"@aws-sdk/middleware-user-agent": "3.
|
|
279505
|
+
"@aws-sdk/middleware-user-agent": "3.911.0",
|
|
278904
279506
|
"@aws-sdk/region-config-resolver": "3.910.0",
|
|
278905
279507
|
"@aws-sdk/types": "3.910.0",
|
|
278906
279508
|
"@aws-sdk/util-endpoints": "3.910.0",
|
|
278907
279509
|
"@aws-sdk/util-user-agent-browser": "3.910.0",
|
|
278908
|
-
"@aws-sdk/util-user-agent-node": "3.
|
|
279510
|
+
"@aws-sdk/util-user-agent-node": "3.911.0",
|
|
278909
279511
|
"@smithy/config-resolver": "^4.3.2",
|
|
278910
279512
|
"@smithy/core": "^3.16.1",
|
|
278911
279513
|
"@smithy/fetch-http-handler": "^5.3.3",
|
|
@@ -280320,7 +280922,7 @@ var require_package2 = __commonJS({
|
|
|
280320
280922
|
module2.exports = {
|
|
280321
280923
|
name: "@aws-sdk/client-sso",
|
|
280322
280924
|
description: "AWS SDK for JavaScript Sso Client for Node.js, Browser and React Native",
|
|
280323
|
-
version: "3.
|
|
280925
|
+
version: "3.911.0",
|
|
280324
280926
|
scripts: {
|
|
280325
280927
|
build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
|
|
280326
280928
|
"build:cjs": "node ../../scripts/compilation/inline client-sso",
|
|
@@ -280339,16 +280941,16 @@ var require_package2 = __commonJS({
|
|
|
280339
280941
|
dependencies: {
|
|
280340
280942
|
"@aws-crypto/sha256-browser": "5.2.0",
|
|
280341
280943
|
"@aws-crypto/sha256-js": "5.2.0",
|
|
280342
|
-
"@aws-sdk/core": "3.
|
|
280944
|
+
"@aws-sdk/core": "3.911.0",
|
|
280343
280945
|
"@aws-sdk/middleware-host-header": "3.910.0",
|
|
280344
280946
|
"@aws-sdk/middleware-logger": "3.910.0",
|
|
280345
280947
|
"@aws-sdk/middleware-recursion-detection": "3.910.0",
|
|
280346
|
-
"@aws-sdk/middleware-user-agent": "3.
|
|
280948
|
+
"@aws-sdk/middleware-user-agent": "3.911.0",
|
|
280347
280949
|
"@aws-sdk/region-config-resolver": "3.910.0",
|
|
280348
280950
|
"@aws-sdk/types": "3.910.0",
|
|
280349
280951
|
"@aws-sdk/util-endpoints": "3.910.0",
|
|
280350
280952
|
"@aws-sdk/util-user-agent-browser": "3.910.0",
|
|
280351
|
-
"@aws-sdk/util-user-agent-node": "3.
|
|
280953
|
+
"@aws-sdk/util-user-agent-node": "3.911.0",
|
|
280352
280954
|
"@smithy/config-resolver": "^4.3.2",
|
|
280353
280955
|
"@smithy/core": "^3.16.1",
|
|
280354
280956
|
"@smithy/fetch-http-handler": "^5.3.3",
|
|
@@ -360182,7 +360784,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"assert":true,"node:assert":[">= 14.1
|
|
|
360182
360784
|
/***/ ((module) => {
|
|
360183
360785
|
|
|
360184
360786
|
"use strict";
|
|
360185
|
-
module.exports = {"rE":"0.1.
|
|
360787
|
+
module.exports = {"rE":"0.1.95"};
|
|
360186
360788
|
|
|
360187
360789
|
/***/ })
|
|
360188
360790
|
|