@lesliechan721/aw 0.1.0-beta.19 → 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 (43) hide show
  1. package/dist/src/commands/rebuild-command.js +0 -5
  2. package/dist/src/commands/rebuild-command.js.map +1 -1
  3. package/dist/src/commands/rebuild-integration.d.ts +0 -1
  4. package/dist/src/commands/rebuild-integration.js +3 -152
  5. package/dist/src/commands/rebuild-integration.js.map +1 -1
  6. package/dist/src/commands/status-v6.js +44 -25
  7. package/dist/src/commands/status-v6.js.map +1 -1
  8. package/dist/src/tui/components.d.ts +1 -0
  9. package/dist/src/tui/components.js +3 -1
  10. package/dist/src/tui/components.js.map +1 -1
  11. package/dist/src/tui/console-app-v4.d.ts +1 -1
  12. package/dist/src/tui/console-app-v4.js +765 -1129
  13. package/dist/src/tui/console-app-v4.js.map +1 -1
  14. package/dist/src/tui/controller-runtime.js +94 -51
  15. package/dist/src/tui/controller-runtime.js.map +1 -1
  16. package/dist/src/tui/controller.d.ts +4 -30
  17. package/dist/src/tui/controller.js +11 -219
  18. package/dist/src/tui/controller.js.map +1 -1
  19. package/dist/src/tui/dependency-graph.d.ts +3 -3
  20. package/dist/src/tui/dependency-graph.js +15 -14
  21. package/dist/src/tui/dependency-graph.js.map +1 -1
  22. package/dist/src/tui/glossary.d.ts +1 -1
  23. package/dist/src/tui/glossary.js +1 -1
  24. package/dist/src/tui/glossary.js.map +1 -1
  25. package/dist/src/tui/model.d.ts +2 -0
  26. package/dist/src/tui/model.js +63 -30
  27. package/dist/src/tui/model.js.map +1 -1
  28. package/dist/src/tui/operation-review-planner.js +8 -195
  29. package/dist/src/tui/operation-review-planner.js.map +1 -1
  30. package/dist/src/tui/plugin-write-task.js +4 -0
  31. package/dist/src/tui/plugin-write-task.js.map +1 -1
  32. package/dist/src/tui/router.d.ts +4 -16
  33. package/dist/src/tui/router.js.map +1 -1
  34. package/dist/src/tui/screen-registry.d.ts +10 -57
  35. package/dist/src/tui/screen-registry.js +1 -15
  36. package/dist/src/tui/screen-registry.js.map +1 -1
  37. package/package.json +3 -3
  38. package/dist/src/tui/catalog-management-screens.d.ts +0 -45
  39. package/dist/src/tui/catalog-management-screens.js +0 -25
  40. package/dist/src/tui/catalog-management-screens.js.map +0 -1
  41. package/dist/src/tui/catalog-management.d.ts +0 -240
  42. package/dist/src/tui/catalog-management.js +0 -856
  43. 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) {
@@ -1489,7 +1525,7 @@ export function createTuiControllerDependencies(context, progressFeed, options =
1489
1525
  if (blockedPlanTargets.length === 0)
1490
1526
  break;
1491
1527
  const requestedKeys = new Set(draft.executableTargets.map(pluginWriteTaskTargetKey));
1492
- const errorCodesByRoot = new Map();
1528
+ const blockedPlansByRoot = new Map();
1493
1529
  for (const blockedPlanTarget of blockedPlanTargets) {
1494
1530
  const pending = [blockedPlanTarget];
1495
1531
  const visited = new Set();
@@ -1533,25 +1569,45 @@ export function createTuiControllerDependencies(context, progressFeed, options =
1533
1569
  throw new TuiOperationBlockedError('taskPlanConsumerMissing', '任务计划中的阻止项无法映射到请求目标。');
1534
1570
  }
1535
1571
  for (const key of mappedRoots) {
1536
- const codes = errorCodesByRoot.get(key) ?? new Set();
1537
- codes.add(blockedPlanTarget.errorCode ?? 'writePlanBlocked');
1538
- errorCodesByRoot.set(key, codes);
1572
+ const plans = blockedPlansByRoot.get(key) ?? [];
1573
+ plans.push(blockedPlanTarget);
1574
+ blockedPlansByRoot.set(key, plans);
1539
1575
  }
1540
1576
  }
1541
1577
  blockedTargets.push(...draft.executableTargets.flatMap((target) => {
1542
- const codes = errorCodesByRoot.get(pluginWriteTaskTargetKey(target));
1543
- return codes ? [{
1578
+ const plans = blockedPlansByRoot.get(pluginWriteTaskTargetKey(target));
1579
+ return plans ? [{
1544
1580
  target,
1545
1581
  reason: 'targetUnavailable',
1546
1582
  issueIds: draft.causes.filter((cause) => cause.consumers.some((consumer) => pluginWriteTaskTargetKey(consumer) === pluginWriteTaskTargetKey(target)))
1547
1583
  .map((cause) => cause.issueId),
1548
- errorCodes: [...codes].sort((left, right) => left.localeCompare(right, 'en')),
1584
+ errorCodes: [...new Set(plans.map((plan) => plan.errorCode ?? 'writePlanBlocked'))]
1585
+ .sort((left, right) => left.localeCompare(right, 'en')),
1586
+ diagnostics: plans.map((plan, index) => ({
1587
+ id: `task-plan:${sourceId}:${target.pluginId}:${target.platform}:${target.scope}:${index}`,
1588
+ code: plan.errorCode ?? 'writePlanBlocked',
1589
+ stage: 'dependencyPlan',
1590
+ sourceId,
1591
+ target: {
1592
+ pluginId: plan.pluginId, platform: plan.platform,
1593
+ scope: plan.requestedScope ?? plan.resolvedScope,
1594
+ },
1595
+ causes: [],
1596
+ detailLines: [],
1597
+ safeMessage: plan.errorCode === 'artifactCollision'
1598
+ ? '输出位置存在外来内容,无法覆盖。'
1599
+ : plan.errorCode === 'exclusiveOwnerEvidenceInvalid'
1600
+ ? '独立扩展的归属标记缺失或损坏。'
1601
+ : plan.errorCode === 'dependencyNotReady'
1602
+ ? '依赖安装状态无法读取。'
1603
+ : '依赖计划阻止了此目标。',
1604
+ })),
1549
1605
  }] : [];
1550
1606
  }));
1551
- draft.executableTargets = draft.executableTargets.filter((target) => !errorCodesByRoot.has(pluginWriteTaskTargetKey(target)));
1607
+ draft.executableTargets = draft.executableTargets.filter((target) => !blockedPlansByRoot.has(pluginWriteTaskTargetKey(target)));
1552
1608
  draft.causes = draft.causes.map((cause) => ({
1553
1609
  ...cause,
1554
- consumers: cause.consumers.filter((consumer) => !errorCodesByRoot.has(pluginWriteTaskTargetKey(consumer))),
1610
+ consumers: cause.consumers.filter((consumer) => !blockedPlansByRoot.has(pluginWriteTaskTargetKey(consumer))),
1555
1611
  })).filter((cause) => cause.consumers.length > 0);
1556
1612
  }
1557
1613
  if (!preview?.operationPlan || draft.executableTargets.length === 0)
@@ -2149,7 +2205,18 @@ export function createTuiControllerDependencies(context, progressFeed, options =
2149
2205
  }
2150
2206
  const blocker = dependencyPlan.targets.find((target) => target.action === 'block');
2151
2207
  if (blocker) {
2152
- 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
+ }]);
2153
2220
  }
