@lesliechan721/aw 0.1.0-beta.83 → 0.1.0-beta.85
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/assets/aw-runtime-config.mjs +1 -1
- package/dist/authoring/assets/aw-runtime-config.mjs.map +1 -1
- package/dist/index.js +2 -6
- package/dist/index.js.map +1 -1
- package/dist/src/commands/console.js +1 -0
- package/dist/src/commands/console.js.map +1 -1
- package/dist/src/commands/intent-command.d.ts +1 -0
- package/dist/src/commands/intent-command.js +6 -2
- package/dist/src/commands/intent-command.js.map +1 -1
- package/dist/src/commands/plugin-capabilities.js +3 -3
- package/dist/src/commands/plugin-capabilities.js.map +1 -1
- package/dist/src/commands/public-lifecycle-result.d.ts +14 -13
- package/dist/src/commands/public-lifecycle-result.js +204 -64
- package/dist/src/commands/public-lifecycle-result.js.map +1 -1
- package/dist/src/commands/public-lifecycle.d.ts +1 -2
- package/dist/src/commands/public-lifecycle.js +56 -34
- package/dist/src/commands/public-lifecycle.js.map +1 -1
- package/dist/src/commands/public-plugin-query.js +44 -11
- package/dist/src/commands/public-plugin-query.js.map +1 -1
- package/dist/src/commands/rebuild-command.d.ts +13 -3
- package/dist/src/commands/rebuild-command.js +665 -288
- package/dist/src/commands/rebuild-command.js.map +1 -1
- package/dist/src/commands/rebuild-integration.d.ts +6 -2
- package/dist/src/commands/rebuild-integration.js +60 -29
- package/dist/src/commands/rebuild-integration.js.map +1 -1
- package/dist/src/commands/rebuild-operations.d.ts +1 -0
- package/dist/src/commands/rebuild-operations.js +28 -6
- package/dist/src/commands/rebuild-operations.js.map +1 -1
- package/dist/src/commands/rebuild-platform-integration.d.ts +20 -5
- package/dist/src/commands/rebuild-platform-integration.js +752 -182
- package/dist/src/commands/rebuild-platform-integration.js.map +1 -1
- package/dist/src/generators/permissions.d.ts +7 -1
- package/dist/src/generators/permissions.js +56 -0
- package/dist/src/generators/permissions.js.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +112 -54
- package/dist/src/index.js.map +1 -1
- package/dist/src/intent/scope-context.d.ts +4 -2
- package/dist/src/intent/scope-context.js +37 -7
- package/dist/src/intent/scope-context.js.map +1 -1
- package/dist/src/output/component-delivery.d.ts +21 -0
- package/dist/src/output/component-delivery.js +82 -0
- package/dist/src/output/component-delivery.js.map +1 -0
- package/dist/src/output/public-result.d.ts +4 -0
- package/dist/src/output/public-result.js +85 -15
- package/dist/src/output/public-result.js.map +1 -1
- package/dist/src/output/rebuild-progress.d.ts +3 -0
- package/dist/src/output/rebuild-progress.js +12 -2
- package/dist/src/output/rebuild-progress.js.map +1 -1
- package/dist/src/output/receipt-projection.js +64 -19
- package/dist/src/output/receipt-projection.js.map +1 -1
- package/dist/src/output/skill-invocation-notices.d.ts +18 -0
- package/dist/src/output/skill-invocation-notices.js +84 -0
- package/dist/src/output/skill-invocation-notices.js.map +1 -0
- package/dist/src/platforms/capabilities.d.ts +6 -1
- package/dist/src/platforms/capabilities.js +161 -38
- package/dist/src/platforms/capabilities.js.map +1 -1
- package/dist/src/platforms/contracts.d.ts +45 -10
- package/dist/src/platforms/discovery.d.ts +11 -7
- package/dist/src/platforms/discovery.js +176 -76
- package/dist/src/platforms/discovery.js.map +1 -1
- package/dist/src/platforms/inspection-grok.js +121 -9
- package/dist/src/platforms/inspection-grok.js.map +1 -1
- package/dist/src/platforms/inspection-native.js +53 -97
- package/dist/src/platforms/inspection-native.js.map +1 -1
- package/dist/src/platforms/inspection-pi.d.ts +7 -1
- package/dist/src/platforms/inspection-pi.js +295 -95
- package/dist/src/platforms/inspection-pi.js.map +1 -1
- package/dist/src/platforms/inspection-query.d.ts +6 -5
- package/dist/src/platforms/inspection-query.js +30 -25
- package/dist/src/platforms/inspection-query.js.map +1 -1
- package/dist/src/platforms/inspection.d.ts +4 -1
- package/dist/src/platforms/inspection.js +38 -6
- package/dist/src/platforms/inspection.js.map +1 -1
- package/dist/src/platforms/layout.d.ts +6 -0
- package/dist/src/platforms/layout.js +45 -12
- package/dist/src/platforms/layout.js.map +1 -1
- package/dist/src/platforms/lifecycle-native-services.d.ts +1 -1
- package/dist/src/platforms/lifecycle-native-services.js +14 -14
- package/dist/src/platforms/lifecycle-native-services.js.map +1 -1
- package/dist/src/platforms/lifecycle-native.d.ts +1 -0
- package/dist/src/platforms/lifecycle-native.js +29 -89
- package/dist/src/platforms/lifecycle-native.js.map +1 -1
- package/dist/src/platforms/lifecycle.d.ts +2 -0
- package/dist/src/platforms/lifecycle.js +120 -69
- package/dist/src/platforms/lifecycle.js.map +1 -1
- package/dist/src/platforms/projection-code-extension.js +9 -4
- package/dist/src/platforms/projection-code-extension.js.map +1 -1
- package/dist/src/platforms/projection.d.ts +3 -0
- package/dist/src/platforms/projection.js +152 -72
- package/dist/src/platforms/projection.js.map +1 -1
- package/dist/src/platforms/supplement-layout.d.ts +5 -1
- package/dist/src/platforms/supplement-layout.js +23 -1
- package/dist/src/platforms/supplement-layout.js.map +1 -1
- package/dist/src/platforms/supplement-state.d.ts +1 -1
- package/dist/src/platforms/supplement-state.js +18 -7
- package/dist/src/platforms/supplement-state.js.map +1 -1
- package/dist/src/portable/commands.js +1 -1
- package/dist/src/portable/commands.js.map +1 -1
- package/dist/src/portable/materializer.d.ts +4 -0
- package/dist/src/portable/materializer.js +9 -2
- package/dist/src/portable/materializer.js.map +1 -1
- package/dist/src/portable/recovery.d.ts +31 -3
- package/dist/src/portable/recovery.js +261 -82
- package/dist/src/portable/recovery.js.map +1 -1
- package/dist/src/recovery/coordinator.d.ts +19 -5
- package/dist/src/recovery/coordinator.js +433 -174
- package/dist/src/recovery/coordinator.js.map +1 -1
- package/dist/src/recovery/install-concurrency.d.ts +48 -0
- package/dist/src/recovery/install-concurrency.js +196 -0
- package/dist/src/recovery/install-concurrency.js.map +1 -0
- package/dist/src/recovery/interruption.d.ts +19 -0
- package/dist/src/recovery/interruption.js +43 -0
- package/dist/src/recovery/interruption.js.map +1 -0
- package/dist/src/recovery/joint-coordinator.d.ts +18 -4
- package/dist/src/recovery/joint-coordinator.js +829 -341
- package/dist/src/recovery/joint-coordinator.js.map +1 -1
- package/dist/src/recovery/joint-demand.d.ts +22 -2
- package/dist/src/recovery/joint-demand.js +104 -6
- package/dist/src/recovery/joint-demand.js.map +1 -1
- package/dist/src/recovery/joint-install-execution.d.ts +19 -0
- package/dist/src/recovery/joint-install-execution.js +307 -0
- package/dist/src/recovery/joint-install-execution.js.map +1 -0
- package/dist/src/recovery/joint-install-native-rebase.d.ts +4 -0
- package/dist/src/recovery/joint-install-native-rebase.js +67 -0
- package/dist/src/recovery/joint-install-native-rebase.js.map +1 -0
- package/dist/src/recovery/receipt.d.ts +35 -4
- package/dist/src/recovery/receipt.js +90 -1
- package/dist/src/recovery/receipt.js.map +1 -1
- package/dist/src/recovery/retirement.js +1 -1
- package/dist/src/recovery/retirement.js.map +1 -1
- package/dist/src/recovery/status.d.ts +20 -8
- package/dist/src/recovery/status.js +405 -116
- package/dist/src/recovery/status.js.map +1 -1
- package/dist/src/review/platform-profile.d.ts +4 -1
- package/dist/src/review/platform-profile.js +14 -4
- package/dist/src/review/platform-profile.js.map +1 -1
- package/dist/src/review/skill-materialization.d.ts +2 -0
- package/dist/src/review/skill-materialization.js +68 -50
- package/dist/src/review/skill-materialization.js.map +1 -1
- package/dist/src/review/source-binding.js +11 -5
- package/dist/src/review/source-binding.js.map +1 -1
- package/dist/src/tui/console-app-v4.d.ts +1 -1
- package/dist/src/tui/console-app-v4.js +180 -63
- package/dist/src/tui/console-app-v4.js.map +1 -1
- package/dist/src/tui/controller-runtime.js +46 -10
- package/dist/src/tui/controller-runtime.js.map +1 -1
- package/dist/src/tui/controller.d.ts +15 -5
- package/dist/src/tui/controller.js +246 -102
- package/dist/src/tui/controller.js.map +1 -1
- package/dist/src/tui/deployment-view.d.ts +6 -3
- package/dist/src/tui/deployment-view.js +43 -9
- package/dist/src/tui/deployment-view.js.map +1 -1
- package/dist/src/tui/diagnostic-projection.d.ts +11 -3
- package/dist/src/tui/diagnostic-projection.js +85 -4
- package/dist/src/tui/diagnostic-projection.js.map +1 -1
- package/dist/src/tui/entity-cards.d.ts +2 -1
- package/dist/src/tui/entity-cards.js +34 -11
- package/dist/src/tui/entity-cards.js.map +1 -1
- package/dist/src/tui/glossary.js +5 -0
- package/dist/src/tui/glossary.js.map +1 -1
- package/dist/src/tui/model.js +2 -1
- package/dist/src/tui/model.js.map +1 -1
- package/dist/src/tui/operation-diagnostic-screens.d.ts +1 -1
- package/dist/src/tui/operation-diagnostic-screens.js +6 -2
- package/dist/src/tui/operation-diagnostic-screens.js.map +1 -1
- package/dist/src/tui/operation-history.d.ts +12 -3
- package/dist/src/tui/operation-history.js +34 -3
- package/dist/src/tui/operation-history.js.map +1 -1
- package/dist/src/tui/plugin-detail.d.ts +4 -1
- package/dist/src/tui/plugin-detail.js +9 -2
- package/dist/src/tui/plugin-detail.js.map +1 -1
- package/dist/src/tui/scoped-flow.d.ts +3 -1
- package/dist/src/tui/scoped-flow.js +117 -1
- package/dist/src/tui/scoped-flow.js.map +1 -1
- package/dist/src/tui/scoped-inventory.d.ts +6 -2
- package/dist/src/tui/scoped-inventory.js +29 -7
- package/dist/src/tui/scoped-inventory.js.map +1 -1
- package/dist/src/tui/session-console-app.d.ts +2 -0
- package/dist/src/tui/session-console-app.js +11 -0
- package/dist/src/tui/session-console-app.js.map +1 -1
- package/dist/src/types.d.ts +10 -2
- package/dist/src/types.js.map +1 -1
- package/dist/src/utils/artifact-plan.js +5 -1
- package/dist/src/utils/artifact-plan.js.map +1 -1
- package/dist/src/utils/artifact-renderer.d.ts +1 -1
- package/dist/src/utils/artifact-renderer.js +29 -8
- package/dist/src/utils/artifact-renderer.js.map +1 -1
- package/dist/src/utils/aw-home-mutation-lock.js +2 -1
- package/dist/src/utils/aw-home-mutation-lock.js.map +1 -1
- package/dist/src/utils/catalog-source-references.js +14 -17
- package/dist/src/utils/catalog-source-references.js.map +1 -1
- package/dist/src/utils/codex-native-observation.d.ts +6 -0
- package/dist/src/utils/codex-native-observation.js +32 -3
- package/dist/src/utils/codex-native-observation.js.map +1 -1
- package/dist/src/utils/component-command-preparation.d.ts +2 -0
- package/dist/src/utils/component-command-preparation.js +23 -4
- package/dist/src/utils/component-command-preparation.js.map +1 -1
- package/dist/src/utils/component-gap.d.ts +4 -0
- package/dist/src/utils/component-gap.js +20 -0
- package/dist/src/utils/component-gap.js.map +1 -0
- package/dist/src/utils/component-resources.js +2 -4
- package/dist/src/utils/component-resources.js.map +1 -1
- package/dist/src/utils/dynamic-skill-tree.js +2 -32
- package/dist/src/utils/dynamic-skill-tree.js.map +1 -1
- package/dist/src/utils/managed-command-materialization.d.ts +2 -1
- package/dist/src/utils/managed-command-materialization.js +3 -3
- package/dist/src/utils/managed-command-materialization.js.map +1 -1
- package/dist/src/utils/managed-command-store.d.ts +6 -0
- package/dist/src/utils/managed-command-store.js +90 -18
- package/dist/src/utils/managed-command-store.js.map +1 -1
- package/dist/src/utils/multi-source-catalog.d.ts +2 -0
- package/dist/src/utils/multi-source-catalog.js +3 -2
- package/dist/src/utils/multi-source-catalog.js.map +1 -1
- package/dist/src/utils/native-cli-interruption.d.ts +8 -0
- package/dist/src/utils/native-cli-interruption.js +65 -0
- package/dist/src/utils/native-cli-interruption.js.map +1 -0
- package/dist/src/utils/native-cli.d.ts +5 -19
- package/dist/src/utils/native-cli.js +168 -95
- package/dist/src/utils/native-cli.js.map +1 -1
- package/dist/src/utils/ownership.d.ts +1 -0
- package/dist/src/utils/ownership.js +18 -4
- package/dist/src/utils/ownership.js.map +1 -1
- package/dist/src/utils/package-content.d.ts +7 -0
- package/dist/src/utils/package-content.js +70 -0
- package/dist/src/utils/package-content.js.map +1 -0
- package/dist/src/utils/platform-empty-state.d.ts +32 -9
- package/dist/src/utils/platform-empty-state.js +135 -70
- package/dist/src/utils/platform-empty-state.js.map +1 -1
- package/dist/src/utils/plugin-config-write.d.ts +8 -0
- package/dist/src/utils/plugin-config-write.js +93 -25
- package/dist/src/utils/plugin-config-write.js.map +1 -1
- package/dist/src/utils/plugin-scripts.js +24 -8
- package/dist/src/utils/plugin-scripts.js.map +1 -1
- package/dist/src/utils/process-tree.d.ts +1 -1
- package/dist/src/utils/process-tree.js +1 -1
- package/dist/src/utils/process-tree.js.map +1 -1
- package/dist/src/utils/skill-invocation-warning.d.ts +20 -0
- package/dist/src/utils/skill-invocation-warning.js +68 -0
- package/dist/src/utils/skill-invocation-warning.js.map +1 -0
- package/package.json +3 -3
- package/dist/src/output/native-consent.d.ts +0 -2
- package/dist/src/output/native-consent.js +0 -5
- package/dist/src/output/native-consent.js.map +0 -1
- package/dist/src/platforms/gemini-activation.d.ts +0 -36
- package/dist/src/platforms/gemini-activation.js +0 -331
- package/dist/src/platforms/gemini-activation.js.map +0 -1
- package/dist/src/platforms/gemini-consent.d.ts +0 -8
- package/dist/src/platforms/gemini-consent.js +0 -81
- 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,14 @@ 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';
|
|
18
|
+
import { type ComponentDelivery } from '../output/component-delivery.js';
|
|
17
19
|
import { OperationHistoryStore, type OperationDiagnosticDetail, type OperationEffectFacts, type OperationHistorySummary, type OperationReportPreview, type SafeOperationDiagnostic, type SaveOperationReportResult } from './operation-history.js';
|
|
18
20
|
import { type ScopedInventoryViewModel, type ScopedInventoryLoadResult, type InventoryRoot } from './scoped-inventory.js';
|
|
19
|
-
import type
|
|
21
|
+
import { type ScopedTuiPlan } from './scoped-flow.js';
|
|
20
22
|
import type { RecoveryReceipt } from '../recovery/receipt.js';
|
|
21
23
|
import type { RecoveryCommand } from '../recovery/coordinator.js';
|
|
22
24
|
import type { AgentId } from '../intent/deployment-preferences.js';
|
|
@@ -152,10 +154,10 @@ export interface ConfigSaveBatchGroup {
|
|
|
152
154
|
export interface ConfigSaveBatchGroupResult {
|
|
153
155
|
scope: 'user';
|
|
154
156
|
platform?: PlatformTarget;
|
|
155
|
-
status: 'succeeded' | 'failed';
|
|
157
|
+
status: 'succeeded' | 'failed' | 'notStarted';
|
|
156
158
|
configSaved: boolean;
|
|
157
159
|
applyRequested: boolean;
|
|
158
|
-
applyStatus: 'notRequested' | 'notNeeded' | 'succeeded' | 'failed';
|
|
160
|
+
applyStatus: 'notRequested' | 'notStarted' | 'notNeeded' | 'succeeded' | 'partial' | 'failed';
|
|
159
161
|
errorCode?: string;
|
|
160
162
|
execution?: unknown;
|
|
161
163
|
}
|
|
@@ -556,18 +558,23 @@ export interface OperationResultSummary {
|
|
|
556
558
|
elapsedMs?: number;
|
|
557
559
|
messages?: string[];
|
|
558
560
|
configApplied?: boolean;
|
|
561
|
+
configDiagnostics?: Diagnostic[];
|
|
559
562
|
configApplySkippedReason?: 'invalidConfig';
|
|
560
563
|
configScope?: Scope;
|
|
561
564
|
configPlatform?: PlatformTarget;
|
|
562
565
|
configContext?: Scope;
|
|
563
|
-
configTargets?: Array<{
|
|
566
|
+
configTargets?: Array<ComponentDelivery & {
|
|
564
567
|
pluginId?: string;
|
|
565
568
|
platform: PlatformTarget;
|
|
566
569
|
scope: Scope;
|
|
567
570
|
state: 'completed' | 'kept' | 'failed' | 'skipped';
|
|
571
|
+
partialDelivery?: true;
|
|
568
572
|
errorCode?: string;
|
|
573
|
+
diagnosticIds?: string[];
|
|
574
|
+
effects?: OperationEffectFacts;
|
|
569
575
|
}>;
|
|
570
576
|
configApplyRetryAvailable?: boolean;
|
|
577
|
+
configApplyRetryTargets?: PlatformTarget[];
|
|
571
578
|
configRetryApply?: boolean;
|
|
572
579
|
configGroups?: Array<{
|
|
573
580
|
scope: Scope;
|
|
@@ -575,6 +582,8 @@ export interface OperationResultSummary {
|
|
|
575
582
|
configSaved: boolean;
|
|
576
583
|
applyRequested: boolean;
|
|
577
584
|
applyStatus: ConfigSaveBatchGroupResult['applyStatus'];
|
|
585
|
+
notStarted?: true;
|
|
586
|
+
retryTargets?: PlatformTarget[];
|
|
578
587
|
errorCode?: string;
|
|
579
588
|
}>;
|
|
580
589
|
resetDisposition?: 'absent' | 'deletedFile' | 'unlinkedSymlink' | 'quarantinedDirectory';
|
|
@@ -1026,3 +1035,4 @@ export declare class TuiController {
|
|
|
1026
1035
|
executeOperation(reviewToken: string): Promise<OperationExecuteResult>;
|
|
1027
1036
|
dispose(): void;
|
|
1028
1037
|
}
|
|
1038
|
+
export declare function configApplyHasCompletedWork(apply: ConfigApplyResult | undefined): boolean;
|
|
@@ -4,18 +4,23 @@ 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 { projectComponentDeliveryHistory, projectDeliveryNoticeHistory, projectExecutionDiagnostics, projectSkillInvocationHistory, projectThrownOperationDiagnostic } from './diagnostic-projection.js';
|
|
18
|
+
import { projectComponentDelivery } from '../output/component-delivery.js';
|
|
15
19
|
import { OperationHistoryStore, } from './operation-history.js';
|
|
16
20
|
import { targetHasArtifactCollision } from '../utils/target-eligibility.js';
|
|
17
21
|
import { hasStatusInstallationEvidence } from './scoped-inventory.js';
|
|
18
22
|
import { buildScopedInventory } from './scoped-inventory.js';
|
|
23
|
+
import { projectScopedRecoveryHistory } from './scoped-flow.js';
|
|
19
24
|
import { TuiRouter, } from './router.js';
|
|
20
25
|
import { normalizeTuiRoute } from './screen-registry.js';
|
|
21
26
|
import { CatalogSourcesSession } from './catalog-sources/session.js';
|
|
@@ -401,6 +406,9 @@ function sanitizeOperationSummary(summary, sensitiveValues) {
|
|
|
401
406
|
...(summary.messages ? { messages: summary.messages.map(text) } : {}),
|
|
402
407
|
...(summary.changes ? { changes: summary.changes.map(text) } : {}),
|
|
403
408
|
...(summary.warnings ? { warnings: summary.warnings.map(text) } : {}),
|
|
409
|
+
...(summary.configDiagnostics ? { configDiagnostics: summary.configDiagnostics.map((diagnostic) => ({
|
|
410
|
+
...diagnostic, message: text(diagnostic.message),
|
|
411
|
+
})) } : {}),
|
|
404
412
|
...(summary.recoveryActions ? { recoveryActions: summary.recoveryActions.map(text) } : {}),
|
|
405
413
|
...(summary.commandResults ? { commandResults: summary.commandResults.map((result) => ({
|
|
406
414
|
...result,
|
|
@@ -718,7 +726,7 @@ export class TuiController {
|
|
|
718
726
|
});
|
|
719
727
|
if (progressFeed) {
|
|
720
728
|
this.#progressUnsubscribe = progressFeed.subscribe((progress) => {
|
|
721
|
-
if (this.#router.snapshot.current.route.name === 'result')
|
|
729
|
+
if (this.#router.snapshot.current.route.name === 'result' && !this.#scopedTaskInflight)
|
|
722
730
|
return;
|
|
723
731
|
this.#progress = {
|
|
724
732
|
...structuredClone(progress),
|
|
@@ -964,16 +972,27 @@ export class TuiController {
|
|
|
964
972
|
finalVerification: result.state === 'succeeded' ? 'completed' : 'unknown',
|
|
965
973
|
},
|
|
966
974
|
};
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
975
|
+
const summary = 'summary' in result ? result.summary : undefined;
|
|
976
|
+
if (summary) {
|
|
977
|
+
Object.assign(summary, sanitizeOperationSummary(summary, projected.sensitiveValues ?? []));
|
|
978
|
+
}
|
|
979
|
+
const deliveryNotices = projectDeliveryNoticeHistory(summary?.configDiagnostics ?? [], recordId, 'apply');
|
|
980
|
+
const configDelivery = (summary?.configTargets ?? []).map((target, index) => {
|
|
981
|
+
const notices = deliveryNotices.filter(({ target: notice }) => notice?.platform === target.platform
|
|
982
|
+
&& notice.scope === target.scope && notice.pluginId === target.pluginId);
|
|
983
|
+
const delivery = projectComponentDeliveryHistory(target, notices, `${recordId}:${index}`, 'apply', target.state === 'completed' || target.state === 'kept');
|
|
984
|
+
return { target, ...delivery };
|
|
985
|
+
});
|
|
986
|
+
const diagnostics = [...projected.diagnostics, ...deliveryNotices, ...configDelivery.flatMap(({ diagnostics }) => diagnostics),
|
|
987
|
+
...projectSkillInvocationHistory(summary?.configDiagnostics ?? [], recordId, 'apply')];
|
|
988
|
+
const diagnosticIds = diagnostics.map((diagnostic) => diagnostic.id);
|
|
989
|
+
const targets = summary ? summary.configTargets ?? summary.targets ?? [] : projected.targets ?? [];
|
|
971
990
|
Object.assign(result, { operationRecordId: recordId, diagnosticIds, effects: projected.effects });
|
|
972
|
-
if (
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
for (const target of
|
|
976
|
-
const targetDiagnostics =
|
|
991
|
+
if (summary) {
|
|
992
|
+
summary.diagnosticIds = diagnosticIds;
|
|
993
|
+
summary.effects = projected.effects;
|
|
994
|
+
for (const target of targets) {
|
|
995
|
+
const targetDiagnostics = diagnostics.filter((diagnostic) => diagnostic.target
|
|
977
996
|
&& diagnostic.target.platform === target.platform
|
|
978
997
|
&& diagnostic.target.scope === target.scope
|
|
979
998
|
&& (diagnostic.target.pluginId === undefined || diagnostic.target.pluginId === target.pluginId));
|
|
@@ -996,16 +1015,15 @@ export class TuiController {
|
|
|
996
1015
|
message,
|
|
997
1016
|
...('operationKind' in result && result.operationKind ? { operationKind: result.operationKind } : {}),
|
|
998
1017
|
...('pluginId' in result && result.pluginId ? { pluginId: result.pluginId } : {}),
|
|
999
|
-
diagnosticCount:
|
|
1018
|
+
diagnosticCount: diagnostics.length,
|
|
1000
1019
|
effects: projected.effects,
|
|
1001
1020
|
},
|
|
1002
|
-
diagnostics
|
|
1003
|
-
targets:
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
: structuredClone(projected.targets ?? []),
|
|
1021
|
+
diagnostics,
|
|
1022
|
+
targets: targets.map((target) => {
|
|
1023
|
+
const delivery = configDelivery.find((entry) => entry.target === target);
|
|
1024
|
+
return { ...target, diagnosticIds: target.diagnosticIds ?? [],
|
|
1025
|
+
...(delivery?.facts ? { componentDelivery: delivery.facts } : {}) };
|
|
1026
|
+
}),
|
|
1009
1027
|
}, { sensitiveValues: projected.sensitiveValues });
|
|
1010
1028
|
this.#operationDiagnostics.delete(result.operationId);
|
|
1011
1029
|
this.#lastRecordedResultId = recordId;
|
|
@@ -1023,7 +1041,7 @@ export class TuiController {
|
|
|
1023
1041
|
stage,
|
|
1024
1042
|
fallbackCode: code,
|
|
1025
1043
|
sensitiveValues,
|
|
1026
|
-
...(intent && 'pluginId' in intent && 'platform' in intent
|
|
1044
|
+
...(!(error instanceof ConfigApplyInterruptedError) && intent && 'pluginId' in intent && 'platform' in intent
|
|
1027
1045
|
&& (intent.platform === 'codex' || intent.platform === 'claude')
|
|
1028
1046
|
&& (intent.scope === 'user' || intent.scope === 'project')
|
|
1029
1047
|
? { target: { pluginId: intent.pluginId, platform: intent.platform, scope: intent.scope } }
|
|
@@ -1661,9 +1679,29 @@ export class TuiController {
|
|
|
1661
1679
|
this.#progressFeed?.clearCurrent();
|
|
1662
1680
|
this.#progress = { messages: [], startedAtMs: this.dependencies.now?.() ?? Date.now() };
|
|
1663
1681
|
this.#publish();
|
|
1664
|
-
const
|
|
1682
|
+
const isBatch = plan.kind === 'recovery' && (plan.plan.command === 'install' || plan.plan.command === 'sync')
|
|
1683
|
+
&& plan.plan.receipt.requestedTargets.length > 1;
|
|
1684
|
+
const promise = this.dependencies.executeScopedTask(plan).then((outcome) => {
|
|
1685
|
+
const recordByDefault = isBatch || this.#progress.installProgress !== undefined;
|
|
1686
|
+
if (outcome.kind === 'recovery' && (recordByDefault || outcome.receipt.targetResults.some(({ reasons }) => reasons?.some(({ code }) => code === SKILL_INVOCATION_NOTICE)))) {
|
|
1687
|
+
const operationId = `scoped-${crypto.randomUUID()}`;
|
|
1688
|
+
const record = projectScopedRecoveryHistory(outcome.receipt, {
|
|
1689
|
+
operationId, recordId: `${this.#sessionEpoch}:${operationId}`, epoch: this.#sessionEpoch,
|
|
1690
|
+
createdAtMs: this.dependencies.now?.() ?? Date.now(),
|
|
1691
|
+
});
|
|
1692
|
+
if (recordByDefault || record.diagnostics.some(({ code }) => code === SKILL_INVOCATION_NOTICE)) {
|
|
1693
|
+
this.#operationHistory.record(record);
|
|
1694
|
+
}
|
|
1695
|
+
}
|
|
1696
|
+
return outcome;
|
|
1697
|
+
}, (error) => {
|
|
1698
|
+
if (isBatch || this.#progress.installProgress)
|
|
1699
|
+
this.#recordStandaloneFailure(issueCode(error), 'execute', error);
|
|
1700
|
+
throw error;
|
|
1701
|
+
}).finally(() => {
|
|
1665
1702
|
if (this.#scopedTaskInflight?.promise === promise)
|
|
1666
1703
|
this.#scopedTaskInflight = undefined;
|
|
1704
|
+
this.#publish();
|
|
1667
1705
|
});
|
|
1668
1706
|
this.#scopedTaskInflight = { plan, promise };
|
|
1669
1707
|
return promise;
|
|
@@ -3881,20 +3919,21 @@ export class TuiController {
|
|
|
3881
3919
|
|| Array.isArray(execution.groups)
|
|
3882
3920
|
&& (execution.groups
|
|
3883
3921
|
.some((group) => group.configSaved)));
|
|
3922
|
+
const configRetryReportedDelivery = ticket.intent.kind === 'configSave' && ticket.intent.retryApply
|
|
3923
|
+
&& configApplyHasCompletedWork(configApplyResult(execution));
|
|
3884
3924
|
if ((ticket.intent.kind === 'configSave' || ticket.intent.kind === 'configSaveBatch'
|
|
3885
|
-
|| ticket.intent.kind === 'configReset')
|
|
3886
|
-
&& configCommitted) {
|
|
3925
|
+
|| ticket.intent.kind === 'configReset') && (configCommitted || configRetryReportedDelivery)) {
|
|
3887
3926
|
const baseSummary = operationResultSummary(ticket.intent, execution);
|
|
3888
3927
|
const elapsedMs = Math.max(0, (this.dependencies.now?.() ?? Date.now()) - startedAtMs);
|
|
3889
3928
|
const summary = {
|
|
3890
3929
|
...baseSummary,
|
|
3891
3930
|
code: 'operationPartial',
|
|
3892
|
-
message: '设置已保存,但最终状态无法刷新。',
|
|
3931
|
+
message: configCommitted ? '设置已保存,但最终状态无法刷新。' : '部分插件内容已就绪,但最终状态无法刷新。',
|
|
3893
3932
|
elapsedMs,
|
|
3894
3933
|
messages: [
|
|
3895
3934
|
...this.#progress.messages,
|
|
3896
3935
|
...(baseSummary.messages ?? []),
|
|
3897
|
-
'状态刷新失败。配置写入已经提交;请稍后刷新状态。',
|
|
3936
|
+
configCommitted ? '状态刷新失败。配置写入已经提交;请稍后刷新状态。' : '请稍后刷新状态。',
|
|
3898
3937
|
].slice(-8).map((message) => sanitizeDiagnosticText(message, [], collectOperationSensitiveValues(ticket.intent))),
|
|
3899
3938
|
};
|
|
3900
3939
|
this.#progress = { ...this.#progress, elapsedMs };
|
|
@@ -4117,9 +4156,11 @@ export class TuiController {
|
|
|
4117
4156
|
catch (error) {
|
|
4118
4157
|
if (!this.#operationIsCurrent(generation))
|
|
4119
4158
|
return this.#detachedBlocked(operationId, ticket.intent);
|
|
4120
|
-
const
|
|
4159
|
+
const interruptedApply = error instanceof ConfigApplyInterruptedError ? error : undefined;
|
|
4160
|
+
const code = interruptedApply?.code ?? issueCode(error);
|
|
4121
4161
|
const metadata = readSafeOperationError(error);
|
|
4122
4162
|
const preApply = metadata?.stage === 'preApply';
|
|
4163
|
+
const applyCompletedWork = configApplyHasCompletedWork(interruptedApply?.apply);
|
|
4123
4164
|
const configWrite = error && typeof error === 'object' && 'configWrite' in error
|
|
4124
4165
|
? error.configWrite : undefined;
|
|
4125
4166
|
this.#captureThrownProjection(operationId, error, code, 'execute', ticket.intent, {
|
|
@@ -4130,6 +4171,18 @@ export class TuiController {
|
|
|
4130
4171
|
preApplyExternalEffect: preApply ? 'possible' : 'notApplicable',
|
|
4131
4172
|
finalVerification: 'notStarted',
|
|
4132
4173
|
});
|
|
4174
|
+
if (interruptedApply) {
|
|
4175
|
+
const projected = this.#operationDiagnostics.get(operationId);
|
|
4176
|
+
const applyProjection = projectExecutionDiagnostics(interruptedApply, `${this.#sessionEpoch}:${operationId}:interrupted-apply`, projected.sensitiveValues, ticket.intent.kind);
|
|
4177
|
+
projected.diagnostics.push(...applyProjection.diagnostics);
|
|
4178
|
+
projected.effects = {
|
|
4179
|
+
...applyProjection.effects,
|
|
4180
|
+
awWrite: applyCompletedWork ? 'partial' : projected.effects.awWrite,
|
|
4181
|
+
preApplyExternalEffect: preApply ? 'possible' : applyProjection.effects.preApplyExternalEffect,
|
|
4182
|
+
finalVerification: 'notStarted',
|
|
4183
|
+
};
|
|
4184
|
+
projected.targetEffects = applyProjection.targetEffects;
|
|
4185
|
+
}
|
|
4133
4186
|
await this.#logOperationError(error, code, ticket.intent);
|
|
4134
4187
|
if (!this.#operationIsCurrent(generation))
|
|
4135
4188
|
return this.#detachedBlocked(operationId, ticket.intent);
|
|
@@ -4179,28 +4232,44 @@ export class TuiController {
|
|
|
4179
4232
|
}
|
|
4180
4233
|
if (!this.#operationIsCurrent(generation))
|
|
4181
4234
|
return this.#detachedBlocked(operationId, ticket.intent);
|
|
4235
|
+
const applySummary = interruptedApply ? operationResultSummary(ticket.intent, interruptedApply) : undefined;
|
|
4236
|
+
const configMadeProgress = configWrite === 'succeeded' || applyCompletedWork;
|
|
4237
|
+
const retryTargets = configMadeProgress ? configApplyUnfinishedPlatforms(interruptedApply?.apply, ticket.intent.kind === 'configSave' ? ticket.intent.targets : undefined) : [];
|
|
4238
|
+
const interruptionMessage = interruptedApply
|
|
4239
|
+
? configApplyInterruptionMessage(interruptedApply.code, retryTargets) : undefined;
|
|
4182
4240
|
if ((ticket.intent.kind === 'configSave' || ticket.intent.kind === 'configReset')
|
|
4183
|
-
&&
|
|
4241
|
+
&& configMadeProgress) {
|
|
4184
4242
|
const elapsedMs = Math.max(0, (this.dependencies.now?.() ?? Date.now()) - startedAtMs);
|
|
4185
4243
|
const summary = {
|
|
4244
|
+
...applySummary,
|
|
4186
4245
|
code: 'operationPartial',
|
|
4187
4246
|
message: ticket.intent.kind === 'configReset'
|
|
4188
4247
|
? '设置层重置已提交,但后续步骤未完成。'
|
|
4189
|
-
:
|
|
4190
|
-
?
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
:
|
|
4248
|
+
: applyCompletedWork
|
|
4249
|
+
? configWrite === 'succeeded' ? '设置已保存,部分插件内容已就绪。' : '部分插件内容已就绪。'
|
|
4250
|
+
: finalVerification === 'failed'
|
|
4251
|
+
? ticket.intent.apply
|
|
4252
|
+
? '设置已保存,但后续应用或状态复核失败。'
|
|
4253
|
+
: '设置已保存,但状态复核失败。'
|
|
4254
|
+
: ticket.intent.apply
|
|
4255
|
+
? '设置已保存,但后续应用失败。'
|
|
4256
|
+
: '设置已保存,但后续步骤未完成。',
|
|
4196
4257
|
pluginId: ticket.intent.pluginId,
|
|
4197
4258
|
configScope: 'user', configPlatform: ticket.intent.platform, configContext: ticket.intent.context ?? 'user',
|
|
4259
|
+
...(interruptedApply ? { configApplied: applyCompletedWork } : {}),
|
|
4198
4260
|
...(ticket.intent.kind === 'configSave' && ticket.intent.apply
|
|
4199
|
-
? { configApplyRetryAvailable:
|
|
4261
|
+
? { configApplyRetryAvailable: !interruptedApply || retryTargets.length > 0 } : {}),
|
|
4262
|
+
...(interruptedApply ? { configApplyRetryTargets: retryTargets } : {}),
|
|
4200
4263
|
elapsedMs,
|
|
4201
|
-
messages: [
|
|
4202
|
-
|
|
4203
|
-
|
|
4264
|
+
messages: [
|
|
4265
|
+
...(applySummary?.messages ?? []),
|
|
4266
|
+
...(configWrite === 'succeeded' ? [ticket.intent.kind === 'configReset'
|
|
4267
|
+
? '设置层重置已经提交;失败的后续步骤没有恢复旧设置。'
|
|
4268
|
+
: '配置写入已经提交;失败的后续步骤没有回滚设置。'] : []),
|
|
4269
|
+
...(interruptionMessage ? [interruptionMessage] : []),
|
|
4270
|
+
...(finalVerification === 'failed' && interruptedApply
|
|
4271
|
+
? ['最终状态无法刷新。请稍后重新检查状态。'] : []),
|
|
4272
|
+
],
|
|
4204
4273
|
};
|
|
4205
4274
|
this.#progress = { ...this.#progress, elapsedMs };
|
|
4206
4275
|
const result = {
|
|
@@ -4222,6 +4291,16 @@ export class TuiController {
|
|
|
4222
4291
|
navigation: 'result',
|
|
4223
4292
|
returnRoute: ticket.returnRoute,
|
|
4224
4293
|
writeMayHaveCompleted: ticket.intent.kind === 'catalogSourcesRecovery' ? false : true,
|
|
4294
|
+
...(applySummary && interruptionMessage ? {
|
|
4295
|
+
message: interruptionMessage,
|
|
4296
|
+
summary: {
|
|
4297
|
+
...applySummary,
|
|
4298
|
+
code: 'operationFailed',
|
|
4299
|
+
message: interruptionMessage,
|
|
4300
|
+
configApplyRetryAvailable: false,
|
|
4301
|
+
configApplyRetryTargets: [],
|
|
4302
|
+
},
|
|
4303
|
+
} : {}),
|
|
4225
4304
|
});
|
|
4226
4305
|
}
|
|
4227
4306
|
}
|
|
@@ -4329,7 +4408,7 @@ export class TuiController {
|
|
|
4329
4408
|
if (!this.#operationDiagnostics.has(operationId)) {
|
|
4330
4409
|
this.#captureThrownProjection(operationId, undefined, code, 'execute', options?.intent);
|
|
4331
4410
|
}
|
|
4332
|
-
const message = code === 'codexCliNotFound'
|
|
4411
|
+
const message = options?.message ?? (code === 'codexCliNotFound'
|
|
4333
4412
|
? '操作在插件写入前停止。未找到本机 Codex CLI。请检查 PATH,或安装 Codex CLI 或 Codex App 后重试。'
|
|
4334
4413
|
: code === 'codexSystemCliUnsupported'
|
|
4335
4414
|
? '操作在插件写入前停止。本机 Codex CLI 版本不受支持或无法确认。请升级或修复本机 Codex CLI 或 Codex App 后重试。'
|
|
@@ -4341,7 +4420,7 @@ export class TuiController {
|
|
|
4341
4420
|
? '重置执行后设置层仍然存在。请重新检查设置问题。'
|
|
4342
4421
|
: code === 'issueStillPresent'
|
|
4343
4422
|
? '写入已完成,但重新检查后原问题仍然存在。'
|
|
4344
|
-
: '操作未完成。请重新检查后重试。';
|
|
4423
|
+
: '操作未完成。请重新检查后重试。');
|
|
4345
4424
|
const result = {
|
|
4346
4425
|
state: 'blocked',
|
|
4347
4426
|
operationId,
|
|
@@ -4399,6 +4478,65 @@ export class TuiController {
|
|
|
4399
4478
|
this.#listeners.clear();
|
|
4400
4479
|
}
|
|
4401
4480
|
}
|
|
4481
|
+
function configApplyResult(execution) {
|
|
4482
|
+
if (!execution || typeof execution !== 'object')
|
|
4483
|
+
return undefined;
|
|
4484
|
+
return execution.apply;
|
|
4485
|
+
}
|
|
4486
|
+
export function configApplyHasCompletedWork(apply) {
|
|
4487
|
+
return apply?.targetResults?.some((target) => target.partialDelivery || target.state === 'completed' && target.action !== 'skipped') === true
|
|
4488
|
+
|| apply?.commandResults?.some((result) => result.state === 'completed') === true;
|
|
4489
|
+
}
|
|
4490
|
+
function configApplyUnfinishedPlatforms(apply, reviewedPlatforms) {
|
|
4491
|
+
if (!apply || apply.commandResults?.length)
|
|
4492
|
+
return [];
|
|
4493
|
+
const completed = new Set(apply.targetResults.filter((result) => result.state === 'completed' || result.partialDelivery)
|
|
4494
|
+
.map((result) => result.target.platform));
|
|
4495
|
+
return [...new Set(apply.targetResults.filter((result) => (result.state === 'failed' || result.state === 'skipped' && result.errorCode)
|
|
4496
|
+
&& !completed.has(result.target.platform)
|
|
4497
|
+
&& (!reviewedPlatforms || reviewedPlatforms.includes(result.target.platform)))
|
|
4498
|
+
.map((result) => result.target.platform))];
|
|
4499
|
+
}
|
|
4500
|
+
function configApplyInterruptionMessage(code, retryTargets) {
|
|
4501
|
+
const nextStep = retryTargets.length > 0
|
|
4502
|
+
? '可为未完成平台重新准备确认。' : CONFIG_APPLY_MANUAL_RECOVERY;
|
|
4503
|
+
return code === 'processCleanupUnconfirmed'
|
|
4504
|
+
? `无法确认进程已清理。请先检查相关平台进程。${nextStep}`
|
|
4505
|
+
: `应用已中断。${nextStep}`;
|
|
4506
|
+
}
|
|
4507
|
+
const CONFIG_APPLY_MANUAL_RECOVERY = '请检查未完成位置后,从设置重新准备应用。';
|
|
4508
|
+
function configApplyTargets(apply) {
|
|
4509
|
+
return (apply?.targetResults ?? []).flatMap((entry) => {
|
|
4510
|
+
const target = entry.target;
|
|
4511
|
+
if (!target || !isPlatformTarget(target.platform)
|
|
4512
|
+
|| (target.scope !== 'user' && target.scope !== 'project')
|
|
4513
|
+
|| (entry.state !== 'completed' && entry.state !== 'failed' && entry.state !== 'skipped'))
|
|
4514
|
+
return [];
|
|
4515
|
+
let pluginId;
|
|
4516
|
+
if (typeof target.pluginId === 'string') {
|
|
4517
|
+
try {
|
|
4518
|
+
parsePluginId(target.pluginId);
|
|
4519
|
+
pluginId = target.pluginId;
|
|
4520
|
+
}
|
|
4521
|
+
catch {
|
|
4522
|
+
// Target identity can be unavailable in older receipts.
|
|
4523
|
+
}
|
|
4524
|
+
}
|
|
4525
|
+
return [{
|
|
4526
|
+
...(pluginId ? { pluginId } : {}),
|
|
4527
|
+
platform: target.platform,
|
|
4528
|
+
scope: target.scope,
|
|
4529
|
+
state: entry.state === 'skipped' || entry.action === 'skipped' ? 'skipped'
|
|
4530
|
+
: entry.state === 'failed' ? 'failed'
|
|
4531
|
+
: entry.action === 'keep' ? 'kept' : 'completed',
|
|
4532
|
+
...(entry.partialDelivery ? { partialDelivery: true } : {}),
|
|
4533
|
+
...projectComponentDelivery(entry),
|
|
4534
|
+
...(typeof entry.errorCode === 'string'
|
|
4535
|
+
? { errorCode: safeDiagnosticCode(entry.errorCode, 'configApplyFailed') }
|
|
4536
|
+
: {}),
|
|
4537
|
+
}];
|
|
4538
|
+
});
|
|
4539
|
+
}
|
|
4402
4540
|
function operationResultSummaryUnsafe(intent, execution) {
|
|
4403
4541
|
if (intent.kind === 'catalogStorePrune') {
|
|
4404
4542
|
const result = execution;
|
|
@@ -4762,9 +4900,27 @@ function operationResultSummaryUnsafe(intent, execution) {
|
|
|
4762
4900
|
}
|
|
4763
4901
|
if (intent.kind === 'configSaveBatch') {
|
|
4764
4902
|
const batch = execution;
|
|
4903
|
+
const applies = batch.groups.map((group) => configApplyResult(group.execution));
|
|
4904
|
+
const configDiagnostics = applies.flatMap((apply) => apply?.diagnostics ?? []);
|
|
4905
|
+
const commandResults = applies.flatMap((apply) => apply?.commandResults ?? []);
|
|
4906
|
+
const targets = [...new Map(applies.flatMap(configApplyTargets)
|
|
4907
|
+
.map((target) => [[target.pluginId ?? '', target.platform, target.scope].join('\0'), target])).values()];
|
|
4765
4908
|
const savedCount = batch.groups.filter((group) => group.configSaved).length;
|
|
4766
|
-
const
|
|
4767
|
-
const
|
|
4909
|
+
const targetsUpdated = applies.some(configApplyHasCompletedWork);
|
|
4910
|
+
const configGroups = batch.groups.map((group, index) => ({
|
|
4911
|
+
scope: group.scope,
|
|
4912
|
+
platform: group.platform,
|
|
4913
|
+
configSaved: group.configSaved,
|
|
4914
|
+
applyRequested: group.applyRequested,
|
|
4915
|
+
applyStatus: group.applyStatus,
|
|
4916
|
+
...(group.errorCode ? { errorCode: safeDiagnosticCode(group.errorCode, 'configWriteFailed') } : {}),
|
|
4917
|
+
...(group.status === 'notStarted' ? { notStarted: true } : {}),
|
|
4918
|
+
...(group.applyStatus === 'partial'
|
|
4919
|
+
|| group.errorCode === 'operationInterrupted' || group.errorCode === 'processCleanupUnconfirmed'
|
|
4920
|
+
? { retryTargets: configApplyUnfinishedPlatforms(applies[index]) } : {}),
|
|
4921
|
+
}));
|
|
4922
|
+
const retryScopes = configGroups.filter((group) => group.configSaved && (group.applyStatus === 'failed' || group.applyStatus === 'partial')
|
|
4923
|
+
&& group.errorCode !== 'invalidConfig' && group.retryTargets?.length !== 0);
|
|
4768
4924
|
const invalidConfig = savedCount === batch.groups.length
|
|
4769
4925
|
&& batch.groups.some((group) => group.configSaved && group.errorCode === 'invalidConfig')
|
|
4770
4926
|
&& retryScopes.length === 0;
|
|
@@ -4777,43 +4933,42 @@ function operationResultSummaryUnsafe(intent, execution) {
|
|
|
4777
4933
|
const otherProjectsMayRequireSync = batch.groups.some((group) => group.scope === 'user' && group.execution && typeof group.execution === 'object'
|
|
4778
4934
|
&& group.execution.otherProjectsMayRequireSync === true);
|
|
4779
4935
|
return {
|
|
4780
|
-
code:
|
|
4781
|
-
|
|
4782
|
-
: 'operationSucceeded',
|
|
4936
|
+
code: batch.status === 'succeeded' ? 'operationSucceeded'
|
|
4937
|
+
: batch.status === 'partial' || targetsUpdated ? 'operationPartial' : 'operationFailed',
|
|
4783
4938
|
message: invalidConfig
|
|
4784
4939
|
? '设置已保存,但没有应用。当前配置仍无效。'
|
|
4785
|
-
:
|
|
4940
|
+
: batch.status !== 'succeeded'
|
|
4786
4941
|
? savedCount > 0
|
|
4787
|
-
? `已保存 ${savedCount} 个设置层;${
|
|
4942
|
+
? `已保存 ${savedCount} 个设置层;${targetsUpdated ? '部分插件目标已更新。' : '部分步骤未完成。'}`
|
|
4788
4943
|
: '设置没有保存。'
|
|
4789
4944
|
: '设置已保存。',
|
|
4790
4945
|
pluginId: intent.pluginId,
|
|
4946
|
+
configContext: intent.context ?? 'user',
|
|
4791
4947
|
configApplyRetryAvailable: retryScopes.length > 0,
|
|
4792
4948
|
...(invalidConfig ? { configApplySkippedReason: 'invalidConfig' } : {}),
|
|
4793
4949
|
configApplied: intent.apply
|
|
4794
|
-
? batch.groups.some((group) => group.applyStatus === 'succeeded')
|
|
4950
|
+
? targetsUpdated || batch.groups.some((group) => group.applyStatus === 'succeeded')
|
|
4795
4951
|
: false,
|
|
4796
|
-
configGroups
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
|
|
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
|
-
: []),
|
|
4952
|
+
configGroups,
|
|
4953
|
+
...(targets.length > 0 ? { configTargets: targets } : {}),
|
|
4954
|
+
...(configDiagnostics.length ? { configDiagnostics } : {}),
|
|
4955
|
+
commandResults,
|
|
4956
|
+
...(commandResults.length ? { recoveryActions: [...new Set(commandResults.flatMap((result) => result.recoveryActions))] } : {}),
|
|
4808
4957
|
messages: [
|
|
4809
|
-
...
|
|
4958
|
+
...configGroups.map((group) => {
|
|
4810
4959
|
const label = group.platform ? `${group.platform} 平台配置` : '公共配置';
|
|
4960
|
+
if (group.notStarted)
|
|
4961
|
+
return `${label}尚未保存。`;
|
|
4811
4962
|
return group.configSaved
|
|
4812
4963
|
? `${label}已保存${group.errorCode === 'invalidConfig'
|
|
4813
4964
|
? ',但当前配置无效,未应用'
|
|
4814
|
-
: group.applyStatus === '
|
|
4965
|
+
: group.applyStatus === 'partial' ? ',部分插件目标已更新'
|
|
4966
|
+
: group.applyStatus === 'failed' ? ',但应用失败' : ''}。`
|
|
4815
4967
|
: `${label}保存失败。`;
|
|
4816
4968
|
}),
|
|
4969
|
+
...configGroups.flatMap((group) => group.errorCode === 'operationInterrupted' || group.errorCode === 'processCleanupUnconfirmed'
|
|
4970
|
+
? [configApplyInterruptionMessage(group.errorCode, group.retryTargets ?? [])]
|
|
4971
|
+
: group.retryTargets?.length === 0 ? [CONFIG_APPLY_MANUAL_RECOVERY] : []),
|
|
4817
4972
|
...publicWarnings.map((warning) => `警告:${warning}`),
|
|
4818
4973
|
...(otherProjectsMayRequireSync
|
|
4819
4974
|
? ['提示:其它项目没有被扫描,可能需要在对应项目目录中运行 aw plugin sync --context project。']
|
|
@@ -4822,43 +4977,15 @@ function operationResultSummaryUnsafe(intent, execution) {
|
|
|
4822
4977
|
};
|
|
4823
4978
|
}
|
|
4824
4979
|
if (intent.kind === 'configSave' || intent.kind === 'configReset') {
|
|
4825
|
-
const
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
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
|
-
});
|
|
4980
|
+
const apply = configApplyResult(execution);
|
|
4981
|
+
const configDiagnostics = apply?.diagnostics ?? [];
|
|
4982
|
+
const commandResults = apply?.commandResults ?? [];
|
|
4983
|
+
const targets = configApplyTargets(apply);
|
|
4856
4984
|
const overallState = typeof execution === 'object' && execution !== null
|
|
4857
4985
|
? execution.overallState
|
|
4858
4986
|
: undefined;
|
|
4859
|
-
const applyState =
|
|
4860
|
-
const
|
|
4861
|
-
const invalidConfig = applyState === 'unavailable' && applyReason === 'invalidConfig';
|
|
4987
|
+
const applyState = apply?.state;
|
|
4988
|
+
const invalidConfig = apply?.state === 'unavailable' && apply.reason === 'invalidConfig';
|
|
4862
4989
|
const resetDisposition = typeof execution === 'object' && execution !== null
|
|
4863
4990
|
? execution.resetDisposition
|
|
4864
4991
|
: undefined;
|
|
@@ -4887,18 +5014,34 @@ function operationResultSummaryUnsafe(intent, execution) {
|
|
|
4887
5014
|
const failed = overallState === 'failed'
|
|
4888
5015
|
|| (targets.length > 0
|
|
4889
5016
|
&& targets.every((target) => target.state === 'failed' || target.state === 'skipped'));
|
|
5017
|
+
const retryApply = intent.kind === 'configSave' && intent.retryApply === true;
|
|
5018
|
+
const applied = applyState === 'succeeded' || configApplyHasCompletedWork(apply);
|
|
5019
|
+
const retryable = intent.kind === 'configSave'
|
|
5020
|
+
&& intent.apply && !invalidConfig && (applyState === 'partial' || applyState === 'unavailable');
|
|
5021
|
+
const retryTargets = retryable && intent.kind === 'configSave'
|
|
5022
|
+
? applied || commandResults.some((result) => result.state === 'partial')
|
|
5023
|
+
? configApplyUnfinishedPlatforms(apply, intent.targets)
|
|
5024
|
+
: intent.targets
|
|
5025
|
+
: undefined;
|
|
5026
|
+
if (retryable && retryTargets?.length === 0 && !(execution instanceof ConfigApplyInterruptedError)) {
|
|
5027
|
+
publicMessages.push(CONFIG_APPLY_MANUAL_RECOVERY);
|
|
5028
|
+
}
|
|
4890
5029
|
return {
|
|
4891
5030
|
code: failed || partial ? 'operationPartial' : 'operationSucceeded',
|
|
4892
|
-
message:
|
|
4893
|
-
|
|
5031
|
+
message: retryApply
|
|
5032
|
+
? invalidConfig ? '当前配置仍无效。请返回设置修复。'
|
|
5033
|
+
: failed || partial ? applied ? '部分插件内容已就绪。' : '插件设置应用未完成。'
|
|
5034
|
+
: applied ? '已应用已保存的设置。' : '应用检查完成。'
|
|
5035
|
+
: invalidConfig ? '设置已保存,但没有应用。当前配置仍无效。'
|
|
5036
|
+
: failed || partial ? '设置已保存,但插件内容重新应用失败或部分失败。' : '操作已完成。',
|
|
4894
5037
|
pluginId: intent.pluginId,
|
|
4895
5038
|
configScope: 'user', configPlatform: intent.platform, configContext: intent.context ?? 'user',
|
|
4896
|
-
configApplyRetryAvailable:
|
|
4897
|
-
|
|
4898
|
-
...(
|
|
5039
|
+
configApplyRetryAvailable: retryable && retryTargets?.length !== 0,
|
|
5040
|
+
...(retryTargets ? { configApplyRetryTargets: retryTargets } : {}),
|
|
5041
|
+
...(retryApply ? { configRetryApply: true } : {}),
|
|
4899
5042
|
...(publicMessages.length > 0 ? { messages: publicMessages } : {}),
|
|
4900
5043
|
...(intent.kind === 'configSave'
|
|
4901
|
-
? { configApplied:
|
|
5044
|
+
? { configApplied: applied }
|
|
4902
5045
|
: invalidConfig ? { configApplied: false } : {}),
|
|
4903
5046
|
...(invalidConfig ? { configApplySkippedReason: 'invalidConfig' } : {}),
|
|
4904
5047
|
...(intent.kind === 'configReset'
|
|
@@ -4913,6 +5056,7 @@ function operationResultSummaryUnsafe(intent, execution) {
|
|
|
4913
5056
|
}
|
|
4914
5057
|
: {}),
|
|
4915
5058
|
...(targets.length > 0 ? { configTargets: targets } : {}),
|
|
5059
|
+
...(configDiagnostics.length ? { configDiagnostics } : {}),
|
|
4916
5060
|
...(commandResults.length > 0 ? { commandResults,
|
|
4917
5061
|
recoveryActions: [...new Set(commandResults.flatMap((result) => result.recoveryActions))] } : {}),
|
|
4918
5062
|
};
|