@lesliechan721/aw 0.1.0-beta.82 → 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.
- package/dist/authoring/assets/aw-runtime-config.mjs +1 -1
- package/dist/authoring/assets/aw-runtime-config.mjs.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 +11 -5
- package/dist/src/commands/public-lifecycle-result.js +131 -46
- 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 +28 -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 +647 -286
- package/dist/src/commands/rebuild-command.js.map +1 -1
- package/dist/src/commands/rebuild-integration.d.ts +5 -2
- package/dist/src/commands/rebuild-integration.js +55 -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 +23 -4
- package/dist/src/commands/rebuild-operations.js.map +1 -1
- package/dist/src/commands/rebuild-platform-integration.d.ts +14 -3
- package/dist/src/commands/rebuild-platform-integration.js +240 -137
- package/dist/src/commands/rebuild-platform-integration.js.map +1 -1
- package/dist/src/index.js +105 -50
- package/dist/src/index.js.map +1 -1
- package/dist/src/output/public-result.d.ts +2 -0
- package/dist/src/output/public-result.js +43 -6
- 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 +55 -18
- package/dist/src/output/receipt-projection.js.map +1 -1
- package/dist/src/output/skill-invocation-notices.d.ts +16 -0
- package/dist/src/output/skill-invocation-notices.js +48 -0
- package/dist/src/output/skill-invocation-notices.js.map +1 -0
- package/dist/src/platforms/capabilities.d.ts +2 -0
- package/dist/src/platforms/capabilities.js +73 -34
- package/dist/src/platforms/capabilities.js.map +1 -1
- package/dist/src/platforms/contracts.d.ts +9 -9
- package/dist/src/platforms/discovery.d.ts +0 -7
- package/dist/src/platforms/discovery.js +13 -53
- package/dist/src/platforms/discovery.js.map +1 -1
- package/dist/src/platforms/inspection-native.js +1 -80
- package/dist/src/platforms/inspection-native.js.map +1 -1
- package/dist/src/platforms/inspection-query.d.ts +2 -3
- package/dist/src/platforms/inspection-query.js +7 -18
- package/dist/src/platforms/inspection-query.js.map +1 -1
- package/dist/src/platforms/inspection.js +2 -2
- package/dist/src/platforms/inspection.js.map +1 -1
- package/dist/src/platforms/layout.js +1 -5
- 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.js +4 -88
- package/dist/src/platforms/lifecycle-native.js.map +1 -1
- package/dist/src/platforms/lifecycle.js +56 -56
- package/dist/src/platforms/lifecycle.js.map +1 -1
- package/dist/src/platforms/projection-code-extension.js +7 -3
- 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 +86 -54
- package/dist/src/platforms/projection.js.map +1 -1
- package/dist/src/portable/materializer.js +2 -2
- package/dist/src/portable/materializer.js.map +1 -1
- package/dist/src/portable/recovery.d.ts +29 -3
- package/dist/src/portable/recovery.js +220 -78
- package/dist/src/portable/recovery.js.map +1 -1
- package/dist/src/recovery/coordinator.d.ts +21 -5
- package/dist/src/recovery/coordinator.js +383 -151
- 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 +195 -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 +11 -4
- package/dist/src/recovery/joint-coordinator.js +681 -333
- package/dist/src/recovery/joint-coordinator.js.map +1 -1
- package/dist/src/recovery/joint-demand.d.ts +8 -0
- package/dist/src/recovery/joint-demand.js +52 -1
- 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 +20 -0
- package/dist/src/recovery/receipt.js +67 -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.js +26 -27
- 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 +13 -4
- package/dist/src/review/platform-profile.js.map +1 -1
- package/dist/src/review/skill-materialization.d.ts +1 -0
- package/dist/src/review/skill-materialization.js +28 -16
- package/dist/src/review/skill-materialization.js.map +1 -1
- package/dist/src/review/source-binding.js +6 -4
- package/dist/src/review/source-binding.js.map +1 -1
- package/dist/src/tui/catalog-generation.d.ts +6 -0
- package/dist/src/tui/catalog-generation.js +22 -6
- package/dist/src/tui/catalog-generation.js.map +1 -1
- package/dist/src/tui/console-app-v4.d.ts +1 -1
- package/dist/src/tui/console-app-v4.js +139 -59
- package/dist/src/tui/console-app-v4.js.map +1 -1
- package/dist/src/tui/controller-runtime.js +145 -53
- package/dist/src/tui/controller-runtime.js.map +1 -1
- package/dist/src/tui/controller.d.ts +13 -4
- package/dist/src/tui/controller.js +241 -102
- package/dist/src/tui/controller.js.map +1 -1
- package/dist/src/tui/deployment-view.js +6 -1
- package/dist/src/tui/deployment-view.js.map +1 -1
- package/dist/src/tui/diagnostic-projection.d.ts +4 -2
- package/dist/src/tui/diagnostic-projection.js +40 -4
- package/dist/src/tui/diagnostic-projection.js.map +1 -1
- package/dist/src/tui/glossary.js +1 -0
- package/dist/src/tui/glossary.js.map +1 -1
- package/dist/src/tui/operation-diagnostic-screens.d.ts +1 -1
- package/dist/src/tui/operation-diagnostic-screens.js +3 -1
- package/dist/src/tui/operation-diagnostic-screens.js.map +1 -1
- package/dist/src/tui/operation-history.d.ts +6 -3
- package/dist/src/tui/operation-history.js +15 -2
- package/dist/src/tui/operation-history.js.map +1 -1
- package/dist/src/tui/scoped-flow.d.ts +3 -1
- package/dist/src/tui/scoped-flow.js +99 -1
- package/dist/src/tui/scoped-flow.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 +8 -1
- package/dist/src/types.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-generation-resolver.d.ts +1 -0
- package/dist/src/utils/catalog-generation-resolver.js +1 -0
- package/dist/src/utils/catalog-generation-resolver.js.map +1 -1
- package/dist/src/utils/catalog-operation-context.d.ts +11 -0
- package/dist/src/utils/catalog-operation-context.js +18 -3
- package/dist/src/utils/catalog-operation-context.js.map +1 -1
- package/dist/src/utils/catalog-source-references.js +2 -14
- package/dist/src/utils/catalog-source-references.js.map +1 -1
- package/dist/src/utils/component-resources.js +1 -1
- package/dist/src/utils/component-resources.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.d.ts +0 -19
- package/dist/src/utils/native-cli.js +2 -42
- package/dist/src/utils/native-cli.js.map +1 -1
- package/dist/src/utils/ownership.js +1 -1
- package/dist/src/utils/ownership.js.map +1 -1
- package/dist/src/utils/platform-empty-state.d.ts +1 -3
- package/dist/src/utils/platform-empty-state.js +1 -6
- 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 +89 -25
- package/dist/src/utils/plugin-config-write.js.map +1 -1
- package/dist/src/utils/plugin-scripts.js +5 -0
- package/dist/src/utils/plugin-scripts.js.map +1 -1
- package/dist/src/utils/skill-invocation-warning.d.ts +15 -0
- package/dist/src/utils/skill-invocation-warning.js +42 -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
|
@@ -14,23 +14,24 @@ import { withResolvedCatalogPlugin, withResolvedMultiSourceCatalog, formatPlugin
|
|
|
14
14
|
import { coercePluginConfigUpdates, inspectPluginConfigResetTarget, listNamespacedPluginConfigStoreIdentities, readPluginConfigStore, replacePluginConfigStoreLayer, resolveConfigRead, resolveEffectivePluginConfig, resolveEffectivePluginConfigFromStores, resolvePluginConfigReferenceContext, } from '../utils/plugin-config.js';
|
|
15
15
|
import { readRecoveryStatus } from '../recovery/status.js';
|
|
16
16
|
import { readJointDemand } from '../recovery/joint-demand.js';
|
|
17
|
+
import { RecoveryInterruptedError } from '../recovery/interruption.js';
|
|
17
18
|
import { catalogSourceErrorCode, sanitizeCatalogSourceError } from '../utils/catalog-public-error.js';
|
|
18
19
|
import { activateRecoverySourcesAndReprepare, prepareRecovery, executeRecovery, } from '../recovery/coordinator.js';
|
|
19
20
|
import { prepareRetire, executeRetire } from '../recovery/retirement.js';
|
|
20
21
|
import { prepareTargetsPlan, executeTargetsPlan, prepareIntentPlan, executeIntentPlan } from './scoped-flow.js';
|
|
21
|
-
import { applyPluginConfigWrite, applyPluginConfig, preparePluginConfigApply, disposePluginConfigApply, resolveConfigPreApplyAuthorization, resetPluginConfigWithHelper, } from '../utils/plugin-config-write.js';
|
|
22
|
+
import { applyPluginConfigWrite, applyPluginConfig, ConfigApplyInterruptedError, preparePluginConfigApply, disposePluginConfigApply, resolveConfigPreApplyAuthorization, resetPluginConfigWithHelper, } from '../utils/plugin-config-write.js';
|
|
22
23
|
import { analyzePluginConfigMutationImpact, discoverPluginConfigManagedCommandPackages, pluginConfigTargetRenderScopes, pluginSharedNativeConfigRenderUnits } from '../utils/plugin-config-impact.js';
|
|
23
24
|
import { collectPluginConfigReferenceEvidence, pluginConfigHasExternalReferences, resolvePluginConfigReferenceConsumers, resolvePluginConfigReferencePlugins } from '../utils/plugin-config-references.js';
|
|
24
25
|
import { inventoryCatalogSourceReferences } from '../utils/catalog-source-references.js';
|
|
25
|
-
import { operationEvidenceMatches, operationEvidenceFingerprint, TuiConfigInvalidStoreError, TuiController, TuiOperationBlockedError, } from './controller.js';
|
|
26
|
+
import { operationEvidenceMatches, operationEvidenceFingerprint, configApplyHasCompletedWork, TuiConfigInvalidStoreError, TuiController, TuiOperationBlockedError, } from './controller.js';
|
|
26
27
|
import { buildConfigPage, } from './model.js';
|
|
27
28
|
import { projectCatalogSourceLocation } from '../utils/catalog-source-presentation.js';
|
|
28
29
|
import { calculateCatalogSourceConfigFingerprint, calculateCatalogSourceIdentity, } from '../utils/catalog-source-identity.js';
|
|
29
30
|
import { checkAwCapabilitySupport, readPluginManifest } from '../utils/manifest.js';
|
|
30
31
|
import { withAwHomeMutationLock } from '../utils/aw-home-mutation-lock.js';
|
|
31
32
|
import { IMPLEMENTED_AW_CAPABILITIES } from '../commands/aw-capabilities.js';
|
|
32
|
-
import { calculateCatalogGenerationSetDigest, resolveActiveCatalogGeneration, } from '../utils/catalog-generation-resolver.js';
|
|
33
|
-
import { resolveCatalogOperationContext, resolvePartialCatalogOperationContext, selectCatalogOperationContext, } from '../utils/catalog-operation-context.js';
|
|
33
|
+
import { calculateCatalogGenerationSetDigest, createCatalogPreparationStoreKey, resolveActiveCatalogGeneration, } from '../utils/catalog-generation-resolver.js';
|
|
34
|
+
import { CatalogPreparationReadScope, resolveCatalogOperationContext, resolvePartialCatalogOperationContext, selectCatalogOperationContext, } from '../utils/catalog-operation-context.js';
|
|
34
35
|
import { createCatalogStoreKey, readCatalogStoreEntry, } from '../utils/catalog-generation-store.js';
|
|
35
36
|
import { activateCatalogSourceGeneration, compareCatalogGenerationFreshness, probeCatalogSourceFreshness, probeCatalogSourceGeneration, probeCatalogSourceRepairGeneration, recoverCatalogGenerationStateAndActivate, repairCatalogSourceGeneration, replaceDamagedCatalogSourceGeneration, } from '../utils/catalog-generation-service.js';
|
|
36
37
|
import { calculateCatalogSourceImpactDigest, inspectCatalogSourceImpact, } from '../utils/catalog-source-impact.js';
|
|
@@ -38,9 +39,30 @@ import { readCatalogGenerationState } from '../utils/catalog-generation-state.js
|
|
|
38
39
|
import { CatalogGenerationError } from '../utils/catalog-generation-error.js';
|
|
39
40
|
import { CatalogProviderCompatibilityError } from '../utils/catalog-public-error.js';
|
|
40
41
|
import { loadCatalogGenerationViewModels } from './catalog-generation.js';
|
|
42
|
+
import { recoveryReason } from './glossary.js';
|
|
41
43
|
import { executePortableRetry, installPortableSkills, preparePortableInstall, preparePortableRetry, PortableCommandError, recheckPortableInstall, } from '../portable/commands.js';
|
|
42
44
|
import { projectPluginContentOverview, } from './plugin-content.js';
|
|
43
45
|
import { executeCatalogStoreTask, inspectCatalogStoreTask, prepareCatalogStoreTask, } from './catalog-store-task.js';
|
|
46
|
+
function installSourceBinding(catalog, sourceId) {
|
|
47
|
+
const generation = catalog?.generationSet.sources.find((source) => source.sourceId === sourceId);
|
|
48
|
+
const resolution = catalog?.catalog.sources.find((source) => source.sourceId === sourceId)?.resolution;
|
|
49
|
+
return generation && resolution && createCatalogPreparationStoreKey({ ...generation, requestedRef: resolution.requestedRef });
|
|
50
|
+
}
|
|
51
|
+
function homeGenerationsMatch(catalog, generations, configured) {
|
|
52
|
+
if (generations.length !== catalog.catalog.sources.length)
|
|
53
|
+
return false;
|
|
54
|
+
return generations.every((view) => {
|
|
55
|
+
const bound = catalog.generationSet.sources.find((source) => source.sourceId === view.sourceId);
|
|
56
|
+
const source = catalog.catalog.sources.find((item) => item.sourceId === view.sourceId);
|
|
57
|
+
if (!bound)
|
|
58
|
+
return source?.error !== undefined && catalogSourceErrorCode(source.error)
|
|
59
|
+
=== (view.configMismatch ? 'catalogGenerationIdentityMismatch' : view.errorCode);
|
|
60
|
+
const config = configured.sources.find((item) => item.id === view.sourceId);
|
|
61
|
+
return view.state === 'ready' && view.active?.storeKey === bound.storeKey
|
|
62
|
+
&& view.active.resolvedCommit === bound.resolvedCommit && view.active.requestedRef === source?.resolution?.requestedRef
|
|
63
|
+
&& config?.sourceIdentity === bound.sourceIdentity && calculateCatalogSourceConfigFingerprint(config) === bound.sourceConfigFingerprint;
|
|
64
|
+
});
|
|
65
|
+
}
|
|
44
66
|
function reusableCandidateEvidenceIsComplete(candidate) {
|
|
45
67
|
const evidence = candidate.probe.candidate;
|
|
46
68
|
return [
|
|
@@ -597,13 +619,15 @@ function createReviewStageReporter(options) {
|
|
|
597
619
|
export function createTuiControllerDependencies(context, progressFeed, options = {}) {
|
|
598
620
|
const readInventory = options.inventoryCatalogSourceReferences
|
|
599
621
|
?? inventoryCatalogSourceReferences;
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
const loadCatalogGenerations = async () => {
|
|
622
|
+
let validatedStoreEntries = new Map();
|
|
623
|
+
let validatingStoreEntries = new Map();
|
|
624
|
+
const loadCatalogGenerations = async (entries, signal, preparation) => {
|
|
603
625
|
const generations = await loadCatalogGenerationViewModels({
|
|
604
626
|
env: context.env,
|
|
605
|
-
|
|
606
|
-
|
|
627
|
+
signal,
|
|
628
|
+
preparation,
|
|
629
|
+
validatedStoreEntries: entries,
|
|
630
|
+
validatingStoreEntries: new Map(),
|
|
607
631
|
onStage: (event) => context.debugLogger.log({
|
|
608
632
|
type: 'performance:stage',
|
|
609
633
|
level: 'debug',
|
|
@@ -615,9 +639,9 @@ export function createTuiControllerDependencies(context, progressFeed, options =
|
|
|
615
639
|
const retained = new Set(generations.flatMap((source) => [
|
|
616
640
|
source.active?.storeKey,
|
|
617
641
|
].filter((value) => value !== undefined)));
|
|
618
|
-
for (const storeKey of
|
|
642
|
+
for (const storeKey of entries.keys()) {
|
|
619
643
|
if (!retained.has(storeKey))
|
|
620
|
-
|
|
644
|
+
entries.delete(storeKey);
|
|
621
645
|
}
|
|
622
646
|
return generations;
|
|
623
647
|
};
|
|
@@ -632,6 +656,8 @@ export function createTuiControllerDependencies(context, progressFeed, options =
|
|
|
632
656
|
let sessionCatalogOperationContext;
|
|
633
657
|
let sessionStatusResult;
|
|
634
658
|
let sessionRecoveryStatus;
|
|
659
|
+
let latestStatusRead = 0;
|
|
660
|
+
let bindNewCatalog = true;
|
|
635
661
|
const sessionContextForPlugin = (pluginId) => {
|
|
636
662
|
const sourceId = parsePluginId(pluginId).sourceId;
|
|
637
663
|
if (!sourceId || !sessionCatalogOperationContext)
|
|
@@ -678,14 +704,14 @@ export function createTuiControllerDependencies(context, progressFeed, options =
|
|
|
678
704
|
};
|
|
679
705
|
const loadStatus = async (signal) => {
|
|
680
706
|
signal.throwIfAborted();
|
|
707
|
+
const read = ++latestStatusRead;
|
|
708
|
+
const pinnedContext = bindNewCatalog ? undefined : sessionCatalogOperationContext;
|
|
709
|
+
const sessionStoreEntries = validatedStoreEntries;
|
|
681
710
|
const packageInfo = await readCliPackageInfo();
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
signal
|
|
686
|
-
validatedStoreEntries,
|
|
687
|
-
validatingStoreEntries,
|
|
688
|
-
}).catch(async (error) => {
|
|
711
|
+
for (let attempt = 0; attempt < 3; attempt += 1) {
|
|
712
|
+
const catalogReadScope = pinnedContext ? undefined : new CatalogPreparationReadScope({ env: context.env, signal });
|
|
713
|
+
const catalogOperationContext = pinnedContext ?? await catalogReadScope?.resolve({}).catch(async (error) => {
|
|
714
|
+
signal.throwIfAborted();
|
|
689
715
|
if (!(error instanceof CatalogGenerationError)
|
|
690
716
|
|| error.code !== 'catalogGenerationStateInvalid')
|
|
691
717
|
return undefined;
|
|
@@ -711,21 +737,16 @@ export function createTuiControllerDependencies(context, progressFeed, options =
|
|
|
711
737
|
},
|
|
712
738
|
};
|
|
713
739
|
});
|
|
714
|
-
if (catalogOperationContext)
|
|
715
|
-
sessionCatalogOperationContext = catalogOperationContext;
|
|
716
|
-
for (let attempt = 0; attempt < 3; attempt += 1) {
|
|
717
740
|
const result = await loadCatalogView({ context, cliVersion: packageInfo.version, signal,
|
|
718
741
|
...(catalogOperationContext ? { catalogOperationContext } : {}) });
|
|
719
|
-
const snapshot = await readJointDemand({ cwd: context.cwd, env: context.env, signal, catalogOperationContext
|
|
742
|
+
const snapshot = await readJointDemand({ cwd: context.cwd, env: context.env, signal, catalogOperationContext, catalogReadScope,
|
|
743
|
+
...(catalogOperationContext ? { resolveCatalog: async () => ({
|
|
744
|
+
context: catalogOperationContext,
|
|
745
|
+
configured: new Set(catalogOperationContext.catalog.sources.map((source) => source.sourceId)),
|
|
746
|
+
}) } : {}),
|
|
747
|
+
});
|
|
720
748
|
const current = await readRecoveryStatus({ cwd: context.cwd, env: context.env, signal,
|
|
721
|
-
cliVersion: packageInfo.version, nativeCliRunner: context.nativeCliRunner, catalogOperationContext }, snapshot);
|
|
722
|
-
signal.throwIfAborted();
|
|
723
|
-
const configured = await listCatalogSources({ env: context.env });
|
|
724
|
-
signal.throwIfAborted();
|
|
725
|
-
if (result.payload.catalog.configDigest !== configured.configDigest)
|
|
726
|
-
continue;
|
|
727
|
-
sessionStatusResult = result;
|
|
728
|
-
sessionRecoveryStatus = current;
|
|
749
|
+
cliVersion: packageInfo.version, nativeCliRunner: context.nativeCliRunner, catalogOperationContext, catalogReadScope }, snapshot);
|
|
729
750
|
const dependencyOverviews = await loadDependencyOverviews({
|
|
730
751
|
context,
|
|
731
752
|
cliVersion: packageInfo.version,
|
|
@@ -741,7 +762,9 @@ export function createTuiControllerDependencies(context, progressFeed, options =
|
|
|
741
762
|
...(catalogOperationContext ? { catalogOperationContext } : {}),
|
|
742
763
|
});
|
|
743
764
|
signal.throwIfAborted();
|
|
744
|
-
const
|
|
765
|
+
const storeEntries = new Map(catalogReadScope ? undefined : sessionStoreEntries);
|
|
766
|
+
const catalogGenerations = await loadCatalogGenerations(storeEntries, signal, catalogReadScope
|
|
767
|
+
? { scope: catalogReadScope, context: catalogOperationContext } : undefined);
|
|
745
768
|
signal.throwIfAborted();
|
|
746
769
|
const configStoreInventory = (await Promise.all(['user'].map(async (scope) => {
|
|
747
770
|
try {
|
|
@@ -764,9 +787,16 @@ export function createTuiControllerDependencies(context, progressFeed, options =
|
|
|
764
787
|
return [];
|
|
765
788
|
}
|
|
766
789
|
}))).flat();
|
|
790
|
+
const configured = await listCatalogSources({ env: context.env });
|
|
767
791
|
signal.throwIfAborted();
|
|
792
|
+
if (result.payload.catalog.configDigest !== configured.configDigest
|
|
793
|
+
|| catalogOperationContext && !homeGenerationsMatch(catalogOperationContext, catalogGenerations, configured)) {
|
|
794
|
+
if (pinnedContext)
|
|
795
|
+
break;
|
|
796
|
+
continue;
|
|
797
|
+
}
|
|
768
798
|
const statusById = new Map(result.payload.catalog.sources.map((source) => [source.id, source]));
|
|
769
|
-
|
|
799
|
+
const status = {
|
|
770
800
|
cliChannel: packageInfo.version.includes('-') ? 'beta' : 'latest',
|
|
771
801
|
...(current.coverage.projectRoot ? { projectRoot: current.coverage.projectRoot } : {}),
|
|
772
802
|
scopedRecovery: { user: { ...scopedCurrentStatus(current, snapshot, 'user'), dependencyOverviews },
|
|
@@ -805,8 +835,18 @@ export function createTuiControllerDependencies(context, progressFeed, options =
|
|
|
805
835
|
};
|
|
806
836
|
}),
|
|
807
837
|
};
|
|
838
|
+
// Details and Review consume the same accepted read as the home view.
|
|
839
|
+
if (read === latestStatusRead) {
|
|
840
|
+
bindNewCatalog = false;
|
|
841
|
+
sessionCatalogOperationContext = catalogOperationContext;
|
|
842
|
+
sessionStatusResult = result;
|
|
843
|
+
sessionRecoveryStatus = current;
|
|
844
|
+
validatedStoreEntries = storeEntries;
|
|
845
|
+
validatingStoreEntries = new Map();
|
|
846
|
+
}
|
|
847
|
+
return status;
|
|
808
848
|
}
|
|
809
|
-
throw new TuiOperationBlockedError('operationReviewStale', '
|
|
849
|
+
throw new TuiOperationBlockedError('operationReviewStale', '状态读取期间 Catalog 持续变化。请按 H 重新加载。');
|
|
810
850
|
};
|
|
811
851
|
const loadPluginContent = async (pluginId, signal) => {
|
|
812
852
|
signal.throwIfAborted();
|
|
@@ -1784,34 +1824,38 @@ export function createTuiControllerDependencies(context, progressFeed, options =
|
|
|
1784
1824
|
previewAgentSettings: (preferences, pluginId) => previewAgentSettings(context, preferences, pluginId),
|
|
1785
1825
|
saveAgentSettings: (request) => saveAgentSettings(context, request),
|
|
1786
1826
|
beginCatalogSession(sessionOptions) {
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1827
|
+
latestStatusRead += 1;
|
|
1828
|
+
bindNewCatalog = true;
|
|
1829
|
+
validatedStoreEntries = sessionOptions?.reuseValidatedGenerations === true
|
|
1830
|
+
? new Map(validatedStoreEntries) : new Map();
|
|
1831
|
+
validatingStoreEntries = new Map();
|
|
1792
1832
|
},
|
|
1793
1833
|
loadStatus,
|
|
1794
1834
|
async loadScopedStatus(scope, signal) {
|
|
1795
1835
|
signal.throwIfAborted();
|
|
1836
|
+
const read = latestStatusRead;
|
|
1837
|
+
const pinnedContext = sessionCatalogOperationContext;
|
|
1838
|
+
const catalogView = sessionStatusResult;
|
|
1839
|
+
const storeEntries = { validatedStoreEntries, validatingStoreEntries };
|
|
1796
1840
|
const packageInfo = await readCliPackageInfo();
|
|
1797
1841
|
const currentCatalog = await resolvePartialCatalogOperationContext({
|
|
1798
|
-
env: context.env, signal,
|
|
1842
|
+
env: context.env, signal, ...storeEntries,
|
|
1799
1843
|
});
|
|
1800
1844
|
signal.throwIfAborted();
|
|
1801
|
-
if (
|
|
1802
|
-
&& currentCatalog.generationSetDigest !== sessionCatalogOperationContext.generationSetDigest) {
|
|
1845
|
+
if (pinnedContext && currentCatalog.generationSetDigest !== pinnedContext.generationSetDigest) {
|
|
1803
1846
|
throw new TuiOperationBlockedError('catalogSessionReloadRequired', 'Catalog 已变化。请按 H 重新加载,再检查清单。');
|
|
1804
1847
|
}
|
|
1805
|
-
const catalogOperationContext =
|
|
1848
|
+
const catalogOperationContext = pinnedContext ?? currentCatalog;
|
|
1806
1849
|
const snapshot = await readJointDemand({ scope, cwd: context.cwd, env: context.env, signal, catalogOperationContext });
|
|
1807
1850
|
const status = await readRecoveryStatus({ scope, cwd: context.cwd, env: context.env, cliVersion: packageInfo.version,
|
|
1808
1851
|
nativeCliRunner: context.nativeCliRunner, catalogOperationContext, signal }, snapshot);
|
|
1809
1852
|
signal.throwIfAborted();
|
|
1810
|
-
|
|
1811
|
-
const source = sessionStatusResult ?? await loadCatalogView({ context, cliVersion: packageInfo.version, signal, catalogOperationContext });
|
|
1853
|
+
const source = catalogView ?? await loadCatalogView({ context, cliVersion: packageInfo.version, signal, catalogOperationContext });
|
|
1812
1854
|
const dependencyOverviews = await loadDependencyOverviews({ context, cliVersion: packageInfo.version, status,
|
|
1813
1855
|
pluginSummaries: source.pluginSummaries, signal, catalogOperationContext });
|
|
1814
1856
|
signal.throwIfAborted();
|
|
1857
|
+
if (read === latestStatusRead)
|
|
1858
|
+
sessionRecoveryStatus = status;
|
|
1815
1859
|
return { ...scopedCurrentStatus(status, snapshot, scope), dependencyOverviews };
|
|
1816
1860
|
},
|
|
1817
1861
|
async prepareScopedTask(request, signal) {
|
|
@@ -1839,6 +1883,7 @@ export function createTuiControllerDependencies(context, progressFeed, options =
|
|
|
1839
1883
|
}
|
|
1840
1884
|
const packageInfo = await readCliPackageInfo();
|
|
1841
1885
|
signal.throwIfAborted();
|
|
1886
|
+
const pinned = sessionCatalogOperationContext;
|
|
1842
1887
|
const plan = await prepareRecovery(request.command ?? 'sync', request.selectors, {
|
|
1843
1888
|
signal,
|
|
1844
1889
|
scope: request.scope, cwd: context.cwd, env: context.env,
|
|
@@ -1848,6 +1893,18 @@ export function createTuiControllerDependencies(context, progressFeed, options =
|
|
|
1848
1893
|
...(request.targets ? { targets: request.targets } : {}),
|
|
1849
1894
|
...(request.force ? { force: true } : {}),
|
|
1850
1895
|
...(request.refresh ? { refresh: true } : {}),
|
|
1896
|
+
...(request.command === 'install' && !request.refresh && pinned ? {
|
|
1897
|
+
checkInstallCatalog(current, roots) {
|
|
1898
|
+
for (const sourceId of new Set(roots.map((id) => parsePluginId(id).sourceId))) {
|
|
1899
|
+
if (!sourceId)
|
|
1900
|
+
continue;
|
|
1901
|
+
if (installSourceBinding(pinned, sourceId) !== installSourceBinding(current, sourceId)
|
|
1902
|
+
|| (pinned.generationSet.primarySourceId === sourceId) !== (current?.generationSet.primarySourceId === sourceId)) {
|
|
1903
|
+
throw new TuiOperationBlockedError('catalogSessionReloadRequired', recoveryReason('catalogSessionReloadRequired'));
|
|
1904
|
+
}
|
|
1905
|
+
}
|
|
1906
|
+
},
|
|
1907
|
+
} : {}),
|
|
1851
1908
|
...(request.retireUnselectedTargets ? { retireUnselectedTargets: true } : {}),
|
|
1852
1909
|
...(request.scriptTimeoutMs !== undefined ? { scriptTimeoutMs: request.scriptTimeoutMs } : {}),
|
|
1853
1910
|
...(request.dependencyScopeOverrides?.length
|
|
@@ -1878,12 +1935,22 @@ export function createTuiControllerDependencies(context, progressFeed, options =
|
|
|
1878
1935
|
const refreshed = await activateRecoverySourcesAndReprepare(plan.plan, { runtime: context });
|
|
1879
1936
|
return { kind: 'recoveryReview', plan: { kind: 'recovery', scope: plan.scope, plan: refreshed } };
|
|
1880
1937
|
}
|
|
1881
|
-
const receipt = await executeRecovery(plan.plan, {
|
|
1938
|
+
const receipt = await executeRecovery(plan.plan, {
|
|
1939
|
+
yes: true,
|
|
1940
|
+
runtime: progressFeed ? { ...context, onInstallProgress: progressFeed.setInstallProgress } : context,
|
|
1941
|
+
}).catch((error) => {
|
|
1942
|
+
if (!(error instanceof RecoveryInterruptedError))
|
|
1943
|
+
throw error;
|
|
1944
|
+
if (context.interruption && error.code === 'processCleanupUnconfirmed')
|
|
1945
|
+
context.interruption.cleanupFailed = true;
|
|
1946
|
+
return error.receipt;
|
|
1947
|
+
});
|
|
1882
1948
|
return { kind: 'recovery', receipt };
|
|
1883
1949
|
},
|
|
1884
1950
|
loadPluginContent,
|
|
1885
1951
|
async probeCatalogFreshness(sourceId, freshnessOptions, signal) {
|
|
1886
1952
|
signal.throwIfAborted();
|
|
1953
|
+
const storeEntries = { validatedStoreEntries, validatingStoreEntries };
|
|
1887
1954
|
const packageInfo = await readCliPackageInfo();
|
|
1888
1955
|
return probeCatalogSourceFreshness({
|
|
1889
1956
|
sourceId,
|
|
@@ -1893,8 +1960,7 @@ export function createTuiControllerDependencies(context, progressFeed, options =
|
|
|
1893
1960
|
fullValidation: freshnessOptions.fullValidation,
|
|
1894
1961
|
runtime: {
|
|
1895
1962
|
...options.catalogGenerationRuntime,
|
|
1896
|
-
|
|
1897
|
-
validatingStoreEntries,
|
|
1963
|
+
...storeEntries,
|
|
1898
1964
|
},
|
|
1899
1965
|
});
|
|
1900
1966
|
},
|
|
@@ -2589,7 +2655,15 @@ export function createTuiControllerDependencies(context, progressFeed, options =
|
|
|
2589
2655
|
const approvedPreApplyTargets = reviewedBatch.groups.flatMap((group) => group.config.preApplyAuthorization ?? []);
|
|
2590
2656
|
const results = [];
|
|
2591
2657
|
const packageInfo = await readCliPackageInfo();
|
|
2658
|
+
let interrupted = false;
|
|
2592
2659
|
for (const group of intent.groups) {
|
|
2660
|
+
if (interrupted) {
|
|
2661
|
+
results.push({
|
|
2662
|
+
scope: 'user', platform: group.platform, status: 'notStarted',
|
|
2663
|
+
configSaved: false, applyRequested: intent.apply, applyStatus: intent.apply ? 'notStarted' : 'notRequested',
|
|
2664
|
+
});
|
|
2665
|
+
continue;
|
|
2666
|
+
}
|
|
2593
2667
|
const groupIntent = configSaveBatchGroupIntent(intent, group);
|
|
2594
2668
|
const reviewedGroup = reviewedBatch.groups.find((item) => item.platform === group.platform);
|
|
2595
2669
|
if (!reviewedGroup) {
|
|
@@ -2685,15 +2759,16 @@ export function createTuiControllerDependencies(context, progressFeed, options =
|
|
|
2685
2759
|
? 'succeeded'
|
|
2686
2760
|
: result.apply.state === 'skipped'
|
|
2687
2761
|
? 'notNeeded'
|
|
2688
|
-
: 'failed';
|
|
2762
|
+
: configApplyHasCompletedWork(result.apply) ? 'partial' : 'failed';
|
|
2763
|
+
const applyIncomplete = applyStatus === 'failed' || applyStatus === 'partial';
|
|
2689
2764
|
results.push({
|
|
2690
2765
|
scope: 'user', platform: group.platform,
|
|
2691
|
-
status:
|
|
2766
|
+
status: applyIncomplete ? 'failed' : 'succeeded',
|
|
2692
2767
|
configSaved,
|
|
2693
2768
|
applyRequested: intent.apply,
|
|
2694
2769
|
applyStatus,
|
|
2695
2770
|
execution: { ...result, operationRebuildResults },
|
|
2696
|
-
...(
|
|
2771
|
+
...(applyIncomplete ? {
|
|
2697
2772
|
errorCode: result.apply.state === 'unavailable'
|
|
2698
2773
|
? result.apply.error?.code ?? result.apply.reason
|
|
2699
2774
|
: result.apply.targetResults.find((target) => target.errorCode)?.errorCode
|
|
@@ -2702,6 +2777,13 @@ export function createTuiControllerDependencies(context, progressFeed, options =
|
|
|
2702
2777
|
});
|
|
2703
2778
|
}
|
|
2704
2779
|
catch (error) {
|
|
2780
|
+
const interruption = error instanceof ConfigApplyInterruptedError ? error : undefined;
|
|
2781
|
+
if (interruption) {
|
|
2782
|
+
interrupted = true;
|
|
2783
|
+
if (context.interruption && interruption.code === 'processCleanupUnconfirmed') {
|
|
2784
|
+
context.interruption.cleanupFailed = true;
|
|
2785
|
+
}
|
|
2786
|
+
}
|
|
2705
2787
|
configSaved = error?.configWrite === 'succeeded';
|
|
2706
2788
|
const errorCode = typeof error === 'object' && error !== null
|
|
2707
2789
|
&& 'code' in error && typeof error.code === 'string'
|
|
@@ -2712,10 +2794,14 @@ export function createTuiControllerDependencies(context, progressFeed, options =
|
|
|
2712
2794
|
status: 'failed',
|
|
2713
2795
|
configSaved,
|
|
2714
2796
|
applyRequested: intent.apply,
|
|
2715
|
-
applyStatus: intent.apply ? '
|
|
2797
|
+
applyStatus: !intent.apply ? 'notRequested'
|
|
2798
|
+
: configApplyHasCompletedWork(interruption?.apply) ? 'partial' : 'failed',
|
|
2716
2799
|
errorCode,
|
|
2717
|
-
...(operationRebuildResults.length > 0
|
|
2718
|
-
? { execution: {
|
|
2800
|
+
...(interruption || operationRebuildResults.length > 0
|
|
2801
|
+
? { execution: {
|
|
2802
|
+
operationRebuildResults,
|
|
2803
|
+
...(interruption ? { apply: interruption.apply, operationDiagnostic: interruption.operationDiagnostic } : {}),
|
|
2804
|
+
} }
|
|
2719
2805
|
: {}),
|
|
2720
2806
|
});
|
|
2721
2807
|
}
|
|
@@ -2837,6 +2923,12 @@ export function createTuiControllerDependencies(context, progressFeed, options =
|
|
|
2837
2923
|
});
|
|
2838
2924
|
return { ...result, operationRebuildResults };
|
|
2839
2925
|
},
|
|
2926
|
+
}).catch((error) => {
|
|
2927
|
+
if (error instanceof ConfigApplyInterruptedError && context.interruption
|
|
2928
|
+
&& error.code === 'processCleanupUnconfirmed') {
|
|
2929
|
+
context.interruption.cleanupFailed = true;
|
|
2930
|
+
}
|
|
2931
|
+
throw error;
|
|
2840
2932
|
});
|
|
2841
2933
|
}
|
|
2842
2934
|
throw new TuiOperationBlockedError('operationNotImplemented', '这个写操作尚未接入新 Controller。');
|