@xiaoso/dsh-tool-plus 0.1.8-beta.3 → 0.1.8
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.en.md +4 -7
- package/README.md +123 -126
- package/lib/client.js +461 -151
- package/lib/index.mjs +12 -12
- package/lib/{scrapers-DU4u4-Co.mjs → scrapers-D1uU6YiZ.mjs} +1 -1
- package/lib/types/client/ToolPlusSection.d.ts +3 -2
- package/lib/types/client/locales.d.ts +1 -1
- package/lib/types/config/fields.d.ts +1 -1
- package/lib/types/web/client/ToolCardShell.d.ts +15 -5
- package/lib/types/web/client/labels.d.ts +1 -1
- package/lib/types/web/client/row-utils.d.ts +28 -8
- package/lib/types/web/client/rows/card-leading.d.ts +37 -0
- package/lib/types/web/client/rows/fallback-card-facts.d.ts +52 -0
- package/lib/{utils-C-Lo_JC6.mjs → utils-CdLvJy_P.mjs} +1 -1
- package/package.json +151 -151
- package/presets/package.json +1 -1
package/lib/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ __installBunShim();
|
|
|
3
3
|
import { n as fs_promises_shim_exports, t as exists } from "./fs-promises-shim-Bx0fpxuk.mjs";
|
|
4
4
|
import { i as setRuntimeLogger, n as systemChromiumCandidatesForTest, r as runtimeLogger } from "./launch-Uq7920ng.mjs";
|
|
5
5
|
import { $ as isEnoent, A as formatCount, C as warn, D as installBunShim, F as $flag, N as $env, O as formatAge, P as $envpos, Q as hasFsCode, U as getAutoQaDbPath, V as VERSION, X as getRemoteDir, Y as getPuppeteerDir, at as findOnPath, b as debug, c as combineSignals, d as $which, et as isEnotdir, it as untilAborted, k as formatBytes$1, l as exec, m as readImageMetadata, nt as peekFile, q as getInstallId, tt as isProbablyBinary, u as render, x as error } from "./src-DUUqyo9y.mjs";
|
|
6
|
-
import { C as truncateToWidth$1, S as replaceTabs, _ as formatCodeFrameLine, a as fetchBinary, b as LRUCache, c as getParallelExtractContent, d as convertFileWithMarkit, f as Settings, g as capParseErrors, h as OMP_DEFAULTS, i as convertWithMarkit, l as ensureTool, m as settings, o as extractWithParallel, p as isSettingsInitialized, s as findParallelApiKey, u as CONVERTIBLE_EXTENSIONS, v as formatParseErrors, x as padding, y as shortenPath } from "./utils-
|
|
6
|
+
import { C as truncateToWidth$1, S as replaceTabs, _ as formatCodeFrameLine, a as fetchBinary, b as LRUCache, c as getParallelExtractContent, d as convertFileWithMarkit, f as Settings, g as capParseErrors, h as OMP_DEFAULTS, i as convertWithMarkit, l as ensureTool, m as settings, o as extractWithParallel, p as isSettingsInitialized, s as findParallelApiKey, u as CONVERTIBLE_EXTENSIONS, v as formatParseErrors, x as padding, y as shortenPath } from "./utils-CdLvJy_P.mjs";
|
|
7
7
|
import { t as sanitizeText } from "./sanitize-text-BCf5KmCf.mjs";
|
|
8
8
|
import { n as isRecord$5 } from "./type-guards-CttAANEx.mjs";
|
|
9
9
|
import { n as ToolError, r as throwIfAborted, t as ToolAbortError } from "./tool-errors-DoyxivAR.mjs";
|
|
@@ -4173,6 +4173,15 @@ function renderBashResult(value) {
|
|
|
4173
4173
|
* single source; settings.ts reads from here.
|
|
4174
4174
|
*/
|
|
4175
4175
|
const TOOL_PLUS_FIELDS = [
|
|
4176
|
+
{
|
|
4177
|
+
name: "webCards",
|
|
4178
|
+
kind: "boolean",
|
|
4179
|
+
default: true,
|
|
4180
|
+
labelKey: "webCards",
|
|
4181
|
+
hintKey: "webCardsHint",
|
|
4182
|
+
group: "cards",
|
|
4183
|
+
tool: "web"
|
|
4184
|
+
},
|
|
4176
4185
|
{
|
|
4177
4186
|
name: "enableRunInBackground",
|
|
4178
4187
|
kind: "boolean",
|
|
@@ -4236,15 +4245,6 @@ const TOOL_PLUS_FIELDS = [
|
|
|
4236
4245
|
group: "behavior",
|
|
4237
4246
|
tool: "bash"
|
|
4238
4247
|
},
|
|
4239
|
-
{
|
|
4240
|
-
name: "webCards",
|
|
4241
|
-
kind: "boolean",
|
|
4242
|
-
default: true,
|
|
4243
|
-
labelKey: "webCards",
|
|
4244
|
-
hintKey: "webCardsHint",
|
|
4245
|
-
group: "behavior",
|
|
4246
|
-
tool: "bash"
|
|
4247
|
-
},
|
|
4248
4248
|
{
|
|
4249
4249
|
name: "autoBackgroundMs",
|
|
4250
4250
|
kind: "number",
|
|
@@ -4879,7 +4879,7 @@ const TOOL_PLUS_FIELDS = [
|
|
|
4879
4879
|
tool: "astEdit"
|
|
4880
4880
|
}
|
|
4881
4881
|
];
|
|
4882
|
-
TOOL_PLUS_FIELDS.filter((f) => f.tool === "bash").map((f) => f.name), TOOL_PLUS_FIELDS.filter((f) => f.tool === "read").map((f) => f.name), TOOL_PLUS_FIELDS.filter((f) => f.tool === "writeEdit").map((f) => f.name), TOOL_PLUS_FIELDS.filter((f) => f.tool === "grep").map((f) => f.name), TOOL_PLUS_FIELDS.filter((f) => f.tool === "glob").map((f) => f.name), TOOL_PLUS_FIELDS.filter((f) => f.tool === "astGrep").map((f) => f.name), TOOL_PLUS_FIELDS.filter((f) => f.tool === "astEdit").map((f) => f.name);
|
|
4882
|
+
TOOL_PLUS_FIELDS.filter((f) => f.tool === "web").map((f) => f.name), TOOL_PLUS_FIELDS.filter((f) => f.tool === "bash").map((f) => f.name), TOOL_PLUS_FIELDS.filter((f) => f.tool === "read").map((f) => f.name), TOOL_PLUS_FIELDS.filter((f) => f.tool === "writeEdit").map((f) => f.name), TOOL_PLUS_FIELDS.filter((f) => f.tool === "grep").map((f) => f.name), TOOL_PLUS_FIELDS.filter((f) => f.tool === "glob").map((f) => f.name), TOOL_PLUS_FIELDS.filter((f) => f.tool === "astGrep").map((f) => f.name), TOOL_PLUS_FIELDS.filter((f) => f.tool === "astEdit").map((f) => f.name);
|
|
4883
4883
|
/** Look up one field definition by its schema key. */
|
|
4884
4884
|
function toolPlusField(name) {
|
|
4885
4885
|
return TOOL_PLUS_FIELDS.find((field) => field.name === name);
|
|
@@ -10317,7 +10317,7 @@ let specialHandlersPromise;
|
|
|
10317
10317
|
* requires a special handler, so we keep them out of the cold-startup graph.
|
|
10318
10318
|
*/
|
|
10319
10319
|
function loadSpecialHandlers() {
|
|
10320
|
-
specialHandlersPromise ??= import("./scrapers-
|
|
10320
|
+
specialHandlersPromise ??= import("./scrapers-D1uU6YiZ.mjs").then((m) => m.specialHandlers);
|
|
10321
10321
|
return specialHandlersPromise;
|
|
10322
10322
|
}
|
|
10323
10323
|
/**
|
|
@@ -3,7 +3,7 @@ __installBunShim();
|
|
|
3
3
|
import { n as fs_promises_shim_exports } from "./fs-promises-shim-Bx0fpxuk.mjs";
|
|
4
4
|
import { $ as isEnoent, B as USER_AGENT, C as warn, G as getDocsRsCacheDir, N as $env, c as combineSignals, j as formatNumber, k as formatBytes, l as exec, s as Snowflake, y as parseFrontmatter } from "./src-DUUqyo9y.mjs";
|
|
5
5
|
import { W as tryParseJson } from "./utils-BMmwLB0f.mjs";
|
|
6
|
-
import { a as fetchBinary, c as getParallelExtractContent, i as convertWithMarkit, l as ensureTool, m as settings, n as asRecord, o as extractWithParallel, r as asString, s as findParallelApiKey, t as asNumber } from "./utils-
|
|
6
|
+
import { a as fetchBinary, c as getParallelExtractContent, i as convertWithMarkit, l as ensureTool, m as settings, n as asRecord, o as extractWithParallel, r as asString, s as findParallelApiKey, t as asNumber } from "./utils-CdLvJy_P.mjs";
|
|
7
7
|
import { n as isRecord } from "./type-guards-CttAANEx.mjs";
|
|
8
8
|
import { r as throwIfAborted, t as ToolAbortError } from "./tool-errors-DoyxivAR.mjs";
|
|
9
9
|
import { c as getLocalizedText, d as looksLikeHtml, i as decodeHtmlEntities, l as htmlToBasicMarkdown, o as formatIsoDate, r as buildResult, s as formatMediaDuration, u as loadPage } from "./types-DT9vgZ3S.mjs";
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Tool Plus settings section — the plugin's own page in the Settings panel,
|
|
3
3
|
* registered into the `settings.section` slot (nav id `tool-plus`). The page
|
|
4
|
-
* renders one tab per tool (Bash / Read / Write & Edit / Grep /
|
|
5
|
-
* Ast
|
|
4
|
+
* renders one tab per tool (Bash / Read / Write & Edit / Grep / Glob /
|
|
5
|
+
* Ast Grep / Ast Edit) plus a leading `Web 卡片` tab for the plugin-wide
|
|
6
|
+
* browser-card switch; switching a tab shows that tool's configurable
|
|
6
7
|
* fields, while tools without global settings show a placeholder. Only the
|
|
7
8
|
* active tool's panel is rendered; the shared staged form over the
|
|
8
9
|
* `tool-plus` namespace lives at the page level, so drafts survive switching
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* a compile error (the official registration enforces bilingual balance).
|
|
6
6
|
* @module @xiaoso/dsh-tool-plus/client
|
|
7
7
|
*/
|
|
8
|
-
export type BashPlusLocaleKey = 'title' | 'description' | 'nav' | 'pageTitle' | 'pageDescription' | 'tabBash' | 'tabRead' | 'tabWriteEdit' | 'tabGrep' | 'tabGlob' | 'tabAstGrep' | 'tabAstEdit' | 'tabReadImage' | 'groupTiming' | 'groupOutput' | 'groupTruncation' | 'groupBehavior' | 'groupReading' | 'groupSummary' | 'groupImages' | 'groupEditMode' | 'groupGuard' | 'groupGrep' | 'groupSearchDefaults' | 'groupFetch' | 'groupAst' | 'noConfigTitle' | 'noConfigHint' | 'readSummarizeEnabled' | 'readSummarizeEnabledHint' | 'readSummarizeProse' | 'readSummarizeProseHint' | 'readSummarizeMinBodyLines' | 'readSummarizeMinBodyLinesHint' | 'readSummarizeMinCommentLines' | 'readSummarizeMinCommentLinesHint' | 'readSummarizeMinTotalLines' | 'readSummarizeMinTotalLinesHint' | 'readSummarizeUnfoldUntil' | 'readSummarizeUnfoldUntilHint' | 'readSummarizeUnfoldLimit' | 'readSummarizeUnfoldLimitHint' | 'editBlockAutoGenerated' | 'editBlockAutoGeneratedHint' | 'readDefaultLimit' | 'readDefaultLimitHint' | 'readLineNumbers' | 'readLineNumbersHint' | 'readRenderMarkdown' | 'readRenderMarkdownHint' | 'readConcurrentSafe' | 'readConcurrentSafeHint' | 'editMode' | 'editModeHint' | 'editFuzzyMatch' | 'editFuzzyMatchHint' | 'editFuzzyThreshold' | 'editFuzzyThresholdHint' | 'editEnforceSeenLines' | 'editEnforceSeenLinesHint' | 'grepContextBefore' | 'grepContextBeforeHint' | 'grepContextAfter' | 'grepContextAfterHint' | 'grepCaseDefault' | 'grepCaseDefaultHint' | 'grepGitignoreDefault' | 'grepGitignoreDefaultHint' | 'globGitignoreDefault' | 'globGitignoreDefaultHint' | 'globHiddenDefault' | 'globHiddenDefaultHint' | 'astGrepEnabled' | 'astGrepEnabledHint' | 'astEditEnabled' | 'astEditEnabledHint' | 'optReplace' | 'optPatch' | 'optHashline' | 'optApplyPatch' | 'fetchEnabled' | 'fetchEnabledHint' | 'fetchMaxTimeoutSeconds' | 'fetchMaxTimeoutSecondsHint' | 'fetchReader' | 'fetchReaderHint' | 'browserReaderEnabled' | 'browserReaderEnabledHint' | 'browserProbe' | 'browserProbeHint' | 'browserProbeRunning' | 'browserProbeNone' | 'browserProbeFailed' | 'browserProbeUnavailable' | 'optReaderAuto' | 'optReaderNative' | 'optReaderTrafilatura' | 'optReaderLynx' | 'optReaderParallel' | 'optReaderJina' | 'optReaderBrowser' | 'imagesAutoResize' | 'imagesAutoResizeHint' | 'imagesBlockImages' | 'imagesBlockImagesHint' | 'imagesExcludeWebp' | 'imagesExcludeWebpHint' | 'imagesInputMaxBytes' | 'imagesInputMaxBytesHint' | 'imagesResizeMaxSide' | 'imagesResizeMaxSideHint' | 'imagesResizeMaxBytes' | 'imagesResizeMaxBytesHint' | 'imagesResizeMinSide' | 'imagesResizeMinSideHint' | 'imagesResizeJpegQuality' | 'imagesResizeJpegQualityHint' | 'autoBackgroundMs' | 'autoBackgroundMsHint' | 'defaultTimeoutMs' | 'defaultTimeoutMsHint' | 'maxTimeoutMs' | 'maxTimeoutMsHint' | 'maxBackgroundJobs' | 'maxBackgroundJobsHint' | 'outputMaxBytes' | 'outputMaxBytesHint' | 'outputSinkTailBytes' | 'outputSinkTailBytesHint' | 'outputSinkHeadBytes' | 'outputSinkHeadBytesHint' | 'minimizerEnabled' | 'minimizerEnabledHint' | 'enableRunInBackground' | 'enableRunInBackgroundHint' | 'interceptorEnabled' | 'interceptorEnabledHint' | 'nonInteractiveEnv' | 'nonInteractiveEnvHint' | 'snapshotEnabled' | 'snapshotEnabledHint' | 'rmSafe' | 'rmSafeHint' | 'rmSafeStatusInjected' | 'rmSafeStatusInjectedUnverified' | 'rmSafeStatusFailed' | 'rmSafeReasonSnapshotUnavailable' | 'rmSafeReasonCliMissing' | 'rmSafeReasonSnapshotWriteFailed' | 'rmSafeReasonRuntimeNotEffective' | 'useShellCommandWrapper' | 'useShellCommandWrapperHint' | 'webCards' | 'webCardsHint' | 'outputTruncateStrategy' | 'outputTruncateStrategyHint' | 'outputTruncateTriggerBytes' | 'outputTruncateTriggerBytesHint' | 'outputTruncateTriggerLines' | 'outputTruncateTriggerLinesHint' | 'outputTruncateByteMode' | 'outputTruncateByteModeHint' | 'outputTruncateByteHeadBytes' | 'outputTruncateByteHeadBytesHint' | 'outputTruncateByteTailBytes' | 'outputTruncateByteTailBytesHint' | 'outputTruncateLineMode' | 'outputTruncateLineModeHint' | 'outputTruncateLineHeadLines' | 'outputTruncateLineHeadLinesHint' | 'outputTruncateLineTailLines' | 'outputTruncateLineTailLinesHint' | 'optBytes' | 'optLines' | 'optHead' | 'optTail' | 'optMiddle' | 'overridden' | 'reset' | 'readOnly' | 'expand' | 'collapse' | 'save' | 'saving' | 'discard' | 'unsaved' | 'saveFailed' | 'invalidNumber' | 'appliesTo';
|
|
8
|
+
export type BashPlusLocaleKey = 'title' | 'description' | 'nav' | 'pageTitle' | 'pageDescription' | 'tabWeb' | 'tabBash' | 'tabRead' | 'tabWriteEdit' | 'tabGrep' | 'tabGlob' | 'tabAstGrep' | 'tabAstEdit' | 'tabReadImage' | 'groupCards' | 'groupTiming' | 'groupOutput' | 'groupTruncation' | 'groupBehavior' | 'groupReading' | 'groupSummary' | 'groupImages' | 'groupEditMode' | 'groupGuard' | 'groupGrep' | 'groupSearchDefaults' | 'groupFetch' | 'groupAst' | 'noConfigTitle' | 'noConfigHint' | 'readSummarizeEnabled' | 'readSummarizeEnabledHint' | 'readSummarizeProse' | 'readSummarizeProseHint' | 'readSummarizeMinBodyLines' | 'readSummarizeMinBodyLinesHint' | 'readSummarizeMinCommentLines' | 'readSummarizeMinCommentLinesHint' | 'readSummarizeMinTotalLines' | 'readSummarizeMinTotalLinesHint' | 'readSummarizeUnfoldUntil' | 'readSummarizeUnfoldUntilHint' | 'readSummarizeUnfoldLimit' | 'readSummarizeUnfoldLimitHint' | 'editBlockAutoGenerated' | 'editBlockAutoGeneratedHint' | 'readDefaultLimit' | 'readDefaultLimitHint' | 'readLineNumbers' | 'readLineNumbersHint' | 'readRenderMarkdown' | 'readRenderMarkdownHint' | 'readConcurrentSafe' | 'readConcurrentSafeHint' | 'editMode' | 'editModeHint' | 'editFuzzyMatch' | 'editFuzzyMatchHint' | 'editFuzzyThreshold' | 'editFuzzyThresholdHint' | 'editEnforceSeenLines' | 'editEnforceSeenLinesHint' | 'grepContextBefore' | 'grepContextBeforeHint' | 'grepContextAfter' | 'grepContextAfterHint' | 'grepCaseDefault' | 'grepCaseDefaultHint' | 'grepGitignoreDefault' | 'grepGitignoreDefaultHint' | 'globGitignoreDefault' | 'globGitignoreDefaultHint' | 'globHiddenDefault' | 'globHiddenDefaultHint' | 'astGrepEnabled' | 'astGrepEnabledHint' | 'astEditEnabled' | 'astEditEnabledHint' | 'optReplace' | 'optPatch' | 'optHashline' | 'optApplyPatch' | 'fetchEnabled' | 'fetchEnabledHint' | 'fetchMaxTimeoutSeconds' | 'fetchMaxTimeoutSecondsHint' | 'fetchReader' | 'fetchReaderHint' | 'browserReaderEnabled' | 'browserReaderEnabledHint' | 'browserProbe' | 'browserProbeHint' | 'browserProbeRunning' | 'browserProbeNone' | 'browserProbeFailed' | 'browserProbeUnavailable' | 'optReaderAuto' | 'optReaderNative' | 'optReaderTrafilatura' | 'optReaderLynx' | 'optReaderParallel' | 'optReaderJina' | 'optReaderBrowser' | 'imagesAutoResize' | 'imagesAutoResizeHint' | 'imagesBlockImages' | 'imagesBlockImagesHint' | 'imagesExcludeWebp' | 'imagesExcludeWebpHint' | 'imagesInputMaxBytes' | 'imagesInputMaxBytesHint' | 'imagesResizeMaxSide' | 'imagesResizeMaxSideHint' | 'imagesResizeMaxBytes' | 'imagesResizeMaxBytesHint' | 'imagesResizeMinSide' | 'imagesResizeMinSideHint' | 'imagesResizeJpegQuality' | 'imagesResizeJpegQualityHint' | 'autoBackgroundMs' | 'autoBackgroundMsHint' | 'defaultTimeoutMs' | 'defaultTimeoutMsHint' | 'maxTimeoutMs' | 'maxTimeoutMsHint' | 'maxBackgroundJobs' | 'maxBackgroundJobsHint' | 'outputMaxBytes' | 'outputMaxBytesHint' | 'outputSinkTailBytes' | 'outputSinkTailBytesHint' | 'outputSinkHeadBytes' | 'outputSinkHeadBytesHint' | 'minimizerEnabled' | 'minimizerEnabledHint' | 'enableRunInBackground' | 'enableRunInBackgroundHint' | 'interceptorEnabled' | 'interceptorEnabledHint' | 'nonInteractiveEnv' | 'nonInteractiveEnvHint' | 'snapshotEnabled' | 'snapshotEnabledHint' | 'rmSafe' | 'rmSafeHint' | 'rmSafeStatusInjected' | 'rmSafeStatusInjectedUnverified' | 'rmSafeStatusFailed' | 'rmSafeReasonSnapshotUnavailable' | 'rmSafeReasonCliMissing' | 'rmSafeReasonSnapshotWriteFailed' | 'rmSafeReasonRuntimeNotEffective' | 'useShellCommandWrapper' | 'useShellCommandWrapperHint' | 'webCards' | 'webCardsHint' | 'outputTruncateStrategy' | 'outputTruncateStrategyHint' | 'outputTruncateTriggerBytes' | 'outputTruncateTriggerBytesHint' | 'outputTruncateTriggerLines' | 'outputTruncateTriggerLinesHint' | 'outputTruncateByteMode' | 'outputTruncateByteModeHint' | 'outputTruncateByteHeadBytes' | 'outputTruncateByteHeadBytesHint' | 'outputTruncateByteTailBytes' | 'outputTruncateByteTailBytesHint' | 'outputTruncateLineMode' | 'outputTruncateLineModeHint' | 'outputTruncateLineHeadLines' | 'outputTruncateLineHeadLinesHint' | 'outputTruncateLineTailLines' | 'outputTruncateLineTailLinesHint' | 'optBytes' | 'optLines' | 'optHead' | 'optTail' | 'optMiddle' | 'overridden' | 'reset' | 'readOnly' | 'expand' | 'collapse' | 'save' | 'saving' | 'discard' | 'unsaved' | 'saveFailed' | 'invalidNumber' | 'appliesTo';
|
|
9
9
|
/** Simplified Chinese copy. */
|
|
10
10
|
export declare const zh: Record<BashPlusLocaleKey, string>;
|
|
11
11
|
/** English copy. */
|
|
@@ -66,7 +66,7 @@ export interface ToolPlusTab {
|
|
|
66
66
|
fields: readonly string[];
|
|
67
67
|
}
|
|
68
68
|
/** Identifiers of every tool tab. */
|
|
69
|
-
export type ToolPlusToolId = 'bash' | 'read' | 'writeEdit' | 'grep' | 'glob' | 'astGrep' | 'astEdit';
|
|
69
|
+
export type ToolPlusToolId = 'web' | 'bash' | 'read' | 'writeEdit' | 'grep' | 'glob' | 'astGrep' | 'astEdit';
|
|
70
70
|
/** Field group ids -> locale key of the group heading. */
|
|
71
71
|
export declare const TOOL_PLUS_GROUP_LABELS: Record<string, BashPlusLocaleKey>;
|
|
72
72
|
/**
|
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
*
|
|
4
4
|
* The shipped `ToolRow` is not reusable from a plugin (ui-tool is not part of
|
|
5
5
|
* the client platform baseline), so this is our own: one 24px header line
|
|
6
|
-
* (
|
|
6
|
+
* (tool glyph + title + separator + ellipsized summary + optional `+N -M`
|
|
7
7
|
* suffix + clickable path), a keyboard-reachable disclosure, and a body that
|
|
8
|
-
* is either the card a row built or the flattened result text.
|
|
8
|
+
* is either the card a row built or the flattened result text. The leading
|
|
9
|
+
* glyph gives way to a state dot on a failed or interrupted call, and the row
|
|
10
|
+
* sweeps while the call runs, as the shipped row does.
|
|
9
11
|
*
|
|
10
12
|
* Two properties matter more than the visuals:
|
|
11
13
|
* - **Never throw.** Every value is coerced defensively, and {@link CardBoundary}
|
|
@@ -23,8 +25,10 @@ import { type CardBlockView, type CardOpenFileOptions, type CardState, type Card
|
|
|
23
25
|
export interface ToolCardShellProps {
|
|
24
26
|
/** Card translate seat. */
|
|
25
27
|
t: CardTranslate;
|
|
26
|
-
/** Run state driving the leading
|
|
28
|
+
/** Run state driving the leading mark and the status word. */
|
|
27
29
|
state: CardState;
|
|
30
|
+
/** Wire tool name selecting the leading glyph; absent/unknown = the generic glyph. */
|
|
31
|
+
tool?: string | null | undefined;
|
|
28
32
|
/** Single-line title (the tool name). */
|
|
29
33
|
title: string;
|
|
30
34
|
/** Collapsed summary after the separator; empty renders no separator. */
|
|
@@ -64,6 +68,12 @@ export interface GenericCardProps {
|
|
|
64
68
|
block: CardBlockView;
|
|
65
69
|
/** The call's parsed arguments, when there are any. */
|
|
66
70
|
args: Record<string, unknown> | null;
|
|
71
|
+
/** Wire tool name selecting the leading glyph; absent/unknown = the generic glyph. */
|
|
72
|
+
toolName?: string | null | undefined;
|
|
73
|
+
/** Session workspace root, so a stated path is shortened the rows' way. */
|
|
74
|
+
cwd?: string | undefined;
|
|
75
|
+
/** Opens the call's file in the host's viewer; absent = the path is plain text. */
|
|
76
|
+
openFile?: ((path: string, options?: CardOpenFileOptions) => void) | undefined;
|
|
67
77
|
/** Jump to this call in the trajectory view. */
|
|
68
78
|
inspect?: (() => void) | undefined;
|
|
69
79
|
}
|
|
@@ -73,11 +83,11 @@ export interface GenericCardProps {
|
|
|
73
83
|
* A card is only drawn once its metadata passed a `narrow*` guard, so anything
|
|
74
84
|
* else — a running call, a window-truncated call, a Code Dispatch child, a
|
|
75
85
|
* failure, a payload from another plugin version — lands here with the call's
|
|
76
|
-
* own title, run state,
|
|
86
|
+
* own title, run state, the fact its arguments state, and result text.
|
|
77
87
|
* @param props - see {@link GenericCardProps}.
|
|
78
88
|
* @returns the generic shell.
|
|
79
89
|
*/
|
|
80
|
-
export declare function GenericCard({ t, title, block, args, inspect }: GenericCardProps): import("react").JSX.Element;
|
|
90
|
+
export declare function GenericCard({ t, title, block, args, toolName, cwd, openFile, inspect }: GenericCardProps): import("react").JSX.Element;
|
|
81
91
|
/** Props of {@link CardBoundary}. */
|
|
82
92
|
export interface CardBoundaryProps {
|
|
83
93
|
/** Card translate seat, forwarded to the fallback shell. */
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
/** Locale namespace of the tool-card bundle (registered by `registerToolCards`). */
|
|
18
18
|
export declare const CARD_LOCALE_NS = "tool-plus-cards";
|
|
19
19
|
/** Every copy key of the tool-card namespace. */
|
|
20
|
-
export type ToolCardLocaleKey = 'copy' | 'copied' | 'collapse' | 'expand' | 'collapseAria' | 'expandAria' | 'expandRest' | 'files.one' | 'files.other' | 'running' | 'done' | 'failed' | 'cancelled' | 'timedOut' | 'noOutput' | 'title.bash' | 'title.read' | 'title.write' | 'title.edit' | 'title.grep' | 'title.glob' | 'title.astGrep' | 'title.astEdit' | 'write.lines' | 'write.madeExecutable' | 'astEdit.replacements' | 'astEdit.files' | 'astEdit.parseErrors' | 'astEdit.rules' | 'astEdit.rulesRest' | 'read.window' | 'read.collapseAria' | 'read.expandAria' | 'read.expandRest' | 'search.paths' | 'search.paths.truncated' | 'search.matches' | 'search.matches.truncated' | 'search.noResults' | 'search.scope' | 'search.collapseAria' | 'search.expandAria' | 'search.expandRest' | 'terminal.signal' | 'terminal.exitCode' | 'terminal.running' | 'terminal.failed' | 'terminal.done' | 'terminal.noOutput' | 'bash.background' | 'image.loading' | 'image.loadFailed' | 'image.open' | 'image.openNamed' | 'image.dialog' | 'image.close' | 'image.unnamed' | 'image.caption' | 'generic.params' | 'generic.noDetail' | 'inspect';
|
|
20
|
+
export type ToolCardLocaleKey = 'copy' | 'copied' | 'collapse' | 'expand' | 'collapseAria' | 'expandAria' | 'expandRest' | 'files.one' | 'files.other' | 'running' | 'done' | 'failed' | 'stopped' | 'cancelled' | 'timedOut' | 'noOutput' | 'title.bash' | 'title.read' | 'title.write' | 'title.edit' | 'title.grep' | 'title.glob' | 'title.astGrep' | 'title.astEdit' | 'write.lines' | 'write.madeExecutable' | 'astEdit.replacements' | 'astEdit.files' | 'astEdit.parseErrors' | 'astEdit.rules' | 'astEdit.rulesRest' | 'read.window' | 'read.collapseAria' | 'read.expandAria' | 'read.expandRest' | 'search.paths' | 'search.paths.truncated' | 'search.matches' | 'search.matches.truncated' | 'search.noResults' | 'search.scope' | 'search.collapseAria' | 'search.expandAria' | 'search.expandRest' | 'terminal.signal' | 'terminal.exitCode' | 'terminal.running' | 'terminal.failed' | 'terminal.done' | 'terminal.noOutput' | 'bash.background' | 'image.loading' | 'image.loadFailed' | 'image.open' | 'image.openNamed' | 'image.dialog' | 'image.close' | 'image.unnamed' | 'image.caption' | 'generic.params' | 'generic.noDetail' | 'inspect';
|
|
21
21
|
/** Simplified Chinese copy (the source dictionary). */
|
|
22
22
|
export declare const zh: Record<ToolCardLocaleKey, string>;
|
|
23
23
|
/** English dictionary, checked complete against the zh key set. */
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* nothing here touches a raw `meta` field directly.
|
|
15
15
|
* @module @xiaoso/dsh-tool-plus/web/client/row-utils
|
|
16
16
|
*/
|
|
17
|
-
import type { DiffBlockLabels, ReadBlockLabels, SearchBlockLabels,
|
|
17
|
+
import type { DiffBlockLabels, ReadBlockLabels, SearchBlockLabels, TerminalBlockLabels } from '@deepseek-ai/dsh-client-ui-primitives';
|
|
18
18
|
import type { TranslateNS } from '@deepseek-ai/dsh-client-ui-slots';
|
|
19
19
|
import type { CARD_LOCALE_NS, ToolCardLocaleKey } from './labels.ts';
|
|
20
20
|
/** Translate seat of this plugin's card namespace. */
|
|
@@ -36,12 +36,30 @@ export interface CardBlockView {
|
|
|
36
36
|
} | null;
|
|
37
37
|
readonly content?: unknown;
|
|
38
38
|
readonly isError?: unknown;
|
|
39
|
+
/**
|
|
40
|
+
* Settled failure detail. A turn stopped mid-call is projected as a settled
|
|
41
|
+
* `isError` block carrying `code: 'interrupted'`, which is a stop, not a
|
|
42
|
+
* failure — the shipped row model reads this before `isError`.
|
|
43
|
+
*/
|
|
44
|
+
readonly error?: unknown;
|
|
39
45
|
readonly meta?: unknown;
|
|
40
46
|
}
|
|
41
47
|
/** Card run state, one step off the shipped `ToolRowState` (no `stopped`). */
|
|
42
48
|
export type CardState = 'running' | 'ok' | 'error' | 'warning';
|
|
43
49
|
/** Whether a block is the settled half of a call pair. */
|
|
44
50
|
export declare function isSettled(block: CardBlockView): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* The call's original argument text.
|
|
53
|
+
*
|
|
54
|
+
* A running call carries it directly; a settled result carries the head
|
|
55
|
+
* backfilled from the in-window `tool/call`, which is absent when window
|
|
56
|
+
* truncation left that event outside. The text outlives the parse: a call whose
|
|
57
|
+
* arguments are still streaming is not valid JSON yet, and the shell states its
|
|
58
|
+
* first line rather than pretending the call said nothing.
|
|
59
|
+
* @param block - the frozen running-or-settled call node.
|
|
60
|
+
* @returns the argument text, or `''` when no head survives.
|
|
61
|
+
*/
|
|
62
|
+
export declare function cardArgsRaw(block: CardBlockView): string;
|
|
45
63
|
/**
|
|
46
64
|
* Parse the call's raw argument JSON.
|
|
47
65
|
*
|
|
@@ -55,17 +73,19 @@ export declare function parseCardArgs(block: CardBlockView): Record<string, unkn
|
|
|
55
73
|
/**
|
|
56
74
|
* Run state of one call.
|
|
57
75
|
*
|
|
58
|
-
* A
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
76
|
+
* A turn stopped mid-call is projected as a settled `isError` block carrying
|
|
77
|
+
* `error.code === 'interrupted'`; the shipped row model reads that before
|
|
78
|
+
* `isError`, so a stopped call is amber and named "stopped" rather than failed.
|
|
79
|
+
* Any other settled `isError` result is an error. A foreground command that
|
|
80
|
+
* timed out or was cancelled is amber rather than green (the shipped terminal
|
|
81
|
+
* model reads only the trailing exit marker, which is exactly what the card
|
|
82
|
+
* owner was told not to trust). A non-zero exit stays `ok`: bash reports a
|
|
83
|
+
* failing command as result data, and the card's own status pill carries the
|
|
84
|
+
* red.
|
|
63
85
|
* @param block - the frozen running-or-settled call node.
|
|
64
86
|
* @returns the card run state.
|
|
65
87
|
*/
|
|
66
88
|
export declare function cardState(block: CardBlockView): CardState;
|
|
67
|
-
/** Map a card run state onto the primitive's dot semantics. */
|
|
68
|
-
export declare function dotState(state: CardState): StateDotState;
|
|
69
89
|
/**
|
|
70
90
|
* The assistive-technology status word for a run state, or `null` when the
|
|
71
91
|
* state is already carried by the row's content.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Row-leading treatment: which glyph a row leads with, and what replaces it
|
|
3
|
+
* when the call did not settle cleanly.
|
|
4
|
+
*
|
|
5
|
+
* The shipped `ToolRow` does not lead with a status dot. A clean or running row
|
|
6
|
+
* leads with its tool's own glyph, and only `error` / `stopped` swap that glyph
|
|
7
|
+
* for a `StateDot` (`ui-tool/src/client/tool/components/ToolRow.tsx::leadingFor`);
|
|
8
|
+
* the glyph per tool name comes from the shipped variant table
|
|
9
|
+
* (`ui-tool/src/client/tool/toolviews/GenericToolCard.tsx::VARIANT_ICONS`).
|
|
10
|
+
* This module is that rule and that table, kept pure so the mapping is testable
|
|
11
|
+
* under the Node runner — the component that draws it lives in
|
|
12
|
+
* `ToolCardShell`.
|
|
13
|
+
*
|
|
14
|
+
* Two of the eight card keys are this plugin's own tools, so they are absent
|
|
15
|
+
* from the shipped name table. They take the family whose shipped glyph
|
|
16
|
+
* describes the act — a structural search reads like `grep`, an atomic edit
|
|
17
|
+
* writes like `edit` — rather than the shipped `others` sparkle, which would
|
|
18
|
+
* make the two cards this plugin is the only home of look like unknown tools.
|
|
19
|
+
* @module @xiaoso/dsh-tool-plus/web/client/rows/card-leading
|
|
20
|
+
*/
|
|
21
|
+
import type { CardState } from '../row-utils.ts';
|
|
22
|
+
/** Glyph families of the shipped leading table. */
|
|
23
|
+
export type CardLeadingGlyph = 'bash' | 'read' | 'edit' | 'search' | 'others';
|
|
24
|
+
/**
|
|
25
|
+
* Glyph family a row leads with.
|
|
26
|
+
* @param toolName - the call's wire tool name, when the node carries one.
|
|
27
|
+
* @returns the family, or `others` (the shipped generic glyph) for an unknown name.
|
|
28
|
+
*/
|
|
29
|
+
export declare function leadingGlyph(toolName: string | null | undefined): CardLeadingGlyph;
|
|
30
|
+
/** What the leading box draws for one run state. */
|
|
31
|
+
export type CardLeadingKind = 'glyph' | 'error' | 'warning';
|
|
32
|
+
/**
|
|
33
|
+
* Whether a run state keeps the row's glyph or replaces it with a state dot.
|
|
34
|
+
* @param state - the card's run state.
|
|
35
|
+
* @returns the leading kind; `error` and `warning` are the two dot states.
|
|
36
|
+
*/
|
|
37
|
+
export declare function leadingKind(state: CardState): CardLeadingKind;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Collapsed-summary facts for the generic card — every row's degradation path.
|
|
3
|
+
*
|
|
4
|
+
* A call lands on the generic shell when its own card cannot be built: it is
|
|
5
|
+
* still running, its result carried no text, its metadata fell outside the
|
|
6
|
+
* session window, it is a Code Dispatch child, or the Host projected an
|
|
7
|
+
* interruption the card has no material for. In every one of those cases the
|
|
8
|
+
* call's ARGUMENTS are the only material left, and the shipped generic row
|
|
9
|
+
* answers them with the call's own fact: its variant's summary keys first, then
|
|
10
|
+
* ANY string the payload carries, then the first line of the raw argument text
|
|
11
|
+
* (`deriveSummary` in ui-tool's `tool-call-model.ts`). It never answers with an
|
|
12
|
+
* argument count.
|
|
13
|
+
*
|
|
14
|
+
* That is the rule here. The count it replaces told the reader nothing: a
|
|
15
|
+
* directory read, a `:raw` window, a running `grep` and a child call all
|
|
16
|
+
* collapsed to "1 个参数" — the one thing a degraded row must not do, since the
|
|
17
|
+
* head is then the only place the fact exists.
|
|
18
|
+
*
|
|
19
|
+
* The key preference follows THIS plugin's own tool schemas rather than the
|
|
20
|
+
* shipped `SUMMARY_KEYS`: our tools replaced the built-in ones with the OMP
|
|
21
|
+
* native parameter names (`read`/`write` take `path`, `ast_grep` takes `pat`,
|
|
22
|
+
* `ast_edit` takes `paths`), and the shipped table's `file_path` is what the
|
|
23
|
+
* built-in tools used. Both spellings are accepted, ours first, so a transcript
|
|
24
|
+
* recorded before the takeover still states its path.
|
|
25
|
+
* @module @xiaoso/dsh-tool-plus/web/client/rows/fallback-card-facts
|
|
26
|
+
*/
|
|
27
|
+
import { type CardTranslate } from '../row-utils.ts';
|
|
28
|
+
/**
|
|
29
|
+
* The generic card's collapsed summary: the fact the call itself states.
|
|
30
|
+
* @param toolName - the call's wire tool name (empty when truncated).
|
|
31
|
+
* @param args - the call's parsed arguments, or `null` when its head is gone.
|
|
32
|
+
* @param cwd - the session workspace root, for shortening an absolute path.
|
|
33
|
+
* @param t - the card translate seat.
|
|
34
|
+
* @param raw - the call's original argument text, for a payload that is not
|
|
35
|
+
* valid JSON yet (a call still streaming its arguments) or whose only values
|
|
36
|
+
* are non-strings.
|
|
37
|
+
* @returns the collapsed summary text.
|
|
38
|
+
*/
|
|
39
|
+
export declare function fallbackCardSummary(toolName: string | null | undefined, args: Record<string, unknown> | null, cwd: string | undefined, t: CardTranslate, raw?: string | null): string;
|
|
40
|
+
/**
|
|
41
|
+
* The real file a degraded file-backed row may offer to open — `null` when the
|
|
42
|
+
* call names no single file.
|
|
43
|
+
*
|
|
44
|
+
* The head states the call verbatim (selector included) while the link has to
|
|
45
|
+
* name a real file: the same split the read card itself makes between its
|
|
46
|
+
* summary and its link. Whether that file then previews is the side bar's
|
|
47
|
+
* decision, never this module's.
|
|
48
|
+
* @param toolName - the call's wire tool name.
|
|
49
|
+
* @param args - the call's parsed arguments, or `null`.
|
|
50
|
+
* @returns the file to open, or `null` when there is nothing to open.
|
|
51
|
+
*/
|
|
52
|
+
export declare function fallbackCardLink(toolName: string | null | undefined, args: Record<string, unknown> | null): string | null;
|
|
@@ -6267,7 +6267,7 @@ const settings = {
|
|
|
6267
6267
|
};
|
|
6268
6268
|
//#endregion
|
|
6269
6269
|
//#region package.json
|
|
6270
|
-
var version = "0.1.8
|
|
6270
|
+
var version = "0.1.8";
|
|
6271
6271
|
/** `.tmp` files older than this are treated as orphaned writes and swept. */
|
|
6272
6272
|
const TMP_ORPHAN_MAX_AGE_MS = 3e5;
|
|
6273
6273
|
function markitConversionCacheKey(bytes, extension) {
|