@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.
Files changed (47) hide show
  1. package/dist/authoring/scripts/lib/plugin-version-check.mjs +1 -1
  2. package/dist/authoring/scripts/validate-plugin.mjs +5 -2
  3. package/dist/authoring/scripts/validate-plugin.mjs.map +1 -1
  4. package/dist/src/commands/aw-capabilities.d.ts +1 -1
  5. package/dist/src/commands/aw-capabilities.js +2 -0
  6. package/dist/src/commands/aw-capabilities.js.map +1 -1
  7. package/dist/src/commands/rebuild-operations.js +1 -0
  8. package/dist/src/commands/rebuild-operations.js.map +1 -1
  9. package/dist/src/tui/catalog-sources/session.d.ts +5 -1
  10. package/dist/src/tui/catalog-sources/session.js +6 -1
  11. package/dist/src/tui/catalog-sources/session.js.map +1 -1
  12. package/dist/src/tui/catalog-sources/types.d.ts +1 -0
  13. package/dist/src/tui/components.d.ts +1 -11
  14. package/dist/src/tui/components.js +9 -41
  15. package/dist/src/tui/components.js.map +1 -1
  16. package/dist/src/tui/config-value-presentation.d.ts +19 -0
  17. package/dist/src/tui/config-value-presentation.js +77 -0
  18. package/dist/src/tui/config-value-presentation.js.map +1 -0
  19. package/dist/src/tui/console-app-v4.d.ts +1 -1
  20. package/dist/src/tui/console-app-v4.js +885 -1121
  21. package/dist/src/tui/console-app-v4.js.map +1 -1
  22. package/dist/src/tui/controller.d.ts +8 -0
  23. package/dist/src/tui/controller.js +85 -18
  24. package/dist/src/tui/controller.js.map +1 -1
  25. package/dist/src/tui/diagnostics.d.ts +2 -1
  26. package/dist/src/tui/diagnostics.js +8 -1
  27. package/dist/src/tui/diagnostics.js.map +1 -1
  28. package/dist/src/tui/input-display.d.ts +1 -0
  29. package/dist/src/tui/input-display.js +13 -0
  30. package/dist/src/tui/input-display.js.map +1 -1
  31. package/dist/src/tui/model.d.ts +3 -2
  32. package/dist/src/tui/model.js +17 -33
  33. package/dist/src/tui/model.js.map +1 -1
  34. package/dist/src/tui/operation-diagnostic-screens.d.ts +5 -3
  35. package/dist/src/tui/operation-diagnostic-screens.js +26 -9
  36. package/dist/src/tui/operation-diagnostic-screens.js.map +1 -1
  37. package/dist/src/tui/operation-history.js +5 -4
  38. package/dist/src/tui/operation-history.js.map +1 -1
  39. package/dist/src/tui/router.d.ts +4 -6
  40. package/dist/src/tui/router.js.map +1 -1
  41. package/dist/src/tui/screen-registry.d.ts +10 -19
  42. package/dist/src/tui/screen-registry.js +3 -4
  43. package/dist/src/tui/screen-registry.js.map +1 -1
  44. package/dist/src/tui/viewport.d.ts +1 -0
  45. package/dist/src/tui/viewport.js +23 -0
  46. package/dist/src/tui/viewport.js.map +1 -1
  47. package/package.json +3 -3
@@ -408,6 +408,14 @@ export interface OperationReviewModel {
408
408
  blockedTargetCount: number;
409
409
  causeCount: number;
410
410
  };
411
+ rootSummary?: Array<{
412
+ pluginId: string;
413
+ version?: string;
414
+ targets: Array<{
415
+ platform: PlatformName | 'both';
416
+ scope: Scope;
417
+ }>;
418
+ }>;
411
419
  }
412
420
  export type ReviewPreparationStageId = 'refresh' | 'validate' | 'status' | 'catalog' | 'inventory' | 'dependencyPlan' | 'config' | 'portable' | 'evidence';
