@lesliechan721/aw 0.1.0-beta.20 → 0.1.0-beta.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/src/commands/status-v6.js +44 -25
  2. package/dist/src/commands/status-v6.js.map +1 -1
  3. package/dist/src/tui/components.d.ts +1 -0
  4. package/dist/src/tui/components.js +3 -1
  5. package/dist/src/tui/components.js.map +1 -1
  6. package/dist/src/tui/console-app-v4.d.ts +1 -1
  7. package/dist/src/tui/console-app-v4.js +756 -1127
  8. package/dist/src/tui/console-app-v4.js.map +1 -1
  9. package/dist/src/tui/controller-runtime.js +65 -42
  10. package/dist/src/tui/controller-runtime.js.map +1 -1
  11. package/dist/src/tui/controller.d.ts +4 -30
  12. package/dist/src/tui/controller.js +7 -219
  13. package/dist/src/tui/controller.js.map +1 -1
  14. package/dist/src/tui/dependency-graph.d.ts +3 -3
  15. package/dist/src/tui/dependency-graph.js +15 -14
  16. package/dist/src/tui/dependency-graph.js.map +1 -1
  17. package/dist/src/tui/glossary.d.ts +1 -1
  18. package/dist/src/tui/glossary.js +1 -1
  19. package/dist/src/tui/glossary.js.map +1 -1
  20. package/dist/src/tui/model.d.ts +2 -0
  21. package/dist/src/tui/model.js +63 -30
  22. package/dist/src/tui/model.js.map +1 -1
  23. package/dist/src/tui/operation-review-planner.js +8 -195
  24. package/dist/src/tui/operation-review-planner.js.map +1 -1
  25. package/dist/src/tui/plugin-write-task.js +4 -0
  26. package/dist/src/tui/plugin-write-task.js.map +1 -1
  27. package/dist/src/tui/router.d.ts +4 -16
  28. package/dist/src/tui/router.js.map +1 -1
  29. package/dist/src/tui/screen-registry.d.ts +10 -57
  30. package/dist/src/tui/screen-registry.js +1 -15
  31. package/dist/src/tui/screen-registry.js.map +1 -1
  32. package/package.json +3 -3
  33. package/dist/src/tui/catalog-management-screens.d.ts +0 -45
  34. package/dist/src/tui/catalog-management-screens.js +0 -25
  35. package/dist/src/tui/catalog-management-screens.js.map +0 -1
  36. package/dist/src/tui/catalog-management.d.ts +0 -240
  37. package/dist/src/tui/catalog-management.js +0 -856
  38. package/dist/src/tui/catalog-management.js.map +0 -1
@@ -17,10 +17,9 @@ import { analyzePluginConfigMutationImpact } from '../utils/plugin-config-impact
17
17
  import { createBatchIntentCompatiblePlanFingerprint } from '../commands/operation-plan.js';
18
18
  import { inventoryCatalogSourceReferences } from '../utils/catalog-source-references.js';
19
19
  import { operationEvidenceMatches, operationEvidenceFingerprint, TuiConfigInvalidStoreError, TuiController, TuiOperationBlockedError, } from './controller.js';
20
- import { buildConfigGroups, buildConfigPage, buildTuiViewModel, projectPlatformPlacement, } from './model.js';
20
+ import { buildConfigGroups, buildConfigPage, buildTuiViewModel, hasActualScopeEvidence, projectPlatformPlacement, } from './model.js';
21
21
  import { buildPluginWriteTaskCandidates, buildPluginWriteTaskDraft, evaluatePluginWriteTaskRestoreVersion, pluginWriteTaskTargetKey, } from './plugin-write-task.js';
22
22
  import { projectExecutionDiagnostics, projectThrownOperationDiagnostic } from './diagnostic-projection.js';
23
- import { createCatalogManagementService, } from './catalog-management.js';
24
23
  import { projectCatalogSourceLocation } from '../utils/catalog-source-presentation.js';
25
24
  import { calculateCatalogSourceConfigFingerprint, calculateCatalogSourceIdentity, } from '../utils/catalog-source-identity.js';
26
25
  import { checkAwCapabilitySupport, readPluginManifest } from '../utils/manifest.js';
@@ -350,6 +349,7 @@ async function loadDependencyOverviews(options) {
350
349
  sourceId: item.resolution.sourceId,
351
350
  pluginName: entry.name,
352
351
  }),
352
+ sourceIdentity: item.resolution.sourceIdentity,
353
353
  displayName: entry.interface?.displayName ?? entry.name,
354
354
  dependencies: entry.dependencies.map((pluginName) => formatPluginId({ sourceId: item.resolution.sourceId, pluginName })),
355
355
  }))
