@lesliechan721/aw 0.1.0-beta.30 → 0.1.0-beta.32
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/authoring/scripts/lib/plugin-version-check.mjs +1 -1
- package/dist/authoring/scripts/validate-plugin.mjs +5 -2
- package/dist/authoring/scripts/validate-plugin.mjs.map +1 -1
- package/dist/src/commands/aw-capabilities.d.ts +1 -1
- package/dist/src/commands/aw-capabilities.js +2 -0
- package/dist/src/commands/aw-capabilities.js.map +1 -1
- package/dist/src/commands/rebuild-operations.js +1 -0
- package/dist/src/commands/rebuild-operations.js.map +1 -1
- package/dist/src/tui/catalog-sources/session.d.ts +5 -1
- package/dist/src/tui/catalog-sources/session.js +6 -1
- package/dist/src/tui/catalog-sources/session.js.map +1 -1
- package/dist/src/tui/catalog-sources/types.d.ts +1 -0
- package/dist/src/tui/components.d.ts +1 -11
- package/dist/src/tui/components.js +9 -41
- package/dist/src/tui/components.js.map +1 -1
- package/dist/src/tui/config-value-presentation.d.ts +19 -0
- package/dist/src/tui/config-value-presentation.js +77 -0
- package/dist/src/tui/config-value-presentation.js.map +1 -0
- package/dist/src/tui/console-app-v4.d.ts +1 -1
- package/dist/src/tui/console-app-v4.js +885 -1121
- package/dist/src/tui/console-app-v4.js.map +1 -1
- package/dist/src/tui/controller.d.ts +8 -0
- package/dist/src/tui/controller.js +85 -18
- package/dist/src/tui/controller.js.map +1 -1
- package/dist/src/tui/diagnostics.d.ts +2 -1
- package/dist/src/tui/diagnostics.js +8 -1
- package/dist/src/tui/diagnostics.js.map +1 -1
- package/dist/src/tui/input-display.d.ts +1 -0
- package/dist/src/tui/input-display.js +13 -0
- package/dist/src/tui/input-display.js.map +1 -1
- package/dist/src/tui/model.d.ts +3 -2
- package/dist/src/tui/model.js +17 -33
- package/dist/src/tui/model.js.map +1 -1
- package/dist/src/tui/operation-diagnostic-screens.d.ts +5 -3
- package/dist/src/tui/operation-diagnostic-screens.js +26 -9
- package/dist/src/tui/operation-diagnostic-screens.js.map +1 -1
- package/dist/src/tui/operation-history.js +5 -4
- package/dist/src/tui/operation-history.js.map +1 -1
- package/dist/src/tui/router.d.ts +4 -6
- package/dist/src/tui/router.js.map +1 -1
- package/dist/src/tui/screen-registry.d.ts +10 -19
- package/dist/src/tui/screen-registry.js +3 -4
- package/dist/src/tui/screen-registry.js.map +1 -1
- package/dist/src/tui/viewport.d.ts +1 -0
- package/dist/src/tui/viewport.js +23 -0
- package/dist/src/tui/viewport.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { stripVTControlCharacters } from 'node:util';
|
|
2
|
+
import { validatePluginConfigValue, decodePluginConfigSummaryPath, matchPluginConfigPreset, PLUGIN_CONFIG_SUMMARY_MAX_CODE_POINTS, } from '@lesliechan721/aw-plugin-core';
|
|
3
|
+
// Configuration values are not diagnostics: retain ordinary paths and token-like text.
|
|
4
|
+
export function safeConfigText(value) {
|
|
5
|
+
return stripVTControlCharacters(value)
|
|
6
|
+
.replace(/[\u0000-\u001f\u007f-\u009f\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069]/gu, '');
|
|
7
|
+
}
|
|
8
|
+
export function configObjectHasSensitiveChild(field) {
|
|
9
|
+
if (field.type !== 'object')
|
|
10
|
+
return false;
|
|
11
|
+
return Object.values(field.properties ?? {}).some((property) => property.sensitive === true)
|
|
12
|
+
|| (field.additionalProperties !== false && field.additionalProperties?.sensitive === true);
|
|
13
|
+
}
|
|
14
|
+
function scalarText(value) {
|
|
15
|
+
if (typeof value === 'boolean')
|
|
16
|
+
return value ? '开启' : '关闭';
|
|
17
|
+
if (value === '')
|
|
18
|
+
return '(空字符串)';
|
|
19
|
+
return safeConfigText(String(value));
|
|
20
|
+
}
|
|
21
|
+
function boundedValue(text, hiddenProperties = []) {
|
|
22
|
+
const points = [...text];
|
|
23
|
+
const abbreviated = points.length > PLUGIN_CONFIG_SUMMARY_MAX_CODE_POINTS;
|
|
24
|
+
return {
|
|
25
|
+
text: abbreviated ? `${points.slice(0, PLUGIN_CONFIG_SUMMARY_MAX_CODE_POINTS - 1).join('')}…` : text,
|
|
26
|
+
state: 'value',
|
|
27
|
+
complete: !abbreviated && hiddenProperties.length === 0,
|
|
28
|
+
...(hiddenProperties.length > 0 ? { hiddenProperties } : {}),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/** Accept safe projected values; callers keep the complete value for editing and diffs. */
|
|
32
|
+
export function presentConfigValue(options) {
|
|
33
|
+
const { definition, value } = options;
|
|
34
|
+
const configured = options.configured ?? value !== undefined;
|
|
35
|
+
if (options.privateValue || definition.sensitive === true || configObjectHasSensitiveChild(definition)) {
|
|
36
|
+
return { text: configured ? '已设置' : '未设置', state: 'sensitive', complete: true };
|
|
37
|
+
}
|
|
38
|
+
if (!configured && !options.invalid)
|
|
39
|
+
return { text: '未设置', state: 'unset', complete: true };
|
|
40
|
+
if (options.invalid || validatePluginConfigValue(definition, value).length > 0) {
|
|
41
|
+
return { text: '需修正', state: 'invalid', complete: true };
|
|
42
|
+
}
|
|
43
|
+
if (options.full)
|
|
44
|
+
return {
|
|
45
|
+
text: definition.type === 'object' ? safeConfigText(JSON.stringify(value)) : scalarText(value),
|
|
46
|
+
state: 'value', complete: true,
|
|
47
|
+
};
|
|
48
|
+
if (definition.type !== 'object')
|
|
49
|
+
return boundedValue(scalarText(value));
|
|
50
|
+
const object = value;
|
|
51
|
+
if (options.summary && definition.properties) {
|
|
52
|
+
const selected = new Set();
|
|
53
|
+
const text = options.summary.parts.map((part) => {
|
|
54
|
+
const property = decodePluginConfigSummaryPath(part.path);
|
|
55
|
+
selected.add(property);
|
|
56
|
+
if (!Object.hasOwn(definition.properties, property) || !Object.hasOwn(object, property)) {
|
|
57
|
+
return safeConfigText(options.summary.missing);
|
|
58
|
+
}
|
|
59
|
+
const child = definition.properties[property];
|
|
60
|
+
const value = object[property];
|
|
61
|
+
const title = part.format === 'choiceTitle' ? matchPluginConfigPreset(child, value)?.title : undefined;
|
|
62
|
+
return title === undefined ? scalarText(value) : safeConfigText(title);
|
|
63
|
+
}).join(safeConfigText(options.summary.separator));
|
|
64
|
+
return boundedValue(text, Object.keys(object).filter((key) => !selected.has(key)));
|
|
65
|
+
}
|
|
66
|
+
const keys = definition.properties
|
|
67
|
+
? Object.keys(definition.properties).filter((key) => Object.hasOwn(object, key))
|
|
68
|
+
: Object.keys(object).sort((left, right) => left.localeCompare(right, 'en'));
|
|
69
|
+
if (keys.length === 0)
|
|
70
|
+
return boundedValue('(空对象)');
|
|
71
|
+
const text = keys.slice(0, 2).map((key) => {
|
|
72
|
+
const title = definition.properties?.[key]?.title ?? key;
|
|
73
|
+
return `${safeConfigText(title)}=${scalarText(object[key])}`;
|
|
74
|
+
}).join(' · ');
|
|
75
|
+
return boundedValue(text, keys.slice(2));
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=config-value-presentation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-value-presentation.js","sourceRoot":"","sources":["../../../src/tui/config-value-presentation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAErD,OAAO,EACL,yBAAyB,EACzB,6BAA6B,EAC7B,uBAAuB,EACvB,qCAAqC,GAKtC,MAAM,+BAA+B,CAAC;AASvC,uFAAuF;AACvF,MAAM,UAAU,cAAc,CAAC,KAAa;IAC1C,OAAO,wBAAwB,CAAC,KAAK,CAAC;SACnC,OAAO,CAAC,4EAA4E,EAAE,EAAE,CAAC,CAAC;AAC/F,CAAC;AAED,MAAM,UAAU,6BAA6B,CAAC,KAA8B;IAC1E,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC1C,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,C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AC,CAAC;QAChF,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;IAC/E,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,YAAY,CAAC,OAAO,CAAC,CAAC;IACpD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;QACxC,MAAM,KAAK,GAAG,UAAU,CAAC,UAAU,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,IAAI,GAAG,CAAC;QACzD,OAAO,GAAG,cAAc,CAAC,KAAK,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,GAAG,CAAE,CAAC,EAAE,CAAC;IAChE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACf,OAAO,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3C,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ExternalDraftState, TuiController, TuiControllerSnapshot } from './controller.js';
|
|
2
2
|
import type { SessionNavigation, SessionNavigationResult } from './session-host.js';
|
|
3
3
|
import { type TuiScreenId } from './screen-registry.js';
|
|
4
|
-
export declare const CONSOLE_V4_SCREEN_IDS: readonly ["G01", "G02", "G03", "G04", "G05", "G06", "P01", "P02", "P03", "P04", "P05", "P06", "P07", "P08", "P09", "P10", "P11", "P12", "P13", "P14", "P15", "P16", "P17", "P18", "P19", "
|
|
4
|
+
export declare const CONSOLE_V4_SCREEN_IDS: readonly ["G01", "G02", "G03", "G04", "G05", "G06", "P01", "P02", "P03", "P04", "P05", "P06", "P07", "P08", "P09", "P10", "P11", "P12", "P13", "P14", "P15", "P16", "P17", "P18", "P19", "P21", "P22", "C01", "C02", "C03", "C04", "C05", "C06", "C07", "C08", "C09", "C10", "C11", "C12", "C13", "C14", "C15", "C16", "C17", "C18", "C19", "C20", "C21", "C22", "C23", "S01", "S02", "S03", "S04", "S05", "S06", "S07", "S08", "S09", "S10", "S11", "S12", "S13", "S14", "S15", "S16", "S17", "S18", "I01", "I02", "I03", "I04", "I05", "I06", "I07", "I08", "I09", "I10", "I11", "I12", "I13", "D01", "D02", "D03", "D04", "D05", "D06", "D07", "D08", "D09", "D10", "D11", "D12", "D13", "D14", "D15", "D16", "D17", "D18", "D19", "D20", "U01", "U02", "U03", "U04", "U05", "U06", "U07", "U08", "U09", "U10", "U11", "U22", "K02", "B01", "B02", "B06", "B07", "T01", "T02", "T03", "T04", "T05", "L01", "L02", "L03", "L04", "L05", "L06"];
|
|
5
5
|
export type ConsoleV4ScreenId = TuiScreenId;
|
|
6
6
|
type Overlay = 'help' | 'exit' | 'discard' | 'sessionNavigation' | undefined;
|
|
7
7
|
export declare function resolveConsoleV4ScreenId(snapshot: TuiControllerSnapshot, controller: TuiController, overlay?: Overlay, tooSmall?: boolean, searchMode?: boolean): ConsoleV4ScreenId;
|