@lesliechan721/aw 0.1.0-beta.83 → 0.1.0-beta.84

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 (179) hide show
  1. package/dist/authoring/assets/aw-runtime-config.mjs +1 -1
  2. package/dist/authoring/assets/aw-runtime-config.mjs.map +1 -1
  3. package/dist/src/commands/console.js +1 -0
  4. package/dist/src/commands/console.js.map +1 -1
  5. package/dist/src/commands/intent-command.d.ts +1 -0
  6. package/dist/src/commands/intent-command.js +6 -2
  7. package/dist/src/commands/intent-command.js.map +1 -1
  8. package/dist/src/commands/plugin-capabilities.js +3 -3
  9. package/dist/src/commands/plugin-capabilities.js.map +1 -1
  10. package/dist/src/commands/public-lifecycle-result.d.ts +11 -5
  11. package/dist/src/commands/public-lifecycle-result.js +131 -46
  12. package/dist/src/commands/public-lifecycle-result.js.map +1 -1
  13. package/dist/src/commands/public-lifecycle.d.ts +1 -2
  14. package/dist/src/commands/public-lifecycle.js +56 -34
  15. package/dist/src/commands/public-lifecycle.js.map +1 -1
  16. package/dist/src/commands/public-plugin-query.js +28 -11
  17. package/dist/src/commands/public-plugin-query.js.map +1 -1
  18. package/dist/src/commands/rebuild-command.d.ts +13 -3
  19. package/dist/src/commands/rebuild-command.js +647 -286
  20. package/dist/src/commands/rebuild-command.js.map +1 -1
  21. package/dist/src/commands/rebuild-integration.d.ts +5 -2
  22. package/dist/src/commands/rebuild-integration.js +55 -29
  23. package/dist/src/commands/rebuild-integration.js.map +1 -1
  24. package/dist/src/commands/rebuild-operations.d.ts +1 -0
  25. package/dist/src/commands/rebuild-operations.js +23 -4
  26. package/dist/src/commands/rebuild-operations.js.map +1 -1
  27. package/dist/src/commands/rebuild-platform-integration.d.ts +13 -3
  28. package/dist/src/commands/rebuild-platform-integration.js +229 -133
  29. package/dist/src/commands/rebuild-platform-integration.js.map +1 -1
  30. package/dist/src/index.js +105 -50
  31. package/dist/src/index.js.map +1 -1
  32. package/dist/src/output/public-result.d.ts +2 -0
  33. package/dist/src/output/public-result.js +43 -6
  34. package/dist/src/output/public-result.js.map +1 -1
  35. package/dist/src/output/rebuild-progress.d.ts +3 -0
  36. package/dist/src/output/rebuild-progress.js +12 -2
  37. package/dist/src/output/rebuild-progress.js.map +1 -1
  38. package/dist/src/output/receipt-projection.js +55 -18
  39. package/dist/src/output/receipt-projection.js.map +1 -1
  40. package/dist/src/output/skill-invocation-notices.d.ts +16 -0
  41. package/dist/src/output/skill-invocation-notices.js +48 -0
  42. package/dist/src/output/skill-invocation-notices.js.map +1 -0
  43. package/dist/src/platforms/capabilities.d.ts +2 -0
  44. package/dist/src/platforms/capabilities.js +73 -34
  45. package/dist/src/platforms/capabilities.js.map +1 -1
  46. package/dist/src/platforms/contracts.d.ts +9 -9
  47. package/dist/src/platforms/discovery.d.ts +0 -7
  48. package/dist/src/platforms/discovery.js +13 -53
  49. package/dist/src/platforms/discovery.js.map +1 -1
  50. package/dist/src/platforms/inspection-native.js +1 -80
  51. package/dist/src/platforms/inspection-native.js.map +1 -1
  52. package/dist/src/platforms/inspection-query.d.ts +2 -3
  53. package/dist/src/platforms/inspection-query.js +7 -18
  54. package/dist/src/platforms/inspection-query.js.map +1 -1
  55. package/dist/src/platforms/inspection.js +2 -2
  56. package/dist/src/platforms/inspection.js.map +1 -1
  57. package/dist/src/platforms/layout.js +1 -5
  58. package/dist/src/platforms/layout.js.map +1 -1
  59. package/dist/src/platforms/lifecycle-native-services.d.ts +1 -1
  60. package/dist/src/platforms/lifecycle-native-services.js +14 -14
  61. package/dist/src/platforms/lifecycle-native-services.js.map +1 -1
  62. package/dist/src/platforms/lifecycle-native.js +4 -88
  63. package/dist/src/platforms/lifecycle-native.js.map +1 -1
  64. package/dist/src/platforms/lifecycle.js +56 -56
  65. package/dist/src/platforms/lifecycle.js.map +1 -1
  66. package/dist/src/platforms/projection-code-extension.js +7 -3
  67. package/dist/src/platforms/projection-code-extension.js.map +1 -1
  68. package/dist/src/platforms/projection.d.ts +3 -0
  69. package/dist/src/platforms/projection.js +86 -54
  70. package/dist/src/platforms/projection.js.map +1 -1
  71. package/dist/src/portable/materializer.js +2 -2
  72. package/dist/src/portable/materializer.js.map +1 -1
  73. package/dist/src/portable/recovery.d.ts +29 -3
  74. package/dist/src/portable/recovery.js +220 -78
  75. package/dist/src/portable/recovery.js.map +1 -1
  76. package/dist/src/recovery/coordinator.d.ts +18 -4
  77. package/dist/src/recovery/coordinator.js +357 -165
  78. package/dist/src/recovery/coordinator.js.map +1 -1
  79. package/dist/src/recovery/install-concurrency.d.ts +48 -0
  80. package/dist/src/recovery/install-concurrency.js +195 -0
  81. package/dist/src/recovery/install-concurrency.js.map +1 -0
  82. package/dist/src/recovery/interruption.d.ts +19 -0
  83. package/dist/src/recovery/interruption.js +43 -0
  84. package/dist/src/recovery/interruption.js.map +1 -0
  85. package/dist/src/recovery/joint-coordinator.d.ts +11 -4
  86. package/dist/src/recovery/joint-coordinator.js +671 -333
  87. package/dist/src/recovery/joint-coordinator.js.map +1 -1
  88. package/dist/src/recovery/joint-demand.d.ts +8 -0
  89. package/dist/src/recovery/joint-demand.js +52 -1
  90. package/dist/src/recovery/joint-demand.js.map +1 -1
  91. package/dist/src/recovery/joint-install-execution.d.ts +19 -0
  92. package/dist/src/recovery/joint-install-execution.js +307 -0
  93. package/dist/src/recovery/joint-install-execution.js.map +1 -0
  94. package/dist/src/recovery/joint-install-native-rebase.d.ts +4 -0
  95. package/dist/src/recovery/joint-install-native-rebase.js +67 -0
  96. package/dist/src/recovery/joint-install-native-rebase.js.map +1 -0
  97. package/dist/src/recovery/receipt.d.ts +20 -0
  98. package/dist/src/recovery/receipt.js +67 -1
  99. package/dist/src/recovery/receipt.js.map +1 -1
  100. package/dist/src/recovery/retirement.js +1 -1
  101. package/dist/src/recovery/retirement.js.map +1 -1
  102. package/dist/src/recovery/status.js +26 -27
  103. package/dist/src/recovery/status.js.map +1 -1
  104. package/dist/src/review/platform-profile.d.ts +4 -1
  105. package/dist/src/review/platform-profile.js +13 -4
  106. package/dist/src/review/platform-profile.js.map +1 -1
  107. package/dist/src/review/skill-materialization.d.ts +1 -0
  108. package/dist/src/review/skill-materialization.js +28 -16
  109. package/dist/src/review/skill-materialization.js.map +1 -1
  110. package/dist/src/review/source-binding.js +6 -4
  111. package/dist/src/review/source-binding.js.map +1 -1
  112. package/dist/src/tui/console-app-v4.d.ts +1 -1
  113. package/dist/src/tui/console-app-v4.js +137 -57
  114. package/dist/src/tui/console-app-v4.js.map +1 -1
  115. package/dist/src/tui/controller-runtime.js +45 -9
  116. package/dist/src/tui/controller-runtime.js.map +1 -1
  117. package/dist/src/tui/controller.d.ts +13 -4
  118. package/dist/src/tui/controller.js +233 -102
  119. package/dist/src/tui/controller.js.map +1 -1
  120. package/dist/src/tui/deployment-view.js +6 -1
  121. package/dist/src/tui/deployment-view.js.map +1 -1
  122. package/dist/src/tui/diagnostic-projection.d.ts +4 -2
  123. package/dist/src/tui/diagnostic-projection.js +40 -4
  124. package/dist/src/tui/diagnostic-projection.js.map +1 -1
  125. package/dist/src/tui/operation-diagnostic-screens.d.ts +1 -1
  126. package/dist/src/tui/operation-diagnostic-screens.js +3 -1
  127. package/dist/src/tui/operation-diagnostic-screens.js.map +1 -1
  128. package/dist/src/tui/operation-history.d.ts +6 -3
  129. package/dist/src/tui/operation-history.js +15 -2
  130. package/dist/src/tui/operation-history.js.map +1 -1
  131. package/dist/src/tui/scoped-flow.d.ts +3 -1
  132. package/dist/src/tui/scoped-flow.js +99 -1
  133. package/dist/src/tui/scoped-flow.js.map +1 -1
  134. package/dist/src/tui/session-console-app.d.ts +2 -0
  135. package/dist/src/tui/session-console-app.js +11 -0
  136. package/dist/src/tui/session-console-app.js.map +1 -1
  137. package/dist/src/types.d.ts +8 -1
  138. package/dist/src/types.js.map +1 -1
  139. package/dist/src/utils/aw-home-mutation-lock.js +2 -1
  140. package/dist/src/utils/aw-home-mutation-lock.js.map +1 -1
  141. package/dist/src/utils/catalog-source-references.js +2 -14
  142. package/dist/src/utils/catalog-source-references.js.map +1 -1
  143. package/dist/src/utils/component-resources.js +1 -1
  144. package/dist/src/utils/component-resources.js.map +1 -1
  145. package/dist/src/utils/managed-command-materialization.d.ts +2 -1
  146. package/dist/src/utils/managed-command-materialization.js +3 -3
  147. package/dist/src/utils/managed-command-materialization.js.map +1 -1
  148. package/dist/src/utils/managed-command-store.d.ts +6 -0
  149. package/dist/src/utils/managed-command-store.js +90 -18
  150. package/dist/src/utils/managed-command-store.js.map +1 -1
  151. package/dist/src/utils/multi-source-catalog.d.ts +2 -0
  152. package/dist/src/utils/multi-source-catalog.js +3 -2
  153. package/dist/src/utils/multi-source-catalog.js.map +1 -1
  154. package/dist/src/utils/native-cli.d.ts +0 -19
  155. package/dist/src/utils/native-cli.js +2 -42
  156. package/dist/src/utils/native-cli.js.map +1 -1
  157. package/dist/src/utils/ownership.js +1 -1
  158. package/dist/src/utils/ownership.js.map +1 -1
  159. package/dist/src/utils/platform-empty-state.d.ts +1 -3
  160. package/dist/src/utils/platform-empty-state.js +1 -6
  161. package/dist/src/utils/platform-empty-state.js.map +1 -1
  162. package/dist/src/utils/plugin-config-write.d.ts +8 -0
  163. package/dist/src/utils/plugin-config-write.js +89 -25
  164. package/dist/src/utils/plugin-config-write.js.map +1 -1
  165. package/dist/src/utils/plugin-scripts.js +5 -0
  166. package/dist/src/utils/plugin-scripts.js.map +1 -1
  167. package/dist/src/utils/skill-invocation-warning.d.ts +15 -0
  168. package/dist/src/utils/skill-invocation-warning.js +42 -0
  169. package/dist/src/utils/skill-invocation-warning.js.map +1 -0
  170. package/package.json +3 -3
  171. package/dist/src/output/native-consent.d.ts +0 -2
  172. package/dist/src/output/native-consent.js +0 -5
  173. package/dist/src/output/native-consent.js.map +0 -1
  174. package/dist/src/platforms/gemini-activation.d.ts +0 -36
  175. package/dist/src/platforms/gemini-activation.js +0 -331
  176. package/dist/src/platforms/gemini-activation.js.map +0 -1
  177. package/dist/src/platforms/gemini-consent.d.ts +0 -8
  178. package/dist/src/platforms/gemini-consent.js +0 -81
  179. package/dist/src/platforms/gemini-consent.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  import type { ConfigReferenceContext, ConfigReferenceDraft } from './config-references.js';