2154
2221
  }
2155
2222
  const managerPreview = preview?.codexManagerPreview;
@@ -2248,7 +2315,6 @@ export function createTuiControllerDependencies(context, progressFeed, options =
2248
2315
  return evidence;
2249
2316
  };
2250
2317
  const dependencies = {
2251
- catalogManagement,
2252
2318
  beginCatalogSession(sessionOptions) {
2253
2319
  sessionCatalogOperationContext = undefined;
2254
2320
  if (sessionOptions?.reuseValidatedGenerations !== true) {
@@ -2355,10 +2421,6 @@ export function createTuiControllerDependencies(context, progressFeed, options =
2355
2421
  return evidence.dependencyPlan;
2356
2422
  },
2357
2423
  async validateIntent(intent, signal) {
2358
- if (intent.kind === 'catalogManagement') {
2359
- signal.throwIfAborted();
2360
- return;
2361
- }
2362
2424
  if (intent.kind === 'catalogSourcesRecovery') {
2363
2425
  signal.throwIfAborted();
2364
2426
  return;
@@ -2606,25 +2668,6 @@ export function createTuiControllerDependencies(context, progressFeed, options =
2606
2668
  };
2607
2669
  },
2608
2670
  async executeIntent(intent, expectedEvidence, signal) {
2609
- if (intent.kind === 'catalogManagement') {
2610
- signal?.throwIfAborted();
2611
- if (!expectedEvidence.catalogManagement) {
2612
- throw new TuiOperationBlockedError('operationReviewStale', 'Catalog management Review evidence is missing.');
2613
- }
2614
- const progressLabels = {
2615
- validate: '验证 Catalog 状态',
2616
- build: '构建 Catalog snapshot',
2617
- source: '更新开发来源',
2618
- sync: '同步开发来源',
2619
- prune: '清理 Catalog store',
2620
- prepare: '准备发布计划',
2621
- remote: '写入 Catalog 远端',
2622
- verify: '验证操作结果',
2623
- };
2624
- return catalogManagement.execute(intent, expectedEvidence.catalogManagement, (stage) => {
2625
- progressFeed?.setCurrent({ target: 'Catalog 管理', phase: progressLabels[stage] }, `Catalog 管理:${progressLabels[stage]}`);
2626
- });
2627
- }
2628
2671
  if (intent.kind === 'catalogSourcesRecovery') {
2629
2672
  signal?.throwIfAborted();
2630
2673
  return recoverInvalidCatalogSourcesConfig({ env: context.env });