413
421
  export interface ReviewPreparationStage {
@@ -768,8 +768,11 @@ export class TuiController {
768
768
  this.#project();
769
769
  this.#publish();
770
770
  },
771
- onError: (error, code) => {
771
+ onError: (error, code, context) => {
772
772
  void this.#logErrorSafe(error, code);
773
+ return this.#recordStandaloneFailure(code, context.fullValidation
774
+ ? 'validate-catalog-source'
775
+ : context.automatic ? 'auto-check-catalog-source' : 'check-catalog-source', error);
773
776
  },
774
777
  now: this.dependencies.now,
775
778
  });
@@ -1284,14 +1287,10 @@ export class TuiController {
1284
1287
  #stableResultRoute(intent, result) {
1285
1288
  const active = this.#router.activeFlow();
1286
1289
  if (intent.kind === 'pluginWriteTask' && active?.kind === 'pluginWriteTask'
1287
- && (active.parentFlowId || active.returnTarget.name === 'pluginWriteTask'
1288
- && active.returnTarget.goal !== intent.goal)) {
1290
+ && active.returnTarget.name === 'pluginWriteTask'
1291
+ && active.returnTarget.goal !== intent.goal) {
1289
1292
  return this.#normalizeRoute(active.returnTarget);
1290
1293
  }
1291
- const completedPluginId = completedSinglePluginId(intent, result);
1292
- if (completedPluginId) {
1293
- return this.#normalizeRoute({ name: 'pluginDetail', pluginId: completedPluginId });
1294
- }
1295
1294
  if (intent.kind === 'pluginWriteTask'
1296
1295
  && result.state === 'succeeded'
1297
1296
  && 'returnRoute' in result
@@ -1300,6 +1299,14 @@ export class TuiController {
1300
1299
  && result.returnRoute.batchOrigin?.owner === 'batch-write') {
1301
1300
  return { name: 'pluginList', mode: 'installed' };
1302
1301
  }
1302
+ const completedPluginId = completedSinglePluginId(intent, result);
1303
+ if (completedPluginId) {
1304
+ return this.#normalizeRoute({ name: 'pluginDetail', pluginId: completedPluginId });
1305
+ }
1306
+ if (intent.kind === 'pluginWriteTask' && active?.kind === 'pluginWriteTask'
1307
+ && active.parentFlowId) {
1308
+ return this.#normalizeRoute(active.returnTarget);
1309
+ }
1303
1310
  if (intent.kind === 'portableInstall' && result.state === 'succeeded') {
1304
1311
  return this.#normalizeRoute({ name: 'pluginDetail', pluginId: intent.pluginId });
1305
1312
  }
@@ -1556,13 +1563,19 @@ export class TuiController {
1556
1563
  if (!this.hasPortableSkills(pluginId)) {
1557
1564
  throw new TuiOperationBlockedError('portableUnsupported', '插件不提供通用 Skills。');
1558
1565
  }
1566
+ const requestKey = `prepare:${pluginId}`;
1567
+ if (this.#portablePending?.key === requestKey) {
1568
+ return this.#portablePending.promise;
1569
+ }
1559
1570
  this.#router.beginPortableFlow(pluginId);
1571
+ this.#router[navigation]({ name: 'portablePreparing', pluginId });
1572
+ this.#publish();
1560
1573
  const expectedRoute = this.#router.snapshot.current.route;
1561
- return this.#runPortableRequest(`prepare:${pluginId}`, async (signal, token) => {
1574
+ return this.#runPortableRequest(requestKey, async (signal, token) => {
1562
1575
  const draft = await this.#buildPortableDraft(pluginId, false, signal);
1563
1576
  this.#assertPortableRequestCurrent(token, expectedRoute);
1564
1577
  this.#portableDraft = draft;
1565
- this.#router[navigation]({ name: 'portableSkillSelect', pluginId });
1578
+ this.#router.replace({ name: 'portableSkillSelect', pluginId });
1566
1579
  this.#publish();
1567
1580
  return cloneFrozen(draft);
1568
1581
  });
@@ -1573,6 +1586,10 @@ export class TuiController {
1573
1586
  return this.#runPortableRequest(`refresh:${pluginId}`, async (signal, token) => {
1574
1587
  const draft = await this.#buildPortableDraft(pluginId, true, signal);
1575
1588
  this.#assertPortableRequestCurrent(token, expectedRoute);
1589
+ if (this.#activeReview?.operationKind === 'portableInstall') {
1590
+ this.#tickets.delete(this.#activeReview.reviewToken);
1591
+ this.#activeReview = undefined;
1592
+ }
1576
1593
  this.#portableDraft = draft;
1577
1594
  this.#publish();
1578
1595
  return cloneFrozen(draft);
@@ -1990,9 +2007,15 @@ export class TuiController {
1990
2007
  this.#tickets.delete(this.#activeReview.reviewToken);
1991
2008
  this.#activeReview = undefined;
1992
2009
  }
1993
- this.#router.back();
1994
- if (activeFlow
2010
+ if (route.name === 'batchSelection' && activeFlow?.kind === 'batchWrite'
1995
2011
  && this.#router.snapshot.currentFrameId === activeFlow.originFrameId) {
2012
+ this.#router.finishFlow();
2013
+ }
2014
+ else
2015
+ this.#router.back();
2016
+ if (activeFlow
2017
+ && this.#router.snapshot.currentFrameId === activeFlow.originFrameId
2018
+ && this.#router.snapshot.currentFlowId !== activeFlow.id) {
1996
2019
  this.#router.abandonFlow(activeFlow.id);
1997
2020
  if (activeFlow.kind === 'pluginInstall')
1998
2021
  this.#installPlacementDraft = undefined;
@@ -2107,8 +2130,8 @@ export class TuiController {
2107
2130
  || route.name === 'operationReportPreview';
2108
2131
  if (readOnlyHistoryRoute && this.#router.activeFlow()?.kind === 'portableInstall')
2109
2132
  return;
2110
- const portableRoute = route.name === 'portableSkillSelect'
2111
- || route.name === 'portableSkillSummary'
2133
+ const portableRoute = route.name === 'portablePreparing'
2134
+ || route.name === 'portableSkillSelect'
2112
2135
  || route.name === 'portableDependencies'
2113
2136
  || route.name === 'portableAgentMode'
2114
2137
  || route.name === 'portableAgentInput'
@@ -2306,7 +2329,10 @@ export class TuiController {
2306
2329
  }
2307
2330
  : undefined;
2308
2331
  this.#publish();
2309
- return draft.targets.some((target) => !target.locked);
2332
+ const editableDependencies = draft.targets.filter((target) => !target.locked);
2333
+ return editableDependencies.some((target) => draft.targets.some((candidate) => candidate.pluginId === target.pluginId
2334
+ && candidate.platform !== target.platform
2335
+ && candidate.scope !== target.scope));
2310
2336
  }
2311
2337
  catch (error) {
2312
2338
  if (error instanceof Error && error.name === 'AbortError')
@@ -2616,7 +2642,16 @@ export class TuiController {
2616
2642
  }
2617
2643
  recheckCatalogSource(sourceId) {
2618
2644
  this.#assertAcceptingActions();
2619
- return this.#catalogSourcesSession.recheck(sourceId);
2645
+ return this.#catalogSourcesSession.refresh(sourceId, this.#sourceCheckNeedsFullValidation(sourceId));
2646
+ }
2647
+ #sourceCheckNeedsFullValidation(sourceId) {
2648
+ const generation = this.#catalogGenerations.get(sourceId);
2649
+ const freshness = this.#catalogFreshness.get(sourceId);
2650
+ const activeReady = generation?.state === 'ready';
2651
+ return !activeReady
2652
+ || freshness?.state === 'incompatible'
2653
+ || freshness?.state === 'versionConflict'
2654
+ || freshness?.state === 'rollbackDetected';
2620
2655
  }
2621
2656
  async recheckAllCatalogSources() {
2622
2657
  this.#assertAcceptingActions();
@@ -2627,8 +2662,9 @@ export class TuiController {
2627
2662
  const worker = async () => {
2628
2663
  while (next < sourceIds.length) {
2629
2664
  const sourceId = sourceIds[next++];
2630
- if (sourceId)
2631
- await this.#catalogSourcesSession.recheck(sourceId);
2665
+ if (sourceId) {
2666
+ await this.#catalogSourcesSession.refresh(sourceId, this.#sourceCheckNeedsFullValidation(sourceId));
2667
+ }
2632
2668
  }
2633
2669
  };
2634
2670
  await Promise.all(Array.from({ length: Math.min(2, sourceIds.length) }, () => worker()));
@@ -2645,7 +2681,7 @@ export class TuiController {
2645
2681
  beginPluginWriteBatch() {
2646
2682
  this.#assertAcceptingActions();
2647
2683
  this.#router.beginBatchFlow();
2648
- this.#router.push({ name: 'batchSelection' });
2684
+ this.#router.replace({ name: 'batchSelection' }, this.#router.snapshot.current.context);
2649
2685
  this.#publish();
2650
2686
  }
2651
2687
  startPluginWriteBatchReview(intent) {
@@ -3210,6 +3246,36 @@ export class TuiController {
3210
3246
  ? evidence.source?.pluginVersion
3211
3247
  ?? this.#viewModel?.plugins.find((plugin) => plugin.pluginId === intent.pluginId)?.version
3212
3248
  : undefined;
3249
+ const rootSummary = intent.kind === 'pluginWriteTask'
3250
+ ? [...new Set(evidence.taskPlan.requestedTargets
3251
+ .map((target) => target.pluginId))].map((rootPluginId) => {
3252
+ const targets = evidence.taskPlan.requestedTargets
3253
+ .filter((target) => target.pluginId === rootPluginId);
3254
+ const versions = [...new Set(targets.flatMap((target) => target.expectedUpdate?.activeVersion ? [target.expectedUpdate.activeVersion] : []))];
3255
+ return {
3256
+ pluginId: rootPluginId,
3257
+ ...(versions.length === 1 ? { version: versions[0] } : {}),
3258
+ targets: targets.map(({ platform, scope }) => ({ platform, scope })),
3259
+ };
3260
+ })
3261
+ : intent.kind === 'pluginWriteBatch'
3262
+ ? evidence.requestedPluginIds.map((rootPluginId) => {
3263
+ const batchEvidence = evidence;
3264
+ const targetVersions = batchEvidence.targetVersions?.filter((target) => target.pluginId === rootPluginId) ?? [];
3265
+ const versions = [...new Set(targetVersions.flatMap((target) => {
3266
+ const version = intent.action === 'uninstall'
3267
+ ? target.installedVersion
3268
+ : target.availableVersion ?? target.installedVersion;
3269
+ return version ? [version] : [];
3270
+ }))];
3271
+ return {
3272
+ pluginId: rootPluginId,
3273
+ ...(versions.length === 1 ? { version: versions[0] } : {}),
3274
+ targets: batchEvidence.groups.filter((group) => group.requestedPluginIds.includes(rootPluginId))
3275
+ .map(({ platform, scope }) => ({ platform, scope })),
3276
+ };
3277
+ })
3278
+ : undefined;
3213
3279
  const review = {
3214
3280
  operationId,
3215
3281
  reviewToken,
@@ -3250,6 +3316,7 @@ export class TuiController {
3250
3316
  causeCount: evidence.taskPlan.causes.length,
3251
3317
  },
3252
3318
  } : {}),
3319
+ ...(rootSummary && rootSummary.length > 0 ? { rootSummary } : {}),
3253
3320
  ...(evidence.source && 'catalogVersion' in evidence.source
3254
3321
  && typeof evidence.source.catalogVersion === 'string'
3255
3322
  && evidence.source.snapshotDigest