@@ -376,6 +376,55 @@ async function loadDependencyOverviews(options) {
376
376
  const unsupportedPluginIds = new Set(options.status.pluginSummaries
377
377
  .filter((summary) => (summary.missingCapabilities?.length ?? 0) > 0)
378
378
  .map((summary) => summary.pluginId));
379
+ const availableReferencesFor = (consumerPluginId, dependencyPluginId) => {
380
+ const consumerSourceId = parsePluginId(consumerPluginId).sourceId;
381
+ const dependencySourceId = parsePluginId(dependencyPluginId).sourceId;
382
+ const consumerNode = nodes.get(consumerPluginId);
383
+ const dependencyNode = nodes.get(dependencyPluginId);
384
+ if (consumerSourceId !== dependencySourceId
385
+ || !nodes.get(consumerPluginId)?.dependencies.includes(dependencyPluginId))
386
+ return [];
387
+ return (targetsByPlugin.get(consumerPluginId) ?? []).flatMap((consumer) => {
388
+ if (!hasActualScopeEvidence(consumer)
389
+ || consumer.sourceId !== consumerSourceId
390
+ || consumer.sourceIdentity !== consumerNode?.sourceIdentity)
391
+ return [];
392
+ return [...consumer.components, ...(consumer.sharedComponents ?? [])].flatMap((component) => {
393
+ if (component.kind !== 'dependency'
394
+ || component.key !== dependencyPluginId
395
+ || component.state !== 'ready')
396
+ return [];
397
+ const platform = component.metadata?.platform;
398
+ const scope = component.metadata?.scope;
399
+ const project = component.metadata?.project;
400
+ if ((platform !== 'codex' && platform !== 'claude')
401
+ || (scope !== 'user' && scope !== 'project')
402
+ || project !== (scope === 'project' ? 'current' : 'none'))
403
+ return [];
404
+ const dependency = (targetsByPlugin.get(dependencyPluginId) ?? []).find((target) => target.platform === platform
405
+ && target.scope === scope
406
+ && target.sourceId === dependencySourceId
407
+ && target.sourceIdentity === dependencyNode?.sourceIdentity
408
+ && target.sourceIdentity === consumer.sourceIdentity);
409
+ if (!dependency)
410
+ return [];
411
+ return [{
412
+ consumer: {
413
+ pluginId: consumerPluginId,
414
+ platform: consumer.platform,
415
+ scope: consumer.scope,
416
+ project: consumer.scope === 'project' ? 'current' : null,
417
+ },
418
+ dependency: {
419
+ pluginId: dependencyPluginId,
420
+ platform,
421
+ scope,
422
+ project: scope === 'project' ? 'current' : null,
423
+ },
424
+ }];
425
+ });
426
+ });
427
+ };
379
428
  const placementsFor = (pluginId) => {
380
429
  const targets = targetsByPlugin.get(pluginId) ?? [];
381
430
  if (targets.length > 0) {
@@ -448,6 +497,7 @@ async function loadDependencyOverviews(options) {
448
497
  placements,
449
498
  aggregateStatus: aggregateFor(dependency.pluginId, placements),
450
499
  placementReferences: [],
500
+ availablePlacementReferences: availableReferencesFor(pluginId, dependency.pluginId),
451
501
  };
452
502
  });
453
503
  const dependentIds = [...new Set(reverse.get(pluginId) ?? [])].sort();
@@ -462,6 +512,7 @@ async function loadDependencyOverviews(options) {
462
512
  placements,
463
513
  aggregateStatus: aggregateFor(dependentId, placements),
464
514
  placementReferences: [],
515
+ availablePlacementReferences: availableReferencesFor(dependentId, pluginId),
465
516
  };
466
517
  });
467
518
  const targetBlockers = (targetsByPlugin.get(pluginId) ?? []).flatMap((target) => target.reasons.filter((error) => error.code.startsWith('dependency') || error.code === 'sourceChanged')
@@ -541,7 +592,6 @@ function createReviewStageReporter(options) {
541
592
  };
542
593
  }
543
594
  export function createTuiControllerDependencies(context, progressFeed, options = {}) {
544
- const catalogManagement = createCatalogManagementService(context);
545
595
  const readInventory = options.inventoryCatalogSourceReferences
546
596
  ?? inventoryCatalogSourceReferences;
547
597
  const validatedStoreEntries = new Map();
@@ -766,20 +816,6 @@ export function createTuiControllerDependencies(context, progressFeed, options =
766
816
  await observationSession.dispose();
767
817
  }
768
818
  }
