@lesliechan721/aw 0.1.0-beta.14 → 0.1.0-beta.15
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/src/commands/status-v6.d.ts +2 -1
- package/dist/src/commands/status-v6.js +7 -1
- package/dist/src/commands/status-v6.js.map +1 -1
- package/dist/src/tui/console-app-v4.js +523 -133
- package/dist/src/tui/console-app-v4.js.map +1 -1
- package/dist/src/tui/controller-runtime.js +59 -37
- package/dist/src/tui/controller-runtime.js.map +1 -1
- package/dist/src/tui/controller.d.ts +15 -1
- package/dist/src/tui/controller.js +86 -3
- package/dist/src/tui/controller.js.map +1 -1
- package/dist/src/tui/model.js +2 -3
- package/dist/src/tui/model.js.map +1 -1
- package/dist/src/tui/operation-review-planner.js +22 -1
- package/dist/src/tui/operation-review-planner.js.map +1 -1
- package/dist/src/tui/plugin-write-task.d.ts +2 -1
- package/dist/src/tui/plugin-write-task.js +17 -0
- package/dist/src/tui/plugin-write-task.js.map +1 -1
- package/dist/src/tui/router.d.ts +1 -0
- package/dist/src/tui/router.js +13 -5
- package/dist/src/tui/router.js.map +1 -1
- package/dist/src/tui/screen-registry.d.ts +21 -1
- package/dist/src/tui/screen-registry.js +5 -1
- package/dist/src/tui/screen-registry.js.map +1 -1
- package/package.json +3 -3
|
@@ -3,7 +3,7 @@ import type { CatalogActivationMode, CatalogSource, CatalogGenerationActiveV1, C
|
|
|
3
3
|
import type { PortableReview } from '../portable/commands.js';
|
|
4
4
|
import type { CatalogSourceUpdate } from '../utils/catalog-sources.js';
|
|
5
5
|
import type { CatalogGenerationFreshnessState, CatalogGenerationFreshnessResult } from '../utils/catalog-generation-service.js';
|
|
6
|
-
import type { StatusV7Payload, StatusV7PluginSummary, StatusTargetRevision } from '../commands/status-v6.js';
|
|
6
|
+
import type { StatusV7Payload, StatusV7PluginSummary, StatusV7Target, StatusTargetRevision } from '../commands/status-v6.js';
|
|
7
7
|
import type { ReconcileOperationPlan } from '../commands/reconcile-operation-plan.js';
|
|
8
8
|
import type { RebuildCommandResult } from '../commands/rebuild-command.js';
|
|
9
9
|
import type { OfflineCleanupTargetEvidence } from '../commands/offline-cleanup-evidence.js';
|
|
@@ -42,6 +42,7 @@ export interface PluginWriteBatchTarget {
|
|
|
42
42
|
platform: PlatformName;
|
|
43
43
|
scope: Scope;
|
|
44
44
|
}
|
|
45
|
+
export declare function pluginWriteBatchTargets(action: Exclude<BatchPluginWriteAction, 'install'>, pluginIds: readonly string[], statusTargets: readonly StatusV7Target[]): PluginWriteBatchTarget[];
|
|
45
46
|
export interface PluginWriteBatchIntent {
|
|
46
47
|
kind: 'pluginWriteBatch';
|
|
47
48
|
action: BatchPluginWriteAction;
|
|
@@ -62,6 +63,11 @@ export interface PluginWriteBatchGroupEvidence {
|
|
|
62
63
|
export interface PluginWriteBatchEvidence extends OperationEvidence {
|
|
63
64
|
requestedPluginIds: string[];
|
|
64
65
|
groups: PluginWriteBatchGroupEvidence[];
|
|
66
|
+
targetVersions?: Array<PluginWriteBatchTarget & {
|
|
67
|
+
presence: 'new' | 'installed' | 'unknown';
|
|
68
|
+
installedVersion?: string;
|
|
69
|
+
availableVersion?: string;
|
|
70
|
+
}>;
|
|
65
71
|
}
|
|
66
72
|
export interface PluginWriteBatchGroupResult {
|
|
67
73
|
groupId: string;
|
|
@@ -757,6 +763,8 @@ export declare class TuiController {
|
|
|
757
763
|
installFilter?: PluginInstallFilter;
|
|
758
764
|
}): PluginListItemViewModel[];
|
|
759
765
|
getPluginOverview(pluginId: string): PluginListItemViewModel | undefined;
|
|
766
|
+
listCurrentProjectIntentRoots(): string[];
|
|
767
|
+
listPluginWriteBatchTargets(action: Exclude<BatchPluginWriteAction, 'install'>, pluginIds: readonly string[]): PluginWriteBatchTarget[];
|
|
760
768
|
getPluginDependencyOverview(pluginId: string): PluginDependencyOverviewViewModel | undefined;
|
|
761
769
|
listPluginDependencyOverviews(): PluginDependencyOverviewViewModel[];
|
|
762
770
|
getBlockingDependents(pluginId: string, platform: PlatformName, scope: Scope): PluginDependencyOverviewViewModel['dependents'];
|
|
@@ -779,6 +787,12 @@ export declare class TuiController {
|
|
|
779
787
|
beginPluginWriteBatch(): void;
|
|
780
788
|
startPluginWriteBatchReview(intent: PluginWriteBatchIntent): ReviewPreparationSnapshot;
|
|
781
789
|
startPluginWriteTaskReview(intent: PluginWriteTaskIntent, returnRoute?: TuiRoute): ReviewPreparationSnapshot;
|
|
790
|
+
beginNestedPluginWriteTask(route: Extract<TuiRoute, {
|
|
791
|
+
name: 'pluginWriteTask';
|
|
792
|
+
}>): void;
|
|
793
|
+
pluginWriteTaskReturnRoute(route: Extract<TuiRoute, {
|
|
794
|
+
name: 'pluginWriteTask';
|
|
795
|
+
}>): TuiRoute;
|
|
782
796
|
retryFailedPluginWriteBatch(): ReviewPreparationSnapshot | undefined;
|
|
783
797
|
retryFailedPluginWriteTask(): ReviewPreparationSnapshot | undefined;
|
|
784
798
|
catalogActivationBlockReason(): CatalogActivationBlockReason | undefined;
|
|
@@ -2,6 +2,7 @@ import crypto from 'node:crypto';
|
|
|
2
2
|
import { CatalogManagementError, } from './catalog-management.js';
|
|
3
3
|
import { CatalogGenerationError } from '../utils/catalog-generation-error.js';
|
|
4
4
|
import { readSafeOperationError } from '../utils/safe-operation-diagnostic.js';
|
|
5
|
+
import { statusTargetActivation, statusTargetIntent, statusTargetOwnershipState, } from '../commands/status-v6.js';
|
|
5
6
|
import { buildRebuildReceiptJson, requestedIntentAction } from '../output/command-receipt.js';
|
|
6
7
|
import { buildOperationResultModel } from '../commands/operation-planner.js';
|
|
7
8
|
import { buildOperationReviewProjection } from './operation-review-planner.js';
|
|
@@ -22,6 +23,57 @@ export const PLUGIN_WRITE_BATCH_ACTIONS = [
|
|
|
22
23
|
'uninstall',
|
|
23
24
|
'cleanup',
|
|
24
25
|
];
|
|
26
|
+
export function pluginWriteBatchTargets(action, pluginIds, statusTargets) {
|
|
27
|
+
const selected = new Set(pluginIds);
|
|
28
|
+
const targets = [];
|
|
29
|
+
const add = (target, scope) => {
|
|
30
|
+
targets.push({ pluginId: target.pluginId, platform: target.platform, scope });
|
|
31
|
+
};
|
|
32
|
+
for (const target of statusTargets) {
|
|
33
|
+
if (!selected.has(target.pluginId))
|
|
34
|
+
continue;
|
|
35
|
+
const intent = statusTargetIntent(target);
|
|
36
|
+
const ownership = statusTargetOwnershipState(target);
|
|
37
|
+
const activation = statusTargetActivation(target);
|
|
38
|
+
const hasManagedOutput = ownership !== 'absent';
|
|
39
|
+
const hasCleanupEvidence = ownership === 'present' || ownership === 'partial'
|
|
40
|
+
|| intent.relation === 'managed';
|
|
41
|
+
if (action === 'sync' || action === 'reinstall') {
|
|
42
|
+
intent.scopes.forEach((scope) => add(target, scope));
|
|
43
|
+
if (hasManagedOutput)
|
|
44
|
+
add(target, target.scope);
|
|
45
|
+
if (target.platform === 'codex') {
|
|
46
|
+
if (activation?.user === true)
|
|
47
|
+
add(target, 'user');
|
|
48
|
+
if (activation?.project === true)
|
|
49
|
+
add(target, 'project');
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
else if (action === 'uninstall') {
|
|
53
|
+
if (hasManagedOutput)
|
|
54
|
+
add(target, target.scope);
|
|
55
|
+
if (target.platform === 'codex') {
|
|
56
|
+
if (activation?.user === true)
|
|
57
|
+
add(target, 'user');
|
|
58
|
+
if (activation?.project === true)
|
|
59
|
+
add(target, 'project');
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
else if (hasCleanupEvidence) {
|
|
63
|
+
add(target, target.scope);
|
|
64
|
+
if (target.platform === 'codex') {
|
|
65
|
+
if (activation?.user === true)
|
|
66
|
+
add(target, 'user');
|
|
67
|
+
if (activation?.project === true)
|
|
68
|
+
add(target, 'project');
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return [...new Map(targets.map((target) => [
|
|
73
|
+
[target.pluginId, target.platform, target.scope].join('\0'), target,
|
|
74
|
+
])).values()].sort((left, right) => [left.pluginId, left.platform, left.scope].join('\0')
|
|
75
|
+
.localeCompare([right.pluginId, right.platform, right.scope].join('\0'), 'en'));
|
|
76
|
+
}
|
|
25
77
|
function reviewPreparationStageLabel(stage) {
|
|
26
78
|
return {
|
|
27
79
|
refresh: '刷新相关来源',
|
|
@@ -1466,8 +1518,11 @@ export class TuiController {
|
|
|
1466
1518
|
return origin;
|
|
1467
1519
|
if (this.#router.snapshot.current.route.name === 'result'
|
|
1468
1520
|
&& this.#resultAnchor
|
|
1469
|
-
&& (this.#resultAnchor.name === 'pluginPreview' || this.#resultAnchor.name === 'pluginDetail'
|
|
1470
|
-
|
|
1521
|
+
&& (this.#resultAnchor.name === 'pluginPreview' || this.#resultAnchor.name === 'pluginDetail'
|
|
1522
|
+
|| this.#resultAnchor.name === 'pluginWriteTask')
|
|
1523
|
+
&& (this.#resultAnchor.pluginId === pluginId
|
|
1524
|
+
|| this.#resultAnchor.name === 'pluginWriteTask'
|
|
1525
|
+
&& this.#resultAnchor.targetKeys?.some((key) => key.startsWith(`${pluginId}\0`)))) {
|
|
1471
1526
|
return structuredClone(this.#resultAnchor);
|
|
1472
1527
|
}
|
|
1473
1528
|
return undefined;
|
|
@@ -1842,6 +1897,16 @@ export class TuiController {
|
|
|
1842
1897
|
const plugin = this.#viewModel?.plugins.find((entry) => entry.pluginId === pluginId);
|
|
1843
1898
|
return plugin ? cloneFrozen(plugin) : undefined;
|
|
1844
1899
|
}
|
|
1900
|
+
listCurrentProjectIntentRoots() {
|
|
1901
|
+
return cloneFrozen([...new Set((this.#status?.payload.targets ?? []).flatMap((target) => {
|
|
1902
|
+
const intent = statusTargetIntent(target);
|
|
1903
|
+
return intent.relation === 'root' && intent.scopes.includes('project')
|
|
1904
|
+
? [target.pluginId] : [];
|
|
1905
|
+
}))].sort((left, right) => left.localeCompare(right, 'en')));
|
|
1906
|
+
}
|
|
1907
|
+
listPluginWriteBatchTargets(action, pluginIds) {
|
|
1908
|
+
return cloneFrozen(pluginWriteBatchTargets(action, pluginIds, this.#status?.payload.targets ?? []));
|
|
1909
|
+
}
|
|
1845
1910
|
getPluginDependencyOverview(pluginId) {
|
|
1846
1911
|
const overview = this.#viewModel?.dependencyOverviews.find((entry) => entry.pluginId === pluginId);
|
|
1847
1912
|
return overview ? cloneFrozen(overview) : undefined;
|
|
@@ -1990,6 +2055,23 @@ export class TuiController {
|
|
|
1990
2055
|
startPluginWriteTaskReview(intent, returnRoute) {
|
|
1991
2056
|
return this.startReviewPreparation(intent, returnRoute);
|
|
1992
2057
|
}
|
|
2058
|
+
beginNestedPluginWriteTask(route) {
|
|
2059
|
+
this.#assertAcceptingActions();
|
|
2060
|
+
const current = this.#router.snapshot.current.route;
|
|
2061
|
+
if (current.name !== 'pluginWriteTask') {
|
|
2062
|
+
throw new TuiOperationBlockedError('taskOriginUnavailable', '嵌套任务缺少父任务。');
|
|
2063
|
+
}
|
|
2064
|
+
this.#router.beginFlow('pluginWriteTask', current);
|
|
2065
|
+
this.#router.push(route);
|
|
2066
|
+
this.#publish();
|
|
2067
|
+
}
|
|
2068
|
+
pluginWriteTaskReturnRoute(route) {
|
|
2069
|
+
const active = this.#router.activeFlow();
|
|
2070
|
+
return structuredClone(active?.kind === 'pluginWriteTask'
|
|
2071
|
+
&& active.returnTarget.name === 'pluginWriteTask'
|
|
2072
|
+
? active.returnTarget
|
|
2073
|
+
: route);
|
|
2074
|
+
}
|
|
1993
2075
|
retryFailedPluginWriteBatch() {
|
|
1994
2076
|
if (!this.#batchRetryIntent)
|
|
1995
2077
|
return undefined;
|
|
@@ -2026,7 +2108,8 @@ export class TuiController {
|
|
|
2026
2108
|
&& route.targetKeys !== undefined
|
|
2027
2109
|
&& route.targetKeys.length > 0
|
|
2028
2110
|
&& route.batchOrigin !== undefined
|
|
2029
|
-
&& activeFlow?.id === route.batchOrigin.flowId
|
|
2111
|
+
&& (activeFlow?.id === route.batchOrigin.flowId
|
|
2112
|
+
|| activeFlow?.parentFlowId === route.batchOrigin.flowId)
|
|
2030
2113
|
&& this.listPluginWriteTaskCandidates(route.goal).some((candidate) => candidate.sourceId === intent.sourceId
|
|
2031
2114
|
&& candidate.blockReason === 'catalogActivationRequired'
|
|
2032
2115
|
&& route.targetKeys.includes(pluginWriteTaskTargetKey(candidate.target)));
|