@lesliechan721/aw 0.1.0-beta.62 → 0.1.0-beta.64
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/src/tui/console-app-v4.js +19 -10
- package/dist/src/tui/console-app-v4.js.map +1 -1
- package/dist/src/tui/controller-runtime.js +56 -12
- package/dist/src/tui/controller-runtime.js.map +1 -1
- package/dist/src/utils/plugin-config-references.d.ts +2 -0
- package/dist/src/utils/plugin-config-references.js +10 -5
- package/dist/src/utils/plugin-config-references.js.map +1 -1
- package/package.json +3 -3
|
@@ -17,7 +17,7 @@ import { assertProjectSharedConfigPathVisible } from '../utils/project-boundary.
|
|
|
17
17
|
import { calculatePluginIntentDigest, readPluginIntentState, } from '../utils/plugin-intent-state.js';
|
|
18
18
|
import { applyPluginConfigWrite, replayConfigRuntimeWrites, resolveConfigPreApplyAuthorization, resetPluginConfigWithHelper, } from '../utils/plugin-config-write.js';
|
|
19
19
|
import { analyzePluginConfigMutationImpact, discoverPluginConfigManagedCommandPackages, pluginConfigTargetRenderScopes, pluginSharedNativeConfigTargets } from '../utils/plugin-config-impact.js';
|
|
20
|
-
import { collectPluginConfigReferenceEvidence, resolvePluginConfigReferenceConsumers, resolvePluginConfigReferencePlugins } from '../utils/plugin-config-references.js';
|
|
20
|
+
import { collectPluginConfigReferenceEvidence, pluginConfigHasExternalReferences, resolvePluginConfigReferenceConsumers, resolvePluginConfigReferencePlugins } from '../utils/plugin-config-references.js';
|
|
21
21
|
import { createBatchIntentCompatiblePlanFingerprint } from '../commands/operation-plan.js';
|
|
22
22
|
import { inventoryCatalogSourceReferences } from '../utils/catalog-source-references.js';
|
|
23
23
|
import { operationEvidenceMatches, operationEvidenceFingerprint, TuiConfigInvalidStoreError, TuiController, TuiOperationBlockedError, } from './controller.js';
|
|
@@ -132,14 +132,20 @@ export function configAffectedStatusTargets(targets, pluginId, configScope, cons
|
|
|
132
132
|
.sort((left, right) => `${left.pluginId}\0${left.platform}\0${left.scope}`
|
|
133
133
|
.localeCompare(`${right.pluginId}\0${right.platform}\0${right.scope}`, 'en'));
|
|
134
134
|
}
|
|
135
|
-
|
|
136
|
-
|
|
135
|
+
function configNeedsReferencePlugins(plugin) {
|
|
136
|
+
return pluginConfigHasExternalReferences(plugin.manifest)
|
|
137
|
+
|| Object.values(plugin.manifest.config?.fields ?? {})
|
|
138
|
+
.some((field) => field.type === 'array' && field.items.type === 'object');
|
|
139
|
+
}
|
|
140
|
+
async function configRetrySharedNativeRenderTargets(plugin, targets, env, referencePlugins) {
|
|
141
|
+
const plugins = await resolvePluginConfigReferenceConsumers({ plugin, env, plugins: referencePlugins });
|
|
137
142
|
return plugins.flatMap((consumer) => pluginSharedNativeConfigTargets(consumer).filter((shared) => targets.some((target) => (target.pluginName ?? plugin.manifest.name) === consumer.manifest.name
|
|
138
143
|
&& target.platform === (shared.platform ?? 'codex'))));
|
|
139
144
|
}
|
|
140
145
|
async function configRetryStoreDigest(options) {
|
|
141
146
|
const plugins = await resolvePluginConfigReferencePlugins({ sourceId: options.plugin.sourceId,
|
|
142
|
-
sourceIdentity: options.plugin.sourceIdentity, logicalIdentity: options.plugin.catalogLogicalIdentity,
|
|
147
|
+
sourceIdentity: options.plugin.sourceIdentity, logicalIdentity: options.plugin.catalogLogicalIdentity,
|
|
148
|
+
env: options.env, plugins: options.plugins });
|
|
143
149
|
const byName = new Map([...plugins, options.plugin].map((plugin) => [plugin.manifest.name, plugin]));
|
|
144
150
|
const profiles = [{ pluginName: options.plugin.manifest.name, scope: options.scope },
|
|
145
151
|
...options.targets.flatMap((target) => {
|
|
@@ -2153,13 +2159,28 @@ export function createTuiControllerDependencies(context, progressFeed, options =
|
|
|
2153
2159
|
catalogOperationByEvidence.set(evidence, catalogOperation);
|
|
2154
2160
|
return evidence;
|
|
2155
2161
|
}
|
|
2156
|
-
const
|
|
2162
|
+
const needsReferencePlugins = intent.kind === 'configSave'
|
|
2163
|
+
&& await withResolvedCatalogPlugin({
|
|
2164
|
+
selector: intent.pluginId, cliVersion: packageInfo.version, env: context.env,
|
|
2165
|
+
...(catalogOperation ? { operationContext: catalogOperation } : {}),
|
|
2166
|
+
...(signal ? { signal } : {}),
|
|
2167
|
+
consume: ({ plugin }) => configNeedsReferencePlugins(plugin),
|
|
2168
|
+
});
|
|
2169
|
+
const referencePlugins = needsReferencePlugins
|
|
2170
|
+
? await resolvePluginConfigReferencePlugins({
|
|
2171
|
+
sourceId: parsePluginId(intent.pluginId).sourceId,
|
|
2172
|
+
env: context.env,
|
|
2173
|
+
operationContext: catalogOperation,
|
|
2174
|
+
})
|
|
2175
|
+
: undefined;
|
|
2176
|
+
const configReferencePluginIds = intent.kind === 'configSave' && needsReferencePlugins
|
|
2157
2177
|
? await withResolvedCatalogPlugin({
|
|
2158
2178
|
selector: intent.pluginId, cliVersion: packageInfo.version, env: context.env,
|
|
2159
2179
|
...(catalogOperation ? { operationContext: catalogOperation } : {}),
|
|
2160
2180
|
...(signal ? { signal } : {}),
|
|
2161
|
-
consume: async ({ plugin }) => (await resolvePluginConfigReferenceConsumers({
|
|
2162
|
-
|
|
2181
|
+
consume: async ({ plugin }) => (await resolvePluginConfigReferenceConsumers({
|
|
2182
|
+
plugin, env: context.env, plugins: referencePlugins,
|
|
2183
|
+
})).map((entry) => entry.pluginId ?? `${entry.sourceId}/${entry.manifest.name}`),
|
|
2163
2184
|
})
|
|
2164
2185
|
: [];
|
|
2165
2186
|
if (preparation && intent.kind === 'configSave') {
|
|
@@ -2199,6 +2220,7 @@ export function createTuiControllerDependencies(context, progressFeed, options =
|
|
|
2199
2220
|
}
|
|
2200
2221
|
const impact = intent.retryApply ? undefined : await analyzePluginConfigMutationImpact({
|
|
2201
2222
|
plugin,
|
|
2223
|
+
referencePlugins,
|
|
2202
2224
|
scope: intent.scope,
|
|
2203
2225
|
cwd: context.cwd,
|
|
2204
2226
|
env: context.env,
|
|
@@ -2214,7 +2236,7 @@ export function createTuiControllerDependencies(context, progressFeed, options =
|
|
|
2214
2236
|
: impact.affectedTargets;
|
|
2215
2237
|
const commandPackages = impact?.affectedCommandPackages
|
|
2216
2238
|
?? (await discoverPluginConfigManagedCommandPackages({ plugin, scope: intent.scope,
|
|
2217
|
-
cwd: context.cwd, env: context.env ?? process.env, platformTargets: affectedTargets })).packages;
|
|
2239
|
+
cwd: context.cwd, env: context.env ?? process.env, platformTargets: affectedTargets, referencePlugins })).packages;
|
|
2218
2240
|
const preApplyAuthorization = configIntentRequestsApply(intent)
|
|
2219
2241
|
? (await resolveConfigPreApplyAuthorization({
|
|
2220
2242
|
plugin,
|
|
@@ -2224,6 +2246,7 @@ export function createTuiControllerDependencies(context, progressFeed, options =
|
|
|
2224
2246
|
applyTargets: affectedTargets,
|
|
2225
2247
|
nativeCliRunner: context.nativeCliRunner,
|
|
2226
2248
|
rebuildRuntime: {
|
|
2249
|
+
referencePlugins,
|
|
2227
2250
|
catalogOperationContext: preparedCatalogOperation,
|
|
2228
2251
|
expectedGenerationSetDigest: preparedCatalogOperation.generationSetDigest,
|
|
2229
2252
|
inventoryCatalogSourceReferences: operationInventory,
|
|
@@ -2237,9 +2260,10 @@ export function createTuiControllerDependencies(context, progressFeed, options =
|
|
|
2237
2260
|
commandPackages,
|
|
2238
2261
|
preApplyAuthorization,
|
|
2239
2262
|
retryStoreDigest: intent.retryApply ? await configRetryStoreDigest({ plugin, scope: intent.scope,
|
|
2240
|
-
targets: affectedTargets, commandPackages, preApplyAuthorization, cwd: context.cwd, env: context.env
|
|
2263
|
+
targets: affectedTargets, commandPackages, preApplyAuthorization, cwd: context.cwd, env: context.env,
|
|
2264
|
+
plugins: referencePlugins }) : undefined,
|
|
2241
2265
|
sharedNativeRenderTargets: intent.retryApply
|
|
2242
|
-
? await configRetrySharedNativeRenderTargets(plugin, affectedTargets, context.env)
|
|
2266
|
+
? await configRetrySharedNativeRenderTargets(plugin, affectedTargets, context.env, referencePlugins)
|
|
2243
2267
|
: impact.sharedNativeRenderTargets,
|
|
2244
2268
|
};
|
|
2245
2269
|
},
|
|
@@ -2349,6 +2373,7 @@ export function createTuiControllerDependencies(context, progressFeed, options =
|
|
|
2349
2373
|
const impact = intent.kind === 'configSave' && !intent.retryApply
|
|
2350
2374
|
? await analyzePluginConfigMutationImpact({
|
|
2351
2375
|
plugin,
|
|
2376
|
+
referencePlugins,
|
|
2352
2377
|
scope: intent.scope,
|
|
2353
2378
|
cwd: context.cwd,
|
|
2354
2379
|
env: context.env,
|
|
@@ -2367,6 +2392,7 @@ export function createTuiControllerDependencies(context, progressFeed, options =
|
|
|
2367
2392
|
?? (intent.kind === 'configSave' ? (await discoverPluginConfigManagedCommandPackages({
|
|
2368
2393
|
plugin, scope: intent.scope, cwd: context.cwd, env: context.env ?? process.env,
|
|
2369
2394
|
platformTargets: configImpactVisibleTargets(plugin.manifest.name, configVisibleTargets),
|
|
2395
|
+
referencePlugins,
|
|
2370
2396
|
})).packages : []);
|
|
2371
2397
|
const preApplyAuthorization = intent.kind === 'configSave'
|
|
2372
2398
|
&& configIntentRequestsApply(intent)
|
|
@@ -2380,6 +2406,7 @@ export function createTuiControllerDependencies(context, progressFeed, options =
|
|
|
2380
2406
|
: impact.affectedTargets,
|
|
2381
2407
|
nativeCliRunner: context.nativeCliRunner,
|
|
2382
2408
|
rebuildRuntime: {
|
|
2409
|
+
referencePlugins,
|
|
2383
2410
|
...(catalogOperation ? { catalogOperationContext: catalogOperation } : {}),
|
|
2384
2411
|
...(catalogOperation?.generationSetDigest
|
|
2385
2412
|
? { expectedGenerationSetDigest: catalogOperation.generationSetDigest }
|
|
@@ -2396,10 +2423,10 @@ export function createTuiControllerDependencies(context, progressFeed, options =
|
|
|
2396
2423
|
preApplyAuthorization,
|
|
2397
2424
|
retryStoreDigest: intent.kind === 'configSave' && intent.retryApply
|
|
2398
2425
|
? await configRetryStoreDigest({ plugin, scope: intent.scope, targets: affectedTargets,
|
|
2399
|
-
commandPackages, preApplyAuthorization, cwd: context.cwd, env: context.env }) : undefined,
|
|
2426
|
+
commandPackages, preApplyAuthorization, cwd: context.cwd, env: context.env, plugins: referencePlugins }) : undefined,
|
|
2400
2427
|
sharedNativeRenderTargets: intent.kind === 'configSave'
|
|
2401
2428
|
? intent.retryApply
|
|
2402
|
-
? await configRetrySharedNativeRenderTargets(plugin, configImpactVisibleTargets(plugin.manifest.name, configVisibleTargets), context.env)
|
|
2429
|
+
? await configRetrySharedNativeRenderTargets(plugin, configImpactVisibleTargets(plugin.manifest.name, configVisibleTargets), context.env, referencePlugins)
|
|
2403
2430
|
: impact.sharedNativeRenderTargets
|
|
2404
2431
|
: [],
|
|
2405
2432
|
};
|
|
@@ -3781,6 +3808,13 @@ export function createTuiControllerDependencies(context, progressFeed, options =
|
|
|
3781
3808
|
...(groupCatalogOperation ? { operationContext: groupCatalogOperation } : {}),
|
|
3782
3809
|
consume: async ({ plugin, source }) => {
|
|
3783
3810
|
assertSourceEvidenceMatches(freshSource, sourceEvidenceForPlugin(source, plugin.manifest.name));
|
|
3811
|
+
const referencePlugins = configNeedsReferencePlugins(plugin) ? await resolvePluginConfigReferencePlugins({
|
|
3812
|
+
sourceId: plugin.sourceId,
|
|
3813
|
+
sourceIdentity: plugin.sourceIdentity,
|
|
3814
|
+
logicalIdentity: plugin.catalogLogicalIdentity,
|
|
3815
|
+
env: context.env,
|
|
3816
|
+
operationContext: groupCatalogOperation,
|
|
3817
|
+
}) : undefined;
|
|
3784
3818
|
const applyTargets = intent.apply
|
|
3785
3819
|
? freshConfig.affectedTargets.map((target) => ({
|
|
3786
3820
|
pluginName: target.pluginName ?? plugin.manifest.name,
|
|
@@ -3797,6 +3831,7 @@ export function createTuiControllerDependencies(context, progressFeed, options =
|
|
|
3797
3831
|
nativeCliRunner: context.nativeCliRunner,
|
|
3798
3832
|
rebuildRuntime: {
|
|
3799
3833
|
...context,
|
|
3834
|
+
referencePlugins,
|
|
3800
3835
|
awHomeMutationToken,
|
|
3801
3836
|
operationDiagnosticSink: (entries) => {
|
|
3802
3837
|
operationRebuildResults.push(...structuredClone(entries));
|
|
@@ -3905,6 +3940,13 @@ export function createTuiControllerDependencies(context, progressFeed, options =
|
|
|
3905
3940
|
...(catalogOperation ? { operationContext: catalogOperation } : {}),
|
|
3906
3941
|
consume: async ({ plugin, source }) => {
|
|
3907
3942
|
assertSourceEvidenceMatches(currentSource, sourceEvidenceForPlugin(source, plugin.manifest.name));
|
|
3943
|
+
const referencePlugins = configNeedsReferencePlugins(plugin) ? await resolvePluginConfigReferencePlugins({
|
|
3944
|
+
sourceId: plugin.sourceId,
|
|
3945
|
+
sourceIdentity: plugin.sourceIdentity,
|
|
3946
|
+
logicalIdentity: plugin.catalogLogicalIdentity,
|
|
3947
|
+
env: context.env,
|
|
3948
|
+
operationContext: catalogOperation,
|
|
3949
|
+
}) : undefined;
|
|
3908
3950
|
const applyTargets = intent.retryApply || intent.apply
|
|
3909
3951
|
? currentEvidence.config?.affectedTargets.map((target) => ({
|
|
3910
3952
|
pluginName: target.pluginName ?? plugin.manifest.name,
|
|
@@ -3921,6 +3963,7 @@ export function createTuiControllerDependencies(context, progressFeed, options =
|
|
|
3921
3963
|
nativeCliRunner: context.nativeCliRunner,
|
|
3922
3964
|
rebuildRuntime: {
|
|
3923
3965
|
...context,
|
|
3966
|
+
referencePlugins,
|
|
3924
3967
|
awHomeMutationToken,
|
|
3925
3968
|
operationDiagnosticSink,
|
|
3926
3969
|
...(reviewedScriptTimeoutMs(intent) === undefined
|
|
@@ -3946,6 +3989,7 @@ export function createTuiControllerDependencies(context, progressFeed, options =
|
|
|
3946
3989
|
nativeCliRunner: context.nativeCliRunner,
|
|
3947
3990
|
rebuildRuntime: {
|
|
3948
3991
|
...context,
|
|
3992
|
+
referencePlugins,
|
|
3949
3993
|
awHomeMutationToken,
|
|
3950
3994
|
operationDiagnosticSink,
|
|
3951
3995
|
...(reviewedScriptTimeoutMs(intent) === undefined
|