769
- if (intent.kind === 'catalogManagement') {
770
- signal?.throwIfAborted();
771
- await preparation?.reporter.emit('validate');
772
- const managementEvidence = await catalogManagement.captureEvidence(intent);
773
- signal?.throwIfAborted();
774
- await preparation?.reporter.emit('evidence');
775
- return {
776
- catalog: {
777
- configDigest: managementEvidence.workspaceBinding ?? 'catalog-store',
778
- compositeDigest: managementEvidence.evidenceDigest,
779
- },
780
- catalogManagement: managementEvidence,
781
- };
782
- }
783
819
  if (intent.kind === 'configReset') {
784
820
  const parsed = parsePluginId(intent.pluginId);
785
821
  if (!parsed.sourceId || !parsed.pluginName) {
@@ -2169,7 +2205,18 @@ export function createTuiControllerDependencies(context, progressFeed, options =
2169
2205
  }
2170
2206
  const blocker = dependencyPlan.targets.find((target) => target.action === 'block');
2171
2207
  if (blocker) {
2172
- throw new TuiOperationBlockedError(blocker.errorCode ?? 'dependencyNotReady', `${blocker.errorCode ?? 'dependencyNotReady'}: 依赖安装计划被阻止。`);
2208
+ const code = blocker.errorCode ?? 'dependencyNotReady';
2209
+ const reason = code === 'dependencyScopeConflict' || code === 'codexExtensionScopeConflict'
2210
+ ? '这个依赖的安装位置存在冲突,需要先选择保留的位置。'
2211
+ : code === 'artifactCollision' || code === 'exclusiveOwnerEvidenceInvalid'
2212
+ ? '这个依赖的安装位置被其他内容占用,需要先检查并处理冲突。'
2213
+ : '这个依赖尚不可用,需要先检查并恢复后再安装。';
2214
+ throw new TuiOperationBlockedError(code, `${blocker.pluginId}:${reason}`, [{
2215
+ id: `dependency:${blocker.pluginId}:${blocker.platform}:${blocker.resolvedScope}`,
2216
+ code, stage: 'dependencyPlan', safeMessage: reason,
2217
+ target: { pluginId: blocker.pluginId, platform: blocker.platform, scope: blocker.resolvedScope },
2218
+ causes: [], detailLines: [],
2219
+ }]);
2173
2220
  }
2174
2221
  }
2175
2222
  const managerPreview = preview?.codexManagerPreview;
@@ -2268,7 +2315,6 @@ export function createTuiControllerDependencies(context, progressFeed, options =
2268
2315
  return evidence;
2269
2316
  };
2270
2317
  const dependencies = {
2271
- catalogManagement,
2272
2318
  beginCatalogSession(sessionOptions) {
2273
2319
  sessionCatalogOperationContext = undefined;
2274
2320
  if (sessionOptions?.reuseValidatedGenerations !== true) {
@@ -2375,10 +2421,6 @@ export function createTuiControllerDependencies(context, progressFeed, options =
2375
2421
  return evidence.dependencyPlan;
2376
2422
  },
2377
2423
  async validateIntent(intent, signal) {
2378
- if (intent.kind === 'catalogManagement') {
2379
- signal.throwIfAborted();
2380
- return;
2381
- }
2382
2424
  if (intent.kind === 'catalogSourcesRecovery') {
2383
2425
  signal.throwIfAborted();
2384
2426
  return;
@@ -2626,25 +2668,6 @@ export function createTuiControllerDependencies(context, progressFeed, options =
2626
2668
  };
2627
2669
  },
2628
2670
  async executeIntent(intent, expectedEvidence, signal) {
2629
- if (intent.kind === 'catalogManagement') {
2630
- signal?.throwIfAborted();
2631
- if (!expectedEvidence.catalogManagement) {
2632
- throw new TuiOperationBlockedError('operationReviewStale', 'Catalog management Review evidence is missing.');
2633
- }
2634
- const progressLabels = {
2635
- validate: '验证 Catalog 状态',
2636
- build: '构建 Catalog snapshot',
2637
- source: '更新开发来源',
2638
- sync: '同步开发来源',
2639
- prune: '清理 Catalog store',
2640
- prepare: '准备发布计划',
2641
- remote: '写入 Catalog 远端',
2642
- verify: '验证操作结果',
2643
- };
2644
- return catalogManagement.execute(intent, expectedEvidence.catalogManagement, (stage) => {
2645
- progressFeed?.setCurrent({ target: 'Catalog 管理', phase: progressLabels[stage] }, `Catalog 管理:${progressLabels[stage]}`);
2646
- });
2647
- }
2648
2671
  if (intent.kind === 'catalogSourcesRecovery') {
2649
2672
  signal?.throwIfAborted();
2650
2673
  return recoverInvalidCatalogSourcesConfig({ env: context.env });