2
- import type { CatalogActivationMode, CatalogSource, CatalogGenerationActiveV1, CatalogGenerationCandidateEvidence, CatalogGenerationSyncResult, CatalogSourceImpact, CommandProducerResult, DependencyScopeOverride, PlatformName, PlatformTarget, Scope } from '../types.js';
2
+ import type { CatalogActivationMode, CatalogSource, CatalogGenerationActiveV1, CatalogGenerationCandidateEvidence, CatalogGenerationSyncResult, CatalogSourceImpact, CommandProducerResult, ConfigApplyResult, DependencyScopeOverride, PlatformName, PlatformTarget, Scope } from '../types.js';
3
3
  import type { PortableReview, PortableInstallReceipt, PortableRetryReview } 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';
@@ -11,12 +11,13 @@ import type { CodexReconcilePlan } from '../utils/codex-reconciler.js';
11
11
  import type { PluginConfigMutationImpact } from '../utils/plugin-config-impact.js';
12
12
  import type { OperationPlan } from '../commands/operation-plan.js';
13
13
  import type { RebuildProgressFeed, RebuildProgressSnapshot } from '../output/rebuild-progress.js';
14
+ import type { Diagnostic } from '../output/public-result.js';
14
15
  import { type ConfigPageViewModel, type ConfigProfileOptions, type ConfigReadOptions, type ConfigProfileKey, type ConfigGroupViewModel, type InstallPlacementDraftViewModel, type PluginListItemViewModel, type PluginDependencyOverviewViewModel, type PortableSkillSelectionViewModel, type SourceHealthViewModel, type SourceDetailViewModel, type TuiViewModel, type UserIssueCategory, type UserIssueViewModel } from './model.js';
