@lesliechan721/aw 0.1.0-beta.60 → 0.1.0-beta.62
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/validate-plugin.mjs +56 -9
- package/dist/authoring/scripts/validate-plugin.mjs.map +1 -1
- package/dist/scripts/aw-skill-eval-materializer.js +3 -0
- package/dist/scripts/aw-skill-eval-materializer.js.map +1 -1
- package/dist/scripts/test-plugin-scripts.js +20 -1
- package/dist/scripts/test-plugin-scripts.js.map +1 -1
- package/dist/src/commands/aw-capabilities.d.ts +1 -1
- package/dist/src/commands/aw-capabilities.js +1 -0
- package/dist/src/commands/aw-capabilities.js.map +1 -1
- package/dist/src/commands/rebuild-command.js +25 -26
- package/dist/src/commands/rebuild-command.js.map +1 -1
- package/dist/src/commands/rebuild-integration.d.ts +2 -0
- package/dist/src/commands/rebuild-integration.js +23 -7
- package/dist/src/commands/rebuild-integration.js.map +1 -1
- package/dist/src/commands/review-inspection.js +38 -5
- package/dist/src/commands/review-inspection.js.map +1 -1
- package/dist/src/commands/review-preparation.js +1 -0
- package/dist/src/commands/review-preparation.js.map +1 -1
- package/dist/src/generators/local-plugin.js +7 -5
- package/dist/src/generators/local-plugin.js.map +1 -1
- package/dist/src/portable/materializer.js +3 -0
- package/dist/src/portable/materializer.js.map +1 -1
- package/dist/src/review/review-profile.d.ts +1 -0
- package/dist/src/review/review-profile.js +44 -8
- package/dist/src/review/review-profile.js.map +1 -1
- package/dist/src/review/review-selection.js +19 -6
- package/dist/src/review/review-selection.js.map +1 -1
- package/dist/src/review/skill-materialization.d.ts +1 -0
- package/dist/src/review/skill-materialization.js +2 -0
- package/dist/src/review/skill-materialization.js.map +1 -1
- package/dist/src/review/source-binding.d.ts +5 -0
- package/dist/src/review/source-binding.js +83 -22
- package/dist/src/review/source-binding.js.map +1 -1
- package/dist/src/tui/config-leaf-editor.d.ts +24 -0
- package/dist/src/tui/config-leaf-editor.js +19 -7
- package/dist/src/tui/config-leaf-editor.js.map +1 -1
- package/dist/src/tui/config-references.d.ts +1 -0
- package/dist/src/tui/config-references.js +8 -1
- package/dist/src/tui/config-references.js.map +1 -1
- package/dist/src/tui/console-app-v4.js +77 -17
- package/dist/src/tui/console-app-v4.js.map +1 -1
- package/dist/src/tui/controller-runtime.d.ts +1 -1
- package/dist/src/tui/controller-runtime.js +119 -91
- package/dist/src/tui/controller-runtime.js.map +1 -1
- package/dist/src/tui/controller.d.ts +3 -0
- package/dist/src/tui/controller.js +19 -0
- package/dist/src/tui/controller.js.map +1 -1
- package/dist/src/tui/model.js +1 -1
- package/dist/src/tui/model.js.map +1 -1
- package/dist/src/tui/operation-review-planner.js +13 -8
- package/dist/src/tui/operation-review-planner.js.map +1 -1
- package/dist/src/utils/artifact-renderer.d.ts +8 -1
- package/dist/src/utils/artifact-renderer.js +25 -7
- package/dist/src/utils/artifact-renderer.js.map +1 -1
- package/dist/src/utils/managed-command-materialization.d.ts +2 -0
- package/dist/src/utils/managed-command-materialization.js +2 -1
- package/dist/src/utils/managed-command-materialization.js.map +1 -1
- package/dist/src/utils/plugin-config-impact.d.ts +15 -0
- package/dist/src/utils/plugin-config-impact.js +132 -24
- package/dist/src/utils/plugin-config-impact.js.map +1 -1
- package/dist/src/utils/plugin-config-references.d.ts +80 -0
- package/dist/src/utils/plugin-config-references.js +340 -0
- package/dist/src/utils/plugin-config-references.js.map +1 -0
- package/dist/src/utils/plugin-config-write.js +148 -31
- package/dist/src/utils/plugin-config-write.js.map +1 -1
- package/dist/src/utils/plugin-config.d.ts +10 -2
- package/dist/src/utils/plugin-config.js +53 -4
- package/dist/src/utils/plugin-config.js.map +1 -1
- package/dist/src/utils/plugin-scripts.d.ts +1 -0
- package/dist/src/utils/plugin-scripts.js +1 -1
- package/dist/src/utils/plugin-scripts.js.map +1 -1
- package/dist/src/utils/runtime-config.js +1 -0
- package/dist/src/utils/runtime-config.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { configReferenceKey, configReferenceValues, configReferenceScalars, configReferenceSelection, configReferenceMessage, configCrossLayerDependencies } from './config-references.js';
|
|
2
|
+
import { configReferenceKey, configReferenceValues, configReferenceScalars, configReferenceSelection, configReferenceMessage, configReferenceSource, configCrossLayerDependencies } from './config-references.js';
|
|
3
3
|
import { arrayDraftChanged, arrayDraftValue, createConfigArrayDraft, editConfigArrayDraft } from './config-array-draft.js';
|
|
4
4
|
import { PLUGIN_CONFIG_ARRAY_MAX_ITEMS } from '@lesliechan721/aw-plugin-core';
|
|
5
5
|
import { presentConfigValue, safeConfigText } from './config-value-presentation.js';
|
|
@@ -1074,6 +1074,8 @@ export function ConsoleAppV4(props) {
|
|
|
1074
1074
|
});
|
|
1075
1075
|
const externalDraftFlowIds = useRef(new Map());
|
|
1076
1076
|
const configOverviewAnchors = useRef(new Map());
|
|
1077
|
+
const suspendedConfigDrafts = useRef(new Map());
|
|
1078
|
+
const referenceLeafDrafts = useRef(new Map());
|
|
1077
1079
|
const exitSent = useRef(false);
|
|
1078
1080
|
const operationBusy = useRef(false);
|
|
1079
1081
|
const route = snapshot.router.current.route;
|
|
@@ -1384,6 +1386,10 @@ export function ConsoleAppV4(props) {
|
|
|
1384
1386
|
if (currentFlowId && sourceDraft)
|
|
1385
1387
|
externalDraftFlowIds.current.set(sourceDraft.owner, currentFlowId);
|
|
1386
1388
|
const drafts = [];
|
|
1389
|
+
for (const suspended of suspendedConfigDrafts.current.values()) {
|
|
1390
|
+
if (suspended.externalDraft)
|
|
1391
|
+
drafts.push(suspended.externalDraft);
|
|
1392
|
+
}
|
|
1387
1393
|
if ((dirty || configCandidate && !configCandidate.selectingScope || nestedPropertyRevision || objectVariantPreview || Object.values(arrayDrafts).some((draft) => draft.initial === undefined ? draft.rows.length > 0 : arrayDraftChanged(draft)) || changedObjectDraftKeys.length > 0) && draftOwner) {
|
|
1388
1394
|
const flowId = externalDraftFlowIds.current.get(draftOwner);
|
|
1389
1395
|
drafts.push({
|
|
@@ -1410,8 +1416,9 @@ export function ConsoleAppV4(props) {
|
|
|
1410
1416
|
configDrafts, configCandidate, arrayDrafts, objectDrafts, nestedPropertyRevision, objectVariantPreview, route.name, snapshot.router.currentFlowId, sourceDraft,
|
|
1411
1417
|
]);
|
|
1412
1418
|
useEffect(() => () => props.controller.setExternalDraftState(), [props.controller]);
|
|
1419
|
+
const currentLayerPage = configRoute && configRoute.layer.scope !== 'effective' ? configLayerPages[configRoute.layer.scope] : undefined;
|
|
1413
1420
|
const currentConfigPage = configPageMatches(configPage, configRoute) ? configPage
|
|
1414
|
-
:
|
|
1421
|
+
: configPageMatches(currentLayerPage, configRoute) ? currentLayerPage : undefined;
|
|
1415
1422
|
const hasReferenceFields = (configPage ?? configLayerPages.user ?? configLayerPages.project)?.groups
|
|
1416
1423
|
.some((group) => group.fields.some((field) => configReferenceScalars(field.definition).length > 0)) ?? false;
|
|
1417
1424
|
useEffect(() => {
|
|
@@ -1447,9 +1454,16 @@ export function ConsoleAppV4(props) {
|
|
|
1447
1454
|
.map((field) => [field.key, field]));
|
|
1448
1455
|
for (const [key, value] of Object.entries(draft.updates)) {
|
|
1449
1456
|
const field = fields.get(key);
|
|
1457
|
+
const invalidReferences = field ? configReferenceValues(field.definition, value)
|
|
1458
|
+
.filter(({ scalar, value: selected }) => {
|
|
1459
|
+
const reference = referenceContexts[draftScope]?.selections[configReferenceKey(scalar)];
|
|
1460
|
+
return reference !== undefined && (reference.issues.length > 0
|
|
1461
|
+
|| !reference.choices.some((choice) => choice.value === selected));
|
|
1462
|
+
}).map(({ scalar }) => configReferenceSource(scalar)) : [];
|
|
1450
1463
|
if (!field || !configFieldCanSet(field)
|
|
1451
|
-
|| validatePluginConfigValue(field.definition, value, key).length > 0
|
|
1452
|
-
|
|
1464
|
+
|| validatePluginConfigValue(field.definition, value, key).length > 0
|
|
1465
|
+
|| invalidReferences.length > 0) {
|
|
1466
|
+
issues.push({ scope: draftScope, key, source: 'update', referenceSources: invalidReferences });
|
|
1453
1467
|
}
|
|
1454
1468
|
}
|
|
1455
1469
|
for (const key of draft.removes) {
|
|
@@ -1492,13 +1506,17 @@ export function ConsoleAppV4(props) {
|
|
|
1492
1506
|
if (draftOwner !== owner) {
|
|
1493
1507
|
setDraftOwner(owner);
|
|
1494
1508
|
if (draftOwner !== undefined) {
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1509
|
+
const suspended = suspendedConfigDrafts.current.get(owner);
|
|
1510
|
+
suspendedConfigDrafts.current.delete(owner);
|
|
1511
|
+
setConfigDrafts(suspended?.drafts ?? {});
|
|
1512
|
+
setConfigCandidate(suspended?.candidate);
|
|
1513
|
+
setObjectDrafts(suspended?.objects ?? {});
|
|
1514
|
+
setArrayDrafts(suspended?.arrays ?? {});
|
|
1515
|
+
setChangedObjectDraftKeys(suspended?.changedObjects ?? []);
|
|
1516
|
+
if (suspended)
|
|
1517
|
+
setInputValue(suspended.input);
|
|
1500
1518
|
setObjectError(undefined);
|
|
1501
|
-
setDirty(false);
|
|
1519
|
+
setDirty(suspended?.dirty ?? false);
|
|
1502
1520
|
setConfigActionError(undefined);
|
|
1503
1521
|
}
|
|
1504
1522
|
}
|
|
@@ -1842,13 +1860,31 @@ export function ConsoleAppV4(props) {
|
|
|
1842
1860
|
const activePropertyIsConst = activePropertyDefinition && 'const' in activePropertyDefinition && activePropertyDefinition.const !== undefined;
|
|
1843
1861
|
const referenceNotice = (scalar, value) => {
|
|
1844
1862
|
const selection = referenceContext?.selections[configReferenceKey(scalar)];
|
|
1845
|
-
const message = referenceContextError && !selection ?
|
|
1863
|
+
const message = referenceContextError && !selection ? `来源 ${configReferenceSource(scalar)}:${referenceContextError}`
|
|
1864
|
+
: configReferenceMessage(scalar, selection, value);
|
|
1846
1865
|
const source = 'valueRef' in scalar ? scalar.valueRef.field : '';
|
|
1847
|
-
const pendingSource = editingScope === 'project' && selection?.source !== 'project'
|
|
1866
|
+
const pendingSource = !('valueRef' in scalar && scalar.valueRef?.plugin) && editingScope === 'project' && selection?.source !== 'project'
|
|
1848
1867
|
&& (Object.hasOwn(configDrafts.user?.updates ?? {}, source) || configDrafts.user?.removes.includes(source));
|
|
1849
1868
|
return [message, pendingSource ? `来源 ${source} 在个人默认有未保存修改。请先保存来源配置,再编辑或保存引用配置。` : undefined]
|
|
1850
1869
|
.filter(Boolean).join(' ') || undefined;
|
|
1851
1870
|
};
|
|
1871
|
+
const openReferenceSource = (scalar, leaf) => {
|
|
1872
|
+
const ref = 'valueRef' in scalar ? scalar.valueRef : undefined;
|
|
1873
|
+
if (!ref?.plugin || !configRoute || !draftOwner)
|
|
1874
|
+
return;
|
|
1875
|
+
props.controller.updatePageContext({ focusIndex: focus, scrollOffset });
|
|
1876
|
+
if (leaf)
|
|
1877
|
+
referenceLeafDrafts.current.set(snapshot.router.currentFrameId, leaf);
|
|
1878
|
+
suspendedConfigDrafts.current.set(draftOwner, {
|
|
1879
|
+
drafts: configDrafts, candidate: configCandidate, arrays: arrayDrafts, objects: objectDrafts,
|
|
1880
|
+
changedObjects: changedObjectDraftKeys, dirty, input: inputValue,
|
|
1881
|
+
externalDraft: props.controller.externalDrafts.find((draft) => draft.kind === 'configDraft' && draft.owner === draftOwner),
|
|
1882
|
+
});
|
|
1883
|
+
const sourceId = configRoute.pluginId.split('/')[0];
|
|
1884
|
+
props.controller.beginConfigReferenceSource(`${sourceId}/${ref.plugin}`, ref.field);
|
|
1885
|
+
setFocus(0);
|
|
1886
|
+
setScrollOffset(0);
|
|
1887
|
+
};
|
|
1852
1888
|
useEffect(() => {
|
|
1853
1889
|
if (route.name !== 'configFieldEditor' || !activeField)
|
|
1854
1890
|
return;
|
|
@@ -3196,6 +3232,16 @@ export function ConsoleAppV4(props) {
|
|
|
3196
3232
|
const updateObjectProperty = (propertyKey, value) => {
|
|
3197
3233
|
if (!activeField || activeField.definition.type !== 'object' || !activeObjectDraft)
|
|
3198
3234
|
return false;
|
|
3235
|
+
const definition = activeObjectProperties?.[propertyKey] ?? activeField.definition.additionalProperties;
|
|
3236
|
+
if (definition && value !== undefined) {
|
|
3237
|
+
for (const { scalar, value: selected } of configReferenceValues(definition, value)) {
|
|
3238
|
+
const reference = referenceContext?.selections[configReferenceKey(scalar)];
|
|
3239
|
+
if (!reference || reference.issues.length || !reference.choices.some((choice) => choice.value === selected)) {
|
|
3240
|
+
setInputError(referenceNotice(scalar, selected) ?? '引用选项已变化,请重新选择。');
|
|
3241
|
+
return false;
|
|
3242
|
+
}
|
|
3243
|
+
}
|
|
3244
|
+
}
|
|
3199
3245
|
const candidate = { ...activeObjectDraft, [propertyKey]: value };
|
|
3200
3246
|
if (value === undefined)
|
|
3201
3247
|
delete candidate[propertyKey];
|
|
@@ -5915,7 +5961,8 @@ export function ConsoleAppV4(props) {
|
|
|
5915
5961
|
? currentConfigPage.groups.find((group) => group.id === activeTab.id)
|
|
5916
5962
|
: undefined;
|
|
5917
5963
|
if (configDraftIssues.length > 0) {
|
|
5918
|
-
|
|
5964
|
+
const sources = [...new Set(configDraftIssues.flatMap((issue) => issue.referenceSources ?? []))];
|
|
5965
|
+
description = `${description ?? ''} 有 ${configDraftIssues.length} 项未保存修改已不适用于当前设置。${sources.length ? ` 请检查来源 ${sources.join('、')}。` : ''}`;
|
|
5919
5966
|
}
|
|
5920
5967
|
const mutableLayer = { scope: 'effective' };
|
|
5921
5968
|
const tabActions = activeTab?.kind === 'presets'
|
|
@@ -6140,10 +6187,13 @@ export function ConsoleAppV4(props) {
|
|
|
6140
6187
|
const selection = configReferenceSelection(referenceContext, scalarReference);
|
|
6141
6188
|
const current = arrayItem ? itemValue : draftUpdates[activeField.key] ?? activeField.draftValue ?? activeField.value;
|
|
6142
6189
|
title = `选择${activeField.title}`;
|
|
6143
|
-
description = referenceNotice(scalarReference, current) ?? `选项来自 ${scalarReference
|
|
6190
|
+
description = referenceNotice(scalarReference, current) ?? `选项来自 ${configReferenceSource(scalarReference)};保存到${editingScope === 'user' ? '个人默认' : '当前项目'}。`;
|
|
6144
6191
|
help = '↑↓ 移动 · Enter 使用 · Esc 返回修复来源';
|
|
6145
6192
|
actions = selection.choices.map((choice) => ({ label: safeConfigText(choice.title), selected: choice.value === current,
|
|
6146
6193
|
run: () => updateDraft(activeField.key, choice.value) }));
|
|
6194
|
+
if (scalarReference.valueRef.plugin)
|
|
6195
|
+
actions.push({ label: `编辑来源 ${configReferenceSource(scalarReference)}`,
|
|
6196
|
+
run: () => openReferenceSource(scalarReference) });
|
|
6147
6197
|
content = _jsx(SemanticRows, { actions: [...actions], focus: focus, kind: "choice", compact: policy.mode === 'compact' });
|
|
6148
6198
|
}
|
|
6149
6199
|
else if ('const' in activeField.definition && activeField.definition.const !== undefined) {
|
|
@@ -6370,11 +6420,14 @@ export function ConsoleAppV4(props) {
|
|
|
6370
6420
|
const selection = configReferenceSelection(referenceContext, definition);
|
|
6371
6421
|
const current = activeObjectDraft[property];
|
|
6372
6422
|
title = `选择${propertyTitle}`;
|
|
6373
|
-
description = referenceNotice(definition, current) ?? `选项来自 ${definition
|
|
6423
|
+
description = referenceNotice(definition, current) ?? `选项来自 ${configReferenceSource(definition)}。`;
|
|
6374
6424
|
help = '↑↓ 移动 · Enter 使用 · Esc 返回修复来源';
|
|
6375
6425
|
actions = selection.choices.map((choice) => ({ label: safeConfigText(choice.title), selected: choice.value === current,
|
|
6376
6426
|
run: () => { if (updateObjectProperty(property, choice.value))
|
|
6377
6427
|
back(); } }));
|
|
6428
|
+
if (definition.valueRef.plugin)
|
|
6429
|
+
actions.push({ label: `编辑来源 ${configReferenceSource(definition)}`,
|
|
6430
|
+
run: () => openReferenceSource(definition) });
|
|
6378
6431
|
content = _jsx(SemanticRows, { actions: [...actions], focus: focus, kind: "choice", compact: policy.mode === 'compact' });
|
|
6379
6432
|
}
|
|
6380
6433
|
else if (property !== undefined && definition && 'const' in definition && definition.const !== undefined) {
|
|
@@ -6477,8 +6530,13 @@ export function ConsoleAppV4(props) {
|
|
|
6477
6530
|
title = `编辑${propertyTitle}`;
|
|
6478
6531
|
description = '确认后更新当前对象草稿;Esc 取消此属性的全部修改。';
|
|
6479
6532
|
help = '↑↓ 移动 · Enter 编辑 · a 操作 · c 使用 · Esc 取消';
|
|
6480
|
-
content = _jsx(ConfigLeafEditor, { definition: definition, value: activeObjectDraft[property], propertyKey: property, referenceContext: referenceContext, referenceNotice: referenceNotice, columns: size.columns, rowBudget: pageActionBudget(1), active: !overlay && !tooSmall && !busy, error: inputError, onDraftChange: setNestedPropertyRevision, onCancel: back, onConfirm: (value) => {
|
|
6481
|
-
|
|
6533
|
+
content = _jsx(ConfigLeafEditor, { definition: definition, value: activeObjectDraft[property], propertyKey: property, referenceContext: referenceContext, referenceNotice: referenceNotice, initialDraft: referenceLeafDrafts.current.get(snapshot.router.currentFrameId), onOpenReferenceSource: openReferenceSource, columns: size.columns, rowBudget: pageActionBudget(1), active: !overlay && !tooSmall && !busy, error: inputError, onDraftChange: setNestedPropertyRevision, onCancel: () => { referenceLeafDrafts.current.delete(snapshot.router.currentFrameId); back(); }, onConfirm: (value) => {
|
|
6534
|
+
if (!updateObjectProperty(property, value))
|
|
6535
|
+
return false;
|
|
6536
|
+
referenceLeafDrafts.current.delete(snapshot.router.currentFrameId);
|
|
6537
|
+
back();
|
|
6538
|
+
return true;
|
|
6539
|
+
} }, `${snapshot.router.currentFrameId}:${property}`);
|
|
6482
6540
|
}
|
|
6483
6541
|
else if (property !== undefined && definition) {
|
|
6484
6542
|
title = activePropertySensitive ? '输入敏感值' : `输入${propertyTitle}`;
|
|
@@ -9427,6 +9485,8 @@ export function ConsoleAppV4(props) {
|
|
|
9427
9485
|
}).catch((error) => showSafeUiFailure(error, 'tuiSessionNavigationFailed', 'session-navigation'));
|
|
9428
9486
|
}
|
|
9429
9487
|
function clearExternalDraftValues() {
|
|
9488
|
+
suspendedConfigDrafts.current.clear();
|
|
9489
|
+
referenceLeafDrafts.current.clear();
|
|
9430
9490
|
setDirty(false);
|
|
9431
9491
|
setConfigDrafts({});
|
|
9432
9492
|
setConfigCandidate(undefined);
|