@lesliechan721/aw 0.1.0-beta.14 → 0.1.0-beta.16

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.
Files changed (49) hide show
  1. package/dist/src/commands/aw-capabilities.d.ts +1 -1
  2. package/dist/src/commands/aw-capabilities.js +1 -0
  3. package/dist/src/commands/aw-capabilities.js.map +1 -1
  4. package/dist/src/commands/review-inspection.d.ts +169 -0
  5. package/dist/src/commands/review-inspection.js +916 -0
  6. package/dist/src/commands/review-inspection.js.map +1 -0
  7. package/dist/src/commands/skill-eval.d.ts +5 -0
  8. package/dist/src/commands/skill-eval.js +86 -63
  9. package/dist/src/commands/skill-eval.js.map +1 -1
  10. package/dist/src/commands/status-v6.d.ts +2 -1
  11. package/dist/src/commands/status-v6.js +7 -1
  12. package/dist/src/commands/status-v6.js.map +1 -1
  13. package/dist/src/eval/manifest-v1.js +0 -5
  14. package/dist/src/eval/manifest-v1.js.map +1 -1
  15. package/dist/src/index.js +39 -6
  16. package/dist/src/index.js.map +1 -1
  17. package/dist/src/portable/commands.d.ts +1 -0
  18. package/dist/src/portable/commands.js +43 -1
  19. package/dist/src/portable/commands.js.map +1 -1
  20. package/dist/src/portable/materializer.d.ts +12 -0
  21. package/dist/src/portable/materializer.js +67 -41
  22. package/dist/src/portable/materializer.js.map +1 -1
  23. package/dist/src/review/eval-source-input.d.ts +43 -0
  24. package/dist/src/review/eval-source-input.js +207 -0
  25. package/dist/src/review/eval-source-input.js.map +1 -0
  26. package/dist/src/review/source-binding.d.ts +170 -0
  27. package/dist/src/review/source-binding.js +622 -0
  28. package/dist/src/review/source-binding.js.map +1 -0
  29. package/dist/src/tui/console-app-v4.js +523 -133
  30. package/dist/src/tui/console-app-v4.js.map +1 -1
  31. package/dist/src/tui/controller-runtime.js +59 -37
  32. package/dist/src/tui/controller-runtime.js.map +1 -1
  33. package/dist/src/tui/controller.d.ts +15 -1
  34. package/dist/src/tui/controller.js +86 -3
  35. package/dist/src/tui/controller.js.map +1 -1
  36. package/dist/src/tui/model.js +2 -3
  37. package/dist/src/tui/model.js.map +1 -1
  38. package/dist/src/tui/operation-review-planner.js +22 -1
  39. package/dist/src/tui/operation-review-planner.js.map +1 -1
  40. package/dist/src/tui/plugin-write-task.d.ts +2 -1
  41. package/dist/src/tui/plugin-write-task.js +17 -0
  42. package/dist/src/tui/plugin-write-task.js.map +1 -1
  43. package/dist/src/tui/router.d.ts +1 -0
  44. package/dist/src/tui/router.js +13 -5
  45. package/dist/src/tui/router.js.map +1 -1
  46. package/dist/src/tui/screen-registry.d.ts +21 -1
  47. package/dist/src/tui/screen-registry.js +5 -1
  48. package/dist/src/tui/screen-registry.js.map +1 -1
  49. 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
- && this.#resultAnchor.pluginId === pluginId) {
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)));