deepline 0.1.163 → 0.1.165
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/bundling-sources/apps/play-runner-workers/src/entry.ts +13 -0
- package/dist/bundling-sources/apps/play-runner-workers/src/runtime/map-chunk-plan.ts +302 -119
- package/dist/bundling-sources/sdk/src/release.ts +2 -2
- package/dist/bundling-sources/sdk/src/types.ts +9 -0
- package/dist/cli/index.js +213 -22
- package/dist/cli/index.mjs +213 -22
- package/dist/index.d.mts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -622,10 +622,10 @@ var SDK_RELEASE = {
|
|
|
622
622
|
// 0.1.111 ships dataset-native tool list getters and result row datasets.
|
|
623
623
|
// 0.1.154 removes the short-lived generated enrich StepOptions recompute
|
|
624
624
|
// fields shipped in 0.1.153.
|
|
625
|
-
version: "0.1.
|
|
625
|
+
version: "0.1.165",
|
|
626
626
|
apiContract: "2026-06-dataset-handle-results-hard-cutover",
|
|
627
627
|
supportPolicy: {
|
|
628
|
-
latest: "0.1.
|
|
628
|
+
latest: "0.1.165",
|
|
629
629
|
minimumSupported: "0.1.53",
|
|
630
630
|
deprecatedBelow: "0.1.53",
|
|
631
631
|
commandMinimumSupported: [
|
|
@@ -5421,6 +5421,7 @@ async function handleUsage(options) {
|
|
|
5421
5421
|
const params = new URLSearchParams();
|
|
5422
5422
|
if (options.limit) params.set("recent_limit", options.limit);
|
|
5423
5423
|
if (options.offset) params.set("recent_offset", options.offset);
|
|
5424
|
+
if (options.runId) params.set("run_id", options.runId);
|
|
5424
5425
|
const suffix = Array.from(params).length > 0 ? `?${params.toString()}` : "";
|
|
5425
5426
|
const payload = await http.get(
|
|
5426
5427
|
`/api/v2/billing/usage${suffix}`
|
|
@@ -5973,8 +5974,9 @@ Notes:
|
|
|
5973
5974
|
Examples:
|
|
5974
5975
|
deepline billing usage
|
|
5975
5976
|
deepline billing usage --limit 50 --offset 50 --json
|
|
5977
|
+
deepline billing usage --run-id play/example/run/20260630t120000-000-abcdef --json
|
|
5976
5978
|
`
|
|
5977
|
-
).option("--limit <n>", "Recent-call page size").option("--offset <n>", "Recent-call offset").option("--json", "Emit JSON output. Also automatic when stdout is piped").action(handleUsage);
|
|
5979
|
+
).option("--limit <n>", "Recent-call page size").option("--offset <n>", "Recent-call offset").option("--run-id <run_id>", "Show recent usage for one play run").option("--json", "Emit JSON output. Also automatic when stdout is piped").action(handleUsage);
|
|
5978
5980
|
billing.command("limit").description("Show configured monthly limit state.").addHelpText(
|
|
5979
5981
|
"after",
|
|
5980
5982
|
`
|
|
@@ -16830,6 +16832,8 @@ var ENRICH_EXPORT_BACKING_ROWS_WAIT_MS = 6e4;
|
|
|
16830
16832
|
var ENRICH_EXPORT_BACKING_ROWS_POLL_MS = 1e3;
|
|
16831
16833
|
var ENRICH_SOURCE_ROW_INDEX_COLUMN = "__deeplineSourceRowIndex";
|
|
16832
16834
|
var ENRICH_ORIGINAL_SOURCE_ROW_INDEX_COLUMN = "__deeplineOriginalSourceRowIndex";
|
|
16835
|
+
var ENRICH_CELL_META_FIELD = "__deeplineCellMeta";
|
|
16836
|
+
var ENRICH_CELL_META_PATCH_FIELD = "__deeplineCellMetaPatch";
|
|
16833
16837
|
var EXIT_SERVER2 = 5;
|
|
16834
16838
|
var ENRICH_DEBUG_T0 = Date.now();
|
|
16835
16839
|
var GENERATED_ENRICH_ROWS_TABLE_NAMESPACE = "deepline_enrich_rows";
|
|
@@ -17902,6 +17906,18 @@ function exportableSheetRow2(row, sourceRowStart = 0) {
|
|
|
17902
17906
|
const data = record.data;
|
|
17903
17907
|
if (data && typeof data === "object" && !Array.isArray(data)) {
|
|
17904
17908
|
const exported = { ...data };
|
|
17909
|
+
applyFailureCellMeta(exported, exported[ENRICH_CELL_META_FIELD], {
|
|
17910
|
+
rowError: record.error
|
|
17911
|
+
});
|
|
17912
|
+
applyFailureCellMeta(exported, record.cellMeta, { rowError: record.error });
|
|
17913
|
+
applyFailureCellMeta(exported, record.cellMetaPatch, {
|
|
17914
|
+
rowError: record.error
|
|
17915
|
+
});
|
|
17916
|
+
applyFailureCellMeta(exported, record[ENRICH_CELL_META_PATCH_FIELD], {
|
|
17917
|
+
rowError: record.error
|
|
17918
|
+
});
|
|
17919
|
+
delete exported[ENRICH_CELL_META_FIELD];
|
|
17920
|
+
delete exported[ENRICH_CELL_META_PATCH_FIELD];
|
|
17905
17921
|
const inputIndex = typeof record.inputIndex === "number" ? record.inputIndex : typeof record.inputIndex === "string" && record.inputIndex.trim() ? Number(record.inputIndex) : Number.NaN;
|
|
17906
17922
|
if (Number.isInteger(inputIndex) && inputIndex >= 0) {
|
|
17907
17923
|
if (ENRICH_SOURCE_ROW_INDEX_COLUMN in exported) {
|
|
@@ -17912,6 +17928,18 @@ function exportableSheetRow2(row, sourceRowStart = 0) {
|
|
|
17912
17928
|
return exported;
|
|
17913
17929
|
}
|
|
17914
17930
|
const fallback = { ...record };
|
|
17931
|
+
applyFailureCellMeta(fallback, fallback[ENRICH_CELL_META_FIELD], {
|
|
17932
|
+
rowError: record.error
|
|
17933
|
+
});
|
|
17934
|
+
applyFailureCellMeta(fallback, record.cellMeta, {
|
|
17935
|
+
rowError: record.error
|
|
17936
|
+
});
|
|
17937
|
+
applyFailureCellMeta(fallback, record.cellMetaPatch, {
|
|
17938
|
+
rowError: record.error
|
|
17939
|
+
});
|
|
17940
|
+
applyFailureCellMeta(fallback, fallback[ENRICH_CELL_META_PATCH_FIELD], {
|
|
17941
|
+
rowError: record.error
|
|
17942
|
+
});
|
|
17915
17943
|
for (const key of [
|
|
17916
17944
|
"key",
|
|
17917
17945
|
"status",
|
|
@@ -17919,6 +17947,8 @@ function exportableSheetRow2(row, sourceRowStart = 0) {
|
|
|
17919
17947
|
"inputIndex",
|
|
17920
17948
|
"runId",
|
|
17921
17949
|
"error",
|
|
17950
|
+
ENRICH_CELL_META_FIELD,
|
|
17951
|
+
ENRICH_CELL_META_PATCH_FIELD,
|
|
17922
17952
|
"stage",
|
|
17923
17953
|
"provider",
|
|
17924
17954
|
"seq",
|
|
@@ -17929,6 +17959,45 @@ function exportableSheetRow2(row, sourceRowStart = 0) {
|
|
|
17929
17959
|
}
|
|
17930
17960
|
return fallback;
|
|
17931
17961
|
}
|
|
17962
|
+
function failureCellFromMeta(meta, fallback) {
|
|
17963
|
+
if (!isRecord7(meta)) {
|
|
17964
|
+
return null;
|
|
17965
|
+
}
|
|
17966
|
+
const status = typeof meta.status === "string" ? meta.status.trim().toLowerCase() : "";
|
|
17967
|
+
const hasFailureStatus = status === "failed" || status === "error";
|
|
17968
|
+
const explicitError = typeof meta.error === "string" && meta.error.trim() ? meta.error.trim() : typeof meta.last_error === "string" && meta.last_error.trim() ? meta.last_error.trim() : typeof meta.message === "string" && meta.message.trim() ? meta.message.trim() : "";
|
|
17969
|
+
if (!hasFailureStatus && !explicitError) {
|
|
17970
|
+
return null;
|
|
17971
|
+
}
|
|
17972
|
+
const fallbackError = hasFailureStatus && typeof fallback.rowError === "string" && fallback.rowError.trim() ? fallback.rowError.trim() : "";
|
|
17973
|
+
const error = explicitError || fallbackError;
|
|
17974
|
+
const message = error || `Column status: ${status || "failed"}`;
|
|
17975
|
+
return {
|
|
17976
|
+
status: status || "failed",
|
|
17977
|
+
error: message,
|
|
17978
|
+
...typeof meta.operation === "string" && meta.operation.trim() ? { operation: meta.operation.trim() } : {},
|
|
17979
|
+
...typeof meta.provider === "string" && meta.provider.trim() ? { provider: meta.provider.trim() } : {}
|
|
17980
|
+
};
|
|
17981
|
+
}
|
|
17982
|
+
function applyFailureCellMeta(row, cellMeta, fallback) {
|
|
17983
|
+
if (!isRecord7(cellMeta)) {
|
|
17984
|
+
return;
|
|
17985
|
+
}
|
|
17986
|
+
for (const [field, meta] of Object.entries(cellMeta)) {
|
|
17987
|
+
if (!field || field.startsWith("__")) {
|
|
17988
|
+
continue;
|
|
17989
|
+
}
|
|
17990
|
+
const failure = failureCellFromMeta(meta, fallback);
|
|
17991
|
+
if (!failure) {
|
|
17992
|
+
continue;
|
|
17993
|
+
}
|
|
17994
|
+
const existing = row[field];
|
|
17995
|
+
if (isNonEmptyCsvCell(existing) && !cellFailureError(existing)) {
|
|
17996
|
+
continue;
|
|
17997
|
+
}
|
|
17998
|
+
row[field] = failure;
|
|
17999
|
+
}
|
|
18000
|
+
}
|
|
17932
18001
|
function mergeExportedSheetRow(target, next) {
|
|
17933
18002
|
const baseMetadata = target._metadata;
|
|
17934
18003
|
const nextMetadata = next._metadata;
|
|
@@ -17990,7 +18059,7 @@ function stripEnrichSourceRowIndex(row) {
|
|
|
17990
18059
|
}
|
|
17991
18060
|
return stripped;
|
|
17992
18061
|
}
|
|
17993
|
-
function
|
|
18062
|
+
function collectHardFailureAliasSpecs(config) {
|
|
17994
18063
|
const aliases = [];
|
|
17995
18064
|
const seen = /* @__PURE__ */ new Set();
|
|
17996
18065
|
for (const command of config.commands) {
|
|
@@ -18005,10 +18074,25 @@ function collectHardFailureAliases(config) {
|
|
|
18005
18074
|
continue;
|
|
18006
18075
|
}
|
|
18007
18076
|
seen.add(alias);
|
|
18008
|
-
aliases.push(
|
|
18077
|
+
aliases.push({
|
|
18078
|
+
alias,
|
|
18079
|
+
operation: command.operation?.trim() || command.tool.trim() || void 0
|
|
18080
|
+
});
|
|
18009
18081
|
}
|
|
18010
18082
|
return aliases;
|
|
18011
18083
|
}
|
|
18084
|
+
function hardFailureOperationByAlias(config) {
|
|
18085
|
+
const operations = /* @__PURE__ */ new Map();
|
|
18086
|
+
if (!config) {
|
|
18087
|
+
return operations;
|
|
18088
|
+
}
|
|
18089
|
+
for (const spec of collectHardFailureAliasSpecs(config)) {
|
|
18090
|
+
if (spec.operation) {
|
|
18091
|
+
operations.set(normalizeAlias2(spec.alias), spec.operation);
|
|
18092
|
+
}
|
|
18093
|
+
}
|
|
18094
|
+
return operations;
|
|
18095
|
+
}
|
|
18012
18096
|
function cellFailureError(value) {
|
|
18013
18097
|
const parsed = parseMaybeJsonObject(value);
|
|
18014
18098
|
if (!isRecord7(parsed)) {
|
|
@@ -18118,14 +18202,15 @@ function aliasFlattenedCells(row, alias) {
|
|
|
18118
18202
|
return cells;
|
|
18119
18203
|
}
|
|
18120
18204
|
function collectEnrichFailureJobs(input2) {
|
|
18121
|
-
const aliases =
|
|
18205
|
+
const aliases = collectHardFailureAliasSpecs(input2.config);
|
|
18122
18206
|
if (aliases.length === 0 || input2.rows.length === 0) {
|
|
18123
18207
|
return [];
|
|
18124
18208
|
}
|
|
18125
18209
|
const rowOffset = input2.rowStart ?? 0;
|
|
18126
18210
|
const jobs = [];
|
|
18127
18211
|
input2.rows.forEach((row, rowIndex) => {
|
|
18128
|
-
aliases.forEach((
|
|
18212
|
+
aliases.forEach((spec, aliasIndex) => {
|
|
18213
|
+
const { alias } = spec;
|
|
18129
18214
|
const failure = aliasFailureCellCandidates(row, alias).map(cellFailureError).find(
|
|
18130
18215
|
(candidate) => Boolean(candidate)
|
|
18131
18216
|
);
|
|
@@ -18133,15 +18218,20 @@ function collectEnrichFailureJobs(input2) {
|
|
|
18133
18218
|
return;
|
|
18134
18219
|
}
|
|
18135
18220
|
const rowId = sourceRowIndexFromEnrichRow(row, 0, Number.MAX_SAFE_INTEGER) ?? rowOffset + rowIndex;
|
|
18221
|
+
const operation = failure.operation ?? spec.operation;
|
|
18222
|
+
const message = enrichFailureMessageWithOperation(
|
|
18223
|
+
failure.message,
|
|
18224
|
+
operation
|
|
18225
|
+
);
|
|
18136
18226
|
jobs.push({
|
|
18137
18227
|
job_id: `row-${rowId}-${alias}`,
|
|
18138
18228
|
row_id: rowId,
|
|
18139
18229
|
col_index: aliasIndex,
|
|
18140
18230
|
column: alias,
|
|
18141
18231
|
status: "failed",
|
|
18142
|
-
last_error:
|
|
18143
|
-
error:
|
|
18144
|
-
...
|
|
18232
|
+
last_error: message,
|
|
18233
|
+
error: message,
|
|
18234
|
+
...operation ? { operation } : {},
|
|
18145
18235
|
...failure.provider ? { provider: failure.provider } : {}
|
|
18146
18236
|
});
|
|
18147
18237
|
});
|
|
@@ -18149,7 +18239,7 @@ function collectEnrichFailureJobs(input2) {
|
|
|
18149
18239
|
return jobs;
|
|
18150
18240
|
}
|
|
18151
18241
|
function collectStatusFailureJobs(input2) {
|
|
18152
|
-
const aliases =
|
|
18242
|
+
const aliases = collectHardFailureAliasSpecs(input2.config);
|
|
18153
18243
|
if (aliases.length === 0) {
|
|
18154
18244
|
return [];
|
|
18155
18245
|
}
|
|
@@ -18157,7 +18247,8 @@ function collectStatusFailureJobs(input2) {
|
|
|
18157
18247
|
const rowStart = input2.rowRange.rowStart ?? 0;
|
|
18158
18248
|
const selectedRows = input2.rowRange.rowEnd !== null && input2.rowRange.rowEnd >= rowStart ? input2.rowRange.rowEnd - rowStart + 1 : Number.MAX_SAFE_INTEGER;
|
|
18159
18249
|
const jobs = [];
|
|
18160
|
-
aliases.forEach((
|
|
18250
|
+
aliases.forEach((spec, aliasIndex) => {
|
|
18251
|
+
const { alias } = spec;
|
|
18161
18252
|
const stat2 = summaries.map((summary) => summary[alias]).find(isRecord7);
|
|
18162
18253
|
if (!stat2) {
|
|
18163
18254
|
return;
|
|
@@ -18174,7 +18265,12 @@ function collectStatusFailureJobs(input2) {
|
|
|
18174
18265
|
if (!Number.isFinite(failedCount) || failedCount <= 0) {
|
|
18175
18266
|
return;
|
|
18176
18267
|
}
|
|
18177
|
-
const message =
|
|
18268
|
+
const message = statusFailureMessage({
|
|
18269
|
+
stat: stat2,
|
|
18270
|
+
alias,
|
|
18271
|
+
failedCount,
|
|
18272
|
+
operation: spec.operation
|
|
18273
|
+
});
|
|
18178
18274
|
for (let offset = 0; offset < failedCount; offset += 1) {
|
|
18179
18275
|
const rowId = rowStart + offset;
|
|
18180
18276
|
jobs.push({
|
|
@@ -18190,6 +18286,26 @@ function collectStatusFailureJobs(input2) {
|
|
|
18190
18286
|
});
|
|
18191
18287
|
return jobs;
|
|
18192
18288
|
}
|
|
18289
|
+
function statusFailureMessage(input2) {
|
|
18290
|
+
const raw = firstCollectedStringField(input2.stat, "error") ?? firstCollectedStringField(input2.stat, "message");
|
|
18291
|
+
if (!raw) {
|
|
18292
|
+
return `Column ${input2.alias} failed for ${input2.failedCount} row(s).`;
|
|
18293
|
+
}
|
|
18294
|
+
return enrichFailureMessageWithOperation(raw, input2.operation);
|
|
18295
|
+
}
|
|
18296
|
+
function enrichFailureMessageWithOperation(message, operation) {
|
|
18297
|
+
const raw = message.trim();
|
|
18298
|
+
const marker = operation?.trim();
|
|
18299
|
+
if (!marker || raw.includes(marker)) {
|
|
18300
|
+
return raw;
|
|
18301
|
+
}
|
|
18302
|
+
if (/^(?:[A-Za-z0-9_:-]+:\s*)?(?:Error|TypeError|ReferenceError|SyntaxError|RangeError):\s+/.test(
|
|
18303
|
+
raw
|
|
18304
|
+
)) {
|
|
18305
|
+
return `${marker}: ${raw}`;
|
|
18306
|
+
}
|
|
18307
|
+
return `${marker}: Error: ${raw}`;
|
|
18308
|
+
}
|
|
18193
18309
|
function collectCompleteStatusFailureMessages(input2) {
|
|
18194
18310
|
const requiredCount = Math.max(1, Math.trunc(input2.rowCount));
|
|
18195
18311
|
const jobs = collectStatusFailureJobs({
|
|
@@ -18756,6 +18872,7 @@ function materializeAliasSuccessCell(row, alias) {
|
|
|
18756
18872
|
}
|
|
18757
18873
|
function normalizeEnrichRowsForCsvExport(rows, config, options) {
|
|
18758
18874
|
const aliases = config ? collectConfigScalarAliasOrder(config) : [];
|
|
18875
|
+
const failureOperationByAlias = hardFailureOperationByAlias(config);
|
|
18759
18876
|
return rows.map((row) => {
|
|
18760
18877
|
const metadata = legacyMetadataFromRow(row);
|
|
18761
18878
|
const normalized = metadata ? { ...row, _metadata: metadata } : { ...row };
|
|
@@ -18790,7 +18907,10 @@ function normalizeEnrichRowsForCsvExport(rows, config, options) {
|
|
|
18790
18907
|
(candidate) => Boolean(candidate)
|
|
18791
18908
|
);
|
|
18792
18909
|
if (failure) {
|
|
18793
|
-
normalized[alias] =
|
|
18910
|
+
normalized[alias] = enrichFailureMessageWithOperation(
|
|
18911
|
+
failure.message,
|
|
18912
|
+
failure.operation ?? failureOperationByAlias.get(normalizeAlias2(alias))
|
|
18913
|
+
);
|
|
18794
18914
|
}
|
|
18795
18915
|
}
|
|
18796
18916
|
for (const alias of aliases) {
|
|
@@ -18799,21 +18919,24 @@ function normalizeEnrichRowsForCsvExport(rows, config, options) {
|
|
|
18799
18919
|
normalized[alias] = value;
|
|
18800
18920
|
continue;
|
|
18801
18921
|
}
|
|
18802
|
-
if (isNonEmptyCsvCell(normalized[alias])) {
|
|
18803
|
-
continue;
|
|
18804
|
-
}
|
|
18805
18922
|
const failure = aliasFailureCellCandidates(normalized, alias).map(cellFailureError).find(
|
|
18806
18923
|
(candidate) => Boolean(candidate)
|
|
18807
18924
|
);
|
|
18808
18925
|
if (failure) {
|
|
18809
|
-
normalized[alias] =
|
|
18926
|
+
normalized[alias] = enrichFailureMessageWithOperation(
|
|
18927
|
+
failure.message,
|
|
18928
|
+
failure.operation ?? failureOperationByAlias.get(normalizeAlias2(alias))
|
|
18929
|
+
);
|
|
18930
|
+
continue;
|
|
18931
|
+
}
|
|
18932
|
+
if (isNonEmptyCsvCell(normalized[alias])) {
|
|
18810
18933
|
continue;
|
|
18811
18934
|
}
|
|
18812
|
-
const
|
|
18935
|
+
const statusFailureMessage2 = options?.statusFailureMessages?.get(
|
|
18813
18936
|
normalizeAlias2(alias)
|
|
18814
18937
|
);
|
|
18815
|
-
if (
|
|
18816
|
-
normalized[alias] =
|
|
18938
|
+
if (statusFailureMessage2) {
|
|
18939
|
+
normalized[alias] = statusFailureMessage2;
|
|
18817
18940
|
}
|
|
18818
18941
|
}
|
|
18819
18942
|
return normalized;
|
|
@@ -21916,6 +22039,63 @@ function matchesGrepQuery(value, query, mode) {
|
|
|
21916
22039
|
if (mode === "any") return terms.some((term) => haystack.includes(term));
|
|
21917
22040
|
return terms.every((term) => haystack.includes(term));
|
|
21918
22041
|
}
|
|
22042
|
+
function shellCommandArg(value) {
|
|
22043
|
+
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
22044
|
+
}
|
|
22045
|
+
function zeroMatchToolGuidance(options) {
|
|
22046
|
+
const categories = options.categories ?? [];
|
|
22047
|
+
const query = options.query?.trim() ?? "";
|
|
22048
|
+
const filterText = [
|
|
22049
|
+
categories.length ? `categories=${categories.join(",")}` : null,
|
|
22050
|
+
query ? `grep=${query}` : null,
|
|
22051
|
+
query ? `grep_mode=${options.mode ?? "all"}` : null
|
|
22052
|
+
].filter(Boolean).join(" ");
|
|
22053
|
+
const suggestions = [
|
|
22054
|
+
...query ? [
|
|
22055
|
+
{
|
|
22056
|
+
label: "Use ranked semantic search for intent-style queries",
|
|
22057
|
+
command: `deepline tools search -- ${shellCommandArg(query)}`
|
|
22058
|
+
},
|
|
22059
|
+
...options.mode === "all" ? [
|
|
22060
|
+
{
|
|
22061
|
+
label: "Relax literal grep from AND to OR matching",
|
|
22062
|
+
command: `deepline tools grep --mode any -- ${shellCommandArg(query)}`
|
|
22063
|
+
}
|
|
22064
|
+
] : []
|
|
22065
|
+
] : [],
|
|
22066
|
+
{
|
|
22067
|
+
label: "List the current atomic tool catalog",
|
|
22068
|
+
command: "deepline tools list --json"
|
|
22069
|
+
},
|
|
22070
|
+
...query ? [
|
|
22071
|
+
{
|
|
22072
|
+
label: "Search composed Deepline plays separately",
|
|
22073
|
+
command: `deepline plays search -- ${shellCommandArg(query)}`
|
|
22074
|
+
}
|
|
22075
|
+
] : []
|
|
22076
|
+
];
|
|
22077
|
+
return {
|
|
22078
|
+
reason: "filters_matched_no_atomic_tools",
|
|
22079
|
+
message: `The tools catalog responded successfully, but no atomic provider tools matched ${filterText || "the current filters"}. This is a zero-match filter result, not a registry outage.`,
|
|
22080
|
+
suggestions
|
|
22081
|
+
};
|
|
22082
|
+
}
|
|
22083
|
+
function zeroMatchRender(emptyResult) {
|
|
22084
|
+
return {
|
|
22085
|
+
sections: [
|
|
22086
|
+
{
|
|
22087
|
+
title: "0 tools available:",
|
|
22088
|
+
lines: [emptyResult.message]
|
|
22089
|
+
},
|
|
22090
|
+
{
|
|
22091
|
+
title: "suggestions",
|
|
22092
|
+
lines: emptyResult.suggestions.map(
|
|
22093
|
+
(suggestion) => `${suggestion.label}: ${suggestion.command}`
|
|
22094
|
+
)
|
|
22095
|
+
}
|
|
22096
|
+
]
|
|
22097
|
+
};
|
|
22098
|
+
}
|
|
21919
22099
|
async function listTools(args) {
|
|
21920
22100
|
const client2 = new DeeplineClient();
|
|
21921
22101
|
const categoryArgIndex = args.findIndex((arg) => arg === "--categories");
|
|
@@ -21930,8 +22110,9 @@ async function listTools(args) {
|
|
|
21930
22110
|
(category) => item.categories.includes(category)
|
|
21931
22111
|
)
|
|
21932
22112
|
);
|
|
22113
|
+
const emptyResult = items.length === 0 && requestedCategories.length > 0 ? zeroMatchToolGuidance({ categories: requestedCategories }) : null;
|
|
21933
22114
|
const render = {
|
|
21934
|
-
sections: [
|
|
22115
|
+
sections: emptyResult ? zeroMatchRender(emptyResult).sections : [
|
|
21935
22116
|
{
|
|
21936
22117
|
title: `${items.length} tools available:`,
|
|
21937
22118
|
lines: items.map((item) => {
|
|
@@ -21953,6 +22134,7 @@ async function listTools(args) {
|
|
|
21953
22134
|
{
|
|
21954
22135
|
tools: outputItems,
|
|
21955
22136
|
count: outputItems.length,
|
|
22137
|
+
...emptyResult ? { emptyResult } : {},
|
|
21956
22138
|
filters: {
|
|
21957
22139
|
categories: requestedCategories
|
|
21958
22140
|
},
|
|
@@ -22024,6 +22206,11 @@ async function grepTools(queryInput, options = {}) {
|
|
|
22024
22206
|
);
|
|
22025
22207
|
const shouldCompact = options.compact || !options.json;
|
|
22026
22208
|
const outputTools = shouldCompact ? tools.slice(0, 8).map(compactTool) : tools;
|
|
22209
|
+
const emptyResult = tools.length === 0 ? zeroMatchToolGuidance({
|
|
22210
|
+
categories: requestedCategories,
|
|
22211
|
+
query,
|
|
22212
|
+
mode
|
|
22213
|
+
}) : null;
|
|
22027
22214
|
printCommandEnvelope(
|
|
22028
22215
|
{
|
|
22029
22216
|
tools: outputTools,
|
|
@@ -22036,6 +22223,10 @@ async function grepTools(queryInput, options = {}) {
|
|
|
22036
22223
|
filters: {
|
|
22037
22224
|
categories: requestedCategories
|
|
22038
22225
|
},
|
|
22226
|
+
...emptyResult ? {
|
|
22227
|
+
emptyResult,
|
|
22228
|
+
render: zeroMatchRender(emptyResult)
|
|
22229
|
+
} : {},
|
|
22039
22230
|
commandTemplates: TOOL_COMMAND_TEMPLATES
|
|
22040
22231
|
},
|
|
22041
22232
|
{ json: options.json || shouldEmitJson() }
|