@moda-ai/cli 1.55.12 → 1.55.13
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/dist/cli.js +21 -8
- package/package.json +1 -1
- package/skills/integration/index.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -3288,6 +3288,25 @@ function searchDegradeWarning(reason, requestedMode, coverage) {
|
|
|
3288
3288
|
return `${lead} the requested ${requestedMode} ranking did not run, and ${notComparable}. Use --mode=keyword with exact identifiers.`;
|
|
3289
3289
|
}
|
|
3290
3290
|
}
|
|
3291
|
+
function searchOutcomeWarnings(record, requestedFlag, query2) {
|
|
3292
|
+
const warnings = [];
|
|
3293
|
+
const requested = asString(record.requested_mode) ?? requestedFlag ?? "hybrid";
|
|
3294
|
+
const actual = asString(record.search_mode);
|
|
3295
|
+
const degradeReason = asString(record.degrade_reason);
|
|
3296
|
+
const degraded = record.degraded === true || actual !== undefined && actual !== requested;
|
|
3297
|
+
if (degradeReason && degradeReason !== "none") {
|
|
3298
|
+
warnings.push(searchDegradeWarning(degradeReason, requested, record.coverage));
|
|
3299
|
+
} else if (degraded && actual) {
|
|
3300
|
+
warnings.push(`Search ran in ${actual} mode instead of the requested ${requested} mode.`);
|
|
3301
|
+
}
|
|
3302
|
+
if (asString(record.zero_result_reason) === "no_keyword_match") {
|
|
3303
|
+
const match = asRecord(asRecord(record.coverage)?.keyword_match);
|
|
3304
|
+
const minTerms = asNumber(match?.min_terms) ?? undefined;
|
|
3305
|
+
const dropped = asNumber(match?.dropped_non_matching) ?? 0;
|
|
3306
|
+
warnings.push(`No message in this window contains "${query2}"` + (minTerms !== undefined ? ` or at least ${minTerms} of its significant terms` : "") + ` (case-insensitive substring match${degraded ? `, served as keyword because the ${requested} ranking did not run` : ""}).` + (dropped > 0 ? ` ${dropped} index neighbour(s) that only shared a word were not returned.` : "") + " Retry with a shorter exact phrase or identifier, widen --time-range, add --include-tool-io for tool calls/results, or rephrase.");
|
|
3307
|
+
}
|
|
3308
|
+
return warnings;
|
|
3309
|
+
}
|
|
3291
3310
|
function searchCoverageWarnings(coverage, timeRange) {
|
|
3292
3311
|
const record = asRecord(coverage);
|
|
3293
3312
|
if (!record)
|
|
@@ -3893,14 +3912,7 @@ async function runCommand(command, positional, flags, positionals = positional ?
|
|
|
3893
3912
|
const data = await callDataAPI(`/search?${query2.toString()}`);
|
|
3894
3913
|
recordSearchTelemetry(context, data);
|
|
3895
3914
|
const searchRecord = asRecord(data) ?? {};
|
|
3896
|
-
const
|
|
3897
|
-
const actualMode = asString(searchRecord.search_mode);
|
|
3898
|
-
const warnings = [];
|
|
3899
|
-
if (degradeReason && degradeReason !== "none") {
|
|
3900
|
-
warnings.push(searchDegradeWarning(degradeReason, params.mode ?? "hybrid", searchRecord.coverage));
|
|
3901
|
-
} else if (params.mode && actualMode && actualMode !== params.mode && params.mode !== "hybrid") {
|
|
3902
|
-
warnings.push(`Search ran in ${actualMode} mode instead of the requested ${params.mode} mode.`);
|
|
3903
|
-
}
|
|
3915
|
+
const warnings = searchOutcomeWarnings(searchRecord, params.mode, params.q);
|
|
3904
3916
|
warnings.push(...searchCoverageWarnings(searchRecord.coverage, params.time_range ?? "all"));
|
|
3905
3917
|
const results = Array.isArray(searchRecord.results) ? searchRecord.results : [];
|
|
3906
3918
|
if (results.length > 0 && (params.offset ?? 0) > 0) {
|
|
@@ -6052,6 +6064,7 @@ if (isMain) {
|
|
|
6052
6064
|
export {
|
|
6053
6065
|
telemetryCommandName,
|
|
6054
6066
|
stripLoneSurrogates,
|
|
6067
|
+
searchOutcomeWarnings,
|
|
6055
6068
|
searchDegradeWarning,
|
|
6056
6069
|
searchCoverageWarnings,
|
|
6057
6070
|
runCommand,
|
package/package.json
CHANGED