15
16
  import type { PluginContentOverview } from './plugin-content.js';
16
17
  import { type PluginDetailSubject } from './plugin-detail.js';
17
18
  import { OperationHistoryStore, type OperationDiagnosticDetail, type OperationEffectFacts, type OperationHistorySummary, type OperationReportPreview, type SafeOperationDiagnostic, type SaveOperationReportResult } from './operation-history.js';
18
19
  import { type ScopedInventoryViewModel, type ScopedInventoryLoadResult, type InventoryRoot } from './scoped-inventory.js';
19
- import type { ScopedTuiPlan } from './scoped-flow.js';
20
+ import { type ScopedTuiPlan } from './scoped-flow.js';
20
21
  import type { RecoveryReceipt } from '../recovery/receipt.js';
21
22
  import type { RecoveryCommand } from '../recovery/coordinator.js';
22
23
  import type { AgentId } from '../intent/deployment-preferences.js';
@@ -152,10 +153,10 @@ export interface ConfigSaveBatchGroup {
152
153
  export interface ConfigSaveBatchGroupResult {
153
154
  scope: 'user';
154
155
  platform?: PlatformTarget;
155
- status: 'succeeded' | 'failed';
156
+ status: 'succeeded' | 'failed' | 'notStarted';
156
157
  configSaved: boolean;
157
158
  applyRequested: boolean;
158
- applyStatus: 'notRequested' | 'notNeeded' | 'succeeded' | 'failed';
159
+ applyStatus: 'notRequested' | 'notStarted' | 'notNeeded' | 'succeeded' | 'partial' | 'failed';
159
160
  errorCode?: string;
160
161
  execution?: unknown;
161
162
  }
@@ -556,6 +557,7 @@ export interface OperationResultSummary {
556
557
  elapsedMs?: number;
557
558
  messages?: string[];
558
559
  configApplied?: boolean;
560
+ configDiagnostics?: Diagnostic[];
559
561
  configApplySkippedReason?: 'invalidConfig';
560
562
  configScope?: Scope;
561
563
  configPlatform?: PlatformTarget;
@@ -565,9 +567,13 @@ export interface OperationResultSummary {
565
567
  platform: PlatformTarget;
566
568
  scope: Scope;
567
569
  state: 'completed' | 'kept' | 'failed' | 'skipped';
570
+ partialDelivery?: true;
568
571
  errorCode?: string;
572
+ diagnosticIds?: string[];
573
+ effects?: OperationEffectFacts;
569
574
  }>;
570
575
  configApplyRetryAvailable?: boolean;
576
+ configApplyRetryTargets?: PlatformTarget[];
571
577
  configRetryApply?: boolean;
572
578
  configGroups?: Array<{
573
579
  scope: Scope;
@@ -575,6 +581,8 @@ export interface OperationResultSummary {
575
581
  configSaved: boolean;
576
582
  applyRequested: boolean;
577
583
  applyStatus: ConfigSaveBatchGroupResult['applyStatus'];
584
+ notStarted?: true;
585
+ retryTargets?: PlatformTarget[];
578
586
  errorCode?: string;
579
587
  }>;
580
588
  resetDisposition?: 'absent' | 'deletedFile' | 'unlinkedSymlink' | 'quarantinedDirectory';
@@ -1026,3 +1034,4 @@ export declare class TuiController {
1026
1034
  executeOperation(reviewToken: string): Promise<OperationExecuteResult>;
1027
1035
  dispose(): void;
1028
1036
  }
1037
+ export declare function configApplyHasCompletedWork(apply: ConfigApplyResult | undefined): boolean;
@@ -4,18 +4,22 @@ import crypto from 'node:crypto';
4
4
  import { CatalogGenerationError } from '../utils/catalog-generation-error.js';
5
5
  import { readSafeOperationError } from '../utils/safe-operation-diagnostic.js';
6
6
  import { NativeCliError } from '../utils/native-cli.js';
7
+ import { ConfigApplyInterruptedError } from '../utils/plugin-config-write.js';
8
+ import { parsePluginId } from '../utils/multi-source-catalog.js';
7
9
  import { flattenStatusTargets, statusTargetActivation, statusTargetIntent, statusTargetOwnershipState, statusTargetSharedNative, } from '../commands/status-v6.js';
8
10
  import { buildRebuildReceiptJson, requestedIntentAction } from '../output/command-receipt.js';
11
+ import { SKILL_INVOCATION_NOTICE } from '../utils/skill-invocation-warning.js';
9
12
  import { buildOperationResultModel } from '../commands/operation-planner.js';
10
13
  import { buildOperationReviewProjection } from './operation-review-planner.js';
11
14
  import { buildTuiViewModel, dependencyPlacementTargets, hasScopedExtensionOwnership, } from './model.js';
12
15
  import { buildPluginDetailSubject } from './plugin-detail.js';
13
16
  import { safeDiagnosticCode, sanitizeDiagnosticText } from './diagnostics.js';
14
- import { projectExecutionDiagnostics, projectThrownOperationDiagnostic } from './diagnostic-projection.js';
17
+ import { projectExecutionDiagnostics, projectSkillInvocationHistory, projectThrownOperationDiagnostic } from './diagnostic-projection.js';
15
18
  import { OperationHistoryStore, } from './operation-history.js';
16
19
  import { targetHasArtifactCollision } from '../utils/target-eligibility.js';
17
20
  import { hasStatusInstallationEvidence } from './scoped-inventory.js';
18
21
  import { buildScopedInventory } from './scoped-inventory.js';
22
+ import { projectScopedRecoveryHistory } from './scoped-flow.js';
19
23
  import { TuiRouter, } from './router.js';
20
24
  import { normalizeTuiRoute } from './screen-registry.js';
21
25
  import { CatalogSourcesSession } from './catalog-sources/session.js';
@@ -401,6 +405,9 @@ function sanitizeOperationSummary(summary, sensitiveValues) {
401
405
  ...(summary.messages ? { messages: summary.messages.map(text) } : {}),
402
406
  ...(summary.changes ? { changes: summary.changes.map(text) } : {}),
403
407
  ...(summary.warnings ? { warnings: summary.warnings.map(text) } : {}),
408
+ ...(summary.configDiagnostics ? { configDiagnostics: summary.configDiagnostics.map((diagnostic) => ({
409
+ ...diagnostic, message: text(diagnostic.message),
410
+ })) } : {}),
404
411
  ...(summary.recoveryActions ? { recoveryActions: summary.recoveryActions.map(text) } : {}),
405
412
  ...(summary.commandResults ? { commandResults: summary.commandResults.map((result) => ({
406
413
  ...result,
@@ -718,7 +725,7 @@ export class TuiController {
718
725
  });
719
726
  if (progressFeed) {
720
727
  this.#progressUnsubscribe = progressFeed.subscribe((progress) => {
721
- if (this.#router.snapshot.current.route.name === 'result')
728
+ if (this.#router.snapshot.current.route.name === 'result' && !this.#scopedTaskInflight)
722
729
  return;
723
730
  this.#progress = {
724
731
  ...structuredClone(progress),
@@ -964,16 +971,20 @@ export class TuiController {
964
971
  finalVerification: result.state === 'succeeded' ? 'completed' : 'unknown',
965
972
  },
966
973
  };
967
- if ('summary' in result && result.summary) {
968
- Object.assign(result.summary, sanitizeOperationSummary(result.summary, projected.sensitiveValues ?? []));
969
- }
970
- const diagnosticIds = projected.diagnostics.map((diagnostic) => diagnostic.id);
974
+ const summary = 'summary' in result ? result.summary : undefined;
975
+ if (summary) {
976
+ Object.assign(summary, sanitizeOperationSummary(summary, projected.sensitiveValues ?? []));
977
+ }
978
+ const diagnostics = [...projected.diagnostics,
979
+ ...projectSkillInvocationHistory(summary?.configDiagnostics ?? [], recordId, 'apply')];
980
+ const diagnosticIds = diagnostics.map((diagnostic) => diagnostic.id);
981
+ const targets = summary ? summary.targets ?? summary.configTargets ?? [] : projected.targets ?? [];
971
982
  Object.assign(result, { operationRecordId: recordId, diagnosticIds, effects: projected.effects });
972
- if ('summary' in result && result.summary) {
973
- result.summary.diagnosticIds = diagnosticIds;
974
- result.summary.effects = projected.effects;
975
- for (const target of result.summary.targets ?? []) {
976
- const targetDiagnostics = projected.diagnostics.filter((diagnostic) => diagnostic.target
983
+ if (summary) {
984
+ summary.diagnosticIds = diagnosticIds;
985
+ summary.effects = projected.effects;
986
+ for (const target of targets) {
987
+ const targetDiagnostics = diagnostics.filter((diagnostic) => diagnostic.target
977
988
  && diagnostic.target.platform === target.platform
978
989
  && diagnostic.target.scope === target.scope
979
990
  && (diagnostic.target.pluginId === undefined || diagnostic.target.pluginId === target.pluginId));
@@ -996,16 +1007,11 @@ export class TuiController {
996
1007
  message,
997
1008
  ...('operationKind' in result && result.operationKind ? { operationKind: result.operationKind } : {}),
998
1009
  ...('pluginId' in result && result.pluginId ? { pluginId: result.pluginId } : {}),
999
- diagnosticCount: projected.diagnostics.length,
1010
+ diagnosticCount: diagnostics.length,
1000
1011
  effects: projected.effects,
1001
1012
  },
1002
- diagnostics: projected.diagnostics,
1003
- targets: 'summary' in result && result.summary
1004
- ? structuredClone((result.summary.targets ?? []).map((target) => ({
1005
- ...target,
1006
- diagnosticIds: target.diagnosticIds ?? [],
1007
- })))
1008
- : structuredClone(projected.targets ?? []),
1013
+ diagnostics,
1014
+ targets: targets.map((target) => ({ ...target, diagnosticIds: target.diagnosticIds ?? [] })),
1009
1015
  }, { sensitiveValues: projected.sensitiveValues });
1010
1016
  this.#operationDiagnostics.delete(result.operationId);
1011
1017
  this.#lastRecordedResultId = recordId;
@@ -1023,7 +1029,7 @@ export class TuiController {
1023
1029
  stage,
1024
1030
  fallbackCode: code,
1025
1031
  sensitiveValues,
1026
- ...(intent && 'pluginId' in intent && 'platform' in intent
1032
+ ...(!(error instanceof ConfigApplyInterruptedError) && intent && 'pluginId' in intent && 'platform' in intent
1027
1033
  && (intent.platform === 'codex' || intent.platform === 'claude')
1028
1034
  && (intent.scope === 'user' || intent.scope === 'project')
1029
1035
  ? { target: { pluginId: intent.pluginId, platform: intent.platform, scope: intent.scope } }
@@ -1661,9 +1667,29 @@ export class TuiController {
1661
1667
  this.#progressFeed?.clearCurrent();
1662
1668
  this.#progress = { messages: [], startedAtMs: this.dependencies.now?.() ?? Date.now() };
1663
1669
  this.#publish();
1664
- const promise = this.dependencies.executeScopedTask(plan).finally(() => {
1670
+ const isBatch = plan.kind === 'recovery' && (plan.plan.command === 'install' || plan.plan.command === 'sync')
1671
+ && plan.plan.receipt.requestedTargets.length > 1;
1672
+ const promise = this.dependencies.executeScopedTask(plan).then((outcome) => {
1673
+ const recordByDefault = isBatch || this.#progress.installProgress !== undefined;
1674
+ if (outcome.kind === 'recovery' && (recordByDefault || outcome.receipt.targetResults.some(({ reasons }) => reasons?.some(({ code }) => code === SKILL_INVOCATION_NOTICE)))) {
1675
+ const operationId = `scoped-${crypto.randomUUID()}`;
1676
+ const record = projectScopedRecoveryHistory(outcome.receipt, {
1677
+ operationId, recordId: `${this.#sessionEpoch}:${operationId}`, epoch: this.#sessionEpoch,
1678
+ createdAtMs: this.dependencies.now?.() ?? Date.now(),
1679
+ });
1680
+ if (recordByDefault || record.diagnostics.some(({ code }) => code === SKILL_INVOCATION_NOTICE)) {
1681
+ this.#operationHistory.record(record);
1682
+ }
1683
+ }
1684
+ return outcome;
1685
+ }, (error) => {
1686
+ if (isBatch || this.#progress.installProgress)
1687
+ this.#recordStandaloneFailure(issueCode(error), 'execute', error);
1688
+ throw error;
1689
+ }).finally(() => {
1665
1690
  if (this.#scopedTaskInflight?.promise === promise)
1666
1691
  this.#scopedTaskInflight = undefined;
1692
+ this.#publish();
1667
1693
  });
1668
1694
  this.#scopedTaskInflight = { plan, promise };
1669
1695
  return promise;
@@ -3881,20 +3907,21 @@ export class TuiController {
3881
3907
  || Array.isArray(execution.groups)
3882
3908
  && (execution.groups
3883
3909
  .some((group) => group.configSaved)));
3910
+ const configRetryReportedDelivery = ticket.intent.kind === 'configSave' && ticket.intent.retryApply
3911
+ && configApplyHasCompletedWork(configApplyResult(execution));
3884
3912
  if ((ticket.intent.kind === 'configSave' || ticket.intent.kind === 'configSaveBatch'
3885
- || ticket.intent.kind === 'configReset')
3886
- && configCommitted) {
3913
+ || ticket.intent.kind === 'configReset') && (configCommitted || configRetryReportedDelivery)) {
3887
3914
  const baseSummary = operationResultSummary(ticket.intent, execution);
3888
3915
  const elapsedMs = Math.max(0, (this.dependencies.now?.() ?? Date.now()) - startedAtMs);
3889
3916
  const summary = {
3890
3917
  ...baseSummary,
3891
3918
  code: 'operationPartial',
3892
- message: '设置已保存,但最终状态无法刷新。',
3919
+ message: configCommitted ? '设置已保存,但最终状态无法刷新。' : '部分插件内容已就绪,但最终状态无法刷新。',
3893
3920
  elapsedMs,
3894
3921
  messages: [
3895
3922
  ...this.#progress.messages,
3896
3923
  ...(baseSummary.messages ?? []),
3897
- '状态刷新失败。配置写入已经提交;请稍后刷新状态。',
3924
+ configCommitted ? '状态刷新失败。配置写入已经提交;请稍后刷新状态。' : '请稍后刷新状态。',
3898
3925
  ].slice(-8).map((message) => sanitizeDiagnosticText(message, [], collectOperationSensitiveValues(ticket.intent))),
3899
3926
  };
3900
3927
  this.#progress = { ...this.#progress, elapsedMs };
@@ -4117,9 +4144,11 @@ export class TuiController {
4117
4144
  catch (error) {
4118
4145
  if (!this.#operationIsCurrent(generation))
4119
4146
  return this.#detachedBlocked(operationId, ticket.intent);
4120
- const code = issueCode(error);
4147
+ const interruptedApply = error instanceof ConfigApplyInterruptedError ? error : undefined;
4148
+ const code = interruptedApply?.code ?? issueCode(error);
4121
4149
  const metadata = readSafeOperationError(error);
4122
4150
  const preApply = metadata?.stage === 'preApply';
4151
+ const applyCompletedWork = configApplyHasCompletedWork(interruptedApply?.apply);
4123
4152
  const configWrite = error && typeof error === 'object' && 'configWrite' in error
4124
4153
  ? error.configWrite : undefined;
4125
4154
  this.#captureThrownProjection(operationId, error, code, 'execute', ticket.intent, {
@@ -4130,6 +4159,18 @@ export class TuiController {
4130
4159
  preApplyExternalEffect: preApply ? 'possible' : 'notApplicable',
4131
4160
  finalVerification: 'notStarted',
4132
4161
  });
4162
+ if (interruptedApply) {
4163
+ const projected = this.#operationDiagnostics.get(operationId);
4164
+ const applyProjection = projectExecutionDiagnostics(interruptedApply, `${this.#sessionEpoch}:${operationId}:interrupted-apply`, projected.sensitiveValues, ticket.intent.kind);
4165
+ projected.diagnostics.push(...applyProjection.diagnostics);
4166
+ projected.effects = {
4167
+ ...applyProjection.effects,
4168
+ awWrite: applyCompletedWork ? 'partial' : projected.effects.awWrite,
4169
+ preApplyExternalEffect: preApply ? 'possible' : applyProjection.effects.preApplyExternalEffect,
4170
+ finalVerification: 'notStarted',
4171
+ };
4172
+ projected.targetEffects = applyProjection.targetEffects;
4173
+ }
4133
4174
  await this.#logOperationError(error, code, ticket.intent);
4134
4175
  if (!this.#operationIsCurrent(generation))
4135
4176
  return this.#detachedBlocked(operationId, ticket.intent);
@@ -4179,28 +4220,44 @@ export class TuiController {
4179
4220
  }
4180
4221
  if (!this.#operationIsCurrent(generation))
4181
4222
  return this.#detachedBlocked(operationId, ticket.intent);
4223
+ const applySummary = interruptedApply ? operationResultSummary(ticket.intent, interruptedApply) : undefined;
4224
+ const configMadeProgress = configWrite === 'succeeded' || applyCompletedWork;
4225
+ const retryTargets = configMadeProgress ? configApplyUnfinishedPlatforms(interruptedApply?.apply, ticket.intent.kind === 'configSave' ? ticket.intent.targets : undefined) : [];
4226
+ const interruptionMessage = interruptedApply
4227
+ ? configApplyInterruptionMessage(interruptedApply.code, retryTargets) : undefined;
4182
4228
  if ((ticket.intent.kind === 'configSave' || ticket.intent.kind === 'configReset')
4183
- && configWrite === 'succeeded') {
4229
+ && configMadeProgress) {
4184
4230
  const elapsedMs = Math.max(0, (this.dependencies.now?.() ?? Date.now()) - startedAtMs);
4185
4231
  const summary = {
4232
+ ...applySummary,
4186
4233
  code: 'operationPartial',
4187
4234
  message: ticket.intent.kind === 'configReset'
4188
4235
  ? '设置层重置已提交,但后续步骤未完成。'
4189
- : finalVerification === 'failed'
4190
- ? ticket.intent.apply
4191
- ? '设置已保存,但后续应用或状态复核失败。'
4192
- : '设置已保存,但状态复核失败。'
4193
- : ticket.intent.apply
4194
- ? '设置已保存,但后续应用失败。'
4195
- : '设置已保存,但后续步骤未完成。',
4236
+ : applyCompletedWork
4237
+ ? configWrite === 'succeeded' ? '设置已保存,部分插件内容已就绪。' : '部分插件内容已就绪。'
4238
+ : finalVerification === 'failed'
4239
+ ? ticket.intent.apply
4240
+ ? '设置已保存,但后续应用或状态复核失败。'
4241
+ : '设置已保存,但状态复核失败。'
4242
+ : ticket.intent.apply
4243
+ ? '设置已保存,但后续应用失败。'
4244
+ : '设置已保存,但后续步骤未完成。',
4196
4245
  pluginId: ticket.intent.pluginId,
4197
4246
  configScope: 'user', configPlatform: ticket.intent.platform, configContext: ticket.intent.context ?? 'user',
4247
+ ...(interruptedApply ? { configApplied: applyCompletedWork } : {}),
4198
4248
  ...(ticket.intent.kind === 'configSave' && ticket.intent.apply
4199
- ? { configApplyRetryAvailable: true } : {}),
4249
+ ? { configApplyRetryAvailable: !interruptedApply || retryTargets.length > 0 } : {}),
4250
+ ...(interruptedApply ? { configApplyRetryTargets: retryTargets } : {}),
4200
4251
  elapsedMs,
4201
- messages: [ticket.intent.kind === 'configReset'
4202
- ? '设置层重置已经提交;失败的后续步骤没有恢复旧设置。'
4203
- : '配置写入已经提交;失败的后续步骤没有回滚设置。'],
4252
+ messages: [
4253
+ ...(applySummary?.messages ?? []),
4254
+ ...(configWrite === 'succeeded' ? [ticket.intent.kind === 'configReset'
4255
+ ? '设置层重置已经提交;失败的后续步骤没有恢复旧设置。'
4256
+ : '配置写入已经提交;失败的后续步骤没有回滚设置。'] : []),
4257
+ ...(interruptionMessage ? [interruptionMessage] : []),
4258
+ ...(finalVerification === 'failed' && interruptedApply
4259
+ ? ['最终状态无法刷新。请稍后重新检查状态。'] : []),
4260
+ ],
4204
4261
  };
4205
4262
  this.#progress = { ...this.#progress, elapsedMs };
4206
4263
  const result = {
@@ -4222,6 +4279,16 @@ export class TuiController {
4222
4279
  navigation: 'result',
4223
4280
  returnRoute: ticket.returnRoute,
4224
4281
  writeMayHaveCompleted: ticket.intent.kind === 'catalogSourcesRecovery' ? false : true,
4282
+ ...(applySummary && interruptionMessage ? {
4283
+ message: interruptionMessage,
4284
+ summary: {
4285
+ ...applySummary,
4286
+ code: 'operationFailed',
4287
+ message: interruptionMessage,
4288
+ configApplyRetryAvailable: false,
4289
+ configApplyRetryTargets: [],
4290
+ },
4291
+ } : {}),
4225
4292
  });
4226
4293
  }
4227
4294
  }
@@ -4329,7 +4396,7 @@ export class TuiController {
4329
4396
  if (!this.#operationDiagnostics.has(operationId)) {
4330
4397
  this.#captureThrownProjection(operationId, undefined, code, 'execute', options?.intent);
4331
4398
  }
4332
- const message = code === 'codexCliNotFound'
4399
+ const message = options?.message ?? (code === 'codexCliNotFound'
4333
4400
  ? '操作在插件写入前停止。未找到本机 Codex CLI。请检查 PATH,或安装 Codex CLI 或 Codex App 后重试。'
4334
4401
  : code === 'codexSystemCliUnsupported'
4335
4402
  ? '操作在插件写入前停止。本机 Codex CLI 版本不受支持或无法确认。请升级或修复本机 Codex CLI 或 Codex App 后重试。'
@@ -4341,7 +4408,7 @@ export class TuiController {
4341
4408
  ? '重置执行后设置层仍然存在。请重新检查设置问题。'
4342
4409
  : code === 'issueStillPresent'
4343
4410
  ? '写入已完成,但重新检查后原问题仍然存在。'
4344
- : '操作未完成。请重新检查后重试。';
4411
+ : '操作未完成。请重新检查后重试。');
4345
4412
  const result = {
4346
4413
  state: 'blocked',
4347
4414
  operationId,
@@ -4399,6 +4466,64 @@ export class TuiController {
4399
4466
  this.#listeners.clear();
4400
4467
  }
4401
4468
  }
4469
+ function configApplyResult(execution) {
4470
+ if (!execution || typeof execution !== 'object')
4471
+ return undefined;
4472
+ return execution.apply;
4473
+ }
4474
+ export function configApplyHasCompletedWork(apply) {
4475
+ return apply?.targetResults?.some((target) => target.partialDelivery || target.state === 'completed' && target.action !== 'skipped') === true
4476
+ || apply?.commandResults?.some((result) => result.state === 'completed') === true;
4477
+ }
4478
+ function configApplyUnfinishedPlatforms(apply, reviewedPlatforms) {
4479
+ if (!apply || apply.commandResults?.length)
4480
+ return [];
4481
+ const completed = new Set(apply.targetResults.filter((result) => result.state === 'completed' || result.partialDelivery)
4482
+ .map((result) => result.target.platform));
4483
+ return [...new Set(apply.targetResults.filter((result) => (result.state === 'failed' || result.state === 'skipped' && result.errorCode)
4484
+ && !completed.has(result.target.platform)
4485
+ && (!reviewedPlatforms || reviewedPlatforms.includes(result.target.platform)))
4486
+ .map((result) => result.target.platform))];
4487
+ }
4488
+ function configApplyInterruptionMessage(code, retryTargets) {
4489
+ const nextStep = retryTargets.length > 0
4490
+ ? '可为未完成平台重新准备确认。' : CONFIG_APPLY_MANUAL_RECOVERY;
4491
+ return code === 'processCleanupUnconfirmed'
4492
+ ? `无法确认进程已清理。请先检查相关平台进程。${nextStep}`
4493
+ : `应用已中断。${nextStep}`;
4494
+ }
4495
+ const CONFIG_APPLY_MANUAL_RECOVERY = '请检查未完成位置后,从设置重新准备应用。';
4496
+ function configApplyTargets(apply) {
4497
+ return (apply?.targetResults ?? []).flatMap((entry) => {
4498
+ const target = entry.target;
4499
+ if (!target || !isPlatformTarget(target.platform)
4500
+ || (target.scope !== 'user' && target.scope !== 'project')
4501
+ || (entry.state !== 'completed' && entry.state !== 'failed' && entry.state !== 'skipped'))
4502
+ return [];
4503
+ let pluginId;
4504
+ if (typeof target.pluginId === 'string') {
4505
+ try {
4506
+ parsePluginId(target.pluginId);
4507
+ pluginId = target.pluginId;
4508
+ }
4509
+ catch {
4510
+ // Target identity can be unavailable in older receipts.
4511
+ }
4512
+ }
4513
+ return [{
4514
+ ...(pluginId ? { pluginId } : {}),
4515
+ platform: target.platform,
4516
+ scope: target.scope,
4517
+ state: entry.state === 'skipped' || entry.action === 'skipped' ? 'skipped'
4518
+ : entry.state === 'failed' ? 'failed'
4519
+ : entry.action === 'keep' ? 'kept' : 'completed',
4520
+ ...(entry.partialDelivery ? { partialDelivery: true } : {}),
4521
+ ...(typeof entry.errorCode === 'string'
4522
+ ? { errorCode: safeDiagnosticCode(entry.errorCode, 'configApplyFailed') }
4523
+ : {}),
4524
+ }];
4525
+ });
4526
+ }
4402
4527
  function operationResultSummaryUnsafe(intent, execution) {
4403
4528
  if (intent.kind === 'catalogStorePrune') {
4404
4529
  const result = execution;
@@ -4762,9 +4887,27 @@ function operationResultSummaryUnsafe(intent, execution) {
4762
4887
  }
4763
4888
  if (intent.kind === 'configSaveBatch') {
4764
4889
  const batch = execution;
4890
+ const applies = batch.groups.map((group) => configApplyResult(group.execution));
4891
+ const configDiagnostics = applies.flatMap((apply) => apply?.diagnostics ?? []);
4892
+ const commandResults = applies.flatMap((apply) => apply?.commandResults ?? []);
4893
+ const targets = [...new Map(applies.flatMap(configApplyTargets)
4894
+ .map((target) => [[target.pluginId ?? '', target.platform, target.scope].join('\0'), target])).values()];
4765
4895
  const savedCount = batch.groups.filter((group) => group.configSaved).length;
4766
- const failedCount = batch.groups.filter((group) => group.status === 'failed').length;
4767
- const retryScopes = batch.groups.filter((group) => group.configSaved && group.applyStatus === 'failed' && group.errorCode !== 'invalidConfig');
4896
+ const targetsUpdated = applies.some(configApplyHasCompletedWork);
4897
+ const configGroups = batch.groups.map((group, index) => ({
4898
+ scope: group.scope,
4899
+ platform: group.platform,
4900
+ configSaved: group.configSaved,
4901
+ applyRequested: group.applyRequested,
4902
+ applyStatus: group.applyStatus,
4903
+ ...(group.errorCode ? { errorCode: safeDiagnosticCode(group.errorCode, 'configWriteFailed') } : {}),
4904
+ ...(group.status === 'notStarted' ? { notStarted: true } : {}),
4905
+ ...(group.applyStatus === 'partial'
4906
+ || group.errorCode === 'operationInterrupted' || group.errorCode === 'processCleanupUnconfirmed'
4907
+ ? { retryTargets: configApplyUnfinishedPlatforms(applies[index]) } : {}),
4908
+ }));
4909
+ const retryScopes = configGroups.filter((group) => group.configSaved && (group.applyStatus === 'failed' || group.applyStatus === 'partial')
4910
+ && group.errorCode !== 'invalidConfig' && group.retryTargets?.length !== 0);
4768
4911
  const invalidConfig = savedCount === batch.groups.length
4769
4912
  && batch.groups.some((group) => group.configSaved && group.errorCode === 'invalidConfig')
4770
4913
  && retryScopes.length === 0;
@@ -4777,43 +4920,42 @@ function operationResultSummaryUnsafe(intent, execution) {
4777
4920
  const otherProjectsMayRequireSync = batch.groups.some((group) => group.scope === 'user' && group.execution && typeof group.execution === 'object'
4778
4921
  && group.execution.otherProjectsMayRequireSync === true);
4779
4922
  return {
4780
- code: failedCount > 0
4781
- ? savedCount > 0 ? 'operationPartial' : 'operationFailed'
4782
- : 'operationSucceeded',
4923
+ code: batch.status === 'succeeded' ? 'operationSucceeded'
4924
+ : batch.status === 'partial' || targetsUpdated ? 'operationPartial' : 'operationFailed',
4783
4925
  message: invalidConfig
4784
4926
  ? '设置已保存,但没有应用。当前配置仍无效。'
4785
- : failedCount > 0
4927
+ : batch.status !== 'succeeded'
4786
4928
  ? savedCount > 0
4787
- ? `已保存 ${savedCount} 个设置层;${failedCount} 个设置层失败。`
4929
+ ? `已保存 ${savedCount} 个设置层;${targetsUpdated ? '部分插件目标已更新。' : '部分步骤未完成。'}`
4788
4930
  : '设置没有保存。'
4789
4931
  : '设置已保存。',
4790
4932
  pluginId: intent.pluginId,
4933
+ configContext: intent.context ?? 'user',
4791
4934
  configApplyRetryAvailable: retryScopes.length > 0,
4792
4935
  ...(invalidConfig ? { configApplySkippedReason: 'invalidConfig' } : {}),
4793
4936
  configApplied: intent.apply
4794
- ? batch.groups.some((group) => group.applyStatus === 'succeeded')
4937
+ ? targetsUpdated || batch.groups.some((group) => group.applyStatus === 'succeeded')
4795
4938
  : false,
4796
- configGroups: batch.groups.map((group) => ({
4797
- scope: group.scope,
4798
- platform: group.platform,
4799
- configSaved: group.configSaved,
4800
- applyRequested: group.applyRequested,
4801
- applyStatus: group.applyStatus,
4802
- ...(group.errorCode ? { errorCode: safeDiagnosticCode(group.errorCode, 'configWriteFailed') } : {}),
4803
- })),
4804
- commandResults: batch.groups.flatMap((group) => group.execution
4805
- && typeof group.execution === 'object'
4806
- ? (group.execution.apply?.commandResults ?? [])
4807
- : []),
4939
+ configGroups,
4940
+ ...(targets.length > 0 ? { configTargets: targets } : {}),
4941
+ ...(configDiagnostics.length ? { configDiagnostics } : {}),
4942
+ commandResults,
4943
+ ...(commandResults.length ? { recoveryActions: [...new Set(commandResults.flatMap((result) => result.recoveryActions))] } : {}),
4808
4944
  messages: [
4809
- ...batch.groups.map((group) => {
4945
+ ...configGroups.map((group) => {
4810
4946
  const label = group.platform ? `${group.platform} 平台配置` : '公共配置';
4947
+ if (group.notStarted)
4948
+ return `${label}尚未保存。`;
4811
4949
  return group.configSaved
4812
4950
  ? `${label}已保存${group.errorCode === 'invalidConfig'
4813
4951
  ? ',但当前配置无效,未应用'
4814
- : group.applyStatus === 'failed' ? ',但应用失败' : ''}。`
4952
+ : group.applyStatus === 'partial' ? ',部分插件目标已更新'
4953
+ : group.applyStatus === 'failed' ? ',但应用失败' : ''}。`
4815
4954
  : `${label}保存失败。`;
4816
4955
  }),
4956
+ ...configGroups.flatMap((group) => group.errorCode === 'operationInterrupted' || group.errorCode === 'processCleanupUnconfirmed'
4957
+ ? [configApplyInterruptionMessage(group.errorCode, group.retryTargets ?? [])]
4958
+ : group.retryTargets?.length === 0 ? [CONFIG_APPLY_MANUAL_RECOVERY] : []),
4817
4959
  ...publicWarnings.map((warning) => `警告:${warning}`),
4818
4960
  ...(otherProjectsMayRequireSync
4819
4961
  ? ['提示:其它项目没有被扫描,可能需要在对应项目目录中运行 aw plugin sync --context project。']
@@ -4822,43 +4964,15 @@ function operationResultSummaryUnsafe(intent, execution) {
4822
4964
  };
4823
4965
  }
4824
4966
  if (intent.kind === 'configSave' || intent.kind === 'configReset') {
4825
- const rawApply = typeof execution === 'object' && execution !== null
4826
- && typeof execution.apply === 'object'
4827
- && execution.apply !== null
4828
- ? execution.apply
4829
- : {};
4830
- const rawTargets = Array.isArray(rawApply.targetResults)
4831
- ? rawApply.targetResults
4832
- : [];
4833
- const commandResults = Array.isArray(rawApply.commandResults)
4834
- ? rawApply.commandResults : [];
4835
- const targets = rawTargets.flatMap((entry) => {
4836
- const target = typeof entry.target === 'object' && entry.target !== null
4837
- ? entry.target
4838
- : entry;
4839
- if (!isPlatformTarget(target.platform)
4840
- || (target.scope !== 'user' && target.scope !== 'project')
4841
- || (entry.state !== 'completed' && entry.state !== 'failed' && entry.state !== 'skipped'))
4842
- return [];
4843
- return [{
4844
- ...(typeof target.pluginId === 'string' ? { pluginId: target.pluginId } : {}),
4845
- platform: target.platform,
4846
- scope: target.scope,
4847
- state: entry.state === 'skipped' || entry.action === 'skipped' ? 'skipped'
4848
- : entry.state === 'failed' ? 'failed'
4849
- : entry.action === 'keep' ? 'kept'
4850
- : entry.state,
4851
- ...(typeof entry.errorCode === 'string'
4852
- ? { errorCode: safeDiagnosticCode(entry.errorCode, 'configApplyFailed') }
4853
- : {}),
4854
- }];
4855
- });
4967
+ const apply = configApplyResult(execution);
4968
+ const configDiagnostics = apply?.diagnostics ?? [];
4969
+ const commandResults = apply?.commandResults ?? [];
4970
+ const targets = configApplyTargets(apply);
4856
4971
  const overallState = typeof execution === 'object' && execution !== null
4857
4972
  ? execution.overallState
4858
4973
  : undefined;
4859
- const applyState = rawApply.state;
4860
- const applyReason = rawApply.reason;
4861
- const invalidConfig = applyState === 'unavailable' && applyReason === 'invalidConfig';
4974
+ const applyState = apply?.state;
4975
+ const invalidConfig = apply?.state === 'unavailable' && apply.reason === 'invalidConfig';
4862
4976
  const resetDisposition = typeof execution === 'object' && execution !== null
4863
4977
  ? execution.resetDisposition
4864
4978
  : undefined;
@@ -4887,18 +5001,34 @@ function operationResultSummaryUnsafe(intent, execution) {
4887
5001
  const failed = overallState === 'failed'
4888
5002
  || (targets.length > 0
4889
5003
  && targets.every((target) => target.state === 'failed' || target.state === 'skipped'));
5004
+ const retryApply = intent.kind === 'configSave' && intent.retryApply === true;
5005
+ const applied = applyState === 'succeeded' || configApplyHasCompletedWork(apply);
5006
+ const retryable = intent.kind === 'configSave'
5007
+ && intent.apply && !invalidConfig && (applyState === 'partial' || applyState === 'unavailable');
5008
+ const retryTargets = retryable && intent.kind === 'configSave'
5009
+ ? applied || commandResults.some((result) => result.state === 'partial')
5010
+ ? configApplyUnfinishedPlatforms(apply, intent.targets)
5011
+ : intent.targets
5012
+ : undefined;
5013
+ if (retryable && retryTargets?.length === 0 && !(execution instanceof ConfigApplyInterruptedError)) {
5014
+ publicMessages.push(CONFIG_APPLY_MANUAL_RECOVERY);
5015
+ }
4890
5016
  return {
4891
5017
  code: failed || partial ? 'operationPartial' : 'operationSucceeded',
4892
- message: invalidConfig ? '设置已保存,但没有应用。当前配置仍无效。'
4893
- : failed || partial ? '设置已保存,但插件内容重新应用失败或部分失败。' : '操作已完成。',
5018
+ message: retryApply
5019
+ ? invalidConfig ? '当前配置仍无效。请返回设置修复。'
5020
+ : failed || partial ? applied ? '部分插件内容已就绪。' : '插件设置应用未完成。'
5021
+ : applied ? '已应用已保存的设置。' : '应用检查完成。'
5022
+ : invalidConfig ? '设置已保存,但没有应用。当前配置仍无效。'
5023
+ : failed || partial ? '设置已保存,但插件内容重新应用失败或部分失败。' : '操作已完成。',
4894
5024
  pluginId: intent.pluginId,
4895
5025
  configScope: 'user', configPlatform: intent.platform, configContext: intent.context ?? 'user',
4896
- configApplyRetryAvailable: intent.kind === 'configSave'
4897
- && intent.apply && !invalidConfig && (applyState === 'partial' || applyState === 'unavailable'),
4898
- ...(intent.kind === 'configSave' && intent.retryApply ? { configRetryApply: true } : {}),
5026
+ configApplyRetryAvailable: retryable && retryTargets?.length !== 0,
5027
+ ...(retryTargets ? { configApplyRetryTargets: retryTargets } : {}),
5028
+ ...(retryApply ? { configRetryApply: true } : {}),
4899
5029
  ...(publicMessages.length > 0 ? { messages: publicMessages } : {}),
4900
5030
  ...(intent.kind === 'configSave'
4901
- ? { configApplied: applyState === 'succeeded' || applyState === 'partial' }
5031
+ ? { configApplied: applied }
4902
5032
  : invalidConfig ? { configApplied: false } : {}),
4903
5033
  ...(invalidConfig ? { configApplySkippedReason: 'invalidConfig' } : {}),
4904
5034
  ...(intent.kind === 'configReset'
@@ -4913,6 +5043,7 @@ function operationResultSummaryUnsafe(intent, execution) {
4913
5043
  }
4914
5044
  : {}),
4915
5045
  ...(targets.length > 0 ? { configTargets: targets } : {}),
5046
+ ...(configDiagnostics.length ? { configDiagnostics } : {}),
4916
5047
  ...(commandResults.length > 0 ? { commandResults,
4917
5048
  recoveryActions: [...new Set(commandResults.flatMap((result) => result.recoveryActions))] } : {}),
4918
5049
  };